You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

573 lines
25 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using SlnMesnac.RfidUpload.Common;
using SlnMesnac.RfidUpload.Model.config;
using SlnMesnac.RfidUpload.TouchSocket;
using System;
using System.Collections.Generic;
using SlnMesnac.RfidUpload.Model;
using SlnMesnac.RfidUpload.NLog;
using System.Reflection.Emit;
using System.Security.Cryptography;
using SlnMesnac.RfidUpload.Model.apiParam;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* 版权所有 (c) 2024 WenJY 保留所有权利。
* CLR版本4.0.30319.42000
* 机器名称T14-GEN3-7895
* 命名空间SlnMesnac.RfidUpload.Business
* 唯一标识1326b9fc-9ad1-4bd7-883a-32a01ab38cb1
*
* 创建者WenJY
* 电子邮箱:
* 创建时间2024-12-06 14:21:17
* 版本V1.0.0
* 描述:
*
*--------------------------------------------------------------------
* 修改人:
* 时间:
* 修改说明:
*
* 版本V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace SlnMesnac.RfidUpload.Business
{
public class CsbHandleBusiness
{
private static readonly Lazy<CsbHandleBusiness> _lazy = new Lazy<CsbHandleBusiness>(() => new CsbHandleBusiness());
public static CsbHandleBusiness Instance
{
get
{
return _lazy.Value;
}
}
private CsbHandleBusiness() { }
private AppConfig appConfig = AppConfig.Instance;
private WebApiClientApp webApiClientApp = WebApiClientApp.Instance;
private LogHelper logHelper = LogHelper.Instance;
private JsonChange jsonChange = JsonChange.Instance;
private static INIFile iNIFile = new INIFile(System.Environment.CurrentDirectory + "/App.InI");
/// <summary>
/// 容器指定封发扫描接口
/// </summary>
public void getScanInfoAppointRfidByCSB(string rqtm)
{
try
{
JObject jsonObject = new JObject
{
["code"] = 101,
["requestURL"] = appConfig.requestURL,
["sysCode"] = appConfig.sysCode,
["password"] = appConfig.password,
["ak"] = appConfig.ak,
["sk"] = appConfig.sk,
["containerRegisterQuery"] = new JObject
{
["opOrgCode"] = iNIFile.IniReadValue("ContainerRegisterQuery", "opOrgCode"),
["opOrgName"] = iNIFile.IniReadValue("ContainerRegisterQuery", "opOrgName"),
["userCode"] = iNIFile.IniReadValue("ContainerRegisterQuery", "userCode"),
["userName"] = iNIFile.IniReadValue("ContainerRegisterQuery", "userName"),
["provice"] = iNIFile.IniReadValue("ContainerRegisterQuery", "provice"),
["rqzlmc"] = iNIFile.IniReadValue("ContainerRegisterQuery", "rqzlmc"),
["zbid"] = iNIFile.IniReadValue("ContainerRegisterQuery", "zbid"),
["destinationOrgName"] = iNIFile.IniReadValue("ContainerRegisterQuery", "destinationOrgName"),
["destinationOrgCode"] = iNIFile.IniReadValue("ContainerRegisterQuery", "destinationOrgCode"),
["rqzl"] = iNIFile.IniReadValue("ContainerRegisterQuery", "rqzl"),
["rqxh"] = iNIFile.IniReadValue("ContainerRegisterQuery", "rqxh"),
["rqxhmc"] = iNIFile.IniReadValue("ContainerRegisterQuery", "rqxhmc"),
["rqtm"] = rqtm,
}
};
string jsonString = jsonObject.ToString();
var str = webApiClientApp.UploadAsync(jsonString);
CsbResult res = JsonConvert.DeserializeObject<CsbResult>(str);
logHelper.Info($"容器指定封发扫描接口返回信息:{jsonChange.ModeToJson(res)}");
}
catch (Exception ex)
{
logHelper.Error($"容器指定封发扫描接口处理异常:{ex.Message}", ex);
}
}
/// <summary>
/// 容器入库接口
/// </summary>
public CsbResult scanAnyContainerCodeByCsb(string rqtm)
{
CsbResult res = new CsbResult();
try
{
JObject jsonObject = new JObject
{
["code"] = 102,
["requestURL"] = appConfig.requestURL,
["sysCode"] = appConfig.sysCode,
["password"] = appConfig.password,
["ak"] = appConfig.ak,
["sk"] = appConfig.sk,
["batchOpenQuery"] = new JObject
{
["opOrgCode"] = iNIFile.IniReadValue("batchOpenQuery", "opOrgCode"),
["userCode"] = iNIFile.IniReadValue("batchOpenQuery", "userCode"),
["userName"] = iNIFile.IniReadValue("batchOpenQuery", "userName"),
["provice"] = iNIFile.IniReadValue("batchOpenQuery", "provice"),
["rqtm"] = rqtm,
["devicedId"] = iNIFile.IniReadValue("batchOpenQuery", "zbid"),
}
};
string jsonString = jsonObject.ToString();
var str = webApiClientApp.UploadAsync(jsonString);
res = JsonConvert.DeserializeObject<CsbResult>(str);
logHelper.Info($"容器入库接口返回信息:{jsonChange.ModeToJson(res)}");
return res;
}
catch (Exception ex)
{
logHelper.Error($"容器入库接口处理异常:{ex.Message}", ex);
res.status = "500";
res.msg = $"新容器入库接口处理异常:{ex.Message}";
return res;
}
}
/// <summary>
/// 新容器入库-调拨单号验证接口
/// </summary>
public CsbResult containerStorageQueryByCsb(string dbbh,string rqtmStart,string rqtmEnd)
{
CsbResult res = new CsbResult();
try
{
JObject jsonObject = new JObject
{
["code"] = 103,
["requestURL"] = appConfig.requestURL,
["sysCode"] = appConfig.sysCode,
["password"] = appConfig.password,
["ak"] = appConfig.ak,
["sk"] = appConfig.sk,
["newContainerStorageQuery"] = new JObject
{
["opOrgCode"] = iNIFile.IniReadValue("newContainerStorageQuery", "opOrgCode"),
["dbbh"] = dbbh,
["devicedId"] = iNIFile.IniReadValue("newContainerStorageQuery", "userName"),
["rqtmSerialList"] = new JObject
{
["rqtmStart"] = rqtmStart,
["rqtmEnd"] = rqtmEnd,
},
}
};
string jsonString = jsonObject.ToString();
var str = webApiClientApp.UploadAsync(jsonString);
res = JsonConvert.DeserializeObject<CsbResult>(str);
logHelper.Info($"新容器入库-调拨单号验证接口返回信息:{jsonChange.ModeToJson(res)}");
}
catch (Exception ex)
{
logHelper.Error($"新容器入库-调拨单号验证接口处理异常:{ex.Message}", ex);
res.status = "500";
res.msg = $"新容器入库-调拨单号验证接口处理异常:{ex.Message}";
}
return res;
}
/// <summary>
/// 新容器入库-按送货单接收容器接口
/// </summary>
public void containerStorageBatchQueryByCsb(string trackNo,string batchNo,string rqtmList,string rqtmEnd)
{
try
{
JObject jsonObject = new JObject
{
["code"] = 103,
["requestURL"] = appConfig.requestURL,
["sysCode"] = appConfig.sysCode,
["password"] = appConfig.password,
["ak"] = appConfig.ak,
["sk"] = appConfig.sk,
["newContainerStorageBatchQuery"] = new JObject
{
["opOrgCode"] = iNIFile.IniReadValue("newContainerStorageBatchQuery", "opOrgCode"),
["trackNo"] = trackNo,
["devicedId"] = iNIFile.IniReadValue("newContainerStorageBatchQuery", "userName"),
["batchNo"] = batchNo,
["rqtmList"] = rqtmList,
["rqtmEnd"] = rqtmEnd,
}
};
string jsonString = jsonObject.ToString();
var str = webApiClientApp.UploadAsync(jsonString);
CsbResult res = JsonConvert.DeserializeObject<CsbResult>(str);
logHelper.Info($"新容器入库-按送货单接收容器接口返回信息:{jsonChange.ModeToJson(res)}");
}
catch (Exception ex)
{
logHelper.Error($"新容器入库-按送货单接收容器接口处理异常:{ex.Message}", ex);
}
}
/// <summary>
/// 6.6.新容器入库-按送货单反馈接收结果接口
/// </summary>
public void receContainerStorageByCsb(string trackNo,string msgType)
{
try
{
JObject jsonObject = new JObject
{
["code"] = 103,
["requestURL"] = appConfig.requestURL,
["sysCode"] = appConfig.sysCode,
["password"] = appConfig.password,
["ak"] = appConfig.ak,
["sk"] = appConfig.sk,
["newContainerStorageQuery"] = new JObject
{
["opOrgCode"] = iNIFile.IniReadValue("newContainerStorageQuery", "opOrgCode"),
["trackNo"] = trackNo,
["msgType"] = msgType,
}
};
string jsonString = jsonObject.ToString();
var str = webApiClientApp.UploadAsync(jsonString);
CsbResult res = JsonConvert.DeserializeObject<CsbResult>(str);
logHelper.Info($"新容器入库-按送货单反馈接收结果接口返回信息:{jsonChange.ModeToJson(res)}");
}
catch (Exception ex)
{
logHelper.Error($"新容器入库-按送货单反馈接收结果接口处理异常:{ex.Message}", ex);
}
}
/// <summary>
/// 容器封发-获取调拨单和封发计划
/// </summary>
public CsbResult transferOrderFfjhByCsb(string jsdw,string beginDate,string endDate)
{
CsbResult res = new CsbResult();
try
{
JObject jsonObject = new JObject
{
["code"] = 103,
["requestURL"] = appConfig.requestURL,
["sysCode"] = appConfig.sysCode,
["password"] = appConfig.password,
["ak"] = appConfig.ak,
["sk"] = appConfig.sk,
["TdjStockTransferOrderQuery"] = new JObject
{
["opOrgCode"] = iNIFile.IniReadValue("TdjStockTransferOrderQuery", "opOrgCode"),
["devicedId"] = iNIFile.IniReadValue("TdjStockTransferOrderQuery", "devicedId"),
["jsdw"] = jsdw,
["beginDate"] = beginDate,
["endDate"] = endDate,
}
};
string jsonString = jsonObject.ToString();
var str = webApiClientApp.UploadAsync(jsonString);
res = JsonConvert.DeserializeObject<CsbResult>(str);
logHelper.Info($"容器封发-获取调拨单和封发计划接口返回信息:{jsonChange.ModeToJson(res)}");
return res;
}
catch (Exception ex)
{
logHelper.Error($"容器封发-获取调拨单和封发计划接口处理异常:{ex.Message}", ex);
res.status = "500";
res.msg = $"容器封发-获取调拨单和封发计划接口处理异常:{ex.Message}";
return res;
}
}
/// <summary>
/// 容器封发-验证封发计划
/// </summary>
public CsbResult transferOrderFfjhCheckByCsb(string ffjhNo,string ffjhscrq)
{
CsbResult res = new CsbResult();
try
{
JObject jsonObject = new JObject
{
["code"] = 103,
["requestURL"] = appConfig.requestURL,
["sysCode"] = appConfig.sysCode,
["password"] = appConfig.password,
["ak"] = appConfig.ak,
["sk"] = appConfig.sk,
["TdjStockTransferOrderffjhCheckQuery"] = new JObject
{
["opOrgCode"] = iNIFile.IniReadValue("TdjStockTransferOrderffjhCheckQuery", "opOrgCode"),
["devicedId"] = iNIFile.IniReadValue("TdjStockTransferOrderffjhCheckQuery", "devicedId"),
["ffjhNo"] = ffjhNo,
["ffjhscrq"] = ffjhscrq,
}
};
string jsonString = jsonObject.ToString();
var str = webApiClientApp.UploadAsync(jsonString);
res = JsonConvert.DeserializeObject<CsbResult>(str);
logHelper.Info($"容器封发-验证封发计划接口返回信息:{jsonChange.ModeToJson(res)}");
return res;
}
catch (Exception ex)
{
logHelper.Error($"容器封发-验证封发计划接口处理异常:{ex.Message}", ex);
res.msg = "500";
res.msg = $"容器封发-验证封发计划接口处理异常:{ex.Message}";
return res;
}
}
/// <summary>
/// 容器封发-接收容器条码
/// </summary>
public CsbResult containerScanSealByCsb(string ffjhNo,string opBatch,string ffjhscrq,string batchNo,string rqtmList)
{
CsbResult res = new CsbResult();
try
{
JObject jsonObject = new JObject
{
["code"] = 103,
["requestURL"] = appConfig.requestURL,
["sysCode"] = appConfig.sysCode,
["password"] = appConfig.password,
["ak"] = appConfig.ak,
["sk"] = appConfig.sk,
["TdjContainerScanSealQuery"] = new JObject
{
["opOrgCode"] = iNIFile.IniReadValue("TdjContainerScanSealQuery", "opOrgCode"),
["devicedId"] = iNIFile.IniReadValue("TdjContainerScanSealQuery", "devicedId"),
["shopCode"] = iNIFile.IniReadValue("TdjContainerScanSealQuery", "shopCode"),
["ffjhNo"] = ffjhNo,
["turnFlag"] = 1,
["opBatch"] = opBatch,
["ffjhscrq"] = ffjhscrq,
["batchNo"] = batchNo,
["rqtmList"] = rqtmList,
}
};
string jsonString = jsonObject.ToString();
var str = webApiClientApp.UploadAsync(jsonString);
res = JsonConvert.DeserializeObject<CsbResult>(str);
logHelper.Info($"容器封发-接收容器条码接口返回信息:{jsonChange.ModeToJson(res)}");
return res;
}
catch (Exception ex)
{
logHelper.Error($"容器封发-接收容器条码接口处理异常:{ex.Message}", ex);
res.status = "500";
res.msg = $"容器封发-接收容器条码接口处理异常:{ex.Message}";
return res;
}
}
/// <summary>
/// 容器封发-反馈接收结果
/// </summary>
public CsbResult containerScanSealResultByCsb(string ffjhNo,string opBatch)
{
CsbResult res = new CsbResult();
try
{
JObject jsonObject = new JObject
{
["code"] = 103,
["requestURL"] = appConfig.requestURL,
["sysCode"] = appConfig.sysCode,
["password"] = appConfig.password,
["ak"] = appConfig.ak,
["sk"] = appConfig.sk,
["TdjContainerScanSealQuery"] = new JObject
{
["opOrgCode"] = iNIFile.IniReadValue("TdjContainerScanSealQuery", "opOrgCode"),
["ffjhNo"] = ffjhNo,
["opBatch"] = opBatch,
}
};
string jsonString = jsonObject.ToString();
var str = webApiClientApp.UploadAsync(jsonString);
res = JsonConvert.DeserializeObject<CsbResult>(str);
logHelper.Info($"容器封发-反馈接收结果接口返回信息:{jsonChange.ModeToJson(res)}");
return res;
}
catch (Exception ex)
{
logHelper.Error($"容器封发-反馈接收结果接口处理异常:{ex.Message}", ex);
res.msg = $"容器封发-反馈接收结果接口处理异常:{ex.Message}";
res.status = "500";
return res;
}
}
/// <summary>
/// 容器直连配发-获取邮路卸交站
/// </summary>
public void findStationSequenceByCsb(string ffjhNo,string opBatch)
{
try
{
JObject jsonObject = new JObject
{
["code"] = 103,
["requestURL"] = appConfig.requestURL,
["sysCode"] = appConfig.sysCode,
["password"] = appConfig.password,
["ak"] = appConfig.ak,
["sk"] = appConfig.sk,
["TdjContainerAllotQuery"] = new JObject
{
["opOrgCode"] = iNIFile.IniReadValue("TdjContainerAllotQuery", "opOrgCode"),
["devicedId"] = iNIFile.IniReadValue("TdjContainerAllotQuery", "devicedId"),
["shopCode"] = iNIFile.IniReadValue("TdjContainerAllotQuery", "shopCode"),
["routeCode"] = iNIFile.IniReadValue("TdjContainerAllotQuery", "routeCode"),
["ffjhNo"] = ffjhNo,
["opBatch"] = opBatch,
}
};
string jsonString = jsonObject.ToString();
var str = webApiClientApp.UploadAsync(jsonString);
CsbResult res = JsonConvert.DeserializeObject<CsbResult>(str);
logHelper.Info($"容器直连配发-获取邮路卸交站接口返回信息:{jsonChange.ModeToJson(res)}");
}
catch (Exception ex)
{
logHelper.Error($"容器直连配发-获取邮路卸交站接口处理异常:{ex.Message}", ex);
}
}
/// <summary>
/// 容器直连配发-校验发运计划
/// </summary>
public void tranPlanCheckByCsb(string ffjhNo,string opBatch,string stationOrgCode,string stationOrgName)
{
try
{
JObject jsonObject = new JObject
{
["code"] = 103,
["requestURL"] = appConfig.requestURL,
["sysCode"] = appConfig.sysCode,
["password"] = appConfig.password,
["ak"] = appConfig.ak,
["sk"] = appConfig.sk,
["TdjContainerAllotQuery"] = new JObject
{
["opOrgCode"] = iNIFile.IniReadValue("TdjContainerAllotQuery", "opOrgCode"),
["devicedId"] = iNIFile.IniReadValue("TdjContainerAllotQuery", "devicedId"),
["shopCode"] = iNIFile.IniReadValue("TdjContainerAllotQuery", "shopCode"),
["routeCode"] = iNIFile.IniReadValue("TdjContainerAllotQuery", "routeCode"),
["ffjhNo"] = ffjhNo,
["opBatch"] = opBatch,
["areaCode"] = iNIFile.IniReadValue("TdjContainerAllotQuery", "shopName"),
["shopName"] = iNIFile.IniReadValue("TdjContainerAllotQuery", "shopName"),
["stationOrgCode"] = stationOrgCode,
["stationOrgName"] = stationOrgName,
}
};
string jsonString = jsonObject.ToString();
var str = webApiClientApp.UploadAsync(jsonString);
CsbResult res = JsonConvert.DeserializeObject<CsbResult>(str);
logHelper.Info($"容器直连配发-校验发运计划接口返回信息:{jsonChange.ModeToJson(res)}");
}
catch (Exception ex)
{
logHelper.Error($"容器直连配发-校验发运计划接口处理异常:{ex.Message}", ex);
}
}
/// <summary>
/// 容器直连配发-开始配发
/// </summary>
public void containerAllotByCsb(string ffjhNo,string opBatch)
{
try
{
JObject jsonObject = new JObject
{
["code"] = 103,
["requestURL"] = appConfig.requestURL,
["sysCode"] = appConfig.sysCode,
["password"] = appConfig.password,
["ak"] = appConfig.ak,
["sk"] = appConfig.sk,
["TdjContainerAllotQuery"] = new JObject
{
["opOrgCode"] = iNIFile.IniReadValue("TdjContainerAllotQuery", "opOrgCode"),
["devicedId"] = iNIFile.IniReadValue("TdjContainerAllotQuery", "devicedId"),
["shopCode"] = iNIFile.IniReadValue("TdjContainerAllotQuery", "shopCode"),
["ffjhNo"] = ffjhNo,
["opBatch"] = opBatch,
["userCode"] = iNIFile.IniReadValue("TdjContainerAllotQuery", "userCode"),
["userName"] = iNIFile.IniReadValue("TdjContainerAllotQuery", "userName"),
["groupCode"] = iNIFile.IniReadValue("TdjContainerAllotQuery", "groupCode"),
["groupName"] = iNIFile.IniReadValue("TdjContainerAllotQuery", "groupName"),
}
};
string jsonString = jsonObject.ToString();
var str = webApiClientApp.UploadAsync(jsonString);
CsbResult res = JsonConvert.DeserializeObject<CsbResult>(str);
logHelper.Info($"容器直连配发-开始配发接口返回信息:{jsonChange.ModeToJson(res)}");
}
catch (Exception ex)
{
logHelper.Error($"容器直连配发-开始配发接口处理异常:{ex.Message}", ex);
}
}
/// <summary>
/// 容器直连配发-反馈接收结果
/// </summary>
public void containerAllotResultByCsb(string ffjhNo,string opBatch)
{
try
{
JObject jsonObject = new JObject
{
["code"] = 103,
["requestURL"] = appConfig.requestURL,
["sysCode"] = appConfig.sysCode,
["password"] = appConfig.password,
["ak"] = appConfig.ak,
["sk"] = appConfig.sk,
["TdjContainerAllotQuery"] = new JObject
{
["opOrgCode"] = iNIFile.IniReadValue("TdjContainerAllotQuery", "opOrgCode"),
["ffjhNo"] = ffjhNo,
["opBatch"] = opBatch,
}
};
string jsonString = jsonObject.ToString();
var str = webApiClientApp.UploadAsync(jsonString);
CsbResult res = JsonConvert.DeserializeObject<CsbResult>(str);
logHelper.Info($"容器直连配发-反馈接收结果接口返回信息:{jsonChange.ModeToJson(res)}");
}
catch (Exception ex)
{
logHelper.Error($"容器直连配发-反馈接收结果接口处理异常:{ex.Message}", ex);
}
}
}
}