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.
171 lines
6.8 KiB
171 lines
6.8 KiB
using DBModel;
|
|
using Newtonsoft.Json;
|
|
using Newtonsoft.Json.Linq;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using XS_DAL;
|
|
using XS_Model;
|
|
|
|
namespace XS_BLL
|
|
{
|
|
/// <summary>
|
|
/// WMS取消任务接口
|
|
/// </summary>
|
|
public class WMS_REQUEST_CANCEL_BLL
|
|
{
|
|
public static string Wms_request_cancel(string recieveJson)
|
|
{
|
|
string data = UtilityBLL.GetReceiveValues(recieveJson, "data");
|
|
|
|
List<T_RESULT> rModelList = new List<T_RESULT>();
|
|
|
|
try
|
|
{
|
|
List<wms_request_out_Model> modelList = UtilityBLL.GetReceiveValuesList<wms_request_out_Model>(recieveJson, "data");
|
|
for (int i = 0; i < modelList.Count; i++)
|
|
{
|
|
IO_CONTROL model = new IO_CONTROL();
|
|
T_RESULT rModdel = new T_RESULT();
|
|
#region 数据验证
|
|
if (string.IsNullOrEmpty(modelList[i].taskId))
|
|
{
|
|
rModdel.code = "01";
|
|
rModdel.msg = "任务号不能为空!!!";
|
|
rModdel.taskId = modelList[i].taskId;
|
|
rModelList.Add(rModdel);
|
|
continue;
|
|
}
|
|
if (string.IsNullOrEmpty(modelList[i].containerCode))
|
|
{
|
|
rModdel.code = "01";
|
|
rModdel.msg = "容器号不能为空!!!";
|
|
rModdel.taskId = modelList[i].containerCode;
|
|
rModelList.Add(rModdel);
|
|
continue;
|
|
}
|
|
#endregion 数据验证
|
|
#region 数据赋值
|
|
model.CONTROL_STATUS = 0;
|
|
#endregion 数据赋值
|
|
int rows = model.GetTable(" (CONTROL_STATUS = 0 || CONTROL_STATUS = 900 )and CONTROL_ID = " + modelList[i].taskId + " and STOCK_BARCODE = '" + modelList[i].containerCode + "' ").Rows.Count;
|
|
//是否已存在该托盘或任务号未执行的任务
|
|
if (rows > 0)
|
|
{
|
|
if (model.Delete(" CONTROL_ID = " + modelList[i].taskId + " and STOCK_BARCODE = '" + modelList[i].containerCode + "' "))
|
|
{
|
|
rModdel.code = "00";
|
|
rModdel.msg = "WCS接收删除任务成功。";
|
|
rModdel.taskId = modelList[i].taskId;
|
|
rModelList.Add(rModdel);
|
|
continue;
|
|
}
|
|
else
|
|
{
|
|
rModdel.code = "01";
|
|
rModdel.msg = "WCS接收删除任务失败。";
|
|
rModdel.taskId = modelList[i].taskId;
|
|
rModelList.Add(rModdel);
|
|
continue;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
rows = model.GetTable(" CONTROL_ID = " + modelList[i].taskId + " ").Rows.Count;
|
|
if (rows <= 0)
|
|
{
|
|
rModdel.code = "01";
|
|
rModdel.msg = "00;WCS未找到该任务。。。";
|
|
rModdel.taskId = modelList[i].taskId;
|
|
rModelList.Add(rModdel);
|
|
continue;
|
|
}
|
|
else
|
|
{
|
|
rModdel.code = "01";
|
|
rModdel.msg = "09;WCS已存在该条码/任务号未完成任务。";
|
|
rModdel.taskId = modelList[i].taskId;
|
|
rModelList.Add(rModdel);
|
|
continue;
|
|
}
|
|
}
|
|
}
|
|
string retJSON = JsonConvert.SerializeObject(
|
|
new
|
|
{
|
|
method = "wms_request_cancel",
|
|
timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
|
|
data = rModelList
|
|
});
|
|
#region 接口日志记录
|
|
IO_INTERFACE IModel = new IO_INTERFACE();
|
|
//IModel.INTERFACE_ID = "";
|
|
IModel.INTERFACE_NAME = "wms_request_cancel";
|
|
IModel.INTERFACE_FLOW = "WMS==>>WCS";
|
|
IModel.INTERFACE_REQUEST = recieveJson;
|
|
IModel.INTERFACE_FEEDBACK = retJSON;
|
|
IModel.INTERFACE_DATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
IModel.INTERFACE_MENO = "";
|
|
|
|
IModel.Insert();
|
|
#endregion 接口日志记录
|
|
LogHelper.LogOperation("wms_request_cancel", recieveJson, retJSON);
|
|
new DisplaySet().AddListBoxItem("", "");
|
|
new DisplaySet().AddListBoxItem("WMS取消任务接收:", recieveJson);
|
|
new DisplaySet().AddListBoxItem("反馈:", retJSON);
|
|
return retJSON;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
new DisplaySet().ErrorAddListBoxItem("wms_request_cancel", ex.Message);
|
|
new DisplaySet().AddListBoxItem("wms_request_cancel", ex.Message);
|
|
T_RESULT rModdel = new T_RESULT();
|
|
rModdel.code = "01";
|
|
rModdel.msg = ex.Message;
|
|
rModdel.taskId = "";
|
|
rModelList.Add(rModdel);
|
|
string retJSON = JsonConvert.SerializeObject(
|
|
new
|
|
{
|
|
method = "wms_request_cancel",
|
|
timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
|
|
data = rModelList
|
|
});
|
|
return retJSON;
|
|
}
|
|
}
|
|
|
|
public class wms_request_out_Model
|
|
{
|
|
/// <summary>
|
|
/// 任务号
|
|
/// </summary>
|
|
public String taskId { get; set; }
|
|
|
|
/// <summary>
|
|
/// 容器号
|
|
/// </summary>
|
|
public String containerCode { get; set; }
|
|
|
|
/// <summary>
|
|
/// 巷道号(18001-18004)
|
|
/// </summary>
|
|
public String bankId { get; set; }
|
|
|
|
/// <summary>
|
|
/// 货位地址(如01-03-03)
|
|
/// </summary>
|
|
public String sourceAddress { get; set; }
|
|
|
|
/// <summary>
|
|
/// 目标出库输送机编号
|
|
/// </summary>
|
|
public double? targetAddress { get; set; }
|
|
|
|
/// <summary>
|
|
/// 优先级 0-10 数字越大,优先级越高
|
|
/// </summary>
|
|
public String tasklevel { get; set; }
|
|
|
|
}
|
|
}
|
|
}
|