diff --git a/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs b/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs index d76c8f19..c97ac0cb 100644 --- a/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs +++ b/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs @@ -720,7 +720,7 @@ namespace Myshipping.Application throw Oops.Bah("大简云接收订舱用户key和秘钥未配置,请联系管理员"); } - var orderList = _rep.AsQueryable().Where(x => ids.Contains(x.Id)).ToList(); + var orderList = _rep.AsQueryable().Filter(null, true).Where(x => ids.Contains(x.Id)).ToList(); var noSubmitList = orderList.Where(x => x.BSSTATUS != "已提交").Select(x => x.BOOKINGNO).ToList(); if (noSubmitList.Count > 0) { @@ -771,7 +771,7 @@ namespace Myshipping.Application var succ = item.GetBooleanValue("success"); if (succ) { - var model = _rep.AsQueryable().First(x => x.Id == id); + var model = _rep.AsQueryable().Filter(null, true).First(x => x.Id == id); model.BSSTATUS = "已录入"; await _rep.UpdateAsync(model); @@ -916,6 +916,8 @@ namespace Myshipping.Application //日志动态 SaveAuditLog($"{model.BSSTATUS},审核意见:{recModel.Comment}", id, model.CreatedUserId.Value, model.TenantId.Value, "系统"); + long bookingId = 0; + //进入客户订舱系统的订舱台账 if (recModel.Accept) { @@ -926,6 +928,7 @@ namespace Myshipping.Application await _repOrder.InsertAsync(bkOrder); model.BookingId = bkOrder.Id; //客户订舱数据与订舱台账数据关联 + bookingId = bkOrder.Id; await _rep.UpdateAsync(model); var bkEdiExt = new BookingEDIExt(); @@ -960,9 +963,6 @@ namespace Myshipping.Application await _repFile.InsertAsync(file); } - - - return bkOrder.Id; } @@ -971,18 +971,35 @@ namespace Myshipping.Application { try { - var body = new + string json = null; + if (recModel.Accept) { - Type = recModel.Accept ? "CustOrderStatusAccept" : "CustOrderStatusReject", - Data = new + var body = new { - model.BSNO, - BSSTATUS = recModel.Accept ? "已审核" : "已驳回", - BookingOrderId = recModel.Accept ? (long?)model.BookingId : null, - COMMENT = recModel.Accept ? null : recModel.Comment - } - }; - var json = body.ToJsonString(); + Type = "CustOrderStatusAccept", + Data = new + { + model.BSNO, + BSSTATUS = "已审核", + BookingOrderId = bookingId + } + }; + json = body.ToJsonString(); + } + else + { + var body = new + { + Type = "CustOrderStatusReject", + Data = new + { + model.BSNO, + BSSTATUS = "已驳回", + COMMENT = recModel.Comment + } + }; + json = body.ToJsonString(); + } var mqUrl = _cache.GetAllSysConfig().Result.FirstOrDefault(x => x.Code == "AuditBookingMqUrl")?.Value ?? throw new Exception("需配置接收订舱需求审核后推送东胜MQ连接串:[AuditBookingMqUrl]"); @@ -1020,7 +1037,14 @@ namespace Myshipping.Application } }); - return 0; + if (recModel.Accept) + { + return bookingId; + } + else + { + return 0; + } } #endregion @@ -1822,7 +1846,11 @@ namespace Myshipping.Application throw Oops.Bah("当前状态不能修改"); } - await CancelSubmit(new List() { custOrder.Id }); + if (custOrder.BSSTATUS == "已提交") + { + await CancelSubmit(new List() { custOrder.Id }); + custOrder = await _rep.AsQueryable().Filter(null, true).FirstAsync(x => x.Id == custOrder.Id); //取消后重新拉取一遍数据 + } input.Id = custOrder.Id; diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index c33aa712..ff1a308d 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -3761,7 +3761,7 @@ namespace Myshipping.Application var bs = await GenPrintFile(bookingId, printTemplate); var opt = App.GetOptions(); - var fileSaveName = $"放舱_{order.MBLNO}_{DateTime.Now.Ticks}.pdf"; // 文件原始名称 + var fileSaveName = $"放舱通知_{order.MBLNO}_{DateTime.Now.Ticks}.pdf"; // 文件原始名称 var dirAbs = string.Empty; if (string.IsNullOrEmpty(opt.basePath)) { @@ -3848,7 +3848,7 @@ namespace Myshipping.Application 邮箱:{user.Email}
"; - var sendResult = await MailSendHelper.SendMail(mailAcc, mailSubject, mailContent, letterYard.AttnMail, new KeyValuePair(fileSaveName, bs)); + var sendResult = await MailSendHelper.SendMail(mailAcc, mailSubject, mailContent, letterYard.AttnMail, new KeyValuePair($"放舱通知_{order.MBLNO}.pdf", bs)); if (!sendResult.Key) { _logger.LogError($"放舱邮件发送失败:从{mailAcc.MailAccount}到{letterYard.AttnMail},主题 {mailSubject}");