安睿特接口
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

137 lines
5.3 KiB

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
{
/// <summary>
/// WCS任务取消
/// </summary>
public class WCS_CANCELTASK_BLL
{
#region 全局参数
/// <summary>
/// 接口地址,请求路径
/// </summary>
public static string InterfaceAdd = Global.upper_WMSURL + "api/wcs/task/cancel";//请求路径
/// <summary>
/// 接口名称,接口日志文件名
/// </summary>
public static string InterfaceName = "WCS_CANCELTASK";
/// <summary>
/// 接口描述
/// </summary>
public static string InterfaceNote = "WCS任务取消";
/// <summary>
/// 接口流向
/// </summary>
public static string InterfaceFlow = "WCS==>>WMS";
/// <summary>
/// 请求JSON
/// </summary>
public static string reqJson = string.Empty;
/// <summary>
/// 反馈JSON
/// </summary>
public static string retJson = string.Empty;
#endregion
/// <summary>
/// 测试--WCS任务取消
/// </summary>
/// <returns></returns>
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;
}
/// <summary>
/// WCS任务取消(通用)
/// add 修改人:yy 修改时间:2024年3月7日 原因/内容:重新修改返回流程
/// </summary>
public static void WCS_CANCELTASK()
{
try
{
IO_CONTROL model = new IO_CONTROL();
List<IO_CONTROL> modelList = new List<IO_CONTROL>();
IO_CONTROL_APPLY caModle = new IO_CONTROL_APPLY();
IO_INTERFACE_TASK_LOG ItlModel = new IO_INTERFACE_TASK_LOG();
List<IO_CONTROL_APPLY> acModelList = new List<IO_CONTROL_APPLY>();
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);
}
}
}
}