private void sc3_Clk() { CB0_ROLL_ID.Enabled = true; MasterCommon.Gp_Ms_Cls((Collection)Mc3["rControl"]); if (!sc3.Checked) { if (!sc1.Checked & !sc2.Checked & !sc4.Checked) { sc3.Checked = true; } return; } // If sc2.Value = -1 Then '-1: ssCBChecked sc3.ForeColor = Color.Red; sc1.ForeColor = Color.Black; sc1.Checked = false; sc2.ForeColor = Color.Black; sc2.Checked = false; sc4.ForeColor = Color.Black; sc4.Checked = false; //sf3.Enabled = true; //sf1.Enabled = false; //sf2.Enabled = false; //sf4.Enabled = false; ULabel16.Text = "轴承号"; sQuery_load = "SELECT BEARING_ID FROM GP_BEARING3 "; GeneralCommon.Gf_ComboAdd(CB0_ROLL_ID, sQuery_load); }
private void sc4_Clk() { CB0_ROLL_ID.Enabled = true; MasterCommon.Gp_Ms_Cls((Collection)Mc4["rControl"]); if (!sc4.Checked) { if (!sc1.Checked & !sc2.Checked & !sc3.Checked) { sc4.Checked = true; } return; } sc4.ForeColor = Color.Red; sc1.ForeColor = Color.Black; sc1.Checked = false; sc2.ForeColor = Color.Black; sc2.Checked = false; sc3.ForeColor = Color.Black; sc3.Checked = false; //sf4.Enabled = true; //sf1.Enabled = false; //sf2.Enabled = false; //sf3.Enabled = false; ULabel16.Text = "护板号"; sQuery_load = "SELECT PLANK_NO FROM GP_PLANK3 "; GeneralCommon.Gf_ComboAdd(CB0_ROLL_ID, sQuery_load); }
private void sc2_Clk() { CBO_ROLL_NO.Enabled = true; MasterCommon.Gp_Ms_Cls((Collection)Mc1["rControl"]); if (!sc2.Checked) { if (!sc3.Checked & !sc4.Checked) { sc2.Checked = true; } return; } sc2.ForeColor = Color.Red; sc3.ForeColor = Color.Black; sc3.Checked = false; sc4.ForeColor = Color.Black; sc4.Checked = false; //sf2.Enabled = true; //sf1.Enabled = false; //sf3.Enabled = false; //sf4.Enabled = false; ULabel16.Text = "轴承座号"; sQuery_load = "SELECT CHOCK_ID FROM GP_CHOCK3 "; GeneralCommon.Gf_ComboAdd(CBO_ROLL_NO, sQuery_load); }
private void sc1_Clk() { CB0_ROLL_ID.Enabled = true; MasterCommon.Gp_Ms_Cls((Collection)Mc1["rControl"]); if (!sc1.Checked) { if (!sc2.Checked & !sc3.Checked & !sc4.Checked) { sc1.Checked = true; } return; } sc1.ForeColor = Color.Red; sc2.ForeColor = Color.Black; sc2.Checked = false; sc3.ForeColor = Color.Black; sc3.Checked = false; sc4.ForeColor = Color.Black; sc4.Checked = false; //sf1.Enabled = true; //sf2.Enabled = false; //sf3.Enabled = false; //sf4.Enabled = false; ULabel16.Text = "轧辊号"; sQuery_load = "SELECT ROLL_NO FROM GP_ROLL3 WHERE ROLL_STATUS<>'DL' ORDER BY SUBSTR(ROLL_NO,1,1) DESC, SUBSTR(ROLL_NO,6,2) "; GeneralCommon.Gf_ComboAdd(CB0_ROLL_ID, sQuery_load); }
public void Form_Pro() { MasterCommon mc = new MasterCommon(); if (mc.Gf_Ms_Process(GeneralCommon.M_CN1, m_Master, "1111")) { } }
public override void Form_Ref() { if (Gf_Sp_Display(GeneralCommon.M_CN1, ss1, MasterCommon.Gf_Ms_MakeQuery((string)(Sc1["P-R"]), "R", (Collection)Mc1["pControl"]), (Collection)Sc1["pColumn"], false)) { Gf_Sp_Display2(GeneralCommon.M_CN1, ss2, MasterCommon.Gf_Ms_MakeQuery((string)(Sc2["P-R"]), "R", (Collection)Mc1["pControl"]), (Collection)Sc2["pColumn"], false); Gf_Sp_Display3(GeneralCommon.M_CN1, ss3, MasterCommon.Gf_Ms_MakeQuery((string)(Sc3["P-R"]), "R", (Collection)Mc1["pControl"]), (Collection)Sc3["pColumn"], false); SearchCommentsData(); } }
private void ssResult2Ctl() { if (ssResult.Rows.Count > 1) { if (GeneralCommon.DD_New.sWitch == "MS" || GeneralCommon.DD_New.sWitch == "CUS") { /* 控件F4涉及到两个信息 CD/CD_NAME两个信息分别填写在TextBox的两个部分. */ /* rControl[1] 保存CD, rControl[2] 保存CD_NAME. * */ int i = 0; string CtlAtt = ""; for (i = 0; i < GeneralCommon.DD_New.sContrl.Count; i++) { CtlAtt = GeneralCommon.DD_New.sCtlAttr[i].ToString().ToUpper(); if (CtlAtt.Contains("I")) { Control Ctr = (Control)GeneralCommon.DD_New.sContrl[i]; MasterCommon.SetControlValue(Ctr, ssResult[ssResult.RowSel, Convert.ToInt32(GeneralCommon.DD_New.siCol[i])].ToString()); } } } else { FlexGrid_User oFlexGrid = (FlexGrid_User)GeneralCommon.DD_New.sPname; /* 只将代码赋值给原来的F4列上. */ // oFlexGrid[oFlexGrid.RowSel, oFlexGrid.ColSel] = ssResult[ssResult.RowSel, 1].ToString(); int i = 0; string CtlAtt = ""; for (i = 0; i < GeneralCommon.DD_New.sContrl.Count; i++) { CtlAtt = GeneralCommon.DD_New.sCtlAttr[i].ToString().ToUpper(); if (CtlAtt.Contains("I")) { // Control Ctr = (Control)GeneralCommon.DD_New.sContrl[i]; SpreadCommon.SetCellValue(oFlexGrid, oFlexGrid.RowSel, ((C1.Win.C1FlexGrid.Column)GeneralCommon.DD_New.sContrl[i]).Index, ssResult[ssResult.RowSel, Convert.ToInt32(GeneralCommon.DD_New.siCol[i])].ToString()); } } } } }
private void DataDic_Activated(object sender, EventArgs e) { if (ssWhere.Cols.Count < 2) { this.Close(); return; } ssWhere_setting(); ssResult_setting(); if (GeneralCommon.DD_New.sWitch == "CUS" || GeneralCommon.DD_New.sWitch == "MS") { if (GeneralCommon.DD_New.DicRefType == "C") { for (int i = 0; i < GeneralCommon.DD_New.sContrl.Count; i++) { if (GeneralCommon.DD_New.sCtlAttr[i].ToString().Contains("R") || GeneralCommon.DD_New.sCtlAttr[i].ToString().Contains("P")) { ssWhere[1, Convert.ToInt32(GeneralCommon.DD_New.siCol[i])] = MasterCommon.GetControlValue(GeneralCommon.DD_New.sContrl[i]); } } } } else if (GeneralCommon.DD_New.sWitch == "SP") {//待检查 FlexGrid_User oFlexGrid = (FlexGrid_User)GeneralCommon.DD_New.sPname; if (GeneralCommon.DD_New.DicRefType == "C") { for (int i = 0; i < GeneralCommon.DD_New.sContrl.Count; i++) { if (GeneralCommon.DD_New.sCtlAttr[i].ToString().Contains("R") || GeneralCommon.DD_New.sCtlAttr[i].ToString().Contains("P")) { ssWhere[1, Convert.ToInt32(GeneralCommon.DD_New.siCol[i])] = SpreadCommon.GetCellValue((FlexGrid_User)GeneralCommon.DD_New.sPname, ((FlexGrid_User)GeneralCommon.DD_New.sPname).RowSel, ((C1.Win.C1FlexGrid.Column)GeneralCommon.DD_New.sContrl[i]).Index).ToString().Trim(); } } } // ssWhere[1,1] = oFlexGrid[oFlexGrid.RowSel, Convert.ToInt32(GeneralCommon.rControl[0].ToString())].ToString(); } ssWhere.Select(1, 1); this.BackColor = GeneralCommon.VbFormBKColor; }
//--------------------------------------------------------------------------------------- // 1.ID : Gf_Only_Display // 2.Input Value : Conn Connection, Sc Collection, sQuery String, // {iDupCnt Long}, {nCheckControl Collection}, {mCheckControl Collection}, // {MsgChk Boolean}, {EvenRowChk Boolean} // 3.Return Value : Boolean // 4.Create Date : // 5.Modify Date : // 6.Comment : Only Display //--------------------------------------------------------------------------------------- public bool Gf_Only_Display(ADODB.Connection Conn, Collection Sc, string sQuery, int iDupCnt, Collection nCheckControl, Collection mCheckControl, bool MsgChk, bool EvenRowChk) { bool returnValue = false; SpreadCommon SpreadCommon = new SpreadCommon(); MasterCommon MasterCommon = new MasterCommon(); int JJ; int j; int lRowCount; int lColCount; string sMsg; string[] sTemp; string sSpreadClip; ADODB.Recordset AdoRs; object ArrayRecords; //Db Connection Check if (Conn.State == 0) { if (GeneralCommon.GF_DbConnect() == false) { returnValue = false; } return(returnValue); } try { if (nCheckControl != null) { sMsg = MasterCommon.Gf_Ms_NeceCheck(nCheckControl); if (sMsg != "OK") { sMsg = "必须输入 " + sMsg.Trim() + " ...!!!"; GeneralCommon.Gp_MsgBoxDisplay(sMsg, "", ""); returnValue = false; return(returnValue); } } if (mCheckControl != null) { sMsg = MasterCommon.Gf_Ms_NeceCheck2(mCheckControl); if (sMsg != "OK") { sMsg = "输入的项目必须符合 " + sMsg.Trim() + " 的长度...!!!"; GeneralCommon.Gp_MsgBoxDisplay(sMsg, "", ""); returnValue = false; return(returnValue); } } AdoRs = new ADODB.Recordset(); FarPoint.Win.Spread.FpSpread with_1 = (FarPoint.Win.Spread.FpSpread)Sc["Spread"]; returnValue = true; with_1.Sheets[0].RowCount = 0; //with_1.ReDraw = false; with_1.Sheets[0].RowCount = 0; Cursor.Current = Cursors.WaitCursor; //Ado Execute AdoRs.Open(sQuery, Conn, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockReadOnly, -1); if (AdoRs.BOF || AdoRs.EOF) { if (MsgChk) { GeneralCommon.Gp_MsgBoxDisplay("无法找到该资料...!!!", "I", ""); } returnValue = false; //with_1.ReDraw = true; AdoRs.Close(); AdoRs = null; Cursor.Current = Cursors.Default; return(returnValue); } ArrayRecords = AdoRs.GetRows(); AdoRs.Close(); AdoRs = null; if (iDupCnt > 0) { sTemp = new string[iDupCnt + 1]; } if ((AdoRs.RecordCount - 1) >= 0) { with_1.Sheets[0].RowCount = AdoRs.RecordCount; for (lRowCount = 0; lRowCount <= AdoRs.RecordCount - 1; lRowCount++) { sSpreadClip = ""; for (lColCount = iDupCnt; lColCount <= AdoRs.Fields.Count; lColCount++) { sSpreadClip = sSpreadClip + AdoRs.Fields[lColCount].Value.ToString() + '\t'; } with_1.Sheets[0].SetClip(lRowCount, 0, lRowCount, lColCount, sSpreadClip); } } if (EvenRowChk) { SpreadCommon.Gp_Sp_EvenRowBackcolor((FarPoint.Win.Spread.FpSpread)Sc["Spread"], 0); } //.OperationMode = FPSpread.OperationModeConstants.OperationModeRow //with_1.ReDraw = true; returnValue = true; Cursor.Current = Cursors.Default; return(returnValue); } catch (Exception ex) { AdoRs = null; returnValue = false; Cursor.Current = Cursors.Default; GeneralCommon.Gp_MsgBoxDisplay((string)("Gf_Only_Display Error : " + ex.Message), "", ""); } return(returnValue); }
public static void Gp_F4Find(Control F4) { string sWhere = ""; string sQuery = ""; if (F4 is F4COMN) { F4COMN f4_temp = (F4COMN)F4; if (f4_temp.Get_Witch() == "MS" || f4_temp.Get_Witch() == "CUS") { if (!string.IsNullOrEmpty(f4_temp.CusSql)) { sQuery = f4_temp.CusSql; sWhere = ""; } else if (!string.IsNullOrEmpty(f4_temp.PrcoCode)) { string callSql = "{call " + f4_temp.PrcoCode + "("; string Par = ""; for (int i = 0; i < f4_temp.Contrl.Count; i++) { if (f4_temp.CtlAttr[i].ToString().ToUpper().Contains("R")) { Par += "'" + MasterCommon.GetControlValue(f4_temp.Contrl[i]).ToString().Replace("'", "''") + "',"; } } if (Par.Length > 0) { Par = Par.Substring(0, Par.Length - 1); } callSql = callSql + Par + ")}"; sQuery = callSql; sWhere = ""; } else { string sQuery_temp = " "; string sWhere_after = ""; string sWhere_before = ""; string sOrder_Temp = " "; if (f4_temp.KeyName.Trim().Length > 0 && f4_temp.Key.Trim().Length > 0) { sWhere_before = "where " + f4_temp.KeyName.Trim() + "='" + f4_temp.Key.Trim() + "' and "; } else { sWhere_before = "where "; } sQuery = " SELECT "; //拼Where 后面的限制条件 和 Select 后的字段 for (int i = 0; i < f4_temp.Contrl.Count; i++) { if (!string.IsNullOrEmpty(Convert.ToString(f4_temp.BackName[i]))) { if (f4_temp.CtlAttr[i].ToString().ToUpper().Contains("R") && !f4_temp.CtlAttr[i].ToString().ToUpper().Contains("P")) { sWhere_after += "and nvl(" + f4_temp.BackName[i].ToString().Trim() + ",'') LIKE '%" + MasterCommon.GetControlValue(f4_temp.Contrl[i]).ToString().Trim().Replace("'", "''") + "%' "; } else if (f4_temp.CtlAttr[i].ToString().ToUpper().Contains("P")) { sWhere_after += "and " + f4_temp.BackName[i].ToString().Trim() + " LIKE '%" + MasterCommon.GetControlValue(f4_temp.Contrl[i]).ToString().Trim().Replace("'", "''") + "%' "; sOrder_Temp += " " + f4_temp.BackName[i].ToString().Trim() + " Asc ,"; } if (string.IsNullOrEmpty(Convert.ToString(f4_temp.ColName[i]))) { sQuery_temp += " " + f4_temp.BackName[i] + " \" " + f4_temp.BackName[i] + " \","; } sQuery_temp += " " + f4_temp.BackName[i] + " \" " + f4_temp.ColName[i] + " \","; } } sQuery += sQuery_temp.Substring(0, sQuery_temp.Length - 1) + " FROM " + f4_temp.BackTableName + " "; sQuery += sWhere_before; sWhere_after += " "; // if (!sWhere_before.Contains("=")) { sWhere_after = sWhere_after.Substring(4); } sWhere += sWhere_after + " "; sWhere += " " + f4_temp.Join; if (!string.IsNullOrEmpty(f4_temp.OrderBy)) { sWhere += " " + f4_temp.OrderBy; } else { sWhere += " order by " + sOrder_Temp.Substring(0, sOrder_Temp.Length - 1); } } } System.Data.DataTable DataTab = GeneralCommon.Gf_ExecProc2Ref(sQuery + sWhere); if (DataTab.Rows.Count == 1) { int i = 0; string CtlAtt = ""; for (i = 0; i < f4_temp.Contrl.Count; i++) { CtlAtt = f4_temp.CtlAttr[i].ToString().ToUpper(); if (CtlAtt.Contains("I")) { Control Ctr = (Control)f4_temp.Contrl[i]; MasterCommon.SetControlValue(Ctr, DataTab.Rows[0][Convert.ToInt32(f4_temp.iCol[i]) - 1]); } } } } else if (F4 is F4COMR) { F4COMR f4_temp = (F4COMR)F4; if (f4_temp.Get_Witch() == "MS" || f4_temp.Get_Witch() == "CUS") { if (!string.IsNullOrEmpty(f4_temp.CusSql)) { sQuery = f4_temp.CusSql; sWhere = ""; } else if (!string.IsNullOrEmpty(f4_temp.PrcoCode)) { string callSql = "{call " + f4_temp.PrcoCode + "("; string Par = ""; for (int i = 0; i < f4_temp.Contrl.Count; i++) { if (f4_temp.CtlAttr[i].ToString().ToUpper().Contains("R")) { Par += "'" + MasterCommon.GetControlValue(f4_temp.Contrl[i]).ToString().Replace("'", "''") + "',"; } } if (Par.Length > 0) { Par = Par.Substring(0, Par.Length - 1); } callSql = callSql + Par + ")}"; sQuery = callSql; sWhere = ""; } else { string sQuery_temp = " "; string sWhere_after = ""; string sWhere_before = ""; string sOrder_Temp = " "; if (f4_temp.KeyName.Trim().Length > 0 && f4_temp.Key.Trim().Length > 0) { sWhere_before = "where " + f4_temp.KeyName.Trim() + "='" + f4_temp.Key.Trim() + "' and "; } else { sWhere_before = "where "; } sQuery = " SELECT "; //拼Where 后面的限制条件 和 Select 后的字段 for (int i = 0; i < f4_temp.Contrl.Count; i++) { if (!string.IsNullOrEmpty(Convert.ToString(f4_temp.BackName[i]))) { if (f4_temp.CtlAttr[i].ToString().ToUpper().Contains("R") && !f4_temp.CtlAttr[i].ToString().ToUpper().Contains("P")) { sWhere_after += "and nvl(" + f4_temp.BackName[i].ToString().Trim() + ",'') LIKE '%" + MasterCommon.GetControlValue(f4_temp.Contrl[i]).ToString().Trim().Replace("'", "''") + "%' "; } else if (f4_temp.CtlAttr[i].ToString().ToUpper().Contains("P")) { sWhere_after += "and " + f4_temp.BackName[i].ToString().Trim() + " LIKE '%" + MasterCommon.GetControlValue(f4_temp.Contrl[i]).ToString().Trim().Replace("'", "''") + "%' "; sOrder_Temp += " " + f4_temp.BackName[i].ToString().Trim() + " Asc ,"; } if (string.IsNullOrEmpty(Convert.ToString(f4_temp.ColName[i]))) { sQuery_temp += " " + f4_temp.BackName[i] + " \" " + f4_temp.BackName[i] + " \","; } sQuery_temp += " " + f4_temp.BackName[i] + " \" " + f4_temp.ColName[i] + " \","; } } sQuery += sQuery_temp.Substring(0, sQuery_temp.Length - 1) + " FROM " + f4_temp.BackTableName + " "; sQuery += sWhere_before; sWhere_after += " "; // if (!sWhere_before.Contains("=")) { sWhere_after = sWhere_after.Substring(4); } sWhere += sWhere_after + " "; sWhere += " " + f4_temp.Join; if (!string.IsNullOrEmpty(f4_temp.OrderBy)) { sWhere += " " + f4_temp.OrderBy; } else { sWhere += " order by " + sOrder_Temp.Substring(0, sOrder_Temp.Length - 1); } } } System.Data.DataTable DataTab = GeneralCommon.Gf_ExecProc2Ref(sQuery + sWhere); if (DataTab.Rows.Count == 1) { int i = 0; string CtlAtt = ""; for (i = 0; i < f4_temp.Contrl.Count; i++) { CtlAtt = f4_temp.CtlAttr[i].ToString().ToUpper(); if (CtlAtt.Contains("I")) { Control Ctr = (Control)f4_temp.Contrl[i]; MasterCommon.SetControlValue(Ctr, DataTab.Rows[0][Convert.ToInt32(f4_temp.iCol[i]) - 1]); } } } } else { throw new System.Exception("Gp_DD_Collection没有找到控件" + F4.Name); } }
//--------------------------------------------------------------------------------------- // 1.ID : Gf_DD_Display // 2.Input Value : Conn Connection, sQuery String, [MsgChk Boolean] // 3.Return Value : Boolean // 4.Create Date : // 5.Modify Date : // 6.Comment : Data Dictionary Result Data Display //--------------------------------------------------------------------------------------- public static bool Gf_Common_DD(Keys KeyCode) { SpreadCommon SpreadCommon = new SpreadCommon(); string sOld_Code = ""; string sNew_Code = ""; // string sOld_Name = ""; string sNew_Name = ""; /* 如果退出F4窗口. */ if (KeyCode == Keys.Return || KeyCode == Keys.Escape || GeneralCommon.GF_DbConnect() == false) { GeneralCommon.Gp_DD_New_Clear(); return(false); } GeneralCommon.DD_New.DicRefType = "C"; //Active Form DataDic Call try { if (GeneralCommon.DD_New.sWitch == "MS" || GeneralCommon.DD_New.sWitch == "CUS") { if (!string.IsNullOrEmpty(GeneralCommon.DD_New.sCusCode)) { GeneralCommon.DD_New.sQuery = GeneralCommon.DD_New.sCusCode; GeneralCommon.DD_New.sWhere = ""; } else if (!string.IsNullOrEmpty(GeneralCommon.DD_New.sPrcoCode)) { string callSql = "{call " + GeneralCommon.DD_New.sPrcoCode + "("; string Par = ""; for (int i = 0; i < GeneralCommon.DD_New.sContrl.Count; i++) { if (GeneralCommon.DD_New.sCtlAttr[i].ToString().ToUpper().Contains("R")) { Par += "'" + MasterCommon.GetControlValue(GeneralCommon.DD_New.sContrl[i]).ToString().Replace("'", "''") + "',"; } } if (Par.Length > 0) { Par = Par.Substring(0, Par.Length - 1); } callSql = callSql + Par + ")}"; GeneralCommon.DD_New.sQuery = callSql; GeneralCommon.DD_New.sWhere = ""; } else { string sQuery_temp = " "; string sWhere_after = ""; string sWhere_before = ""; string sOrder_Temp = " "; if (GeneralCommon.DD_New.sKeyName.Trim().Length > 0 && GeneralCommon.DD_New.sKey.Trim().Length > 0) { sWhere_before = "where " + GeneralCommon.DD_New.sKeyName.Trim() + "='" + GeneralCommon.DD_New.sKey.Trim() + "' and "; } else { sWhere_before = "where "; } GeneralCommon.DD_New.sQuery = " SELECT "; //拼Where 后面的限制条件 和 Select 后的字段 for (int i = 0; i < GeneralCommon.DD_New.sContrl.Count; i++) { if (!string.IsNullOrEmpty(Convert.ToString(GeneralCommon.DD_New.sBackName[i]))) { if (GeneralCommon.DD_New.sCtlAttr[i].ToString().ToUpper().Contains("R") && !GeneralCommon.DD_New.sCtlAttr[i].ToString().ToUpper().Contains("P")) { sWhere_after += "and nvl(" + GeneralCommon.DD_New.sBackName[i].ToString().Trim() + ",f_nullvalue('" + GeneralCommon.DD_New.sBackTableName + "','" + GeneralCommon.DD_New.sBackName[i].ToString().Trim() + "')) LIKE '%" + MasterCommon.GetControlValue(GeneralCommon.DD_New.sContrl[i]).ToString().Trim().Replace("'", "''") + "%' "; } else if (GeneralCommon.DD_New.sCtlAttr[i].ToString().ToUpper().Contains("P")) { sWhere_after += "and " + GeneralCommon.DD_New.sBackName[i].ToString().Trim() + " LIKE '%" + MasterCommon.GetControlValue(GeneralCommon.DD_New.sContrl[i]).ToString().Trim().Replace("'", "''") + "%' "; sOrder_Temp += " " + GeneralCommon.DD_New.sBackName[i].ToString().Trim() + " Asc ,"; } if (string.IsNullOrEmpty(Convert.ToString(GeneralCommon.DD_New.sColName[i]))) { sQuery_temp += " " + GeneralCommon.DD_New.sBackName[i] + " \" " + GeneralCommon.DD_New.sBackName[i] + " \","; } sQuery_temp += " " + GeneralCommon.DD_New.sBackName[i] + " \" " + GeneralCommon.DD_New.sColName[i] + " \","; } } GeneralCommon.DD_New.sQuery += sQuery_temp.Substring(0, sQuery_temp.Length - 1) + " FROM " + GeneralCommon.DD_New.sBackTableName + " "; GeneralCommon.DD_New.sQuery += sWhere_before; sWhere_after += " "; // if (!sWhere_before.Contains("=")) { sWhere_after = sWhere_after.Substring(4); } GeneralCommon.DD_New.sWhere += sWhere_after + " "; GeneralCommon.DD_New.sWhere += " " + GeneralCommon.DD_New.sJoin; if (!string.IsNullOrEmpty(GeneralCommon.DD_New.sOrderBy)) { GeneralCommon.DD_New.sWhere += " " + GeneralCommon.DD_New.sOrderBy; } else { GeneralCommon.DD_New.sWhere += " order by " + sOrder_Temp.Substring(0, sOrder_Temp.Length - 1); } } } else {//带检查 if (!string.IsNullOrEmpty(GeneralCommon.DD_New.sCusCode)) { GeneralCommon.DD_New.sQuery = GeneralCommon.DD_New.sCusCode; GeneralCommon.DD_New.sWhere = ""; } else if (!string.IsNullOrEmpty(GeneralCommon.DD_New.sPrcoCode)) { string callSql = "{call " + GeneralCommon.DD_New.sPrcoCode + "("; string Par = ""; for (int i = 0; i < GeneralCommon.DD_New.sContrl.Count; i++) { if (GeneralCommon.DD_New.sCtlAttr[i].ToString().ToUpper().Contains("R")) { Par += "'" + SpreadCommon.GetColValue((C1.Win.C1FlexGrid.Column)GeneralCommon.DD_New.sContrl[i]).ToString().Replace("'", "''") + "',"; } } if (Par.Length > 0) { Par = Par.Substring(0, Par.Length - 1); } callSql = callSql + Par + ")}"; GeneralCommon.DD_New.sQuery = callSql; GeneralCommon.DD_New.sWhere = ""; } else { string sQuery_temp = " "; string sWhere_after = ""; string sWhere_before = ""; string sOrder_Temp = " "; if (GeneralCommon.DD_New.sKeyName.Trim().Length > 0 && GeneralCommon.DD_New.sKey.Trim().Length > 0) { sWhere_before = "where " + GeneralCommon.DD_New.sKeyName.Trim() + "='" + GeneralCommon.DD_New.sKey.Trim() + "' "; } else { sWhere_before = "where "; } GeneralCommon.DD_New.sQuery = " SELECT "; //拼Where 后面的限制条件 和 Select 后的字段 for (int i = 0; i < GeneralCommon.DD_New.sContrl.Count; i++) { if (!string.IsNullOrEmpty(Convert.ToString(GeneralCommon.DD_New.sBackName[i]))) { if (GeneralCommon.DD_New.sCtlAttr[i].ToString().ToUpper().Contains("R") && !GeneralCommon.DD_New.sCtlAttr[i].ToString().ToUpper().Contains("P")) { sWhere_after += "and nvl(" + GeneralCommon.DD_New.sBackName[i].ToString().Trim() + ",'%') LIKE '%" + SpreadCommon.GetCellValue((FlexGrid_User)GeneralCommon.DD_New.sPname, ((FlexGrid_User)GeneralCommon.DD_New.sPname).RowSel, ((C1.Win.C1FlexGrid.Column)GeneralCommon.DD_New.sContrl[i]).Index).ToString().Trim().Replace("'", "''") + "%' "; } else if (GeneralCommon.DD_New.sCtlAttr[i].ToString().ToUpper().Contains("P")) { sWhere_after += "and " + GeneralCommon.DD_New.sBackName[i].ToString().Trim() + " LIKE '%" + SpreadCommon.GetCellValue((FlexGrid_User)GeneralCommon.DD_New.sPname, ((FlexGrid_User)GeneralCommon.DD_New.sPname).RowSel, ((C1.Win.C1FlexGrid.Column)GeneralCommon.DD_New.sContrl[i]).Index).ToString().Trim().Replace("'", "''") + "%' "; sOrder_Temp += " " + GeneralCommon.DD_New.sBackName[i].ToString().Trim() + " Asc ,"; } if (string.IsNullOrEmpty(Convert.ToString(GeneralCommon.DD_New.sColName[i]))) { sQuery_temp += " " + GeneralCommon.DD_New.sBackName[i] + " \" " + GeneralCommon.DD_New.sBackName[i] + " \","; } sQuery_temp += " " + GeneralCommon.DD_New.sBackName[i] + " \" " + GeneralCommon.DD_New.sColName[i] + " \","; } } GeneralCommon.DD_New.sQuery += sQuery_temp.Substring(0, sQuery_temp.Length - 1) + " FROM " + GeneralCommon.DD_New.sBackTableName + " "; GeneralCommon.DD_New.sQuery += sWhere_before; sWhere_after += " "; // if (!sWhere_before.Contains("=")) { sWhere_after = sWhere_after.Substring(4); } GeneralCommon.DD_New.sWhere += sWhere_after + " "; GeneralCommon.DD_New.sWhere += " " + GeneralCommon.DD_New.sJoin; if (!string.IsNullOrEmpty(GeneralCommon.DD_New.sOrderBy)) { GeneralCommon.DD_New.sWhere += " " + GeneralCommon.DD_New.sOrderBy; } else { GeneralCommon.DD_New.sWhere += " order by " + sOrder_Temp.Substring(0, sOrder_Temp.Length - 1); } } //FlexGrid_User oFlexGrid = (FlexGrid_User)GeneralCommon.DD_New.sPname; ///* 取出当前单元格编辑的内容. */ //sOld_Code = "";//oFlexGrid[oFlexGrid.RowSel, Convert.ToInt32(GeneralCommon.rControl[0])].ToString(); //GeneralCommon.DD_New.sQuery = " SELECT CD \"代码\", CD_SHORT_NAME \"代码简称\", CD_NAME \"代码名称\", "; //GeneralCommon.DD_New.sQuery += " CD_SHORT_ENG \"代码英文简称\", CD_FULL_ENG \"代码英文名称\" FROM TZ_CD "; //GeneralCommon.DD_New.sQuery += " WHERE CD_MANA_NO = '" + GeneralCommon.DD.sKey.Trim() + "' "; //GeneralCommon.DD_New.sWhere += " and CD LIKE '" + sOld_Code.Trim() + "%' "; ///* 判断当前传入查询参数的个数. */ //if (GeneralCommon.rControl.Count > 0) //{ // //sOld_Code = oFlexGrid[oFlexGrid.RowSel, Convert.ToInt32(((System.Windows.Forms.TextBox)(GeneralCommon.rControl[2])).Text)].ToString(); // sOld_Code = oFlexGrid[oFlexGrid.RowSel, Convert.ToInt32(GeneralCommon.rControl[0])].ToString(); // //} // GeneralCommon.DD_New.sWhere += " and NVL(CD_NAME,'%') LIKE '" + sOld_Name.Trim() + "%' "; // GeneralCommon.DD_New.sWhere += " AND CD != ' ' "; // GeneralCommon.DD_New.sWhere += " AND APLY_STD = '1' "; // if (!string.IsNullOrEmpty(GeneralCommon.DD_New.sJoin)) // { // GeneralCommon.DD_New.sWhere += " and " + GeneralCommon.DD_New.sJoin + "Order by CD"; // } //} } if (Gf_DD_Display(GeneralCommon.DD_New.sQuery + GeneralCommon.DD_New.sWhere, false)) { /* F4 窗口退出处理程序 [FlexGrid中的F4功能] */ if (GeneralCommon.DD_New.sWitch == "SP") { /* 如果当前为 Spread F4 控件. */ FlexGrid_User oFlexGrid = (FlexGrid_User)GeneralCommon.DD_New.sPname; sNew_Code = oFlexGrid[oFlexGrid.RowSel, Convert.ToInt32((GeneralCommon.rControl[0]))].ToString(); if (GeneralCommon.rControl.Count > 0) { sNew_Name = oFlexGrid[oFlexGrid.RowSel, Convert.ToInt32((GeneralCommon.rControl[0]))].ToString(); } switch (oFlexGrid.Rows[oFlexGrid.RowSel].Caption) { case "插入": break; case "删除": break; case "修改": break; default: { //ss.ActiveSheet.RowHeader.Cells[ss.ActiveSheet.ActiveRowIndex, 0].Text = "Update"; oFlexGrid.Rows[oFlexGrid.RowSel].Caption = "修改"; break; } } if (GeneralCommon.DD_New.sSelect) { if (sOld_Code != sNew_Code) { SpreadCommon.Gp_Sp_UpdateMark(oFlexGrid, true); } } } } GeneralCommon.Gp_DD_New_Clear(); return(true); } catch (Exception ex) { GeneralCommon.Gp_DD_Clear(); GeneralCommon.Gp_MsgBoxDisplay("DataDic 查询出错啦...!!!" + ex.Message, "I"); return(false); } }