From fa9cbd561d5a2d4198953766838b41cb13e7f771 Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Tue, 26 Mar 2024 15:36:46 +0800 Subject: [PATCH 01/12] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A9=AC=E5=A3=AB?= =?UTF-8?q?=E5=9F=BAAPI=E8=AE=A2=E8=88=B1=E7=9A=84=E5=8F=B0=E8=B4=A6?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/BookingOrder/BookingMSKAPIService.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Myshipping.Application/Service/BookingOrder/BookingMSKAPIService.cs b/Myshipping.Application/Service/BookingOrder/BookingMSKAPIService.cs index 964ea006..8f45c343 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingMSKAPIService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingMSKAPIService.cs @@ -990,17 +990,16 @@ namespace Myshipping.Application.Service.BookingOrder //菜单375504048771141=我的任务台账 List userlist = await _sysDataUserMenuService.GetDataScopeList(MenuConst.MenuMSKApi); - if (userlist == null) - userlist = new List { UserManager.UserId }; - if (userlist.Count > 0) + { + userlist.Add(UserManager.UserId); userlist = userlist.Distinct().ToList(); + } _logger.LogInformation("任务台账权限范围 {list}", userlist); - var entities = await _bookingDeliveryRecordRep.AsQueryable() - .Where(t => userlist.Contains(t.CreatedUserId.Value)) + .Where(t => userlist == null || (userlist.Count > 0 && userlist.Contains(t.CreatedUserId.Value))) .WhereIF(createBegin != DateTime.MinValue, t => t.CreatedTime.HasValue && t.CreatedTime.Value >= createBegin) .WhereIF(createEnd != DateTime.MinValue, t => t.CreatedTime.HasValue && t.CreatedTime.Value < createEnd) .WhereIF(updateBegin != DateTime.MinValue, t => t.UpdatedTime.HasValue && t.UpdatedTime.Value >= updateBegin) @@ -1296,6 +1295,7 @@ namespace Myshipping.Application.Service.BookingOrder /// /// 马士基API订舱ID组 /// 返回执行结果消息 + [HttpPost("/BookingMSKAPI/BatchSend")] public async Task BatchSend(long[] ids) { var list = await _bookingDeliveryRecordRep.AsQueryable() @@ -1316,6 +1316,7 @@ namespace Myshipping.Application.Service.BookingOrder /// 马士基API订舱ID /// 需要复制生成记录 /// 返回执行结果消息 + [HttpGet("/BookingMSKAPI/BatchSend")] public async Task BatchCopy(long id, int copyNum) { From bf90e142f253bb991844ac4b7bd44bd4bcadd56c Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Tue, 26 Mar 2024 16:17:07 +0800 Subject: [PATCH 02/12] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/TaskManagePlat/TaskManageService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs index a42cd1b4..7b7c243a 100644 --- a/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs @@ -1290,7 +1290,7 @@ namespace Myshipping.Application #endregion #region 任务目的港未提货/任务目的港提货未返空 - if (info.Main.TaskType == TaskBaseTypeEnum.POD_DISCHARGE_FULL) + if (info.Main.TaskType == TaskBaseTypeEnum.POD_DISCHARGE_FULL || info.Main.TaskType == TaskBaseTypeEnum.POD_GATEOUT_FULL) { TaskPODDischargeGateoutFullInfo dischargeGateout = info.Main.PODDischargeGateoutFull.Adapt(); From bf41b71ee82488dc616a6cc1b624fd81e7343005 Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Tue, 26 Mar 2024 22:44:20 +0800 Subject: [PATCH 03/12] =?UTF-8?q?=E4=BF=AE=E6=94=B9DRAFT=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entity/TaskManagePlat/TaskDraftInfo.cs | 6 +++--- Myshipping.Application/Enum/TaskFileCategoryEnum.cs | 10 ++++++++++ .../Service/TaskManagePlat/TaskManageService.cs | 12 ++++++++++++ 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/Myshipping.Application/Entity/TaskManagePlat/TaskDraftInfo.cs b/Myshipping.Application/Entity/TaskManagePlat/TaskDraftInfo.cs index e569df8f..78c21469 100644 --- a/Myshipping.Application/Entity/TaskManagePlat/TaskDraftInfo.cs +++ b/Myshipping.Application/Entity/TaskManagePlat/TaskDraftInfo.cs @@ -10,10 +10,10 @@ using System.Threading.Tasks; namespace Myshipping.Application { /// - /// 任务目的港未提货未返箱 + /// 任务格式单 /// - [SugarTable("task_pod_discharge_gateout_full")] - [Description("任务目的港未提货未返箱")] + [SugarTable("task_draft_info")] + [Description("任务格式单")] public class TaskDraftInfo : TaskManageDbEntity { /// diff --git a/Myshipping.Application/Enum/TaskFileCategoryEnum.cs b/Myshipping.Application/Enum/TaskFileCategoryEnum.cs index 9c725be8..c246102e 100644 --- a/Myshipping.Application/Enum/TaskFileCategoryEnum.cs +++ b/Myshipping.Application/Enum/TaskFileCategoryEnum.cs @@ -43,6 +43,16 @@ namespace Myshipping.Application [Description("Booking Cancellation Notice")] BC_CANCEL_NOTICE, /// + /// Booking Cancellation + /// + [Description("Draft")] + DRAFT, + /// + /// Booking Cancellation Notice + /// + [Description("Draft Notice")] + DRAFT_NOTICE, + /// /// 空 /// [Description("NONE")] diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs index 7b7c243a..d18abe85 100644 --- a/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs @@ -417,6 +417,12 @@ namespace Myshipping.Application fileCategory = TaskFileCategoryEnum.BC_CANCEL.ToString(); } + else if (TaskBaseTypeEnum.DRAFT.ToString() == taskInfo.TASK_BASE_TYPE) + { + attachFileType = "draftfiles"; + + fileCategory = TaskFileCategoryEnum.DRAFT.ToString(); + } var noExtensionFileName = Path.GetFileNameWithoutExtension(file.FileName); var fileFullName = await FileAttachHelper.SaveFile(taskInfo.PK_ID, bytes, batchNo, noExtensionFileName, @@ -466,6 +472,12 @@ namespace Myshipping.Application fileCategory = TaskFileCategoryEnum.BC_CANCEL_NOTICE.ToString(); } + else if (TaskBaseTypeEnum.DRAFT.ToString() == taskInfo.TASK_BASE_TYPE) + { + attachFileType = "draftnoticefiles"; + + fileCategory = TaskFileCategoryEnum.DRAFT.ToString(); + } var noExtensionFileName = Path.GetFileNameWithoutExtension(modifyFile.FileName); var fileFullName = await FileAttachHelper.SaveFile(taskInfo.PK_ID, bytes, batchNo, noExtensionFileName, From 334809922a5e887a5d496ccbeca2511cdff8014e Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Tue, 26 Mar 2024 23:07:14 +0800 Subject: [PATCH 04/12] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A9=AC=E5=A3=AB?= =?UTF-8?q?=E5=9F=BA=E8=AE=A2=E8=88=B1=E5=8F=B0=E8=B4=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/BookingOrder/BookingMSKAPIService.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Myshipping.Application/Service/BookingOrder/BookingMSKAPIService.cs b/Myshipping.Application/Service/BookingOrder/BookingMSKAPIService.cs index 8f45c343..b4b10f48 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingMSKAPIService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingMSKAPIService.cs @@ -990,7 +990,14 @@ namespace Myshipping.Application.Service.BookingOrder //菜单375504048771141=我的任务台账 List userlist = await _sysDataUserMenuService.GetDataScopeList(MenuConst.MenuMSKApi); - if (userlist.Count > 0) + bool isAdmin = false; + + if(userlist == null) + { + isAdmin = true; + userlist = new List(); + } + else if (userlist != null && userlist.Count > 0) { userlist.Add(UserManager.UserId); userlist = userlist.Distinct().ToList(); @@ -999,7 +1006,7 @@ namespace Myshipping.Application.Service.BookingOrder _logger.LogInformation("任务台账权限范围 {list}", userlist); var entities = await _bookingDeliveryRecordRep.AsQueryable() - .Where(t => userlist == null || (userlist.Count > 0 && userlist.Contains(t.CreatedUserId.Value))) + .Where(t => isAdmin || userlist.Contains(t.CreatedUserId.Value)) .WhereIF(createBegin != DateTime.MinValue, t => t.CreatedTime.HasValue && t.CreatedTime.Value >= createBegin) .WhereIF(createEnd != DateTime.MinValue, t => t.CreatedTime.HasValue && t.CreatedTime.Value < createEnd) .WhereIF(updateBegin != DateTime.MinValue, t => t.UpdatedTime.HasValue && t.UpdatedTime.Value >= updateBegin) From df662c45c8c4a0dbb197582fea8934dc5d82c0d3 Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Wed, 27 Mar 2024 13:07:13 +0800 Subject: [PATCH 05/12] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=88=AA=E5=8D=95?= =?UTF-8?q?=E5=9B=9E=E6=89=A7=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/TaskManageOrderSIFeedBackInfo.cs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderSIFeedBackInfo.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderSIFeedBackInfo.cs index 76583f00..fe34ddb3 100644 --- a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderSIFeedBackInfo.cs +++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderSIFeedBackInfo.cs @@ -134,6 +134,26 @@ namespace Myshipping.Application /// public string ThirdPayAddr { get; set; } + /// + /// 截单上传时间 + /// + public string SubmittedDate { get; set; } + + /// + /// 签单方式(seaway、original、telex) + /// + public string DocumentType { get; set; } + + /// + /// 提单份数 + /// + public string BillOfNum { get; set; } + + /// + /// 放单方式 + /// + public string ReleaseInstruction { get; set; } + /// /// 箱信息 /// From 1ac8f208b0ed4673b00972d1527efc4d3f8e52af Mon Sep 17 00:00:00 2001 From: zhangxiaofeng <1939543722@qq.com> Date: Wed, 27 Mar 2024 16:24:24 +0800 Subject: [PATCH 06/12] =?UTF-8?q?=E9=A9=AC=E5=A3=AB=E5=9F=BA=E7=94=B5?= =?UTF-8?q?=E6=94=BE=E6=8F=90=E4=BA=A4=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BookingOrder/BookingOrderService.cs | 144 +++++++++++++++++- .../BookingOrder/Dto/SubmitTelexResultDto.cs | 22 +++ Myshipping.Web.Core/dbsettings.json | 11 +- 3 files changed, 168 insertions(+), 9 deletions(-) create mode 100644 Myshipping.Application/Service/BookingOrder/Dto/SubmitTelexResultDto.cs diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index 92e85883..bfa70016 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -145,7 +145,7 @@ namespace Myshipping.Application private readonly IServiceWorkFlowManageService _serviceWorkFlowManageService; private readonly IDjyUserConfigService _djyUserConfigService; private readonly IBookingSlotService bookingSlotService; - + private readonly IBookingValueAddedService bookingValueAddedService; private readonly IEventPublisher _publisher; private readonly SqlSugarRepository _repTenantParamValue; @@ -177,7 +177,7 @@ namespace Myshipping.Application ISysOrgService orgService, SqlSugarRepository repLineOpMgrConfig, SqlSugarRepository repSysEmp, SqlSugarRepository repAutoYard, IServiceWorkFlowManageService serviceWorkFlowManageService, IDjyUserConfigService djyUserConfigService, IEventPublisher publisher, SqlSugarRepository repSlotBase, SqlSugarRepository repSlotAllocation, SqlSugarRepository repSlotAllocationCtn, IBookingSlotService bookingSlotService, - SqlSugarRepository repBookingStatusSubscribe, SqlSugarRepository repTenantParamValue) + SqlSugarRepository repBookingStatusSubscribe, SqlSugarRepository repTenantParamValue, IBookingValueAddedService bookingValueAddedService) { this._logger = logger; this._rep = rep; @@ -231,6 +231,7 @@ namespace Myshipping.Application this.bookingSlotService = bookingSlotService; _repBookingStatusSubscribe = repBookingStatusSubscribe; _repTenantParamValue = repTenantParamValue; + this.bookingValueAddedService = bookingValueAddedService; } #region 主表和箱信息 @@ -11910,11 +11911,9 @@ namespace Myshipping.Application } } } - - #endregion - + #region BC /// /// 接收BC信息更新订舱 /// @@ -12004,5 +12003,140 @@ namespace Myshipping.Application CustomerBookingSyncHelper.SendCustomerBookingSync((long)id, BookingOrderSyncTypeEnum.BC.ToString()); } } + + #endregion + + #region 电放 + /// + /// 船司电放提交 + /// + /// 订舱主键数组 + /// 每单的处理提交结果 + [HttpPost("/BookingOrder/SubmitTelex")] + public async Task> SubmitTelex([FromBody] long[] ids) + { + var orderList = await _rep.AsQueryable().Where(x => ids.Contains(x.Id)).ToListAsync(); + if (orderList.Count == 0) + { + throw Oops.Bah("未找到相应订舱"); + } + + var allSysConfig = _cache.GetAllSysConfig().Result; + var url = allSysConfig.FirstOrDefault(x => x.Code == "TelexServiceUrl")?.Value; + var key = allSysConfig.FirstOrDefault(x => x.Code == "TelexServiceKey")?.Value; + var secret = allSysConfig.FirstOrDefault(x => x.Code == "TelexServiceSecret")?.Value; + + if (string.IsNullOrWhiteSpace(url)) + { + throw Oops.Bah("大简云电放服务接口地址未配置,请联系管理员"); + } + if (string.IsNullOrWhiteSpace(key)) + { + throw Oops.Bah("大简云电放服务接口Key未配置,请联系管理员"); + } + if (string.IsNullOrWhiteSpace(secret)) + { + throw Oops.Bah("大简云电放服务接口Secret未配置,请联系管理员"); + } + url += "/v1/submit"; + + var webAccount = _webAccountConfig.GetAccountConfig("MSKWeb", UserManager.UserId).Result; + if (webAccount == null) + { + throw Oops.Bah("未配置网站账户,类型:MSKWeb"); + } + + var mappingCarrier = _cache.GetAllMappingCarrier().Result; + var mappingIssueType = _cache.GetAllMappingIssueType().Result; + + List result = new(); + foreach (var order in orderList) + { + try + { + if (string.IsNullOrWhiteSpace(order.MBLNO)) + { + result.Add(new SubmitTelexResultDto(order.MBLNO, false, "提单号为空")); + continue; + } + if (string.IsNullOrWhiteSpace(order.ISSUETYPE)) + { + result.Add(new SubmitTelexResultDto(order.MBLNO, false, "签单方式为空")); + continue; + } + if (string.IsNullOrWhiteSpace(order.CARRIERID)) + { + result.Add(new SubmitTelexResultDto(order.MBLNO, false, "船公司为空")); + continue; + } + + // 判断船公司是否符合条件 + string carrierId = mappingCarrier.FirstOrDefault(x => x.Module == "TelexCheck" && x.Code == order.CARRIERID)?.MapCode; + carrierId = (carrierId ?? order.CARRIERID).ToUpper(); + if (carrierId != "MSK") + { + result.Add(new SubmitTelexResultDto(order.MBLNO, false, $"{order.CARRIER}船公司此功能待开发")); + continue; + } + + // 判断签单方式是否符合条件 + string issueType = mappingIssueType.FirstOrDefault(x => x.Module == "TelexCheck" && x.Code == order.ISSUETYPE)?.MapCode; + issueType = issueType?? order.ISSUETYPE; + if (!issueType.Equals("telex", StringComparison.OrdinalIgnoreCase)) + { + result.Add(new SubmitTelexResultDto(order.MBLNO, false, $"{order.MBLNO}签单方式非电放")); + continue; + } + + // 提交电放 + var body = new + { + user_key = key, + user_secret = secret, + web_code = carrierId, + web_user = webAccount.Account, + web_psw = webAccount.Password, + bno = order.MBLNO + }; + + _logger.LogInformation("请求电放提交接口开始,mblno={mblno}, url={url}, body={body}", order.MBLNO, url, body); + var rtn = await url.SetBody(body).PostAsStringAsync(); + _logger.LogInformation("请求电放提交接口结束,mblno={mblno}, rtn={rtn}", order.MBLNO, rtn); + + var jsonRtn = JObject.Parse(rtn); + if (jsonRtn.GetIntValue("code") == 200) + { + _logger.LogInformation("请求电放提交接口成功,mblno={mblno}", order.MBLNO); + + // 推送 电放已安排 状态 + var pushModel = new ModifyServiceProjectStatusDto + { + BookingId = order.Id, + SourceType = TrackingSourceTypeEnum.MANUAL, + StatusCodes = new List { + new ModifyServiceProjectStatusDetailDto { StatusCode = "DFYAP" } } + }; + var saveStatusRlt = await bookingValueAddedService.SaveServiceStatus(pushModel); + _logger.LogInformation("请求电放提交接口成功后推送 电放已安排 状态,JSON={json} ,结果={rlt}", JSON.Serialize(pushModel), JSON.Serialize(saveStatusRlt)); + + result.Add(new SubmitTelexResultDto(order.MBLNO, true, null)); + } + else + { + var msg = jsonRtn.GetStringValue("msg")?.Replace("爬虫", ""); + _logger.LogInformation("请求电放提交接口失败,mblno={mblno}, 电放服务返回:{msg}", order.MBLNO, msg); + result.Add(new SubmitTelexResultDto(order.MBLNO, false, $"电放服务返回:{msg}")); + } + } + catch (Exception ex) + { + _logger.LogError("请求电放提交接口过程中发生未知异常,mblno={mblno}, ex={ex}", order.MBLNO, ex); + result.Add(new SubmitTelexResultDto(order.MBLNO, false, $"错误:{ex.Message}")); + continue; + } + } + return result; + } + #endregion } } diff --git a/Myshipping.Application/Service/BookingOrder/Dto/SubmitTelexResultDto.cs b/Myshipping.Application/Service/BookingOrder/Dto/SubmitTelexResultDto.cs new file mode 100644 index 00000000..b5e17279 --- /dev/null +++ b/Myshipping.Application/Service/BookingOrder/Dto/SubmitTelexResultDto.cs @@ -0,0 +1,22 @@ +namespace Myshipping.Application.Service.BookingOrder.Dto +{ + public class SubmitTelexResultDto + { + public SubmitTelexResultDto(string mBLNO, bool isSuccess, string failReason) + { + MBLNO = mBLNO; + IsSuccess = isSuccess; + FailReason = failReason; + } + + /// + /// 提单号 + /// + public string MBLNO { get; set; } + public bool IsSuccess { get; set; } + /// + /// 失败原因 + /// + public string FailReason { get; set; } + } +} diff --git a/Myshipping.Web.Core/dbsettings.json b/Myshipping.Web.Core/dbsettings.json index 95a07aec..cbe87b24 100644 --- a/Myshipping.Web.Core/dbsettings.json +++ b/Myshipping.Web.Core/dbsettings.json @@ -3,8 +3,10 @@ "DefaultDbNumber": "0", "DefaultDbType": "MySql", - // 普通订舱(测试环境): + // 普通订舱(和川测试环境): "DefaultDbString": "Data Source=60.209.125.238;Database=booking_hechuan_dev;User ID=root;Password=Djy@Mysql.test;pooling=true;port=32006;sslmode=none;CharSet=utf8mb4;Convert Zero Datetime=True;Allow Zero Datetime=True;", + // 普通订舱(自用正式环境): + //"DefaultDbString": "Data Source=rm-m5e06xxqpa68a68ry5o.mysql.rds.aliyuncs.com;Database=booking_data;User ID=rulesengine_admin;Password=Rule1qaz2wsx!QAZ;pooling=true;port=3306;sslmode=none;CharSet=utf8mb4;Convert Zero Datetime=True;Allow Zero Datetime=True;", // 客户订舱-客户端(测试环境): //"DefaultDbString": "Data Source=60.209.125.238;Database=booking_customer_test;User ID=root;Password=Djy@Mysql.test;pooling=true;port=32006;sslmode=none;CharSet=utf8mb4;Convert Zero Datetime=True;Allow Zero Datetime=True;", @@ -12,9 +14,9 @@ //"DefaultDbString": "Data Source=60.209.125.238;Database=booking_djy_test;User ID=root;Password=Djy@Mysql.test;pooling=true;port=32006;sslmode=none;CharSet=utf8mb4;Convert Zero Datetime=True;Allow Zero Datetime=True;", // 客户订舱-客户端(正式环境): - //"DefaultDbString": "Data Source=47.104.222.4;Database=booking_customer;User ID=root;Password=d0pC?Vhxq!Aj5g29H-TZ=M74rX38~]Jw;pooling=true;port=3306;sslmode=none;CharSet=utf8mb4;Convert Zero Datetime=True;Allow Zero Datetime=True;", + //"DefaultDbString": "Data Source=rm-m5e06xxqpa68a68ry5o.mysql.rds.aliyuncs.com;Database=booking_customer;User ID=rulesengine_admin;Password=Rule1qaz2wsx!QAZ;pooling=true;port=3306;sslmode=none;CharSet=utf8mb4;Convert Zero Datetime=True;Allow Zero Datetime=True;", // 客户订舱-运营端(正式环境): - //"DefaultDbString": "Data Source=47.104.222.4;Database=booking_djy;User ID=root;Password=d0pC?Vhxq!Aj5g29H-TZ=M74rX38~]Jw;pooling=true;port=3306;sslmode=none;CharSet=utf8mb4;Convert Zero Datetime=True;Allow Zero Datetime=True;", + //"DefaultDbString": "Data Source=rm-m5e06xxqpa68a68ry5o.mysql.rds.aliyuncs.com;Database=booking_djy;User ID=rulesengine_admin;Password=Rule1qaz2wsx!QAZ;pooling=true;port=3306;sslmode=none;CharSet=utf8mb4;Convert Zero Datetime=True;Allow Zero Datetime=True;", "DbConfigs": [ { @@ -25,7 +27,8 @@ { "DbNumber": "common", "DbType": "SqlServer", - "DbString": "Server=60.209.125.238,32009;Database=DevCommonDB;User=sa;Password=Djy@Sql2022.test;MultipleActiveResultSets=True;" + "DbString": "Server=60.209.125.238,32009;Database=DevCommonDB;User=sa;Password=Djy@Sql2022.test;MultipleActiveResultSets=True;", + //"DbString": "Server=47.104.73.97,6762;Database=CommonDB;User=sa;Password=QDdjy#2020*;MultipleActiveResultSets=True;" }, { "DbNumber": "pingtai", From a07ca05352722ee0c80336569629873132099c8f Mon Sep 17 00:00:00 2001 From: zhangxiaofeng <1939543722@qq.com> Date: Wed, 27 Mar 2024 16:42:13 +0800 Subject: [PATCH 07/12] =?UTF-8?q?=E9=A9=AC=E5=A3=AB=E5=9F=BA=E7=94=B5?= =?UTF-8?q?=E6=94=BE=E6=8F=90=E4=BA=A4=E6=8E=A5=E5=8F=A3=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/BookingOrder/BookingOrderService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index 41568672..5415cab6 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -12075,7 +12075,7 @@ namespace Myshipping.Application carrierId = (carrierId ?? order.CARRIERID).ToUpper(); if (carrierId != "MSK") { - result.Add(new SubmitTelexResultDto(order.MBLNO, false, $"{order.CARRIER}船公司此功能待开发")); + result.Add(new SubmitTelexResultDto(order.MBLNO, false, $"[{order.CARRIER}]船公司此功能待开发")); continue; } @@ -12084,7 +12084,7 @@ namespace Myshipping.Application issueType = issueType?? order.ISSUETYPE; if (!issueType.Equals("telex", StringComparison.OrdinalIgnoreCase)) { - result.Add(new SubmitTelexResultDto(order.MBLNO, false, $"{order.MBLNO}签单方式非电放")); + result.Add(new SubmitTelexResultDto(order.MBLNO, false, $"签单方式非电放")); continue; } From f5b0c36ae9f7d0741238ce916be404727311a2c7 Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Thu, 28 Mar 2024 09:54:48 +0800 Subject: [PATCH 08/12] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E8=88=B1=E4=BD=8D=E7=9A=84cancellation=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entity/BookingSlot/BookingSlotBase.cs | 16 +++++++++++++++- .../Service/BookingSlot/BookingSlotService.cs | 6 +++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Myshipping.Application/Entity/BookingSlot/BookingSlotBase.cs b/Myshipping.Application/Entity/BookingSlot/BookingSlotBase.cs index 04170dd9..a51d2446 100644 --- a/Myshipping.Application/Entity/BookingSlot/BookingSlotBase.cs +++ b/Myshipping.Application/Entity/BookingSlot/BookingSlotBase.cs @@ -338,6 +338,20 @@ namespace Myshipping.Application [SugarColumn(ColumnName = "SLOT_SOURCE")] [Description("舱位来源 EMAIL-邮件导入 MANUAL-手工")] public string SLOT_SOURCE{ get; set; } - + + /// + /// 是否Cancellation + /// + [SugarColumn(ColumnName = "IS_CANCELLATION")] + [Description("是否Cancellation")] + public bool IS_CANCELLATION { get; set; } + + /// + /// Cancellation时间 + /// + [SugarColumn(ColumnName = "CANCELLATION_DATE")] + [Description("Cancellation时间")] + public string CANCELLATION_DATE { get; set; } + } } \ No newline at end of file diff --git a/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs b/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs index a8f8e182..8673b67f 100644 --- a/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs +++ b/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs @@ -287,7 +287,7 @@ namespace Myshipping.Application long id = 0; //接口方法直接调用save、delete等方法会报错,可能因为非token授权登录导致,故重写一遍保存、删除代码 - if (dto.OpType == "add" || dto.OpType == "update" || dto.OpType == "del") + if (dto.OpType == "add" || dto.OpType == "update" || dto.OpType == "del" || dto.OpType == "cancellation") { //翻译船公司 if (!string.IsNullOrWhiteSpace(dto.DataObj.CARRIERID) && string.IsNullOrWhiteSpace(dto.DataObj.CARRIER)) @@ -498,6 +498,10 @@ namespace Myshipping.Application await InsLog("Del", model.Id, "取消舱位"); } + else if (dto.OpType == "cancellation") + { + + } //更新库存 await _publisher.PublishAsync(new ChannelEventSource("BookingSlotStock:Update", new BookingSlotStockUpdateModel From ce833c625a971d6a0518e6c2782888a7fd541d59 Mon Sep 17 00:00:00 2001 From: zhangxiaofeng <1939543722@qq.com> Date: Thu, 28 Mar 2024 11:07:31 +0800 Subject: [PATCH 09/12] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=88=B1=E4=BD=8D?= =?UTF-8?q?=E5=8F=96=E6=B6=88=E9=85=8D=E5=A5=97=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entity/BookingSlot/BookingSlotBase.cs | 3 +- .../Event/BookingSlotStockSubscriber.cs | 1 + .../Service/BookingSlot/BookingSlotService.cs | 68 +++++++++++++++---- .../BookingSlot/Dto/BookingSlotBaseDto.cs | 10 +++ 4 files changed, 65 insertions(+), 17 deletions(-) diff --git a/Myshipping.Application/Entity/BookingSlot/BookingSlotBase.cs b/Myshipping.Application/Entity/BookingSlot/BookingSlotBase.cs index a51d2446..4846a35f 100644 --- a/Myshipping.Application/Entity/BookingSlot/BookingSlotBase.cs +++ b/Myshipping.Application/Entity/BookingSlot/BookingSlotBase.cs @@ -351,7 +351,6 @@ namespace Myshipping.Application /// [SugarColumn(ColumnName = "CANCELLATION_DATE")] [Description("Cancellation时间")] - public string CANCELLATION_DATE { get; set; } - + public DateTime? CANCELLATION_DATE { get; set; } } } \ No newline at end of file diff --git a/Myshipping.Application/Event/BookingSlotStockSubscriber.cs b/Myshipping.Application/Event/BookingSlotStockSubscriber.cs index 8653f8fc..a345ecc7 100644 --- a/Myshipping.Application/Event/BookingSlotStockSubscriber.cs +++ b/Myshipping.Application/Event/BookingSlotStockSubscriber.cs @@ -54,6 +54,7 @@ namespace Myshipping.Application.Event var baseList = await _repBase.AsQueryable().Filter(null, true) .Where(x => !x.IsDeleted + && !x.IS_CANCELLATION && x.VESSEL == paraObj.VESSEL && x.VOYNO == paraObj.VOYNO && x.CONTRACT_NO == paraObj.CONTRACT_NO diff --git a/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs b/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs index 8673b67f..26f8408b 100644 --- a/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs +++ b/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs @@ -264,7 +264,7 @@ namespace Myshipping.Application result.msg = "成功"; result.ext = id; } - catch(Exception ex) + catch (Exception ex) { result.succ = false; result.msg = $"失败,原因:{ex.Message}"; @@ -297,7 +297,7 @@ namespace Myshipping.Application || t.EnName.Equals(dto.DataObj.CARRIERID, StringComparison.OrdinalIgnoreCase) || t.CnName.Equals(dto.DataObj.CARRIERID, StringComparison.OrdinalIgnoreCase)).FirstOrDefault(); - if(carrierInfo != null) + if (carrierInfo != null) { dto.DataObj.CARRIER = carrierInfo.CnName?.Trim(); } @@ -311,7 +311,7 @@ namespace Myshipping.Application dto.DataObj.CtnList.ForEach(t => { - if(!string.IsNullOrWhiteSpace(t.CTNALL) && string.IsNullOrWhiteSpace(t.CTNCODE)) + if (!string.IsNullOrWhiteSpace(t.CTNALL) && string.IsNullOrWhiteSpace(t.CTNCODE)) { var ctnCode = ctnCodeList.FirstOrDefault(a => !string.IsNullOrWhiteSpace(a.Name) && a.Name.Equals(t.CTNALL, StringComparison.OrdinalIgnoreCase)); @@ -399,13 +399,17 @@ namespace Myshipping.Application .Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID && x.SLOT_ID == model.Id).ToList(); - if(ctnList != null) + if (ctnList != null) { bcSrcDto.CtnList = ctnList.GroupBy(x => x.CTNALL) .Select(x => { - return new TaskBCCTNInfoDto { CtnALL = x.Key, CTNNUM = x.ToList() - .Sum(a => a.CTNNUM) }; + return new TaskBCCTNInfoDto + { + CtnALL = x.Key, + CTNNUM = x.ToList() + .Sum(a => a.CTNNUM) + }; }).ToList(); } @@ -473,7 +477,7 @@ namespace Myshipping.Application } //一般更新数据指的是Booking Amendment,需要与舱位进行数据比对 - await PushCompareBCInfo(bcSrcDto, bcTargetDto,id, dto.BatchNo); + await PushCompareBCInfo(bcSrcDto, bcTargetDto, id, dto.BatchNo); } else if (dto.OpType == "del") { @@ -500,7 +504,40 @@ namespace Myshipping.Application } else if (dto.OpType == "cancellation") { + // 更新标志 + var slotNO = dto.DataObj.SLOT_BOOKING_NO; + model = await _repBase.AsQueryable().Filter(null, true).FirstAsync(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID && x.SLOT_BOOKING_NO == slotNO); + if (model == null) + { + throw Oops.Bah($"未找到订舱编号为 {slotNO} 的数据"); + } + id = model.Id; + model.IS_CANCELLATION = true; + model.CANCELLATION_DATE = DateTime.Now; + await _repBase.UpdateAsync(model); + + // 删除该舱位相关的订舱关联关系 + var slotList = await _repAllocation.AsQueryable().Where(a => a.BOOKING_SLOT_ID == id).ToListAsync(); + var slotIdList = slotList.Select(s => s.Id); + + await _repAllocation.Context.Updateable() + .SetColumns(a => a.IsDeleted == true) + .SetColumns(a => a.UpdatedTime == DateTime.Now) + .SetColumns(a => a.UpdatedUserId == UserManager.UserId) + .SetColumns(a => a.UpdatedUserName == UserManager.Name) + .Where(a => slotIdList.Contains(a.Id)) + .ExecuteCommandAsync(); + + await _repAllocationCtn.Context.Updateable() + .SetColumns(a => a.IsDeleted == true) + .SetColumns(a => a.UpdatedTime == DateTime.Now) + .SetColumns(a => a.UpdatedUserId == UserManager.UserId) + .SetColumns(a => a.UpdatedUserName == UserManager.Name) + .Where(a => slotIdList.Contains(a.SLOT_ALLOC_ID)) + .ExecuteCommandAsync(); + + await InsLog("Cancellation", model.Id, "取消舱位"); } //更新库存 @@ -703,6 +740,7 @@ namespace Myshipping.Application // 1. 【舱位基础表】与【箱子表】做关联,并根据【舱位主键】、【箱型】做分组,统计出【总的箱量】,作为queryable1 var queryable1 = _repBase.Context.Queryable((bas, ctn) => bas.Id == ctn.SLOT_ID) + .Where(bas => bas.IS_CANCELLATION == false) .WhereIF(!string.IsNullOrEmpty(slotInput.PORTLOAD), bas => bas.PORTLOAD.Contains(slotInput.PORTLOAD)) .WhereIF(!string.IsNullOrEmpty(slotInput.PORTDISCHARGE), bas => bas.PORTLOAD.Contains(slotInput.PORTLOAD)) .WhereIF(!string.IsNullOrEmpty(slotInput.VESSEL), bas => bas.VESSEL.Contains(slotInput.VESSEL)) @@ -1004,7 +1042,7 @@ namespace Myshipping.Application /// 舱位主键 /// 请求批次号用来区分对应的哪个批次任务 /// - private async Task PushCompareBCInfo(TaskBCInfoDto bcSrcDto, TaskBCInfoDto bcTargetDto,long slotId,string reqBatchNo) + private async Task PushCompareBCInfo(TaskBCInfoDto bcSrcDto, TaskBCInfoDto bcTargetDto, long slotId, string reqBatchNo) { string batchNo = IDGen.NextID().ToString(); @@ -1027,7 +1065,7 @@ namespace Myshipping.Application { SLOT_ID = slotId, COMPARE_BATCHNO = reqBatchNo, - COMPARE_DIFF_NUM = compareResult.extra.IsExistsDiff? compareResult.extra.ShowDetailList.Count : 0, + COMPARE_DIFF_NUM = compareResult.extra.IsExistsDiff ? compareResult.extra.ShowDetailList.Count : 0, CreatedTime = nowDate, UpdatedTime = nowDate, CreatedUserId = UserManager.UserId, @@ -1117,8 +1155,8 @@ namespace Myshipping.Application [HttpGet("/BookingSlot/GetSlotCompareResult")] public async Task> GetSlotCompareResult([FromQuery] long id, [FromQuery] string batchNo) { - var compareInfo = await _bookingSlotCompareRepository.AsQueryable() - .FirstAsync(t => t.SLOT_ID == id && t.COMPARE_BATCHNO == batchNo); + var compareInfo = await _bookingSlotCompareRepository.AsQueryable() + .FirstAsync(t => t.SLOT_ID == id && t.COMPARE_BATCHNO == batchNo); if (compareInfo == null) { @@ -1154,7 +1192,7 @@ namespace Myshipping.Application result.succ = true; result.msg = "导入成功"; } - catch(Exception ex) + catch (Exception ex) { _logger.LogError($"导入舱位异常,原因:{ex.Message}"); @@ -1186,7 +1224,7 @@ namespace Myshipping.Application throw Oops.Oh($"舱位信息不存在或已作废"); // 判断是否已存在引用关系 - if (_repAllocation.IsExists(a => a.BOOKING_SLOT_ID == slotInfo.Id + if (_repAllocation.IsExists(a => a.BOOKING_SLOT_ID == slotInfo.Id && a.BOOKING_ID > 0 && a.IsDeleted == false)) { throw Oops.Oh($"舱位已有对应的订舱订单,不能重复执行"); @@ -1217,7 +1255,7 @@ namespace Myshipping.Application /// 舱位附件列表 /// 订舱请求详情 /// 返回订舱ID - private async Task GenerateBookingOrder(BookingSlotBase bookingSlotBase, List bookingSlotCtnList, + private async Task GenerateBookingOrder(BookingSlotBase bookingSlotBase, List bookingSlotCtnList, List bookingSlotFileList, BookingGenerateDto generateModel) { @@ -1441,7 +1479,7 @@ namespace Myshipping.Application /// 文件名称 /// public string FileName { get; set; } - + /// /// 文件二进制流 /// diff --git a/Myshipping.Application/Service/BookingSlot/Dto/BookingSlotBaseDto.cs b/Myshipping.Application/Service/BookingSlot/Dto/BookingSlotBaseDto.cs index e297a9f8..6c050ddb 100644 --- a/Myshipping.Application/Service/BookingSlot/Dto/BookingSlotBaseDto.cs +++ b/Myshipping.Application/Service/BookingSlot/Dto/BookingSlotBaseDto.cs @@ -311,7 +311,17 @@ namespace Myshipping.Application.Service.BookingSlot.Dto [Description("舱单截止时间")] public DateTime? MANIFEST_CUT_DATE { get; set; } + /// + /// 是否Cancellation + /// + [Description("是否Cancellation")] + public bool IS_CANCELLATION { get; set; } + /// + /// Cancellation时间 + /// + [Description("Cancellation时间")] + public DateTime? CANCELLATION_DATE { get; set; } } /// From d5b93a3dff0064d9084d7298de742826d62be8c7 Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Thu, 28 Mar 2024 12:57:41 +0800 Subject: [PATCH 10/12] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A2=84=E7=94=A9?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TaskManagePlat/TaskManageRollingNominationService.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskManageRollingNominationService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskManageRollingNominationService.cs index b25c0f8a..4cabdaa1 100644 --- a/Myshipping.Application/Service/TaskManagePlat/TaskManageRollingNominationService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/TaskManageRollingNominationService.cs @@ -170,6 +170,10 @@ namespace Myshipping.Application var shipList = _taskRollingNominationShipInfoRepository.AsQueryable() .Where(a => a.NOM_ID == rollModel.PK_ID && a.GROUP_INDX == 1 && !a.IsDeleted).ToList(); + if(shipList == null) + shipList = _taskRollingNominationShipInfoRepository.AsQueryable() + .Where(a => a.NOM_ID == rollModel.PK_ID && a.GROUP_INDX == 0 && !a.IsDeleted).ToList(); + var fromEntity = shipList.FirstOrDefault(a => a.SHIP_TYPE.Equals("From", StringComparison.OrdinalIgnoreCase)); From 8750382281a2f3c097b5fd9ec0594614a3d06c9e Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Thu, 28 Mar 2024 13:33:50 +0800 Subject: [PATCH 11/12] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A2=84=E7=94=A9?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TaskManagePlat/TaskManageRollingNominationService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskManageRollingNominationService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskManageRollingNominationService.cs index 4cabdaa1..29605999 100644 --- a/Myshipping.Application/Service/TaskManagePlat/TaskManageRollingNominationService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/TaskManageRollingNominationService.cs @@ -170,7 +170,7 @@ namespace Myshipping.Application var shipList = _taskRollingNominationShipInfoRepository.AsQueryable() .Where(a => a.NOM_ID == rollModel.PK_ID && a.GROUP_INDX == 1 && !a.IsDeleted).ToList(); - if(shipList == null) + if(shipList.Count == 0) shipList = _taskRollingNominationShipInfoRepository.AsQueryable() .Where(a => a.NOM_ID == rollModel.PK_ID && a.GROUP_INDX == 0 && !a.IsDeleted).ToList(); From 9f0be5494deeb827e48ad2bbe92383b8979ab41f Mon Sep 17 00:00:00 2001 From: zhangxiaofeng <1939543722@qq.com> Date: Thu, 28 Mar 2024 14:50:02 +0800 Subject: [PATCH 12/12] =?UTF-8?q?=E7=94=B5=E6=94=BE=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BookingOrder/BookingOrderService.cs | 96 +++++++++++++++++-- 1 file changed, 90 insertions(+), 6 deletions(-) diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index 5415cab6..ccd41fab 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -12038,7 +12038,6 @@ namespace Myshipping.Application { throw Oops.Bah("大简云电放服务接口Secret未配置,请联系管理员"); } - url += "/v1/submit"; var webAccount = _webAccountConfig.GetAccountConfig("MSKWeb", UserManager.UserId).Result; if (webAccount == null) @@ -12050,6 +12049,8 @@ namespace Myshipping.Application var mappingIssueType = _cache.GetAllMappingIssueType().Result; List result = new(); + List<(long Id, string MBLNO, string CarrierId)> pushList = new(); + foreach (var order in orderList) { try @@ -12081,21 +12082,104 @@ namespace Myshipping.Application // 判断签单方式是否符合条件 string issueType = mappingIssueType.FirstOrDefault(x => x.Module == "TelexCheck" && x.Code == order.ISSUETYPE)?.MapCode; - issueType = issueType?? order.ISSUETYPE; + issueType = issueType ?? order.ISSUETYPE; if (!issueType.Equals("telex", StringComparison.OrdinalIgnoreCase)) { result.Add(new SubmitTelexResultDto(order.MBLNO, false, $"签单方式非电放")); continue; } + pushList.Add((order.Id, order.MBLNO, carrierId)); + } + catch (Exception ex) + { + _logger.LogError("请求电放条件判断的过程中发生未知异常,mblno={mblno}, ex={ex}", order.MBLNO, ex); + result.Add(new SubmitTelexResultDto(order.MBLNO, false, $"提交错误:{ex.Message}")); + continue; + } + } + + if (pushList.Count == 0) + { + return result; + } + + if (ids.Length > 1) + { + url += "/v1/tasks"; + var mblnos = string.Concat(',', pushList.Select(x => x.MBLNO)); + try + { + // 提交电放 + var data = pushList.Select(x => new + { + web_code = x.CarrierId, + web_user = webAccount.Account, + web_psw = webAccount.Password, + bno = x.MBLNO, + email = UserManager.Email + }); + var body = new + { + user_key = key, + user_secret = secret, + data = data + }; + + _logger.LogInformation("请求电放提交接口开始,mblnos={mblnos}, url={url}, body={body}", mblnos, url, body); + var rtn = await url.SetBody(body).PostAsStringAsync(); + _logger.LogInformation("请求电放提交接口结束,rtn={rtn}", rtn); + + var jsonRtn = JObject.Parse(rtn); + if (jsonRtn.GetIntValue("code") == 200) + { + _logger.LogInformation("请求电放提交接口成功,mblnos={mblnos}", mblnos); + + foreach (var item in pushList) + { + // 推送 电放已安排 状态 + var pushModel = new ModifyServiceProjectStatusDto + { + BookingId = item.Id, + SourceType = TrackingSourceTypeEnum.MANUAL, + StatusCodes = new List { + new ModifyServiceProjectStatusDetailDto { StatusCode = "DFYAP" } } + }; + var saveStatusRlt = await bookingValueAddedService.SaveServiceStatus(pushModel); + _logger.LogInformation("请求电放提交接口成功后推送 电放已安排 状态,mblno={mblno},JSON={json} ,结果={rlt}", + item.MBLNO, JSON.Serialize(pushModel), JSON.Serialize(saveStatusRlt)); + + result.Add(new SubmitTelexResultDto(item.MBLNO, true, null)); + } + } + else + { + var msg = jsonRtn.GetStringValue("msg")?.Replace("爬虫", ""); + _logger.LogInformation("请求电放提交接口失败,mblnos={mblnos}, 电放服务返回:{msg}", mblnos, msg); + result.AddRange(pushList.Select(x => new SubmitTelexResultDto(x.MBLNO, false, $"电放服务返回:{msg}"))); + } + } + catch (Exception ex) + { + _logger.LogError("请求电放服务的过程中发生未知异常,mblnos={mblnos}, ex={ex}", mblnos, ex); + result.AddRange(pushList.Select(x => new SubmitTelexResultDto(x.MBLNO, false, $"错误:{ex.Message}"))); + } + } + else + { + url += "/v1/submit"; + + var order = pushList[0]; + try + { // 提交电放 var body = new { user_key = key, user_secret = secret, - web_code = carrierId, web_user = webAccount.Account, web_psw = webAccount.Password, + web_code = order.CarrierId, bno = order.MBLNO }; @@ -12114,7 +12198,7 @@ namespace Myshipping.Application BookingId = order.Id, SourceType = TrackingSourceTypeEnum.MANUAL, StatusCodes = new List { - new ModifyServiceProjectStatusDetailDto { StatusCode = "DFYAP" } } + new ModifyServiceProjectStatusDetailDto { StatusCode = "DFYAP" } } }; var saveStatusRlt = await bookingValueAddedService.SaveServiceStatus(pushModel); _logger.LogInformation("请求电放提交接口成功后推送 电放已安排 状态,JSON={json} ,结果={rlt}", JSON.Serialize(pushModel), JSON.Serialize(saveStatusRlt)); @@ -12130,11 +12214,11 @@ namespace Myshipping.Application } catch (Exception ex) { - _logger.LogError("请求电放提交接口过程中发生未知异常,mblno={mblno}, ex={ex}", order.MBLNO, ex); + _logger.LogError("请求电放服务的过程中发生未知异常,mblno={mblno}, ex={ex}", order.MBLNO, ex); result.Add(new SubmitTelexResultDto(order.MBLNO, false, $"错误:{ex.Message}")); - continue; } } + return result; } #endregion