| | |
| | | public string PSN = ""; |
| | | public string PSN2 = ""; |
| | | public string PSN3 = ""; |
| | | public bool t = true; |
| | | public Frmwt(string ParentId) |
| | | { |
| | | InitializeComponent(); |
| | |
| | | |
| | | private void LabelShow() |
| | | { |
| | | //string[] aaa = PSN.Split(','); |
| | | //string bbbb = aaa[0]; |
| | | PSNBox.Text = PSN; |
| | | string[] b_str = PSN.Split(','); |
| | | PSNBox.Text = b_str[1]; |
| | | |
| | | JObject jo = WI6027(); |
| | | if (jo == null) |
| | |
| | | JObject jo1032 = WI1032(PSNBox.Text, SNMBox.Text, KPNMBox.Text, KPValueBox.Text); |
| | | if (jo1032 != null) |
| | | { |
| | | if (WI6041(PSNBox.Text, SNMBox.Text, KPNMBox.Text, jo1032)) |
| | | if (WI6041(PSNBox.Text, SNMBox.Text, KPNMBox.Text, b_str[0])) |
| | | { |
| | | System_Bll.WriteLogToDB(new Entity.Base_Log |
| | | { |
| | |
| | | |
| | | public JObject WI6027() |
| | | { |
| | | //string WI6027 = "{ \"user\":\"sys\",\"password\":\"sysuser\",\"method\":\"MES_BA_WI6027\",\"servername\":\"TEST_WTMES_Customer\",\"methodparameter\":{ \"mac\":\"6A:15:63:C3:CC:EA\",\"hostName\":\"liuxingliang-PC\"} }"; |
| | | string a = "D0:8E:79:02:CF:91"; |
| | | |
| | | string a = "a0:36:9F:6c:0e:95"; |
| | | string WI6027 = "{"; |
| | | WI6027 += "\"user\":\"sys\","; |
| | | WI6027 += "\"password\":\"sysuser\","; |
| | |
| | | WI6027 += "\"servername\":\"London\","; |
| | | WI6027 += "\"methodparameter\":{"; |
| | | WI6027 += "\"mac\":\"" + a + "\","; |
| | | WI6027 += "\"hostName\":\"PC-20230103TQKE\""; |
| | | WI6027 += "\"hostName\":\"DESKTOP-UV8I1I0\""; |
| | | WI6027 += "}}"; |
| | | |
| | | JObject jo = MES_Interface(WI6027, encryptionKey); |
| | | return jo; |
| | | return MES_Interface(WI6027, encryptionKey); |
| | | } |
| | | |
| | | public bool WI601K(string BarCode) |
| | | { |
| | | //string WI601K = "{\"user\":\"sys\", \"password\":\"sysuser\",\"method\":\"MES_BA_WI601K\",\"servername\":\"TEST_WTMES_Customer\", \"methodparameter\":{\"BarCode\":\"123456789\", \"HostName\":\"liuxingliang-PC\", \"Mac\":\"6A:15:63:C3:CC:EA\" }}\n"; |
| | | |
| | | string a = "a0:36:9F:6c:0e:95"; |
| | | string WI601K = "{"; |
| | | WI601K += "\"user\":\"sys\","; |
| | | WI601K += "\"password\":\"sysuser\","; |
| | |
| | | WI601K += "\"servername\":\"London\","; |
| | | WI601K += "\"methodparameter\":{"; |
| | | WI601K += "\"BarCode\":\"" + BarCode + "\","; |
| | | WI601K += "\"HostName\":\"liuxingliang-PC\","; |
| | | WI601K += "\"Mac\":\"6A:15:63:C3:CC:EA\""; |
| | | WI601K += "\"HostName\":\"DESKTOP-UV8I1I0\","; |
| | | WI601K += "\"Mac\":\"" + a + "\""; |
| | | WI601K += "}"; |
| | | WI601K += "}"; |
| | | |
| | | JObject jo = MES_Interface(WI601K, encryptionKey); |
| | | if (jo["state"].ToString() == "false") |
| | | { |
| | | t = false; |
| | | System_Bll.WriteLogToDB(new Entity.Base_Log |
| | | |
| | | { |
| | | CreateUserID = FrmLogin.LoginUserID, |
| | | CreateUserName = FrmLogin.loginUserName, |
| | | LocalIP = FrmLogin.LocalIP, |
| | | LogMessage = "MES接口WI601K,条码比对失败!", |
| | | Type = "包装线", |
| | | LogMessage = "WI601K接口调用失败:" + jo["content"].ToString(), |
| | | Type = "称重", |
| | | ClassName = typeof(FrmLogin).ToString() |
| | | }); |
| | | return false; |
| | |
| | | JObject jo = MES_Interface(WI1032, encryptionKey); |
| | | if (jo["state"].ToString() == "false") |
| | | { |
| | | t = false; |
| | | System_Bll.WriteLogToDB(new Entity.Base_Log |
| | | { |
| | | CreateUserID = FrmLogin.LoginUserID, |
| | | CreateUserName = FrmLogin.loginUserName, |
| | | LocalIP = FrmLogin.LocalIP, |
| | | LogMessage = "MES接口WI1032条码邦定失败", |
| | | Type = "包装线", |
| | | LogMessage = "WI1032接口调用失败:" + jo["content"].ToString(), |
| | | Type = "称重", |
| | | ClassName = typeof(FrmLogin).ToString() |
| | | }); |
| | | return null; |
| | |
| | | return jo; |
| | | } |
| | | |
| | | public bool WI6041(string Line, string Station, string StationID, JObject outWI1032) |
| | | public bool WI6041(string Line, string Station, string StationID, string PSN) |
| | | { |
| | | var contents = outWI1032["content"]; |
| | | |
| | | string WI6041 = "{ " + |
| | | "\n\"user\":\"sys\", " + |
| | | "\n\"password\":\"sysuser\", " + |
| | | "\n\"method\":\"MES_BA_WI6041\", " + |
| | | "\n\"servername\":\"London\", " + |
| | | "\n\"methodparameter\":{ " + |
| | | "\n\"content\":{ " + |
| | | "\n\"snresult\":{ " + |
| | | "\n}, " + |
| | | "\n\"testresult\":{ " + |
| | | "\n\"psn\":\"" + (string)contents["PSN"] + "\", " + |
| | | "\n\"workordernumber\":\"100000236815\", " + |
| | | "\n\"testStationId\":\"" + StationID + "\", " + |
| | | "\n\"testStationName\":\"" + Station + "\", " + |
| | | "\n\"linename\":\"" + Line + "\", " + |
| | | "\n\"hostname\":\"admin-PC-0930\", " + |
| | | "\n\"testTime\":\"" + string.Format("{0:yyyy-MM-dd HH:mm:ss.fff}", DateTime.Now) + "\", " + |
| | | "\n\"testModel\":\"S87567GB002_BLK1\", " + |
| | | "\n\"testWorkID\":\"\", " + |
| | | "\n\"Fixture\":\"\", " + |
| | | "\n\"FixtureSN\":\"\", " + |
| | | "\n\"Powersupply\":\"\", " + |
| | | "\n\"PowersupplySN\":\"\", " + |
| | | "\n\"Instrument\":\"\", " + |
| | | "\n\"InstrumentSN\":\"\", " + |
| | | "\n\"Operator\":\"\", " + |
| | | "\n\"testVersion\":\"V1.0.1\" " + |
| | | "\n}, " + |
| | | "\n\"itemresult\":[ " + |
| | | "\n]," + |
| | | "\n\"specialitem\":[ " + |
| | | "\n] " + |
| | | "\n}, " + |
| | | "\n\"state\":\"pass\", " + |
| | | "\n\"errcode\":\"\", " + |
| | | "\n\"errmessage\":\"\"} " + |
| | | "\n}"; |
| | | string WI6041 = "{ "; |
| | | WI6041 += "\n\"user\":\"sys\", "; |
| | | WI6041 += "\n\"password\":\"sysuser\", "; |
| | | WI6041 += "\n\"method\":\"MES_BA_WI6041\", "; |
| | | WI6041 += "\n\"servername\":\"London\", "; |
| | | WI6041 += "\n\"methodparameter\":{ "; |
| | | WI6041 += "\n\"content\":{ "; |
| | | WI6041 += "\n\"snresult\":{ "; |
| | | WI6041 += "\n}, "; |
| | | WI6041 += "\n\"testresult\":{ "; |
| | | WI6041 += "\n\"psn\":\"" + PSN + "\", "; |
| | | WI6041 += "\n\"workordernumber\":\"100000236815\", "; |
| | | WI6041 += "\n\"testStationId\":\"" + StationID + "\", "; |
| | | WI6041 += "\n\"testStationName\":\"" + Station + "\", "; |
| | | WI6041 += "\n\"linename\":\"" + Line + "\", "; |
| | | WI6041 += "\n\"hostname\":\"admin-PC-0930\", "; |
| | | WI6041 += "\n\"testTime\":\"" + string.Format("{0:yyyy-MM-dd HH:mm:ss.fff}", DateTime.Now) + "\", "; |
| | | WI6041 += "\n\"testModel\":\"S87567GB002_BLK1\", "; |
| | | WI6041 += "\n\"testWorkID\":\"\", "; |
| | | WI6041 += "\n\"Fixture\":\"\", "; |
| | | WI6041 += "\n\"FixtureSN\":\"\", "; |
| | | WI6041 += "\n\"Powersupply\":\"\", "; |
| | | WI6041 += "\n\"PowersupplySN\":\"\", "; |
| | | WI6041 += "\n\"Instrument\":\"\", "; |
| | | WI6041 += "\n\"InstrumentSN\":\"\", "; |
| | | WI6041 += "\n\"Operator\":\"\", "; |
| | | WI6041 += "\n\"testVersion\":\"V1.0.1\" "; |
| | | WI6041 += "\n}, "; |
| | | WI6041 += "\n\"itemresult\":[ "; |
| | | WI6041 += "\n],"; |
| | | WI6041 += "\n\"specialitem\":[ "; |
| | | WI6041 += "\n] "; |
| | | WI6041 += "\n}, "; |
| | | WI6041 += "\n\"state\":\"pass\", "; |
| | | WI6041 += "\n\"errcode\":\"\", "; |
| | | WI6041 += "\n\"errmessage\":\"\"} "; |
| | | WI6041 += "\n}"; |
| | | JObject jo = MES_Interface(WI6041, encryptionKey); |
| | | if (jo["state"].ToString() == "false") |
| | | { |
| | | t = false; |
| | | System_Bll.WriteLogToDB(new Entity.Base_Log |
| | | { |
| | | CreateUserID = FrmLogin.LoginUserID, |
| | | CreateUserName = FrmLogin.loginUserName, |
| | | LocalIP = FrmLogin.LocalIP, |
| | | LogMessage = "MES接口WI6041数据提交失败", |
| | | Type = "包装线", |
| | | LogMessage = "WI6041接口调用失败:" + jo["content"].ToString(), |
| | | Type = "称重", |
| | | ClassName = typeof(FrmLogin).ToString() |
| | | }); |
| | | |
| | | string a = string.Format("{0:yyyy-MM-dd HH:mm:ss.fff}", DateTime.Now); |
| | | return false; |
| | | } |
| | | return true; |