|
|
@@ -38,6 +38,11 @@ namespace UAS_MES_NEW.PublicMethod
|
|
|
[JsonProperty("hashKey")]
|
|
|
public string HashKey { get; set; }
|
|
|
}
|
|
|
+ public class BindItemYS
|
|
|
+ {
|
|
|
+ [JsonProperty("barcd")]
|
|
|
+ public string barcd { get; set; }
|
|
|
+ }
|
|
|
|
|
|
public class RootObject
|
|
|
{
|
|
|
@@ -65,6 +70,32 @@ namespace UAS_MES_NEW.PublicMethod
|
|
|
[JsonProperty("bindList")]
|
|
|
public List<BindItem> BindList { get; set; }
|
|
|
}
|
|
|
+
|
|
|
+ public class RootObjectYS {
|
|
|
+ [JsonProperty("nub")]
|
|
|
+ public string nub { get; set; }
|
|
|
+
|
|
|
+ [JsonProperty("login_key")]
|
|
|
+ public string login_key { get; set; }
|
|
|
+
|
|
|
+ [JsonProperty("ebeln")]
|
|
|
+ public string ebeln { get; set; }
|
|
|
+
|
|
|
+ [JsonProperty("ebelp")]
|
|
|
+ public string ebelp { get; set; }
|
|
|
+
|
|
|
+ [JsonProperty("pkcde")]
|
|
|
+ public string pkcde { get; set; }
|
|
|
+
|
|
|
+ [JsonProperty("brgew")]
|
|
|
+ public double brgew { get; set; }
|
|
|
+
|
|
|
+ [JsonProperty("mak01")]
|
|
|
+ public string mak01 { get; set; }
|
|
|
+
|
|
|
+ [JsonProperty("bindList")]
|
|
|
+ public List<BindItemYS> BindList { get; set; }
|
|
|
+ }
|
|
|
public class DeviceInfo
|
|
|
{
|
|
|
[JsonProperty("tool_name")]
|
|
|
@@ -535,8 +566,74 @@ namespace UAS_MES_NEW.PublicMethod
|
|
|
{
|
|
|
returnstr = returnstr.Substring(0, 1000);
|
|
|
}
|
|
|
+ dh.ExecuteSql("insert into EISDATA(ED_ID, ED_DATA, ED_INDATE, ED_TYPE)values(EISDATA_seq.nextval,'" + returnstr + "',sysdate,'SendPowerCode')", "insert");
|
|
|
}
|
|
|
|
|
|
+ public static async void SendBoxDataYS(string iBox)
|
|
|
+ {
|
|
|
+ string sn = dh.getFieldDataByCondition("packagedetail left join ztedata on pd_barcode=ZD_DEV_EN_NO and pd_makecode=zd_makecode ", "replace(wm_concat(replace(ZD_MAC_START,'-','')),',','-')", "pd_outboxcode='" + iBox + "' and zd_type='BOX'").ToString();
|
|
|
+ DataTable dt = (DataTable)dh.ExecuteSql("select ma_custpo,ma_custpodetno,ZD_BIG_BOX_NO,pr_code,PRODUCT_MODE,ms_makecode,po_sn from makeserial left join product on ms_prodcode=pr_code left join make on ma_code=ms_makecode left join zte_order on ma_custpo=batch_no left join ztedata on ZD_DEV_EN_NO=ms_sncode and zd_makecode=ms_makecode where ms_outboxcode ='" + iBox + "' and zd_type='BOX' order by ms_id desc", "select");
|
|
|
+ string pr_code = "";
|
|
|
+ var root = new RootObjectYS
|
|
|
+ {
|
|
|
+ nub = iBox,
|
|
|
+ login_key = "PRD90904837",
|
|
|
+ ebeln = dt.Rows[0]["ma_custpo"].ToString(),
|
|
|
+ ebelp = dt.Rows[0]["ma_custpodetno"].ToString(),
|
|
|
+ pkcde = iBox,
|
|
|
+ brgew = 0,
|
|
|
+ mak01 = "mak01",
|
|
|
+ BindList = new List<BindItemYS>()
|
|
|
+ };
|
|
|
+ dt = (DataTable)dh.ExecuteSql("select pd_barcode,replace(ZD_MAC_START,'-','')ZD_MAC_START from packagedetail left join ztedata on pd_barcode=ZD_DEV_EN_NO and pd_makecode=zd_makecode where pd_outboxcode='" + iBox + "' and zd_type='BOX' order by pd_barcode", "select");
|
|
|
+ for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ root.BindList.Add(new BindItemYS
|
|
|
+ {
|
|
|
+ barcd = dt.Rows[i]["pd_barcode"].ToString()
|
|
|
+ }); ;
|
|
|
+ }
|
|
|
+ var httpClientHandler = new HttpClientHandler();
|
|
|
+ httpClientHandler.ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => { return true; };
|
|
|
+
|
|
|
+ using (var client = new HttpClient(httpClientHandler))
|
|
|
+ {
|
|
|
+ StringBuilder sbText = new StringBuilder();
|
|
|
+ string json = JsonConvert.SerializeObject(root, Formatting.Indented);
|
|
|
+ var content = new StringContent(json, Encoding.UTF8, "application/json");
|
|
|
+ await Console.Out.WriteLineAsync(json);
|
|
|
+ try
|
|
|
+ {
|
|
|
+ var response = await client.PostAsync("https://xi.hikvision.com:8850/RESTAdapter/outsourcing/CALLBACKPACKINGINFO", content);
|
|
|
+ if (response.IsSuccessStatusCode)
|
|
|
+ {
|
|
|
+ string returnstr = await response.Content.ReadAsStringAsync();
|
|
|
+ JObject deviceObj = JObject.Parse(returnstr);
|
|
|
+ string code = deviceObj["code"]["code"].ToString();
|
|
|
+ string msg = deviceObj["code"]["msg"].ToString();
|
|
|
+ if (code == "0000")
|
|
|
+ {
|
|
|
+ dh.ExecuteSql("update packagedetail set pd_issuccess=-1 where pd_outboxcode='" + iBox + "'", "update");
|
|
|
+ dh.ExecuteSql("update package set pa_issuccess=-1 where pa_outboxcode='" + iBox + "'", "update");
|
|
|
+ //MessageBox.Show(ZD_BIG_BOX_NO + "上传星云成功");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ dh.ExecuteSql("insert into EISDATA(ED_ID, ED_DATA, ED_INDATE, ED_TYPE)values(EISDATA_seq.nextval,'" + msg + "',sysdate,'SendBoxData')", "insert");
|
|
|
+ MessageBox.Show(msg);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ BaseUtil.ShowError(response.StatusCode.ToString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ dh.ExecuteSql("insert into EISDATA(ED_ID, ED_DATA, ED_INDATE, ED_TYPE)values(EISDATA_seq.nextval,'" + ex.Message + "',sysdate,'SendBoxData')", "insert");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
//发送外箱号数据,打印前获取
|
|
|
public static async void SendBoxData(string iBox)
|
|
|
{
|