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 _lazy = new Lazy(() => 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; public static INIFile iNIFile = new INIFile(System.Environment.CurrentDirectory + "/App.InI"); /// /// 容器指定封发扫描接口 /// 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, ["apiName"] = "getScanInfoAppointRfidByCSB", ["paramName"] = "containerRegisterQuery", ["containerRegisterQuery"] = new JObject { ["opOrgCode"] = appConfig.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"] = appConfig.devicedId, ["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(str); } catch (Exception ex) { logHelper.Error($"容器指定封发扫描接口处理异常:{ex.Message}", ex); } } /// /// 容器入库接口 /// public CsbResult scanAnyContainerCodeByCsb(string rqtm) { CsbResult res = new CsbResult(); try { var jsonObject = new JObject { ["opOrgCode"] = appConfig.opOrgCode, ["userCode"] = iNIFile.IniReadValue("batchOpenQuery", "userCode"), ["userName"] = iNIFile.IniReadValue("batchOpenQuery", "userName"), ["provice"] = iNIFile.IniReadValue("batchOpenQuery", "provice"), ["rqtm"] = rqtm, ["devicedId"] = appConfig.devicedId, }; string jsonString = jsonObject.ToString(); var str = webApiClientApp.UploadAsync("scanAnyContainerCodeByCsb", "batchOpenQuery", jsonString, "容器入库"); res = JsonConvert.DeserializeObject(str); return res; } catch (Exception ex) { logHelper.Error($"容器入库接口处理异常:{ex.Message}", ex); res.message= $"新容器入库接口处理异常:{ex.Message}"; return res; } } /// /// 新容器入库-调拨单号验证接口 /// public CsbResult containerStorageQueryByCsb(string dbbh, string rqtmStart, string rqtmEnd) { CsbResult res = new CsbResult(); try { var jsonObject = new JObject { ["opOrgCode"] = appConfig.opOrgCode, ["dbbh"] = dbbh, ["devicedId"] = iNIFile.IniReadValue("SystemConfig", "devicedId"), ["rqtmSerialList"] =new JArray(new JObject { ["rqtmStart"] = rqtmStart, ["rqtmEnd"] = rqtmEnd, }) , }; string jsonString = jsonObject.ToString(); var str = webApiClientApp.UploadAsync("containerStorageQueryByCsb", "newContainerStorageQuery", jsonString, "新容器入库-调拨单号验证接口"); res = JsonConvert.DeserializeObject(str); } catch (Exception ex) { logHelper.Error($"新容器入库-调拨单号验证接口处理异常:{ex.Message}", ex); //res.status = "500"; res.message= $"新容器入库-调拨单号验证接口处理异常:{ex.Message}"; } return res; } /// /// 新容器入库-按送货单接收容器接口 /// public CsbResult containerStorageBatchQueryByCsb(string trackNo, string batchNo, List rqtmList) { CsbResult res = new CsbResult(); try { var jsonObject = new JObject { ["opOrgCode"] = appConfig.opOrgCode, ["trackNo"] = trackNo, ["batchNo"] = batchNo, ["devicedId"] = appConfig.devicedId, ["rqtmList"] = JArray.FromObject(rqtmList), // ["rqtmEnd"] = rqtmEnd, }; string jsonString = jsonObject.ToString(); var str = webApiClientApp.UploadAsync("containerStorageBatchQueryByCsb", "newContainerStorageBatchQuery", jsonString, "新容器入库-按送货单接收容器接口"); res = JsonConvert.DeserializeObject(str); return res; } catch (Exception ex) { logHelper.Error($"新容器入库-按送货单接收容器接口处理异常:{ex.Message}", ex); return res; } } /// /// 6.6.新容器入库-按送货单反馈接收结果接口 /// public CsbResult receContainerStorageByCsb(string trackNo, string msgType) { CsbResult res = new CsbResult(); try { var jsonObject = new JObject { ["opOrgCode"] = appConfig.opOrgCode, ["trackNo"] = trackNo, ["msgType"] = msgType, }; string jsonString = jsonObject.ToString(); var str = webApiClientApp.UploadAsync("receContainerStorageByCsb", "newContainerStorageQuery", jsonString, "新容器入库-按送货单反馈接收结果接口"); res = JsonConvert.DeserializeObject(str); return res; } catch (Exception ex) { logHelper.Error($"新容器入库-按送货单反馈接收结果接口处理异常:{ex.Message}", ex); return res; } } /// /// 容器封发-获取调拨单和封发计划 /// public CsbResult transferOrderFfjhByCsb(string jsdw, string beginDate, string endDate) { CsbResult res = new CsbResult(); try { var jsonObject = new JObject { ["opOrgCode"] = appConfig.opOrgCode, ["devicedId"] = appConfig.devicedId, ["jsdw"] = jsdw, ["beginDate"] = beginDate, ["endDate"] = endDate, }; string jsonString = jsonObject.ToString(); var str = webApiClientApp.UploadAsync("transferOrderFfjhByCsb", "TdjStockTransferOrderQuery", jsonString, "容器封发-获取调拨单和封发计划"); res = JsonConvert.DeserializeObject(str); return res; } catch (Exception ex) { logHelper.Error($"容器封发-获取调拨单和封发计划接口处理异常:{ex.Message}", ex); // res.status = "500"; res.message= $"容器封发-获取调拨单和封发计划接口处理异常:{ex.Message}"; return res; } } /// /// 容器封发-验证封发计划 /// public CsbResult transferOrderFfjhCheckByCsb(string ffjhNo, string ffjhscrq) { CsbResult res = new CsbResult(); try { var jsonObject = new JObject { ["opOrgCode"] = appConfig.opOrgCode, ["devicedId"] = appConfig.devicedId, ["ffjhNo"] = ffjhNo, ["ffjhscrq"] = ffjhscrq, }; string jsonString = jsonObject.ToString(); var str = webApiClientApp.UploadAsync("transferOrderFfjhCheckByCsb", "TdjStockTransferOrderffjhCheckQuery", jsonString, " 容器封发-验证封发计划"); res = JsonConvert.DeserializeObject(str); return res; } catch (Exception ex) { logHelper.Error($"容器封发-验证封发计划接口处理异常:{ex.Message}", ex); // res.code = "500"; res.message= $"容器封发-验证封发计划接口处理异常:{ex.Message}"; return res; } } /// /// 容器封发-接收容器条码 /// public CsbResult containerScanSealByCsb(string ffjhNo, string opBatch, string ffjhscrq, string batchNo, List rqtmList) { CsbResult res = new CsbResult(); try { var jsonObject = new JObject { ["opOrgCode"] = appConfig.opOrgCode, ["devicedId"] = appConfig.devicedId, ["shopCode"] = iNIFile.IniReadValue("TdjContainerScanSealQuery", "shopCode"), ["ffjhNo"] = ffjhNo, ["turnFlag"] = 1, ["opBatch"] = opBatch, ["ffjhscrq"] = ffjhscrq, ["batchNo"] = batchNo, ["rqtmList"] = JArray.FromObject(rqtmList), }; string jsonString = jsonObject.ToString(); var str = webApiClientApp.UploadAsync("containerScanSealByCsb", "TdjContainerScanSealQuery", jsonString, "容器封发-接收容器条码"); res = JsonConvert.DeserializeObject(str); return res; } catch (Exception ex) { logHelper.Error($"容器封发-接收容器条码接口处理异常:{ex.Message}", ex); //res.status = "500"; res.message= $"容器封发-接收容器条码接口处理异常:{ex.Message}"; return res; } } /// /// 容器封发-反馈接收结果 /// public CsbResult containerScanSealResultByCsb(string ffjhNo, string opBatch) { CsbResult res = new CsbResult(); try { var jsonObject = new JObject { ["opOrgCode"] = appConfig.opOrgCode, ["ffjhNo"] = ffjhNo, ["opBatch"] = opBatch, }; string jsonString = jsonObject.ToString(); var str = webApiClientApp.UploadAsync("containerScanSealResultByCsb", "TdjContainerScanSealQuery", jsonString, "容器封发-反馈接收结果"); res = JsonConvert.DeserializeObject(str); return res; } catch (Exception ex) { logHelper.Error($"容器封发-反馈接收结果接口处理异常:{ex.Message}", ex); res.message= $"容器封发-反馈接收结果接口处理异常:{ex.Message}"; //res.status = "500"; return res; } } /// /// 容器直连配发-获取邮路卸交站 /// public CsbResult findStationSequenceByCsb(string ffjhNo, string opBatch) { CsbResult res = new CsbResult(); try { var jsonObject = new JObject { ["opOrgCode"] = appConfig.opOrgCode, ["devicedId"] = appConfig.devicedId, ["shopCode"] = iNIFile.IniReadValue("TdjContainerAllotQuery", "shopCode"), ["routeCode"] = iNIFile.IniReadValue("TdjContainerAllotQuery", "routeCode"), ["ffjhNo"] = ffjhNo, ["opBatch"] = opBatch, }; string jsonString = jsonObject.ToString(); var str = webApiClientApp.UploadAsync("findStationSequenceByCsb", "TdjContainerAllotQuery", jsonString, " 容器直连配发-获取邮路卸交站"); res = JsonConvert.DeserializeObject(str); return res; } catch (Exception ex) { logHelper.Error($"容器直连配发-获取邮路卸交站接口处理异常:{ex.Message}", ex); res.message = $"容器直连配发-获取邮路卸交站接口处理异常:{ex.Message}"; // res.code = "500"; return res; } } /// /// 容器直连配发-校验发运计划 /// public CsbResult tranPlanCheckByCsb(string ffjhNo, string opBatch, string stationOrgCode, string stationOrgName) { CsbResult res = new CsbResult(); try { var jsonObject = new JObject { ["opOrgCode"] = appConfig.opOrgCode, ["devicedId"] = appConfig.devicedId, ["shopCode"] = iNIFile.IniReadValue("TdjContainerAllotQuery", "shopCode"), ["routeCode"] = iNIFile.IniReadValue("TdjContainerAllotQuery", "routeCode"), ["ffjhNo"] = ffjhNo, ["opBatch"] = opBatch, ["areaCode"] = iNIFile.IniReadValue("TdjContainerAllotQuery", "areaCode"), ["shopName"] = iNIFile.IniReadValue("TdjContainerAllotQuery", "shopName"), ["stationOrgCode"] = stationOrgCode, ["stationOrgName"] = stationOrgName, }; string jsonString = jsonObject.ToString(); var str = webApiClientApp.UploadAsync("tranPlanCheckByCsb", "TdjContainerAllotQuery", jsonString, "容器直连配发-校验发运计划"); res = JsonConvert.DeserializeObject(str); return res; } catch (Exception ex) { logHelper.Error($"容器直连配发-校验发运计划接口处理异常:{ex.Message}", ex); res.message = $"容器直连配发-校验发运计划接口处理异常:{ex.Message}"; // res.code = "500"; return res; } } /// /// 容器直连配发-开始配发 /// public CsbResult containerAllotByCsb(string ffjhNo, string opBatch) { CsbResult res = new CsbResult(); try { var jsonObject = new JObject { ["opOrgCode"] = appConfig.opOrgCode, ["devicedId"] = appConfig.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("containerAllotByCsb", "TdjContainerAllotQuery", jsonString, "容器直连配发-开始配发"); res = JsonConvert.DeserializeObject(str); return res; } catch (Exception ex) { logHelper.Error($"容器直连配发-开始配发接口处理异常:{ex.Message}", ex); res.message = $"容器直连配发-开始配发接口处理异常:{ex.Message}"; // res.code = "500"; return res; } } /// /// 容器直连配发-反馈接收结果 /// public CsbResult containerAllotResultByCsb(string ffjhNo, string opBatch) { CsbResult res = new CsbResult(); try { var jsonObject = new JObject { ["opOrgCode"] = appConfig.opOrgCode, ["ffjhNo"] = ffjhNo, ["opBatch"] = opBatch, }; string jsonString = jsonObject.ToString(); var str = webApiClientApp.UploadAsync("containerAllotResultByCsb", "TdjContainerAllotQuery", jsonString, "容器直连配发-反馈接收结果"); res = JsonConvert.DeserializeObject(str); return res; } catch (Exception ex) { logHelper.Error($"容器直连配发-反馈接收结果接口处理异常:{ex.Message}", ex); res.message = $"容器直连配发-反馈接收结果接口处理异常:{ex.Message}"; // res.code = "500"; return res; } } } }