diff --git a/Myshipping.Application/Entity/TaskManagePlat/TaskVGMFeedBackInfo.cs b/Myshipping.Application/Entity/TaskManagePlat/TaskVGMFeedBackInfo.cs index fd9e86a3..969ea4fb 100644 --- a/Myshipping.Application/Entity/TaskManagePlat/TaskVGMFeedBackInfo.cs +++ b/Myshipping.Application/Entity/TaskManagePlat/TaskVGMFeedBackInfo.cs @@ -59,5 +59,10 @@ namespace Myshipping.Application.Entity /// 称重方式 /// public string WEIGHTYPE { get; set; } + + /// + /// 主单号 + /// + public string MBL_NO { get; set; } } } diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskBookingOrderDto.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskBookingOrderDto.cs index 6392da86..dccd35f4 100644 --- a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskBookingOrderDto.cs +++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskBookingOrderDto.cs @@ -87,30 +87,37 @@ namespace Myshipping.Application /// /// 开船日期 /// + /// 2022-01-01 public string ETD { get; set; } /// /// 实际开船日期 /// + /// 2022-01-01 public string ATD { get; set; } /// /// 预计到港日期 /// + /// 2022-01-01 public string ETA { get; set; } /// /// 截港日期 /// + /// 2022-01-01 public string ClosingDate { get; set; } /// /// 截单日期 /// + /// 2022-01-01 public string CloseDocDate { get; set; } /// /// 截VGM时间 /// + /// 2022-01-01 public string CloseVGMDate { get; set; } /// /// 收货地代码 /// + /// CNTAO public string PlaceReceiptId { get; set; } /// /// 收货地 @@ -119,6 +126,7 @@ namespace Myshipping.Application /// /// 起运港代码 /// + /// CNTAO public string PortLoadId { get; set; } /// /// 起运港 @@ -127,6 +135,7 @@ namespace Myshipping.Application /// /// 卸货港代码 /// + /// USDCB public string PortDischargeId { get; set; } /// /// 卸货港 @@ -135,6 +144,7 @@ namespace Myshipping.Application /// /// 交货地代码 /// + /// USDCB public string PlaceDeliveryId { get; set; } /// /// 交货地 @@ -143,6 +153,7 @@ namespace Myshipping.Application /// /// 目的地代码 /// + /// USDCB public string DestinationId { get; set; } /// /// 目的地 @@ -163,6 +174,7 @@ namespace Myshipping.Application /// /// 签单日期 /// + /// 2022-01-01 public string IssueDate { get; set; } /// /// 签单地点代码 @@ -544,6 +556,7 @@ namespace Myshipping.Application /// /// 中转港代码 /// + /// public string TransportId { get; set; } /// /// 中转港 diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskCompareResultDto.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskCompareResultDto.cs new file mode 100644 index 00000000..6a225e00 --- /dev/null +++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskCompareResultDto.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Myshipping.Application +{ + /// + /// + /// + public class TaskCompareResultDto + { + /// + /// 字段代码 + /// + public string Code { get; set; } + + /// + /// 原值 + /// + public object SrcVal { get; set; } + + /// + /// 修改值 + /// + public object TargetVal { get; set; } + + /// + /// 是否不一致 + /// + public bool IsDiff { get; set; } = false; + + /// + /// 字段类型 + /// + public Type ValType { get; set; } + } +} diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageMapper.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageMapper.cs index 99328ed7..b11b1565 100644 --- a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageMapper.cs +++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageMapper.cs @@ -72,7 +72,8 @@ namespace Myshipping.Application .Map(dest => dest.KGS, src => src.KGS) .Map(dest => dest.TAREWEIGHT, src => src.TAREWEIGHT) .Map(dest => dest.WEIGHKGS, src => src.WEIGHKGS) - .Map(dest => dest.WEIGHTYPE, src => src.WEIGHTYPE); + .Map(dest => dest.WEIGHTYPE, src => src.WEIGHTYPE) + .Map(dest => dest.MBL_NO, src => src.MBLNo); config.ForType() @@ -163,7 +164,7 @@ namespace Myshipping.Application .Map(dest => dest.CloseVGMDate, src => src.CLOSEVGMDATE.HasValue ? src.CLOSEVGMDATE.Value.ToString("yyyy-MM-dd HH:mm:ss") : "") .Map(dest => dest.PlaceReceiptId, src => src.PLACERECEIPTID) .Map(dest => dest.PlaceReceipt, src => src.PLACERECEIPT) - .Map(dest => dest.PortLoadId, src => src.PORTLOAD) + .Map(dest => dest.PortLoadId, src => src.PORTLOADID) .Map(dest => dest.PortLoad, src => src.PORTLOAD) .Map(dest => dest.PortDischargeId, src => src.PORTDISCHARGEID) .Map(dest => dest.PortDischarge, src => src.PORTDISCHARGE) @@ -354,6 +355,237 @@ namespace Myshipping.Application .Map(dest => dest.CreatedUserName, src => src.CreatedUserName) .Map(dest => dest.UpdatedUserId, src => src.UpdatedUserId.ToString()) .Map(dest => dest.UpdatedUserName, src => src.UpdatedUserName); + + + config.ForType() + .Map(dest => dest.Shipper, src => src.SHIPPER) + .Map(dest => dest.Consignee, src => src.CONSIGNEE) + .Map(dest => dest.NotifyParty, src => src.NOTIFYPARTY) + .Map(dest => dest.Marks, src => src.MARKS) + .Map(dest => dest.Description, src => src.DESCRIPTION) + .Map(dest => dest.Remark, src => src.REMARK) + .Map(dest => dest.BLFRT, src => src.BLFRT) + .Map(dest => dest.Service, src => src.SERVICE) + .Map(dest => dest.IssueType, src => src.ISSUETYPE) + .Map(dest => dest.PortLoadId, src => src.PORT_LOADID) + .Map(dest => dest.PortLoad, src => src.PORT_LOAD) + .Map(dest => dest.PortDischargeId, src => src.PORT_DISCHARGEID) + .Map(dest => dest.PortDischarge, src => src.PORT_DISCHARGE) + .Map(dest => dest.PortTransId, src => src.PORT_TRANSID) + .Map(dest => dest.PortTrans, src => src.PORT_TRANS) + .Map(dest => dest.DestinationId, src => src.DESTINATION_ID) + .Map(dest => dest.Destination, src => src.DESTINATION) + .Map(dest => dest.KindPKGS, src => src.KIND_PKGS) + .Map(dest => dest.PKGS, src => src.PKGS) + .Map(dest => dest.ThirdPayAddr, src => src.THIRDPAYADDR); + + + config.ForType() + .Map(dest => dest.ContaNo, src => src.CONTA_NO) + .Map(dest => dest.SealNo, src => src.SEAL_NO) + .Map(dest => dest.PKGS, src => src.PKGS) + .Map(dest => dest.KGS, src => src.KGS) + .Map(dest => dest.CBM, src => src.CBM) + .Map(dest => dest.ContaType, src => src.CONTA_TYPE) + .Map(dest => dest.ContaTypeName, src => src.CONTA_TYPE_NAME); + + + config.ForType() + .Map(dest => dest.ContaNo, src => src.CONTA_NO) + .Map(dest => dest.SealNo, src => src.SEAL_NO) + .Map(dest => dest.ContaType, src => src.CONTA_TYPE) + .Map(dest => dest.ContaTypeName, src => src.CONTA_TYPE_NAME) + .Map(dest => dest.KGS, src => src.KGS) + .Map(dest => dest.TareWeight, src => src.TAREWEIGHT) + .Map(dest => dest.WeighKGs, src => src.WEIGHKGS) + .Map(dest => dest.WeighType, src => src.WEIGHTYPE) + .Map(dest => dest.MBLNo, src => src.MBL_NO); + + + config.ForType() + .Map(dest => dest.ContaNo, src => src.CONTA_NO) + .Map(dest => dest.SealNo, src => src.SEAL_NO) + .Map(dest => dest.ContaType, src => src.CONTA_TYPE) + .Map(dest => dest.ContaTypeName, src => src.CONTA_TYPE_NAME) + .Map(dest => dest.KGS, src => src.KGS) + .Map(dest => dest.TareWeight, src => src.TAREWEIGHT) + .Map(dest => dest.WeighKGs, src => src.WEIGHKGS) + .Map(dest => dest.WeighType, src => src.WEIGHTYPE) + .Map(dest => dest.MBLNo, src => src.MBL_NO); + + + config.ForType() + .Map(dest => dest.ContaNo, src => src.CNTRNO) + .Map(dest => dest.SealNo, src => src.SEALNO) + .Map(dest => dest.ContaType, src => src.CTNCODE) + .Map(dest => dest.ContaTypeName, src => src.CTNALL) + .Map(dest => dest.KGS, src => src.KGS) + .Map(dest => dest.TareWeight, src => src.TAREWEIGHT) + .Map(dest => dest.WeighKGs, src => src.WEIGHKGS) + .Map(dest => dest.WeighType, src => src.WEIGHTYPE); + + + config.ForType() + .Map(dest => dest.CTNCODE, src => src.ContaType) + .Map(dest => dest.CTNALL, src => src.ContaTypeName) + .Map(dest => dest.TEU, src => src.TEU) + .Map(dest => dest.CNTRNO, src => src.ContaNo) + .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.TAREWEIGHT, src => src.TareWeight) + .Map(dest => dest.CTNSTATUS, src => src.ContaStatus) + .Map(dest => dest.WEIGHTYPE, src => src.WeighType) + .Map(dest => dest.WEIGHKGS, src => src.WeighKGs) + .Map(dest => dest.WEIGHATTN, src => src.WeighAttn) + .Map(dest => dest.VGMCONNCOM, src => src.VGMConnCom) + .Map(dest => dest.WEIGHTEL, src => src.WeighTel) + .Map(dest => dest.WEIGHDATE, src => src.WeighDate) + .Map(dest => dest.VGMADDR, src => src.VGMAddr) + .Map(dest => dest.VGMEMAIL, src => src.VGMEmail) + .Map(dest => dest.REMARK, src => src.Remark); + + + config.ForType() + .Map(dest => dest.MBLNO, src => src.MasterBlNo) + .Map(dest => dest.HBLNO, src => src.HouseBlNo) + .Map(dest => dest.BOOKINGNO, src => src.BookingNo) + .Map(dest => dest.CONTRACTNO, src => src.ContrNo) + .Map(dest => dest.SERVICECONTRACTNO, src => src.ServContrNo) + .Map(dest => dest.SHIPPERID, src => src.ShipperId) + .Map(dest => dest.CONSIGNEEID, src => src.ConsigneeId) + .Map(dest => dest.NOTIFYPARTYID, src => src.NotifyPartyId) + .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.NotifyPrt2) + .Map(dest => dest.YARDID, src => src.YardId) + .Map(dest => dest.YARD, src => src.Yard) + .Map(dest => dest.VESSELID, src => src.VesselId) + .Map(dest => dest.VESSEL, src => src.Vessel) + .Map(dest => dest.VOYNO, src => src.Voyno) + .Map(dest => dest.VOYNOINNER, src => src.VoynoIn) + .Map(dest => dest.ETD, src => src.ETD) + .Map(dest => dest.ATD, src => src.ATD) + .Map(dest => dest.ETA, src => src.ETA) + .Map(dest => dest.CLOSINGDATE, src => src.ClosingDate) + .Map(dest => dest.CLOSEDOCDATE, src => src.CloseDocDate) + .Map(dest => dest.CLOSEVGMDATE, src => src.CloseVGMDate) + .Map(dest => dest.PLACERECEIPTID, src => src.PlaceReceiptId) + .Map(dest => dest.PLACERECEIPT, src => src.PlaceReceipt) + .Map(dest => dest.PORTLOADID, src => src.PortLoadId) + .Map(dest => dest.PORTLOAD, src => src.PortLoad) + .Map(dest => dest.PORTDISCHARGEID, src => src.PortDischargeId) + .Map(dest => dest.PORTDISCHARGE, src => src.PortDischarge) + .Map(dest => dest.PLACEDELIVERYID, src => src.PlaceDeliveryId) + .Map(dest => dest.PLACEDELIVERY, src => src.PlaceDelivery) + .Map(dest => dest.DESTINATIONID, src => src.DestinationId) + .Map(dest => dest.DESTINATION, src => src.Destination) + .Map(dest => dest.NOBILL, src => src.NoBill) + .Map(dest => dest.COPYNOBILL, src => src.CopyNoBill) + .Map(dest => dest.ISSUETYPE, src => src.IssueType) + .Map(dest => dest.ISSUEDATE, src => src.IssueDate) + .Map(dest => dest.ISSUEPLACEID, src => src.IssuePlaceId) + .Map(dest => dest.ISSUEPLACE, src => src.IssuePlace) + .Map(dest => dest.BLFRT, src => src.Blfrt) + .Map(dest => dest.PREPARDAT, src => src.PrepardAt) + .Map(dest => dest.PAYABLEAT, src => src.PayableAt) + .Map(dest => dest.SERVICE, src => src.Service) + .Map(dest => dest.MARKS, src => src.Marks) + .Map(dest => dest.HSCODE, src => src.HsCode) + .Map(dest => dest.DESCRIPTION, src => src.GoodsDescription) + .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.TOTALNO, src => src.TotalNO) + .Map(dest => dest.CNTRTOTAL, src => src.CntrTotal) + .Map(dest => dest.CARRIERID, src => src.CarrierId) + .Map(dest => dest.CARRIER, src => src.Carrier) + .Map(dest => dest.CARGOID, src => src.CargoId) + .Map(dest => dest.DCLASS, src => src.DClass) + .Map(dest => dest.DUNNO, src => src.DUnno) + .Map(dest => dest.DPAGE, src => src.DPage) + .Map(dest => dest.DLABEL, src => src.DLabel) + .Map(dest => dest.LINKMAN, src => src.DLinkMan) + .Map(dest => dest.TEMPID, src => src.TempId) + .Map(dest => dest.TEMPSET, src => src.TempSet) + .Map(dest => dest.REEFERF, src => src.Reeferf) + .Map(dest => dest.HUMIDITY, src => src.Humidity) + .Map(dest => dest.TEMPMIN, src => src.TempMin) + .Map(dest => dest.TEMPMAX, src => src.TempMax) + .Map(dest => dest.ISCONTAINERSOC, src => src.IsContaSOC) + .Map(dest => dest.SOREMARK, src => src.SORemark) + .Map(dest => dest.SIREMARK, src => src.SIRemark) + .Map(dest => dest.YARDREMARK, src => src.YardRemark) + .Map(dest => dest.SHIPPERNAME, src => src.ShipperName) + .Map(dest => dest.SHIPPERADDR1, src => src.ShipperAddr1) + .Map(dest => dest.SHIPPERADDR2, src => src.ShipperAddr2) + .Map(dest => dest.SHIPPERADDR3, src => src.ShipperAddr3) + .Map(dest => dest.SHIPPERCITY, src => src.ShipperCity) + .Map(dest => dest.SHIPPERPROVINCE, src => src.ShipperProvice) + .Map(dest => dest.SHIPPERPOSTCODE, src => src.ShipperPostCode) + .Map(dest => dest.SHIPPERCOUNTRY, src => src.ShipperCountry) + .Map(dest => dest.SHIPPERATTN, src => src.ShipperAttn) + .Map(dest => dest.SHIPPERTEL, src => src.ShipperTel) + .Map(dest => dest.CONSIGNEENAME, src => src.ConsigneeName) + .Map(dest => dest.CONSIGNEEADDR1, src => src.ConsigneeAddr1) + .Map(dest => dest.CONSIGNEEADDR2, src => src.ConsigneeAddr2) + .Map(dest => dest.CONSIGNEEADDR3, src => src.ConsigneeAddr3) + .Map(dest => dest.CONSIGNEECITY, src => src.ConsigneeCity) + .Map(dest => dest.CONSIGNEEPROVINCE, src => src.ConsigneeProvince) + .Map(dest => dest.CONSIGNEEPOSTCODE, src => src.ConsigneePostCode) + .Map(dest => dest.CONSIGNEERCOUNTRY, src => src.ConsigneeCountry) + .Map(dest => dest.CONSIGNEEATTN, src => src.ConsigneeAttn) + .Map(dest => dest.CONSIGNEETEL, src => src.ConsigneeTel) + .Map(dest => dest.NOTIFYPARTYNAME, src => src.NotifyPartyName) + .Map(dest => dest.NOTIFYPARTYADDR1, src => src.NotifyPartyAddr1) + .Map(dest => dest.NOTIFYPARTYADDR2, src => src.NotifyPartyAddr2) + .Map(dest => dest.NOTIFYPARTYADDR3, src => src.NotifyPartyAddr3) + .Map(dest => dest.NOTIFYPARTYCITY, src => src.NotifyPartyCity) + .Map(dest => dest.NOTIFYPARTYPROVINCE, src => src.NotifyPartyProvince) + .Map(dest => dest.NOTIFYPARTYPOSTCODE, src => src.NotifyPartyPostCode) + .Map(dest => dest.NOTIFYPARTYCOUNTRY, src => src.NotifyPartyCountry) + .Map(dest => dest.NOTIFYPARTYATTN, src => src.NotifyPartyAttn) + .Map(dest => dest.NOTIFYPARTYTEL, src => src.NotifyPartyTel) + .Map(dest => dest.CUSTOMSER, src => src.CustomsER) + .Map(dest => dest.TRUCKER, src => src.TruckER) + .Map(dest => dest.AGENTID, src => src.AgentId) + .Map(dest => dest.FORWARDERID, src => src.ForwarderId) + .Map(dest => dest.SHIPAGENCYID, src => src.ShipAgencyId) + .Map(dest => dest.CUSTOMSERID, src => src.CustomsERId) + .Map(dest => dest.TRUCKERID, src => src.TruckERId) + .Map(dest => dest.AGENTNAME, src => src.AgentName) + .Map(dest => dest.CONSIGNEEDOORADDR, src => src.ConsigneeDoorAddr) + .Map(dest => dest.SHIPPERDOORADDR, src => src.ShipperDoorAddr) + .Map(dest => dest.SCACCODE, src => src.SCACCode) + .Map(dest => dest.ITNCODE, src => src.ITNCode) + .Map(dest => dest.PREPARDATID, src => src.PrePardAtId) + .Map(dest => dest.PAYABLEATID, src => src.PayableAtId) + .Map(dest => dest.CUSTNO, src => src.CustNo) + .Map(dest => dest.TRANSPORTID, src => src.TransportId) + .Map(dest => dest.TRANSPORT, src => src.Transport) + .Map(dest => dest.THIRDPAYADDR, src => src.ThirdPayAddr) + .Map(dest => dest.YARDCONTRACTTEL, src => src.YardContractTel) + .Map(dest => dest.YARDCONTRACTEMAIL, src => src.YardContractEmail) + .Map(dest => dest.FEESELF, src => src.FeeSelf) + .Map(dest => dest.LANECODE, src => src.LaneCode) + .Map(dest => dest.LANENAME, src => src.LaneName) + .Map(dest => dest.FREIGHTPAYER, src => src.FreightPayer); + + + config.ForType() + .Map(dest => dest.CTNCODE, src => src.CONTA_TYPE) + .Map(dest => dest.CTNALL, src => src.CONTA_TYPE_NAME) + .Map(dest => dest.CNTRNO, src => src.CONTA_NO) + .Map(dest => dest.SEALNO, src => src.SEAL_NO) + .Map(dest => dest.KGS, src => src.KGS) + .Map(dest => dest.TAREWEIGHT, src => src.TAREWEIGHT) + .Map(dest => dest.WEIGHTYPE, src => src.WEIGHTYPE) + .Map(dest => dest.WEIGHKGS, src => src.WEIGHKGS); } + } } diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderVGMFeedBackInfo.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderVGMFeedBackInfo.cs index 97562128..cfd411c9 100644 --- a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderVGMFeedBackInfo.cs +++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderVGMFeedBackInfo.cs @@ -50,5 +50,11 @@ namespace Myshipping.Application /// 称重方式 /// public string WEIGHTYPE { get; set; } + + + /// + /// 主单号 + /// + public string MBLNo { get; set; } } } diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskSIFeedBackResultBusiDto.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskSIFeedBackResultBusiDto.cs new file mode 100644 index 00000000..cdb77a0d --- /dev/null +++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskSIFeedBackResultBusiDto.cs @@ -0,0 +1,111 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Myshipping.Application +{ + public class TaskSIFeedBackResultBusiDto + { + /// + /// 发货人 + /// + public string Shipper { get; set; } + /// + /// 收货人 + /// + public string Consignee { get; set; } + /// + /// 通知人 + /// + public string NotifyParty { get; set; } + /// + /// 唛头 + /// + public string Marks { get; set; } + /// + /// 货描 + /// + public string Description { get; set; } + /// + /// 截单备注 + /// + public string Remark { get; set; } + /// + /// 付费方式 + /// + public string BLFRT { get; set; } + /// + /// 运输条款 + /// + /// CY-CY + public string Service { get; set; } + /// + /// 签单方式 + /// + /// TELEX + public string IssueType { get; set; } + /// + /// 装货港代码 + /// + /// CNTAO + public string PortLoadId { get; set; } + /// + /// 装货港 + /// + public string PortLoad { get; set; } + /// + /// 卸货港代码 + /// + /// GUPIT + public string PortDischargeId { get; set; } + /// + /// 卸货港 + /// + public string PortDischarge { get; set; } + /// + /// 中转港代码 + /// + /// GUPIT + public string PortTransId { get; set; } + /// + /// 中转港 + /// + public string PortTrans { get; set; } + /// + /// 目的地代码 + /// + /// GUPIT + public string DestinationId { get; set; } + /// + /// 目的地 + /// + public string Destination { get; set; } + /// + /// 件数 + /// + public int? PKGS { get; set; } + /// + /// 包装 + /// + public string KindPKGS { get; set; } + /// + /// 毛重 + /// + public decimal? KGS { get; set; } + /// + /// 尺寸 + /// + public decimal? CBM { get; set; } + /// + /// 第三付款地 + /// + public string ThirdPayAddr { get; set; } + + /// + /// 箱信息 + /// + public List ContaList { get; set; } + } +} diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskSIFeedBackResultContaDto.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskSIFeedBackResultContaDto.cs new file mode 100644 index 00000000..63728170 --- /dev/null +++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskSIFeedBackResultContaDto.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Myshipping.Application +{ + /// + /// SI集装箱 + /// + public class TaskSIFeedBackResultContaDto + { + /// + /// 集装箱号 + /// + /// RFCU2088064 + public string ContaNo { get; set; } + + /// + /// 铅封号 + /// + /// T090518 + public string SealNo { get; set; } + + /// + /// 件数 + /// + /// 222 + public int PKGS { get; set; } + + /// + /// 重量 + /// + /// 1651 + public decimal? KGS { get; set; } + + /// + /// 尺寸 + /// + /// 9.67 + public decimal? CBM { get; set; } + + /// + /// 箱型代码 + /// + /// 20GP + public string ContaType { get; set; } + + /// + /// 箱型 + /// + /// 20GP + public string ContaTypeName { get; set; } + } +} diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskSIFeedBackResultDto.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskSIFeedBackResultDto.cs new file mode 100644 index 00000000..5ad1b027 --- /dev/null +++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskSIFeedBackResultDto.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Myshipping.Application +{ + /// + /// SI详情 + /// + public class TaskSIFeedBackResultDto + { + // + /// 任务主键 + /// + public string TaskId { get; set; } + + /// + /// 订舱详情 + /// + public TaskBookingOrderDto BookingOrder { get; set; } + + /// + /// SI详情 + /// + public TaskSIFeedBackResultBusiDto BusiInfo { get; set; } + + /// + /// SI与订舱主信息比对差异字段列表 + /// + public List SICompareOrderKeyList { get; set; } + + /// + /// SI与订舱集装箱比对差异字段列表 + /// + public List SICompareOrderContaKeyList { get; set; } + } +} diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskSIModifyDto.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskSIModifyDto.cs new file mode 100644 index 00000000..2b4cae48 --- /dev/null +++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskSIModifyDto.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Myshipping.Application +{ + public class TaskSIModifyDto: TaskBookingOrderDto + { + /// + /// 任务主键 + /// + public string TaskPKId { get; set; } + } +} diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskVGMFeedBackDto.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskVGMFeedBackDto.cs new file mode 100644 index 00000000..1ffd201f --- /dev/null +++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskVGMFeedBackDto.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Myshipping.Application +{ + /// + /// VGM反馈 + /// + public class TaskVGMFeedBackDto + { + /// + /// 集装箱号 + /// + public string ContaNo { get; set; } + + /// + /// 铅封号 + /// + public string SealNo { get; set; } + + /// + /// 箱型代码 + /// + public string ContaType { get; set; } + + /// + /// 箱型 + /// + public string ContaTypeName { get; set; } + + /// + /// 重量 + /// + public decimal? KGS { get; set; } + + /// + /// 皮重 + /// + public decimal? TareWeight { get; set; } + + /// + /// 称重重量 + /// + public decimal? WeighKGs { get; set; } + + /// + /// 称重方式 + /// + public string WeighType { get; set; } + + /// + /// 主单号 + /// + public string MBLNo { get; set; } + } +} diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskVgmCompareResultDto.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskVgmCompareResultDto.cs new file mode 100644 index 00000000..1eaa28f7 --- /dev/null +++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskVgmCompareResultDto.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Myshipping.Application +{ + public class TaskVgmCompareDto : TaskVGMFeedBackDto + { + /// + /// 比对差异字段 + /// + public List compareDiffList { get; set; } + } + + + public class TaskVgmCompareResultDto + { + /// + /// 订舱与VGM反馈差异对比 + /// + public List bookOrderCompareList { get; set; } + + /// + /// VGM反馈与订舱差异比对 + /// + public List vgmCompareList { get; set; } + } +} diff --git a/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageService.cs b/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageService.cs index cde968b6..4d99ed1f 100644 --- a/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageService.cs @@ -174,5 +174,35 @@ namespace Myshipping.Application /// 排序方法,默认降序 /// 返回结果 Task LaraPaperRecordExport(string sortField, int pageNo = 1, int pageSize = 30, bool descSort = true); + + /// + /// 保存SI信息 + /// + /// 订舱信息 + /// 返回结果 + Task SaveBookingSI(TaskBookingOrderDto model); + + + /// + /// 获取SI反馈信息 + /// + /// 任务主键 + /// 返回结果 + Task GetSIFeedBackInfo(string taskPKId); + + /// + /// 获取VGM比较结果 + /// + /// 任务主键 + /// 返回结果 + Task GetVGMCompareResult(string taskPKId); + + /// + /// 更新订舱(VGM比较更新) + /// + /// 任务主键 + /// 返回结果 + Task SaveBookingVGM(string taskPKId); + } } diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs index 5aa6e6c2..e98de14b 100644 --- a/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs @@ -4,6 +4,7 @@ using Furion.DistributedIDGenerator; using Furion.DynamicApiController; using Furion.FriendlyException; using Furion.JsonSerialization; +using Furion.Localization; using Furion.RemoteRequest; using Furion.RemoteRequest.Extensions; using Mapster; @@ -25,9 +26,12 @@ using Newtonsoft.Json.Linq; using Npoi.Mapper; using NPOI.HPSF; using NPOI.HSSF.UserModel; +using NPOI.OpenXmlFormats; using NPOI.POIFS.Crypt.Dsig; +using NPOI.SS.Formula.Eval; using NPOI.SS.Formula.Functions; using NPOI.SS.UserModel; +using NPOI.Util; using NPOI.XSSF.Model; using Org.BouncyCastle.Asn1.X500; using SixLabors.ImageSharp.Processing.Processors.Transforms; @@ -2435,7 +2439,7 @@ namespace Myshipping.Application /// 页码容量 /// 排序方法,默认降序 /// 返回结果 - [HttpGet("/TaskManage/GetLaraPaperRecordPage")] + [HttpGet("/TaskManage/LaraPaperRecordExport")] public async Task LaraPaperRecordExport([FromQuery] string sortField,[FromQuery] int pageNo = 1, [FromQuery] int pageSize = 30, [FromQuery] bool descSort = true) { QueryTaskManageBaseDto querySearch = new QueryTaskManageBaseDto @@ -2465,6 +2469,7 @@ namespace Myshipping.Application return new FileStreamResult(ms, "application/vnd.ms-excel") { FileDownloadName = $"{DateTime.Now.ToString("yyyyMMddHHmmss")}_LaraPaperRecord.xls" }; } + #region 导出提单纸登记记录生成Excel /// /// 导出提单纸登记记录生成Excel /// @@ -2529,6 +2534,735 @@ namespace Myshipping.Application return ms; } + #endregion + + #region 保存SI信息 + /// + /// 保存SI信息 + /// + /// 订舱信息 + /// 返回结果 + [HttpPost("/TaskManage/SaveBookingSI")] + public async Task SaveBookingSI(TaskBookingOrderDto model) + { + TaskManageOrderResultDto result = new TaskManageOrderResultDto(); + + /* + 1、比较原始数据和修改数据内容,记录差异。 + 2、更新订舱主信息和集装箱信息。 + 3、写入本地历史记录表。 + */ + try + { + if (string.IsNullOrWhiteSpace(model.TaskBaseInfo.PKId)) + throw Oops.Oh($"任务主键TaskBaseInfo.PKId不能为空"); + + var taskInfo = _taskBaseInfoRepository.AsQueryable().First(t => t.PK_ID == model.TaskBaseInfo.PKId); + + if (taskInfo == null) + throw Oops.Oh($"任务信息获取失败"); + + if (string.IsNullOrWhiteSpace(taskInfo.BOOK_ORDER_NO)) + throw Oops.Oh($"任务信息的订舱主键不存在"); + + if (taskInfo.TASK_TYPE != TaskBusiTypeEnum.SI_FEEDBACK.ToString()) + throw Oops.Oh($"当前任务类型不是{TaskBusiTypeEnum.SI_FEEDBACK.GetDescription()}"); + + //取订舱详情(包含集装箱) + var bookOrderList = _bookingOrderRepository.EntityContext.Queryable() + .LeftJoin(_bookingOrderRepository.EntityContext.Queryable(),(bk, ctn) => bk.Id == ctn.BILLID) + .Where((bk, ctn) => bk.Id == long.Parse(taskInfo.BOOK_ORDER_NO) && bk.TenantId == UserManager.TENANT_ID) + .Select((bk, ctn) => new { bk = bk, ctn = ctn }).ToList(); + + var orderInfo = bookOrderList.FirstOrDefault().bk; + + List orderCtnList = new List(); + + //这里是左连接查询,解决集装箱为空的情况 + if(bookOrderList.Any(t=>t.ctn.Id > 0)) + orderCtnList = bookOrderList.Select(t => t.ctn).ToList(); + + var mdBookingOrder = model.Adapt(); + + mdBookingOrder.Id = orderInfo.Id; + mdBookingOrder.UpdatedTime = DateTime.Now; + mdBookingOrder.UpdatedUserId = UserManager.UserId; + mdBookingOrder.UpdatedUserName = UserManager.Name; + + //比对主订舱信息 + var orderDiff = InnerCompare(orderInfo, mdBookingOrder); + + //比对箱信息 + var contaList = model.ContaList.Select(x => x.Adapt()).ToList(); + + /**/ + //这里参考原有的更新逻辑,只更新了SI回执有的字段信息,其他字段不更新,如果后期有调整可以自行增加更新字段 + await _bookingOrderRepository.AsUpdateable(mdBookingOrder).UpdateColumns(it => new + { + it.UpdatedTime, + it.UpdatedUserId, + it.UpdatedUserName, + it.SHIPPER, + it.CONSIGNEE, + it.NOTIFYPARTY, + it.MARKS, + it.DESCRIPTION, + it.BLFRT, + it.SERVICE, + it.ISSUETYPE, + it.PORTLOADID, + it.PORTLOAD, + it.PORTDISCHARGEID, + it.PORTDISCHARGE, + it.TRANSPORTID, + it.TRANSPORT, + it.DESTINATIONID, + it.DESTINATION, + it.PKGS, + it.KINDPKGS, + it.KGS, + it.CBM, + it.THIRDPAYADDR, + it.SIREMARK + }).ExecuteCommandAsync(); + + var ctnlist = await _bookingOrderContaRepository.AsQueryable().Where(x => x.BILLID == mdBookingOrder.Id).ToListAsync(); + + var si2orderCtnList = contaList.GroupJoin(ctnlist, l => l.CNTRNO?.Trim(), r => r.CNTRNO?.Trim(), (l, r) => { + var currInfo = r.FirstOrDefault(); + + if(currInfo == null) + { + l.BILLID = orderInfo.Id; + l.CreatedTime = DateTime.Now; + l.CreatedUserId = UserManager.UserId; + l.CreatedUserName = UserManager.Name; + + l.UpdatedTime = l.CreatedTime; + l.UpdatedUserId = UserManager.UserId; + l.UpdatedUserName = UserManager.Name; + return new { OperType = "insert", obj = l }; + } + else + { + currInfo.Id = l.Id; + currInfo.BILLID = l.BILLID; + currInfo.UpdatedTime = DateTime.Now; + currInfo.UpdatedUserId = UserManager.UserId; + currInfo.UpdatedUserName = UserManager.Name; + + return new { OperType = "update", obj = currInfo }; + } + }).ToList(); + + + var delList = ctnlist.GroupJoin(contaList, l => l.CNTRNO?.Trim(), r => r.CNTRNO?.Trim(), (l, r) => { + var currInfo = r.FirstOrDefault(); + + if (currInfo == null) + { + l.UpdatedTime = DateTime.Now; + l.UpdatedUserId = UserManager.UserId; + l.UpdatedUserName = UserManager.Name; + return new { OperType = "delete", obj = l }; + } + + return new { OperType = string.Empty, obj = l }; + }).Where(t=>t.OperType != string.Empty).ToList(); + + + if (delList.Count > 0) + si2orderCtnList.AddRange(delList); + + + if (si2orderCtnList.Count > 0) + { + si2orderCtnList.ForEach(async ctn => + { + if (ctn.OperType == "insert") + { + //插入 + await _bookingOrderContaRepository.InsertAsync(ctn.obj); + } + else if (ctn.OperType == "update") + { + //更新 + await _bookingOrderContaRepository.AsUpdateable(ctn.obj).UpdateColumns(it => new + { + it.CTNALL, + it.SEALNO, + it.PKGS, + it.KGS, + it.CBM, + it.UpdatedTime, + it.UpdatedUserId, + it.UpdatedUserName, + }).ExecuteCommandAsync(); + } + else if (ctn.OperType == "delete") + { + await _bookingOrderContaRepository.DeleteAsync(x => x.Id == ctn.obj.Id); + } + }); + } + + result.succ = true; + result.msg = "保存SI信息成功"; + } + catch(Exception ex) + { + throw Oops.Bah($"保存SI信息异常,{0}", ex.Message); + } + + return result; + } + #endregion + + #region 获取SI反馈信息 + /// + /// 获取SI反馈信息 + /// + /// 任务主键 + /// 返回结果 + [HttpGet("/TaskManage/GetSIFeedBackInfo")] + public async Task GetSIFeedBackInfo(string taskPKId) + { + TaskSIFeedBackResultDto model = new TaskSIFeedBackResultDto(); + + try + { + var taskInfo = _taskBaseInfoRepository.AsQueryable().First(t => t.PK_ID == taskPKId); + + if (taskInfo == null) + throw Oops.Oh($"任务信息获取失败"); + + if (string.IsNullOrWhiteSpace(taskInfo.BOOK_ORDER_NO)) + throw Oops.Oh($"任务信息的订舱主键不存在"); + + if (taskInfo.TASK_TYPE != TaskBusiTypeEnum.SI_FEEDBACK.ToString()) + throw Oops.Oh($"当前任务类型不是{TaskBusiTypeEnum.SI_FEEDBACK.GetDescription()}"); + + + var bookOrderList = _bookingOrderRepository.EntityContext.Queryable() + .InnerJoin((bk, ctn) => bk.Id == ctn.BILLID) + .Where((bk, ctn) => bk.Id == long.Parse(taskInfo.BOOK_ORDER_NO) && bk.TenantId == UserManager.TENANT_ID) + .Select((bk, ctn) => new { bk = bk, ctn = ctn }).ToList(); + + var orderInfo = bookOrderList.FirstOrDefault().bk; + + model.TaskId = taskInfo.PK_ID; + + var siFeedBackList = _taskSIFeedBackInfoRepository.EntityContext.Queryable() + .InnerJoin((si, ctn) => si.PK_ID == ctn.P_PKID) + .Where((si, ctn) => si.TASK_PKID == model.TaskId && si.TenantId == UserManager.TENANT_ID) + .Select((si, ctn) => new { si = si, ctn = ctn }).ToList(); + + if (siFeedBackList.Count == 0) + throw Oops.Oh($"SI反馈信息不存在"); + + var siFeedBackInfo = siFeedBackList.FirstOrDefault().si; + + var resultInfo = siFeedBackInfo.Adapt(); + + resultInfo.ContaList = siFeedBackList.Select(t => t.ctn.Adapt()).ToList(); + + model.BusiInfo = resultInfo; + + if (orderInfo != null) + { + //订舱 + model.BookingOrder = orderInfo.Adapt(); + } + + //进行数据比对确认差异字段KEY + var mainDiff = await InnerCompareMainInfoDiff(orderInfo, siFeedBackInfo); + + model.SICompareOrderKeyList = mainDiff; + + var contaDiff = await InnerCompareContaInfoDiff(bookOrderList.Select(t=>t.ctn).ToList(), + siFeedBackList.Select(t=>t.ctn).ToList()); + + model.SICompareOrderContaKeyList = contaDiff; + } + catch (Exception ex) + { + throw Oops.Bah($"获取获取单票账单详情异常,{0}", ex.Message); + } + return model; + } + #endregion + + private List InnerCompare(object srcModel,object targetModel) + { + List list = new List(); + + if(srcModel is BookingOrder) + { + var srcBK = (BookingOrder)srcModel; + var targetBK = (BookingOrder)targetModel; + + var bookProps = typeof(BookingOrder).GetProperties(); + + list = bookProps.Select(prop => + { + var bk1Val = prop.GetValue(srcBK); + var bk2Val = prop.GetValue(targetBK); + + if (prop.PropertyType == typeof(string)) + { + string st1 = (bk1Val as string).AdjustString(); + string st2 = (bk2Val as string).AdjustString(); + + if (st1 != st2) + { + return new TaskCompareResultDto { Code = prop.Name, SrcVal = bk1Val, TargetVal = bk2Val, IsDiff = true, ValType = prop.PropertyType }; + } + + return new TaskCompareResultDto { Code = prop.Name, SrcVal = bk1Val, TargetVal = bk2Val, IsDiff = false, ValType = prop.PropertyType }; + } + else if (prop.PropertyType == typeof(int?)) + { + var dt1 = bk1Val as int?; + var dt2 = bk2Val as int?; + + if (dt1 != dt2) + { + return new TaskCompareResultDto { Code = prop.Name, SrcVal = bk1Val, TargetVal = bk2Val, IsDiff = true, ValType = prop.PropertyType }; + } + + return new TaskCompareResultDto { Code = prop.Name, SrcVal = bk1Val, TargetVal = bk2Val, IsDiff = true, ValType = prop.PropertyType }; + } + else if (prop.PropertyType == typeof(decimal?)) + { + var dt1 = bk1Val as decimal?; + var dt2 = bk2Val as decimal?; + + if (dt1 != dt2) + { + return new TaskCompareResultDto { Code = prop.Name, SrcVal = bk1Val, TargetVal = bk2Val, IsDiff = true, ValType = prop.PropertyType }; + } + + return new TaskCompareResultDto { Code = prop.Name, SrcVal = bk1Val, TargetVal = bk2Val, IsDiff = true, ValType = prop.PropertyType }; + } + + if (bk1Val != bk2Val) + return new TaskCompareResultDto { Code = prop.Name, SrcVal = bk1Val, TargetVal = bk2Val, IsDiff = true, ValType = prop.PropertyType }; + + + return new TaskCompareResultDto { Code = prop.Name, SrcVal = bk1Val, TargetVal = bk2Val, IsDiff = false, ValType = prop.PropertyType }; + }).ToList(); + } + + + return list; + } + + #region 比较主信息 + /// + /// 比较主信息 + /// + /// 订舱详情 + /// SI反馈详情 + /// 返回差异 + private async Task> InnerCompareMainInfoDiff(BookingOrder bookingOrder, TaskSIFeedBackInfo taskSIFeedBackInfo) + { + List resultList = new List(); + + //需要比对的字段 + var compareField = new string[] { "SHIPPER", "CONSIGNEE", "NOTIFYPARTY", "MARKS", "DESCRIPTION", "BLFRT", "SERVICE", "ISSUETYPE", "PORTLOAD", "PORTDISCHARGE", + "TRANSPORT", "DESTINATION", "PKGS", "KGS", "CBM", "KINDPKGS", "THIRDPAYADDR" }; + + var bookProps = typeof(BookingOrder).GetProperties(); + var feedProps = typeof(TaskSIFeedBackInfo).GetProperties(); + + resultList = bookProps.GroupJoin(feedProps, l => l.Name.ToUpper(), + r => r.Name.ToUpper(), (l, r) => + { + if (compareField.Any(x => x.Equals(l.Name, StringComparison.OrdinalIgnoreCase))) + { + var currList = r.ToList(); + + if (currList.Count > 0) + { + var si = r.FirstOrDefault(); + + var bkVal = l.GetValue(bookingOrder); + var siVal = si.GetValue(taskSIFeedBackInfo); + + if (l.PropertyType == typeof(string)) + { + string st1 = (bkVal as string).AdjustString(); + string st2 = (siVal as string).AdjustString(); + + if (!st1.Equals(st2)) + { + return l.Name.ToUpper(); + } + + return string.Empty; + } + else if (l.PropertyType == typeof(int?)) + { + var dt1 = bkVal as int?; + var dt2 = siVal as int?; + + if (!dt1.Equals(dt2)) + { + return l.Name.ToUpper(); + } + + return string.Empty; + } + else if (l.PropertyType == typeof(decimal?)) + { + var dt1 = bkVal as decimal?; + var dt2 = siVal as decimal?; + + if (!dt1.Equals(dt2)) + { + return l.Name.ToUpper(); + } + + return string.Empty; + } + } + + return string.Empty; + } + + return string.Empty; + + }).Where(t => !string.IsNullOrWhiteSpace(t)).ToList(); + + return resultList; + } + #endregion + + #region 比较箱信息 + /// + /// 比较箱信息 + /// + /// 订舱箱信息 + /// SI反馈箱信息 + /// 返回差异 + private async Task> InnerCompareContaInfoDiff(List bookContaList,List siContaList) + { + List resultList = new List(); + + var bookProps = typeof(BookingCtn).GetProperties(); + var feedProps = typeof(TaskSIFeedBackContaInfo).GetProperties(); + + resultList = siContaList.GroupJoin(bookContaList, l => l.CONTA_NO, r => r.CNTRNO, (l, r) => + { + var currList = r.ToList(); + + if (currList.Count > 0) + { + var bkCtn = currList.FirstOrDefault(); + + if (!l.KGS.Equals(bkCtn.KGS) + || !l.PKGS.Equals(bkCtn.PKGS) + || !l.SEAL_NO.Equals(bkCtn.SEALNO) + || !l.CONTA_TYPE.Equals(bkCtn.CTNALL) + || !l.CBM.Equals(bkCtn.CBM)) + { + return l.CONTA_NO; + } + + return String.Empty; + } + + return l.CONTA_NO; + }).Where(t => !string.IsNullOrWhiteSpace(t)).ToList(); + + return resultList; + } + #endregion + + #region 获取VGM比较结果 + /// + /// 获取VGM比较结果 + /// + /// 任务主键 + /// 返回结果 + [HttpGet("/TaskManage/GetVGMCompareResult")] + public async Task GetVGMCompareResult(string taskPKId) + { + TaskVgmCompareResultDto model = new TaskVgmCompareResultDto(); + + List list = new List(); + List list2 = new List(); + try + { + var taskInfo = _taskBaseInfoRepository.AsQueryable().First(t => t.PK_ID == taskPKId); + + if (taskInfo == null) + throw Oops.Oh($"任务信息获取失败"); + + if (string.IsNullOrWhiteSpace(taskInfo.BOOK_ORDER_NO)) + throw Oops.Oh($"任务信息的订舱主键不存在"); + + if (taskInfo.TASK_TYPE != TaskBusiTypeEnum.VGM_COMPARE.ToString()) + throw Oops.Oh($"当前任务类型不是{TaskBusiTypeEnum.VGM_COMPARE.GetDescription()}"); + + var vgmList = _taskVGMFeedBackInfoRepository.AsQueryable().Where(t => t.TASK_PKID == taskInfo.PK_ID) + .ToList(); + + if(vgmList.Count == 0) + throw Oops.Oh($"VGM反馈信息不存在"); + + var contaList = _bookingOrderContaRepository.AsQueryable().Where(t => t.BILLID == long.Parse(taskInfo.BOOK_ORDER_NO)).ToList(); + + list = contaList.GroupJoin(vgmList, l => l.CNTRNO?.Trim(), r => r.CONTA_NO?.Trim(), (l, r) => { + var currInfo = r.FirstOrDefault(); + + TaskVgmCompareDto md = l.Adapt(); + + if (currInfo != null) + { + if(!l.SEALNO.Equals(currInfo.SEAL_NO)) + { + md.compareDiffList.Add(nameof(TaskVgmCompareDto.SealNo)); + } + if (!l.CTNCODE.Equals(currInfo.CONTA_TYPE)) + { + md.compareDiffList.Add(nameof(TaskVgmCompareDto.ContaType)); + } + if (!l.CTNALL.Equals(currInfo.CONTA_TYPE_NAME)) + { + md.compareDiffList.Add(nameof(TaskVgmCompareDto.ContaTypeName)); + } + if (!l.KGS.Equals(currInfo.KGS)) + { + md.compareDiffList.Add(nameof(TaskVgmCompareDto.KGS)); + } + if (!l.TAREWEIGHT.Equals(currInfo.TAREWEIGHT)) + { + md.compareDiffList.Add(nameof(TaskVgmCompareDto.TareWeight)); + } + if (!l.WEIGHKGS.Equals(currInfo.WEIGHKGS)) + { + md.compareDiffList.Add(nameof(TaskVgmCompareDto.WeighKGs)); + } + if (!l.WEIGHTYPE.Equals(currInfo.WEIGHTYPE)) + { + md.compareDiffList.Add(nameof(TaskVgmCompareDto.WeighType)); + } + } + else + { + md.compareDiffList = new List { nameof(TaskVgmCompareDto.ContaNo), + nameof(TaskVgmCompareDto.SealNo), + nameof(TaskVgmCompareDto.ContaType), + nameof(TaskVgmCompareDto.ContaTypeName), + nameof(TaskVgmCompareDto.KGS), + nameof(TaskVgmCompareDto.TareWeight), + nameof(TaskVgmCompareDto.WeighKGs), + nameof(TaskVgmCompareDto.WeighType), + }; + } + + return md; + }).ToList(); + + model.bookOrderCompareList = list; + + list2 = vgmList.GroupJoin(contaList, l => l.CONTA_NO?.Trim(), r => r.CNTRNO?.Trim(), (l, r) => { + var currInfo = r.FirstOrDefault(); + + TaskVgmCompareDto md = l.Adapt(); + + if (currInfo != null) + { + if (!l.SEAL_NO.Equals(currInfo.SEALNO)) + { + md.compareDiffList.Add(nameof(TaskVgmCompareDto.SealNo)); + } + if (!l.CONTA_TYPE.Equals(currInfo.CTNCODE)) + { + md.compareDiffList.Add(nameof(TaskVgmCompareDto.ContaType)); + } + if (!l.CONTA_TYPE_NAME.Equals(currInfo.CTNALL)) + { + md.compareDiffList.Add(nameof(TaskVgmCompareDto.ContaTypeName)); + } + if (!l.KGS.Equals(currInfo.KGS)) + { + md.compareDiffList.Add(nameof(TaskVgmCompareDto.KGS)); + } + if (!l.TAREWEIGHT.Equals(currInfo.TAREWEIGHT)) + { + md.compareDiffList.Add(nameof(TaskVgmCompareDto.TareWeight)); + } + if (!l.WEIGHKGS.Equals(currInfo.WEIGHKGS)) + { + md.compareDiffList.Add(nameof(TaskVgmCompareDto.WeighKGs)); + } + if (!l.WEIGHTYPE.Equals(currInfo.WEIGHTYPE)) + { + md.compareDiffList.Add(nameof(TaskVgmCompareDto.WeighType)); + } + } + else + { + md.compareDiffList = new List { nameof(TaskVgmCompareDto.ContaNo), + nameof(TaskVgmCompareDto.SealNo), + nameof(TaskVgmCompareDto.ContaType), + nameof(TaskVgmCompareDto.ContaTypeName), + nameof(TaskVgmCompareDto.KGS), + nameof(TaskVgmCompareDto.TareWeight), + nameof(TaskVgmCompareDto.WeighKGs), + nameof(TaskVgmCompareDto.WeighType), + }; + } + + return md; + }).ToList(); + + model.vgmCompareList = list2; + + } + catch (Exception ex) + { + throw Oops.Bah($"获取VGM比较结果异常,{0}", ex.Message); + } + + return model; + } + #endregion + + #region 更新订舱(VGM比较更新) + /// + /// 更新订舱(VGM比较更新) + /// + /// 任务主键 + /// 返回结果 + [HttpPost("/TaskManage/SaveBookingVGM")] + public async Task SaveBookingVGM(string taskPKId) + { + TaskManageOrderResultDto result = new TaskManageOrderResultDto(); + + try + { + var taskInfo = _taskBaseInfoRepository.AsQueryable().First(t => t.PK_ID == taskPKId); + + if (taskInfo == null) + throw Oops.Oh($"任务信息获取失败"); + + if (string.IsNullOrWhiteSpace(taskInfo.BOOK_ORDER_NO)) + throw Oops.Oh($"任务信息的订舱主键不存在"); + + if (taskInfo.TASK_TYPE != TaskBusiTypeEnum.VGM_COMPARE.ToString()) + throw Oops.Oh($"当前任务类型不是{TaskBusiTypeEnum.VGM_COMPARE.GetDescription()}"); + + //取订舱详情(包含集装箱) + var bookOrderList = _bookingOrderRepository.EntityContext.Queryable() + .LeftJoin(_bookingOrderRepository.EntityContext.Queryable(), (bk, ctn) => bk.Id == ctn.BILLID) + .Where((bk, ctn) => bk.Id == long.Parse(taskInfo.BOOK_ORDER_NO) && bk.TenantId == UserManager.TENANT_ID) + .Select((bk, ctn) => new { bk = bk, ctn = ctn }).ToList(); + + var orderInfo = bookOrderList.FirstOrDefault().bk; + + List orderCtnList = new List(); + + //这里是左连接查询,解决集装箱为空的情况 + if (bookOrderList.Any(t => t.ctn.Id > 0)) + orderCtnList = bookOrderList.Select(t => t.ctn).ToList(); + + var contaList = _taskVGMFeedBackInfoRepository.AsQueryable().Where(t => t.TASK_PKID == taskInfo.PK_ID).ToList(); + + var si2orderCtnList = contaList.GroupJoin(orderCtnList, l => l.CONTA_NO?.Trim(), r => r.CNTRNO?.Trim(), (l, r) => { + var currInfo = r.FirstOrDefault(); + + var contaInfo = l.Adapt(); + + if (currInfo == null) + { + contaInfo.BILLID = orderInfo.Id; + contaInfo.CreatedTime = DateTime.Now; + contaInfo.CreatedUserId = UserManager.UserId; + contaInfo.CreatedUserName = UserManager.Name; + + contaInfo.UpdatedTime = contaInfo.CreatedTime; + contaInfo.UpdatedUserId = UserManager.UserId; + contaInfo.UpdatedUserName = UserManager.Name; + + return new { OperType = "insert", obj = contaInfo }; + } + else + { + currInfo.Id = contaInfo.Id; + currInfo.BILLID = contaInfo.BILLID; + currInfo.UpdatedTime = DateTime.Now; + currInfo.UpdatedUserId = UserManager.UserId; + currInfo.UpdatedUserName = UserManager.Name; + + return new { OperType = "update", obj = currInfo }; + } + }).ToList(); + + + var delList = orderCtnList.GroupJoin(contaList, l => l.CNTRNO?.Trim(), r => r.CONTA_NO?.Trim(), (l, r) => { + var currInfo = r.FirstOrDefault(); + + if (currInfo == null) + { + l.UpdatedTime = DateTime.Now; + l.UpdatedUserId = UserManager.UserId; + l.UpdatedUserName = UserManager.Name; + return new { OperType = "delete", obj = l }; + } + + return new { OperType = string.Empty, obj = l }; + }).Where(t => t.OperType != string.Empty).ToList(); + + + if (delList.Count > 0) + si2orderCtnList.AddRange(delList); + + + if (si2orderCtnList.Count > 0) + { + si2orderCtnList.ForEach(async ctn => + { + if (ctn.OperType == "insert") + { + //插入 + await _bookingOrderContaRepository.InsertAsync(ctn.obj); + } + else if (ctn.OperType == "update") + { + //更新 + await _bookingOrderContaRepository.AsUpdateable(ctn.obj).UpdateColumns(it => new + { + it.CTNALL, + it.SEALNO, + it.PKGS, + it.KGS, + it.CBM, + it.UpdatedTime, + it.UpdatedUserId, + it.UpdatedUserName, + }).ExecuteCommandAsync(); + } + else if (ctn.OperType == "delete") + { + await _bookingOrderContaRepository.DeleteAsync(x => x.Id == ctn.obj.Id); + } + }); + } + + result.succ = true; + result.msg = "更新订舱成功"; + } + catch(Exception ex) + { + throw Oops.Bah($"更新订舱(VGM比较更新)异常,{0}", ex.Message); + } + + return result; + } + #endregion } #region 样本业务提取帮助类 @@ -2555,4 +3289,28 @@ namespace Myshipping.Application } } #endregion + + #region 整理文本数据 + public static class CompareObjExtension + { + /// + /// 整理文本数据 + /// + /// 文本 + /// + public static string AdjustString(this string str) + { + if (string.IsNullOrWhiteSpace(str)) + return str; + + var rtn = str.Replace("\r\n", "\n").Trim(); + if (rtn.EndsWith("\n")) + { + rtn = rtn.Substring(0, rtn.Length - 1); + } + + return rtn; + } + } + #endregion }