using Newtonsoft.Json; using System; using XS_Model; using XS_DAL; using System.Collections.Generic; using System.Linq; using Newtonsoft.Json.Linq; namespace XS_BLL { /// /// 上架/下架确认 /// public class STACK_INBOUNDCONFIRM_BLL { #region 全局参数 /// /// 接口地址,请求路径 /// public static string InterfaceAdd = Global.upper_WMSURL + "stack/inboundConfirm";//请求路径 /// /// 接口名称,接口日志文件名 /// public static string InterfaceName = "STACK_INBOUNDCONFIRM"; /// /// 接口描述 /// public static string InterfaceNote = "上架/下架确认"; /// /// 接口流向 /// public static string InterfaceFlow = "WCS==>>WMS"; /// /// 请求JSON /// public static string reqJson = string.Empty; /// /// 反馈JSON /// public static string retJson = string.Empty; #endregion /// /// 测试 --上架/下架确认 /// /// public static string response_STACK_INBOUNDCONFIRM() { JObject dataJson = null; string json = JsonConvert.SerializeObject(new { code = 0, //调试时自行约定,只要类型对应接口,后面不做说明 success = true, // 当为false的时候,则不用进入到分拨的线体,直行到异常线体口 msg = "", //"XXX数据,成功接收" data = dataJson }); #region json JObject objMis = new JObject(); objMis.Add(new JProperty("code", 0)); objMis.Add(new JProperty("success", true)); objMis.Add(new JProperty("msg", "")); JObject objDate = new JObject(); objMis.Add(new JProperty("data", objDate)); json = JsonConvert.DeserializeObject(objMis.ToString()).ToString(); #endregion return json; } /// /// 上架/下架确认 /// public static void STACK_INBOUNDCONFIRM() { try { IO_CONTROL model = new IO_CONTROL(); List modelList = new List(); IO_CONTROL_APPLY caModle = new IO_CONTROL_APPLY(); IO_INTERFACE_TASK_LOG ItlModel = new IO_INTERFACE_TASK_LOG(); List acModelList = new List(); //WMS任务类型 0 默认 1 WMS AGV任务,2 WMS 上下架任务,3 移库,4 线上盘点 modelList = model.GetModelList(" CONTROL_STATUS in( 900,980,999) and WMS_TASKTYPE = '2' ");//900 WCS 任务删除、980 取空异常完成 foreach (var item in modelList) { #region reqJson JObject objMis = new JObject(); //objMis.Add(new JProperty("taskId", UtilityBLL.GetUuid()));//接口交互 任务号 谁发起,谁生成 objMis.Add(new JProperty("taskId", DateTime.Now.ToString("yyyyMMddHHmmss")));//接口交互 任务号 objMis.Add(new JProperty("taskNo", item.CONTROL_ID));//任务主键 objMis.Add(new JProperty("containerCode", item.STOCK_BARCODE));//托盘条码 objMis.Add(new JProperty("taskStatus", item.CONTROL_STATUS));//任务状态 新加 #endregion reqJson = JsonConvert.DeserializeObject(objMis.ToString()).ToString(); retJson = HttpHelper.PostJson(InterfaceAdd, reqJson); string retSuccess = UtilityBLL.GetReceiveValues(retJson, "success"); string code = UtilityBLL.GetReceiveValues(retJson, "code"); if (new string[] { "900", "980", "999" }.Contains(item.CONTROL_STATUS.ToString()) && code == "0") { //model.Delete(" CONTROL_ID = '" + item.CONTROL_ID + "'"); } #region 添加接口日志 及界面显示 UtilityBLL.CreateINTERFACE_LOG(InterfaceName, InterfaceFlow, reqJson, retJson, InterfaceNote); #endregion } } catch (Exception ex) { new DisplaySet().ErrorAddListBoxItem(InterfaceName, ex.Message); new DisplaySet().AddListBoxItem(InterfaceName, ex.Message); UtilityBLL.CreateINTERFACE_LOG(InterfaceName, InterfaceFlow, reqJson, ex.Message, InterfaceNote); LogHelper.ErrorLog(ex); } } } }