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.
143 lines
5.1 KiB
143 lines
5.1 KiB
using Newtonsoft.Json;
|
|
using Newtonsoft.Json.Linq;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using XS_DAL;
|
|
using XS_Model;
|
|
|
|
namespace XS_BLL
|
|
{
|
|
public class FAULTREPORT_BLL
|
|
{
|
|
#region 全局参数
|
|
/// <summary>
|
|
/// 接口地址,请求路径
|
|
/// </summary>
|
|
//public static string InterfaceAdd = Global.upper_WMSURL + "api/wcs/stack/inboundRoadwayApply";//请求路径 //BarCodeApply
|
|
public static string InterfaceAdd = Global.upper_WMSURL + "FAULTREPORT";//请求路径 //BarCodeApply
|
|
/// <summary>
|
|
/// 接口名称,接口日志文件名
|
|
/// </summary>
|
|
public static string InterfaceName = "FAULTREPORT";
|
|
/// <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>
|
|
public static void FAULTREPORT()
|
|
{
|
|
IO_CONTROL_APPLY model = new IO_CONTROL_APPLY();
|
|
List<IO_CONTROL_APPLY> modelList = new List<IO_CONTROL_APPLY>();
|
|
//入库库位端口
|
|
int[] port = new int[] { 12012, 12005 };
|
|
//acModelList = model.GetModelList(" taskflag=4 and CONTROL_STATUS = 999 and END_DEVICE_CODE in(" + string.Join(",", port) + ")");
|
|
modelList = model.GetModelList(" APPLY_TASK_STATUS = 0 and CONTROL_APPLY_TYPE = 20 ");//20 设备异常上报
|
|
try
|
|
{
|
|
//item.CONTROL_REMARK = item.MANAGE_ID.ToString();
|
|
//taskflag==7入库口扫码报警回传 正常任务在入库巷道申请里面处理
|
|
if (modelList.Count > 0)
|
|
{
|
|
|
|
|
|
string CONTROL_APPLY_ID = string.Empty;
|
|
List<errorlistModel> errList = new List<errorlistModel>();
|
|
|
|
foreach (var item in modelList)
|
|
{
|
|
errorlistModel em = new errorlistModel();
|
|
em.DEVICE_CODE = item.DEVICE_CODE;
|
|
em.CONTROL_ERROR_TEXT = item.CONTROL_ERROR_TEXT;
|
|
errList.Add(em);
|
|
|
|
CONTROL_APPLY_ID += item.CONTROL_APPLY_ID.ToString() + ",";
|
|
}
|
|
|
|
reqJson = JsonConvert.SerializeObject(new { errorlist = errList });
|
|
|
|
|
|
|
|
retJson = HttpHelper.PostJson(InterfaceAdd, reqJson);
|
|
string retSuccess = UtilityBLL.GetReceiveValues(retJson, "success");
|
|
|
|
string code = UtilityBLL.GetReceiveValues(retJson, "success");
|
|
if (code == "True")
|
|
{
|
|
bool bl = model.Update(" APPLY_TASK_STATUS = 1 ", " CONTROL_APPLY_ID in (" + CONTROL_APPLY_ID.TrimEnd(',') + ")");
|
|
//bool bl = model.Delete(" CONTROL_ID in (" + CONTROL_APPLY_ID.Trim('.') + ")");
|
|
}
|
|
#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);
|
|
}
|
|
}
|
|
|
|
public static string response_FAULTREPORT()
|
|
{
|
|
string json = JsonConvert.SerializeObject(new
|
|
{
|
|
code = 0, //调试时自行约定,只要类型对应接口,后面不做说明
|
|
success = true, // 当为false的时候,则不用进入到分拨的线体,直行到异常线体口
|
|
|
|
});
|
|
|
|
#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 class errorlistModel
|
|
{
|
|
/// <summary>
|
|
/// 设备号
|
|
/// </summary>
|
|
public string DEVICE_CODE { get; set; }
|
|
/// <summary>
|
|
/// 异常描述
|
|
/// </summary>
|
|
public string CONTROL_ERROR_TEXT { get; set; }
|
|
}
|
|
}
|
|
|
|
}
|