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.
147 lines
5.5 KiB
147 lines
5.5 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 PALLET_EMPTY_BLL
|
|
{
|
|
#region 全局参数
|
|
/// <summary>
|
|
/// 接口地址,请求路径
|
|
/// </summary>
|
|
//public static string InterfaceAdd = Global.upper_WMSURL + "api/wcs/container/emptyCall";//请求路径 emptyCall
|
|
public static string InterfaceAdd = Global.upper_WMSURL + "emptyCall";//请求路径 emptyCall
|
|
/// <summary>
|
|
/// 接口名称,接口日志文件名
|
|
/// </summary>
|
|
public static string InterfaceName = "emptyCall";
|
|
/// <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_PALLET_EMPTY()
|
|
{
|
|
string json = JsonConvert.SerializeObject(new
|
|
{
|
|
code = 0, //调试时自行约定,只要类型对应接口,后面不做说明
|
|
success = true, // 当为false的时候,则不用进入到分拨的线体,直行到异常线体口
|
|
msg = "", //"XXX数据,成功接收"
|
|
//data = new
|
|
//{
|
|
// taskNo = 123456, // 任务号
|
|
// containerCode = "T10002", //托盘条码
|
|
// qty = 10 //数量
|
|
//}
|
|
});
|
|
#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();
|
|
//objDate.Add(new JProperty("taskNo", 369258));//任务号
|
|
//objDate.Add(new JProperty("containerCode", "T10008"));//托盘条码
|
|
//objDate.Add(new JProperty("qty", 10));//数量
|
|
|
|
//objMis.Add(new JProperty("data", objDate));
|
|
json = JsonConvert.DeserializeObject(objMis.ToString()).ToString();
|
|
|
|
#endregion
|
|
return json;
|
|
}
|
|
/// <summary>
|
|
/// 托盘组申请
|
|
/// </summary>
|
|
public static void PALLET_EMPTY()
|
|
{
|
|
IO_CONTROL model = new IO_CONTROL();
|
|
IO_CONTROL_APPLY caModle = new IO_CONTROL_APPLY();
|
|
List<IO_CONTROL_APPLY> acModelList = new List<IO_CONTROL_APPLY>();
|
|
int[] port = new int[] { 12009 };
|
|
acModelList = caModle.GetModelList(" APPLY_TASK_STATUS = 0 and CONTROL_APPLY_TYPE = 3 and DEVICE_CODE in(" + string.Join(",", port) + ")");
|
|
foreach (var item in acModelList)
|
|
{
|
|
|
|
try
|
|
{
|
|
#region reqJson
|
|
JObject objMis = new JObject();
|
|
objMis.Add(new JProperty("taskId", DateTime.Now.ToString("yyyyMMddHHmmss")));//接口交互 任务号
|
|
objMis.Add(new JProperty("taskNo", ""));//任务主键
|
|
objMis.Add(new JProperty("subTaskNo", ""));//任务主键
|
|
objMis.Add(new JProperty("pointCode", item.DEVICE_CODE));//申请空托盘位置
|
|
#endregion
|
|
reqJson = JsonConvert.DeserializeObject(objMis.ToString()).ToString();
|
|
retJson = HttpHelper.PostJson(InterfaceAdd, reqJson);
|
|
string retdata = UtilityBLL.GetReceiveValues(retJson, "success");
|
|
|
|
///注:条码重复处理
|
|
string retEx = string.Empty;
|
|
if (retdata == "True")
|
|
{
|
|
caModle.Update(" APPLY_TASK_STATUS = 1 ", " CONTROL_APPLY_ID = " + item.CONTROL_APPLY_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, retJson + ex.Message, InterfaceNote);
|
|
LogHelper.ErrorLog(ex);
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 码垛完成上报 返回实体类
|
|
/// </summary>
|
|
public class PALLET_EMPTY_MODEL
|
|
{
|
|
/// <summary>
|
|
/// 任务号
|
|
/// </summary>
|
|
public int taskNo { get; set; }
|
|
/// <summary>
|
|
/// 托盘条码
|
|
/// </summary>
|
|
public string containerCode { get; set; }
|
|
/// <summary>
|
|
/// 数量
|
|
/// </summary>
|
|
public int qty { get; set; }
|
|
}
|
|
}
|
|
}
|