From 1d9f82659dbfdfd6ac0ddbb33f1fd5af1164d939 Mon Sep 17 00:00:00 2001 From: yangle <admin@YINMOU> Date: 星期五, 29 十一月 2024 16:52:14 +0800 Subject: [PATCH] 浸渍 铁芯检测 无尘 单品过站 不能开工不能过站控制 --- WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCoordinateExcelFrom.cs | 185 +++++++++++++++++++++++++++++++++++----------- 1 files changed, 140 insertions(+), 45 deletions(-) diff --git a/WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCoordinateExcelFrom.cs b/WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCoordinateExcelFrom.cs index 6c2c132..6bf8ef0 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 { @@ -30,6 +32,11 @@ //璺緞鍙 this.txtLj.ReadOnly = true; this.txtPcm.ReadOnly = true; + //鍒跺崟缂栫爜鍙 + this.txtHMakerNumber.ReadOnly = true; + //鍒跺崟浜烘彁绀� + this.txtHMaker.ForeColor = Color.LightGray; + this.txtHMaker.Text = "璇疯緭鍏ョ敤鎴风紪鐮�!"; SelectHProList(); } @@ -42,7 +49,6 @@ MessageBox.Show("娴佽浆鍗℃病鏈夋壂鎻�!"); } else { - //璺緞璧嬪�肩粰鏂囨湰 using (FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog()) { @@ -55,8 +61,8 @@ string selectedFolderPath = folderBrowserDialog.SelectedPath; // 浣跨敤 selectedFolderPath 杩涜鍚庣画鎿嶄綔锛屼緥濡傛樉绀哄湪鏂囨湰妗嗕腑 this.txtLj.Text = selectedFolderPath; - //GetCSV_Read(selectedFolderPath); - GetExcel_Read(selectedFolderPath); + GetCSV_Read(selectedFolderPath); + //GetExcel_Read(selectedFolderPath); } } } @@ -114,8 +120,8 @@ } } - //鏄剧ず鏁版嵁 - ShowData(ds); + //鏄剧ず鏁版嵁 CMR-L-066 杞粨浠� + ShowData(ds, "CMR-L-066"); } //鏍规嵁鏂囦欢璺緞鎵惧埌瀵瑰簲鏂囦欢 骞惰幏鍙栧搴旂殑鏁版嵁 @@ -253,8 +259,8 @@ } } } - //鏄剧ず鏁版嵁 - ShowData(ds); + //鏄剧ず鏁版嵁 CMR-L-067 涓夊潗鏍� + ShowData(ds, "CMR-L-067"); } //鏍规嵁鏂囦欢璺緞鎵惧埌瀵瑰簲鏂囦欢 骞惰幏鍙栧搴旂殑鏁版嵁 @@ -321,7 +327,7 @@ } //鎶婃暟鎹樉绀哄湪椤甸潰涓� - public void ShowData(DataSet ds) { + public void ShowData(DataSet ds,string HNumber) { //娓呯┖缃戞牸鍐呭 ListData.Items.Clear(); //娓呯┖琛ㄦ牸鍐呭 @@ -335,14 +341,16 @@ 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 + 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=1 +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"); @@ -367,6 +375,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; } @@ -490,10 +499,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" + @@ -502,13 +518,14 @@ ",HProcExchBillNo,HProcExchQty,HMaterID,HFirstCheckEmp,HLastResult" + ",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType,HICMOEntryID,HQCSchemeID,HShiftsID,HErrTreatment" + ",HTakeSampleCheckBillID,HTakeSampleCheckBillNo,HProcID" + - ") " + - " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "',1,getdate(),'',getdate()" + + ",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 + + ",'" + HProcExchBillNo + "'," + HQty + "," + HMaterID + ",'"+this.labHMakerID.Text + "', " + HLastResults + "," + HProcExchInterID + "," + HProcExchEntryID + ",'" + HProcExchBillNo + "',''," + HICMOEntryID + "," + HQCSchemeID + ",0,''" + - "," + this.HTakeSampleCheckBillID.Text + ",'" + this.HTakeSampleCheckBillNo.Text + "',"+ HProcID + ") "); + "," + this.HTakeSampleCheckBillID.Text + ",'" + this.HTakeSampleCheckBillNo.Text + "'," + HProcID + "" + + ",'" + this.txtPcm.Text + "') "); oCN.Commit(); @@ -590,7 +607,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(); } //涓昏〃 @@ -600,13 +623,13 @@ ",HSourceID,HICMOInterID,HICMOBillNo,HICMOQty,HProcExchInterID,HProcExchEntryID" + ",HProcExchBillNo,HProcExchQty,HMaterID,HFirstCheckEmp,HLastResult" + ",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType,HICMOEntryID,HQCSchemeID,HShiftsID,HErrTreatment" + - ",HTakeSampleCheckBillID,HTakeSampleCheckBillNo,HProcID) " + - " 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 + + ",'" + HProcExchBillNo + "'," + HQty + "," + HMaterID + ",'" + this.labHMakerID.Text + "', " + HLastResults + "," + HProcExchInterID + "," + HProcExchEntryID + ",'" + HProcExchBillNo + "',''," + HICMOEntryID + "," + HQCSchemeID + ",0,''" + - "," + this.HTakeSampleCheckBillID.Text + ",'" + this.HTakeSampleCheckBillNo.Text + "',"+ HProcID + ") "); + "," + this.HTakeSampleCheckBillID.Text + ",'" + this.HTakeSampleCheckBillNo.Text + "',"+ HProcID + ",'" + this.txtPcm.Text + "') "); oCN.Commit(); @@ -687,8 +710,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(); } //涓昏〃 @@ -704,14 +734,15 @@ ",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType,HICMOEntryID,HQCSchemeID,HICMOQty" + ",HProcExchQty,HShiftsID,HErrTreatment" + ",HTakeSampleCheckBillID,HTakeSampleCheckBillNo" + - ") " + - " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "',1,getdate(),'',getdate()" + + ",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,''" + - "," + this.HTakeSampleCheckBillID.Text + ",'" + this.HTakeSampleCheckBillNo.Text + "') "); + "," + this.HTakeSampleCheckBillID.Text + ",'" + this.HTakeSampleCheckBillNo.Text + "'" + + ",'" + this.txtPcm.Text + "','"+ HLastResults + "') "); oCN.Commit(); @@ -731,7 +762,14 @@ { if (e.KeyCode == Keys.Enter) { - SelectHBardCode(this.txtLzk.Text); + if (this.txtHMakerNumber.Text == "") + { + MessageBox.Show("璇疯緭鍏ュ埗鍗曚汉淇℃伅!"); + } + else { + SelectHBardCode(this.txtLzk.Text); + } + } } @@ -741,32 +779,36 @@ try { string cmbPro = this.cmbPro.SelectedValue.ToString(); - DataSet ds = oCN.RunProcReturn("select * from h_v_Sc_ProcessExchangeBillQuerySub where 鍗曟嵁鍙�='" + HBillNo + "' and HProcID='"+ cmbPro + "'", "h_v_Sc_ProcessExchangeBillQuerySub"); + + 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) { - 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("褰撳墠宸ュ簭瀵瑰簲鐨勫崟鎹�,鏌ユ棤鏁版嵁!"); - } - 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.txtLzk.ReadOnly = true; - } + MessageBox.Show("褰撳墠宸ュ簭瀵瑰簲鐨勫彇鏍峰崟鎹�,鏌ユ棤鏁版嵁!"); } 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.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.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) { @@ -801,8 +843,8 @@ private void ReadCoordinateExcelFrom_Activated(object sender, EventArgs e) { - //鍏夋爣閫変腑娴佽浆鍗� - this.txtLzk.Focus(); + //鍏夋爣閫変腑鍒跺崟浜� + this.txtHMaker.Focus(); } private void ReadCoordinateExcelFrom_FormClosing(object sender, FormClosingEventArgs e) @@ -812,5 +854,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