From 7bfb447cbba9524639300a74b0b0a86b40176e63 Mon Sep 17 00:00:00 2001 From: yangle <admin@YINMOU> Date: 星期五, 11 四月 2025 14:35:06 +0800 Subject: [PATCH] 注释优化 --- WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.cs | 56 +++++++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 47 insertions(+), 9 deletions(-) diff --git a/WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.cs b/WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.cs index d659723..2e335ad 100644 --- a/WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.cs +++ b/WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm.cs @@ -265,6 +265,7 @@ if (dr == DialogResult.Yes) { string Url = DBHelper.GetConfigKey(AppDomain.CurrentDomain.BaseDirectory + "Config/SQLAPI.config", "sUrl"); + //閫氳繃鎺ュ彛 鑾峰彇token JsonResult jsonResult = await FindAccessToken(Url); string EquipFile = this.cmbEquipFile.Text; @@ -290,6 +291,7 @@ try { + //鑾峰彇鎵�鏈夎澶囨暟鎹� JsonEquipmentData jsonResult =await FindDeviceList(url, token); if (jsonResult.code != "0") @@ -300,7 +302,7 @@ else { string nos = ""; - //鑾峰彇鍘昏澶囩紪鐮� + //鑾峰彇璁惧缂栫爜 for (int i = 0; i < jsonResult.data.Count; i++) { if (jsonResult.data[i].no == this.cmbEquipFile.SelectedValue.ToString()) @@ -308,8 +310,11 @@ nos = jsonResult.data[i].no; } } + //寮�濮嬫椂闂� string HBegin = this.txtBegin.Text; + //缁撴潫鏃堕棿 string HEnd = this.txtEnd.Text; + //鑾峰彇涓嶈壇鏁帮紝鍚堟暟鏁帮紝鍙枒鏁� 鎬绘暟 jsonResult = await FindDevicePropCalc(url, token, nos, HBegin, HEnd); if (jsonResult.code != "0") { @@ -405,9 +410,12 @@ decimal HUpLimit = 0; decimal HDownLimit = 0; + //鍒嗘瀽鏂规硶 涓哄畾閲忓垎鏋� 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()); } @@ -429,16 +437,19 @@ break; } //SRM@101.2@VEN00005@CGDD000167@1.02.002.002@20231129@1000 + //鍒ゆ柇妫�楠岄」鐩殑浠g爜 璺熷垪鍚嶆槸鍚︿竴鑷� if (dataSet.Tables[0].Rows[i]["HQCCheckItemNumber"].ToString().Contains(HQCCheckItemName)) { for (int k = 0; k < dt.Rows.Count; k++) { - + //鍙彇鏃堕棿鑼冨洿鍐呯殑鏁版嵁 if (DateTime.Parse(dt.Rows[k]["HDate"].ToString()) >= DateTime.Parse(HBegin) && DateTime.Parse(dt.Rows[k]["HDate"].ToString()) <= DateTime.Parse(HEnd)) { + //鑾峰彇妫�楠屽�� decimal HInSpectValue = decimal.Parse(dt.Rows[k][dt.Columns[j].ColumnName].ToString()); - + //榛樿鍊肩粨璁轰负鍚堟牸 int HInSpectResult = 1; + //瀹氶噺鍒嗘瀽 杩涜鍒ゆ柇鏄惁婊¤冻涓婁笅闄� if (HAnalysisMethod == "2") { HInSpectResult = (HInSpectValue > HUpLimit || HDownLimit > HInSpectValue) ? 0 : 1; @@ -448,7 +459,7 @@ HInSpectResult = int.Parse(HInSpectValue.ToString()); } - + //濡傛灉褰撳墠缁撹涓哄悎鏍� 骞朵笖鍘嗗彶缁撹涔熸槸鍚堟牸 鍒欑户缁繚鎸佸悎鏍� if (HInSpectResult == 1 && HLastResult != 0) { HLastResult = 1; @@ -486,7 +497,7 @@ ",0,0,'',0,'','" + dataSet.Tables[0].Rows[i]["HTargetVal"].ToString() + "'" + ",'" + dataSet.Tables[0].Rows[i]["HUpLimit"].ToString() + "','" + dataSet.Tables[0].Rows[i]["HDownLimit"].ToString() + "','','',0,'" + HAnalysisMethod + "'," + dataSet.Tables[0].Rows[i]["HInspectInstruMentID"].ToString() + ",'" + HLastResult + "'" + ") "); - + //濡傛灉褰撳墠缁撹涓哄悎鏍� 骞朵笖鍘嗗彶缁撹涔熸槸鍚堟牸 鍒欑户缁繚鎸佸悎鏍� if (HLastResult == 1 && HLastResults != 0) { HLastResults = 1; @@ -924,6 +935,7 @@ //TimeDate = "2025-02-10 13:10:50"; //time = "2025-02-10 13:11:50"; + //鑾峰彇鎵�鏈夎澶囨暟鎹� JsonEquipmentData jsonResult = await FindDeviceList(Url, token); if (jsonResult.code != "0") { @@ -932,7 +944,7 @@ else { string nos = ""; - //鑾峰彇鍘昏澶囩紪鐮� + //鑾峰彇璁惧缂栫爜 for (int i = 0; i < jsonResult.data.Count; i++) { nos += jsonResult.data[i].no + ","; @@ -946,21 +958,32 @@ //} } nos = nos.Substring(0, nos.Length - 1); + //鑾峰彇鍙傛暟 鑾峰彇姣忎釜璁惧瀵瑰簲鐨勬墍鏈夊弬鏁� JsonEquipmentData jsonEquipment = await FindAllDevicePropsDetailByTimeRange(Url, token, nos, TimeDate, time); var JsonData = "{\"data\":["; CustomWriteLog("01" , DateTime.Now.ToString("yyyy-MM-dd")); + //閫氳繃姣忎釜璁惧杩涜寰幆璧嬪�� for (int i = 0; i < jsonEquipment.data.Count; i++) { + //鑾峰彇璁惧瀵瑰簲鐨勭紪鐮� 鍒ゆ柇缂栫爜鏄惁婊¤冻涓鸿灪姣嶅帇瑁呰澶� if (jsonEquipment.data[i].deviceNo.Contains("CMR-ZZ-SE-")) { + //寰幆 铻烘瘝鍘嬭璁惧瀵瑰簲鐨勬墍鏈夊伐鑹哄弬鏁� for (int j = 0; j < jsonEquipment.data[i].props.Count; j++) { + //寰幆 姣忎釜鍙傛暟瀵瑰簲鐨勬墍鏈夋暟鎹� for (int k = 0; k < jsonEquipment.data[i].props[j].datas.Count; k++) { + //鏃ュ織 CustomWriteLog("1-" + k + ":" + jsonEquipment.data[i].props[j].datas[k].value, DateTime.Now.ToString("yyyy-MM-dd")); + + //鑾峰彇鍙傛暟鐨勭被鍨� valueData value = JsonConvert.DeserializeObject<valueData>(jsonEquipment.data[i].props[j].datas[k].value); + + //鏃ュ織 CustomWriteLog("2", DateTime.Now.ToString("yyyy-MM-dd")); + if (value.type == "鑹搧") { JsonData += "{\"HDate\":\"" + jsonEquipment.data[i].props[j].datas[k].createTime + "\",\"HTechParamName\":\"铻烘瘝鏄惁鍑稿嚭\",\"HResult\":\"OK\",\"HCount\":1,\"HSourceCode\":\"" + jsonEquipment.data[i].deviceNo + "\"},"; @@ -990,14 +1013,17 @@ } } else { + //寰幆 铻烘瘝鍘嬭璁惧瀵瑰簲鐨勬墍鏈夊伐鑹哄弬鏁� for (int j = 0; j < jsonEquipment.data[i].props.Count; j++) { + //寰幆 姣忎釜鍙傛暟瀵瑰簲鐨勬墍鏈夋暟鎹� 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\":\""+ 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++) @@ -1009,7 +1035,9 @@ } CustomWriteLog("02", DateTime.Now.ToString("yyyy-MM-dd")); - var EquipmentStaus = await FindDeviceStatusByNos(Url, token, nos); + + //鑾峰彇璁惧杩愯鐘舵�� + var EquipmentStaus = await FindDeviceStatusByNos(Url, token, nos); for (int i = 0; i < EquipmentStaus.data.Count; i++) { @@ -1078,7 +1106,7 @@ } } - + //鏌ヨ褰撳墠寮�宸ョ殑璁惧 鑾峰彇瀵瑰簲鐨勭墿鏂欎俊鎭� DataSet datable = oCN.RunProcReturn(@"select m.HNumber,eq.HEquipFileNo from Sc_ICMOBillStatus_Tmp a inner join Gy_EquipFileBillMain eq on a.HSourceID = eq.HSourceID inner join Gy_Material m on a.HMaterID = m.HItemID @@ -1096,8 +1124,11 @@ } CustomWriteLog("03", DateTime.Now.ToString("yyyy-MM-dd")); + JsonData = JsonData.Substring(0, JsonData.Length - 1); JsonData += "]}"; + + //淇濆瓨鏁版嵁 DataSave(JsonData); if (TimeDate != "") { @@ -1139,6 +1170,8 @@ 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") @@ -1164,10 +1197,12 @@ //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++) { @@ -1177,12 +1212,14 @@ 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++) { @@ -1193,6 +1230,7 @@ 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 + "'"); } } -- Gitblit v1.9.1