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

146 lines
6.5 KiB

using Newtonsoft.Json;
using System;
using XS_Model;
using XS_DAL;
namespace XS_BLL
{
/// <summary>
/// WMS任务取消(通用)
/// </summary>
public class WMS_CANCELTASK_BLL
{
#region 全局参数
/// <summary>
/// 接口名称,接口日志文件名
/// </summary>
public static string InterfaceName = "WCS_CANCELTASK";
/// <summary>
/// 接口描述
/// </summary>
public static string InterfaceNote = "WMS任务取消(通用)";
/// <summary>
/// 接口流向
/// </summary>
public static string InterfaceFlow = "WMS==>>WCS";
/// <summary>
/// 反馈JSON
/// </summary>
public static string retJson = string.Empty;
#endregion
/// <summary>
/// WMS任务取消(通用)
/// </summary>
/// <param name="recieveBuffer"></param>
/// <returns></returns>
public static string CANCELTASK(string recieveBuffer)
{
IO_CONTROL model = new IO_CONTROL();
try
{
if (!string.IsNullOrEmpty(recieveBuffer))
{
string retEx = string.Empty;
string msg = string.Empty;
IO_INTERFACE_TASK_LOG TASK_LOG = JsonConvert.DeserializeObject<IO_INTERFACE_TASK_LOG>(recieveBuffer);
TASK_LOG.f_startTime = DateTime.Now;
#region add 修改人:yy 修改时间:2024年3月8日 原因/内容:
string dataVerify = string.Empty;
if (string.IsNullOrEmpty(TASK_LOG.taskId.ToString()))
{
dataVerify += "接口任务编码不能为空;";
}
if (string.IsNullOrEmpty(TASK_LOG.taskNo))
{
dataVerify += "任务号不能为空;";
}
if (string.IsNullOrEmpty(TASK_LOG.subTaskNo))
{
dataVerify += "子任务号不能为空;";
}
if (string.IsNullOrEmpty(TASK_LOG.taskDescr))
{
//dataVerify += "任务描述不能为空";
}
if (string.IsNullOrEmpty(TASK_LOG.cancelledTime.ToString()))
{
dataVerify += "取消任务时间不能为空;";
}
#endregion
//数据验证是否存在异常
if (string.IsNullOrEmpty(dataVerify))
{
#region 数据验证
if (string.IsNullOrEmpty(TASK_LOG.taskNo.ToString()))
{
retEx = "任务号不能为空!!!";
}
#endregion 数据验证
if (string.IsNullOrEmpty(retEx))
{
int icNum = model.GetModelList("(CONTROL_STATUS = 0 or CONTROL_STATUS = 900 ) and CONTROL_ID = '" + TASK_LOG.taskNo + "' ").Count;
//tsNum 是否有相同任务,为启动的任务
if (icNum > 0)
{
bool bl = model.Delete("(CONTROL_STATUS = 0 or CONTROL_STATUS = 900 ) and CONTROL_ID = '" + TASK_LOG.taskNo + "' ");
if (bl)
{
msg = "WMS任务取消成功。接口任务号:" + TASK_LOG.taskId + ",任务号:" + TASK_LOG.taskNo + ",取消任务描述:" + TASK_LOG.taskDescr + ",取消时间:" + TASK_LOG.cancelledTime + "。";
retJson = UtilityBLL.CreateJson(2, 0, true, msg);
}
else
{
msg = "WMS任务取消失败。接口任务号:" + TASK_LOG.taskId + ",任务号:" + TASK_LOG.taskNo + ",取消任务描述:" + TASK_LOG.taskDescr + ",取消时间:" + TASK_LOG.cancelledTime + "。";
//retJson = UtilityBLL.CreateJson(1, "1", false, retEx);
retJson = UtilityBLL.CreateJson(2, 1, false, msg);
}
}
else
{
msg += "未查询到相关任务!接口任务号:" + TASK_LOG.taskId + ",任务号:" + TASK_LOG.taskNo + ",取消任务描述:" + TASK_LOG.taskDescr + ",取消时间:" + TASK_LOG.cancelledTime + "。";
retJson = UtilityBLL.CreateJson(2, 1, false, msg);
}
}
else
{
msg += retEx + "接口任务号:" + TASK_LOG.taskId + ",任务号:" + TASK_LOG.taskNo + ",取消任务描述:" + TASK_LOG.taskDescr + ",取消时间:" + TASK_LOG.cancelledTime + "。";
retJson = UtilityBLL.CreateJson(2, 1, false, msg);
}
//添加任务记录
bool bl2 = TASK_LOG.Insert();
}
else
{
retJson = UtilityBLL.CreateJson(2, 1, false, dataVerify);
}
}
else
{
retJson = UtilityBLL.CreateJson(2, 1, false, "数据不能为空。。。");
}
UtilityBLL.CreateINTERFACE_LOG(InterfaceName, InterfaceFlow, recieveBuffer, retJson, InterfaceNote);
return retJson;
}
catch (Exception ex)
{
//retJson = UtilityBLL.CreateJson(1, "1", false, "异常信息:" + ex.Message);
retJson = UtilityBLL.CreateJson(2, 1, false, "异常信息:" + ex.Message);
new DisplaySet().ErrorAddListBoxItem("VISION_RELEASE", ex.Message);
//new DisplaySet().AddListBoxItem("VISION_RELEASE", ex.Message);
UtilityBLL.CreateINTERFACE_LOG(InterfaceName, InterfaceFlow, recieveBuffer, retJson + ex.Message, InterfaceNote);
LogHelper.ErrorLog(ex);
return retJson;
}
}
}
}