安睿特接口
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.

125 lines
4.9 KiB

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
{
/// <summary>
/// 上架/下架确认
/// </summary>
public class STACK_INBOUNDCONFIRM_BLL
{
#region 全局参数
/// <summary>
/// 接口地址,请求路径
/// </summary>
public static string InterfaceAdd = Global.upper_WMSURL + "stack/inboundConfirm";//请求路径
/// <summary>
/// 接口名称,接口日志文件名
/// </summary>
public static string InterfaceName = "STACK_INBOUNDCONFIRM";
/// <summary>
/// 接口描述
/// </summary>
public static string InterfaceNote = "上架/下架确认";
/// <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>
/// 测试 --上架/下架确认
/// </summary>
/// <returns></returns>
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;
}
/// <summary>
/// 上架/下架确认
/// </summary>
public static void STACK_INBOUNDCONFIRM()
{
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>();
//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);
}
}
}
}