济宁李尔接口
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.

136 lines
5.6 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>
/// WCS取消任务接口
/// </summary>
public class WCS_TASK_CANCEL_BLL
{
public static string Wcs_task_cancel(string recieveJson)
{
try
{
JObject objMis = new JObject();
objMis.Add(new JProperty("method", "wcs_task_cancel"));
objMis.Add(new JProperty("timestamp", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")));
JObject objDate = new JObject();
objDate.Add(new JProperty("code", "00"));
objDate.Add(new JProperty("msg", "WCS取消任务成功"));
objDate.Add(new JProperty("taskId", "123461"));
objMis.Add(new JProperty("data", objDate));
string retjson = JsonConvert.DeserializeObject(objMis.ToString()).ToString();
LogHelper.LogOperation("wcs_task_cancel", recieveJson, retjson);
new DisplaySet().AddListBoxItem("", "");
new DisplaySet().AddListBoxItem("接收:", recieveJson);
new DisplaySet().AddListBoxItem("反馈:", retjson);
return retjson;
}
catch (Exception ex)
{
new DisplaySet().AddListBoxItem("wcs_task_cancel", ex.Message);
LogHelper.LogOperation("wcs_task_cancel", recieveJson, ex.Message);
T_RESULT rModdel = new T_RESULT();
rModdel.code = "01";
rModdel.msg = ex.Message;
rModdel.taskId = "";
return JsonConvert.SerializeObject(rModdel);
}
}
/// <summary>
/// WCS取消任务接口
/// </summary>
public static void Wcs_task_cancel()
{
string reqJson = string.Empty;
IO_INTERFACE IModel = new IO_INTERFACE();
try
{
List<IO_CONTROL> modelList = new List<IO_CONTROL>();
IO_CONTROL model = new IO_CONTROL();
modelList = model.GetModelList(" CONTROL_STATUS in(900,980) ");
foreach (var item in modelList)
{
#region json
JObject objMis = new JObject();
objMis.Add(new JProperty("method", "wcs_task_cancel"));
objMis.Add(new JProperty("timestamp", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")));
JObject objDate = new JObject();
objDate.Add(new JProperty("taskId", Convert.ToInt32(item.CONTROL_ID)));
objDate.Add(new JProperty("containerCode", item.STOCK_BARCODE));
objMis.Add(new JProperty("data", objDate));
#endregion
reqJson = JsonConvert.DeserializeObject(objMis.ToString()).ToString();
string retJson = HttpHelper.PostJson(Global.upper_WMSURL, reqJson);
string code = UtilityBLL.GetReceiveValues(retJson, "data,code");
#region 接口日志记录
IModel = new IO_INTERFACE();
//IModel.INTERFACE_ID = "";
IModel.INTERFACE_NAME = "wcs_task_cancel";
IModel.INTERFACE_FLOW = "WCS==>>WMS";
IModel.INTERFACE_REQUEST = reqJson;
IModel.INTERFACE_FEEDBACK = retJson;
IModel.INTERFACE_DATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
IModel.INTERFACE_MENO = "";
IModel.Insert();
#endregion 接口日志记录
LogHelper.LogOperation("wcs_task_cancel", reqJson, retJson);
if (code == "00")
{
if (item.CONTROL_STATUS == 990)
{
model.Delete(" CONTROL_STATUS = 990 and CONTROL_ID = '" + item.CONTROL_ID + "'");
}
if (item.CONTROL_STATUS == 980)
{
model.Delete(" CONTROL_STATUS = 980 and CONTROL_ID = '" + item.CONTROL_ID + "'");
}
if (item.CONTROL_STATUS == 900)
{
model.Delete(" CONTROL_STATUS = 900 and CONTROL_ID = '" + item.CONTROL_ID + "'");
}
}
if (Global.checkBox1 == 1)
{
new DisplaySet().AddListBoxItem("", "");
new DisplaySet().AddListBoxItem("任务取消请求:", reqJson);
new DisplaySet().AddListBoxItem("反馈:", retJson);
}
}
}
catch (Exception ex)
{
new DisplaySet().ErrorAddListBoxItem("wcs_task_cancel", ex.Message);
new DisplaySet().AddListBoxItem("wcs_task_cancel", ex.Message);
#region 接口日志记录
//IModel.INTERFACE_ID = "";
IModel.INTERFACE_NAME = "wcs_task_cancel";
IModel.INTERFACE_FLOW = "WCS==>>WMS";
IModel.INTERFACE_REQUEST = reqJson;
IModel.INTERFACE_FEEDBACK = ex.Message;
IModel.INTERFACE_DATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
IModel.INTERFACE_MENO = "";
IModel.Insert();
LogHelper.ErrorLog(ex);
#endregion 接口日志记录
}
}
}
}