GMethod.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589
  1. using Newtonsoft.Json;
  2. using Newtonsoft.Json.Linq;
  3. using SufeiUtil;
  4. using SXLibrary;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Data.SQLite;
  8. using System.IO;
  9. using System.Linq;
  10. using System.Text;
  11. using System.Threading.Tasks;
  12. using System.Windows.Forms;
  13. namespace MOKA_Factory_Tools
  14. {
  15. internal class GMethod
  16. {
  17. private static MaInfo s_maInfo = null;
  18. private static string strLastOrder = "";
  19. private static string strOrderKind = ""; // 试产 or 量产;
  20. private static Dictionary<string, string> LastKaylaOrderInfo = new Dictionary<string, string>();
  21. private static string url_MaInfo = "http://smes-prd-app01.tclking.com:9002/SAPService.asmx";
  22. private static string url_ReportKey = "http://smes-app-prod.tclking.com/FireTVApi/api/SMES/RecordKey";
  23. private static string url_getOrderProductStatus = "http://smes-app-prod.tclking.com/FireTVApi/api/SMES/getOrderProductStatus?sn=";
  24. private static string url_getMainBoardPSNWithSN = "http://smes-app-prod.tclking.com:9006/api/xm/GetXMTVParts?TVSN=";
  25. public static void SetMexicanConfig(bool bMexican=false)
  26. {
  27. if (bMexican)
  28. {
  29. url_MaInfo = "http://SMES.TMSA.MX:9002/SAPService.asmx";
  30. url_ReportKey = "http://SMES.TMSA.MX/FireTVApi/api/SMESMX/RecordKey";
  31. url_getOrderProductStatus = "http://SMES.TMSA.MX/FireTVApi/api/SMESMX/getOrderProductStatus?sn=";
  32. }
  33. }
  34. public static bool GetMaInfo(string sn, string order, out MaInfo maInfo, SQLiteConnection errorDBNow)
  35. {
  36. string desc;
  37. maInfo = null;
  38. if (s_maInfo != null && s_maInfo.ODF.Equals(order, StringComparison.InvariantCultureIgnoreCase) )
  39. {
  40. maInfo = s_maInfo;
  41. return true;
  42. }
  43. string strPost = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
  44. "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
  45. "<soap:Body>" +
  46. "<GetMaInfo xmlns=\"http://tempuri.org/\">" +
  47. "<sn>" + sn + "</sn>" +
  48. "</GetMaInfo>" +
  49. "</soap:Body>" +
  50. "</soap:Envelope>";
  51. HttpHelper http = new HttpHelper();
  52. HttpItem item = new HttpItem()
  53. {
  54. Encoding = Encoding.UTF8,
  55. Method = "post",
  56. ContentType = "text/xml",
  57. KeepAlive = false
  58. };
  59. item.URL = url_MaInfo;
  60. item.Postdata = strPost;
  61. HttpResult result = http.GetHtml(item);
  62. if (result.StatusCode == System.Net.HttpStatusCode.OK)
  63. {
  64. Log.WriteGetKeyLog("\r\nGetMaInfo :\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
  65. if (!Xmlconfig.GetMaInfoXml(result.Html, out maInfo, out desc))
  66. {
  67. Log.WriteGetKeyLog("GetMaInfo error:" + desc + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata);
  68. return false;
  69. }
  70. }
  71. else
  72. {
  73. Log.WriteGetKeyLog("GetMaInfo error:" + result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata);
  74. return false;
  75. }
  76. s_maInfo = maInfo;
  77. return true;
  78. }
  79. /// <summary>
  80. /// 上报数据抄写结果到MES系统中;
  81. /// </summary>
  82. /// <param name="fsn"></param>
  83. /// <param name="dsn"></param>
  84. /// <param name="dateTime">抄写时间</param>
  85. /// <param name="result">抄写结果</param>
  86. /// <param name="msg">如果上报失败,此参数为失败的描述信息</param>
  87. /// <returns></returns>
  88. public static bool ReportDataBurningResultToMES(string fsn, string dsn, string result, string dateTime, SQLiteConnection errorDBNow, out string msg, out string returnObject)
  89. {
  90. msg = "";
  91. returnObject = "";
  92. string strPost = string.Format("{{\"FSN\":\"{0}\",\"DSN\":\"{1}\",\"DataCopy\":\"{2}\",\"UPDATETIME\":\"{3}\"}}", fsn, dsn, result, dateTime);
  93. HttpHelper http = new HttpHelper();
  94. HttpItem item = new HttpItem()
  95. {
  96. Encoding = Encoding.UTF8,
  97. Method = "post",
  98. ContentType = "application/json",
  99. KeepAlive = false
  100. };
  101. // 测试地址;
  102. item.URL = url_ReportKey;
  103. item.Postdata = strPost;
  104. HttpResult hResult = http.GetHtml(item);
  105. if (hResult.StatusCode == System.Net.HttpStatusCode.OK)
  106. {
  107. try
  108. {
  109. using (JsonTextReader reader = new JsonTextReader(new StringReader(hResult.Html)))
  110. {
  111. JObject jObject = (JObject)JToken.ReadFrom(reader);
  112. reader.Close();
  113. bool bResult = jObject["Result"].Value<bool>();
  114. msg = jObject["EroMsg"].Value<string>();
  115. if (jObject["returnObject"] != null)
  116. returnObject = jObject["returnObject"].ToString();
  117. Log.WriteInfoLog("nReportDataBurningResultToMES:" + hResult.StatusDescription + "\r\n" + hResult.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata);
  118. return bResult;
  119. }
  120. }
  121. catch (Exception e)
  122. {
  123. msg = e.Message;
  124. Log.WriteErrorLog("ReportDataBurningResultToMES Json-error:" + hResult.StatusDescription + "\r\n" + hResult.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata);
  125. }
  126. }
  127. else
  128. {
  129. msg = hResult.StatusDescription;
  130. Log.WriteInfoLog("ReportDataBurningResultToMES Http-error:" + hResult.StatusDescription + "\r\n" + hResult.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata);
  131. }
  132. // 没有进行数据库查重:惹数据已添加过,同一次FSN抄写多次失败后导致多条记录。
  133. SQLiteHelper.InsertDelayErrorReport(errorDBNow, new object[] { item.URL, item.Postdata });
  134. return false;
  135. }
  136. /// <summary>
  137. /// 上传本地数据库失败的日志,重新上传;
  138. /// </summary>
  139. /// <param name="url"></param>
  140. /// <param name="strPost"></param>
  141. /// <param name="mark"></param>
  142. /// <returns></returns>
  143. public static bool ReportDataBurningResultToMES(string url, string strPost, out bool mark)
  144. {
  145. // 表示是否上传成功;
  146. mark = false;
  147. HttpHelper http = new HttpHelper();
  148. HttpItem item = new HttpItem()
  149. {
  150. Encoding = Encoding.UTF8,
  151. Method = "post",
  152. ContentType = "application/json",
  153. KeepAlive = false
  154. };
  155. item.URL = url;
  156. item.Postdata = strPost;
  157. HttpResult hResult = http.GetHtml(item);
  158. if (hResult.StatusCode == System.Net.HttpStatusCode.OK)
  159. {
  160. try
  161. {
  162. using (JsonTextReader reader = new JsonTextReader(new StringReader(hResult.Html)))
  163. {
  164. JObject jObject = (JObject)JToken.ReadFrom(reader);
  165. reader.Close();
  166. mark = jObject["Result"].Value<bool>();
  167. Log.WriteInfoLog("nReportDataBurningResultToMES:" + hResult.StatusDescription + "\r\n" + hResult.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata);
  168. return true;
  169. }
  170. }
  171. catch (Exception)
  172. {
  173. Log.WriteErrorLog("ReportDataBurningResultToMES error:" + hResult.StatusDescription + "\r\n" + hResult.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata);
  174. throw;
  175. }
  176. }
  177. else
  178. {
  179. Log.WriteInfoLog("ReportDataBurningResultToMES error:" + hResult.StatusDescription + "\r\n" + hResult.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata);
  180. }
  181. return false;
  182. }
  183. /// <summary>
  184. /// 通过SN获取订单类型
  185. /// </summary>
  186. /// <param name="sn"></param>
  187. /// <returns></returns>
  188. public static bool GetOrderTypeFromSN(string sn, string order, out string result, out string msg)
  189. {
  190. msg = "";
  191. result = "";
  192. if (order.Equals(strLastOrder, StringComparison.OrdinalIgnoreCase))
  193. {
  194. if (strOrderKind.Equals("量产") || strOrderKind.Equals("试产"))
  195. {
  196. result = strOrderKind;
  197. return true;
  198. }
  199. }
  200. HttpHelper http = new HttpHelper();
  201. HttpItem item = new HttpItem()
  202. {
  203. Encoding = Encoding.UTF8,
  204. Method = "post",
  205. ContentType = "application/x-www-form-urlencoded",
  206. KeepAlive = false
  207. };
  208. // 测试地址;
  209. item.URL = url_getOrderProductStatus + sn;
  210. HttpResult hResult = http.GetHtml(item);
  211. if (hResult.StatusCode == System.Net.HttpStatusCode.OK)
  212. {
  213. try
  214. {
  215. using (JsonTextReader reader = new JsonTextReader(new StringReader(hResult.Html)))
  216. {
  217. JObject jObject = (JObject)JToken.ReadFrom(reader);
  218. reader.Close();
  219. bool bResult = jObject["Result"].Value<bool>();
  220. msg = jObject["EroMsg"].Value<string>();
  221. string returnObject = jObject["returnObject"].ToString();
  222. if (bResult)
  223. {
  224. if (returnObject.Contains("量产"))
  225. result = "量产";
  226. else if (returnObject.Contains("试产"))
  227. result = "试产";
  228. else
  229. result = "错误返回";
  230. strOrderKind = result;
  231. Log.WriteInfoLog("\r\nIsCuringBOM :\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + hResult.Html);
  232. return true;
  233. }
  234. Log.WriteInfoLog("IsCuringBOM error:" + hResult.StatusDescription + "\r\n" + hResult.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata);
  235. }
  236. }
  237. catch (Exception e)
  238. {
  239. msg = e.Message;
  240. Log.WriteErrorLog("IsCuringBOM Json-error:" + hResult.StatusDescription + "\r\n" + hResult.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata);
  241. }
  242. }
  243. else
  244. {
  245. msg = hResult.StatusDescription;
  246. Log.WriteInfoLog("IsCuringBOM Http-error:" + hResult.StatusDescription + "\r\n" + hResult.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata);
  247. }
  248. strOrderKind = "";
  249. return false;
  250. }
  251. /// <summary>
  252. // Section1:本机信息;
  253. // Section2:SMES信息;
  254. // Section3:实际抄写Key信息;
  255. /// </summary>
  256. /// <param name="Line"></param>
  257. /// <param name="Station"></param>
  258. /// <param name="order"></param>
  259. /// <param name="sn"></param>
  260. /// <param name="StartTime"></param>
  261. /// <param name="EndOfTime"></param>
  262. /// <param name="returnObject"></param>
  263. /// <param name="key"></param>
  264. /// <param name="result"></param>
  265. /// <returns></returns>
  266. public static bool GeneratKaylaData(string Line, string Station, string order, string sn, DateTime StartTime, DateTime EndOfTime, string returnObject, KeyInfo key, bool result)
  267. {
  268. Dictionary<string, string> localInfo = new Dictionary<string, string>();
  269. // 本机信息;
  270. localInfo.Add("Item", "Value");
  271. localInfo.Add("factory_id_I", "TCL");
  272. localInfo.Add("operator_I", Line);
  273. localInfo.Add("station_I", Station);
  274. localInfo.Add("fixture_id_I", "1_1");
  275. localInfo.Add("gui_ver_I", System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString());
  276. localInfo.Add("route_check_I", "1");
  277. // SMES信息;
  278. string strLastOrder = CommonMethod.ReadProfileString("MOKAFactoryTools", "LastOrder", "");
  279. if (!strLastOrder.Equals(order, StringComparison.OrdinalIgnoreCase))
  280. {
  281. // 请求新的订单信息;
  282. MaInfo maInfo;
  283. if (!GetMaInfo(sn, order, out maInfo, null))
  284. {
  285. Log.WriteErrorLog("Kayla GetMaInfo失败");
  286. return false;
  287. }
  288. LastKaylaOrderInfo = new Dictionary<string, string>();
  289. if (maInfo != null)
  290. {
  291. LastKaylaOrderInfo.Add("project_name_I", maInfo.project_name_I);
  292. LastKaylaOrderInfo.Add("build_I", maInfo.build_I);
  293. LastKaylaOrderInfo.Add("build_config_I", maInfo.build_config_I);
  294. LastKaylaOrderInfo.Add("diag_ver_I", maInfo.diag_ver_I);
  295. LastKaylaOrderInfo.Add("image_name_ver_I", maInfo.image_name_ver_I);
  296. LastKaylaOrderInfo.Add("soc_type", maInfo.soc_type);
  297. LastKaylaOrderInfo.Add("speaker_vender", maInfo.speaker_vender);
  298. LastKaylaOrderInfo.Add("mic_vender", maInfo.mic_vender);
  299. }
  300. }
  301. Dictionary<string, string> dic = localInfo.Union(LastKaylaOrderInfo).ToDictionary(k => k.Key, v => v.Value);
  302. dic.Add("start_time_I", StartTime.ToString());
  303. dic.Add("serial_id_I", key != null ? key.DSN : ""); // DSN;
  304. dic.Add("FSN", sn);
  305. // 耐压值;
  306. if (returnObject != null && returnObject.Length > 0 && returnObject.Contains("Hightpot"))
  307. {
  308. Log.WriteInfoLog(String.Format("returnObjec={0}", returnObject));
  309. // 删除头尾[];
  310. returnObject = returnObject.Remove(0, 1);
  311. returnObject = returnObject.Remove(returnObject.Length - 1, 1);
  312. JObject jObject = JObject.Parse(returnObject);
  313. string hightpot = CommonMethod.JSON_SeleteNode(jObject, "Hightpot");
  314. int pos = hightpot.LastIndexOf('/');
  315. if (pos != -1)
  316. {
  317. hightpot = hightpot.Substring(pos + 1);
  318. pos = hightpot.IndexOf("mA");
  319. // 使用正规去除数字+小数点以外的字符;
  320. string AC = hightpot.Substring(0, pos + 2);
  321. string DC = hightpot.Substring(pos + 2);
  322. AC = System.Text.RegularExpressions.Regex.Replace(AC, @"[^\d.]*", "");
  323. DC = System.Text.RegularExpressions.Regex.Replace(DC, @"[^\d.]*", "");
  324. dic.Add("AC_I", AC);
  325. dic.Add("DC_R", DC);
  326. }
  327. else
  328. {
  329. dic.Add("AC_I", "");
  330. dic.Add("DC_R", "");
  331. }
  332. }
  333. else
  334. {
  335. dic.Add("AC_I", "");
  336. dic.Add("DC_R", "");
  337. Log.WriteErrorLog("获取耐压值结果为空");
  338. }
  339. if (key != null)
  340. {
  341. if (key.DID.enable)
  342. {
  343. dic.Add("DID", key.DID); // 本身就是字符串;
  344. dic.Add("DID_check", key.DID.result ? "PASS" : "FAIL");
  345. }
  346. if (key.Mac.enable)
  347. {
  348. dic.Add("Mac", key.Mac);//keyInfo.Mac.data.Replace("-", ":");
  349. dic.Add("Mac_check", key.Mac.result ? "PASS" : "FAIL");
  350. }
  351. if (key.HDCP.enable)
  352. {
  353. dic.Add("HDCP", key.HDCP);
  354. dic.Add("HDCP_check", key.HDCP.result ? "PASS" : "FAIL");
  355. }
  356. if (key.HDCP22.enable)
  357. {
  358. dic.Add("HDCP22", key.HDCP22);
  359. dic.Add("HDCP22_check", key.HDCP22.result ? "PASS" : "FAIL");
  360. }
  361. if (key.ESN.enable)
  362. {
  363. dic.Add("ESN", key.ESN);
  364. dic.Add("ESN_check", key.ESN.result ? "PASS" : "FAIL");
  365. }
  366. if (key.Widevine.enable)
  367. {
  368. dic.Add("Widevine", key.Widevine);
  369. dic.Add("Widevine_check", key.Widevine.result ? "PASS" : "FAIL");
  370. }
  371. if (key.CI_plus.enable)
  372. {
  373. dic.Add("CI_plus", key.CI_plus);
  374. dic.Add("CI_plus_check", key.CI_plus.result ? "PASS" : "FAIL");
  375. }
  376. if (key.Attestation.enable)
  377. {
  378. dic.Add("Attestation", key.Attestation);
  379. dic.Add("Attestation_check", key.Attestation.result ? "PASS" : "FAIL");
  380. }
  381. if (key.MGK.enable)
  382. {
  383. dic.Add("MGK", key.MGK);
  384. dic.Add("MGK_check", key.MGK.result ? "PASS" : "FAIL");
  385. }
  386. if (key.Fairplay.enable)
  387. {
  388. dic.Add("Fairplay", key.Fairplay);
  389. dic.Add("Fairplay_check", key.Fairplay.result ? "PASS" : "FAIL");
  390. }
  391. if (key.DSN.enable)
  392. {
  393. dic.Add("DSN", key.DSN);
  394. dic.Add("DSN_check", key.DSN.result ? "PASS" : "FAIL");
  395. }
  396. if (key.WiFi_MAC.enable)
  397. {
  398. dic.Add("WiFi_MAC", key.WiFi_MAC);
  399. dic.Add("WiFi_MAC_check", key.WiFi_MAC.result ? "PASS" : "FAIL");
  400. }
  401. if (key.BT_MAC.enable)
  402. {
  403. dic.Add("BT_MAC", key.BT_MAC);
  404. dic.Add("BT_MAC_check", key.BT_MAC.result ? "PASS" : "FAIL");
  405. }
  406. if (key.LEK.enable)
  407. {
  408. dic.Add("LEK", key.LEK);
  409. dic.Add("LEK_check", key.LEK.result ? "PASS" : "FAIL");
  410. }
  411. if (key.PEK.enable)
  412. {
  413. dic.Add("PEK", key.PEK);
  414. dic.Add("PEK_check", key.PEK.result ? "PASS" : "FAIL");
  415. }
  416. if (key.Playready.enable)
  417. {
  418. dic.Add("Playready", key.Playready);
  419. dic.Add("Playready_check", key.Playready.result ? "PASS" : "FAIL");
  420. }
  421. if (key.Hashkey.enable)
  422. {
  423. dic.Add("Hashkey", key.Hashkey);
  424. dic.Add("Hashkey_check", key.Hashkey.result ? "PASS" : "FAIL");
  425. }
  426. if (key.ECP.enable)
  427. {
  428. dic.Add("ECP", key.ECP);
  429. dic.Add("ECP_check", key.ECP.result ? "PASS" : "FAIL");
  430. }
  431. if (key.YouTube_KEY.enable)
  432. {
  433. dic.Add("YouTube_KEY", key.YouTube_KEY);
  434. dic.Add("YouTube_KEY_check", key.YouTube_KEY.result ? "PASS" : "FAIL");
  435. }
  436. if ( key.FVP.enable )
  437. {
  438. dic.Add("FVP_set", key.FVP.data);
  439. dic.Add("FVP_check", key.FVP.result ? "PASS" : "FAIL");
  440. }
  441. }
  442. dic.Add("cycle_time_I", EndOfTime.Subtract(StartTime).Seconds.ToString());
  443. dic.Add("test_result_I", result ? "PASS" : "FAIL");
  444. try
  445. {
  446. // 以DSN命名文件;
  447. if (!Directory.Exists(AppDomain.CurrentDomain.BaseDirectory + "Kayla"))
  448. {
  449. Directory.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory + "Kayla");
  450. }
  451. string savefile = string.Format("{0}Kayla\\{1}.csv", AppDomain.CurrentDomain.BaseDirectory, sn);
  452. Log.WriteInfoLog(string.Format("Kayla: sn={0}, savefile={1}", sn, savefile));
  453. using (System.IO.StreamWriter file = new System.IO.StreamWriter(savefile, false))
  454. {
  455. foreach (KeyValuePair<string, string> kvp in dic)
  456. {
  457. file.WriteLine(string.Format("{0},{1}", kvp.Key, kvp.Value));
  458. }
  459. }
  460. }
  461. catch (Exception ex)
  462. {
  463. Log.WriteErrorLog(string.Format("保存csv文件失败:{0}", ex.ToString()));
  464. return false;
  465. }
  466. CommonMethod.StartProcess(AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "tcp_send.exe", sn);
  467. return true;
  468. }
  469. // 根据FSN获取服务器上与之绑定的PSN值;
  470. // 这个函数在哪里调用,被谁调用;
  471. // 成功怎么处理;失败怎么处理;
  472. public static bool GetMainBoardPSNWithSN(string FSN, out string PSN)
  473. {
  474. string msg;
  475. PSN = "";
  476. HttpHelper http = new HttpHelper();
  477. HttpItem item = new HttpItem()
  478. {
  479. Encoding = Encoding.UTF8,
  480. Method = "post",
  481. ContentType = "application/x-www-form-urlencoded",
  482. KeepAlive = false
  483. };
  484. item.URL = url_getMainBoardPSNWithSN + FSN;
  485. HttpResult hResult = http.GetHtml(item);
  486. if (hResult.StatusCode == System.Net.HttpStatusCode.OK)
  487. {
  488. try
  489. {
  490. using (JsonTextReader reader = new JsonTextReader(new StringReader(hResult.Html)))
  491. {
  492. JObject jObject = (JObject)JToken.ReadFrom(reader);
  493. reader.Close();
  494. foreach (var ss in jObject["Tvparts"]) //查找某个字段与值
  495. {
  496. //如果里面的TypeCode为MA(主板),读出他的PSN
  497. if (ss["PartTypeCode"].Value<string>().Equals("MA", StringComparison.OrdinalIgnoreCase))
  498. {
  499. PSN = ss["PartSN"].Value<string>();
  500. }
  501. }
  502. if (PSN == "" || PSN == null)
  503. {
  504. MessageBox.Show("查不到该FSN对应的主板PSN号");
  505. return false;
  506. }
  507. Log.WriteInfoLog("PartSN" + PSN);
  508. return true;
  509. }
  510. }
  511. catch (Exception e)
  512. {
  513. msg = e.Message;
  514. Log.WriteErrorLog("IsCuringBOM Json-error:" + hResult.StatusDescription + "\r\n" + hResult.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata);
  515. }
  516. }
  517. else
  518. {
  519. msg = hResult.StatusDescription;
  520. Log.WriteInfoLog("IsCuringBOM Http-error:" + hResult.StatusDescription + "\r\n" + hResult.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata);
  521. }
  522. return false;
  523. }
  524. }
  525. }