From 871fa09fa6b84be39f7d060eb25a7159e0a2ca40 Mon Sep 17 00:00:00 2001 From: yangle <admin@YINMOU> Date: 星期二, 12 十一月 2024 16:50:28 +0800 Subject: [PATCH] 1 --- WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug/EquipmentCollectionForm.exe | 0 WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug.rar | 0 WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.GenerateResource.cache | 0 WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.cs | 193 ++++++++++++- WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/WFormSynchronizeData_SMR.pdb | 0 WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/EquipmentCollectionForm.exe | 0 WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCoordinateExcelFrom.cs | 163 ++++++++--- WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/WFormReadData_SMR.exe | 0 WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/WFormReadData_SMR.pdb | 0 WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/DesignTimeResolveAssemblyReferences.cache | 0 WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/EquipmentCollectionForm.csproj.FileListAbsolute.txt | 1 WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/Vlog/2024-10-22.txt | 1 WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/WFormSynchronizeData_SMR.exe | 0 WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.exe.manifest | 4 WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/EquipmentCollectionForm.csproj.GenerateResource.cache | 0 WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.FileListAbsolute.txt | 1 WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/app.publish/WFormSynchronizeData_SMR.exe | 0 WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.pdb | 0 WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.exe | 0 WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.application | 2 WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug.rar | 0 WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug/Config/SQLAPI.config | 7 WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug.rar | 0 WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCSV.Designer.cs | 4 WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/EquipmentCollectionForm.pdb | 0 WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/WFormSynchronizeData_SMR.application | 2 WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.exe | 0 WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.pdb | 0 WFormSynchronizeData_SMR/WFormReadData_SMR/Program.cs | 2 WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCoordinateExcelFrom.Designer.cs | 94 +++++- WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug/EquipmentCollectionForm.pdb | 0 WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/DesignTimeResolveAssemblyReferences.cache | 0 WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/Vlog/2024-10-02.txt | 1 WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.Designer.cs | 95 +++++- WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/WFormSynchronizeData_SMR.exe.manifest | 4 WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/Vlog/TM2024-10-02.txt | 25 + WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCSV.cs | 163 ++++++++-- WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/DesignTimeResolveAssemblyReferences.cache | 0 WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.csproj | 2 WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/Form1.cs | 65 +++ WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.AssemblyReference.cache | 0 41 files changed, 669 insertions(+), 160 deletions(-) diff --git a/WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.Designer.cs b/WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.Designer.cs index a9886dd..799a59f 100644 --- a/WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.Designer.cs +++ b/WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.Designer.cs @@ -48,12 +48,17 @@ this.HMaterID = new System.Windows.Forms.Label(); this.timer = new System.Windows.Forms.Timer(this.components); this.Time_CLHB = new System.Windows.Forms.Timer(this.components); + this.labHMakerID = new System.Windows.Forms.Label(); + this.txtHMakerNumber = new System.Windows.Forms.TextBox(); + this.label5 = new System.Windows.Forms.Label(); + this.txtHMaker = new System.Windows.Forms.TextBox(); + this.label6 = new System.Windows.Forms.Label(); this.SuspendLayout(); // // cmbEquipFile // this.cmbEquipFile.FormattingEnabled = true; - this.cmbEquipFile.Location = new System.Drawing.Point(128, 39); + this.cmbEquipFile.Location = new System.Drawing.Point(121, 74); this.cmbEquipFile.Name = "cmbEquipFile"; this.cmbEquipFile.Size = new System.Drawing.Size(186, 26); this.cmbEquipFile.TabIndex = 13; @@ -62,7 +67,7 @@ // txtEquipFile // this.txtEquipFile.AutoSize = true; - this.txtEquipFile.Location = new System.Drawing.Point(69, 47); + this.txtEquipFile.Location = new System.Drawing.Point(62, 82); this.txtEquipFile.Name = "txtEquipFile"; this.txtEquipFile.Size = new System.Drawing.Size(53, 18); this.txtEquipFile.TabIndex = 14; @@ -70,7 +75,7 @@ // // btnBegin // - this.btnBegin.Location = new System.Drawing.Point(52, 91); + this.btnBegin.Location = new System.Drawing.Point(45, 126); this.btnBegin.Name = "btnBegin"; this.btnBegin.Size = new System.Drawing.Size(70, 37); this.btnBegin.TabIndex = 15; @@ -80,21 +85,21 @@ // // txtBegin // - this.txtBegin.Location = new System.Drawing.Point(128, 97); + this.txtBegin.Location = new System.Drawing.Point(121, 132); this.txtBegin.Name = "txtBegin"; this.txtBegin.Size = new System.Drawing.Size(186, 28); this.txtBegin.TabIndex = 16; // // txtEnd // - this.txtEnd.Location = new System.Drawing.Point(478, 100); + this.txtEnd.Location = new System.Drawing.Point(471, 135); this.txtEnd.Name = "txtEnd"; this.txtEnd.Size = new System.Drawing.Size(186, 28); this.txtEnd.TabIndex = 18; // // btnEnd // - this.btnEnd.Location = new System.Drawing.Point(402, 94); + this.btnEnd.Location = new System.Drawing.Point(395, 129); this.btnEnd.Name = "btnEnd"; this.btnEnd.Size = new System.Drawing.Size(70, 37); this.btnEnd.TabIndex = 17; @@ -104,7 +109,7 @@ // // btnSave // - this.btnSave.Location = new System.Drawing.Point(744, 26); + this.btnSave.Location = new System.Drawing.Point(737, 61); this.btnSave.Name = "btnSave"; this.btnSave.Size = new System.Drawing.Size(115, 37); this.btnSave.TabIndex = 19; @@ -115,7 +120,7 @@ // label4 // this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(40, 167); + this.label4.Location = new System.Drawing.Point(33, 202); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(53, 18); this.label4.TabIndex = 21; @@ -123,14 +128,14 @@ // // txtLj // - this.txtLj.Location = new System.Drawing.Point(112, 164); + this.txtLj.Location = new System.Drawing.Point(105, 199); this.txtLj.Name = "txtLj"; this.txtLj.Size = new System.Drawing.Size(608, 28); this.txtLj.TabIndex = 20; // // btnLj // - this.btnLj.Location = new System.Drawing.Point(735, 155); + this.btnLj.Location = new System.Drawing.Point(728, 190); this.btnLj.Name = "btnLj"; this.btnLj.Size = new System.Drawing.Size(115, 42); this.btnLj.TabIndex = 22; @@ -140,7 +145,7 @@ // // txtHBathNo // - this.txtHBathNo.Location = new System.Drawing.Point(478, 31); + this.txtHBathNo.Location = new System.Drawing.Point(471, 66); this.txtHBathNo.Name = "txtHBathNo"; this.txtHBathNo.Size = new System.Drawing.Size(186, 28); this.txtHBathNo.TabIndex = 24; @@ -149,7 +154,7 @@ // HBathNo // this.HBathNo.AutoSize = true; - this.HBathNo.Location = new System.Drawing.Point(408, 36); + this.HBathNo.Location = new System.Drawing.Point(401, 71); this.HBathNo.Name = "HBathNo"; this.HBathNo.Size = new System.Drawing.Size(62, 18); this.HBathNo.TabIndex = 25; @@ -157,7 +162,7 @@ // // btnRest // - this.btnRest.Location = new System.Drawing.Point(744, 88); + this.btnRest.Location = new System.Drawing.Point(737, 123); this.btnRest.Name = "btnRest"; this.btnRest.Size = new System.Drawing.Size(115, 37); this.btnRest.TabIndex = 26; @@ -169,14 +174,14 @@ // this.ListData.FormattingEnabled = true; this.ListData.ItemHeight = 18; - this.ListData.Location = new System.Drawing.Point(5, 204); + this.ListData.Location = new System.Drawing.Point(-2, 239); this.ListData.Name = "ListData"; this.ListData.Size = new System.Drawing.Size(932, 472); this.ListData.TabIndex = 27; // // txtHMaterNumber // - this.txtHMaterNumber.Location = new System.Drawing.Point(478, 66); + this.txtHMaterNumber.Location = new System.Drawing.Point(471, 101); this.txtHMaterNumber.Name = "txtHMaterNumber"; this.txtHMaterNumber.Size = new System.Drawing.Size(186, 28); this.txtHMaterNumber.TabIndex = 28; @@ -184,7 +189,7 @@ // HMaterID // this.HMaterID.AutoSize = true; - this.HMaterID.Location = new System.Drawing.Point(458, 9); + this.HMaterID.Location = new System.Drawing.Point(326, 74); this.HMaterID.Name = "HMaterID"; this.HMaterID.Size = new System.Drawing.Size(80, 18); this.HMaterID.TabIndex = 29; @@ -201,11 +206,61 @@ this.Time_CLHB.Interval = 3600000; this.Time_CLHB.Tick += new System.EventHandler(this.Time_CLHB_Tick); // + // labHMakerID + // + this.labHMakerID.AutoSize = true; + this.labHMakerID.Location = new System.Drawing.Point(674, 20); + this.labHMakerID.Name = "labHMakerID"; + this.labHMakerID.Size = new System.Drawing.Size(107, 18); + this.labHMakerID.TabIndex = 34; + this.labHMakerID.Text = "labHMakerID"; + this.labHMakerID.Visible = false; + // + // txtHMakerNumber + // + this.txtHMakerNumber.Location = new System.Drawing.Point(471, 17); + this.txtHMakerNumber.Name = "txtHMakerNumber"; + this.txtHMakerNumber.Size = new System.Drawing.Size(186, 28); + this.txtHMakerNumber.TabIndex = 33; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(401, 22); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(53, 18); + this.label5.TabIndex = 32; + this.label5.Text = "缂栫爜:"; + // + // txtHMaker + // + this.txtHMaker.Location = new System.Drawing.Point(125, 17); + this.txtHMaker.Name = "txtHMaker"; + this.txtHMaker.Size = new System.Drawing.Size(189, 28); + this.txtHMaker.TabIndex = 20; + this.txtHMaker.Enter += new System.EventHandler(this.txtHMaker_Enter); + this.txtHMaker.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtHMaker_KeyDown); + this.txtHMaker.Leave += new System.EventHandler(this.txtHMaker_Leave); + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(47, 22); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(71, 18); + this.label6.TabIndex = 31; + this.label6.Text = "鍒跺崟浜�:"; + // // EquipmentCollectionForm // this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(942, 693); + this.ClientSize = new System.Drawing.Size(942, 723); + this.Controls.Add(this.labHMakerID); + this.Controls.Add(this.txtHMakerNumber); + this.Controls.Add(this.label5); + this.Controls.Add(this.txtHMaker); + this.Controls.Add(this.label6); this.Controls.Add(this.HMaterID); this.Controls.Add(this.txtHMaterNumber); this.Controls.Add(this.ListData); @@ -224,6 +279,7 @@ this.Controls.Add(this.cmbEquipFile); this.Name = "EquipmentCollectionForm"; this.Text = "璁惧鏁版嵁閲囬泦"; + this.Activated += new System.EventHandler(this.EquipmentCollectionForm_Activated); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.EquipmentCollectionForm_FormClosing); this.Load += new System.EventHandler(this.EquipmentCollectionForm_Load); this.ResumeLayout(false); @@ -251,5 +307,10 @@ private System.Windows.Forms.Label HMaterID; private System.Windows.Forms.Timer Time_CLHB; private System.Windows.Forms.Timer timer; + private System.Windows.Forms.Label labHMakerID; + private System.Windows.Forms.TextBox txtHMakerNumber; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.TextBox txtHMaker; + private System.Windows.Forms.Label label6; } } \ No newline at end of file diff --git a/WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.cs b/WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.cs index 8b03698..9fd2537 100644 --- a/WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.cs +++ b/WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.cs @@ -33,6 +33,12 @@ this.btnSave.Enabled = false; this.txtHMaterNumber.ReadOnly = true; //this.btnRest.Enabled = false; + //鍒跺崟缂栫爜鍙 + this.txtHMakerNumber.ReadOnly = true; + //鍒跺崟浜烘彁绀� + this.txtHMaker.ForeColor = Color.LightGray; + this.txtHMaker.Text = "璇疯緭鍏ョ敤鎴风紪鐮�!"; + bindCbox(); } @@ -47,7 +53,7 @@ else { this.txtBegin.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - //this.txtBegin.Text = "2024-09-24 09:47:39"; + //this.txtBegin.Text = "2024-11-04 15:40:27"; this.btnBegin.Enabled = false; if (cmbEquipFile.SelectedIndex == 1) { @@ -201,8 +207,15 @@ { if (e.KeyCode == Keys.Enter) { + if (this.txtHMakerNumber.Text == "") + { + MessageBox.Show("璇疯緭鍏ュ埗鍗曚汉淇℃伅!"); + } + else { + Get_DisplayBard(); + } //this.txtHBathNo.ReadOnly = true; - Get_DisplayBard(); + } } @@ -491,12 +504,12 @@ ",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType,HICMOEntryID,HQCSchemeID,HShiftsID,HErrTreatment" + ",HProcID,HBatchNo,HInSpectQty ,HRightQty ,HUnRightQty ,HUnKnowQty " + ") " + - " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "',1,getdate(),'',getdate()" + + " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "',1,getdate(),'" + this.txtHMaker.Text + "',getdate()" + "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",''" + "," + HSourceID + ",0,'',0,0,0" + - ",'',0," + HMaterID + ",'', " + HLastResults + + ",'',0," + HMaterID + ",'" + this.labHMakerID.Text + "', " + HLastResults + ",0,0,'','',0," + HQCSchemeID + ",0,''" + - "," + HProcID + ",'" + HBatchNo + "',"+ HInSpectQty + ","+ HRightQty + ", "+ HUnRightQty + ", " + HUnKnowQty + ") "); + "," + HProcID + ",'" + HBatchNo + "'," + HInSpectQty + "," + HRightQty + ", " + HUnRightQty + ", " + HUnKnowQty + ") "); oCN.Commit(); @@ -603,6 +616,49 @@ } } + public async Task<JsonResult> EquipResultList(string url, StringContent postData, string Type) + { + + // 鍒涘缓 HttpClient 瀹炰緥 + using (HttpClient client = new HttpClient()) + { + JsonResult jsonResult = new JsonResult(); + try + { + HttpResponseMessage response; + if (Type == "POST") + { // 鍙戣捣 POST 璇锋眰 + response = await client.PostAsync(url, postData); + } + else + { + // 鍙戣捣 get 璇锋眰 + response = await client.GetAsync(url); + } + + + // 纭繚璇锋眰鎴愬姛 + if (response.IsSuccessStatusCode) + { + // 璇诲彇鍝嶅簲鍐呭 + string responseBody = await response.Content.ReadAsStringAsync(); + jsonResult = JsonConvert.DeserializeObject<JsonResult>(responseBody); + } + else + { + MessageBox.Show($"璇锋眰澶辫触锛�: {response.StatusCode}"); + } + + } + catch (Exception ex) + { + MessageBox.Show("璇锋眰鎶ラ敊:" + ex.Message); + } + return jsonResult; + } + } + + //鑾峰彇ID public async Task<JsonResult> FindAccessToken(string url) { @@ -631,8 +687,10 @@ //鑾峰彇鑹搧銆佷笉鑹搧鏄庣粏 public async Task<JsonEquipmentData> FindAllDevicePropsDetailByTimeRange(string url, string token,string nos, string HBegin, string HEnd) { + string basePropIds = DBHelper.GetConfigKey(AppDomain.CurrentDomain.BaseDirectory + "Config/SQLAPI.config", "basePropIds"); + basePropIds = "[" + basePropIds + "]"; nos = nos.Replace(",", "\",\""); - string stringJson = "{\"token\":\"" + token + "\",\"deviceNos\":[\"" + nos + "\"],\"startTime\":\"" + HBegin + "\",\"endTime\":\"" + HEnd + "\",\"basePropIds\":[473,474,489,508, 562, 563, 564, 565, 566, 567, 568, 569, 570,571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 597, 600, 601, 602, 603, 604, 605, 593, 594, 595]}"; + string stringJson = "{\"token\":\"" + token + "\",\"deviceNos\":[\"" + nos + "\"],\"startTime\":\"" + HBegin + "\",\"endTime\":\"" + HEnd + "\",\"basePropIds\":" + basePropIds + "}"; //璁惧鍒楄〃鎺ュ彛 string urls = url + EquipmentType.Nine; @@ -677,12 +735,24 @@ return jsonResult; } + //鑾峰彇璁惧杩愯鏃堕棿 寮�鏈� 鍋滄満 寰呮満 鍏虫満 + public async Task<JsonResult> FindDeviceStatusTimeByNo(string url, string token, string nos, string HBegin, string HEnd) + { + nos = nos.Replace(",", "\",\""); + nos = "\"" + nos + "\""; + string stringJson = "{\"token\":\"" + token + "\",\"no\":" + nos + ",\"startTime\":\"" + HBegin + "\",\"endTime\":\"" + HEnd + "\"}"; + var postData = new StringContent(stringJson, System.Text.Encoding.UTF8, "application/json"); + string urls = url + EquipmentType.Five; + JsonResult jsonResult = await EquipResultList(urls, postData, "POST"); + return jsonResult; + } + //涓嬫媺妗嗙粦瀹氭暟鎹� private void bindCbox() { IList<Info> infoList = new List<Info>(); - Info info1 = new Info() { Id = "CMR_QC_SE_001", Name = "铻烘瘝鍏ㄦ" }; - Info info2 = new Info() { Id = "CMR_ZZ_SE_001", Name = "铻烘瘝鍘嬭" }; + Info info1 = new Info() { Id = "CMR-QC-SE-001", Name = "铻烘瘝鍏ㄦ" }; + Info info2 = new Info() { Id = "CMR-ZZ-SE-001", Name = "铻烘瘝鍘嬭" }; Info info3 = new Info() { Id = "ZSJ07", Name = "娉ㄥ鏈�#07" }; //Info info3 = new Info() { Id = "3", Name = "鐜嬩簲" }; infoList.Add(info1); @@ -722,6 +792,9 @@ //瀹氭椂鑾峰彇鏁版嵁 private async void timer_Tick(object sender, EventArgs e) { + //娴嬭瘯鍏ㄦ + //this.timer.Enabled = false; + string Url = DBHelper.GetConfigKey(AppDomain.CurrentDomain.BaseDirectory + "Config/SQLAPI.config", "sUrl"); string urls = Url + EquipmentType.One; // 鍑嗗瑕佸彂閫佺殑琛ㄥ崟鏁版嵁 @@ -765,7 +838,7 @@ //鑾峰彇鍘昏澶囩紪鐮� for (int i = 0; i < jsonResult.data.Count; i++) { - if (jsonResult.data[i].no.Contains("CMR_ZZ_SE_001")) + if (jsonResult.data[i].no.Contains("CMR-ZZ-SE-001")) { nos += jsonResult.data[i].no + ","; } @@ -846,24 +919,24 @@ //鑾峰彇鍘昏澶囩紪鐮� for (int i = 0; i < jsonResult.data.Count; i++) { - if (jsonResult.data[i].no.Contains("CMR-ZS-SE")) - { - nos += jsonResult.data[i].no + ","; - } - else if (jsonResult.data[i].no.Contains("CMR_ZZ_SE_")) - { - nos += jsonResult.data[i].no + ","; - } + nos += jsonResult.data[i].no + ","; + //if (jsonResult.data[i].no.Contains("CMR-ZS-SE")) + //{ + // nos += jsonResult.data[i].no + ","; + //} + //else if (jsonResult.data[i].no.Contains("CMR_ZZ_SE_")) + //{ + // nos += jsonResult.data[i].no + ","; + //} } nos = nos.Substring(0, nos.Length - 1); - JsonEquipmentData jsonEquipment = await FindAllDevicePropsDetailByTimeRange(Url, token, nos, TimeDate, time); var JsonData = "{\"data\":["; for (int i = 0; i < jsonEquipment.data.Count; i++) { - if (jsonEquipment.data[i].deviceNo.Contains("CMR_ZZ_SE_")) + if (jsonEquipment.data[i].deviceNo.Contains("CMR-ZZ-SE-")) { for (int j = 0; j < jsonEquipment.data[i].props.Count; j++) { @@ -921,6 +994,20 @@ for (int i = 0; i < EquipmentStaus.data.Count; i++) { + //鍗风粫鐨勮澶囪繍琛� 寮�鍏冲仠鏈烘椂闂� + if (EquipmentStaus.data[i].no.Contains("CMR-JR-SD-")) + { + string HBegDate = DateTime.Now.ToString("yyyy-MM-dd 00:00:00"); + string HEndDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + + JsonResult HEqDate = await FindDeviceStatusTimeByNo(Url, token, EquipmentStaus.data[i].no, HBegDate, HEndDate); + + JsonData += "{\"HDate\":\"" + HEndDate + "\",\"HTechParamName\":\"寮�鏈烘椂闀縗",\"HResult\":\"" + ((float)(HEqDate.data.onlineTime / 60 / 60)).ToString("0.00") + "\",\"HCount\":1,\"HSourceCode\":\"" + EquipmentStaus.data[i].no + "\"},"; + JsonData += "{\"HDate\":\"" + HEndDate + "\",\"HTechParamName\":\"鍏虫満鏃堕暱\",\"HResult\":\"" + ((float)(HEqDate.data.offlineTime / 60 / 60)).ToString("0.00") + "\",\"HCount\":1,\"HSourceCode\":\"" + EquipmentStaus.data[i].no + "\"},"; + JsonData += "{\"HDate\":\"" + HEndDate + "\",\"HTechParamName\":\"鍋滄満鏃堕暱\",\"HResult\":\"" + ((float)(HEqDate.data.standbyTime / 60 / 60)).ToString("0.00") + "\",\"HCount\":1,\"HSourceCode\":\"" + EquipmentStaus.data[i].no + "\"},"; + JsonData += "{\"HDate\":\"" + HEndDate + "\",\"HTechParamName\":\"杩愯鏃堕暱\",\"HResult\":\"" + ((float)(HEqDate.data.runTime / 60 / 60)).ToString("0.00") + "\",\"HCount\":1,\"HSourceCode\":\"" + EquipmentStaus.data[i].no + "\"},"; + } + string staus = ""; switch (EquipmentStaus.data[i].status) { @@ -1016,7 +1103,7 @@ { nos += "''" + jsonEquipment.data[i].no + "'',"; } - else if (jsonEquipment.data[i].no.Contains("CMR_ZZ_SE_")) + else if (jsonEquipment.data[i].no.Contains("CMR-ZZ-SE-")) { nos += "''" + jsonEquipment.data[i].no + "'',"; } @@ -1069,6 +1156,66 @@ 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, "鎻愮ず"); + } + } + + private void EquipmentCollectionForm_Activated(object sender, EventArgs e) + { + //鍏夋爣閫変腑鍒跺崟浜� + this.txtHMaker.Focus(); + } } @@ -1094,6 +1241,10 @@ public class JsonData { + public double onlineTime { get; set; } + public double offlineTime { get; set; } + public double standbyTime { get; set; } + public double runTime { get; set; } public string expirationTime { get; set; } public string token { get; set; } public string deviceNo { get; set; } @@ -1157,7 +1308,7 @@ //鑹搧 涓嶈壇鍝� 鏄庣粏 娉ㄥ鏈烘暟鎹� public static string Nine = "/api/third/findAllDevicePropsDetailByTimeRange"; //娉ㄥ鏈烘暟鎹� - public static string Ten = "/api/third/findAllDevicePropsDetailByTimeRange"; + //public static string Ten = "/api/third/findAllDevicePropsDetailByTimeRange"; //public static string Eleven = "Monday"; //public static string Twelve = "Monday"; } diff --git a/WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.csproj b/WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.csproj index 99c2753..20db94a 100644 --- a/WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.csproj +++ b/WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.csproj @@ -12,6 +12,7 @@ <FileAlignment>512</FileAlignment> <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> <Deterministic>true</Deterministic> + <IsWebBootstrapper>false</IsWebBootstrapper> <PublishUrl>publish\</PublishUrl> <Install>true</Install> <InstallFrom>Disk</InstallFrom> @@ -24,7 +25,6 @@ <MapFileExtensions>true</MapFileExtensions> <ApplicationRevision>0</ApplicationRevision> <ApplicationVersion>1.0.0.%2a</ApplicationVersion> - <IsWebBootstrapper>false</IsWebBootstrapper> <UseApplicationTrust>false</UseApplicationTrust> <BootstrapperEnabled>true</BootstrapperEnabled> </PropertyGroup> diff --git a/WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug.rar b/WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug.rar index e3bfde6..bb7838e 100644 --- a/WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug.rar +++ b/WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug.rar Binary files differ diff --git a/WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug/Config/SQLAPI.config b/WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug/Config/SQLAPI.config index 89253d8..da365be 100644 --- a/WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug/Config/SQLAPI.config +++ b/WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug/Config/SQLAPI.config @@ -6,8 +6,11 @@ <add key="sDataBase" value="HX_LMESsys_test"></add> <add key="sUser" value="HX_USER"></add> <add key="sPassword" value="lc@841022"></add> - <!--<add key="sUrl" value="https://30.10.7.6:8066"></add>--><!--鍐呴儴娴嬭瘯--> - <add key="sUrl" value="https://hzsme.nps.iiot.youngsunnb.com/"></add><!--鏂帿灏斿缃戞祴璇�--> + <add key="basePropIds" value="279,473,474,489,508, 562, 563, 564, 565, 566, 567, 568, 569, 570,571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586,593, 594, 595, 597, 600, 601, 602, 603, 604, 605,609,608,610,611,612,613,614,615,616,617,620,621,622,623,624,625,626,627,628,629,630,631,632,633,634,635,636,637"></add> + <!--鍐呴儴娴嬭瘯--> + <!--<add key="sUrl" value="https://30.10.7.6:8066"></add>--> + <!--鏂帿灏斿缃戞祴璇�--> + <add key="sUrl" value="https://hzsme.nps.iiot.youngsunnb.com/"></add> <!--47--> <!--<add key="sServer" value="47.96.97.237,15127"></add> <add key="sDataBase" value="HX_LMESsys"></add> diff --git a/WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug/EquipmentCollectionForm.exe b/WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug/EquipmentCollectionForm.exe index 48d2f25..6fb1161 100644 --- a/WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug/EquipmentCollectionForm.exe +++ b/WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug/EquipmentCollectionForm.exe Binary files differ diff --git a/WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug/EquipmentCollectionForm.pdb b/WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug/EquipmentCollectionForm.pdb index b72a87a..2ed5ddf 100644 --- a/WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug/EquipmentCollectionForm.pdb +++ b/WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug/EquipmentCollectionForm.pdb Binary files differ diff --git a/WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/DesignTimeResolveAssemblyReferences.cache b/WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/DesignTimeResolveAssemblyReferences.cache index 4fa9438..2366082 100644 --- a/WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/DesignTimeResolveAssemblyReferences.cache +++ b/WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/DesignTimeResolveAssemblyReferences.cache Binary files differ diff --git a/WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/EquipmentCollectionForm.csproj.FileListAbsolute.txt b/WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/EquipmentCollectionForm.csproj.FileListAbsolute.txt index e9a5f1c..7b0d11b 100644 --- a/WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/EquipmentCollectionForm.csproj.FileListAbsolute.txt +++ b/WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/EquipmentCollectionForm.csproj.FileListAbsolute.txt @@ -10,4 +10,3 @@ E:\鏅轰簯mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\EquipmentCollectionForm\obj\Debug\EquipmentCollectionForm.csproj.CopyComplete E:\鏅轰簯mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\EquipmentCollectionForm\obj\Debug\EquipmentCollectionForm.exe E:\鏅轰簯mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\EquipmentCollectionForm\obj\Debug\EquipmentCollectionForm.pdb -E:\鏅轰簯mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\EquipmentCollectionForm\obj\Debug\EquipmentCollectionForm.csproj.AssemblyReference.cache diff --git a/WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/EquipmentCollectionForm.csproj.GenerateResource.cache b/WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/EquipmentCollectionForm.csproj.GenerateResource.cache index b45d92b..421bff6 100644 --- a/WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/EquipmentCollectionForm.csproj.GenerateResource.cache +++ b/WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/EquipmentCollectionForm.csproj.GenerateResource.cache Binary files differ diff --git a/WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/EquipmentCollectionForm.exe b/WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/EquipmentCollectionForm.exe index 48d2f25..6fb1161 100644 --- a/WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/EquipmentCollectionForm.exe +++ b/WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/EquipmentCollectionForm.exe Binary files differ diff --git a/WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/EquipmentCollectionForm.pdb b/WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/EquipmentCollectionForm.pdb index b72a87a..2ed5ddf 100644 --- a/WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/EquipmentCollectionForm.pdb +++ b/WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/EquipmentCollectionForm.pdb Binary files differ diff --git a/WFormSynchronizeData_SMR/WFormReadData_SMR/Program.cs b/WFormSynchronizeData_SMR/WFormReadData_SMR/Program.cs index e85be08..ed1d2e9 100644 --- a/WFormSynchronizeData_SMR/WFormReadData_SMR/Program.cs +++ b/WFormSynchronizeData_SMR/WFormReadData_SMR/Program.cs @@ -16,7 +16,7 @@ { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new ReadCoordinateExcelFrom()); + Application.Run(new ReadCSV()); } } } diff --git a/WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCSV.Designer.cs b/WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCSV.Designer.cs index 6fe0c36..5750a3a 100644 --- a/WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCSV.Designer.cs +++ b/WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCSV.Designer.cs @@ -62,7 +62,7 @@ this.ListSelect.ItemHeight = 18; this.ListSelect.Location = new System.Drawing.Point(19, 195); this.ListSelect.Name = "ListSelect"; - this.ListSelect.Size = new System.Drawing.Size(766, 310); + this.ListSelect.Size = new System.Drawing.Size(845, 310); this.ListSelect.TabIndex = 21; // // btnSelect @@ -179,7 +179,7 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(800, 520); + this.ClientSize = new System.Drawing.Size(876, 520); this.Controls.Add(this.label1); this.Controls.Add(this.ListSelect); this.Controls.Add(this.btnSelect); diff --git a/WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCSV.cs b/WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCSV.cs index 19b73e0..2ceb1f3 100644 --- a/WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCSV.cs +++ b/WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCSV.cs @@ -128,6 +128,7 @@ this.btnGH.Enabled = false; this.btnSelect.Enabled = false; num = 1; + //ReadCsv(); } else if (num == 1) { @@ -158,20 +159,36 @@ string Date = DateTime.Now.ToString("yyMMdd"); string HBath = this.txtHBath.Text; + string Year = DateTime.Now.Year.ToString(); + Year = Year.Substring(Year.Length - 2, 2); + string Month = DateTime.Now.Month.ToString(); + Month = Month.Length > 1 ? Month : "0" + Month; + string Day = DateTime.Now.Day.ToString(); + Day = Day.Length > 1 ? Day : "0" + Day; + //娉�:鏂帿灏旂粍瑁�3 鍦‥鐩� _332009 //鍏朵綑鍦―鐩� _C332001_2M //string csv_file_path = $@"C:\Users\admin\Desktop\鏂板缓鏂囦欢澶� (2)\20231123.csv"; //string csv_file_path = $@"D:\THLCR_Data\{HBath}\{HBath}_{Date}_C332001_2M.csv"; //缁勮1 缁勮2璺緞 string csv_file_path = $@"E:\THLCR_Data\{HBath}\{HBath}_{Date}_332009.csv"; //缁勮3璺緞 + //15杞﹂棿缂哄皯璺緞 D:\DATA SAVE\骞碶骞存湀\骞存湀鏃鎵规鍙穃鏁版嵁淇濆瓨.csv + //string csv_file_path = $@"D:\DATA SAVE\{Year}\{Year + Month}\{Year + Month + Day}\{HBath}\鏁版嵁淇濆瓨.csv"; + bool flag = File.Exists(csv_file_path); if (flag) { DataTable dt = new DataTable(); + //string HTypeName = "鏃犲皹"; //string csv_file_path_Read = @"C:\Users\admin\Desktop\鏂板缓鏂囦欢澶� (2)\20231123_1.csv"; //string csv_file_path_Read = $@"D:\THLCR_Data\{HBath}\{HBath}_{Date}_C332001_2M_Read.csv"; //缁勮1 缁勮2璺緞 - string csv_file_path_Read = $@"E:\THLCR_Data\{HBath}\{HBath}_{Date}_332009_Read.csv"; //缁勮3璺緞 + //string csv_file_path_Read = $@"E:\THLCR_Data\{HBath}\{HBath}_{Date}_332009_Read.csv"; //缁勮3璺緞 + string HTypeName = "15"; + //15杞﹂棿缂哄皯璺緞 D:\DATA SAVE\骞碶骞存湀\骞存湀鏃鎵规鍙穃鏁版嵁淇濆瓨.csv + //string csv_file_path_Read = $@"C:\Users\admin\Desktop\鏂板缓鏂囦欢澶� (2)\DATA SAVE\鏁版嵁淇濆瓨_MES璇诲彇.csv"; + + string csv_file_path_Read = $@"D:\DATA SAVE\{Year}\{Year + Month}\{Year + Month + Day}\{HBath}\鏁版嵁淇濆瓨_MES璇诲彇.csv"; File.Copy(csv_file_path, csv_file_path_Read, true); @@ -203,61 +220,131 @@ parser.Close(); //鑾峰彇褰撳墠鏃堕棿 - DateTime ActionTime = DateTime.Parse(DateTime.Now.AddMinutes(-1).ToString("yyyy-MM-dd HH:mm:ss")); + DateTime ActionTime = DateTime.Parse(DateTime.Now.AddMinutes(-2).ToString("yyyy-MM-dd HH:mm:ss")); DateTime EndTime = DateTime.Parse(DateTime.Now.AddMinutes(1).ToString("yyyy-MM-dd HH:mm:00")); foreach (DataRow item in dt.Rows) { - DateTime NowTime = DateTime.Parse(item["娴嬭瘯鏃堕棿"].ToString()); - string HBadCodeSN = item["搴忓彿"].ToString(); - - if (((NowTime >= ActionTime && NowTime < EndTime) || dt.Rows.Count <= 20) && HBadCodeSN != "") + if (HTypeName == "鏃犲皹") { + DateTime NowTime = DateTime.Parse(item["娴嬭瘯鏃堕棿"].ToString()); + string HBadCodeSN = item["搴忓彿"].ToString(); - string HSourceCode = this.HSouce.Text; //璁惧缂栧彿 缁勮1 9994 缁勮2 9995 缁勮3 9996 - string HEmpCode = this.HEmpCode.Text; - string HBarCode = item["搴忓彿"].ToString(); - string HCreateTime = item["娴嬭瘯鏃堕棿"].ToString(); - string HDate = DateTime.Parse(item["娴嬭瘯鏃堕棿"].ToString()).ToString("yyyy-MM-dd"); - string HResult = item["鍒嗛��"].ToString() == "PASS" ? "OK" : "NG"; - string HProcNumber = "005"; - int HFlag = 0; - //string HEmpCode = ""; - if (HBadCodeSN != "") + if (((NowTime >= ActionTime && NowTime < EndTime) || dt.Rows.Count <= 20) && HBadCodeSN != "") { - string HType = ""; - int HCount = 1; - DataSet ds = oCN.RunProcReturn(@"select * from Sb_EquipMentCollection_SN where HBarCode='" + HBarCode + "' and HCreateTime='" + HCreateTime + "'", "Sb_EquipMentCollection_SN"); - - if (ds.Tables[0].Rows.Count == 0) + string HSourceCode = this.HSouce.Text; //璁惧缂栧彿 缁勮1 9994 缁勮2 9995 缁勮3 9996 + string HEmpCode = this.HEmpCode.Text; + string HBarCode = item["搴忓彿"].ToString(); + string HCreateTime = item["娴嬭瘯鏃堕棿"].ToString(); + string HDate = DateTime.Parse(item["娴嬭瘯鏃堕棿"].ToString()).ToString("yyyy-MM-dd"); + string HResult = item["鍒嗛��"].ToString() == "PASS" ? "OK" : "NG"; + string HProcNumber = "005"; + int HFlag = 0; + //string HEmpCode = ""; + if (HBadCodeSN != "") { - string sql = $@"insert into Sb_EquipMentCollection_SN(HSourceCode,HEmpCode,HType,HBarCode,HCount,HCreateTime,HDate,HResult,HProcNumber,HFlag) - values('{HSourceCode}','{HEmpCode}','{HType}','{HBarCode}','{HCount}','{HCreateTime}','{HDate}','{HResult}','{HProcNumber}','{HFlag}')"; - oCN.RunProc(sql); - ListSelect.Items.Add("鏉$爜:" + HBarCode + ",鏃ユ湡:" + HCreateTime + ",缁撴灉:" + HResult); - } - } + string HType = ""; + int HCount = 1; - for (int i = 0; i < dt.Columns.Count; i++) - { - if (dt.Columns[i].ColumnName.Contains("Hz")) - { - string HType = dt.Columns[i].ColumnName; - string HCount = item[HType].ToString(); - - DataSet ds = oCN.RunProcReturn(@"select * from Sb_EquipMentCollectionTechParam_SN where HBarCode='" + HBarCode + "' and HType='" + HType + "'", "Sb_EquipMentCollectionTechParam_SN"); + DataSet ds = oCN.RunProcReturn(@"select * from Sb_EquipMentCollection_SN where HBarCode='" + HBarCode + "' and HCreateTime='" + HCreateTime + "'", "Sb_EquipMentCollection_SN"); if (ds.Tables[0].Rows.Count == 0) { - string sql = $@"insert into Sb_EquipMentCollectionTechParam_SN(HSourceCode,HEmpCode,HType,HBarCode,HCount,HCreateTime,HDate,HResult,HProcNumber,HFlag) -values('{HSourceCode}','{HEmpCode}','{HType}','{HBarCode}','{HCount}','{HCreateTime}','{HDate}','{HResult}','{HProcNumber}','{HFlag}')"; + string sql = $@"insert into Sb_EquipMentCollection_SN(HSourceCode,HEmpCode,HType,HBarCode,HCount,HCreateTime,HDate,HResult,HProcNumber,HFlag) + values('{HSourceCode}','{HEmpCode}','{HType}','{HBarCode}','{HCount}','{HCreateTime}','{HDate}','{HResult}','{HProcNumber}','{HFlag}')"; oCN.RunProc(sql); - //ListSelect.Items.Add("鏉$爜:" + HBarCode + ",鏃ユ湡:" + HCreateTime + ",缁撴灉:" + HResult); + ListSelect.Items.Add("鏉$爜:" + HBarCode + ",鏃ユ湡:" + HCreateTime + ",缁撴灉:" + HResult); + } + } + + for (int i = 0; i < dt.Columns.Count; i++) + { + if (dt.Columns[i].ColumnName.Contains("Hz")) + { + string HType = dt.Columns[i].ColumnName; + string HCount = item[HType].ToString(); + + DataSet ds = oCN.RunProcReturn(@"select * from Sb_EquipMentCollectionTechParam_SN where HBarCode='" + HBarCode + "' and HType='" + HType + "'", "Sb_EquipMentCollectionTechParam_SN"); + + if (ds.Tables[0].Rows.Count == 0) + { + string sql = $@"insert into Sb_EquipMentCollectionTechParam_SN(HSourceCode,HEmpCode,HType,HBarCode,HCount,HCreateTime,HDate,HResult,HProcNumber,HFlag) +values('{HSourceCode}','{HEmpCode}','{HType}','{HBarCode}','{HCount}','{HCreateTime}','{HDate}','{HResult}','{HProcNumber}','{HFlag}')"; + oCN.RunProc(sql); + //ListSelect.Items.Add("鏉$爜:" + HBarCode + ",鏃ユ湡:" + HCreateTime + ",缁撴灉:" + HResult); + } } } } } + + if (HTypeName == "15") + { + DateTime NowTime = DateTime.Parse(item["CS_鏃堕棿"].ToString()); + string HBadCodeSN = item["CS_DM鐮�"].ToString(); + + if (((NowTime >= ActionTime && NowTime < EndTime) || dt.Rows.Count <= 20) && HBadCodeSN != "") + { + + string HSourceCode = this.HSouce.Text; //璁惧缂栧彿 缁勮1 9994 缁勮2 9995 缁勮3 9996 + string HEmpCode = this.HEmpCode.Text; + string HBarCode = item["CS_DM鐮�"].ToString(); + string HCreateTime = item["CS_鏃堕棿"].ToString(); + string HDate = DateTime.Parse(item["CS_鏃堕棿"].ToString()).ToString("yyyy-MM-dd"); + string HResult = item["CS_鎬荤粨鏋�"].ToString(); + string HProcNumber = "005"; + int HFlag = 0; + + if (HResult != "") { + if (HBadCodeSN != "") + { + string HType = ""; + int HCount = 1; + + DataSet ds = oCN.RunProcReturn(@"select * from Sb_EquipMentCollection_SN where HBarCode='" + HBarCode + "' and HCreateTime='" + HCreateTime + "'", "Sb_EquipMentCollection_SN"); + + if (ds.Tables[0].Rows.Count == 0) + { + string sql = $@"insert into Sb_EquipMentCollection_SN(HSourceCode,HEmpCode,HType,HBarCode,HCount,HCreateTime,HDate,HResult,HProcNumber,HFlag) + values('{HSourceCode}','{HEmpCode}','{HType}','{HBarCode}','{HCount}','{HCreateTime}','{HDate}','{HResult}','{HProcNumber}','{HFlag}')"; + oCN.RunProc(sql); + ListSelect.Items.Add("鏉$爜:" + HBarCode + ",鏃ユ湡:" + HCreateTime + ",缁撴灉:" + HResult); + } + } + + for (int i = 0; i < dt.Columns.Count; i++) + { + if (dt.Columns[i].ColumnName.Contains("CS_")) + { + string HType = dt.Columns[i].ColumnName; + string HCount = item[HType].ToString(); + string HResult_TechParam = ""; + if (HType != "CS_鏃堕棿" && HType != "CS_DM鐮�" && HType != "CS_鎬荤粨鏋�") + { + HResult_TechParam = HCount; + double number = 0; + if (!Double.TryParse(HCount, out number)) + { + HCount = "0"; + } + + DataSet ds = oCN.RunProcReturn(@"select * from Sb_EquipMentCollectionTechParam_SN where HBarCode='" + HBarCode + "' and HType='" + HType + "'", "Sb_EquipMentCollectionTechParam_SN"); + + if (ds.Tables[0].Rows.Count == 0) + { + string sql = $@"insert into Sb_EquipMentCollectionTechParam_SN(HSourceCode,HEmpCode,HType,HBarCode,HCount,HCreateTime,HDate,HResult,HProcNumber,HFlag) +values('{HSourceCode}','{HEmpCode}','{HType}','{HBarCode}','{(HCount == "" ? " 0" : HCount)}','{HCreateTime}','{HDate}','{HResult_TechParam}','{HProcNumber}','{HFlag}')"; + oCN.RunProc(sql); + //ListSelect.Items.Add("鏉$爜:" + HBarCode + ",鏃ユ湡:" + HCreateTime + ",缁撴灉:" + HResult); + } + } + } + } + } + } + } + } } } diff --git a/WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCoordinateExcelFrom.Designer.cs b/WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCoordinateExcelFrom.Designer.cs index fc0bd10..44e06fb 100644 --- a/WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCoordinateExcelFrom.Designer.cs +++ b/WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCoordinateExcelFrom.Designer.cs @@ -45,12 +45,17 @@ this.HTakeSampleCheckBillNo = new System.Windows.Forms.Label(); this.HTakeSampleCheckBillID = new System.Windows.Forms.Label(); this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog(); + this.txtHMaker = new System.Windows.Forms.TextBox(); + this.label6 = new System.Windows.Forms.Label(); + this.txtHMakerNumber = new System.Windows.Forms.TextBox(); + this.label5 = new System.Windows.Forms.Label(); + this.labHMakerID = new System.Windows.Forms.Label(); this.SuspendLayout(); // // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(29, 34); + this.label1.Location = new System.Drawing.Point(29, 86); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(89, 18); this.label1.TabIndex = 0; @@ -63,7 +68,7 @@ "棣栦欢妫�楠屽崟", "宸ュ簭妫�楠屽崟", "宸℃妫�楠屽崟"}); - this.cmbJYSelect.Location = new System.Drawing.Point(124, 30); + this.cmbJYSelect.Location = new System.Drawing.Point(124, 82); this.cmbJYSelect.Name = "cmbJYSelect"; this.cmbJYSelect.Size = new System.Drawing.Size(121, 26); this.cmbJYSelect.TabIndex = 1; @@ -71,15 +76,15 @@ // label2 // this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(521, 34); + this.label2.Location = new System.Drawing.Point(521, 86); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(71, 18); this.label2.TabIndex = 2; - this.label2.Text = "娴佽浆鍗�:"; + this.label2.Text = "鍙栨牱鍗�:"; // // txtLzk // - this.txtLzk.Location = new System.Drawing.Point(599, 29); + this.txtLzk.Location = new System.Drawing.Point(599, 81); this.txtLzk.Name = "txtLzk"; this.txtLzk.Size = new System.Drawing.Size(194, 28); this.txtLzk.TabIndex = 3; @@ -87,7 +92,7 @@ // // txtPcm // - this.txtPcm.Location = new System.Drawing.Point(867, 29); + this.txtPcm.Location = new System.Drawing.Point(867, 81); this.txtPcm.Name = "txtPcm"; this.txtPcm.Size = new System.Drawing.Size(100, 28); this.txtPcm.TabIndex = 4; @@ -95,7 +100,7 @@ // label3 // this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(799, 34); + this.label3.Location = new System.Drawing.Point(799, 86); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(71, 18); this.label3.TabIndex = 5; @@ -103,7 +108,7 @@ // // btnLj // - this.btnLj.Location = new System.Drawing.Point(779, 85); + this.btnLj.Location = new System.Drawing.Point(779, 137); this.btnLj.Name = "btnLj"; this.btnLj.Size = new System.Drawing.Size(115, 42); this.btnLj.TabIndex = 6; @@ -113,7 +118,7 @@ // // txtLj // - this.txtLj.Location = new System.Drawing.Point(124, 94); + this.txtLj.Location = new System.Drawing.Point(124, 146); this.txtLj.Name = "txtLj"; this.txtLj.Size = new System.Drawing.Size(637, 28); this.txtLj.TabIndex = 7; @@ -121,7 +126,7 @@ // label4 // this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(52, 97); + this.label4.Location = new System.Drawing.Point(52, 149); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(53, 18); this.label4.TabIndex = 8; @@ -131,14 +136,14 @@ // this.ListData.FormattingEnabled = true; this.ListData.ItemHeight = 18; - this.ListData.Location = new System.Drawing.Point(49, 158); + this.ListData.Location = new System.Drawing.Point(55, 198); this.ListData.Name = "ListData"; this.ListData.Size = new System.Drawing.Size(952, 346); this.ListData.TabIndex = 9; // // btnSave // - this.btnSave.Location = new System.Drawing.Point(900, 85); + this.btnSave.Location = new System.Drawing.Point(900, 137); this.btnSave.Name = "btnSave"; this.btnSave.Size = new System.Drawing.Size(63, 42); this.btnSave.TabIndex = 10; @@ -149,7 +154,7 @@ // cmbPro // this.cmbPro.FormattingEnabled = true; - this.cmbPro.Location = new System.Drawing.Point(339, 30); + this.cmbPro.Location = new System.Drawing.Point(339, 82); this.cmbPro.Name = "cmbPro"; this.cmbPro.Size = new System.Drawing.Size(156, 26); this.cmbPro.TabIndex = 12; @@ -157,7 +162,7 @@ // txtPro // this.txtPro.AutoSize = true; - this.txtPro.Location = new System.Drawing.Point(280, 34); + this.txtPro.Location = new System.Drawing.Point(280, 86); this.txtPro.Name = "txtPro"; this.txtPro.Size = new System.Drawing.Size(53, 18); this.txtPro.TabIndex = 11; @@ -166,7 +171,7 @@ // HTakeSampleCheckBillNo // this.HTakeSampleCheckBillNo.AutoSize = true; - this.HTakeSampleCheckBillNo.Location = new System.Drawing.Point(32, 76); + this.HTakeSampleCheckBillNo.Location = new System.Drawing.Point(32, 128); this.HTakeSampleCheckBillNo.Name = "HTakeSampleCheckBillNo"; this.HTakeSampleCheckBillNo.Size = new System.Drawing.Size(206, 18); this.HTakeSampleCheckBillNo.TabIndex = 13; @@ -176,18 +181,68 @@ // HTakeSampleCheckBillID // this.HTakeSampleCheckBillID.AutoSize = true; - this.HTakeSampleCheckBillID.Location = new System.Drawing.Point(258, 73); + this.HTakeSampleCheckBillID.Location = new System.Drawing.Point(258, 125); this.HTakeSampleCheckBillID.Name = "HTakeSampleCheckBillID"; this.HTakeSampleCheckBillID.Size = new System.Drawing.Size(206, 18); this.HTakeSampleCheckBillID.TabIndex = 14; this.HTakeSampleCheckBillID.Text = "HTakeSampleCheckBillID"; this.HTakeSampleCheckBillID.Visible = false; // + // txtHMaker + // + this.txtHMaker.Location = new System.Drawing.Point(124, 26); + this.txtHMaker.Name = "txtHMaker"; + this.txtHMaker.Size = new System.Drawing.Size(170, 28); + this.txtHMaker.TabIndex = 2; + this.txtHMaker.Enter += new System.EventHandler(this.txtHMaker_Enter); + this.txtHMaker.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtHMaker_KeyDown); + this.txtHMaker.Leave += new System.EventHandler(this.txtHMaker_Leave); + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(46, 31); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(71, 18); + this.label6.TabIndex = 15; + this.label6.Text = "鍒跺崟浜�:"; + // + // txtHMakerNumber + // + this.txtHMakerNumber.Location = new System.Drawing.Point(401, 26); + this.txtHMakerNumber.Name = "txtHMakerNumber"; + this.txtHMakerNumber.Size = new System.Drawing.Size(170, 28); + this.txtHMakerNumber.TabIndex = 18; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(323, 31); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(53, 18); + this.label5.TabIndex = 17; + this.label5.Text = "缂栫爜:"; + // + // labHMakerID + // + this.labHMakerID.AutoSize = true; + this.labHMakerID.Location = new System.Drawing.Point(596, 29); + this.labHMakerID.Name = "labHMakerID"; + this.labHMakerID.Size = new System.Drawing.Size(107, 18); + this.labHMakerID.TabIndex = 19; + this.labHMakerID.Text = "labHMakerID"; + this.labHMakerID.Visible = false; + // // ReadCoordinateExcelFrom // this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1033, 538); + this.ClientSize = new System.Drawing.Size(1033, 565); + this.Controls.Add(this.labHMakerID); + this.Controls.Add(this.txtHMakerNumber); + this.Controls.Add(this.label5); + this.Controls.Add(this.txtHMaker); + this.Controls.Add(this.label6); this.Controls.Add(this.HTakeSampleCheckBillID); this.Controls.Add(this.HTakeSampleCheckBillNo); this.Controls.Add(this.cmbPro); @@ -231,5 +286,10 @@ private System.Windows.Forms.Label HTakeSampleCheckBillNo; private System.Windows.Forms.Label HTakeSampleCheckBillID; private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1; + private System.Windows.Forms.TextBox txtHMaker; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.TextBox txtHMakerNumber; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label labHMakerID; } } \ No newline at end of file diff --git a/WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCoordinateExcelFrom.cs b/WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCoordinateExcelFrom.cs index 6c2c132..a3eccff 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()) { @@ -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,10 @@ ",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 + "'" + ") "); } - + //涓昏〃 oCN.RunProc("Insert Into QC_FirstPieceCheckBillMain " + "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate" + @@ -502,13 +511,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,getdate(),'" + 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 +600,7 @@ + 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 + "'" + ") "); } //涓昏〃 @@ -600,13 +610,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,getdate(),'"+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,7 +697,7 @@ ",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() + "') "); } @@ -704,14 +714,15 @@ ",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType,HICMOEntryID,HQCSchemeID,HICMOQty" + ",HProcExchQty,HShiftsID,HErrTreatment" + ",HTakeSampleCheckBillID,HTakeSampleCheckBillNo" + - ") " + - " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "',1,getdate(),'',getdate()" + + ",HBatchNo) " + + " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "',1,getdate(),'" + 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 + "') "); oCN.Commit(); @@ -731,7 +742,14 @@ { if (e.KeyCode == Keys.Enter) { - SelectHBardCode(this.txtLzk.Text); + if (this.txtHMakerNumber.Text == "") + { + MessageBox.Show("璇疯緭鍏ュ埗鍗曚汉淇℃伅!"); + } + else { + SelectHBardCode(this.txtLzk.Text); + } + } } @@ -741,32 +759,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 +823,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 +834,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 diff --git a/WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug.rar b/WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug.rar index 90748e8..3a48e62 100644 --- a/WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug.rar +++ b/WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug.rar Binary files differ diff --git a/WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/WFormReadData_SMR.exe b/WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/WFormReadData_SMR.exe index b02cdd7..1afede3 100644 --- a/WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/WFormReadData_SMR.exe +++ b/WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/WFormReadData_SMR.exe Binary files differ diff --git a/WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/WFormReadData_SMR.pdb b/WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/WFormReadData_SMR.pdb index 3b8218a..9b67714 100644 --- a/WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/WFormReadData_SMR.pdb +++ b/WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/WFormReadData_SMR.pdb Binary files differ diff --git a/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/DesignTimeResolveAssemblyReferences.cache b/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/DesignTimeResolveAssemblyReferences.cache index 9123945..bc3ddb0 100644 --- a/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/DesignTimeResolveAssemblyReferences.cache +++ b/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/DesignTimeResolveAssemblyReferences.cache Binary files differ diff --git a/WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/EquipmentCollectionForm.csproj.AssemblyReference.cache b/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.AssemblyReference.cache similarity index 100% rename from WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/EquipmentCollectionForm.csproj.AssemblyReference.cache rename to WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.AssemblyReference.cache Binary files differ diff --git a/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.FileListAbsolute.txt b/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.FileListAbsolute.txt index b96d75c..f747ad3 100644 --- a/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.FileListAbsolute.txt +++ b/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.FileListAbsolute.txt @@ -25,6 +25,7 @@ E:\鏅轰簯mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormReadData_SMR\bin\Debug\NPOI.OpenXml4Net.pdb E:\鏅轰簯mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormReadData_SMR\bin\Debug\NPOI.OpenXml4Net.xml E:\鏅轰簯mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormReadData_SMR\bin\Debug\NPOI.OpenXmlFormats.pdb +E:\鏅轰簯mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormReadData_SMR\obj\Debug\WFormReadData_SMR.csproj.AssemblyReference.cache E:\鏅轰簯mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormReadData_SMR\obj\Debug\WFormReadData_SMR.Properties.Resources.resources E:\鏅轰簯mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormReadData_SMR\obj\Debug\WFormReadData_SMR.ReadCoordinateExcelFrom.resources E:\鏅轰簯mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormReadData_SMR\obj\Debug\WFormReadData_SMR.ReadCSV.resources diff --git a/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.GenerateResource.cache b/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.GenerateResource.cache index 2489e8e..db71a11 100644 --- a/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.GenerateResource.cache +++ b/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.GenerateResource.cache Binary files differ diff --git a/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.exe b/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.exe index b02cdd7..1afede3 100644 --- a/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.exe +++ b/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.exe Binary files differ diff --git a/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.pdb b/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.pdb index 3b8218a..9b67714 100644 --- a/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.pdb +++ b/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.pdb Binary files differ diff --git a/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/Form1.cs b/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/Form1.cs index a719d7c..44c5b82 100644 --- a/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/Form1.cs +++ b/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/Form1.cs @@ -73,6 +73,7 @@ //鍒ゆ柇杩欎釜鏉$爜涔嬪墠鐨勭姸鎬佹槸鍚︿负NG DataSet ds = oCN.RunProcReturn(@"select * from Sb_EquipMentCollection_SN WITH(NOLOCK) where HBarCode='" + HBadCodeSN + "' and HCreateTime<'" + dic["HCreateTime"].ToString() + "' and HResult='NG'", "Sb_EquipMentCollection_SN"); + //鏌ヨ鍑虹珯鍗曟槸鍚﹀寘鍚潯鐮� DataSet ds1 = oCN.RunProcReturn(@"select a.HSourceID,a.HProcID,* from Sc_StationOutBillMain a WITH(NOLOCK) inner join Sc_StationOutBillSub_SN sn WITH(NOLOCK) on a.HInterID=sn.HInterID left join Gy_Source s WITH(NOLOCK) on a.HSourceID=s.HItemID @@ -170,9 +171,11 @@ //鏌ヨ鑱屽憳 ds = oCN.RunProcReturn("select * from Gy_Employee WITH(NOLOCK) where HNumber='" + dic["HEmpCode"].ToString() + "' ", "Gy_Employee"); long HEmpIDs = 0; + string HEmpName = ""; if (ds.Tables[0].Rows.Count != 0) { HEmpIDs = long.Parse(ds.Tables[0].Rows[0]["HItemID"].ToString());//鑱屽憳ID + HEmpName = ds.Tables[0].Rows[0]["HName"].ToString(); } long HDeptID = 0; @@ -206,7 +209,7 @@ string HBillSubType = "3791"; int HBillStatus = 1; - string HMaker = "";//鍒跺崟浜� + string HMaker = HEmpName;//鍒跺崟浜� string HMouldNum = "";//妯$┐鍙� int HYear = DateTime.Now.Year; double HPeriod = DateTime.Now.Month; @@ -575,7 +578,8 @@ CustomWriteLog("鏉$爜:" + HBadCodeSN + "宸ュ簭:"+ HProcNumber + ",鍑虹珯鏃堕棿:" + HMakeTime, "TM" + DateTime.Now.ToString("yyyy-MM-dd")); //鍙嶅啓宸ュ簭鍑虹珯鍗曠殑鍚堟牸鏁伴噺 - oCN.RunProc("update Sc_StationOutBillMain set HQty+=1,HBadCount-=1 where HInterID='" + HInterID + "'"); + //oCN.RunProc("update Sc_StationOutBillMain set HQty+=1,HBadCount-=1 where HInterID='" + HInterID + "'"); + oCN.RunProc("update Sc_StationOutBillMain set HQty+=1 where HInterID='" + HInterID + "'"); //鍙嶅啓鏉$爜鐘舵�� oCN.RunProc("update Gy_BarCodeBill set HStatus='' where HBarCode='" + HBadCodeSN + "'"); } @@ -603,14 +607,16 @@ { - DataSet ds = oCN.RunProcReturn("select * from Sc_StationOutBillMain WITH(NOLOCK) where HInterID=" + HInterID + " and HBillNo='" + HBillNo + "'", "Sc_StationOutBillMain"); + DataSet ds = oCN.RunProcReturn(@"select a.HProcExchInterID,a.HProcExchEntryID,a.HProcExchBillNo,a.HProcID,p.HNumber from Sc_StationOutBillMain a WITH(NOLOCK) +left join Gy_Process p WITH(NOLOCK) on a.HProcID=p.HItemID where HInterID=" + HInterID + " and HBillNo='" + HBillNo + "'", "Sc_StationOutBillMain"); string HProcExchInterID = ds.Tables[0].Rows[0]["HProcExchInterID"].ToString(); string HProcExchEntryID = ds.Tables[0].Rows[0]["HProcExchEntryID"].ToString(); string HProcExchBillNo = ds.Tables[0].Rows[0]["HProcExchBillNo"].ToString(); string HProcID = ds.Tables[0].Rows[0]["HProcID"].ToString(); + string HProcNum = ds.Tables[0].Rows[0]["HNumber"].ToString(); //娉�:鍥犱负 缁勮 鎷嶇収 鏃堕棿闂撮殧姣旇緝鐭� 鎵�浠ョ洰鍓嶅彧鏄庣‘缁勮宸ュ簭鎵嶅彲浠ヤ繚瀛樺伐鑹哄弬鏁� 涔嬪悗濡傛灉鏈夊叾浠栧伐搴忕殑璇� 闇�瑕佸鍔犲伐搴忓瓧娈� - if (HProcID == "88") { - ds = oCN.RunProcReturn(@"select s.HItemID HMouldID,t.HItemID HTechParamID,HCount,HCreateTime from Sb_EquipMentCollectionTechParam_SN a WITH(NOLOCK) + if (HProcID == "88"|| HProcNum=="005") { + ds = oCN.RunProcReturn(@"select s.HItemID HMouldID,t.HItemID HTechParamID,HCount,HCreateTime,a.HResult from Sb_EquipMentCollectionTechParam_SN a WITH(NOLOCK) inner join Gy_Source s WITH(NOLOCK) on a.HSourceCode=s.HNumber inner join Gy_TechnologyParameter t WITH(NOLOCK) on a.HType=t.HName where a.HFlag=0 and a.HBarCode='" + HBadCodeSN + "'", "Sb_EquipMentCollectionTechParam_SN"); @@ -625,11 +631,12 @@ string HTechParamID = ds.Tables[0].Rows[i]["HTechParamID"].ToString(); string HCount = ds.Tables[0].Rows[i]["HCount"].ToString(); string HGetTime = ds.Tables[0].Rows[i]["HCreateTime"].ToString(); + string HResult = ds.Tables[0].Rows[i]["HResult"].ToString(); DataSet dataSet = oCN.RunProcReturn("select * from Sc_StationOutBillSub_TechParam WITH(NOLOCK) where HInterID=" + HInterID + " and HBillNo_bak='" + HBillNo + "'", "Sc_StationOutBillSub_TechParam"); - sql = "insert into Sc_StationOutBillSub_TechParam(HInterID,HBillNo_bak,HEntryID ,HSourceInterID,HSourceEntryID,HSourceBillNo,HTechParamID,HRelValue,HGetTime,HBarCode,HMouldID)" + - $"values({HInterID},'{HBillNo}',{(dataSet.Tables[0].Rows.Count + 1)},{HProcExchInterID},{HProcExchEntryID},'{HProcExchBillNo}',{HTechParamID},{HCount},'{HGetTime}','{HBadCodeSN}',{HMouldID})"; + sql = "insert into Sc_StationOutBillSub_TechParam(HInterID,HBillNo_bak,HEntryID ,HSourceInterID,HSourceEntryID,HSourceBillNo,HTechParamID,HRelValue,HGetTime,HBarCode,HMouldID,HRemark)" + + $"values({HInterID},'{HBillNo}',{(dataSet.Tables[0].Rows.Count + 1)},{HProcExchInterID},{HProcExchEntryID},'{HProcExchBillNo}',{HTechParamID},{HCount},'{HGetTime}','{HBadCodeSN}',{HMouldID},'{HResult}')"; oCN.RunProc(sql); } @@ -652,11 +659,28 @@ { try { + DataSet ds = oCN.RunProcReturn(@"select * from Gy_BarCodeBill where HBarCode='" + HBadCodeSN + "'", "Gy_BarCodeBill"); + //鍒ゆ柇鏉$爜鏄惁瀛樺湪鏉$爜妗f + if (ds.Tables[0].Rows.Count > 0) + { + string HSourceBillNo = ds.Tables[0].Rows[0]["HSourceBillNo"].ToString(); + DataSet dataTable = oCN.RunProcReturn(@"select * from Sc_ProcessExchangeBillMain where HBillNo='" + HSourceBillNo + "'", "Sc_ProcessExchangeBillMain"); + //鍒ゆ柇鏉$爜鐨勬簮鍗� 娴佽浆鍗℃槸鍚﹁鍒犻櫎 + if (dataTable.Tables[0].Rows.Count == 0) + { + //濡傛灉婧愬崟宸茬粡鍒犻櫎 鍒欐潯鐮佷篃鍒犻櫎閲嶆柊鐢熸垚 + oCN.RunProc("delete from Gy_BarCodeBill where HBarCode='" + HBadCodeSN + "'"); + + //閲嶆柊鏌ヨ鏉$爜妗f 杩涘叆鏂板鏂规硶 + ds = oCN.RunProcReturn(@"select * from Gy_BarCodeBill where HBarCode='" + HBadCodeSN + "'", "Gy_BarCodeBill"); + } + } + //鍒ゆ柇鏉$爜鏄惁鍦ㄦ暟鎹簱閲� if (ds.Tables[0].Rows.Count == 0) { - //鍒ゆ柇闀垮害鏄惁涓�29浣� + //鍒ゆ柇闀垮害鏄惁涓�29浣� 鏃犲皹杞﹂棿 if (HBadCodeSN.Length == 29) { string str1 = HBadCodeSN.Substring(18, 8); @@ -683,6 +707,24 @@ CustomWriteLog("鏉$爜:" + HBadCodeSN + ",娴佽浆鍗′笉瀛樺湪!", DateTime.Now.ToString("yyyy-MM-dd")); return 2; } + } + } + //鍒ゆ柇闀垮害鏄惁涓�50浣� 15杞﹂棿 + else if (HBadCodeSN.Length == 50) + { + string str1 = HBadCodeSN.Substring(42, 8); + ds = oCN.RunProcReturn("select * from Sc_ProcessExchangeBillMain where HProjectNum like'" + str1 + "-1%'", "Sc_ProcessExchangeBillMain"); + //鍒ゆ柇鏄惁鑳芥壘鍒板搴旂殑娴佽浆鍗� + if (ds.Tables[0].Rows.Count > 0) + { + string HProcExchBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString(); + get_HBardBillSave(HBadCodeSN, HProcExchBillNo); + } + else + { + oCN.RollBack(); + CustomWriteLog("鏉$爜:" + HBadCodeSN + ",娴佽浆鍗′笉瀛樺湪!", DateTime.Now.ToString("yyyy-MM-dd")); + return 2; } } else @@ -817,7 +859,7 @@ //瀹氭椂璇诲彇鏁版嵁 private void timer1_Tick(object sender, EventArgs e) { - DataTable list = oCN.RunProcReturn("select * from Sb_EquipMentCollection_SN WITH(NOLOCK) where HFlag=0 order by HCreateTime", "Sb_EquipMentCollection_SN").Tables[0]; + DataTable list = oCN.RunProcReturn("select top 100 * from Sb_EquipMentCollection_SN WITH(NOLOCK) where HFlag=0 order by HCreateTime asc", "Sb_EquipMentCollection_SN").Tables[0]; //寰幆闆嗗悎 for (int i = 0; i < list.Rows.Count; i++) @@ -826,10 +868,13 @@ string HResult = list.Rows[i]["HResult"].ToString(); string HBadCodeSN = list.Rows[i]["HBarCode"].ToString(); string HCreateTime = list.Rows[i]["HCreateTime"].ToString(); + + //HBadCodeSN = "P1099081-00-E:SDU324292189300"; + //HResult = "OK"; //寮�濮嬩簨鍔� oCN.BeginTran(); - if (HResult == "OK") + if (HResult == "OK") { flag = HResultOK(list.Rows[i]); } diff --git a/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug.rar b/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug.rar index c0935d1..26a12d3 100644 --- a/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug.rar +++ b/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug.rar Binary files differ diff --git a/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/Vlog/2024-10-02.txt b/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/Vlog/2024-10-02.txt new file mode 100644 index 0000000..277b501 --- /dev/null +++ b/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/Vlog/2024-10-02.txt @@ -0,0 +1 @@ +2024/10/2 14:47:23 鏉$爜:AAA971538000000000@7000534480@24081600148@00003Z93,娴佽浆鍗′笉瀛樺湪! diff --git a/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/Vlog/2024-10-22.txt b/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/Vlog/2024-10-22.txt new file mode 100644 index 0000000..287dba4 --- /dev/null +++ b/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/Vlog/2024-10-22.txt @@ -0,0 +1 @@ +2024/10/22 11:27:13 鏉$爜:P1099081-00-E:SDU324292189300,娴佽浆鍗′笉瀛樺湪! diff --git a/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/Vlog/TM2024-10-02.txt b/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/Vlog/TM2024-10-02.txt new file mode 100644 index 0000000..169e48b --- /dev/null +++ b/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/Vlog/TM2024-10-02.txt @@ -0,0 +1,25 @@ +2024/10/2 15:34:22 鏉$爜:AAA971538000000000@7000534480@24081600148@00003Z93宸ュ簭:005,鍑虹珯鏃堕棿:2024/10/2 14:07:00 + +2024/10/2 15:39:51 鏉$爜:AAA971538000000000@7000534480@24081600148@00003Z93宸ュ簭:005,鍑虹珯鏃堕棿:2024/10/2 14:07:00 + +2024/10/2 15:40:14 鏉$爜:AAA971538000000000@7000534480@24081600148@00003Z93宸ュ簭:005,鍑虹珯鏃堕棿:2024/10/2 14:07:00 + +2024/10/2 15:40:52 鏉$爜:AAA971538000000000@7000534480@24081600148@00003Z93宸ュ簭:005,鍑虹珯鏃堕棿:2024/10/2 14:07:00 + +2024/10/2 15:41:46 鏉$爜:AAA971538000000000@7000534480@24081600148@00003Z93宸ュ簭:005,鍑虹珯鏃堕棿:2024/10/2 14:07:00 + +2024/10/2 15:48:03 鏉$爜:AAA971538000000000@7000534480@24081600148@00003Z93宸ュ簭:005,鍑虹珯鏃堕棿:2024/10/2 14:07:00 + +2024/10/2 16:25:03 鏉$爜:AAA971538000000000@7000534480@24081600148@00003Z93宸ュ簭:005,鍑虹珯鏃堕棿:2024/10/2 14:07:00 + +2024/10/2 16:29:18 鏉$爜:AAA971538000000000@7000534480@24081600153@00003Z93宸ュ簭:005,鍑虹珯鏃堕棿:2024/10/2 14:07:00 + +2024/10/2 16:29:37 鏉$爜:AAA971538000000000@7000534480@24081600149@00003Z93宸ュ簭:005,鍑虹珯鏃堕棿:2024/10/2 14:07:00 + +2024/10/2 17:12:30 鏉$爜:AAA971538000000000@7000534480@24081600150@00003Z93宸ュ簭:005,鍑虹珯鏃堕棿:2024/10/2 14:07:00 + +2024/10/2 17:12:52 鏉$爜:AAA971538000000000@7000534480@24081600151@00003Z93宸ュ簭:005,鍑虹珯鏃堕棿:2024/10/2 14:07:00 + +2024/10/2 17:41:38 鏉$爜:AAA971538000000000@7000534480@24081600176@00003Z93宸ュ簭:005,鍑虹珯鏃堕棿:2024/10/2 17:33:00 + +2024/10/2 17:58:03 鏉$爜:AAA971538000000000@7000534480@24081600176@00003Z93宸ュ簭:005,鍑虹珯鏃堕棿:2024/10/2 17:49:00 diff --git a/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/WFormSynchronizeData_SMR.application b/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/WFormSynchronizeData_SMR.application index 6008204..2cd83da 100644 --- a/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/WFormSynchronizeData_SMR.application +++ b/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/WFormSynchronizeData_SMR.application @@ -14,7 +14,7 @@ <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" /> </dsig:Transforms> <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" /> - <dsig:DigestValue>uZI4sKjHwUeWiuQrdLaXP7lIa632KPsHC9N2B7k0PtI=</dsig:DigestValue> + <dsig:DigestValue>bVguW12HBlVMcR5UEGU4s7byOkXtf/f99RtiXyEXIsQ=</dsig:DigestValue> </hash> </dependentAssembly> </dependency> diff --git a/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/WFormSynchronizeData_SMR.exe b/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/WFormSynchronizeData_SMR.exe index 943a9ed..5809b96 100644 --- a/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/WFormSynchronizeData_SMR.exe +++ b/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/WFormSynchronizeData_SMR.exe Binary files differ diff --git a/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/WFormSynchronizeData_SMR.exe.manifest b/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/WFormSynchronizeData_SMR.exe.manifest index e311f9b..3cb9147 100644 --- a/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/WFormSynchronizeData_SMR.exe.manifest +++ b/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/WFormSynchronizeData_SMR.exe.manifest @@ -54,14 +54,14 @@ </dependentAssembly> </dependency> <dependency> - <dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="WFormSynchronizeData_SMR.exe" size="49584"> + <dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="WFormSynchronizeData_SMR.exe" size="50608"> <assemblyIdentity name="WFormSynchronizeData_SMR" version="1.0.0.0" language="neutral" processorArchitecture="msil" /> <hash> <dsig:Transforms> <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" /> </dsig:Transforms> <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" /> - <dsig:DigestValue>qAA6vs4V5oxyn1YmsE9FZFfZ7Dx5uSChCUrB4n4m9x4=</dsig:DigestValue> + <dsig:DigestValue>GytkBAS4Vk32KHXvjGXEgPiZg/PczZRYYBoz7vBcoes=</dsig:DigestValue> </hash> </dependentAssembly> </dependency> diff --git a/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/WFormSynchronizeData_SMR.pdb b/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/WFormSynchronizeData_SMR.pdb index fe93a7f..880f87d 100644 --- a/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/WFormSynchronizeData_SMR.pdb +++ b/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/WFormSynchronizeData_SMR.pdb Binary files differ diff --git a/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/app.publish/WFormSynchronizeData_SMR.exe b/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/app.publish/WFormSynchronizeData_SMR.exe index fbbb553..f61a7e1 100644 --- a/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/app.publish/WFormSynchronizeData_SMR.exe +++ b/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/app.publish/WFormSynchronizeData_SMR.exe Binary files differ diff --git a/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/DesignTimeResolveAssemblyReferences.cache b/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/DesignTimeResolveAssemblyReferences.cache index 9123945..1078187 100644 --- a/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/DesignTimeResolveAssemblyReferences.cache +++ b/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/DesignTimeResolveAssemblyReferences.cache Binary files differ diff --git a/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.application b/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.application index 6008204..2cd83da 100644 --- a/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.application +++ b/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.application @@ -14,7 +14,7 @@ <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" /> </dsig:Transforms> <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" /> - <dsig:DigestValue>uZI4sKjHwUeWiuQrdLaXP7lIa632KPsHC9N2B7k0PtI=</dsig:DigestValue> + <dsig:DigestValue>bVguW12HBlVMcR5UEGU4s7byOkXtf/f99RtiXyEXIsQ=</dsig:DigestValue> </hash> </dependentAssembly> </dependency> diff --git a/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.exe b/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.exe index 943a9ed..5809b96 100644 --- a/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.exe +++ b/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.exe Binary files differ diff --git a/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.exe.manifest b/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.exe.manifest index e311f9b..3cb9147 100644 --- a/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.exe.manifest +++ b/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.exe.manifest @@ -54,14 +54,14 @@ </dependentAssembly> </dependency> <dependency> - <dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="WFormSynchronizeData_SMR.exe" size="49584"> + <dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="WFormSynchronizeData_SMR.exe" size="50608"> <assemblyIdentity name="WFormSynchronizeData_SMR" version="1.0.0.0" language="neutral" processorArchitecture="msil" /> <hash> <dsig:Transforms> <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" /> </dsig:Transforms> <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" /> - <dsig:DigestValue>qAA6vs4V5oxyn1YmsE9FZFfZ7Dx5uSChCUrB4n4m9x4=</dsig:DigestValue> + <dsig:DigestValue>GytkBAS4Vk32KHXvjGXEgPiZg/PczZRYYBoz7vBcoes=</dsig:DigestValue> </hash> </dependentAssembly> </dependency> diff --git a/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.pdb b/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.pdb index fe93a7f..880f87d 100644 --- a/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.pdb +++ b/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.pdb Binary files differ -- Gitblit v1.9.1