diff --git a/Myshipping.Application/EDI/ZhongYuanSoApiHelper.cs b/Myshipping.Application/EDI/ZhongYuanSoApiHelper.cs index f9670d09..2786b08e 100644 --- a/Myshipping.Application/EDI/ZhongYuanSoApiHelper.cs +++ b/Myshipping.Application/EDI/ZhongYuanSoApiHelper.cs @@ -63,9 +63,10 @@ namespace Myshipping.Application.EDI DjyCustomerContact custContact = null; var postModel = new ZhongYuanSoApiModel(); + JObject extObj = null; if (!string.IsNullOrEmpty(custOrder.ExtendData)) { - var extObj = JObject.Parse(custOrder.ExtendData); + extObj = JObject.Parse(custOrder.ExtendData); postModel.webAccount = extObj.GetStringValue("Account"); postModel.webPassword = extObj.GetStringValue("Password"); } @@ -357,9 +358,18 @@ namespace Myshipping.Application.EDI //大简云客户订舱接收BC邮箱 var djyBookMail = sysConfigList.FirstOrDefault(x => x.Code == "DjyCustomerBookReceiveBcMail"); var bcMail = custContact.Email; + if (extObj != null) //优先使用东胜上传的邮箱 + { + var opMail = extObj.GetStringValue("OpMail"); + if (!string.IsNullOrEmpty(opMail)) + { + bcMail = opMail; + } + } + if (djyBookMail != null) { - bcMail += djyBookMail.Value; + bcMail += ";" + djyBookMail.Value; } postModel.special = new ZhongYuanSoApiSpecial() diff --git a/Myshipping.Application/Entity/BusinessCompareDiffRecord.cs b/Myshipping.Application/Entity/BusinessCompareDiffRecord.cs new file mode 100644 index 00000000..bb23bc0b --- /dev/null +++ b/Myshipping.Application/Entity/BusinessCompareDiffRecord.cs @@ -0,0 +1,74 @@ +using Myshipping.Core.Entity; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Myshipping.Application +{ + /// + /// 业务比对差异记录表 + /// + [SugarTable("business_compare_diff_record", TableDescription = "业务比对差异记录表")] + public class BusinessCompareDiffRecord : DBEntityTenant + { + /// + /// 业务主键 + /// + [SugarColumn(ColumnName = "BUSI_ID")] + [Description("业务主键")] + public long BUSI_ID { get; set; } + + /// + /// 业务类型 + /// + [SugarColumn(ColumnName = "BUSI_TYPE")] + [Description("业务类型")] + public long BUSI_TYPE { get; set; } + + /// + /// 任务主键 + /// + [SugarColumn(ColumnName = "TASK_ID")] + [Description("任务主键")] + public long TASK_ID { get; set; } + + /// + /// 打印时间 + /// + [SugarColumn(ColumnName = "PRINT_DATE")] + [Description("打印时间")] + public Nullable PRINT_DATE { get; set; } + + /// + /// 比对类型 BC_MODIFY-BC变更比对 + /// + [SugarColumn(ColumnName = "COMPARE_TYPE")] + [Description("比对类型")] + public string COMPARE_TYPE { get; set; } + + /// + /// 比对结果JSON + /// + [SugarColumn(ColumnName = "COMPARE_RLT")] + [Description("比对结果JSON")] + public string COMPARE_RLT { get; set; } + + /// + /// 比对差异项数 + /// + [SugarColumn(ColumnName = "COMPARE_DIFF_NUM")] + [Description("比对差异项数")] + public Nullable COMPARE_DIFF_NUM { get; set; } + + /// + /// 比对批次号 + /// + [SugarColumn(ColumnName = "COMPARE_BATCHNO")] + [Description("比对批次号")] + public string COMPARE_BATCHNO { get; set; } + } +} diff --git a/Myshipping.Application/Entity/TaskManagePlat/TaskSISubmitted.cs b/Myshipping.Application/Entity/TaskManagePlat/TaskSISubmitted.cs index 6e8ea4ce..606a9a21 100644 --- a/Myshipping.Application/Entity/TaskManagePlat/TaskSISubmitted.cs +++ b/Myshipping.Application/Entity/TaskManagePlat/TaskSISubmitted.cs @@ -51,5 +51,85 @@ namespace Myshipping.Application /// public Nullable BOOKING_ID { get; set; } + /// + /// 截单上传时间 + /// + public Nullable SUBMITTED_DATE { get; set; } + + /// + /// 提单份数 + /// + public Nullable BILLOF_NUM { get; set; } + + /// + /// 放单方式 + /// + public string RELEASE_INSTRUCTION { get; set; } + + /// + /// 是否拆单 SPLIT-标识已拆单 + /// + public string SI_SUBTYPE { get; set; } + + /// + /// 发货人 + /// + public string SHIPPER { get; set; } + + /// + /// 收货人 + /// + public string CONSIGNEE { get; set; } + + /// + /// 通知人 + /// + public string NOTIFYPARTY { get; set; } + + /// + /// 第二通知人 + /// + public string NOTIFYPARTY2 { get; set; } + + /// + /// 订舱方 + /// + public string TRANSPORT_RECEIVER { get; set; } + + /// + /// 唛头 + /// + public string MARKS { get; set; } + + /// + /// HS代码 + /// + public string HSCODE { get; set; } + + /// + /// 货描 + /// + public string DESCRIPTION { get; set; } + + /// + /// 件数 + /// + public Nullable PKGS { get; set; } + + /// + /// 包装 + /// + public string KINDPKGS { get; set; } + + /// + /// 毛重 + /// + public Nullable KGS { get; set; } + + /// + /// 尺码 + /// + public Nullable CBM { get; set; } + } } diff --git a/Myshipping.Application/Entity/TaskManagePlat/TaskSISubmittedCtn.cs b/Myshipping.Application/Entity/TaskManagePlat/TaskSISubmittedCtn.cs new file mode 100644 index 00000000..46020b97 --- /dev/null +++ b/Myshipping.Application/Entity/TaskManagePlat/TaskSISubmittedCtn.cs @@ -0,0 +1,73 @@ +using SqlSugar; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Myshipping.Application.Entity.TaskManagePlat +{ + /// + /// 任务截单回执箱明细 + /// + [SugarTable("task_si_submitted_ctn")] + [Description("任务截单回执箱明细")] + public class TaskSISubmittedCtn : TaskManageDbEntity + { + /// + /// 父主键 + /// + public string P_PKID { get; set; } + + /// + /// 箱型代码 + /// + public string CTNCODE { get; set; } + + /// + /// 箱型 + /// + public string CTNALL { get; set; } + + /// + /// 箱号 + /// + public string CNTRNO { get; set; } + + /// + /// 封号 + /// + public string SEALNO { get; set; } + + /// + /// 件数 + /// + public Nullable PKGS { get; set; } + + /// + /// 包装 + /// + public string KINDPKGS { get; set; } + + /// + /// 毛重 + /// + public Nullable KGS { get; set; } + + /// + /// 尺码 + /// + public Nullable CBM { get; set; } + + /// + /// 称重方式 + /// + public string WEIGHTYPE { get; set; } + + /// + /// 称重重量 + /// + public Nullable WEIGHKGS { get; set; } + } +} diff --git a/Myshipping.Application/Enum/TaskFileCategoryEnum.cs b/Myshipping.Application/Enum/TaskFileCategoryEnum.cs index c246102e..da982df0 100644 --- a/Myshipping.Application/Enum/TaskFileCategoryEnum.cs +++ b/Myshipping.Application/Enum/TaskFileCategoryEnum.cs @@ -53,6 +53,11 @@ namespace Myshipping.Application [Description("Draft Notice")] DRAFT_NOTICE, /// + /// SI Submitted + /// + [Description("SI Submitted")] + SI_SUBMITTED, + /// /// 空 /// [Description("NONE")] diff --git a/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs b/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs index 7c6cfd4f..7af23ba9 100644 --- a/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs +++ b/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs @@ -1402,7 +1402,7 @@ namespace Myshipping.Application order = item.Adapt(); order.BSNO = order.Id.ToString(); //客户订舱系统中的id order.Id = YitIdHelper.NextId(); - order.BSSTATUS = "已接收"; + order.BSSTATUS = "待审核"; await _rep.InsertAsync(order); } else @@ -1424,7 +1424,7 @@ namespace Myshipping.Application order = item.Adapt(order); order.Id = idBackup; order.BSNO = bsnoBackup; - order.BSSTATUS = "已接收"; + order.BSSTATUS = "待审核"; order.IsDeleted = false; await _rep.UpdateAsync(order); } @@ -1469,7 +1469,7 @@ namespace Myshipping.Application //日志动态 - SaveAuditLog($"已接收", order.Id); + SaveAuditLog($"待审核", order.Id); } return rtnList; @@ -1488,7 +1488,7 @@ namespace Myshipping.Application throw Oops.Bah("未找到业务信息"); } - if (model.BSSTATUS != "已接收") + if (model.BSSTATUS != "待审核") { throw Oops.Bah("当前状态不能审核"); } @@ -1549,6 +1549,8 @@ namespace Myshipping.Application bkOrder.CUSTOMERNAME = model.BookingTenantName; bkOrder.ParentId = 0; bkOrder.LANENAME = bkOrder.LANECODE; + bkOrder.OPID = UserManager.UserId.ToString(); + bkOrder.OP = UserManager.Name; await _repOrder.InsertAsync(bkOrder); var bkEdiExt = new BookingEDIExt(); @@ -1619,7 +1621,7 @@ namespace Myshipping.Application } else { - if (order.BSSTATUS != "已接收") + if (order.BSSTATUS != "待审核") { rtnList.Add(new BookingSubmitResultModel() { @@ -2016,11 +2018,10 @@ namespace Myshipping.Application jobj = JObject.Parse(custOrder.ExtendData); } - var jobjBookAcc = new JObject(); - jobjBookAcc["Account"] = input.BOOKINGACCOUNT; - jobjBookAcc["Password"] = input.BOOKINGPASSWORD; - jobj["BookingAccount"] = jobjBookAcc; - custOrder.ExtendData = jobjBookAcc.ToJsonString(); + jobj["Account"] = input.BOOKINGACCOUNT; + jobj["Password"] = input.BOOKINGPASSWORD; + jobj["OpMail"] = input.OPMAIL; + custOrder.ExtendData = jobj.ToJsonString(); var ctns = input.CtnList.Adapt>(); foreach (var ctn in ctns) diff --git a/Myshipping.Application/Service/BookingCustomerOrder/Dto/Dtos.cs b/Myshipping.Application/Service/BookingCustomerOrder/Dto/Dtos.cs index 08b2c1a3..4f4f8fa4 100644 --- a/Myshipping.Application/Service/BookingCustomerOrder/Dto/Dtos.cs +++ b/Myshipping.Application/Service/BookingCustomerOrder/Dto/Dtos.cs @@ -1210,5 +1210,10 @@ namespace Myshipping.Application /// 航线代码 /// public string LINECODE { get; set; } + + /// + /// 操作邮箱 + /// + public string OPMAIL { get; set; } } } diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index 1ad043ef..3829d279 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -142,6 +142,7 @@ namespace Myshipping.Application private readonly SqlSugarRepository _repextendstate; + private readonly SqlSugarRepository _repCustomerOrder; private readonly IServiceWorkFlowManageService _serviceWorkFlowManageService; private readonly IDjyUserConfigService _djyUserConfigService; @@ -179,7 +180,8 @@ 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, IBookingValueAddedService bookingValueAddedService) + SqlSugarRepository repBookingStatusSubscribe, SqlSugarRepository repTenantParamValue, IBookingValueAddedService bookingValueAddedService, + SqlSugarRepository repCustomerOrder) { this._logger = logger; this._rep = rep; @@ -234,6 +236,7 @@ namespace Myshipping.Application _repBookingStatusSubscribe = repBookingStatusSubscribe; _repTenantParamValue = repTenantParamValue; this.bookingValueAddedService = bookingValueAddedService; + this._repCustomerOrder = repCustomerOrder; } #region 主表和箱信息 @@ -2608,6 +2611,16 @@ namespace Myshipping.Application ordOut.BookingEDIExt = ediExtEntity.Adapt(); } + //运营端需返回订舱需求的信息 + if (App.Configuration["RunType"] is CommonConst.RUN_TYPE_DJY) + { + var custOrd = await _repCustomerOrder.AsQueryable().FirstAsync(x => x.BookingId == main.Id); + if (custOrd != null) + { + ordOut.CustomerOrderId = custOrd.Id; + } + } + return ordOut; } @@ -4680,7 +4693,7 @@ namespace Myshipping.Application //设置货物状态:已发下货纸,并回传东胜 await SetGoodsStatus("YFXHZ", bookingId); await SendBookingOrder(new long[] { bookingId }); - + } #endregion diff --git a/Myshipping.Application/Service/BookingOrder/Dto/BookingOrderOutput.cs b/Myshipping.Application/Service/BookingOrder/Dto/BookingOrderOutput.cs index 142734ff..f159b338 100644 --- a/Myshipping.Application/Service/BookingOrder/Dto/BookingOrderOutput.cs +++ b/Myshipping.Application/Service/BookingOrder/Dto/BookingOrderOutput.cs @@ -12,6 +12,11 @@ namespace Myshipping.Application public List HbList { get; set; } public BookingOrderUrlOutput Link { get; set; } public List Slots { get; set; } + + /// + /// 客户订舱需求ID + /// + public long? CustomerOrderId { get; set; } } public class BookingOrderUrlOutput diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageMapper.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageMapper.cs index cfec01b1..4501ead7 100644 --- a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageMapper.cs +++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageMapper.cs @@ -1,5 +1,6 @@ using Mapster; using Myshipping.Application.Entity; +using Myshipping.Application.Entity.TaskManagePlat; using Myshipping.Application.Service.TaskManagePlat.Dtos; using System; using System.Collections.Generic; @@ -1026,7 +1027,33 @@ namespace Myshipping.Application .Map(dest => dest.CARRIER, src => src.Carrier) .Map(dest => dest.TAKE_ISSUETYPE_NAME, src => src.TakeIssueTypeName) .Map(dest => dest.ISSUETYPE, src => src.IssueType) - .Map(dest => dest.NOTICE_DATE, src => src.NoticeDate); + .Map(dest => dest.NOTICE_DATE, src => src.NoticeDate) + .Map(dest => dest.SUBMITTED_DATE, src => src.SubmittedDate) + .Map(dest => dest.BILLOF_NUM, src => src.BillOfNum) + .Map(dest => dest.RELEASE_INSTRUCTION, src => src.ReleaseInstruction) + .Map(dest => dest.SI_SUBTYPE, src => src.SISubType) + .Map(dest => dest.SHIPPER, src => src.Shipper) + .Map(dest => dest.CONSIGNEE, src => src.Consignee) + .Map(dest => dest.NOTIFYPARTY, src => src.NotifyParty) + .Map(dest => dest.NOTIFYPARTY2, src => src.NotifyParty2) + .Map(dest => dest.HSCODE, src => src.HSCode) + .Map(dest => dest.DESCRIPTION, src => src.Description) + .Map(dest => dest.PKGS, src => src.PKGS) + .Map(dest => dest.KINDPKGS, src => src.KindPKGS) + .Map(dest => dest.KGS, src => src.KGS) + .Map(dest => dest.CBM, src => src.CBM); + + config.ForType() + .Map(dest => dest.CNTRNO, src => src.ContaNo) + .Map(dest => dest.CTNCODE, src => src.ContaType) + .Map(dest => dest.CTNALL, src => src.ContaTypeName) + .Map(dest => dest.SEALNO, src => src.SealNo) + .Map(dest => dest.PKGS, src => src.PKGS) + .Map(dest => dest.KINDPKGS, src => src.KINDPKGS) + .Map(dest => dest.KGS, src => src.KGS) + .Map(dest => dest.CBM, src => src.CBM) + .Map(dest => dest.WEIGHTYPE, src => src.WeighType) + .Map(dest => dest.WEIGHKGS, src => src.WeighKGS); config.ForType() .Map(dest => dest.MBL_NO, src => src.MBlNo) diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderSIFeedBackContaInfo.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderSIFeedBackContaInfo.cs index 740f6351..61cc705e 100644 --- a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderSIFeedBackContaInfo.cs +++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderSIFeedBackContaInfo.cs @@ -52,5 +52,21 @@ namespace Myshipping.Application /// /// 20GP public string ContaTypeName { get; set; } + + + /// + /// 包装 + /// + public string KINDPKGS { get; set; } + + /// + /// 称重方式 + /// + public string WeighType { get; set; } + + /// + /// 称重重量 + /// + public Nullable WeighKGS { get; set; } } } diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderSIFeedBackInfo.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderSIFeedBackInfo.cs index fe34ddb3..5b544216 100644 --- a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderSIFeedBackInfo.cs +++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderSIFeedBackInfo.cs @@ -40,10 +40,27 @@ namespace Myshipping.Application /// 通知人 /// public string NotifyParty { get; set; } + + /// + /// 第二通知人 + /// + public string NotifyParty2 { get; set; } + + /// + /// 订舱方 + /// + public string TransportReceiver { get; set; } + /// /// 唛头 /// public string Marks{ get; set; } + + /// + /// HS CODE + /// + public string HSCode { get; set; } + /// /// 货描 /// @@ -154,6 +171,11 @@ namespace Myshipping.Application /// public string ReleaseInstruction { get; set; } + /// + /// 是否拆单 SPLIT-标识已拆单 + /// + public string SISubType { get; set; } + /// /// 箱信息 /// diff --git a/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageSISubmittedService.cs b/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageSISubmittedService.cs index 126f38c7..463ce967 100644 --- a/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageSISubmittedService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageSISubmittedService.cs @@ -39,5 +39,12 @@ namespace Myshipping.Application /// 截单回执任务主键 /// 返回回执 Task SearchAndConnectBookingInfo(string taskPkId); + + /// + /// 处理SI截单回执 + /// + /// 截单回执任务主键 + /// 返回回执 + Task ProcessSISubmitted(string taskPkId); } } diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskManageSISubmittedService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskManageSISubmittedService.cs index 5bfe9af8..c153a74a 100644 --- a/Myshipping.Application/Service/TaskManagePlat/TaskManageSISubmittedService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/TaskManageSISubmittedService.cs @@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using Myshipping.Application.Entity; using Myshipping.Core; +using Myshipping.Core.Service; using System; using System.Collections.Generic; using System.Linq; @@ -24,20 +25,29 @@ namespace Myshipping.Application private readonly SqlSugarRepository _taskSISubmittedRepository; private readonly SqlSugarRepository _taskBaseRepository; private readonly SqlSugarRepository _bookingOrderRepository; + private readonly SqlSugarRepository _businessCompareDiffRecordRepository; + private readonly ILogger _logger; private readonly IBookingValueAddedService _bookingValueAddedService; + private readonly IDjyTenantParamService _djyTenantParamService; + //租户SI回执是否自动更新订舱 + const string CONST_SI_SUBMITTED_DEFAULT_PARAM = "SI_SUBMITTED_AUTO_UPDATE_ORDER"; + public TaskManageSISubmittedService(ILogger logger, SqlSugarRepository taskSISubmittedRepository, SqlSugarRepository taskBaseRepository, SqlSugarRepository bookingOrderRepository, - IBookingValueAddedService bookingValueAddedService) + SqlSugarRepository businessCompareDiffRecordRepository, + IBookingValueAddedService bookingValueAddedService, IDjyTenantParamService djyTenantParamService) { _logger = logger; _taskSISubmittedRepository = taskSISubmittedRepository; _taskBaseRepository = taskBaseRepository; _bookingOrderRepository = bookingOrderRepository; _bookingValueAddedService = bookingValueAddedService; + _djyTenantParamService = djyTenantParamService; + _businessCompareDiffRecordRepository = businessCompareDiffRecordRepository; } #region 获取截单回执详情 @@ -165,7 +175,7 @@ namespace Myshipping.Application #region 重新处理截单任务 /// /// 重新处理截单任务 - /// 对未匹配订舱订单的任务记录重新对应订单订单 + /// 对未匹配订舱订单的任务记录重新对应订舱订单 /// /// 截单回执任务主键 /// 返回回执 @@ -190,7 +200,7 @@ namespace Myshipping.Application string mblNo = siSubmitted.MBL_NO.ToUpper().Trim(); var bookingInfo = _bookingOrderRepository.AsQueryable().Filter(null, true) - .FirstAsync(a => a.MBLNO == mblNo && a.IsDeleted == false && (a.ParentId == null || a.ParentId == 0)); + .FirstAsync(a => a.MBLNO == mblNo && a.IsDeleted == false && (a.ParentId == null || a.ParentId == 0) && a.TenantId == UserManager.TENANT_ID); if(bookingInfo == null) throw Oops.Oh($"提单号{mblNo}未提取有效的订舱订单"); @@ -215,5 +225,70 @@ namespace Myshipping.Application return result; } #endregion + + #region 处理SI截单回执 + /// + /// 处理SI截单回执 + /// + /// 截单回执任务主键 + /// 返回回执 + public async Task ProcessSISubmitted(string taskPkId) + { + TaskManageOrderResultDto result = new TaskManageOrderResultDto(); + + try + { + /* + 1、判断当前租户开启了自动更新订舱数据(SI_SUBMITTED_AUTO_UPDATE_ORDER=ENABLE) + 2、先与订舱数据进行比对,记录比对结果。 + 3、更新订舱详情 + */ + + var taskBase = _taskBaseRepository.AsQueryable().First(a => a.PK_ID == taskPkId); + + if (taskBase == null) + throw Oops.Oh($"任务主键{taskPkId}无法获取业务信息"); + + var siSubmitted = _taskSISubmittedRepository.AsQueryable().First(a => a.TASK_ID == taskBase.PK_ID); + + if (siSubmitted == null) + throw Oops.Oh($"截单回执主键{taskPkId}无法获取业务信息"); + + if (siSubmitted.BOOKING_ID.HasValue) + throw Oops.Oh($"当前截单回执已有匹配的订舱订单"); + + DjyTenantParamValueOutput paramConfig = null; + + var paramList = _djyTenantParamService.GetParaCodeWithValue(new[] { CONST_SI_SUBMITTED_DEFAULT_PARAM }).GetAwaiter().GetResult(); + + if (paramList != null && paramList.Count > 0) + { + paramConfig = paramList.FirstOrDefault(a => a.ParaCode.Equals(CONST_SI_SUBMITTED_DEFAULT_PARAM, StringComparison.OrdinalIgnoreCase)); + } + + if(paramConfig != null) + { + //更新前先比对一遍差异 + + //更新订舱数据 + + //更新任务的状态 + + //直接完成SI的回执任务 + } + else + { + result.msg = "当前租户没开通自动(SI回执是否自动更新订舱)"; + } + } + catch (Exception ex) + { + result.succ= false; + result.msg = ex.Message; + } + + return result; + } + #endregion } } diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs index 6f5e458f..c5c0999d 100644 --- a/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs @@ -17,6 +17,7 @@ using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.Extensions.Logging; using Myshipping.Application.EDI; using Myshipping.Application.Entity; +using Myshipping.Application.Entity.TaskManagePlat; using Myshipping.Application.Helper; using Myshipping.Application.Service.BookingOrder; using Myshipping.Application.Service.BookingSlot.Dto; @@ -76,7 +77,7 @@ namespace Myshipping.Application { private readonly SqlSugarRepository _taskBaseInfoRepository; private readonly SqlSugarRepository _taskSISubmittedRepository; - private readonly SqlSugarRepository _taskSIFeedBackContaInfoRepository; + private readonly SqlSugarRepository _taskSISubmittedCtnRepository; private readonly SqlSugarRepository _taskBillFeeDetailInfoRepository; private readonly SqlSugarRepository _taskFileInfoRepository; private readonly SqlSugarRepository _taskEmailInfoRepository; @@ -140,7 +141,7 @@ namespace Myshipping.Application public TaskManageService(SqlSugarRepository taskBaseInfoRepository, SqlSugarRepository taskSISubmittedRepository, - SqlSugarRepository taskSIFeedBackContaInfoRepository, + SqlSugarRepository taskSISubmittedCtnRepository, SqlSugarRepository taskBillFeeDetailInfoRepository, SqlSugarRepository taskFileInfoRepository, SqlSugarRepository taskEmailInfoRepository, @@ -186,7 +187,7 @@ namespace Myshipping.Application { _taskBaseInfoRepository = taskBaseInfoRepository; _taskSISubmittedRepository = taskSISubmittedRepository; - _taskSIFeedBackContaInfoRepository = taskSIFeedBackContaInfoRepository; + _taskSISubmittedCtnRepository = taskSISubmittedCtnRepository; _taskBillFeeDetailInfoRepository = taskBillFeeDetailInfoRepository; _taskFileInfoRepository = taskFileInfoRepository; _taskEmailInfoRepository = taskEmailInfoRepository; @@ -339,26 +340,37 @@ namespace Myshipping.Application //如果大简云用户ID不为空,接收人为空时,通过大简云用户ID关联订舱人ID if (UserManager.UserId != null) { - userTendInfo = new UserTendDto + //这里只有派车不是公共任务,其他基本都是公共任务 + if (info.Main.TaskType == TaskBaseTypeEnum.TRUCK_DISPATCH) { - userId = UserManager.UserId, - userName = UserManager.Name, - tendId = UserManager.TENANT_ID, - tenantName = UserManager.TENANT_NAME - }; + userTendInfo = GetUserTendInfo(info.Main.RecvUserId); - taskInfo.IS_PUBLIC = 1; + taskInfo.IS_PUBLIC = 0; + } + else + { + userTendInfo = new UserTendDto + { + userId = UserManager.UserId, + userName = UserManager.Name, + tendId = UserManager.TENANT_ID, + tenantName = UserManager.TENANT_NAME + }; + + taskInfo.IS_PUBLIC = 1; + } + } else if (!string.IsNullOrWhiteSpace(info.Main.DJYRecvUserId) && string.IsNullOrWhiteSpace(info.Main.TaskUserId)) { userTendInfo = GetUserTendInfoByDJYUserId(info.Main.DJYRecvUserId, info.Main.DJYRecvUserEmail); - if(userTendInfo != null) + if (userTendInfo != null) { taskInfo.IS_PUBLIC = 0; } } - else if(string.IsNullOrWhiteSpace(info.Main.DJYRecvUserId) && string.IsNullOrWhiteSpace(info.Main.TaskUserId) && + else if (string.IsNullOrWhiteSpace(info.Main.DJYRecvUserId) && string.IsNullOrWhiteSpace(info.Main.TaskUserId) && !string.IsNullOrWhiteSpace(info.Main.TaskRecvEmail) && info.Main.TaskTenatId.HasValue && info.Main.TaskTenatId.Value > 0) { userTendInfo = GetUserTendInfoByEmail(info.Main.TaskTenatId.Value, info.Main.TaskRecvEmail); @@ -435,6 +447,12 @@ namespace Myshipping.Application fileCategory = TaskFileCategoryEnum.DRAFT.ToString(); } + else if (TaskBaseTypeEnum.SI_FEEDBACK.ToString() == taskInfo.TASK_BASE_TYPE) + { + attachFileType = "sisubmittedfiles"; + + fileCategory = TaskFileCategoryEnum.SI_SUBMITTED.ToString(); + } var noExtensionFileName = Path.GetFileNameWithoutExtension(file.FileName); var fileFullName = await FileAttachHelper.SaveFile(taskInfo.PK_ID, bytes, batchNo, noExtensionFileName, @@ -618,18 +636,18 @@ namespace Myshipping.Application taskSISubmitted.TenantId = taskInfo.TenantId; taskSISubmitted.TenantName = taskInfo.TenantName; - await _taskSISubmittedRepository.InsertAsync(taskSISubmitted); + _taskSISubmittedRepository.Insert(taskSISubmitted); + - /* //SI反馈箱信息入库 if (info.Main.SIFeedBack.ContaList != null && info.Main.SIFeedBack.ContaList.Count > 0) { info.Main.SIFeedBack.ContaList.ForEach(async ctn => { - var contaInfo = ctn.Adapt(); + var contaInfo = ctn.Adapt(); contaInfo.PK_ID = IDGen.NextID().ToString(); - contaInfo.P_PKID = taskSIFeedBackInfo.PK_ID; + contaInfo.P_PKID = taskSISubmitted.PK_ID; contaInfo.CreatedTime = taskInfo.CreatedTime; contaInfo.UpdatedTime = taskInfo.CreatedTime; @@ -639,9 +657,11 @@ namespace Myshipping.Application contaInfo.TenantId = taskInfo.TenantId; contaInfo.TenantName = taskInfo.TenantName; - await _taskSIFeedBackContaInfoRepository.InsertAsync(contaInfo); + _taskSISubmittedCtnRepository.Insert(contaInfo); }); - }*/ + } + + //这里入库完成后执行SI的处理 } #endregion