using Newtonsoft.Json; using System; using XS_Model; using XS_DAL; using System.Collections.Generic; using Newtonsoft.Json.Linq; using System.Linq; namespace XS_BLL { /// /// WCS任务取消 /// public class WCS_CANCELTASK_BLL { #region 全局参数 /// /// 接口地址,请求路径 /// public static string InterfaceAdd = Global.upper_WMSURL + "api/wcs/task/cancel";//请求路径 /// /// 接口名称,接口日志文件名 /// public static string InterfaceName = "WCS_CANCELTASK"; /// /// 接口描述 /// public static string InterfaceNote = "WCS任务取消"; /// /// 接口流向 /// public static string InterfaceFlow = "WCS==>>WMS"; /// /// 请求JSON /// public static string reqJson = string.Empty; /// /// 反馈JSON /// public static string retJson = string.Empty; #endregion /// /// 测试--WCS任务取消 /// /// public static string response_WCS_CANCELTASK() { 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; } /// /// WCS任务取消(通用) /// add 修改人:yy 修改时间:2024年3月7日 原因/内容:重新修改返回流程 /// public static void WCS_CANCELTASK() { 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(); int[] arr = new int[] { 900 };//900 WCS 任务删除 modelList = model.GetModelList(" CONTROL_STATUS in(" + string.Join(",", arr) + ")"); foreach (var item in modelList) { #region reqJson string taskDescr = string.Empty; switch (item.CONTROL_STATUS) { case 900: taskDescr = "WCS 手工任务删除"; break; default: taskDescr = ""; break; } 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("subtaskNo", item.MANAGE_ID));//管理任务任务号 objMis.Add(new JProperty("taskDescr", taskDescr));//异常任务描述 objMis.Add(new JProperty("cancelledTime", item.CONTROL_END_TIME));//取消时间 #endregion reqJson = JsonConvert.DeserializeObject(objMis.ToString()).ToString(); retJson = HttpHelper.PostJson(InterfaceAdd, reqJson); string retSuccess = UtilityBLL.GetReceiveValues(retJson, "success"); //返回是否取消成功 if (new string[] { "900" }.Contains(item.CONTROL_STATUS.ToString()) && Convert.ToBoolean(retSuccess) == true) { model.Delete(" CONTROL_STATUS = 900 and 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); } } } }