فهرست منبع

泰国接口提交

callm 1 روز پیش
والد
کامیت
bf643f054f
1فایلهای تغییر یافته به همراه53 افزوده شده و 2 حذف شده
  1. 53 2
      UAS_MES_HYSX/PublicMethod/HttpServer.cs

+ 53 - 2
UAS_MES_HYSX/PublicMethod/HttpServer.cs

@@ -151,6 +151,9 @@ namespace UAS_MES_NEW.PublicMethod
         [JsonProperty("order_no")]
         public string OrderNo { get; set; }
 
+        [JsonProperty("OrderNum")]
+        public string OrderNum { get; set; }
+
         // 使用字典或列表来存储序列化的数组数据
         public List<string> DSN { get; set; } = new List<string>();
         public List<string> MacStart { get; set; } = new List<string>();
@@ -171,6 +174,9 @@ namespace UAS_MES_NEW.PublicMethod
         public List<string> Reserve20 { get; set; } = new List<string>();
         public List<string> Reserve21 { get; set; } = new List<string>();
         public List<string> Reserve22 { get; set; } = new List<string>();
+        public List<string> product_id { get; set; } = new List<string>();
+        public List<string> sn { get; set; } = new List<string>();
+        public List<string> en { get; set; } = new List<string>();
 
     }
 
@@ -519,6 +525,51 @@ namespace UAS_MES_NEW.PublicMethod
                     break;
                 }
             }
+
+            index = 0;
+            while (true)
+            {
+                string key = $"product_id{index}";
+                if (jsonObject.TryGetValue(key, out JToken value))
+                {
+                    deviceInfo.product_id.Add(value.ToString());
+                    index++;
+                }
+                else
+                {
+                    break;
+                }
+            }
+
+            index = 0;
+            while (true)
+            {
+                string key = $"sn{index}";
+                if (jsonObject.TryGetValue(key, out JToken value))
+                {
+                    deviceInfo.sn.Add(value.ToString());
+                    index++;
+                }
+                else
+                {
+                    break;
+                }
+            }
+
+            index = 0;
+            while (true)
+            {
+                string key = $"en{index}";
+                if (jsonObject.TryGetValue(key, out JToken value))
+                {
+                    deviceInfo.en.Add(value.ToString());
+                    index++;
+                }
+                else
+                {
+                    break;
+                }
+            }
         }
     }
 
@@ -1322,7 +1373,7 @@ namespace UAS_MES_NEW.PublicMethod
                 Converters = new List<JsonConverter> { new DeviceInfoConverter() }
             };
 
-            Thailand deviceInfo = JsonConvert.DeserializeObject<Thailand>(returnstr, settings);
+            DeviceInfo deviceInfo = JsonConvert.DeserializeObject<DeviceInfo>(returnstr, settings);
 
             //将返回的信息存入数据库
             for (int i = 0; i < deviceInfo.product_id.Count; i++)
@@ -1334,7 +1385,7 @@ namespace UAS_MES_NEW.PublicMethod
                 dh.ExecuteSql("insert into ZTEDATA(ZD_ID,ZD_SN, ZD_MAKECODE, ZD_TYPE,ZD_product_mode, ZD_PRODUCTNAME, " +
                     "ZD_ORDER_NO, ZD_BIG_BOX_NO, ZD_D_SN, ZD_DEV_EN_NO,ZD_DEVICEID,zd_custom ,ZD_INDATE)" +
                     "values(ZTEDATA_seq.nextval,'" + deviceInfo.sn[i] + "','" + makecode + "','BOX','" + deviceInfo.ProductMode + "','" + deviceInfo.ProductName + "'," +
-                    ",'" + deviceInfo.OrderNum + "','" + deviceInfo.BigBoxNo + "','" + deviceInfo.sn[i] + "','" + deviceInfo.en[i] + "','" + deviceInfo.product_id[i] + "','Thailand'," +
+                    "'" + deviceInfo.OrderNum + "','" + deviceInfo.BigBoxNo + "','" + deviceInfo.sn[i] + "','" + deviceInfo.en[i] + "','" + deviceInfo.product_id[i] + "','Thailand'" +
                     ",sysdate)", "insert");
             }
             dh.ExecuteSql("update package set pa_zxcode ='" + deviceInfo.BigBoxNo + "' where pa_outboxcode='" + iBox + "'", "update");