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.
2416 lines
87 KiB
2416 lines
87 KiB
3 months ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
using System.Text;
|
||
|
using System.ServiceModel;
|
||
|
using System.Data;
|
||
|
using System.Collections;
|
||
|
//using System.Web.Script.Serialization;
|
||
|
using System.Text.RegularExpressions;
|
||
|
using CommonLib;
|
||
|
using System.Threading;
|
||
|
using DBFactory;
|
||
|
using ICommLayer;
|
||
|
using CommLayerFactory;
|
||
|
//using System.Security;
|
||
|
using System.Security.Cryptography;
|
||
|
using System.Web;
|
||
|
using System.Net;
|
||
|
using System.IO;
|
||
|
using System.Xml.Serialization;
|
||
|
using Newtonsoft.Json;
|
||
|
|
||
|
|
||
|
namespace WcfControlMonitorLib
|
||
|
{
|
||
|
public class CCallService
|
||
|
{
|
||
|
|
||
|
public class WMS_WCS_PARAM_OUT_MOVE
|
||
|
{
|
||
|
public string groupid { get; set; }//任务组号
|
||
|
public string msgTime { get; set; }//下发时间
|
||
|
public string externalOrderNo { get; set; }//业务单号
|
||
|
public string region { get; set; }//出库的库位组
|
||
|
public int priority { get; set; }// 优先级
|
||
|
public List<OUT_MOVE_DATA> tasks { get; set; }
|
||
|
//检查参数是否缺失
|
||
|
public bool CheckParamNotNull(out string error)
|
||
|
{
|
||
|
|
||
|
StringBuilder message = new StringBuilder();
|
||
|
if (groupid == String.Empty)
|
||
|
{
|
||
|
message.Append("缺少groupid参数。");
|
||
|
|
||
|
}
|
||
|
if (msgTime == String.Empty)
|
||
|
{
|
||
|
message.Append("缺少msgTime参数。");
|
||
|
|
||
|
}
|
||
|
if (externalOrderNo == String.Empty)
|
||
|
{
|
||
|
message.Append("缺少externalOrderNo参数。");
|
||
|
|
||
|
}
|
||
|
if (region == String.Empty)
|
||
|
{
|
||
|
message.Append("缺少region参数。");
|
||
|
|
||
|
}
|
||
|
//if (priority == String.Empty)
|
||
|
//{
|
||
|
// message.Append("缺少timestamp参数。");
|
||
|
|
||
|
//}
|
||
|
if (tasks == null||tasks.Count==0)
|
||
|
{
|
||
|
message.Append("缺少tasks参数。");
|
||
|
|
||
|
}
|
||
|
|
||
|
error = message.ToString();
|
||
|
|
||
|
if (message.Length == 0)
|
||
|
{
|
||
|
return true;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
public class WCS_WMS_PARAM_OUT_MOVE
|
||
|
{
|
||
|
public string method { get; set; }
|
||
|
//public string client_customerid { get; set; }
|
||
|
//public string client_db { get; set; }
|
||
|
//public string messageid { get; set; }
|
||
|
//public string apptoken { get; set; }
|
||
|
//public string appkey { get; set; }
|
||
|
//public string sign { get; set; }
|
||
|
public string timestamp { get; set; }
|
||
|
|
||
|
//public object data { get; set; } // //dzf 出库和移库
|
||
|
public List<OUT_MOVE_RES> data { get; set; }
|
||
|
|
||
|
//public WCS_WMS_PARAM()
|
||
|
//{
|
||
|
// method = "";
|
||
|
// //client_customerid = "aa";
|
||
|
// //client_db = " ";
|
||
|
// //messageid = "";
|
||
|
// //apptoken = "";
|
||
|
// //appkey = "";
|
||
|
// //sign = "";
|
||
|
// timestamp = "";
|
||
|
// data = new object();
|
||
|
//}
|
||
|
|
||
|
//public static string MD5Encrypt64(string data)
|
||
|
//{
|
||
|
// MD5 md5 = new MD5CryptoServiceProvider();
|
||
|
// Encoding utf8 = Encoding.UTF8;
|
||
|
// string sign2 = HttpUtility.UrlEncode((Convert.ToBase64String(md5.ComputeHash(Encoding.Default.GetBytes(appSecret + data + appSecret)))).ToUpper(), utf8);
|
||
|
// return sign2;
|
||
|
//}
|
||
|
|
||
|
//检查参数是否缺失
|
||
|
public bool CheckParamNotNull(out string error)
|
||
|
{
|
||
|
|
||
|
StringBuilder message = new StringBuilder();
|
||
|
if (method == String.Empty)
|
||
|
{
|
||
|
message.Append("缺少method参数。");
|
||
|
|
||
|
}
|
||
|
//if (client_customerid == String.Empty)
|
||
|
//{
|
||
|
// message.Append("缺少client_customerid参数。");
|
||
|
|
||
|
//}
|
||
|
//if (client_db == String.Empty)
|
||
|
//{
|
||
|
// message.Append("缺少client_db参数。");
|
||
|
|
||
|
//}
|
||
|
//if (messageid == String.Empty)
|
||
|
//{
|
||
|
// message.Append("缺少messageid参数。");
|
||
|
|
||
|
//}
|
||
|
//if (apptoken == String.Empty)
|
||
|
//{
|
||
|
// message.Append("缺少apptoken参数。");
|
||
|
|
||
|
//}
|
||
|
//if (appkey == String.Empty)
|
||
|
//{
|
||
|
// message.Append("缺少appkey参数。");
|
||
|
|
||
|
//}
|
||
|
//if (sign == String.Empty)
|
||
|
//{
|
||
|
// message.Append("缺少sign参数。");
|
||
|
|
||
|
//}
|
||
|
if (timestamp == String.Empty)
|
||
|
{
|
||
|
message.Append("缺少timestamp参数。");
|
||
|
|
||
|
}
|
||
|
if (data == null)
|
||
|
{
|
||
|
message.Append("缺少data参数。");
|
||
|
|
||
|
}
|
||
|
|
||
|
error = message.ToString();
|
||
|
|
||
|
if (message.Length == 0)
|
||
|
{
|
||
|
return true;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
#region OUT_MOVE_DATA 下发任务 山东时代
|
||
|
public class OUT_MOVE_DATA
|
||
|
//JSON格式业务数据
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// 任务ID
|
||
|
/// </summary>
|
||
|
public string taskId { get; set; }
|
||
|
/// <summary>
|
||
|
/// 业务单号
|
||
|
/// </summary>
|
||
|
public string externalOrderNo { get; set; }
|
||
|
/// <summary>
|
||
|
/// 任务类型 1.入库,2:出库,3:移库,4.越库?
|
||
|
/// </summary>
|
||
|
public int taskType { get; set; }
|
||
|
/// <summary>
|
||
|
/// 任务起点
|
||
|
/// </summary>
|
||
|
public string startNode { get; set; }
|
||
|
/// <summary>
|
||
|
/// 起始巷道
|
||
|
/// </summary>
|
||
|
public string startLaneway { get; set; }
|
||
|
/// <summary>
|
||
|
/// 起始排
|
||
|
/// </summary>
|
||
|
public int startRow { get; set; }
|
||
|
/// <summary>
|
||
|
/// 起始列
|
||
|
/// </summary>
|
||
|
public int startColumn { get; set; }
|
||
|
/// <summary>
|
||
|
/// 起始层
|
||
|
/// </summary>
|
||
|
public int startLayer { get; set; }
|
||
|
/// <summary>
|
||
|
/// 起始深度
|
||
|
/// </summary>
|
||
|
public int startDepth { get; set; }
|
||
|
/// <summary>
|
||
|
/// 任务终点
|
||
|
/// </summary>
|
||
|
public string endNode { get; set; }
|
||
|
/// <summary>
|
||
|
/// 目标巷道
|
||
|
/// </summary>
|
||
|
public string endLaneway { get; set; }
|
||
|
/// <summary>
|
||
|
/// 目标排
|
||
|
/// </summary>
|
||
|
public int endRow { get; set; }
|
||
|
/// <summary>
|
||
|
/// 目标列
|
||
|
/// </summary>
|
||
|
public int endColumn { get; set; }
|
||
|
/// <summary>
|
||
|
/// 目标层
|
||
|
/// </summary>
|
||
|
public int endLayer { get; set; }
|
||
|
/// <summary>
|
||
|
/// 目标深度
|
||
|
/// </summary>
|
||
|
public int endDepth { get; set; }
|
||
|
/// <summary>
|
||
|
/// 目标库位组
|
||
|
/// </summary>
|
||
|
public string endGroup { get; set; }
|
||
|
/// <summary>
|
||
|
//拆包间编码
|
||
|
/// </summary>
|
||
|
public string unpackingRomCode { get; set; }
|
||
|
/// <summary>
|
||
|
/// 拆包间库位编码
|
||
|
/// </summary>
|
||
|
public string unpackingRomWhLocationCode { get; set; }
|
||
|
/// <summary>
|
||
|
/// 搬运类型
|
||
|
/// </summary>
|
||
|
public int carryType { get; set; }
|
||
|
/// <summary>
|
||
|
/// 容器编码
|
||
|
/// </summary>
|
||
|
public string containerCode { get; set; }
|
||
|
/// <summary>
|
||
|
/// 物料编码
|
||
|
/// </summary>
|
||
|
public string materialCode { get; set; }
|
||
|
/// <summary>
|
||
|
/// 物料名称
|
||
|
/// </summary>
|
||
|
public string materialName { get; set; }
|
||
|
/// <summary>
|
||
|
/// 物料类型
|
||
|
/// </summary>
|
||
|
public string materialType { get; set; }
|
||
|
/// <summary>
|
||
|
/// 批次号
|
||
|
/// </summary>
|
||
|
public string batchNo { get; set; }
|
||
|
/// <summary>
|
||
|
/// 宽度
|
||
|
/// </summary>
|
||
|
public string referTag { get; set; }
|
||
|
/// <summary>
|
||
|
/// 供应商批次号
|
||
|
/// </summary>
|
||
|
public string supplierBatch { get; set; }
|
||
|
/// <summary>
|
||
|
/// 载具尺寸
|
||
|
/// </summary>
|
||
|
public string containerSize { get; set; }
|
||
|
/// <summary>
|
||
|
/// 数量
|
||
|
/// </summary>
|
||
|
public double qty { get; set; }
|
||
|
/// <summary>
|
||
|
/// 贴纸信息
|
||
|
/// </summary>
|
||
|
public List<LCS_lotInfo> lotInfo { get; set; }
|
||
|
}
|
||
|
public class LCS_lotInfo {
|
||
|
/// <summary>
|
||
|
/// 贴纸编号
|
||
|
/// </summary>
|
||
|
public string lotID { get; set; }
|
||
|
/// <summary>
|
||
|
/// 物料编码
|
||
|
/// </summary>
|
||
|
public string MaterialCode { get; set; }
|
||
|
/// <summary>
|
||
|
/// 物料名称
|
||
|
/// </summary>
|
||
|
public string MaterialName { get; set; }
|
||
|
/// <summary>
|
||
|
/// 批次号
|
||
|
/// </summary>
|
||
|
public string batchNo { get; set; }
|
||
|
/// <summary>
|
||
|
/// 宽度
|
||
|
/// </summary>
|
||
|
public string referTag { get; set; }
|
||
|
/// <summary>
|
||
|
/// 供应商批次号
|
||
|
/// </summary>
|
||
|
public string supplierBatchNo { get; set; }
|
||
|
/// <summary>
|
||
|
/// 数量
|
||
|
/// </summary>
|
||
|
public double qty { get; set; }
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
#region OUT_MOVE_RES 出库返回 山东时代
|
||
|
|
||
|
public class OUT_MOVE_RES //JSON格式业务数据
|
||
|
{
|
||
|
public int code { get; set; }//处理状态。0,成功,1异常
|
||
|
public string msg { get; set; }//返回消息
|
||
|
public string data { get; set; }
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
|
||
|
#region//test stackstatus
|
||
|
public class WMS_WCS_111
|
||
|
{
|
||
|
public string method { get; set; }
|
||
|
//public string client_customerid { get; set; }
|
||
|
//public string client_db { get; set; }
|
||
|
//public string messageid { get; set; }
|
||
|
//public string apptoken { get; set; }
|
||
|
//public string appkey { get; set; }
|
||
|
//public string sign { get; set; }
|
||
|
public string timestamp { get; set; }
|
||
|
|
||
|
//public object data { get; set; } //需要根据method进行类型转换
|
||
|
public List<STATUS_111> data { get; set; }
|
||
|
|
||
|
|
||
|
//检查参数是否缺失
|
||
|
public bool CheckParamNotNull(out string error)
|
||
|
{
|
||
|
|
||
|
StringBuilder message = new StringBuilder();
|
||
|
if (method == String.Empty)
|
||
|
{
|
||
|
message.Append("缺少method参数。");
|
||
|
|
||
|
}
|
||
|
//if (client_customerid == String.Empty)
|
||
|
//{
|
||
|
// message.Append("缺少client_customerid参数。");
|
||
|
|
||
|
//}
|
||
|
//if (client_db == String.Empty)
|
||
|
//{
|
||
|
// message.Append("缺少client_db参数。");
|
||
|
|
||
|
//}
|
||
|
//if (messageid == String.Empty)
|
||
|
//{
|
||
|
// message.Append("缺少messageid参数。");
|
||
|
|
||
|
//}
|
||
|
//if (apptoken == String.Empty)
|
||
|
//{
|
||
|
// message.Append("缺少apptoken参数。");
|
||
|
|
||
|
//}
|
||
|
//if (appkey == String.Empty)
|
||
|
//{
|
||
|
// message.Append("缺少appkey参数。");
|
||
|
|
||
|
//}
|
||
|
//if (sign == String.Empty)
|
||
|
//{
|
||
|
// message.Append("缺少sign参数。");
|
||
|
|
||
|
//}
|
||
|
if (timestamp == String.Empty)
|
||
|
{
|
||
|
message.Append("缺少timestamp参数。");
|
||
|
|
||
|
}
|
||
|
if (data == null)
|
||
|
{
|
||
|
message.Append("缺少data参数。");
|
||
|
|
||
|
}
|
||
|
|
||
|
error = message.ToString();
|
||
|
|
||
|
if (message.Length == 0)
|
||
|
{
|
||
|
return true;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//public FLUX_SYSTEM_PARAM(string[] str)
|
||
|
//{
|
||
|
// for (int i = 0; i < str.Length; i++)
|
||
|
// {
|
||
|
// if (str[i].Contains("method") == true)
|
||
|
// {
|
||
|
// this.method = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("client_customerid") == true)
|
||
|
// {
|
||
|
// this.client_customerid = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("client_db") == true)
|
||
|
// {
|
||
|
// this.client_db = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("messageid") == true)
|
||
|
// {
|
||
|
// this.messageid = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("apptoken") == true)
|
||
|
// {
|
||
|
// this.apptoken = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("appkey") == true)
|
||
|
// {
|
||
|
// this.appkey = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("sign") == true)
|
||
|
// {
|
||
|
// this.sign = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("timestamp") == true)
|
||
|
// {
|
||
|
// this.timestamp = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("data") == true)
|
||
|
// {
|
||
|
// //this.data = str[i].Split('=')[1]; //业务数据
|
||
|
// continue;
|
||
|
// }
|
||
|
// }
|
||
|
//}
|
||
|
}
|
||
|
public class WCS_WMS_111
|
||
|
{
|
||
|
public string method { get; set; }
|
||
|
//public string client_customerid { get; set; }
|
||
|
//public string client_db { get; set; }
|
||
|
//public string messageid { get; set; }
|
||
|
//public string apptoken { get; set; }
|
||
|
//public string appkey { get; set; }
|
||
|
//public string sign { get; set; }
|
||
|
public string timestamp { get; set; }
|
||
|
|
||
|
//public object data { get; set; } // //dzf 出库和移库
|
||
|
public List<OUT_MOVE_RES> data { get; set; }
|
||
|
|
||
|
//public WCS_WMS_PARAM()
|
||
|
//{
|
||
|
// method = "";
|
||
|
// //client_customerid = "aa";
|
||
|
// //client_db = " ";
|
||
|
// //messageid = "";
|
||
|
// //apptoken = "";
|
||
|
// //appkey = "";
|
||
|
// //sign = "";
|
||
|
// timestamp = "";
|
||
|
// data = new object();
|
||
|
//}
|
||
|
|
||
|
//public static string MD5Encrypt64(string data)
|
||
|
//{
|
||
|
// MD5 md5 = new MD5CryptoServiceProvider();
|
||
|
// Encoding utf8 = Encoding.UTF8;
|
||
|
// string sign2 = HttpUtility.UrlEncode((Convert.ToBase64String(md5.ComputeHash(Encoding.Default.GetBytes(appSecret + data + appSecret)))).ToUpper(), utf8);
|
||
|
// return sign2;
|
||
|
//}
|
||
|
|
||
|
//检查参数是否缺失
|
||
|
public bool CheckParamNotNull(out string error)
|
||
|
{
|
||
|
|
||
|
StringBuilder message = new StringBuilder();
|
||
|
if (method == String.Empty)
|
||
|
{
|
||
|
message.Append("缺少method参数。");
|
||
|
|
||
|
}
|
||
|
//if (client_customerid == String.Empty)
|
||
|
//{
|
||
|
// message.Append("缺少client_customerid参数。");
|
||
|
|
||
|
//}
|
||
|
//if (client_db == String.Empty)
|
||
|
//{
|
||
|
// message.Append("缺少client_db参数。");
|
||
|
|
||
|
//}
|
||
|
//if (messageid == String.Empty)
|
||
|
//{
|
||
|
// message.Append("缺少messageid参数。");
|
||
|
|
||
|
//}
|
||
|
//if (apptoken == String.Empty)
|
||
|
//{
|
||
|
// message.Append("缺少apptoken参数。");
|
||
|
|
||
|
//}
|
||
|
//if (appkey == String.Empty)
|
||
|
//{
|
||
|
// message.Append("缺少appkey参数。");
|
||
|
|
||
|
//}
|
||
|
//if (sign == String.Empty)
|
||
|
//{
|
||
|
// message.Append("缺少sign参数。");
|
||
|
|
||
|
//}
|
||
|
if (timestamp == String.Empty)
|
||
|
{
|
||
|
message.Append("缺少timestamp参数。");
|
||
|
|
||
|
}
|
||
|
if (data == null)
|
||
|
{
|
||
|
message.Append("缺少data参数。");
|
||
|
|
||
|
}
|
||
|
|
||
|
error = message.ToString();
|
||
|
|
||
|
if (message.Length == 0)
|
||
|
{
|
||
|
return true;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
#region STATUS_111 多穿设备状态
|
||
|
|
||
|
public class STATUS_111 //JSON格式业务数据
|
||
|
{
|
||
|
public string stackindex { get; set; }//任务编号(索引)
|
||
|
public string positon { get; set; }//层
|
||
|
public string battery { get; set; }//电量
|
||
|
public string laneout { get; set; }//巷道内外
|
||
|
public string runstatus { get; set; }//状态
|
||
|
}
|
||
|
#endregion
|
||
|
#endregion
|
||
|
|
||
|
|
||
|
public class WMS_WCS_PARAM_IN
|
||
|
{
|
||
|
public string method { get; set; }
|
||
|
|
||
|
public string timestamp { get; set; }
|
||
|
|
||
|
public IN_DATA data { get; set; } //需要根据method进行类型转换
|
||
|
|
||
|
|
||
|
|
||
|
//检查参数是否缺失
|
||
|
public bool CheckParamNotNull(out string error)
|
||
|
{
|
||
|
|
||
|
StringBuilder message = new StringBuilder();
|
||
|
if (method == String.Empty)
|
||
|
{
|
||
|
message.Append("缺少method参数。");
|
||
|
|
||
|
}
|
||
|
|
||
|
if (timestamp == String.Empty)
|
||
|
{
|
||
|
message.Append("缺少timestamp参数。");
|
||
|
|
||
|
}
|
||
|
if (data == null)
|
||
|
{
|
||
|
message.Append("缺少data参数。");
|
||
|
|
||
|
}
|
||
|
|
||
|
error = message.ToString();
|
||
|
|
||
|
if (message.Length == 0)
|
||
|
{
|
||
|
return true;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//public FLUX_SYSTEM_PARAM(string[] str)
|
||
|
//{
|
||
|
// for (int i = 0; i < str.Length; i++)
|
||
|
// {
|
||
|
// if (str[i].Contains("method") == true)
|
||
|
// {
|
||
|
// this.method = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("client_customerid") == true)
|
||
|
// {
|
||
|
// this.client_customerid = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("client_db") == true)
|
||
|
// {
|
||
|
// this.client_db = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("messageid") == true)
|
||
|
// {
|
||
|
// this.messageid = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("apptoken") == true)
|
||
|
// {
|
||
|
// this.apptoken = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("appkey") == true)
|
||
|
// {
|
||
|
// this.appkey = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("sign") == true)
|
||
|
// {
|
||
|
// this.sign = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("timestamp") == true)
|
||
|
// {
|
||
|
// this.timestamp = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("data") == true)
|
||
|
// {
|
||
|
// //this.data = str[i].Split('=')[1]; //业务数据
|
||
|
// continue;
|
||
|
// }
|
||
|
// }
|
||
|
//}
|
||
|
}
|
||
|
public class WCS_WMS_PARAM_IN
|
||
|
{
|
||
|
public string method { get; set; }
|
||
|
|
||
|
public string timestamp { get; set; }
|
||
|
|
||
|
public IN_RES data { get; set; } //入库 取消
|
||
|
|
||
|
|
||
|
//检查参数是否缺失
|
||
|
public bool CheckParamNotNull(out string error)
|
||
|
{
|
||
|
|
||
|
StringBuilder message = new StringBuilder();
|
||
|
if (method == String.Empty)
|
||
|
{
|
||
|
message.Append("缺少method参数。");
|
||
|
|
||
|
}
|
||
|
|
||
|
if (timestamp == String.Empty)
|
||
|
{
|
||
|
message.Append("缺少timestamp参数。");
|
||
|
|
||
|
}
|
||
|
if (data == null)
|
||
|
{
|
||
|
message.Append("缺少data参数。");
|
||
|
|
||
|
}
|
||
|
|
||
|
error = message.ToString();
|
||
|
|
||
|
if (message.Length == 0)
|
||
|
{
|
||
|
return true;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
#region IN_DATA 入库 民航二所
|
||
|
public class IN_DATA
|
||
|
//JSON格式业务数据
|
||
|
{
|
||
|
/// <summary>
|
||
|
///
|
||
|
/// </summary>
|
||
|
public string taskId { get; set; }
|
||
|
/// <summary>
|
||
|
///
|
||
|
/// </summary>
|
||
|
public string containerCode { get; set; }
|
||
|
/// <summary>
|
||
|
///
|
||
|
/// </summary>
|
||
|
public string sourceAddress { get; set; }
|
||
|
/// <summary>
|
||
|
///
|
||
|
/// </summary>
|
||
|
public string targetAddress { get; set; }
|
||
|
/// <summary>
|
||
|
///
|
||
|
/// </summary>
|
||
|
public string tasklevel { get; set; }
|
||
|
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
#region IN_RES 入库返回
|
||
|
|
||
|
public class IN_RES //JSON格式业务数据
|
||
|
{
|
||
|
public string code { get; set; }//处理状态。00,成功,01异常
|
||
|
public string msg { get; set; }//返回消息
|
||
|
public string taskId { get; set; }
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
|
||
|
|
||
|
public class WMS_WCS_PARAM_CANCEL
|
||
|
{
|
||
|
public string method { get; set; }
|
||
|
|
||
|
public string timestamp { get; set; }
|
||
|
|
||
|
public CANCEL_DATA data { get; set; } //需要根据method进行类型转换
|
||
|
|
||
|
|
||
|
|
||
|
//检查参数是否缺失
|
||
|
public bool CheckParamNotNull(out string error)
|
||
|
{
|
||
|
|
||
|
StringBuilder message = new StringBuilder();
|
||
|
if (method == String.Empty)
|
||
|
{
|
||
|
message.Append("缺少method参数。");
|
||
|
}
|
||
|
|
||
|
if (timestamp == String.Empty)
|
||
|
{
|
||
|
message.Append("缺少timestamp参数。");
|
||
|
|
||
|
}
|
||
|
if (data == null)
|
||
|
{
|
||
|
message.Append("缺少data参数。");
|
||
|
|
||
|
}
|
||
|
|
||
|
error = message.ToString();
|
||
|
|
||
|
if (message.Length == 0)
|
||
|
{
|
||
|
return true;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//public FLUX_SYSTEM_PARAM(string[] str)
|
||
|
//{
|
||
|
// for (int i = 0; i < str.Length; i++)
|
||
|
// {
|
||
|
// if (str[i].Contains("method") == true)
|
||
|
// {
|
||
|
// this.method = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("client_customerid") == true)
|
||
|
// {
|
||
|
// this.client_customerid = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("client_db") == true)
|
||
|
// {
|
||
|
// this.client_db = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("messageid") == true)
|
||
|
// {
|
||
|
// this.messageid = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("apptoken") == true)
|
||
|
// {
|
||
|
// this.apptoken = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("appkey") == true)
|
||
|
// {
|
||
|
// this.appkey = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("sign") == true)
|
||
|
// {
|
||
|
// this.sign = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("timestamp") == true)
|
||
|
// {
|
||
|
// this.timestamp = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("data") == true)
|
||
|
// {
|
||
|
// //this.data = str[i].Split('=')[1]; //业务数据
|
||
|
// continue;
|
||
|
// }
|
||
|
// }
|
||
|
//}
|
||
|
}
|
||
|
public class WCS_WMS_PARAM_CANCEL
|
||
|
{
|
||
|
public string method { get; set; }
|
||
|
|
||
|
public string timestamp { get; set; }
|
||
|
|
||
|
public CANCEL_RES_DATA data { get; set; } //入库 取消
|
||
|
|
||
|
|
||
|
//检查参数是否缺失
|
||
|
public bool CheckParamNotNull(out string error)
|
||
|
{
|
||
|
|
||
|
StringBuilder message = new StringBuilder();
|
||
|
if (method == String.Empty)
|
||
|
{
|
||
|
message.Append("缺少method参数。");
|
||
|
|
||
|
}
|
||
|
|
||
|
if (timestamp == String.Empty)
|
||
|
{
|
||
|
message.Append("缺少timestamp参数。");
|
||
|
|
||
|
}
|
||
|
if (data == null)
|
||
|
{
|
||
|
message.Append("缺少data参数。");
|
||
|
|
||
|
}
|
||
|
|
||
|
error = message.ToString();
|
||
|
|
||
|
if (message.Length == 0)
|
||
|
{
|
||
|
return true;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
#region CANCEL_DATA WMS取消任务
|
||
|
|
||
|
public class CANCEL_DATA //JSON格式业务数据
|
||
|
{
|
||
|
public string taskId { get; set; }//任务编号(索引)
|
||
|
public string msgTime { get; set; }//
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
#region CANCEL_RES_DATA
|
||
|
|
||
|
public class CANCEL_RES_DATA //JSON格式业务数据
|
||
|
{
|
||
|
public string code { get; set; }//状态(0 成功,1 失败)
|
||
|
public string msg { get; set; }//返回消息,描述信息
|
||
|
public string taskId { get; set; }
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
public class WCS_WMS_PARAM_UPDATE
|
||
|
{
|
||
|
public string method { get; set; }
|
||
|
|
||
|
public string timestamp { get; set; }
|
||
|
|
||
|
public UPDATE_TASK_DATA data { get; set; } //需要根据method进行类型转换
|
||
|
|
||
|
//检查参数是否缺失
|
||
|
public bool CheckParamNotNull(out string error)
|
||
|
{
|
||
|
|
||
|
StringBuilder message = new StringBuilder();
|
||
|
if (method == String.Empty)
|
||
|
{
|
||
|
message.Append("缺少method参数。");
|
||
|
|
||
|
}
|
||
|
|
||
|
if (timestamp == String.Empty)
|
||
|
{
|
||
|
message.Append("缺少timestamp参数。");
|
||
|
|
||
|
}
|
||
|
if (data == null)
|
||
|
{
|
||
|
message.Append("缺少data参数。");
|
||
|
|
||
|
}
|
||
|
|
||
|
error = message.ToString();
|
||
|
|
||
|
if (message.Length == 0)
|
||
|
{
|
||
|
return true;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//public FLUX_SYSTEM_PARAM(string[] str)
|
||
|
//{
|
||
|
// for (int i = 0; i < str.Length; i++)
|
||
|
// {
|
||
|
// if (str[i].Contains("method") == true)
|
||
|
// {
|
||
|
// this.method = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("client_customerid") == true)
|
||
|
// {
|
||
|
// this.client_customerid = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("client_db") == true)
|
||
|
// {
|
||
|
// this.client_db = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("messageid") == true)
|
||
|
// {
|
||
|
// this.messageid = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("apptoken") == true)
|
||
|
// {
|
||
|
// this.apptoken = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("appkey") == true)
|
||
|
// {
|
||
|
// this.appkey = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("sign") == true)
|
||
|
// {
|
||
|
// this.sign = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("timestamp") == true)
|
||
|
// {
|
||
|
// this.timestamp = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("data") == true)
|
||
|
// {
|
||
|
// //this.data = str[i].Split('=')[1]; //业务数据
|
||
|
// continue;
|
||
|
// }
|
||
|
// }
|
||
|
//}
|
||
|
}
|
||
|
|
||
|
public class WMS_WCS_PARAM_UPDATE
|
||
|
{
|
||
|
public string method { get; set; }
|
||
|
//public string client_customerid { get; set; }
|
||
|
//public string client_db { get; set; }
|
||
|
//public string messageid { get; set; }
|
||
|
//public string apptoken { get; set; }
|
||
|
//public string appkey { get; set; }
|
||
|
//public string sign { get; set; }
|
||
|
public string timestamp { get; set; }
|
||
|
|
||
|
public UPDATE_TASK_RES data { get; set; } //需要根据method进行类型转换
|
||
|
|
||
|
//检查参数是否缺失
|
||
|
public bool CheckParamNotNull(out string error)
|
||
|
{
|
||
|
|
||
|
StringBuilder message = new StringBuilder();
|
||
|
if (method == String.Empty)
|
||
|
{
|
||
|
message.Append("缺少method参数。");
|
||
|
|
||
|
}
|
||
|
//if (client_customerid == String.Empty)
|
||
|
//{
|
||
|
// message.Append("缺少client_customerid参数。");
|
||
|
|
||
|
//}
|
||
|
//if (client_db == String.Empty)
|
||
|
//{
|
||
|
// message.Append("缺少client_db参数。");
|
||
|
|
||
|
//}
|
||
|
//if (messageid == String.Empty)
|
||
|
//{
|
||
|
// message.Append("缺少messageid参数。");
|
||
|
|
||
|
//}
|
||
|
//if (apptoken == String.Empty)
|
||
|
//{
|
||
|
// message.Append("缺少apptoken参数。");
|
||
|
|
||
|
//}
|
||
|
//if (appkey == String.Empty)
|
||
|
//{
|
||
|
// message.Append("缺少appkey参数。");
|
||
|
|
||
|
//}
|
||
|
//if (sign == String.Empty)
|
||
|
//{
|
||
|
// message.Append("缺少sign参数。");
|
||
|
|
||
|
//}
|
||
|
if (timestamp == String.Empty)
|
||
|
{
|
||
|
message.Append("缺少timestamp参数。");
|
||
|
|
||
|
}
|
||
|
if (data == null)
|
||
|
{
|
||
|
message.Append("缺少data参数。");
|
||
|
|
||
|
}
|
||
|
|
||
|
error = message.ToString();
|
||
|
|
||
|
if (message.Length == 0)
|
||
|
{
|
||
|
return true;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//public FLUX_SYSTEM_PARAM(string[] str)
|
||
|
//{
|
||
|
// for (int i = 0; i < str.Length; i++)
|
||
|
// {
|
||
|
// if (str[i].Contains("method") == true)
|
||
|
// {
|
||
|
// this.method = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("client_customerid") == true)
|
||
|
// {
|
||
|
// this.client_customerid = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("client_db") == true)
|
||
|
// {
|
||
|
// this.client_db = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("messageid") == true)
|
||
|
// {
|
||
|
// this.messageid = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("apptoken") == true)
|
||
|
// {
|
||
|
// this.apptoken = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("appkey") == true)
|
||
|
// {
|
||
|
// this.appkey = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("sign") == true)
|
||
|
// {
|
||
|
// this.sign = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("timestamp") == true)
|
||
|
// {
|
||
|
// this.timestamp = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("data") == true)
|
||
|
// {
|
||
|
// //this.data = str[i].Split('=')[1]; //业务数据
|
||
|
// continue;
|
||
|
// }
|
||
|
// }
|
||
|
//}
|
||
|
}
|
||
|
|
||
|
#region UPDATE_TASK_DATA 更改任务状态
|
||
|
|
||
|
public class UPDATE_TASK_DATA //JSON格式业务数据
|
||
|
{
|
||
|
// 20220904 add for zcy
|
||
|
public string taskId { get; set; }//任务编号(索引)
|
||
|
public string taskstatus { get; set; }//状态(10 执行中 30故障 999完成)
|
||
|
public string errortext { get; set; }//
|
||
|
public string containerCode { get; set; }// 容器编号
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
#region UPDATE_TASK_RES 更改任务状态返回
|
||
|
public class UPDATE_TASK_RES
|
||
|
{
|
||
|
public string code { get; set; }//状态(0 成功,1 失败)
|
||
|
public string msg { get; set; }//返回消息,描述信息
|
||
|
public string taskId { get; set; }
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
public class WCS_WMS_PARAM_TCANCEL
|
||
|
{
|
||
|
public string method { get; set; }
|
||
|
|
||
|
public string timestamp { get; set; }
|
||
|
|
||
|
public DELETE_TASK_DATA data { get; set; } //需要根据method进行类型转换
|
||
|
|
||
|
//检查参数是否缺失
|
||
|
public bool CheckParamNotNull(out string error)
|
||
|
{
|
||
|
|
||
|
StringBuilder message = new StringBuilder();
|
||
|
if (method == String.Empty)
|
||
|
{
|
||
|
message.Append("缺少method参数。");
|
||
|
|
||
|
}
|
||
|
|
||
|
if (timestamp == String.Empty)
|
||
|
{
|
||
|
message.Append("缺少timestamp参数。");
|
||
|
|
||
|
}
|
||
|
if (data == null)
|
||
|
{
|
||
|
message.Append("缺少data参数。");
|
||
|
|
||
|
}
|
||
|
|
||
|
error = message.ToString();
|
||
|
|
||
|
if (message.Length == 0)
|
||
|
{
|
||
|
return true;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//public FLUX_SYSTEM_PARAM(string[] str)
|
||
|
//{
|
||
|
// for (int i = 0; i < str.Length; i++)
|
||
|
// {
|
||
|
// if (str[i].Contains("method") == true)
|
||
|
// {
|
||
|
// this.method = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("client_customerid") == true)
|
||
|
// {
|
||
|
// this.client_customerid = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("client_db") == true)
|
||
|
// {
|
||
|
// this.client_db = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("messageid") == true)
|
||
|
// {
|
||
|
// this.messageid = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("apptoken") == true)
|
||
|
// {
|
||
|
// this.apptoken = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("appkey") == true)
|
||
|
// {
|
||
|
// this.appkey = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("sign") == true)
|
||
|
// {
|
||
|
// this.sign = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("timestamp") == true)
|
||
|
// {
|
||
|
// this.timestamp = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("data") == true)
|
||
|
// {
|
||
|
// //this.data = str[i].Split('=')[1]; //业务数据
|
||
|
// continue;
|
||
|
// }
|
||
|
// }
|
||
|
//}
|
||
|
}
|
||
|
|
||
|
public class WMS_WCS_PARAM_TCANCEL
|
||
|
{
|
||
|
public string method { get; set; }
|
||
|
//public string client_customerid { get; set; }
|
||
|
//public string client_db { get; set; }
|
||
|
//public string messageid { get; set; }
|
||
|
//public string apptoken { get; set; }
|
||
|
//public string appkey { get; set; }
|
||
|
//public string sign { get; set; }
|
||
|
public string timestamp { get; set; }
|
||
|
|
||
|
public DELETE_TASK_RES data { get; set; } //需要根据method进行类型转换
|
||
|
|
||
|
//检查参数是否缺失
|
||
|
public bool CheckParamNotNull(out string error)
|
||
|
{
|
||
|
|
||
|
StringBuilder message = new StringBuilder();
|
||
|
if (method == String.Empty)
|
||
|
{
|
||
|
message.Append("缺少method参数。");
|
||
|
|
||
|
}
|
||
|
//if (client_customerid == String.Empty)
|
||
|
//{
|
||
|
// message.Append("缺少client_customerid参数。");
|
||
|
|
||
|
//}
|
||
|
//if (client_db == String.Empty)
|
||
|
//{
|
||
|
// message.Append("缺少client_db参数。");
|
||
|
|
||
|
//}
|
||
|
//if (messageid == String.Empty)
|
||
|
//{
|
||
|
// message.Append("缺少messageid参数。");
|
||
|
|
||
|
//}
|
||
|
//if (apptoken == String.Empty)
|
||
|
//{
|
||
|
// message.Append("缺少apptoken参数。");
|
||
|
|
||
|
//}
|
||
|
//if (appkey == String.Empty)
|
||
|
//{
|
||
|
// message.Append("缺少appkey参数。");
|
||
|
|
||
|
//}
|
||
|
//if (sign == String.Empty)
|
||
|
//{
|
||
|
// message.Append("缺少sign参数。");
|
||
|
|
||
|
//}
|
||
|
if (timestamp == String.Empty)
|
||
|
{
|
||
|
message.Append("缺少timestamp参数。");
|
||
|
|
||
|
}
|
||
|
if (data == null)
|
||
|
{
|
||
|
message.Append("缺少data参数。");
|
||
|
|
||
|
}
|
||
|
|
||
|
error = message.ToString();
|
||
|
|
||
|
if (message.Length == 0)
|
||
|
{
|
||
|
return true;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//public FLUX_SYSTEM_PARAM(string[] str)
|
||
|
//{
|
||
|
// for (int i = 0; i < str.Length; i++)
|
||
|
// {
|
||
|
// if (str[i].Contains("method") == true)
|
||
|
// {
|
||
|
// this.method = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("client_customerid") == true)
|
||
|
// {
|
||
|
// this.client_customerid = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("client_db") == true)
|
||
|
// {
|
||
|
// this.client_db = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("messageid") == true)
|
||
|
// {
|
||
|
// this.messageid = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("apptoken") == true)
|
||
|
// {
|
||
|
// this.apptoken = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("appkey") == true)
|
||
|
// {
|
||
|
// this.appkey = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("sign") == true)
|
||
|
// {
|
||
|
// this.sign = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("timestamp") == true)
|
||
|
// {
|
||
|
// this.timestamp = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("data") == true)
|
||
|
// {
|
||
|
// //this.data = str[i].Split('=')[1]; //业务数据
|
||
|
// continue;
|
||
|
// }
|
||
|
// }
|
||
|
//}
|
||
|
}
|
||
|
|
||
|
|
||
|
#region DELETE_TASK_DATA 向管理申请删除任务
|
||
|
public class DELETE_TASK_DATA
|
||
|
{
|
||
|
|
||
|
public string taskId { get; set; }//任务编号(索引)
|
||
|
public string containerCode { get; set; }//条码
|
||
|
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
#region DELETE_TASK_RES 取消任务返回
|
||
|
public class DELETE_TASK_RES
|
||
|
{
|
||
|
public string code { get; set; }//状态(0 成功,1 失败)
|
||
|
public string msg { get; set; }//返回消息,描述信息
|
||
|
public string taskId { get; set; }
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
public class WCS_WMS_PARAM_STACK_STATUS
|
||
|
{
|
||
|
public string method { get; set; }
|
||
|
//public string client_customerid { get; set; }
|
||
|
//public string client_db { get; set; }
|
||
|
//public string messageid { get; set; }
|
||
|
//public string apptoken { get; set; }
|
||
|
//public string appkey { get; set; }
|
||
|
//public string sign { get; set; }
|
||
|
public string timestamp { get; set; }
|
||
|
|
||
|
//public object data { get; set; } //
|
||
|
public List<STACKSTATUS_DATA> data { get; set; }
|
||
|
|
||
|
//public WCS_WMS_PARAM()
|
||
|
//{
|
||
|
// method = "";
|
||
|
// //client_customerid = "aa";
|
||
|
// //client_db = " ";
|
||
|
// //messageid = "";
|
||
|
// //apptoken = "";
|
||
|
// //appkey = "";
|
||
|
// //sign = "";
|
||
|
// timestamp = "";
|
||
|
// data = new object();
|
||
|
//}
|
||
|
|
||
|
//public static string MD5Encrypt64(string data)
|
||
|
//{
|
||
|
// MD5 md5 = new MD5CryptoServiceProvider();
|
||
|
// Encoding utf8 = Encoding.UTF8;
|
||
|
// string sign2 = HttpUtility.UrlEncode((Convert.ToBase64String(md5.ComputeHash(Encoding.Default.GetBytes(appSecret + data + appSecret)))).ToUpper(), utf8);
|
||
|
// return sign2;
|
||
|
//}
|
||
|
|
||
|
//检查参数是否缺失
|
||
|
public bool CheckParamNotNull(out string error)
|
||
|
{
|
||
|
|
||
|
StringBuilder message = new StringBuilder();
|
||
|
if (method == String.Empty)
|
||
|
{
|
||
|
message.Append("缺少method参数。");
|
||
|
|
||
|
}
|
||
|
//if (client_customerid == String.Empty)
|
||
|
//{
|
||
|
// message.Append("缺少client_customerid参数。");
|
||
|
|
||
|
//}
|
||
|
//if (client_db == String.Empty)
|
||
|
//{
|
||
|
// message.Append("缺少client_db参数。");
|
||
|
|
||
|
//}
|
||
|
//if (messageid == String.Empty)
|
||
|
//{
|
||
|
// message.Append("缺少messageid参数。");
|
||
|
|
||
|
//}
|
||
|
//if (apptoken == String.Empty)
|
||
|
//{
|
||
|
// message.Append("缺少apptoken参数。");
|
||
|
|
||
|
//}
|
||
|
//if (appkey == String.Empty)
|
||
|
//{
|
||
|
// message.Append("缺少appkey参数。");
|
||
|
|
||
|
//}
|
||
|
//if (sign == String.Empty)
|
||
|
//{
|
||
|
// message.Append("缺少sign参数。");
|
||
|
|
||
|
//}
|
||
|
if (timestamp == String.Empty)
|
||
|
{
|
||
|
message.Append("缺少timestamp参数。");
|
||
|
|
||
|
}
|
||
|
if (data == null)
|
||
|
{
|
||
|
message.Append("缺少data参数。");
|
||
|
|
||
|
}
|
||
|
|
||
|
error = message.ToString();
|
||
|
|
||
|
if (message.Length == 0)
|
||
|
{
|
||
|
return true;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
public class WMS_WCS_PARAM_STACK_STATUS
|
||
|
{
|
||
|
public string method { get; set; }
|
||
|
//public string client_customerid { get; set; }
|
||
|
//public string client_db { get; set; }
|
||
|
//public string messageid { get; set; }
|
||
|
//public string apptoken { get; set; }
|
||
|
//public string appkey { get; set; }
|
||
|
//public string sign { get; set; }
|
||
|
public string timestamp { get; set; }
|
||
|
|
||
|
public STACKSTATUS_RES_DATA data { get; set; } //需要根据method进行类型转换
|
||
|
|
||
|
//检查参数是否缺失
|
||
|
public bool CheckParamNotNull(out string error)
|
||
|
{
|
||
|
|
||
|
StringBuilder message = new StringBuilder();
|
||
|
if (method == String.Empty)
|
||
|
{
|
||
|
message.Append("缺少method参数。");
|
||
|
|
||
|
}
|
||
|
//if (client_customerid == String.Empty)
|
||
|
//{
|
||
|
// message.Append("缺少client_customerid参数。");
|
||
|
|
||
|
//}
|
||
|
//if (client_db == String.Empty)
|
||
|
//{
|
||
|
// message.Append("缺少client_db参数。");
|
||
|
|
||
|
//}
|
||
|
//if (messageid == String.Empty)
|
||
|
//{
|
||
|
// message.Append("缺少messageid参数。");
|
||
|
|
||
|
//}
|
||
|
//if (apptoken == String.Empty)
|
||
|
//{
|
||
|
// message.Append("缺少apptoken参数。");
|
||
|
|
||
|
//}
|
||
|
//if (appkey == String.Empty)
|
||
|
//{
|
||
|
// message.Append("缺少appkey参数。");
|
||
|
|
||
|
//}
|
||
|
//if (sign == String.Empty)
|
||
|
//{
|
||
|
// message.Append("缺少sign参数。");
|
||
|
|
||
|
//}
|
||
|
if (timestamp == String.Empty)
|
||
|
{
|
||
|
message.Append("缺少timestamp参数。");
|
||
|
|
||
|
}
|
||
|
if (data == null)
|
||
|
{
|
||
|
message.Append("缺少data参数。");
|
||
|
|
||
|
}
|
||
|
|
||
|
error = message.ToString();
|
||
|
|
||
|
if (message.Length == 0)
|
||
|
{
|
||
|
return true;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//public FLUX_SYSTEM_PARAM(string[] str)
|
||
|
//{
|
||
|
// for (int i = 0; i < str.Length; i++)
|
||
|
// {
|
||
|
// if (str[i].Contains("method") == true)
|
||
|
// {
|
||
|
// this.method = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("client_customerid") == true)
|
||
|
// {
|
||
|
// this.client_customerid = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("client_db") == true)
|
||
|
// {
|
||
|
// this.client_db = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("messageid") == true)
|
||
|
// {
|
||
|
// this.messageid = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("apptoken") == true)
|
||
|
// {
|
||
|
// this.apptoken = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("appkey") == true)
|
||
|
// {
|
||
|
// this.appkey = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("sign") == true)
|
||
|
// {
|
||
|
// this.sign = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("timestamp") == true)
|
||
|
// {
|
||
|
// this.timestamp = str[i].Split('=')[1];
|
||
|
// continue;
|
||
|
// }
|
||
|
// if (str[i].Contains("data") == true)
|
||
|
// {
|
||
|
// //this.data = str[i].Split('=')[1]; //业务数据
|
||
|
// continue;
|
||
|
// }
|
||
|
// }
|
||
|
//}
|
||
|
}
|
||
|
|
||
|
|
||
|
#region STACKSTATUS_DATA 多穿设备状态
|
||
|
|
||
|
public class STACKSTATUS_DATA //JSON格式业务数据
|
||
|
{
|
||
|
public string stackindex { get; set; }//任务编号(索引)
|
||
|
public string positon { get; set; }//层
|
||
|
public string battery { get; set; }//电量
|
||
|
public string laneout { get; set; }//巷道内外
|
||
|
public string runstatus { get; set; }//状态
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
#region STACKSTATUS_RES_DATA
|
||
|
|
||
|
public class STACKSTATUS_RES_DATA //JSON格式业务数据
|
||
|
{
|
||
|
public string code { get; set; }//状态(0 成功,1 失败)
|
||
|
public string msg { get; set; }//返回消息,描述信息
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
public static event RefreshMonitorEventHandler RefreshMonitor;
|
||
|
public static void OnRefreshMonitor(RefreshMonitorEventArgs e)
|
||
|
{
|
||
|
if (RefreshMonitor != null)
|
||
|
{
|
||
|
RefreshMonitor(e);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
public static bool Invok_WMS_new( string pContent, string address, out string sResult)
|
||
|
{
|
||
|
object result = new object();
|
||
|
try
|
||
|
|
||
|
{
|
||
|
if (!address.Contains("state"))
|
||
|
{
|
||
|
CommonClassLib.CCarryConvert.WriteDarkCasket("CallService", "DealCallService", "发送报文:", pContent, "");
|
||
|
}
|
||
|
|
||
|
//json参数 //创建一个HTTP请求
|
||
|
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(address);
|
||
|
//Post请求方式
|
||
|
request.Method = "POST";
|
||
|
request.Timeout = 4500;
|
||
|
//内容类型
|
||
|
request.ContentType = "application/json;charset=UTF-8";
|
||
|
//将Json字符串转化为字节
|
||
|
byte[] byteData = Encoding.UTF8.GetBytes(pContent);
|
||
|
|
||
|
int length = byteData.Length;
|
||
|
//设置请求的ContentLength
|
||
|
request.ContentLength = length;
|
||
|
//发送请求,获得请求流
|
||
|
Stream writer = request.GetRequestStream();//获取用于写入请求数据的Stream对象
|
||
|
//将请求参数写入流
|
||
|
writer.Write(byteData, 0, length);
|
||
|
writer.Close();
|
||
|
//获得响应流
|
||
|
var response = (HttpWebResponse)request.GetResponse();
|
||
|
var responseString = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding("utf-8")).ReadToEnd();
|
||
|
sResult = responseString;
|
||
|
if (!address.Contains("state"))
|
||
|
{
|
||
|
CommonClassLib.CCarryConvert.WriteDarkCasket("CallService", "DealCallService", "收到报文:", responseString, "");
|
||
|
}
|
||
|
return true;
|
||
|
|
||
|
}
|
||
|
catch (System.Net.WebException ex)
|
||
|
{
|
||
|
sResult = ex.Message;
|
||
|
var mResponse = ex.Response as HttpWebResponse;
|
||
|
var responseStream = mResponse.GetResponseStream();
|
||
|
if (responseStream != null)
|
||
|
{
|
||
|
var streamReader = new StreamReader(responseStream, Encoding.GetEncoding("utf-8"));
|
||
|
//获取返回的信息
|
||
|
result = streamReader.ReadToEnd();
|
||
|
streamReader.Close();
|
||
|
responseStream.Close();
|
||
|
}
|
||
|
result = "获取数据失败,请重试!" + address + ex.ToString() + " 返回数据" + result;
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
public static string UpdateToWMS(UPDATE_TASK_DATA ask_data, out UPDATE_TASK_RES resp_data)
|
||
|
{
|
||
|
string bResult = string.Empty;
|
||
|
bool sResult = true;
|
||
|
string outJson = string.Empty;
|
||
|
resp_data = null;
|
||
|
try
|
||
|
{
|
||
|
WCS_WMS_PARAM_UPDATE upd = new WCS_WMS_PARAM_UPDATE();
|
||
|
WMS_WCS_PARAM_UPDATE upd_res = new WMS_WCS_PARAM_UPDATE();
|
||
|
upd.method = "wcs_status_feedback";
|
||
|
upd.timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||
|
upd.data = ask_data;
|
||
|
|
||
|
string data_json_string = Model.JsonHelper.Serializer(upd);
|
||
|
|
||
|
sResult = Invok_WMS_new(data_json_string, CStaticClass.ManageServiceAddress, out outJson);
|
||
|
|
||
|
if (sResult == false)
|
||
|
{
|
||
|
bResult = outJson;
|
||
|
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
upd_res = Model.JsonHelper.Deserialize<WMS_WCS_PARAM_UPDATE>(outJson);//WMS的返回值需要反序列化
|
||
|
UPDATE_TASK_RES outdata = upd_res.data;
|
||
|
|
||
|
if (outdata.code == "00" || outdata.code == "0")
|
||
|
{
|
||
|
bResult = "";
|
||
|
resp_data = outdata;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if (outdata.msg == "")
|
||
|
{
|
||
|
bResult = "返回为null";
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
bResult = outdata.msg;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return bResult;
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
bResult = ex.Message;
|
||
|
return bResult;
|
||
|
}
|
||
|
}
|
||
|
public static string CancelToWMS(DELETE_TASK_DATA ask_data, out DELETE_TASK_RES resp_data)
|
||
|
{
|
||
|
string bResult = string.Empty;
|
||
|
bool sResult = true;
|
||
|
string outJson = string.Empty;
|
||
|
resp_data = null;
|
||
|
try
|
||
|
{
|
||
|
WCS_WMS_PARAM_TCANCEL canc = new WCS_WMS_PARAM_TCANCEL();
|
||
|
WMS_WCS_PARAM_TCANCEL cancres = new WMS_WCS_PARAM_TCANCEL();
|
||
|
canc.method = "wcs_task_cancel";
|
||
|
canc.timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||
|
canc.data = ask_data;
|
||
|
|
||
|
string data_json_string = Model.JsonHelper.Serializer(canc);
|
||
|
|
||
|
|
||
|
sResult = Invok_WMS_new( data_json_string, CStaticClass.ManageServiceAddressTwo,out outJson);
|
||
|
|
||
|
if (sResult == false)
|
||
|
{
|
||
|
bResult = outJson;
|
||
|
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
cancres = Model.JsonHelper.Deserialize<WMS_WCS_PARAM_TCANCEL>(outJson);
|
||
|
DELETE_TASK_RES outdata = cancres.data;
|
||
|
|
||
|
if (outdata.code == "00" || outdata.code == "0")
|
||
|
{
|
||
|
bResult = "";
|
||
|
resp_data = outdata;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if (outdata.msg == "")
|
||
|
{
|
||
|
bResult = "返回为null";
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
bResult = outdata.msg;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return bResult;
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
bResult = ex.Message;
|
||
|
return bResult;
|
||
|
}
|
||
|
}
|
||
|
public static string UpdateStatusToWMS(List<STACKSTATUS_DATA> ask_data, out STACKSTATUS_RES_DATA resp_data)
|
||
|
{
|
||
|
string bResult = string.Empty;
|
||
|
bool sResult = true;
|
||
|
string outJson = string.Empty;
|
||
|
resp_data = null;
|
||
|
try
|
||
|
{
|
||
|
WCS_WMS_PARAM_STACK_STATUS updatestatus= new WCS_WMS_PARAM_STACK_STATUS();
|
||
|
WMS_WCS_PARAM_STACK_STATUS updatestatusres = new WMS_WCS_PARAM_STACK_STATUS();
|
||
|
updatestatus.method = "wcs_stack_status";
|
||
|
updatestatus.timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||
|
updatestatus.data = ask_data;
|
||
|
|
||
|
string data_json_string =Model.JsonHelper.Serializer(updatestatus);
|
||
|
|
||
|
|
||
|
sResult = Invok_WMS_new(data_json_string, CStaticClass.ManageServiceAddressThree, out outJson);
|
||
|
|
||
|
if (sResult == false)
|
||
|
{
|
||
|
bResult = outJson;
|
||
|
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
updatestatusres = Model.JsonHelper.Deserialize<WMS_WCS_PARAM_STACK_STATUS>(outJson);//将wms回复的信息反序列化
|
||
|
STACKSTATUS_RES_DATA outdata = updatestatusres.data;
|
||
|
|
||
|
if (outdata.code == "00" || outdata.code == "0")
|
||
|
{
|
||
|
bResult = "";
|
||
|
resp_data = outdata;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if (outdata.msg == "")
|
||
|
{
|
||
|
bResult = "返回为null";
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
bResult = outdata.msg;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return bResult;
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
bResult = ex.Message;
|
||
|
return bResult;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
//向wms上报纸箱任务
|
||
|
|
||
|
|
||
|
//测试出库任务
|
||
|
//public static string TestOut(OUT_DATA ask_data, out string resp_data1)
|
||
|
//{
|
||
|
|
||
|
// OUT_RES resp_data = new OUT_RES();
|
||
|
|
||
|
|
||
|
// string bResult = string.Empty;
|
||
|
// bool sResult = true;
|
||
|
// string outJson = string.Empty;
|
||
|
// resp_data = null;
|
||
|
// try
|
||
|
// {
|
||
|
// WCS_WMS_PARAM outData = new WCS_WMS_PARAM();
|
||
|
// outData.method = "wcs_request_out";
|
||
|
// outData.client_customerid = "aa";
|
||
|
// outData.client_db = "";
|
||
|
// outData.messageid = "";
|
||
|
// outData.apptoken = "";
|
||
|
// outData.appkey = "";
|
||
|
// outData.sign = "";
|
||
|
// outData.timestamp = "";
|
||
|
// outData.data = ask_data;
|
||
|
|
||
|
// string data_json_string = Model.JsonHelper.Serializer(outData);
|
||
|
|
||
|
// sResult = Invok_WMS_new( data_json_string, out outJson);
|
||
|
|
||
|
|
||
|
|
||
|
// if (sResult == false)
|
||
|
// {
|
||
|
// bResult = outJson;
|
||
|
// }
|
||
|
// else
|
||
|
// {
|
||
|
// resp_data = Model.JsonHelper.Deserialize<OUT_RES>(outJson);
|
||
|
// if (resp_data.code != "1")
|
||
|
// {
|
||
|
// if (resp_data.msg == "")
|
||
|
// {
|
||
|
// bResult = "返回为null";
|
||
|
// }
|
||
|
// else
|
||
|
// {
|
||
|
// bResult = resp_data.msg;
|
||
|
// }
|
||
|
// }
|
||
|
// else
|
||
|
// {
|
||
|
// bResult = "";
|
||
|
// //resp_data = outdata;
|
||
|
// }
|
||
|
// }
|
||
|
// resp_data1 = "true";
|
||
|
|
||
|
// return bResult;
|
||
|
// }
|
||
|
// catch (Exception ex)
|
||
|
// {
|
||
|
// bResult = ex.Message;
|
||
|
// resp_data1 = "false";
|
||
|
// return bResult;
|
||
|
// }
|
||
|
//}
|
||
|
|
||
|
|
||
|
static DBOperator dbo = CStaticClass.dbo;
|
||
|
static DBOperator dboMan = CStaticClass.dboM;
|
||
|
static StringBuilder sql = new StringBuilder();
|
||
|
static StringBuilder[] wv = { new StringBuilder("2") };
|
||
|
static StringBuilder[] witemnames = { new StringBuilder("") };
|
||
|
static Model.MDevice devinfo = new Model.MDevice();
|
||
|
static CCommonFunction ccf = new CCommonFunction();
|
||
|
static Thread mythread;
|
||
|
static Thread mythreadUpdatestatus;
|
||
|
static bool exitThread = false;
|
||
|
static bool exitThreadUpdatestatus = false;
|
||
|
static CGetState cgs = new CGetState();
|
||
|
|
||
|
static string _CCallServiceError = "";//监控调度类错误说明
|
||
|
|
||
|
public static string CCallServiceError
|
||
|
{
|
||
|
get { return _CCallServiceError; }
|
||
|
set { _CCallServiceError = value; }
|
||
|
}
|
||
|
|
||
|
//static Dictionary<string, string> ErrorStation = new Dictionary<string, string>
|
||
|
//{
|
||
|
// {"12005","12006"},{"12008","12007"},{"22009","22008"}
|
||
|
//};
|
||
|
|
||
|
|
||
|
private static void BeginListen()
|
||
|
{//20091107
|
||
|
while (!exitThread)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
string bResult = "";
|
||
|
DataView dv = new DataView(); DataView dvl = new DataView();
|
||
|
string dtime = DateTime.Now.ToString("u");
|
||
|
dtime = dtime.Substring(0, dtime.Length - 1);
|
||
|
int AutoManageIdx = 0; int a = 0;
|
||
|
string FSTARTCELL = ""; string FENDCELL = "";
|
||
|
int FSTARTDEVICE = 0; int FENDDEVICE = 0;
|
||
|
int flaneway = 0; int fstack = 0;
|
||
|
int FControlTaskType = 0;
|
||
|
|
||
|
|
||
|
UPDATE_TASK_DATA tempComp = new UPDATE_TASK_DATA();
|
||
|
UPDATE_TASK_RES tempCompRes = new UPDATE_TASK_RES();
|
||
|
DELETE_TASK_DATA tempCanc = new DELETE_TASK_DATA();
|
||
|
DELETE_TASK_RES tempCancRes = new DELETE_TASK_RES();
|
||
|
|
||
|
//LAYERSTATUS_DATA tempLayer = new LAYERSTATUS_DATA();
|
||
|
|
||
|
#region IO_CONTROL 删除
|
||
|
sql.Clear();
|
||
|
sql.Append("select * from IO_CONTROL WHERE CONTROL_STATUS = 999 OR CONTROL_STATUS = 900 OR CONTROL_STATUS = 970");
|
||
|
|
||
|
if (dbo.ExceSQL(sql.ToString()).Tables[0].DefaultView.Count > 0)
|
||
|
{
|
||
|
sql.Clear();
|
||
|
sql.Append("delete from IO_CONTROL where CONTROL_STATUS = 999 OR CONTROL_STATUS = 900 OR CONTROL_STATUS = 970");
|
||
|
dbo.ExceSQL(sql.ToString());
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
sql.Remove(0, sql.Length);
|
||
|
sql.Append("select * from IO_CONTROL_APPLY where (CONTROL_APPLY_TYPE = 10) or (CONTROL_APPLY_TYPE = 30) or (CONTROL_APPLY_TYPE = 999) or (CONTROL_APPLY_TYPE = 900) or (CONTROL_APPLY_TYPE = 970) order by CONTROL_APPLY_ID,CREATE_TIME");
|
||
|
dv = dbo.ExceSQL(sql.ToString()).Tables[0].DefaultView;
|
||
|
for (int i = 0; i < dv.Count; i++)
|
||
|
{
|
||
|
CommonClassLib.CCarryConvert.WriteDarkCasket("CallService", "DealCallService", "准备开始调用wms服务:", "任务号:"+dv[i]["CONTROL_ID"].ToString(), ",起点站台:" + dv[i]["DEVICE_CODE"].ToString()
|
||
|
+ ",条码:" + dv[i]["STOCK_BARCODE"].ToString() + ",任务类型:" + dv[i]["CONTROL_APPLY_TYPE"] + ",状态:" + dv[i]["APPLY_TASK_STATUS"] );
|
||
|
if (Convert.ToInt32(dv[i]["CONTROL_APPLY_TYPE"]) != 900) // 非删除状态
|
||
|
{
|
||
|
if (Convert.ToInt32(dv[i]["CONTROL_APPLY_TYPE"]) == 10) //执行状态
|
||
|
{
|
||
|
tempComp.taskId = dv[i]["CONTROL_ID"].ToString();
|
||
|
tempComp.taskstatus = dv[i]["APPLY_TASK_STATUS"].ToString();
|
||
|
tempComp.errortext = string.Empty;
|
||
|
tempComp.containerCode = dv[i]["STOCK_BARCODE"].ToString();
|
||
|
bResult = UpdateToWMS(tempComp, out tempCompRes);
|
||
|
if (!bResult.Contains("成功") && bResult != "") //WMS回复没成功
|
||
|
{
|
||
|
//调用失败, 状态不变,写入错误原因后删除 不再给其再次更新执行了
|
||
|
dbo.ExecuteSql(string.Format("UPDATE IO_CONTROL_APPLY set CONTROL_APPLY_REMARK = '{1}' WHERE (CONTROL_APPLY_ID = {0})", Convert.ToInt32(dv[i]["CONTROL_APPLY_ID"]), bResult));
|
||
|
dbo.ExecuteSql(string.Format("DELETE FROM IO_CONTROL_APPLY WHERE (CONTROL_APPLY_ID = {0})", Convert.ToInt32(dv[i]["CONTROL_APPLY_ID"])));
|
||
|
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
dbo.ExecuteSql(string.Format("DELETE FROM IO_CONTROL_APPLY WHERE (CONTROL_APPLY_ID = {0})", Convert.ToInt32(dv[i]["CONTROL_APPLY_ID"])));//民航二所 删除当前条 创建触发器删除时写入历史表
|
||
|
}
|
||
|
|
||
|
}
|
||
|
else if (Convert.ToInt32(dv[i]["CONTROL_APPLY_TYPE"]) == 30) //报警状态
|
||
|
{
|
||
|
tempComp.taskId = dv[i]["CONTROL_ID"].ToString();
|
||
|
tempComp.taskstatus = dv[i]["APPLY_TASK_STATUS"].ToString();
|
||
|
tempComp.errortext = dv[i]["CONTROL_APPLY_PARAMETER"].ToString();//报警信息写在CONTROL_APPLY_PARAMETER
|
||
|
tempComp.containerCode = dv[i]["STOCK_BARCODE"].ToString();
|
||
|
bResult = UpdateToWMS(tempComp, out tempCompRes);
|
||
|
|
||
|
if (!bResult.Contains("成功") && bResult != "") //WMS回复没成功
|
||
|
{
|
||
|
//调用失败, 状态不变,写入错误原因后删除 不再给其再次更新执行了
|
||
|
dbo.ExecuteSql(string.Format("UPDATE IO_CONTROL_APPLY set CONTROL_APPLY_REMARK = '{1}' WHERE (CONTROL_APPLY_ID = {0})", Convert.ToInt32(dv[i]["CONTROL_APPLY_ID"]), bResult));
|
||
|
dbo.ExecuteSql(string.Format("DELETE FROM IO_CONTROL_APPLY WHERE (CONTROL_APPLY_ID = {0})", Convert.ToInt32(dv[i]["CONTROL_APPLY_ID"])));
|
||
|
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
dbo.ExecuteSql(string.Format("DELETE FROM IO_CONTROL_APPLY WHERE (CONTROL_APPLY_ID = {0})", Convert.ToInt32(dv[i]["CONTROL_APPLY_ID"])));//民航二所 删除当前条 创建触发器删除时写入历史表
|
||
|
}
|
||
|
|
||
|
}
|
||
|
else if (Convert.ToInt32(dv[i]["CONTROL_APPLY_TYPE"]) == 999|| Convert.ToInt32(dv[i]["CONTROL_APPLY_TYPE"]) == 970) //完成状态 或者970状态
|
||
|
{
|
||
|
tempComp.taskId = dv[i]["CONTROL_ID"].ToString();
|
||
|
tempComp.taskstatus = dv[i]["APPLY_TASK_STATUS"].ToString();
|
||
|
tempComp.errortext = dv[i]["CONTROL_APPLY_PARAMETER"].ToString();
|
||
|
tempComp.containerCode = dv[i]["STOCK_BARCODE"].ToString();
|
||
|
bResult = UpdateToWMS(tempComp, out tempCompRes);
|
||
|
|
||
|
int status = 0;
|
||
|
if (Convert.ToInt32(dv[i]["CONTROL_APPLY_TYPE"]) == 999)
|
||
|
{
|
||
|
status = 996;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
status = 976;
|
||
|
}
|
||
|
|
||
|
if (!bResult.Contains("成功") && bResult != "") //WMS回复没成功
|
||
|
{
|
||
|
//调用失败, 状态不变,写入上次错误原因 并且置为996 或者976 线程不再处理 人为处理
|
||
|
dbo.ExecuteSql(string.Format("UPDATE IO_CONTROL_APPLY set CONTROL_APPLY_TYPE={2}, APPLY_TASK_STATUS={2}, CONTROL_APPLY_REMARK = '{1}' WHERE (CONTROL_APPLY_ID = {0})", Convert.ToInt32(dv[i]["CONTROL_APPLY_ID"]), bResult, status));
|
||
|
|
||
|
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
dbo.ExecuteSql(string.Format("DELETE FROM IO_CONTROL_APPLY WHERE (CONTROL_ID = {0})", Convert.ToInt32(dv[i]["CONTROL_ID"])));//民航二所 可以删除该任务的所有记录了 创建触发器删除时写入历史表 删除所有当前任务号的IO_CONTROL_APPLY
|
||
|
}
|
||
|
|
||
|
}
|
||
|
if (tempCompRes != null) //成功
|
||
|
{
|
||
|
CommonClassLib.CCarryConvert.WriteDarkCasket("CallService", "DealCallService", "调用任务状态上报接口:", "任务号:" + dv[i]["CONTROL_ID"].ToString(), ",起点站台:" + dv[i]["DEVICE_CODE"].ToString() + ",条码:" + dv[i]["STOCK_BARCODE"].ToString()
|
||
|
+ ",原taskid:" + tempComp.taskId + ",状态:" + tempComp.taskstatus + ",结果:成功" + ",返回代码:" + tempCompRes.code);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CommonClassLib.CCarryConvert.WriteDarkCasket("CallService", "DealCallService", "调用任务状态上报申请:", "任务号:" + dv[i]["CONTROL_ID"].ToString(), ",起点站台:" + dv[i]["DEVICE_CODE"].ToString() + ",条码:" + dv[i]["STOCK_BARCODE"].ToString()
|
||
|
+ ",原taskid:" + tempComp.taskId + ",状态:" + tempComp.taskstatus + ",结果:" + bResult);
|
||
|
}
|
||
|
}
|
||
|
else //删除状态
|
||
|
{
|
||
|
|
||
|
tempCanc.taskId = dv[i]["CONTROL_ID"].ToString() ;
|
||
|
tempCanc.containerCode = dv[i]["STOCK_BARCODE"].ToString();
|
||
|
bResult = CancelToWMS(tempCanc, out tempCancRes);
|
||
|
|
||
|
if (!bResult.Contains("成功") && bResult != "")
|
||
|
{
|
||
|
//调用失败, 状态不变,写入上次错误原因 并且置为996 线程不再处理 人为处理
|
||
|
dbo.ExecuteSql(string.Format("UPDATE IO_CONTROL_APPLY set CONTROL_APPLY_TYPE=906, APPLY_TASK_STATUS=906, CONTROL_APPLY_REMARK = '{1}' WHERE (CONTROL_APPLY_ID = {0})", Convert.ToInt32(dv[i]["CONTROL_APPLY_ID"]), bResult));
|
||
|
|
||
|
if (bResult.Contains("不存在此任务无法取消")) //将所有该任务号的申请全部删除
|
||
|
{
|
||
|
dbo.ExecuteSql(string.Format("DELETE FROM IO_CONTROL_APPLY WHERE (CONTROL_ID = {0})", Convert.ToInt32(dv[i]["CONTROL_ID"])));
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
dbo.ExecuteSql(string.Format("DELETE FROM IO_CONTROL_APPLY WHERE (CONTROL_ID = {0})", Convert.ToInt32(dv[i]["CONTROL_ID"])));//将所有该任务号的申请全部删除
|
||
|
}
|
||
|
|
||
|
if (tempCancRes != null)
|
||
|
{
|
||
|
CommonClassLib.CCarryConvert.WriteDarkCasket("CallService", "DealCallService", "调用任务删除上报接口:", "任务号:" + dv[i]["CONTROL_ID"].ToString(), ",起点站台:" + dv[i]["DEVICE_CODE"].ToString() + ",条码:" + dv[i]["STOCK_BARCODE"].ToString()
|
||
|
+ ",原taskid:" + tempCanc.taskId + ",条码:" + tempCanc.containerCode + "结果:成功" + ",返回代码:" + tempCancRes.code);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
CommonClassLib.CCarryConvert.WriteDarkCasket("CallService", "DealCallService", "调用任务删除上报接口:", "任务号:" + dv[i]["CONTROL_ID"].ToString(), ",起点站台:" + dv[i]["DEVICE_CODE"].ToString() + ",条码:" + dv[i]["STOCK_BARCODE"].ToString()
|
||
|
+ ",原taskid:" + tempCanc.taskId + ",条码:" + tempCanc.containerCode + ",结果:" + bResult);
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
#region 将多穿层信息,同步给WMS(0可用,1禁用,2有车)
|
||
|
//sql.Clear();
|
||
|
//sql.Append("select a.f_deviceindex, F_ErrorCode, F_LockedState,F_Postion,F_LaneOut ,F_WMSStatus,F_UpdateNo " +
|
||
|
// " from T_Base_Device a, SHUTTLE_POSITION b ,SHUTTLE_LAYER_STATUS c where" +
|
||
|
// " a.F_DeviceIndex = b.F_DeviceIndex and F_DeviceKindIndex = 1 and F_IsShuttleBorad = 1" +
|
||
|
// " and c.f_layer = b.F_postion");
|
||
|
//dv = dbo.ExceSQL(sql.ToString()).Tables[0].DefaultView;
|
||
|
//for (int i = 0; i < dv.Count; i++)
|
||
|
//{
|
||
|
// int dev = Convert.ToInt32(dv[i]["f_deviceindex"]);
|
||
|
// int updateTo = Convert.ToInt32(dv[i]["F_UpdateNo"]);
|
||
|
|
||
|
// int errCode = Convert.ToInt32(dv[i]["F_ErrorCode"]);
|
||
|
// int lockCode = Convert.ToInt32(dv[i]["F_LockedState"]);
|
||
|
// int laneOut = Convert.ToInt32(dv[i]["F_LaneOut"]); //在巷道0,不在巷道1
|
||
|
// int layer = Convert.ToInt32(dv[i]["F_Postion"]);
|
||
|
|
||
|
|
||
|
// if ((errCode >= 30 || lockCode == -1) && laneOut == 0)
|
||
|
// {
|
||
|
// tempLayer.bankId = "18002";
|
||
|
// tempLayer.banklayer = layer.ToString();
|
||
|
// tempLayer.statusCode = "1";
|
||
|
|
||
|
// }
|
||
|
// else
|
||
|
// {
|
||
|
// tempLayer.bankId = "18002";
|
||
|
// tempLayer.banklayer = layer.ToString();
|
||
|
// tempLayer.statusCode = "0";
|
||
|
// }
|
||
|
|
||
|
// #region 已同步
|
||
|
// devinfo = Model.CGetInfo.GetDeviceInfo(dev);
|
||
|
// if (devinfo.RemotePort == updateTo && tempLayer.statusCode == dv[i]["F_WMSStatus"].ToString() && devinfo.RemotePort != 0)
|
||
|
// {
|
||
|
// //借用RemotePort,保存向管理同步的状态
|
||
|
// continue;
|
||
|
// }
|
||
|
// #endregion
|
||
|
|
||
|
// else
|
||
|
// {
|
||
|
// //bResult = UpdateLayerToWMS(tempLayer, out tempCompRes);
|
||
|
|
||
|
// //if (bResult.Contains("成功") || bResult == "")
|
||
|
// {
|
||
|
// dbo.ExecuteSql(string.Format("update SHUTTLE_LAYER_STATUS set F_WMSStatus = '{1}' , F_UpdateNo = '{2}' where F_Layer = {0}", layer, tempLayer.statusCode, updateTo + 1));
|
||
|
// devinfo.RemotePort = updateTo + 1;
|
||
|
// CommonClassLib.CCarryConvert.WriteDarkCasket("CallService", "DealCallService", "多穿层状态更新成功:", layer.ToString(), ",层状态:" + tempLayer.statusCode);
|
||
|
|
||
|
// }
|
||
|
// }
|
||
|
|
||
|
|
||
|
//}
|
||
|
|
||
|
////没有多穿的曾,未被禁用,则可用
|
||
|
//sql.Clear();
|
||
|
//sql.Append("SELECT F_Layer,F_WMSStatus,F_UpdateNo FROM SHUTTLE_LAYER_STATUS where f_wmsstatus <> 0 and f_wmsstatus <> -1 " +
|
||
|
// "and f_layer not in (select f_postion from SHUTTLE_POSITION)");
|
||
|
//dv = dbo.ExceSQL(sql.ToString()).Tables[0].DefaultView;
|
||
|
//if (dv.Count > 0)
|
||
|
//{
|
||
|
// for (int i = 0; i < dv.Count; i++)
|
||
|
// {
|
||
|
// string layer = dv[i]["F_Layer"].ToString();
|
||
|
// {
|
||
|
// tempLayer.bankId = "18002";
|
||
|
// tempLayer.banklayer = dv[i]["F_Layer"].ToString();
|
||
|
// tempLayer.statusCode = "0";
|
||
|
// }
|
||
|
|
||
|
// if (tempLayer.statusCode != dv[i]["F_WMSStatus"].ToString())
|
||
|
// {
|
||
|
// //bResult = UpdateLayerToWMS(tempLayer, out tempCompRes);
|
||
|
|
||
|
// //if (bResult.Contains("成功") || bResult == "")
|
||
|
// {
|
||
|
// dbo.ExecuteSql(string.Format("update SHUTTLE_LAYER_STATUS set F_WMSStatus = '{1}' , F_UpdateNo = '{2}' where F_Layer = {0}", layer, tempLayer.statusCode, 0));
|
||
|
|
||
|
// CommonClassLib.CCarryConvert.WriteDarkCasket("CallService", "DealCallService", "多穿层状态更新成功:", "", ",层状态:" + tempLayer.statusCode);
|
||
|
// }
|
||
|
// }
|
||
|
|
||
|
|
||
|
// }
|
||
|
//}
|
||
|
#endregion
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
_CCallServiceError = ex.StackTrace + ex.Message;
|
||
|
CommonClassLib.CCarryConvert.WriteDarkCasket("CallService", "DealCallService", "调用接口时异常:", "19999", "清除所有申请!");
|
||
|
//dbo.ExecuteSql(string.Format("UPDATE IO_CONTROL_APPLY set APPLY_TASK_STATUS = 2 where APPLY_TASK_STATUS = 0"));
|
||
|
}
|
||
|
finally
|
||
|
{
|
||
|
Thread.Sleep(500);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static void EndListen()
|
||
|
{//20091107
|
||
|
exitThread = true;
|
||
|
|
||
|
if (mythread != null)
|
||
|
{
|
||
|
|
||
|
mythread.Abort();
|
||
|
mythread = null;
|
||
|
}
|
||
|
|
||
|
|
||
|
exitThreadUpdatestatus = true;
|
||
|
|
||
|
if (mythreadUpdatestatus != null)
|
||
|
{
|
||
|
|
||
|
mythreadUpdatestatus.Abort();
|
||
|
mythreadUpdatestatus = null;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
private static void BeginListenUpdatestatus()
|
||
|
{//20091107
|
||
|
while (!exitThreadUpdatestatus)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
|
||
|
if (CStaticClass.ObtainManageTask == true)
|
||
|
{
|
||
|
|
||
|
STACKSTATUS_DATA stackstatus = new STACKSTATUS_DATA();
|
||
|
STACKSTATUS_RES_DATA stackstatusres = new STACKSTATUS_RES_DATA();
|
||
|
StringBuilder sql = new StringBuilder();
|
||
|
DataView dvmo = new DataView();
|
||
|
sql.Remove(0, sql.Length);
|
||
|
sql.Append("SELECT * FROM SHUTTLE_POSITION ");
|
||
|
dvmo = dbo.ExceSQL(sql.ToString()).Tables[0].DefaultView;
|
||
|
if (dvmo.Count > 0)
|
||
|
{
|
||
|
List<STACKSTATUS_DATA> stackdatalist = new List<STACKSTATUS_DATA>();
|
||
|
|
||
|
STACKSTATUS_RES_DATA stackdatares = new STACKSTATUS_RES_DATA();
|
||
|
for (int i = 0; i < dvmo.Count; i++)
|
||
|
{
|
||
|
STACKSTATUS_DATA stackdata = new STACKSTATUS_DATA();
|
||
|
stackdata.stackindex = dvmo[i]["F_DeviceIndex"].ToString();
|
||
|
stackdata.positon = dvmo[i]["F_Postion"].ToString();
|
||
|
stackdata.battery = dvmo[i]["F_BatteryStatus"].ToString();
|
||
|
stackdata.laneout = dvmo[i]["F_LaneOut"].ToString();
|
||
|
stackdata.runstatus = dvmo[i]["F_RunStatus"].ToString();
|
||
|
stackdatalist.Add(stackdata);
|
||
|
|
||
|
}
|
||
|
string bResult = UpdateStatusToWMS(stackdatalist, out stackstatusres);
|
||
|
if (bResult != null)
|
||
|
{
|
||
|
// CommonClassLib.CCarryConvert.WriteDarkCasket("CallService", "DealCallService", "调用穿梭板更新信息接口:", "结束", "结果:成功" + ",返回代码:" + stackstatusres.code);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
// CommonClassLib.CCarryConvert.WriteDarkCasket("CallService", "DealCallService", "调用穿梭板更新信息接口:", "结束", "结果:" + bResult);
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
_CCallServiceError = ex.StackTrace + ex.Message;
|
||
|
CommonClassLib.CCarryConvert.WriteDarkCasket("CallService", "DealCallService", "调用更新穿梭板状态接口时异常:", "19999", "异常");
|
||
|
|
||
|
}
|
||
|
finally
|
||
|
{
|
||
|
Thread.Sleep(5000);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
public static void StartListen()
|
||
|
{
|
||
|
//LayerStatus.LAYER.Clear();
|
||
|
//sql.Clear();
|
||
|
//sql.Append("select * from SHUTTLE_LAYER_STATUS");
|
||
|
//DataView dv = new DataView();
|
||
|
//dv = dbo.ExceSQL(sql.ToString()).Tables[0].DefaultView;
|
||
|
//for (int i=0; i<dv.Count;i ++)
|
||
|
//{
|
||
|
// LayerStatus.LAYER.Add(Convert.ToInt32(dv[i]["F_Layer"]), Convert.ToInt32(dv[i]["F_UpdateNo"]));
|
||
|
//}
|
||
|
exitThread = false;
|
||
|
mythread = new Thread(new ThreadStart(BeginListen));
|
||
|
mythread.IsBackground = true;
|
||
|
mythread.Start();
|
||
|
|
||
|
exitThreadUpdatestatus = false;
|
||
|
mythreadUpdatestatus = new Thread(new ThreadStart(BeginListenUpdatestatus)); //
|
||
|
mythreadUpdatestatus.IsBackground = true;
|
||
|
mythreadUpdatestatus.Start();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static class LayerStatus
|
||
|
{
|
||
|
public static Dictionary<int, int> LAYER = new Dictionary<int, int>();
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|