From c05f5677f4e4296da0b8d9ced577bb5643e64579 Mon Sep 17 00:00:00 2001 From: yangle <admin@YINMOU> Date: 星期三, 11 九月 2024 20:18:23 +0800 Subject: [PATCH] 数据同步优化 --- WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug/EquipmentCollectionForm.exe | 0 WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.GenerateResource.cache | 0 WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.cs | 240 +++++++++++++++++++++++++++++++--------- WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/EquipmentCollectionForm.exe | 0 WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache | 0 WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCoordinateExcelFrom.cs | 6 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/DesignTimeResolveAssemblyReferencesInput.cache | 0 WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/EquipmentCollectionForm.csproj.GenerateResource.cache | 0 WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.FileListAbsolute.txt | 1 WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.exe | 0 WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.resx | 3 WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug.rar | 0 WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.CoreCompileInputs.cache | 2 WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug/Config/SQLAPI.config | 4 WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug.rar | 0 WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.csproj.user | 8 + WFormSynchronizeData_SMR/WFormReadData_SMR/WFormReadData_SMR.csproj | 9 - WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/EquipmentCollectionForm.pdb | 0 WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.pdb | 0 WFormSynchronizeData_SMR/WFormReadData_SMR/Program.cs | 2 WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug/EquipmentCollectionForm.pdb | 0 /dev/null | 0 WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.Designer.cs | 8 + WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/DesignTimeResolveAssemblyReferences.cache | 0 WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.csproj | 27 ++++ 27 files changed, 239 insertions(+), 71 deletions(-) diff --git a/WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.Designer.cs b/WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.Designer.cs index c557527..2a863b5 100644 --- a/WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.Designer.cs +++ b/WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.Designer.cs @@ -47,6 +47,7 @@ this.txtHMaterNumber = new System.Windows.Forms.TextBox(); 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.SuspendLayout(); // // cmbEquipFile @@ -195,6 +196,11 @@ this.timer.Interval = 60000; this.timer.Tick += new System.EventHandler(this.timer_Tick); // + // Time_CLHB + // + this.Time_CLHB.Interval = 3600000; + this.Time_CLHB.Tick += new System.EventHandler(this.Time_CLHB_Tick); + // // EquipmentCollectionForm // this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); @@ -218,6 +224,7 @@ this.Controls.Add(this.cmbEquipFile); this.Name = "EquipmentCollectionForm"; this.Text = "璁惧鏁版嵁閲囬泦"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.EquipmentCollectionForm_FormClosing); this.Load += new System.EventHandler(this.EquipmentCollectionForm_Load); this.ResumeLayout(false); this.PerformLayout(); @@ -243,5 +250,6 @@ private System.Windows.Forms.TextBox txtHMaterNumber; private System.Windows.Forms.Label HMaterID; private System.Windows.Forms.Timer timer; + private System.Windows.Forms.Timer Time_CLHB; } } \ No newline at end of file diff --git a/WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.cs b/WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.cs index 7d91062..1767412 100644 --- a/WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.cs +++ b/WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.cs @@ -32,6 +32,7 @@ this.txtLj.ReadOnly = true; this.btnSave.Enabled = false; this.txtHMaterNumber.ReadOnly = true; + //this.btnRest.Enabled = false; bindCbox(); } @@ -44,8 +45,8 @@ } else { - //this.txtBegin.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - this.txtBegin.Text = "2024-8-7 15:20:06"; + this.txtBegin.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + //this.txtBegin.Text = "2024-09-06 10:52:39"; this.btnBegin.Enabled = false; if (cmbEquipFile.SelectedIndex == 1) { @@ -62,8 +63,9 @@ MessageBox.Show("璇风偣鍑诲紑濮嬫寜閽繘琛屽紑濮嬬‘璁�!"); } else - { //this.txtEnd.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - this.txtEnd.Text = "2024-8-7 17:20:06"; + { + this.txtEnd.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + //this.txtEnd.Text = "2024-09-06 11:20:39"; this.btnEnd.Enabled = false; if (cmbEquipFile.SelectedIndex == 1) @@ -84,6 +86,7 @@ //璺緞璧嬪�肩粰鏂囨湰 using (OpenFileDialog openFile = new OpenFileDialog()) { + openFile.Multiselect = true; // 鍏佽閫夋嫨澶氫釜鏂囦欢 DialogResult result = openFile.ShowDialog(); if (result == DialogResult.OK) { @@ -93,21 +96,23 @@ string selectedFolderPath = openFile.FileName; this.txtLj.Text = selectedFolderPath; - objJsonResult = Xt_CSVReadText(selectedFolderPath, 1); + objJsonResult = Xt_CSVReadText(openFile.FileNames, 1); dt = objJsonResult.dataTable; if (objJsonResult.code == "0") { MessageBox.Show(objJsonResult.Message); } - else { + else + { for (int i = 0; i < dt.Rows.Count; i++) { ListData.Items.Add("搴曞瓟鐩村緞:" + dt.Rows[i]["BottomHoleDiameter"].ToString() + ",鏈夋棤铻虹墮妫�娴嬫暟鎹�:" + dt.Rows[i]["TestingData"].ToString() + ",鏈夋棤铻虹墮妫�娴嬬粨鏋�:" + dt.Rows[i]["DetectionResult"].ToString() + ",鏃堕棿:" + dt.Rows[i]["HDate"].ToString()); - } + } + } } } @@ -115,7 +120,7 @@ } //璇诲彇CSV鏂囦欢鏁版嵁 鏍规嵁鏂囦欢璺緞鎵惧埌瀵瑰簲鏂囦欢 骞惰幏鍙栧搴旂殑鏁版嵁 - public json Xt_CSVReadText(string FilePath, int num) + public json Xt_CSVReadText(string[] FilePath, int num) { try { @@ -124,46 +129,53 @@ dt.Columns.Add("TestingData"); dt.Columns.Add("DetectionResult"); dt.Columns.Add("HDate"); + DataTable dt2 = new DataTable(); - List<string[]> records = new List<string[]>(); - - using (StreamReader sr = new StreamReader(FilePath, Encoding.GetEncoding("gb2312"))) + for (int u = 0; u < FilePath.Length; u++) { - string[] headers = sr.ReadLine()?.Split(','); - if (headers != null) + using (StreamReader sr = new StreamReader(FilePath[u], Encoding.GetEncoding("gb2312"))) { - foreach (var header in headers) + string[] headers = sr.ReadLine()?.Split(','); + if (headers != null && u == 0) { - dt2.Columns.Add(header.Trim()); - } - } - - string line; - while ((line = sr.ReadLine()) != null) - { - var values = line.Split(','); - DataRow row = dt2.NewRow(); - - for (int i = 0; i < values.Length; i++) - { - // 杩欓噷鍙兘闇�瑕佹坊鍔犵被鍨嬭浆鎹㈠拰閿欒澶勭悊 - row[i] = values[i].Trim(); + foreach (var header in headers) + { + dt2.Columns.Add(header.Trim()); + } } - dt2.Rows.Add(row); + string line; + while ((line = sr.ReadLine()) != null) + { + var values = line.Split(','); + DataRow row = dt2.NewRow(); + + for (int i = 0; i < values.Length; i++) + { + // 杩欓噷鍙兘闇�瑕佹坊鍔犵被鍨嬭浆鎹㈠拰閿欒澶勭悊 + row[i] = values[i].Trim(); + } + + dt2.Rows.Add(row); + } } } - + DateTime HBegin = DateTime.Parse(this.txtBegin.Text); + DateTime HEnd = DateTime.Parse(this.txtEnd.Text); + for (int i = 0; i < dt2.Rows.Count; i++) { for (int j = 0; j < 2; j++) { - DataRow dr = dt.NewRow(); - dr["BottomHoleDiameter"] = dt2.Rows[i][dt2.Columns[j]].ToString(); - dr["TestingData"] = dt2.Rows[i][dt2.Columns[j + 2]].ToString(); - dr["DetectionResult"] = dt2.Rows[i][dt2.Columns[j + 4]].ToString(); - dr["HDate"] = DateTime.Parse(dt2.Rows[i][dt2.Columns[6]].ToString() + " " + dt2.Rows[i][dt2.Columns[7]].ToString()).ToString("yyyy-MM-dd HH:mm:ss"); - dt.Rows.Add(dr); + DateTime Now = DateTime.Parse(dt2.Rows[i][dt2.Columns[6]].ToString() + " " + dt2.Rows[i][dt2.Columns[7]].ToString()); + if (Now >= HBegin && Now <= HEnd) { + DataRow dr = dt.NewRow(); + dr["BottomHoleDiameter"] = dt2.Rows[i][dt2.Columns[j]].ToString(); + dr["TestingData"] = dt2.Rows[i][dt2.Columns[j + 2]].ToString(); + dr["DetectionResult"] = dt2.Rows[i][dt2.Columns[j + 4]].ToString(); + dr["HDate"] = DateTime.Parse(dt2.Rows[i][dt2.Columns[6]].ToString() + " " + dt2.Rows[i][dt2.Columns[7]].ToString()).ToString("yyyy-MM-dd HH:mm:ss"); + dt.Rows.Add(dr); + } } } @@ -256,7 +268,6 @@ break; } this.btnSave.Enabled = false; - } } @@ -269,6 +280,7 @@ if (jsonResult.code != "0") { + this.btnSave.Enabled = true; MessageBox.Show("璁惧鍒楄〃鎶ラ敊:" + jsonResult.message); } else @@ -287,6 +299,7 @@ jsonResult = await FindDevicePropCalc(url, token, nos, HBegin, HEnd); if (jsonResult.code != "0") { + this.btnSave.Enabled = true; MessageBox.Show("鏁伴噺鑾峰彇鎶ラ敊:" + jsonResult.message); } else { @@ -297,7 +310,7 @@ for (int i = 0; i < jsonResult.data.Count; i++) { - if (jsonResult.data[i].propId == 173) + if (jsonResult.data[i].propId == 467) { HInSpectQty = jsonResult.data[i].sum; } @@ -305,7 +318,7 @@ { HRightQty = jsonResult.data[i].sum; } - else if (jsonResult.data[i].propId == 606) + else if (jsonResult.data[i].propId == 466) { HUnKnowQty = jsonResult.data[i].sum; } @@ -314,6 +327,8 @@ HUnRightQty = jsonResult.data[i].sum; } } + + string HNumber = ""; int HSourceID = 0; string HSourceNumber = ""; @@ -334,11 +349,12 @@ DataSet dsSouce = oCN.RunProcReturn("select * from Gy_Source with(nolock) where HNumber='" + HSourceNumber + "'", "Gy_Source"); if (dsSouce.Tables[0].Rows.Count == 0) { + this.btnSave.Enabled = true; MessageBox.Show("鐢熶骇璧勬簮鏌ユ棤鏁版嵁!"); } else { - HSourceID = int.Parse(dsSouce.Tables[0].Rows[0]["HInterID"].ToString()); + HSourceID = int.Parse(dsSouce.Tables[0].Rows[0]["HItemID"].ToString()); //鏌ヨ妫�楠屾柟妗� DataSet dataSet = oCN.RunProcReturn(@"select a.HInterID HQCSchemeID,b.HQCCheckItemID, ch.HNumber HQCCheckItemNumber,m.HNumber,HUpLimit,HDownLimit,HTargetVal,a.HProcID,b.HInspectInstruMentID @@ -370,9 +386,15 @@ { int HLastResult = 1; string HAnalysisMethod = dataSet.Tables[0].Rows[i]["HAnalysisMethod"].ToString(); + decimal HUpLimit = 0; + decimal HDownLimit = 0; - decimal HUpLimit = decimal.Parse(dataSet.Tables[0].Rows[i]["HTargetVal"].ToString()) + decimal.Parse(dataSet.Tables[0].Rows[i]["HUpLimit"].ToString()); - decimal HDownLimit = decimal.Parse(dataSet.Tables[0].Rows[i]["HTargetVal"].ToString()) + decimal.Parse(dataSet.Tables[0].Rows[i]["HDownLimit"].ToString()); + if (HAnalysisMethod == "2") + { + HUpLimit = decimal.Parse(dataSet.Tables[0].Rows[i]["HTargetVal"].ToString()) + decimal.Parse(dataSet.Tables[0].Rows[i]["HUpLimit"].ToString()); + HDownLimit = decimal.Parse(dataSet.Tables[0].Rows[i]["HTargetVal"].ToString()) + decimal.Parse(dataSet.Tables[0].Rows[i]["HDownLimit"].ToString()); + } + for (int j = 0; j < dt.Columns.Count - 1; j++) { @@ -466,27 +488,30 @@ ",HSourceID,HICMOInterID,HICMOBillNo,HICMOQty,HProcExchInterID,HProcExchEntryID" + ",HProcExchBillNo,HProcExchQty,HMaterID,HFirstCheckEmp,HLastResult" + ",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType,HICMOEntryID,HQCSchemeID,HShiftsID,HErrTreatment" + - ",HProcID,HBatchNo" + + ",HProcID,HBatchNo,HInSpectQty ,HRightQty ,HUnRightQty ,HUnKnowQty " + ") " + " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "',1,getdate(),'',getdate()" + "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",''" + "," + HSourceID + ",0,'',0,0,0" + ",'',0," + HMaterID + ",'', " + HLastResults + ",0,0,'','',0," + HQCSchemeID + ",0,''" + - "," + HProcID + ",'" + HBatchNo + "') "); + "," + HProcID + ",'" + HBatchNo + "',"+ HInSpectQty + ","+ HRightQty + ", "+ HUnRightQty + ", " + HUnKnowQty + ") "); oCN.Commit(); MessageBox.Show("淇濆瓨鎴愬姛!"); - + //this.btnRest.Enabled = true; + } else { + this.btnSave.Enabled = true; MessageBox.Show("褰撳墠鐗╂枡鐨勬楠屾柟妗堜笌Excel鐨勫垪涓嶅尮閰�!"); } } else { + this.btnSave.Enabled = true; MessageBox.Show("褰撳墠鐗╂枡娌℃湁瀵瑰簲鐨勬楠屾柟妗�!"); } } @@ -495,6 +520,7 @@ } catch (Exception e) { + this.btnSave.Enabled = true; MessageBox.Show("淇濆瓨澶辫触!" + e.Message); } } @@ -605,7 +631,7 @@ public async Task<JsonEquipmentData> FindAllDevicePropsDetailByTimeRange(string url, string token,string nos, string HBegin, string HEnd) { nos = nos.Replace(",", "\",\""); - string stringJson = "{\"token\":\"" + token + "\",\"deviceNos\":[\"" + nos + "\"],\"startTime\":\"" + HBegin + "\",\"endTime\":\"" + HEnd + "\",\"basePropIds\":[473,474,600,601,602,603,604,605,576,577,578,562,563,564,565,566,567]}"; + 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 urls = url + EquipmentType.Nine; @@ -618,7 +644,7 @@ //鑾峰彇涓嶈壇鏁帮紝鍚堟暟鏁帮紝鍙枒鏁� 鎬绘暟 public async Task<JsonEquipmentData> FindDevicePropCalc(string url, string token,string nos,string HBegin,string HEnd) { - string stringJson = "{\"token\":\"" + token + "\",\"deviceNo\":\"" + nos + "\",\"propIds\":[173,469,470,606],\"beginTime\":\"" + HBegin + "\",\"endTime\":\"" + HEnd + "\"}"; + string stringJson = "{\"token\":\"" + token + "\",\"deviceNo\":\"" + nos + "\",\"propIds\":[466,467,469,470],\"beginTime\":\"" + HBegin + "\",\"endTime\":\"" + HEnd + "\"}"; var postData = new StringContent(stringJson, System.Text.Encoding.UTF8, "application/json"); string urls = url + EquipmentType.Seven; JsonEquipmentData jsonResult = await EquipmentList(urls, postData, "POST"); @@ -634,6 +660,18 @@ string stringJson = "{\"token\":\"" + token + "\",\"nos\":[" + nos + "]}"; var postData = new StringContent(stringJson, System.Text.Encoding.UTF8, "application/json"); string urls = url + EquipmentType.Three; + JsonEquipmentData jsonResult = await EquipmentList(urls, postData, "POST"); + return jsonResult; + } + + //鑾峰彇璁惧鏃堕棿娈典骇閲� + public async Task<JsonEquipmentData> FindProdByNosAndTime(string url, string token, string nos, string HBegin, string HEnd) + { + nos = nos.Replace(",", "\",\""); + nos = "\"" + nos + "\""; + string stringJson = "{\"token\":\"" + token + "\",\"nos\":[" + nos + "],\"startTime\":\"" + HBegin + "\",\"endTime\":\"" + HEnd + "\"}"; + var postData = new StringContent(stringJson, System.Text.Encoding.UTF8, "application/json"); + string urls = url + EquipmentType.Four; JsonEquipmentData jsonResult = await EquipmentList(urls, postData, "POST"); return jsonResult; } @@ -675,6 +713,7 @@ this.txtBegin.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); this.btnBegin.Enabled = false; this.timer.Enabled = true; + this.Time_CLHB.Enabled = true; } } } @@ -731,8 +770,8 @@ } } nos = nos.Substring(0, nos.Length - 1); - TimeDate = "2024-08-14 08:30:39"; - time = "2024-08-14 15:05:39"; + //TimeDate = "2024-08-14 08:30:39"; + //time = "2024-08-14 15:05:39"; JsonEquipmentData jsonEquipment = await FindAllDevicePropsDetailByTimeRange(Url, token, nos, TimeDate, time); @@ -792,8 +831,8 @@ } //this.timer.Enabled = false; - //TimeDate = "2024-08-14 17:00:39"; - //time = "2024-08-14 17:05:39"; + //TimeDate = "2024-08-19 19:38:14.540"; + //time = "2024-08-19 19:39:14.540"; JsonEquipmentData jsonResult = await FindDeviceList(Url, token); if (jsonResult.code != "0") @@ -827,7 +866,7 @@ { for (int j = 0; j < jsonEquipment.data[i].props.Count; j++) { - for (int k = 0; k < jsonEquipment.data[0].props[j].datas.Count; k++) + for (int k = 0; k < jsonEquipment.data[i].props[j].datas.Count; k++) { valueData value = JsonConvert.DeserializeObject<valueData>(jsonEquipment.data[i].props[j].datas[k].value); if (value.type == "鑹搧") @@ -852,7 +891,7 @@ JsonData += "{\"HDate\":\"" + time + "\",\"HTechParamName\":\"鑹搧鏁癨",\"HResult\":\"OK\",\"HCount\":" + data.data[j].sum + ",\"HSourceCode\":\"" + jsonEquipment.data[i].deviceNo + "\"},"; } //涓嶈壇鏁� - else if (data.data[i].propId == 470) + else if (data.data[j].propId == 470) { JsonData += "{\"HDate\":\"" + time + "\",\"HTechParamName\":\"NG鏁伴噺\",\"HResult\":\"NG\",\"HCount\":" + data.data[j].sum + ",\"HSourceCode\":\"" + jsonEquipment.data[i].deviceNo + "\"},"; } @@ -863,8 +902,16 @@ { for (int k = 0; k < jsonEquipment.data[i].props[j].datas.Count; k++) { - JsonData += "{\"HDate\":\"" + jsonEquipment.data[i].props[j].datas[k].createTime + "\",\"HTechParamName\":\"" + jsonEquipment.data[i].props[j].propName + "\",\"HResult\":\"\",\"HCount\":" + jsonEquipment.data[i].props[j].datas[k].value + ",\"HSourceCode\":\"" + jsonEquipment.data[i].deviceNo + "\"},"; + JsonData += "{\"HDate\":\"" + jsonEquipment.data[i].props[j].datas[k].createTime + "\",\"HTechParamName\":\"" + jsonEquipment.data[i].props[j].propName + "\",\"HResult\":\""+ jsonEquipment.data[i].props[j].datas[k].value + "\",\"HCount\":1,\"HSourceCode\":\"" + jsonEquipment.data[i].deviceNo + "\"},"; } + } + + JsonEquipmentData data = await FindProdByNosAndTime(Url, token, jsonEquipment.data[i].deviceNo, TimeDate, time); + + for (int j = 0; j < data.data.Count; j++) + { + + JsonData += "{\"HDate\":\"" + time + "\",\"HTechParamName\":\"鐢熶骇鏁伴噺\",\"HResult\":\"OK\",\"HCount\":" + data.data[j].prod + ",\"HSourceCode\":\"" + jsonEquipment.data[i].deviceNo + "\"},"; } } } @@ -935,6 +982,91 @@ ",宸ヨ壓鍙傛暟鍊�:" + data.data[i].HResult); } } + + //瀹氭椂鐢熸垚浜ч噺姹囨姤鍗� + private async void Time_CLHB_Tick(object sender, EventArgs e) + { + string Url = DBHelper.GetConfigKey(AppDomain.CurrentDomain.BaseDirectory + "Config/SQLAPI.config", "sUrl"); + string urls = Url + EquipmentType.One; + // 鍑嗗瑕佸彂閫佺殑琛ㄥ崟鏁版嵁 + var formData = new FormUrlEncodedContent(new[] + { + new KeyValuePair<string, string>("userName", "admin"), + new KeyValuePair<string, string>("password", "admin") + // 娣诲姞鏇村閿�煎锛屾牴鎹偍鐨勯渶瑕� + }); + JsonResult jsonResult = await getUrl(urls, formData); + string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + string token = jsonResult.data.token; + JsonEquipmentData jsonEquipment = await FindDeviceList(Url, token); + + if (jsonEquipment.code != "0") + { + MessageBox.Show("璁惧鍒楄〃鎶ラ敊:" + jsonEquipment.message); + } + else + { + string nos = ""; + //鑾峰彇鍘昏澶囩紪鐮� + for (int i = 0; i < jsonEquipment.data.Count; i++) + { + if (jsonEquipment.data[i].no.Contains("CMR-ZS-SE")) + { + nos += "''" + jsonEquipment.data[i].no + "'',"; + } + else if (jsonEquipment.data[i].no.Contains("CMR_ZZ_SE_")) + { + nos += "''" + jsonEquipment.data[i].no + "'',"; + } + } + nos = nos.Substring(0, nos.Length - 1); + + //this.Time_CLHB.Enabled = false; + + DataSet ds = oCN.RunProcReturn("exec h_p_Sc_TimeICMOReporList '" + nos + "'", "h_p_Sc_TimeICMOReporList"); + + if (ds.Tables[0].Rows.Count > 0) + { + DataTable dt = ds.Tables[0]; + for (int i = 0; i < dt.Rows.Count; i++) + { + nos = dt.Rows[i]["璁惧缂栫爜"].ToString(); + string HICMInterID = dt.Rows[i]["HInterID"].ToString(); + string HBegDate = DateTime.Parse(dt.Rows[i]["鏃ユ湡"].ToString()).ToString("yyyy-MM-dd HH:mm:ss"); + string HEndDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + jsonEquipment = await FindProdByNosAndTime(Url, token, nos, HBegDate, HEndDate); + if (decimal.Parse(jsonEquipment.data[0].prod) > 0) { + oCN.RunProc("exec h_p_Sc_AddTimeICMORepor " + HICMInterID + "," + jsonEquipment.data[0].prod+",'"+ HEndDate + "'"); + } + } + } + if (ds.Tables[1].Rows.Count > 0) + { + DataTable dt = ds.Tables[1]; + for (int i = 0; i < dt.Rows.Count; i++) + { + nos = dt.Rows[i]["璁惧缂栫爜"].ToString(); + string HICMInterID = dt.Rows[i]["HInterID"].ToString(); + string HBegDate = DateTime.Parse(dt.Rows[i]["寮�濮嬫棩鏈�"].ToString()).ToString("yyyy-MM-dd HH:mm:ss"); + string HEndDate = DateTime.Parse(dt.Rows[i]["缁撴潫鏃ユ湡"].ToString()).ToString("yyyy-MM-dd HH:mm:ss"); + jsonEquipment = await FindProdByNosAndTime(Url, token, nos, HBegDate, HEndDate); + if (decimal.Parse(jsonEquipment.data[0].prod) > 0) + { + oCN.RunProc("exec h_p_Sc_AddTimeICMORepor " + HICMInterID + "," + jsonEquipment.data[0].prod + ",'" + HEndDate + "'"); + } + } + } + } + + } + + private void EquipmentCollectionForm_FormClosing(object sender, FormClosingEventArgs e) + { + if (MessageBox.Show("纭畾瑕佸叧闂悧锛�", "纭", MessageBoxButtons.YesNo) == DialogResult.No) + { + e.Cancel = true; + } + } } diff --git a/WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.csproj b/WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.csproj index 12c2398..99c2753 100644 --- a/WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.csproj +++ b/WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.csproj @@ -12,6 +12,21 @@ <FileAlignment>512</FileAlignment> <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> <Deterministic>true</Deterministic> + <PublishUrl>publish\</PublishUrl> + <Install>true</Install> + <InstallFrom>Disk</InstallFrom> + <UpdateEnabled>false</UpdateEnabled> + <UpdateMode>Foreground</UpdateMode> + <UpdateInterval>7</UpdateInterval> + <UpdateIntervalUnits>Days</UpdateIntervalUnits> + <UpdatePeriodically>false</UpdatePeriodically> + <UpdateRequired>false</UpdateRequired> + <MapFileExtensions>true</MapFileExtensions> + <ApplicationRevision>0</ApplicationRevision> + <ApplicationVersion>1.0.0.%2a</ApplicationVersion> + <IsWebBootstrapper>false</IsWebBootstrapper> + <UseApplicationTrust>false</UseApplicationTrust> + <BootstrapperEnabled>true</BootstrapperEnabled> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PlatformTarget>AnyCPU</PlatformTarget> @@ -88,5 +103,17 @@ <ItemGroup> <None Include="App.config" /> </ItemGroup> + <ItemGroup> + <BootstrapperPackage Include=".NETFramework,Version=v4.7.2"> + <Visible>False</Visible> + <ProductName>Microsoft .NET Framework 4.7.2 %28x86 鍜� x64%29</ProductName> + <Install>true</Install> + </BootstrapperPackage> + <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1"> + <Visible>False</Visible> + <ProductName>.NET Framework 3.5 SP1</ProductName> + <Install>false</Install> + </BootstrapperPackage> + </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> </Project> \ No newline at end of file diff --git a/WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.csproj.user b/WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.csproj.user index c10e84b..6a402f6 100644 --- a/WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.csproj.user +++ b/WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.csproj.user @@ -2,5 +2,13 @@ <Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <ProjectView>ProjectFiles</ProjectView> + <PublishUrlHistory /> + <InstallUrlHistory /> + <SupportUrlHistory /> + <UpdateUrlHistory /> + <BootstrapperUrlHistory /> + <ErrorReportUrlHistory /> + <FallbackCulture>zh-CN</FallbackCulture> + <VerifyUploadedFiles>false</VerifyUploadedFiles> </PropertyGroup> </Project> \ No newline at end of file diff --git a/WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.resx b/WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.resx index e22c5ac..82acfdb 100644 --- a/WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.resx +++ b/WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.resx @@ -120,4 +120,7 @@ <metadata name="timer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>17, 17</value> </metadata> + <metadata name="Time_CLHB.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>125, 17</value> + </metadata> </root> \ No newline at end of file diff --git a/WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug.rar b/WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug.rar index b0ea3a6..2605393 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 e5eef4b..388e30c 100644 --- a/WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug/Config/SQLAPI.config +++ b/WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug/Config/SQLAPI.config @@ -6,8 +6,8 @@ <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://preview.nps.iiot.youngsunnb.com"></add>--><!--鍐呴儴娴嬭瘯--> - <add key="sUrl" value="https://hzsme.nps.iiot.youngsunnb.com/"></add><!--鏂帿灏斿缃戞祴璇�--> + <add key="sUrl" value="http://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 de72472..c699d4b 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 61a0a5a..31b92b5 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/DesignTimeResolveAssemblyReferencesInput.cache b/WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache index b82d4ed..9e795ad 100644 --- a/WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache +++ b/WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache Binary files differ diff --git a/WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/EquipmentCollectionForm.csproj.GenerateResource.cache b/WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/EquipmentCollectionForm.csproj.GenerateResource.cache index aee4ee3..2a12a20 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 de72472..c699d4b 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 61a0a5a..31b92b5 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/EquipmentCollectionForm.Designer.cs b/WFormSynchronizeData_SMR/WFormReadData_SMR/EquipmentCollectionForm.Designer.cs deleted file mode 100644 index a92d660..0000000 --- a/WFormSynchronizeData_SMR/WFormReadData_SMR/EquipmentCollectionForm.Designer.cs +++ /dev/null @@ -1,215 +0,0 @@ -锘� -namespace WFormReadData_SMR -{ - partial class EquipmentCollectionForm - { - /// <summary> - /// Required designer variable. - /// </summary> - private System.ComponentModel.IContainer components = null; - - /// <summary> - /// Clean up any resources being used. - /// </summary> - /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// <summary> - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// </summary> - private void InitializeComponent() - { - this.cmbEquipFile = new System.Windows.Forms.ComboBox(); - this.txtEquipFile = new System.Windows.Forms.Label(); - this.btnBegin = new System.Windows.Forms.Button(); - this.txtBegin = new System.Windows.Forms.TextBox(); - this.txtEnd = new System.Windows.Forms.TextBox(); - this.btnEnd = new System.Windows.Forms.Button(); - this.btnSave = new System.Windows.Forms.Button(); - this.label4 = new System.Windows.Forms.Label(); - this.txtLj = new System.Windows.Forms.TextBox(); - this.btnLj = new System.Windows.Forms.Button(); - this.txtHBathNo = new System.Windows.Forms.TextBox(); - this.HBathNo = new System.Windows.Forms.Label(); - this.btnRest = new System.Windows.Forms.Button(); - this.ListData = new System.Windows.Forms.ListBox(); - this.SuspendLayout(); - // - // cmbEquipFile - // - this.cmbEquipFile.FormattingEnabled = true; - this.cmbEquipFile.Location = new System.Drawing.Point(128, 39); - this.cmbEquipFile.Name = "cmbEquipFile"; - this.cmbEquipFile.Size = new System.Drawing.Size(174, 26); - this.cmbEquipFile.TabIndex = 13; - // - // txtEquipFile - // - this.txtEquipFile.AutoSize = true; - this.txtEquipFile.Location = new System.Drawing.Point(69, 47); - this.txtEquipFile.Name = "txtEquipFile"; - this.txtEquipFile.Size = new System.Drawing.Size(53, 18); - this.txtEquipFile.TabIndex = 14; - this.txtEquipFile.Text = "璁惧:"; - // - // btnBegin - // - this.btnBegin.Location = new System.Drawing.Point(52, 91); - this.btnBegin.Name = "btnBegin"; - this.btnBegin.Size = new System.Drawing.Size(70, 37); - this.btnBegin.TabIndex = 15; - this.btnBegin.Text = "寮�濮�"; - this.btnBegin.UseVisualStyleBackColor = true; - this.btnBegin.Click += new System.EventHandler(this.btnBegin_Click); - // - // txtBegin - // - this.txtBegin.Location = new System.Drawing.Point(128, 97); - this.txtBegin.Name = "txtBegin"; - this.txtBegin.Size = new System.Drawing.Size(174, 28); - this.txtBegin.TabIndex = 16; - // - // txtEnd - // - this.txtEnd.Location = new System.Drawing.Point(478, 100); - this.txtEnd.Name = "txtEnd"; - this.txtEnd.Size = new System.Drawing.Size(164, 28); - this.txtEnd.TabIndex = 18; - // - // btnEnd - // - this.btnEnd.Location = new System.Drawing.Point(402, 94); - this.btnEnd.Name = "btnEnd"; - this.btnEnd.Size = new System.Drawing.Size(70, 37); - this.btnEnd.TabIndex = 17; - this.btnEnd.Text = "缁撴潫"; - this.btnEnd.UseVisualStyleBackColor = true; - this.btnEnd.Click += new System.EventHandler(this.btnEnd_Click); - // - // btnSave - // - this.btnSave.Location = new System.Drawing.Point(744, 26); - this.btnSave.Name = "btnSave"; - this.btnSave.Size = new System.Drawing.Size(115, 37); - this.btnSave.TabIndex = 19; - this.btnSave.Text = "淇濆瓨"; - this.btnSave.UseVisualStyleBackColor = true; - this.btnSave.Click += new System.EventHandler(this.btnSave_Click); - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(40, 167); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(53, 18); - this.label4.TabIndex = 21; - this.label4.Text = "璺緞:"; - // - // txtLj - // - this.txtLj.Location = new System.Drawing.Point(112, 164); - 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.Name = "btnLj"; - this.btnLj.Size = new System.Drawing.Size(115, 42); - this.btnLj.TabIndex = 22; - this.btnLj.Text = "閫夋嫨璺緞"; - this.btnLj.UseVisualStyleBackColor = true; - this.btnLj.Click += new System.EventHandler(this.btnLj_Click); - // - // txtHBathNo - // - this.txtHBathNo.Location = new System.Drawing.Point(478, 31); - this.txtHBathNo.Name = "txtHBathNo"; - this.txtHBathNo.Size = new System.Drawing.Size(164, 28); - this.txtHBathNo.TabIndex = 24; - this.txtHBathNo.KeyUp += new System.Windows.Forms.KeyEventHandler(this.txtHBathNo_KeyUp); - // - // HBathNo - // - this.HBathNo.AutoSize = true; - this.HBathNo.Location = new System.Drawing.Point(408, 36); - this.HBathNo.Name = "HBathNo"; - this.HBathNo.Size = new System.Drawing.Size(62, 18); - this.HBathNo.TabIndex = 25; - this.HBathNo.Text = "鎵规鍙�"; - // - // btnRest - // - this.btnRest.Location = new System.Drawing.Point(744, 88); - this.btnRest.Name = "btnRest"; - this.btnRest.Size = new System.Drawing.Size(115, 37); - this.btnRest.TabIndex = 26; - this.btnRest.Text = "閲嶇疆"; - this.btnRest.UseVisualStyleBackColor = true; - this.btnRest.Click += new System.EventHandler(this.btnRest_Click); - // - // ListData - // - this.ListData.FormattingEnabled = true; - this.ListData.ItemHeight = 18; - this.ListData.Location = new System.Drawing.Point(5, 204); - this.ListData.Name = "ListData"; - this.ListData.Size = new System.Drawing.Size(932, 472); - this.ListData.TabIndex = 27; - // - // 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.Controls.Add(this.ListData); - this.Controls.Add(this.btnRest); - this.Controls.Add(this.HBathNo); - this.Controls.Add(this.txtHBathNo); - this.Controls.Add(this.btnLj); - this.Controls.Add(this.label4); - this.Controls.Add(this.txtLj); - this.Controls.Add(this.btnSave); - this.Controls.Add(this.txtEnd); - this.Controls.Add(this.btnEnd); - this.Controls.Add(this.txtBegin); - this.Controls.Add(this.btnBegin); - this.Controls.Add(this.txtEquipFile); - this.Controls.Add(this.cmbEquipFile); - this.Name = "EquipmentCollectionForm"; - this.Text = "璁惧鏁版嵁閲囬泦"; - this.Load += new System.EventHandler(this.EquipmentCollectionForm_Load); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.ComboBox cmbEquipFile; - private System.Windows.Forms.Label txtEquipFile; - private System.Windows.Forms.Button btnBegin; - private System.Windows.Forms.TextBox txtBegin; - private System.Windows.Forms.TextBox txtEnd; - private System.Windows.Forms.Button btnEnd; - private System.Windows.Forms.Button btnSave; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.TextBox txtLj; - private System.Windows.Forms.Button btnLj; - private System.Windows.Forms.TextBox txtHBathNo; - private System.Windows.Forms.Label HBathNo; - private System.Windows.Forms.Button btnRest; - private System.Windows.Forms.ListBox ListData; - } -} \ No newline at end of file diff --git a/WFormSynchronizeData_SMR/WFormReadData_SMR/EquipmentCollectionForm.cs b/WFormSynchronizeData_SMR/WFormReadData_SMR/EquipmentCollectionForm.cs deleted file mode 100644 index 5389576..0000000 --- a/WFormSynchronizeData_SMR/WFormReadData_SMR/EquipmentCollectionForm.cs +++ /dev/null @@ -1,241 +0,0 @@ -锘縰sing System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.IO; -using System.Linq; -using System.Net.Http; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace WFormReadData_SMR -{ - public partial class EquipmentCollectionForm : Form - { - private json objJsonResult = new json(); - DataTable dt = new DataTable(); - public EquipmentCollectionForm() - { - InitializeComponent(); - } - - private void EquipmentCollectionForm_Load(object sender, EventArgs e) - { - this.txtBegin.ReadOnly = true; - this.txtEnd.ReadOnly = true; - this.txtLj.ReadOnly = true; - this.btnSave.Enabled = false; - } - - private async void btnBegin_Click(object sender, EventArgs e) - { - if (this.txtHBathNo.Text == "" || this.txtHBathNo.ReadOnly == false) - { - MessageBox.Show("璇疯緭鍏ユ壒娆″彿杩涜纭!"); - } - else - { - await getUrl(); - this.txtBegin.Text = DateTime.Now.ToString(); - this.btnBegin.Enabled = false; - } - } - - private void btnEnd_Click(object sender, EventArgs e) - { - if (this.txtBegin.Text == "") - { - MessageBox.Show("璇风偣鍑诲紑濮嬫寜閽繘琛屽紑濮嬬‘璁�!"); - } - else - { - this.txtEnd.Text = DateTime.Now.ToString(); - this.btnEnd.Enabled = false; - } - } - - private void btnLj_Click(object sender, EventArgs e) - { - if (this.txtEnd.Text == "") - { - MessageBox.Show("璇风偣鍑荤粨鏉熸寜閽繘琛岀粨鏉熺‘璁�!"); - } - else - { - //璺緞璧嬪�肩粰鏂囨湰 - using (OpenFileDialog openFile = new OpenFileDialog()) - { - DialogResult result = openFile.ShowDialog(); - if (result == DialogResult.OK) - { - //淇濆瓨鎸夐挳鐏版帀 - this.btnSave.Enabled = true; - - string selectedFolderPath = openFile.FileName; - this.txtLj.Text = selectedFolderPath; - - objJsonResult = Xt_CSVReadText(selectedFolderPath, 1); - dt = objJsonResult.dataTable; - - if (objJsonResult.code == "0") - { - MessageBox.Show(objJsonResult.Message); - } - else { - for (int i = 0; i < dt.Rows.Count; i++) - { - ListData.Items.Add("搴曞瓟鐩村緞:" + dt.Rows[i]["BottomHoleDiameter"].ToString() + - ",鏈夋棤铻虹墮妫�娴嬫暟鎹�:" + dt.Rows[i]["TestingData"].ToString() + - ",鏈夋棤铻虹墮妫�娴嬬粨鏋�:" + dt.Rows[i]["DetectionResult"].ToString()); - } - } - } - } - } - } - - //璇诲彇CSV鏂囦欢鏁版嵁 鏍规嵁鏂囦欢璺緞鎵惧埌瀵瑰簲鏂囦欢 骞惰幏鍙栧搴旂殑鏁版嵁 - public json Xt_CSVReadText(string FilePath, int num) - { - try - { - DataTable dt = new DataTable(num.ToString()); - dt.Columns.Add("BottomHoleDiameter"); - dt.Columns.Add("TestingData"); - dt.Columns.Add("DetectionResult"); - DataTable dt2 = new DataTable(); - List<string[]> records = new List<string[]>(); - - using (StreamReader sr = new StreamReader(FilePath, Encoding.GetEncoding("gb2312"))) - { - string[] headers = sr.ReadLine()?.Split(','); - if (headers != null) - { - foreach (var header in headers) - { - dt2.Columns.Add(header.Trim()); - } - } - - string line; - while ((line = sr.ReadLine()) != null) - { - var values = line.Split(','); - DataRow row = dt2.NewRow(); - - for (int i = 0; i < values.Length; i++) - { - // 杩欓噷鍙兘闇�瑕佹坊鍔犵被鍨嬭浆鎹㈠拰閿欒澶勭悊 - row[i] = values[i].Trim(); - } - - dt2.Rows.Add(row); - } - } - - for (int i = 0; i < dt2.Rows.Count; i++) - { - for (int j = 0; j < 2; j++) - { - DataRow dr = dt.NewRow(); - dr["BottomHoleDiameter"] = dt2.Rows[i][dt2.Columns[j]].ToString(); - dr["TestingData"] = dt2.Rows[i][dt2.Columns[j + 2]].ToString(); - dr["DetectionResult"] = dt2.Rows[i][dt2.Columns[j + 4]].ToString(); - dt.Rows.Add(dr); - } - } - - objJsonResult.count = 1; - objJsonResult.Message = ""; - objJsonResult.dataTable = dt; - return objJsonResult; - } - catch (Exception e) - { - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = e.Message; - objJsonResult.dataTable = null; - return objJsonResult; - } - } - - - private void txtHBathNo_KeyUp(object sender, KeyEventArgs e) - { - if (e.KeyCode == Keys.Enter) - { - this.txtHBathNo.ReadOnly = true; - } - } - - private void btnRest_Click(object sender, EventArgs e) - { - this.txtHBathNo.Text = ""; - this.txtHBathNo.ReadOnly = false; - - this.btnBegin.Enabled = true; - this.txtBegin.Text = ""; - - this.btnEnd.Enabled = true; - this.txtEnd.Text = ""; - - this.btnSave.Enabled = false; - - this.txtLj.Text = ""; - - } - - private void btnSave_Click(object sender, EventArgs e) - { - DialogResult dr = MessageBox.Show("纭淇濆瓨?", "鎻愮ず", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); - - if (dr == DialogResult.Yes) { - var formData = new FormUrlEncodedContent(new[]{ - new KeyValuePair<string, string>("userName", "admin"), - new KeyValuePair<string, string>("password", "admin") - // 娣诲姞鏇村閿�煎锛屾牴鎹偍鐨勯渶瑕� - }); - - - } - } - //string url, FormUrlEncodedContent formData - static async Task getUrl() - { - - // 鍒涘缓 HttpClient 瀹炰緥 - using (var client = new HttpClient()) - { - // 璁剧疆璇锋眰鍦板潃 - string url = "https://preview.nps.iiot.youngsunnb.com/api/third/findAccessToken"; - - // 鍑嗗瑕佸彂閫佺殑琛ㄥ崟鏁版嵁 - var formData = new FormUrlEncodedContent(new[] - { - new KeyValuePair<string, string>("userName", "admin"), - new KeyValuePair<string, string>("password", "admin") - // 娣诲姞鏇村閿�煎锛屾牴鎹偍鐨勯渶瑕� - }); - - // 鍙戦�� POST 璇锋眰锛屽苟绛夊緟鍝嶅簲 - HttpResponseMessage response = await client.PostAsync(url, formData); - - // 妫�鏌ュ搷搴旀槸鍚︽垚鍔� - if (response.IsSuccessStatusCode) - { - // 澶勭悊鎴愬姛鍝嶅簲鐨勯�昏緫 - string responseBody = await response.Content.ReadAsStringAsync(); - Console.WriteLine("鍝嶅簲鍐呭锛�" + responseBody); - } - else - { - // 澶勭悊澶辫触鍝嶅簲鐨勯�昏緫 - Console.WriteLine("璇锋眰澶辫触锛岀姸鎬佺爜锛�" + response.StatusCode); - } - } - } - } -} diff --git a/WFormSynchronizeData_SMR/WFormReadData_SMR/EquipmentCollectionForm.resx b/WFormSynchronizeData_SMR/WFormReadData_SMR/EquipmentCollectionForm.resx deleted file mode 100644 index 1af7de1..0000000 --- a/WFormSynchronizeData_SMR/WFormReadData_SMR/EquipmentCollectionForm.resx +++ /dev/null @@ -1,120 +0,0 @@ -锘�<?xml version="1.0" encoding="utf-8"?> -<root> - <!-- - Microsoft ResX Schema - - Version 2.0 - - The primary goals of this format is to allow a simple XML format - that is mostly human readable. The generation and parsing of the - various data types are done through the TypeConverter classes - associated with the data types. - - Example: - - ... ado.net/XML headers & schema ... - <resheader name="resmimetype">text/microsoft-resx</resheader> - <resheader name="version">2.0</resheader> - <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> - <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> - <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> - <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> - <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> - <value>[base64 mime encoded serialized .NET Framework object]</value> - </data> - <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> - <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> - <comment>This is a comment</comment> - </data> - - There are any number of "resheader" rows that contain simple - name/value pairs. - - Each data row contains a name, and value. The row also contains a - type or mimetype. Type corresponds to a .NET class that support - text/value conversion through the TypeConverter architecture. - Classes that don't support this are serialized and stored with the - mimetype set. - - The mimetype is used for serialized objects, and tells the - ResXResourceReader how to depersist the object. This is currently not - extensible. For a given mimetype the value must be set accordingly: - - Note - application/x-microsoft.net.object.binary.base64 is the format - that the ResXResourceWriter will generate, however the reader can - read any of the formats listed below. - - mimetype: application/x-microsoft.net.object.binary.base64 - value : The object must be serialized with - : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter - : and then encoded with base64 encoding. - - mimetype: application/x-microsoft.net.object.soap.base64 - value : The object must be serialized with - : System.Runtime.Serialization.Formatters.Soap.SoapFormatter - : and then encoded with base64 encoding. - - mimetype: application/x-microsoft.net.object.bytearray.base64 - value : The object must be serialized into a byte array - : using a System.ComponentModel.TypeConverter - : and then encoded with base64 encoding. - --> - <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> - <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> - <xsd:element name="root" msdata:IsDataSet="true"> - <xsd:complexType> - <xsd:choice maxOccurs="unbounded"> - <xsd:element name="metadata"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="value" type="xsd:string" minOccurs="0" /> - </xsd:sequence> - <xsd:attribute name="name" use="required" type="xsd:string" /> - <xsd:attribute name="type" type="xsd:string" /> - <xsd:attribute name="mimetype" type="xsd:string" /> - <xsd:attribute ref="xml:space" /> - </xsd:complexType> - </xsd:element> - <xsd:element name="assembly"> - <xsd:complexType> - <xsd:attribute name="alias" type="xsd:string" /> - <xsd:attribute name="name" type="xsd:string" /> - </xsd:complexType> - </xsd:element> - <xsd:element name="data"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> - <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> - </xsd:sequence> - <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> - <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> - <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> - <xsd:attribute ref="xml:space" /> - </xsd:complexType> - </xsd:element> - <xsd:element name="resheader"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> - </xsd:sequence> - <xsd:attribute name="name" type="xsd:string" use="required" /> - </xsd:complexType> - </xsd:element> - </xsd:choice> - </xsd:complexType> - </xsd:element> - </xsd:schema> - <resheader name="resmimetype"> - <value>text/microsoft-resx</value> - </resheader> - <resheader name="version"> - <value>2.0</value> - </resheader> - <resheader name="reader"> - <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> - </resheader> - <resheader name="writer"> - <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> - </resheader> -</root> \ No newline at end of file diff --git a/WFormSynchronizeData_SMR/WFormReadData_SMR/Program.cs b/WFormSynchronizeData_SMR/WFormReadData_SMR/Program.cs index b0eda98..e85be08 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 EquipmentCollectionForm()); + Application.Run(new ReadCoordinateExcelFrom()); } } } diff --git a/WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCoordinateExcelFrom.cs b/WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCoordinateExcelFrom.cs index 5085ee1..6c2c132 100644 --- a/WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCoordinateExcelFrom.cs +++ b/WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCoordinateExcelFrom.cs @@ -55,8 +55,8 @@ string selectedFolderPath = folderBrowserDialog.SelectedPath; // 浣跨敤 selectedFolderPath 杩涜鍚庣画鎿嶄綔锛屼緥濡傛樉绀哄湪鏂囨湰妗嗕腑 this.txtLj.Text = selectedFolderPath; - GetCSV_Read(selectedFolderPath); - //GetExcel_Read(selectedFolderPath); + //GetCSV_Read(selectedFolderPath); + GetExcel_Read(selectedFolderPath); } } } @@ -342,7 +342,7 @@ DataSet dataSet = oCN.RunProcReturn(@"select a.HInterID HQCSchemeID,b.HQCCheckItemID, ch.HNumber HQCCheckItemNumber,m.HNumber,HUpLimit,HDownLimit,HTargetVal from Sc_ProcessExchangeBillMain pr with(nolock) inner join Gy_QCCheckProjectMain a with(nolock) on pr.HMaterID=a.HMaterID -inner join Gy_QCCheckProjectSub b with(nolock) on a.HInterID=b.HInterID and b.HInspectInstruMentID=2 +inner join Gy_QCCheckProjectSub b with(nolock) on a.HInterID=b.HInterID and b.HInspectInstruMentID=1 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"); diff --git a/WFormSynchronizeData_SMR/WFormReadData_SMR/WFormReadData_SMR.csproj b/WFormSynchronizeData_SMR/WFormReadData_SMR/WFormReadData_SMR.csproj index fa4e104..466d309 100644 --- a/WFormSynchronizeData_SMR/WFormReadData_SMR/WFormReadData_SMR.csproj +++ b/WFormSynchronizeData_SMR/WFormReadData_SMR/WFormReadData_SMR.csproj @@ -97,12 +97,6 @@ </ItemGroup> <ItemGroup> <Compile Include="DBHelper.cs" /> - <Compile Include="EquipmentCollectionForm.cs"> - <SubType>Form</SubType> - </Compile> - <Compile Include="EquipmentCollectionForm.Designer.cs"> - <DependentUpon>EquipmentCollectionForm.cs</DependentUpon> - </Compile> <Compile Include="json.cs" /> <Compile Include="ReadCoordinateExcelFrom.cs"> <SubType>Form</SubType> @@ -124,9 +118,6 @@ </Compile> <Compile Include="Program.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> - <EmbeddedResource Include="EquipmentCollectionForm.resx"> - <DependentUpon>EquipmentCollectionForm.cs</DependentUpon> - </EmbeddedResource> <EmbeddedResource Include="Properties\Resources.resx"> <Generator>ResXFileCodeGenerator</Generator> <LastGenOutput>Resources.Designer.cs</LastGenOutput> diff --git a/WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug.rar b/WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug.rar index 84c6648..90748e8 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 5825467..b02cdd7 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 734ccfa..3b8218a 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 f5e894a..9123945 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/WFormReadData_SMR/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache index 62ab797..c2423a8 100644 --- a/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache +++ b/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache Binary files differ diff --git a/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.EquipmentCollectionForm.resources b/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.EquipmentCollectionForm.resources deleted file mode 100644 index 6c05a97..0000000 --- a/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.EquipmentCollectionForm.resources +++ /dev/null Binary files differ diff --git a/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.CoreCompileInputs.cache b/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.CoreCompileInputs.cache index 2eb78e6..ed41358 100644 --- a/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.CoreCompileInputs.cache +++ b/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -ff37b5b974b9759f5393c18ff0271ab5fa98580b +bcb81c71ebfb37915287aeccf3d336ac1f15b1d6 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 148d21c..b96d75c 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 @@ -34,4 +34,3 @@ E:\鏅轰簯mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormReadData_SMR\obj\Debug\WFormReadData_SMR.csproj.CopyComplete E:\鏅轰簯mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormReadData_SMR\obj\Debug\WFormReadData_SMR.exe E:\鏅轰簯mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormReadData_SMR\obj\Debug\WFormReadData_SMR.pdb -E:\鏅轰簯mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormReadData_SMR\obj\Debug\WFormReadData_SMR.EquipmentCollectionForm.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 7e84828..2489e8e 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 5825467..b02cdd7 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 734ccfa..3b8218a 100644 --- a/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.pdb +++ b/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.pdb Binary files differ -- Gitblit v1.9.1