diff --git a/SlnMesnac.RfidUpload.Business/CsbHandleBusiness.cs b/SlnMesnac.RfidUpload.Business/CsbHandleBusiness.cs index a11cc8d..cd43a9e 100644 --- a/SlnMesnac.RfidUpload.Business/CsbHandleBusiness.cs +++ b/SlnMesnac.RfidUpload.Business/CsbHandleBusiness.cs @@ -53,7 +53,7 @@ namespace SlnMesnac.RfidUpload.Business 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"); + public static INIFile iNIFile = new INIFile(System.Environment.CurrentDirectory + "/App.InI"); /// /// 容器指定封发扫描接口 @@ -70,6 +70,8 @@ namespace SlnMesnac.RfidUpload.Business ["password"] = appConfig.password, ["ak"] = appConfig.ak, ["sk"] = appConfig.sk, + ["apiName"] = "getScanInfoAppointRfidByCSB", + ["paramName"] = "containerRegisterQuery", ["containerRegisterQuery"] = new JObject { ["opOrgCode"] = iNIFile.IniReadValue("ContainerRegisterQuery", "opOrgCode"), @@ -106,28 +108,18 @@ namespace SlnMesnac.RfidUpload.Business CsbResult res = new CsbResult(); try { - - JObject jsonObject = new JObject + var 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"), - - } + ["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", "devicedId"), + }; string jsonString = jsonObject.ToString(); - var str = webApiClientApp.UploadAsync(jsonString); + var str = webApiClientApp.UploadAsync("scanAnyContainerCodeByCsb", "batchOpenQuery", jsonString); res = JsonConvert.DeserializeObject(str); logHelper.Info($"容器入库接口返回信息:{jsonChange.ModeToJson(res)}"); return res; @@ -136,7 +128,7 @@ namespace SlnMesnac.RfidUpload.Business { logHelper.Error($"容器入库接口处理异常:{ex.Message}", ex); res.status = "500"; - res.msg = $"新容器入库接口处理异常:{ex.Message}"; + res.message= $"新容器入库接口处理异常:{ex.Message}"; return res; } } @@ -144,34 +136,25 @@ namespace SlnMesnac.RfidUpload.Business /// /// 新容器入库-调拨单号验证接口 /// - public CsbResult containerStorageQueryByCsb(string dbbh,string rqtmStart,string rqtmEnd) + public CsbResult containerStorageQueryByCsb(string dbbh, string rqtmStart, string rqtmEnd) { CsbResult res = new CsbResult(); try { - JObject jsonObject = new JObject + var 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 { - ["opOrgCode"] = iNIFile.IniReadValue("newContainerStorageQuery", "opOrgCode"), - ["dbbh"] = dbbh, - ["devicedId"] = iNIFile.IniReadValue("newContainerStorageQuery", "userName"), - ["rqtmSerialList"] = new JObject - { - ["rqtmStart"] = rqtmStart, - ["rqtmEnd"] = rqtmEnd, - }, + ["rqtmStart"] = rqtmStart, + ["rqtmEnd"] = rqtmEnd, + }, - } }; string jsonString = jsonObject.ToString(); - var str = webApiClientApp.UploadAsync(jsonString); + var str = webApiClientApp.UploadAsync("containerStorageQueryByCsb", "newContainerStorageQuery", jsonString); res = JsonConvert.DeserializeObject(str); logHelper.Info($"新容器入库-调拨单号验证接口返回信息:{jsonChange.ModeToJson(res)}"); } @@ -179,7 +162,7 @@ namespace SlnMesnac.RfidUpload.Business { logHelper.Error($"新容器入库-调拨单号验证接口处理异常:{ex.Message}", ex); res.status = "500"; - res.msg = $"新容器入库-调拨单号验证接口处理异常:{ex.Message}"; + res.message= $"新容器入库-调拨单号验证接口处理异常:{ex.Message}"; } return res; @@ -188,30 +171,21 @@ namespace SlnMesnac.RfidUpload.Business /// /// 新容器入库-按送货单接收容器接口 /// - public void containerStorageBatchQueryByCsb(string trackNo,string batchNo,string rqtmList,string rqtmEnd) + public void containerStorageBatchQueryByCsb(string trackNo, string batchNo, string rqtmList, string rqtmEnd) { try { - JObject jsonObject = new JObject + var 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, - } + ["opOrgCode"] = iNIFile.IniReadValue("newContainerStorageBatchQuery", "opOrgCode"), + ["trackNo"] = trackNo, + ["devicedId"] = iNIFile.IniReadValue("newContainerStorageBatchQuery", "devicedId"), + ["batchNo"] = batchNo, + ["rqtmList"] = rqtmList, + ["rqtmEnd"] = rqtmEnd, }; string jsonString = jsonObject.ToString(); - var str = webApiClientApp.UploadAsync(jsonString); + var str = webApiClientApp.UploadAsync("containerStorageBatchQueryByCsb", "newContainerStorageBatchQuery", jsonString); CsbResult res = JsonConvert.DeserializeObject(str); logHelper.Info($"新容器入库-按送货单接收容器接口返回信息:{jsonChange.ModeToJson(res)}"); } @@ -224,27 +198,18 @@ namespace SlnMesnac.RfidUpload.Business /// /// 6.6.新容器入库-按送货单反馈接收结果接口 /// - public void receContainerStorageByCsb(string trackNo,string msgType) + public void receContainerStorageByCsb(string trackNo, string msgType) { try { - JObject jsonObject = new JObject + var 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, - } + ["opOrgCode"] = iNIFile.IniReadValue("newContainerStorageQuery", "opOrgCode"), + ["trackNo"] = trackNo, + ["msgType"] = msgType, }; string jsonString = jsonObject.ToString(); - var str = webApiClientApp.UploadAsync(jsonString); + var str = webApiClientApp.UploadAsync("receContainerStorageByCsb", "newContainerStorageQuery", jsonString); CsbResult res = JsonConvert.DeserializeObject(str); logHelper.Info($"新容器入库-按送货单反馈接收结果接口返回信息:{jsonChange.ModeToJson(res)}"); } @@ -256,31 +221,22 @@ namespace SlnMesnac.RfidUpload.Business /// /// 容器封发-获取调拨单和封发计划 /// - public CsbResult transferOrderFfjhByCsb(string jsdw,string beginDate,string endDate) + public CsbResult transferOrderFfjhByCsb(string jsdw, string beginDate, string endDate) { CsbResult res = new CsbResult(); try { - JObject jsonObject = new JObject + var 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, + ["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); + var str = webApiClientApp.UploadAsync("transferOrderFfjhByCsb", "TdjStockTransferOrderQuery", jsonString); res = JsonConvert.DeserializeObject(str); logHelper.Info($"容器封发-获取调拨单和封发计划接口返回信息:{jsonChange.ModeToJson(res)}"); return res; @@ -289,7 +245,7 @@ namespace SlnMesnac.RfidUpload.Business { logHelper.Error($"容器封发-获取调拨单和封发计划接口处理异常:{ex.Message}", ex); res.status = "500"; - res.msg = $"容器封发-获取调拨单和封发计划接口处理异常:{ex.Message}"; + res.message= $"容器封发-获取调拨单和封发计划接口处理异常:{ex.Message}"; return res; } } @@ -297,39 +253,30 @@ namespace SlnMesnac.RfidUpload.Business /// /// 容器封发-验证封发计划 /// - public CsbResult transferOrderFfjhCheckByCsb(string ffjhNo,string ffjhscrq) + public CsbResult transferOrderFfjhCheckByCsb(string ffjhNo, string ffjhscrq) { CsbResult res = new CsbResult(); try { - JObject jsonObject = new JObject + var 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, + ["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(str); + var str = webApiClientApp.UploadAsync("transferOrderFfjhCheckByCsb", "TdjStockTransferOrderffjhCheckQuery", jsonString); + res = JsonConvert.DeserializeObject(str); logHelper.Info($"容器封发-验证封发计划接口返回信息:{jsonChange.ModeToJson(res)}"); return res; } catch (Exception ex) { logHelper.Error($"容器封发-验证封发计划接口处理异常:{ex.Message}", ex); - res.msg = "500"; - res.msg = $"容器封发-验证封发计划接口处理异常:{ex.Message}"; + res.code = "500"; + res.message= $"容器封发-验证封发计划接口处理异常:{ex.Message}"; return res; } } @@ -337,35 +284,26 @@ namespace SlnMesnac.RfidUpload.Business /// /// 容器封发-接收容器条码 /// - public CsbResult containerScanSealByCsb(string ffjhNo,string opBatch,string ffjhscrq,string batchNo,string rqtmList) + public CsbResult containerScanSealByCsb(string ffjhNo, string opBatch, string ffjhscrq, string batchNo, string rqtmList) { CsbResult res = new CsbResult(); try { - JObject jsonObject = new JObject + var 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, + ["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); + var str = webApiClientApp.UploadAsync("containerScanSealByCsb", "TdjContainerScanSealQuery", jsonString); res = JsonConvert.DeserializeObject(str); logHelper.Info($"容器封发-接收容器条码接口返回信息:{jsonChange.ModeToJson(res)}"); return res; @@ -374,7 +312,7 @@ namespace SlnMesnac.RfidUpload.Business { logHelper.Error($"容器封发-接收容器条码接口处理异常:{ex.Message}", ex); res.status = "500"; - res.msg = $"容器封发-接收容器条码接口处理异常:{ex.Message}"; + res.message= $"容器封发-接收容器条码接口处理异常:{ex.Message}"; return res; } } @@ -382,29 +320,20 @@ namespace SlnMesnac.RfidUpload.Business /// /// 容器封发-反馈接收结果 /// - public CsbResult containerScanSealResultByCsb(string ffjhNo,string opBatch) + public CsbResult containerScanSealResultByCsb(string ffjhNo, string opBatch) { CsbResult res = new CsbResult(); try { - JObject jsonObject = new JObject + var 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, + ["opOrgCode"] = iNIFile.IniReadValue("TdjContainerScanSealQuery", "opOrgCode"), + ["ffjhNo"] = ffjhNo, + ["opBatch"] = opBatch, - } }; string jsonString = jsonObject.ToString(); - var str = webApiClientApp.UploadAsync(jsonString); + var str = webApiClientApp.UploadAsync("containerScanSealResultByCsb", "TdjContainerScanSealQuery", jsonString); res = JsonConvert.DeserializeObject(str); logHelper.Info($"容器封发-反馈接收结果接口返回信息:{jsonChange.ModeToJson(res)}"); return res; @@ -412,7 +341,7 @@ namespace SlnMesnac.RfidUpload.Business catch (Exception ex) { logHelper.Error($"容器封发-反馈接收结果接口处理异常:{ex.Message}", ex); - res.msg = $"容器封发-反馈接收结果接口处理异常:{ex.Message}"; + res.message= $"容器封发-反馈接收结果接口处理异常:{ex.Message}"; res.status = "500"; return res; } @@ -421,151 +350,136 @@ namespace SlnMesnac.RfidUpload.Business /// /// 容器直连配发-获取邮路卸交站 /// - public void findStationSequenceByCsb(string ffjhNo,string opBatch) + public CsbResult findStationSequenceByCsb(string ffjhNo, string opBatch) { + CsbResult res = new CsbResult(); try { - JObject jsonObject = new JObject + var 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, - } + ["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(str); + var str = webApiClientApp.UploadAsync("findStationSequenceByCsb", "TdjContainerAllotQuery", jsonString); + res = JsonConvert.DeserializeObject(str); logHelper.Info($"容器直连配发-获取邮路卸交站接口返回信息:{jsonChange.ModeToJson(res)}"); + return res; } catch (Exception ex) { logHelper.Error($"容器直连配发-获取邮路卸交站接口处理异常:{ex.Message}", ex); + res.message = $"容器直连配发-获取邮路卸交站接口处理异常:{ex.Message}"; + res.code = "500"; + return res; } } /// /// 容器直连配发-校验发运计划 /// - public void tranPlanCheckByCsb(string ffjhNo,string opBatch,string stationOrgCode,string stationOrgName) + public CsbResult tranPlanCheckByCsb(string ffjhNo, string opBatch, string stationOrgCode, string stationOrgName) { + CsbResult res = new CsbResult(); try { - JObject jsonObject = new JObject + var 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, + ["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", "areaCode"), + ["shopName"] = iNIFile.IniReadValue("TdjContainerAllotQuery", "shopName"), + ["stationOrgCode"] = stationOrgCode, + ["stationOrgName"] = stationOrgName, - } }; string jsonString = jsonObject.ToString(); - var str = webApiClientApp.UploadAsync(jsonString); - CsbResult res = JsonConvert.DeserializeObject(str); + var str = webApiClientApp.UploadAsync("tranPlanCheckByCsb", "TdjContainerAllotQuery", jsonString); + res = JsonConvert.DeserializeObject(str); logHelper.Info($"容器直连配发-校验发运计划接口返回信息:{jsonChange.ModeToJson(res)}"); + return res; } catch (Exception ex) { logHelper.Error($"容器直连配发-校验发运计划接口处理异常:{ex.Message}", ex); + res.message = $"容器直连配发-校验发运计划接口处理异常:{ex.Message}"; + res.code = "500"; + return res; } } /// /// 容器直连配发-开始配发 /// - public void containerAllotByCsb(string ffjhNo,string opBatch) + public CsbResult containerAllotByCsb(string ffjhNo, string opBatch) { + CsbResult res = new CsbResult(); try { - JObject jsonObject = new JObject + var 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"), + ["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(str); + var str = webApiClientApp.UploadAsync("containerAllotByCsb", "containerAllotByCsb", jsonString); + res = JsonConvert.DeserializeObject(str); logHelper.Info($"容器直连配发-开始配发接口返回信息:{jsonChange.ModeToJson(res)}"); + return res; } catch (Exception ex) { logHelper.Error($"容器直连配发-开始配发接口处理异常:{ex.Message}", ex); + res.message = $"容器直连配发-开始配发接口处理异常:{ex.Message}"; + res.code = "500"; + return res; } } /// /// 容器直连配发-反馈接收结果 /// - public void containerAllotResultByCsb(string ffjhNo,string opBatch) + public CsbResult containerAllotResultByCsb(string ffjhNo, string opBatch) { + + CsbResult res = new CsbResult(); try { - JObject jsonObject = new JObject + var 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, - - } + ["opOrgCode"] = iNIFile.IniReadValue("TdjContainerAllotQuery", "opOrgCode"), + ["ffjhNo"] = ffjhNo, + ["opBatch"] = opBatch, + }; string jsonString = jsonObject.ToString(); - var str = webApiClientApp.UploadAsync(jsonString); - CsbResult res = JsonConvert.DeserializeObject(str); + var str = webApiClientApp.UploadAsync("containerAllotResultByCsb", "TdjContainerAllotQuery", jsonString); + res = JsonConvert.DeserializeObject(str); logHelper.Info($"容器直连配发-反馈接收结果接口返回信息:{jsonChange.ModeToJson(res)}"); + return res; } catch (Exception ex) { logHelper.Error($"容器直连配发-反馈接收结果接口处理异常:{ex.Message}", ex); + res.message = $"容器直连配发-反馈接收结果接口处理异常:{ex.Message}"; + res.code = "500"; + return res; } } } diff --git a/SlnMesnac.RfidUpload.Model/ContainerInbound.cs b/SlnMesnac.RfidUpload.Model/ContainerInbound.cs index a85b18f..e69bb31 100644 --- a/SlnMesnac.RfidUpload.Model/ContainerInbound.cs +++ b/SlnMesnac.RfidUpload.Model/ContainerInbound.cs @@ -18,5 +18,9 @@ namespace SlnMesnac.RfidUpload.Model public string ak { get; set; } public string sk { get; set; } + + public string apiName { get; set; } + + public string paramName { get; set; } } } \ No newline at end of file diff --git a/SlnMesnac.RfidUpload.Model/apiParam/CsbResult.cs b/SlnMesnac.RfidUpload.Model/apiParam/CsbResult.cs index af0c05f..7a3a964 100644 --- a/SlnMesnac.RfidUpload.Model/apiParam/CsbResult.cs +++ b/SlnMesnac.RfidUpload.Model/apiParam/CsbResult.cs @@ -33,5 +33,9 @@ namespace SlnMesnac.RfidUpload.Model.apiParam public string msg { get; set; } public List @object { get; set; } + + public string code { get; set; } + public string csbCode { get; set; } + public string message { get; set; } } } diff --git a/SlnMesnac.RfidUpload.TouchSocket/WebApiClientApp.cs b/SlnMesnac.RfidUpload.TouchSocket/WebApiClientApp.cs index 8edd8dd..7c7a4ae 100644 --- a/SlnMesnac.RfidUpload.TouchSocket/WebApiClientApp.cs +++ b/SlnMesnac.RfidUpload.TouchSocket/WebApiClientApp.cs @@ -75,6 +75,41 @@ namespace SlnMesnac.RfidUpload.TouchSocket return result; } + + public string UploadAsync(string apiName, string paramName, string paramStr) + { + string result = string.Empty; + try + { + + //logger.Info($"请求CSB接口调用服务,参数:{paramStr}"); + ContainerInbound container = new ContainerInbound + { + code = 103, + requestURL = appConfig.requestURL, + sysCode = appConfig.sysCode, + password = appConfig.password, + ak = appConfig.ak, + sk = appConfig.sk, + apiName = apiName, + paramName = paramName, + containerRegisterQuery = paramStr + }; + var str = jsonChange.ModeToJson(container); + logger.Info($"请求CSB接口调用服务,参数:{str}"); + result = Post("http://127.0.0.1:9090/api/uploadCsb", container); + logger.Info($"CSB接口返回信息:{result}"); + } + catch (Exception e) + { + Console.WriteLine(e.Message); + result = e.Message; + logger.Info($"请求CSB接口调用服务异常:{e.Message}"); + } + return result; + } + + public string UploadAsync(string paramStr) { string result = string.Empty; diff --git a/SlnMesnac.RfidUpload.UI/ContainerTransferOrderWindow.xaml b/SlnMesnac.RfidUpload.UI/ContainerTransferOrderWindow.xaml new file mode 100644 index 0000000..64c8e25 --- /dev/null +++ b/SlnMesnac.RfidUpload.UI/ContainerTransferOrderWindow.xaml @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +