From 428a4a5d860c121271c426015c08b646258b85d6 Mon Sep 17 00:00:00 2001 From: zrg <z18737863051@163.com> Date: 星期四, 08 五月 2025 15:51:48 +0800 Subject: [PATCH] 增加注释 --- WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCoordinateExcelFrom.cs | 241 +++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 198 insertions(+), 43 deletions(-) diff --git a/WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCoordinateExcelFrom.cs b/WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCoordinateExcelFrom.cs index 4aaf1c9..04a86cf 100644 --- a/WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCoordinateExcelFrom.cs +++ b/WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCoordinateExcelFrom.cs @@ -6,6 +6,8 @@ using NPOI.XSSF.UserModel; // 瀵逛簬.xlsx鏂囦欢 using NPOI.HSSF.UserModel; // 瀵逛簬.xls鏂囦欢 using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Drawing; namespace WFormReadData_SMR { @@ -24,14 +26,20 @@ this.cmbJYSelect.SelectedIndex = 0; this.cmbJYSelect.DropDownStyle = ComboBoxStyle.DropDownList; + + //鎵规鐮佸彧璇� this.txtPcm.ReadOnly = true; //璺緞鍙 this.txtLj.ReadOnly = true; this.txtPcm.ReadOnly = true; - - + //鍒跺崟缂栫爜鍙 + this.txtHMakerNumber.ReadOnly = true; + //鍒跺崟浜烘彁绀� + this.txtHMaker.ForeColor = Color.LightGray; + this.txtHMaker.Text = "璇疯緭鍏ョ敤鎴风紪鐮�!"; + SelectHProList(); } private void btnLj_Click(object sender, EventArgs e) @@ -43,7 +51,6 @@ MessageBox.Show("娴佽浆鍗℃病鏈夋壂鎻�!"); } else { - //璺緞璧嬪�肩粰鏂囨湰 using (FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog()) { @@ -115,8 +122,8 @@ } } - //鏄剧ず鏁版嵁 - ShowData(ds); + //鏄剧ず鏁版嵁 CMR-L-066 杞粨浠� + ShowData(ds, "CMR-L-066"); } //鏍规嵁鏂囦欢璺緞鎵惧埌瀵瑰簲鏂囦欢 骞惰幏鍙栧搴旂殑鏁版嵁 @@ -169,15 +176,17 @@ if (nums == 1) { dr["Characteristic"] = "FAI 3-16-3-" + (i + 1); - dr["Actual"] = dt2.Rows[0][dt2.Columns[j]].ToString(); } else { dr["Characteristic"] = "FAI 3-16-1-" + (i + 1); - dr["Actual"] = dt2.Rows[0][dt2.Columns[j]].ToString(); } + dr["Actual"] = dt2.Rows[i][dt2.Columns[j]].ToString(); - dt.Rows.Add(dr); + if (dt2.Rows[i][dt2.Columns[j]].ToString() != "") { + dt.Rows.Add(dr); + } + nums++; if (nums == 2) @@ -254,8 +263,8 @@ } } } - //鏄剧ず鏁版嵁 - ShowData(ds); + //鏄剧ず鏁版嵁 CMR-L-067 涓夊潗鏍� + ShowData(ds, "CMR-L-067"); } //鏍规嵁鏂囦欢璺緞鎵惧埌瀵瑰簲鏂囦欢 骞惰幏鍙栧搴旂殑鏁版嵁 @@ -322,7 +331,8 @@ } //鎶婃暟鎹樉绀哄湪椤甸潰涓� - public void ShowData(DataSet ds) { + public void ShowData(DataSet ds,string HNumber) { + string HProcID = this.cmbPro.SelectedValue.ToString(); //娓呯┖缃戞牸鍐呭 ListData.Items.Clear(); //娓呯┖琛ㄦ牸鍐呭 @@ -336,17 +346,20 @@ dataTable.Columns.Add("Actual"); dataTable.Columns.Add("HUpLimit"); dataTable.Columns.Add("HDownLimit"); + dataTable.Columns.Add("HInspectInstruMentID"); for (int i = 0; i < ds.Tables.Count; i++) { - //淇敼鏄湪鍝釜璁惧涓婅繘琛岀殑鏁版嵁閲囬泦 b.HInspectInstruMentID=1 涓夊潗鏍�1 杞粨浠�2 - DataSet dataSet = oCN.RunProcReturn(@"select a.HInterID HQCSchemeID,b.HQCCheckItemID, ch.HNumber HQCCheckItemNumber,m.HNumber,HUpLimit,HDownLimit,HTargetVal + //淇敼 鏄湪鍝釜璁惧涓婅繘琛岀殑鏁版嵁閲囬泦 b.HInspectInstruMentID=1 涓夊潗鏍�1 杞粨浠�2 + //鏌ヨ褰撳墠娴佽浆鍗� 浠ュ強 宸ュ簭 瀵瑰簲鐨勬楠屾柟妗堟槸鍚﹀瓨鍦� + DataSet dataSet = oCN.RunProcReturn(@"select b.HInspectInstruMentID,a.HInterID HQCSchemeID,b.HQCCheckItemID, ch.HNumber HQCCheckItemNumber,m.HNumber,HUpLimit,HDownLimit,HTargetVal from Sc_ProcessExchangeBillMain pr with(nolock) inner join Gy_QCCheckProjectMain a with(nolock) on pr.HMaterID=a.HMaterID -inner join Gy_QCCheckProjectSub b with(nolock) on a.HInterID=b.HInterID and b.HInspectInstruMentID=2 +inner join Gy_QCCheckProjectSub b with(nolock) on a.HInterID=b.HInterID +inner join Gy_InspectInstruMent men with(nolock) on b.HInspectInstruMentID=men.HItemID and men.HNumber='"+ HNumber + @"' left join Gy_Material m with(nolock) on a.HMaterID=m.HItemID left join Gy_QCCheckItem ch with(nolock) on b.HQCCheckItemID=ch.HItemID -where pr.HBillNo='" + this.txtLzk.Text + "'", "Gy_QCCheckProjectMain"); +where pr.HBillNo='" + this.txtLzk.Text + "' and a.HProcID="+ HProcID, "Gy_QCCheckProjectMain"); if (dataSet.Tables[0].Rows.Count == 0) { @@ -368,6 +381,7 @@ dr["Actual"] = ds.Tables[i].Rows[k]["Actual"].ToString(); dr["HUpLimit"] = dataSet.Tables[0].Rows[j]["HUpLimit"].ToString(); dr["HDownLimit"] = dataSet.Tables[0].Rows[j]["HDownLimit"].ToString(); + dr["HInspectInstruMentID"] = dataSet.Tables[0].Rows[j]["HInspectInstruMentID"].ToString(); ListData.Items.Add("妫�楠岄」鐩�:" + ds.Tables[i].Rows[k]["Characteristic"].ToString() + ",瀹炴祴鍊�:" + ds.Tables[i].Rows[k]["Actual"].ToString() + ",涓婂叕宸�:" + dataSet.Tables[0].Rows[j]["HUpLimit"].ToString() + ",涓嬪叕宸�:" + dataSet.Tables[0].Rows[j]["HDownLimit"].ToString()); break; } @@ -431,16 +445,18 @@ { try { + string HProcID = this.cmbPro.SelectedValue.ToString(); string sExeReturnInfo = ""; string BillType = "7505"; long HInterID = oCN.CreateBillID_Prod(BillType, ref sExeReturnInfo); string HBillNo = oCN.CreateBillCode(BillType, ref sExeReturnInfo, true); + //鍒ゆ柇褰撳墠娴佽浆鍗� 褰撳墠宸ュ簭 鏄惁宸茬粡娲捐繃宸� DataSet ds = oCN.RunProcReturn(@"select staus.HSourceID,a.HICMOInterID,a.HICMOEntryID,a.HICMOBillNo,a.HPlanQty,a.HInterID HProcExchInterID, staus.HSourceEntryID HProcExchEntryID,a.HBillNo HProcExchBillNo,a.HQty,a.HMaterID from Sc_ProcessExchangeBillMain a with(nolock) inner join Sc_ICMOBillStatus_Tmp staus with(nolock) on a.HInterID=staus.HSourceInterID -where a.HBillNo='" + this.txtLzk.Text + "' and staus.HProcID=186 ", "Sc_ProcessExchangeBillMain"); +where a.HBillNo='" + this.txtLzk.Text + "' and staus.HProcID="+ HProcID, "Sc_ProcessExchangeBillMain"); if (ds.Tables[0].Rows.Count == 0) { @@ -490,9 +506,17 @@ ",getdate(),0,''," + HProcExchInterID + "," + HProcExchEntryID + ",'" + HProcExchBillNo + "','',0,0" + "," + dataTable.Rows[i]["CharacteristicID"].ToString() + ",'" + dataTable.Rows[i]["HQCStd"].ToString() + "','','"+ dataTable.Rows[i]["HQCStd"].ToString() + "','" + HLastResult + "'" + - ",'" + dataTable.Rows[i]["HUpLimit"].ToString() + "','" + dataTable.Rows[i]["HDownLimit"].ToString() + "',''" + ",0,0,0,0,0,0,'',0,'" + dataTable.Rows[i]["Actual"].ToString() + "','" + dataTable.Rows[i]["HQCStd"].ToString() + "','" + dataTable.Rows[i]["HUpLimit"].ToString() + "','" + dataTable.Rows[i]["HDownLimit"].ToString() + "','','',0,'1',0,'"+ HLastResult + "'" + ") "); + ",'" + dataTable.Rows[i]["HUpLimit"].ToString() + "','" + dataTable.Rows[i]["HDownLimit"].ToString() + "',''" + ",0,0,0,0,0,0,'',0,'" + dataTable.Rows[i]["Actual"].ToString() + "','" + dataTable.Rows[i]["HQCStd"].ToString() + "','" + dataTable.Rows[i]["HUpLimit"].ToString() + "','" + dataTable.Rows[i]["HDownLimit"].ToString() + "','','',0,'2'," + dataTable.Rows[i]["HInspectInstruMentID"].ToString() + ",'" + HLastResult + "'" + + ") "); } + DataSet SetData = oCN.RunProcReturn("select HMakeDate from QC_TakeSampleCheckBillMain where HInterID =" + this.HTakeSampleCheckBillID.Text, "QC_TakeSampleCheckBillMain"); + string HMakeDate = ""; + if (SetData.Tables[0].Rows.Count > 0) + { + HMakeDate = SetData.Tables[0].Rows[0]["HMakeDate"].ToString(); + } + //涓昏〃 oCN.RunProc("Insert Into QC_FirstPieceCheckBillMain " + "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate" + @@ -500,13 +524,15 @@ ",HSourceID,HICMOInterID,HICMOBillNo,HICMOQty,HProcExchInterID,HProcExchEntryID" + ",HProcExchBillNo,HProcExchQty,HMaterID,HFirstCheckEmp,HLastResult" + ",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType,HICMOEntryID,HQCSchemeID,HShiftsID,HErrTreatment" + - ") " + - " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "',1,getdate(),'',getdate()" + + ",HTakeSampleCheckBillID,HTakeSampleCheckBillNo,HProcID" + + ",HBatchNo) " + + " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "',1,'"+ HMakeDate + "','" + this.txtHMaker.Text + "',getdate()" + "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",''" + "," + HSourceID + "," + HICMOInterID + ",'" + HICMOBillNo + "'," + HPlanQty + "," + HProcExchInterID + "," + HProcExchEntryID + - ",'" + HProcExchBillNo + "'," + HQty + "," + HMaterID + ",'', " + HLastResults + - "," + HProcExchInterID + "," + HProcExchEntryID + ",'" + HProcExchBillNo + "',''," + HICMOEntryID + "," + HQCSchemeID + ",0,''" + - ") "); + ",'" + HProcExchBillNo + "'," + HQty + "," + HMaterID + ",'"+this.labHMakerID.Text + "', " + HLastResults + + "," + HProcExchInterID + "," + HProcExchEntryID + ",'" + HProcExchBillNo + "',''," + HICMOEntryID + "," + HQCSchemeID + "," + this.HShiftsID.Text + ",''" + + "," + this.HTakeSampleCheckBillID.Text + ",'" + this.HTakeSampleCheckBillNo.Text + "'," + HProcID + "" + + ",'" + this.txtPcm.Text + "') "); oCN.Commit(); @@ -517,6 +543,8 @@ catch (Exception e) { oCN.RollBack(); + //淇濆瓨鎸夐挳鐏版帀 + this.btnSave.Enabled = true; MessageBox.Show("淇濆瓨澶辫触!" + e.Message); } } @@ -526,16 +554,18 @@ { try { + string HProcID = this.cmbPro.SelectedValue.ToString(); string sExeReturnInfo = ""; string BillType = "7520"; long HInterID = oCN.CreateBillID_Prod(BillType, ref sExeReturnInfo); string HBillNo = oCN.CreateBillCode(BillType, ref sExeReturnInfo, true); + // 鍒ゆ柇褰撳墠娴佽浆鍗� 褰撳墠宸ュ簭 鏄惁宸茬粡娲捐繃宸� DataSet ds = oCN.RunProcReturn(@"select staus.HSourceID,a.HICMOInterID,a.HICMOEntryID,a.HICMOBillNo,a.HPlanQty,a.HInterID HProcExchInterID, staus.HSourceEntryID HProcExchEntryID,a.HBillNo HProcExchBillNo,a.HQty,a.HMaterID from Sc_ProcessExchangeBillMain a with(nolock) inner join Sc_ICMOBillStatus_Tmp staus with(nolock) on a.HInterID=staus.HSourceInterID -where a.HBillNo='" + this.txtLzk.Text + "' and staus.HProcID=186 ", "Sc_ProcessExchangeBillMain"); +where a.HBillNo='" + this.txtLzk.Text + "' and staus.HProcID=" + HProcID, "Sc_ProcessExchangeBillMain"); if (ds.Tables[0].Rows.Count == 0) { @@ -585,7 +615,13 @@ + HInterID + ",'" + HBillNo + "'," + (i + 1) + ",''" + ",getdate(),0,''," + HProcExchInterID + "," + HProcExchEntryID + ",'" + HProcExchBillNo + "','',0,0," + dataTable.Rows[i]["CharacteristicID"].ToString() + ",'" + dataTable.Rows[i]["HQCStd"].ToString() + "','','"+ dataTable.Rows[i]["HQCStd"].ToString() + "','" + HLastResult + "'" + - ",'" + dataTable.Rows[i]["HUpLimit"].ToString() + "','" + dataTable.Rows[i]["HDownLimit"].ToString() + "',''" + ",0,0,0,0,0,0,'',0,'" + dataTable.Rows[i]["Actual"].ToString() + "','" + dataTable.Rows[i]["HQCStd"].ToString() + "','" + dataTable.Rows[i]["HUpLimit"].ToString() + "','" + dataTable.Rows[i]["HDownLimit"].ToString() + "','','',0,'1',0,'"+ HLastResult + "'" + ") "); + ",'" + dataTable.Rows[i]["HUpLimit"].ToString() + "','" + dataTable.Rows[i]["HDownLimit"].ToString() + "',''" + ",0,0,0,0,0,0,'',0,'" + dataTable.Rows[i]["Actual"].ToString() + "','" + dataTable.Rows[i]["HQCStd"].ToString() + "','" + dataTable.Rows[i]["HUpLimit"].ToString() + "','" + dataTable.Rows[i]["HDownLimit"].ToString() + "','','',0,'2'," + dataTable.Rows[i]["HInspectInstruMentID"].ToString() + ",'" + HLastResult + "'" + ") "); + } + DataSet SetData = oCN.RunProcReturn("select HMakeDate from QC_TakeSampleCheckBillMain where HInterID =" + this.HTakeSampleCheckBillID.Text, "QC_TakeSampleCheckBillMain"); + string HMakeDate = ""; + if (SetData.Tables[0].Rows.Count > 0) + { + HMakeDate = SetData.Tables[0].Rows[0]["HMakeDate"].ToString(); } //涓昏〃 @@ -595,13 +631,13 @@ ",HSourceID,HICMOInterID,HICMOBillNo,HICMOQty,HProcExchInterID,HProcExchEntryID" + ",HProcExchBillNo,HProcExchQty,HMaterID,HFirstCheckEmp,HLastResult" + ",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType,HICMOEntryID,HQCSchemeID,HShiftsID,HErrTreatment" + - ") " + - " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "',1,getdate(),'',getdate()" + + ",HTakeSampleCheckBillID,HTakeSampleCheckBillNo,HProcID,HBatchNo) " + + " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "',1,'"+ HMakeDate + "','"+this.txtHMaker.Text + "',getdate()" + "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",''" + "," + HSourceID + "," + HICMOInterID + ",'" + HICMOBillNo + "'," + HPlanQty + "," + HProcExchInterID + "," + HProcExchEntryID + - ",'" + HProcExchBillNo + "'," + HQty + "," + HMaterID + ",'', " + HLastResults + - "," + HProcExchInterID + "," + HProcExchEntryID + ",'" + HProcExchBillNo + "',''," + HICMOEntryID + "," + HQCSchemeID + ",0,''" + - ") "); + ",'" + HProcExchBillNo + "'," + HQty + "," + HMaterID + ",'" + this.labHMakerID.Text + "', " + HLastResults + + "," + HProcExchInterID + "," + HProcExchEntryID + ",'" + HProcExchBillNo + "',''," + HICMOEntryID + "," + HQCSchemeID + "," + this.HShiftsID.Text + ",''" + + "," + this.HTakeSampleCheckBillID.Text + ",'" + this.HTakeSampleCheckBillNo.Text + "',"+ HProcID + ",'" + this.txtPcm.Text + "') "); oCN.Commit(); @@ -620,16 +656,18 @@ { try { + string HProcID = this.cmbPro.SelectedValue.ToString(); string sExeReturnInfo = ""; string BillType = "7507"; long HInterID = oCN.CreateBillID_Prod(BillType, ref sExeReturnInfo); string HBillNo = oCN.CreateBillCode(BillType, ref sExeReturnInfo, true); + // 鍒ゆ柇褰撳墠娴佽浆鍗� 褰撳墠宸ュ簭 鏄惁宸茬粡娲捐繃宸� DataSet ds = oCN.RunProcReturn(@"select staus.HSourceID,a.HICMOInterID,a.HICMOEntryID,a.HICMOBillNo,a.HPlanQty,a.HInterID HProcExchInterID, staus.HSourceEntryID HProcExchEntryID,a.HBillNo HProcExchBillNo,a.HQty,a.HMaterID,staus.HProcID from Sc_ProcessExchangeBillMain a with(nolock) inner join Sc_ICMOBillStatus_Tmp staus with(nolock) on a.HInterID=staus.HSourceInterID -where a.HBillNo='" + this.txtLzk.Text + "' and staus.HProcID=186 ", "Sc_ProcessExchangeBillMain"); +where a.HBillNo='" + this.txtLzk.Text + "' and staus.HProcID=" + HProcID, "Sc_ProcessExchangeBillMain"); if (ds.Tables[0].Rows.Count == 0) { @@ -646,7 +684,7 @@ string HProcExchBillNo = ds.Tables[0].Rows[0]["HProcExchBillNo"].ToString(); string HQty = ds.Tables[0].Rows[0]["HQty"].ToString(); string HMaterID = ds.Tables[0].Rows[0]["HMaterID"].ToString(); - string HProcID = ds.Tables[0].Rows[0]["HProcID"].ToString(); + HProcID = ds.Tables[0].Rows[0]["HProcID"].ToString(); string HQCSchemeID = dataTable.Rows[0]["HQCSchemeID"].ToString(); int HLastResults = 1; @@ -681,8 +719,15 @@ ",getdate(),0,''," + HProcExchInterID + "," + HProcExchEntryID + ",'" + HProcExchBillNo + "','',0,0,0," + dataTable.Rows[i]["CharacteristicID"].ToString() + ",'" + dataTable.Rows[i]["HQCStd"].ToString() + "','','" + HLastResult + "'" + ",0,'',0,0,0,0,0,0,'',0,'" + dataTable.Rows[i]["Actual"].ToString() + "','" + dataTable.Rows[i]["HQCStd"].ToString() + "','" + dataTable.Rows[i]["HUpLimit"].ToString() + "','" + dataTable.Rows[i]["HDownLimit"].ToString() + - "','','',0,'',0,'"+ HLastResult + "'" + + "','','',0,'2'," + dataTable.Rows[i]["HInspectInstruMentID"].ToString() + ",'" + HLastResult + "'" + ",'"+ dataTable.Rows[i]["HQCStd"].ToString() + "') "); + } + + DataSet SetData = oCN.RunProcReturn("select HMakeDate from QC_TakeSampleCheckBillMain where HInterID =" + this.HTakeSampleCheckBillID.Text, "QC_TakeSampleCheckBillMain"); + string HMakeDate = ""; + if (SetData.Tables[0].Rows.Count > 0) + { + HMakeDate = SetData.Tables[0].Rows[0]["HMakeDate"].ToString(); } //涓昏〃 @@ -695,15 +740,18 @@ ",HBarCode,HLBatchNo,HCusID,HSortBillNo,HContrctBatchNo" + ",HProdAreaID,HProdTypeID,HProdStoveNo,HRecipeID,HDiameter1" + ",HDiameter2,HRoutingInterID,HDrawingDireID,HPackTypeID" + -",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType,HICMOEntryID,HQCSchemeID,HICMOQty,HProcExchQty,HShiftsID,HErrTreatment" + - ") " + - " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "',1,getdate(),'',getdate()" + + ",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType,HICMOEntryID,HQCSchemeID,HICMOQty" + + ",HProcExchQty,HShiftsID,HErrTreatment" + + ",HTakeSampleCheckBillID,HTakeSampleCheckBillNo" + + ",HBatchNo,HCheckerResult) " + + " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "',1,'" + HMakeDate + "','" + this.txtHMaker.Text + "',getdate()" + "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",''" + "," + HICMOInterID + ",'" + HICMOBillNo + "'," + HProcExchInterID + "," + HProcExchEntryID + ",'" + HProcExchBillNo + "'" + - "," + HMaterID + "," + HProcID + "," + HSourceID + ",0,0,0,0,0,0,'" + HLastResults + "'" + + "," + HMaterID + "," + HProcID + "," + HSourceID + ",0,0,0,0,0," + this.labHMakerID.Text + ",'" + HLastResults + "'" + ",'','',0,'',''" + - ",0,0,'',0,0,0,0,'',0," + HProcExchInterID + "," + HProcExchEntryID + ",'" + HProcExchBillNo + "',''," + HICMOEntryID + "," + HQCSchemeID + "," + HPlanQty + "," + HQty + ",0,''" + - ") "); + ",0,0,'',0,0,0,0,'',0," + HProcExchInterID + "," + HProcExchEntryID + ",'" + HProcExchBillNo + "',''," + HICMOEntryID + "," + HQCSchemeID + "," + HPlanQty + "," + HQty + "," + this.HShiftsID.Text + ",''" + + "," + this.HTakeSampleCheckBillID.Text + ",'" + this.HTakeSampleCheckBillNo.Text + "'" + + ",'" + this.txtPcm.Text + "','" + HLastResults + "') "); oCN.Commit(); @@ -723,7 +771,14 @@ { if (e.KeyCode == Keys.Enter) { - SelectHBardCode(this.txtLzk.Text); + if (this.txtHMakerNumber.Text == "") + { + MessageBox.Show("璇疯緭鍏ュ埗鍗曚汉淇℃伅!"); + } + else { + SelectHBardCode(this.txtLzk.Text); + } + } } @@ -732,16 +787,63 @@ { try { - DataSet ds = oCN.RunProcReturn("select * from Sc_ProcessExchangeBillMain where HBillNo='" + HBillNo + "' ", "Sc_ProcessExchangeBillMain"); + string cmbPro = this.cmbPro.SelectedValue.ToString(); + + //鏌ヨ鍙栨牱鍗曟暟鎹� + DataSet ds = oCN.RunProcReturn("select * from h_v_QC_TakeSampleCheckBillList where 鍗曟嵁鍙�='" + HBillNo + "' and HProcID='" + cmbPro + "'", "h_v_QC_TakeSampleCheckBillList"); if (ds.Tables[0].Rows.Count == 0) { - MessageBox.Show("鏌ユ棤鏁版嵁!"); + MessageBox.Show("褰撳墠宸ュ簭瀵瑰簲鐨勫彇鏍峰崟鎹�,鏌ユ棤鏁版嵁!"); } else { string HProjectNum = ds.Tables[0].Rows[0]["HProjectNum"].ToString(); this.txtPcm.Text = HProjectNum.Split('-')[0]; + this.txtLzk.Text = ds.Tables[0].Rows[0]["宸ュ簭娴佽浆鍗″彿"].ToString(); + this.HTakeSampleCheckBillID.Text = ds.Tables[0].Rows[0]["hmainid"].ToString(); + this.HTakeSampleCheckBillNo.Text = ds.Tables[0].Rows[0]["鍗曟嵁鍙�"].ToString(); + this.HShiftsID.Text = ds.Tables[0].Rows[0]["HShiftsID"].ToString(); this.txtLzk.ReadOnly = true; + this.label2.Text = "娴佽浆鍗�:"; + } + + //DataSet ds = oCN.RunProcReturn("select * from h_v_Sc_ProcessExchangeBillQuerySub where 鍗曟嵁鍙�='" + HBillNo + "' and HProcID='"+ cmbPro + "'", "h_v_Sc_ProcessExchangeBillQuerySub"); + //if (ds.Tables[0].Rows.Count == 0) + //{ + + //} + //else + //{ + // string HProjectNum = ds.Tables[0].Rows[0]["HProjectNum"].ToString(); + // this.txtPcm.Text = HProjectNum.Split('-')[0]; + // this.HTakeSampleCheckBillID.Text = "0"; + // this.HTakeSampleCheckBillNo.Text = ""; + // this.txtLzk.ReadOnly = true; + //} + } + catch (Exception e) + { + MessageBox.Show(this, e.Message, "鎻愮ず"); + } + } + + //鏌ヨ宸ュ簭 + public void SelectHProList() + { + try + { + DataSet ds = oCN.RunProcReturn("select * from Gy_Process ", "Sc_ProcessExchangeBillMain"); + if (ds.Tables[0].Rows.Count == 0) + { + MessageBox.Show("宸ュ簭鏌ユ棤鏁版嵁!"); + } + else + { + this.cmbPro.DataSource = ds.Tables[0]; + this.cmbPro.DisplayMember = "HName"; + this.cmbPro.ValueMember = "HItemID"; + this.cmbPro.SelectedIndex = 0; + this.cmbPro.DropDownStyle = ComboBoxStyle.DropDownList; } } catch (Exception e) @@ -752,8 +854,8 @@ private void ReadCoordinateExcelFrom_Activated(object sender, EventArgs e) { - //鍏夋爣閫変腑娴佽浆鍗� - this.txtLzk.Focus(); + //鍏夋爣閫変腑鍒跺崟浜� + this.txtHMaker.Focus(); } private void ReadCoordinateExcelFrom_FormClosing(object sender, FormClosingEventArgs e) @@ -763,5 +865,58 @@ e.Cancel = true; } } + + private void txtHMaker_Leave(object sender, EventArgs e) + { + if (string.IsNullOrWhiteSpace(txtHMaker.Text)) + { + this.txtHMaker.ForeColor = Color.LightGray; + txtHMaker.Text = "璇疯緭鍏ョ敤鎴风紪鐮�!"; + } + } + + private void txtHMaker_Enter(object sender, EventArgs e) + { + if (txtHMaker.Text.Trim() == "璇疯緭鍏ョ敤鎴风紪鐮�!") + { + txtHMaker.Text = ""; + this.txtHMaker.ForeColor = Color.Black; + } + } + + private void txtHMaker_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Enter) + { + SelectHMaker(this.txtHMaker.Text); + } + + } + + //鏌ヨ鑱屽憳淇℃伅 + public void SelectHMaker(string txtHMaker) { + try + { + DataSet ds = oCN.RunProcReturn("select HItemID,HName,HNumber from Gy_Employee where HNumber='" + txtHMaker + "' or HName ='" + txtHMaker + "'", "Gy_Employee"); + if (ds.Tables[0].Rows.Count > 0) + { + string HName = ds.Tables[0].Rows[0]["HName"].ToString(); + string HMakerID = ds.Tables[0].Rows[0]["HItemID"].ToString(); + string HNumber = ds.Tables[0].Rows[0]["HNumber"].ToString(); + this.txtHMaker.Text = HName; + this.txtHMakerNumber.Text = HNumber; + this.labHMakerID.Text = HMakerID; + this.txtHMaker.ReadOnly = true; + } + else + { + MessageBox.Show(this, txtHMaker + ",鏌ユ棤鏁版嵁,鍙兘鏄緭鍏ョ紪鐮佹湁璇�!", "鎻愮ず"); + } + } + catch (Exception e) + { + MessageBox.Show(this, e.Message, "鎻愮ず"); + } + } } } \ No newline at end of file -- Gitblit v1.9.1