From fa1a6075a63fbf9930ecc6bfbfc754c504b2a445 Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Tue, 12 Mar 2024 11:39:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A9=AC=E5=A3=AB=E5=9F=BA?= =?UTF-8?q?=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 --- .../Entity/BookingDeliveryRecordCtn.cs | 10 ++ .../BookingOrder/BookingMSKAPIService.cs | 99 +++++++++++++++---- .../BookingOrder/Dto/BookingEDIMapper.cs | 57 +++++++++++ .../Service/BookingOrder/Dto/MSKBookingDto.cs | 5 + .../Dto/QueryBookingDeliveryRecordDto.cs | 10 ++ .../BookingOrder/IBookingMSKAPIService.cs | 7 ++ .../TaskManagePlat/TaskManageService.cs | 2 - 7 files changed, 168 insertions(+), 22 deletions(-) diff --git a/Myshipping.Application/Entity/BookingDeliveryRecordCtn.cs b/Myshipping.Application/Entity/BookingDeliveryRecordCtn.cs index 6df757a9..52850fe7 100644 --- a/Myshipping.Application/Entity/BookingDeliveryRecordCtn.cs +++ b/Myshipping.Application/Entity/BookingDeliveryRecordCtn.cs @@ -41,5 +41,15 @@ namespace Myshipping.Application.Entity /// 箱内货物重量 /// public int CTN_SUFFER_WEIGHT { get; set; } + + /// + /// 箱计量单位 + /// + public string STUFFING_MEASUREMENT_TYPE { get; set; } + + /// + /// 重量或者体积的计量单位 + /// + public string STUFFING_MEASUREMENT_UNIT { get; set; } } } diff --git a/Myshipping.Application/Service/BookingOrder/BookingMSKAPIService.cs b/Myshipping.Application/Service/BookingOrder/BookingMSKAPIService.cs index 9999c599..9468000c 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingMSKAPIService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingMSKAPIService.cs @@ -399,32 +399,17 @@ namespace Myshipping.Application.Service.BookingOrder }); } - recordInfo.CreatedTime = nowDate; - recordInfo.UpdatedTime = nowDate; - recordInfo.CreatedUserId = UserManager.UserId; - recordInfo.CreatedUserName = UserManager.Name; - - _bookingDeliveryRecordRep.Insert(recordInfo); - - if (recordCtnList.Count > 0) - { - recordCtnList.ForEach(async x => - { - x.RECORD_ID = recordInfo.Id; - x.CreatedTime = nowDate; - x.UpdatedTime = nowDate; - x.CreatedUserId = UserManager.UserId; - x.CreatedUserName = UserManager.Name; - - await _bookingDeliveryRecordCtnRep.InsertAsync(x); - }); - } + var id = await Save(model); MSKAPIBookingResultDto resultInfo = null; + _logger.LogInformation($"开始请求MSK API订舱,JSON={JSON.Serialize(bookingDto)}"); + var rlt = await sendUrl.SetBody(bookingDto) .PostAsStringAsync(); + _logger.LogInformation($"开始请求MSK API订舱,返回结果 JSON={JSON.Serialize(rlt)}"); + if (!string.IsNullOrWhiteSpace(rlt)) { try @@ -672,6 +657,7 @@ namespace Myshipping.Application.Service.BookingOrder /// /// 查询条件 /// 返回台账列表 + [HttpPost("/BookingMSKAPI/GetPage")] public async Task> GetPageAsync([FromBody] QueryBookingDeliveryRecordDto QuerySearch) { @@ -806,6 +792,11 @@ namespace Myshipping.Application.Service.BookingOrder .WhereIF(jobEnd != DateTime.MinValue, t => t.JOB_TIME.HasValue && t.JOB_TIME.Value < jobEnd) .WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.PriceReference), t => t.PRICE_REFERENCE.Contains(QuerySearch.PriceReference)) .WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.BookedByCompanyName), t => t.BOOKEDBY_COMPANY_NAME.Contains(QuerySearch.BookedByCompanyName)) + .WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.BookedByCompanyPartyCode), t => t.BOOKEDBY_COMPANY_PARTYCODE.Contains(QuerySearch.BookedByCompanyPartyCode)) + .WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.PriceOwnerCompanyName), t => t.PRICE_OWNER_COMPANY_NAME.Contains(QuerySearch.PriceOwnerCompanyName)) + .WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.PriceOwnerCompanyPartyCode), t => t.PRICE_OWNER_COMPANY_PARTYCODE.Contains(QuerySearch.PriceOwnerCompanyPartyCode)) + .WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.PlaceReceiptCity), t => t.PLACERECEIPT_CITY.Contains(QuerySearch.PlaceReceiptCity) || t.PLACERECEIPT_UNLOC_CODE.Contains(QuerySearch.PlaceReceiptCity)) + .WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.PlaceDeliveryCity), t => t.PLACEDELIVERY_CITY.Contains(QuerySearch.PlaceDeliveryCity) || t.PLACEDELIVERY_UNLOC_CODE.Contains(QuerySearch.PlaceDeliveryCity)) .OrderBy(entityOrderCol + (QuerySearch.descSort ? " asc " : " desc ")) .ToPagedListAsync(QuerySearch.PageNo, QuerySearch.PageSize); @@ -820,6 +811,7 @@ namespace Myshipping.Application.Service.BookingOrder /// /// 马士基API订舱ID /// 返回详情 + [HttpGet("/BookingMSKAPI/GetInfo")] public async Task GetInfo(long id) { BookingDeliveryRecordDto model = null; @@ -835,5 +827,72 @@ namespace Myshipping.Application.Service.BookingOrder return model; } #endregion + + #region 保存 + /// + /// 保存 + /// + /// 请求订舱详情 + /// 返回ID + [HttpPost("/BookingMSKAPI/Save")] + public async Task Save([FromBody] MSKBookingDto model) + { + DateTime nowDate = DateTime.Now; + + if (model.id.HasValue && model.id.Value > 0) + { + BookingDeliveryRecord entity = model.Adapt(); + + entity.UpdatedTime = nowDate; + entity.UpdatedUserId = UserManager.UserId; + entity.UpdatedUserName = UserManager.Name; + + await _bookingDeliveryRecordRep.AsUpdateable(entity).IgnoreColumns(x => new + { + x.CreatedTime, + x.CreatedUserId, + x.CreatedUserName, + x.BOOKING_REFERENCE, + x.BookingId, + x.REQUEST_ACKNOWLEDGEMENT_ID, + x.STATUS + }).ExecuteCommandAsync(); + + return model.id.Value; + } + else + { + BookingDeliveryRecord entity = model.Adapt(); + + entity.CreatedTime = nowDate; + entity.UpdatedTime = nowDate; + entity.CreatedUserId = UserManager.UserId; + entity.CreatedUserName = UserManager.Name; + + await _bookingDeliveryRecordRep.InsertAsync(entity); + + if (model.ctns != null && model.ctns.Count > 0) + { + model.ctns.ForEach(ctn => + { + + var ctnEntity = ctn.Adapt(); + + ctnEntity.RECORD_ID = entity.Id; + ctnEntity.CreatedTime = nowDate; + ctnEntity.UpdatedTime = nowDate; + ctnEntity.CreatedUserId = UserManager.UserId; + ctnEntity.CreatedUserName = UserManager.Name; + ctnEntity.STUFFING_MEASUREMENT_TYPE = "WEIGHT"; + ctnEntity.STUFFING_MEASUREMENT_UNIT = "KGS"; + + _bookingDeliveryRecordCtnRep.Insert(ctnEntity); + }); + } + + return entity.Id; + } + } + #endregion } } diff --git a/Myshipping.Application/Service/BookingOrder/Dto/BookingEDIMapper.cs b/Myshipping.Application/Service/BookingOrder/Dto/BookingEDIMapper.cs index cd3a17ef..4ef402a2 100644 --- a/Myshipping.Application/Service/BookingOrder/Dto/BookingEDIMapper.cs +++ b/Myshipping.Application/Service/BookingOrder/Dto/BookingEDIMapper.cs @@ -176,8 +176,65 @@ namespace Myshipping.Application .Map(dest => dest.goodsName, src => src.GOODSNAME) .Map(dest => dest.isReefer, src => src.IS_REEFER) .Map(dest => dest.cargoType, src => src.CARGO_TYPE) + .Map(dest => dest.placeDeliveryId, src => src.PLACEDELIVERYID) + .Map(dest => dest.placeDelivery, src => src.PLACEDELIVERY) + .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.laneCode, src => src.LANECODE) + .Map(dest => dest.laneName, src => src.LANENAME) + .Map(dest => dest.carriageType, src => src.CARRIAGE_TYPE) + .Map(dest => dest.carriageTypeName, src => src.CARRIAGE_TYPE_NAME) + .Map(dest => dest.bookingSlotType, src => src.BOOKING_SLOT_TYPE) + .Map(dest => dest.bookingSlotTypeName, src => src.BOOKING_SLOT_TYPE_NAME) + .Map(dest => dest.issueType, src => src.ISSUETYPE) + .Map(dest => dest.ctnStat, src => src.CTN_STAT) + .Map(dest => dest.weekAt, src => src.WEEK_AT) + .Map(dest => dest.sendTime, src => src.SEND_TIME) + .Map(dest => dest.cargoType, src => src.CARGO_TYPE); + config.ForType() + .Map(dest => dest.id, src => src.Id) + .Map(dest => dest.carrierId, src => src.CARRIERID) + .Map(dest => dest.priceReference, src => src.PRICE_REFERENCE) + .Map(dest => dest.productCode, src => src.PRODUCT_CODE) + .Map(dest => dest.sender, src => src.SENDER) + .Map(dest => dest.bookedByCompanyName, src => src.BOOKEDBY_COMPANY_NAME) + .Map(dest => dest.bookedByCompanyPartyCode, src => src.BOOKEDBY_COMPANY_PARTYCODE) + .Map(dest => dest.bookedByCompanyContact, src => src.BOOKEDBY_COMPANY_CONTACT) + .Map(dest => dest.bookedByCompanyEmail, src => src.BOOKEDBY_COMPANY_CONTACT_EMAIL) + .Map(dest => dest.isbookingPartOwnPrice, src => src.IS_BOOKING_PART_OWN_PRICE) + .Map(dest => dest.priceOwnerCompanyName, src => src.PRICE_OWNER_COMPANY_NAME) + .Map(dest => dest.priceOwnerCompanyPartyCode, src => src.PRICE_OWNER_COMPANY_PARTYCODE) + .Map(dest => dest.priceOwnerCompanyContact, src => src.PRICE_OWNER_COMPANY_CONTACT) + .Map(dest => dest.priceOwnerCompanyContactEmail, src => src.PRICE_OWNER_COMPANY_CONTACT_EMAIL) + .Map(dest => dest.carrierCode, src => src.CARRIER_CODE) + .Map(dest => dest.earliestDepartureDate, src => src.EARLIEST_DEPARTURE_DATE) + .Map(dest => dest.exportServiceMode, src => src.EXPORT_SERVICE_MODE) + .Map(dest => dest.importServiceMode, src => src.IMPORT_SERVICE_MODE) + .Map(dest => dest.placeReceiptCity, src => src.PLACERECEIPT_CITY) + .Map(dest => dest.placeReceiptUnlocCode, src => src.PLACERECEIPT_UNLOC_CODE) + .Map(dest => dest.placeDeliveryCity, src => src.PLACEDELIVERY_CITY) + .Map(dest => dest.placeDeliveryUnlocCode, src => src.PLACEDELIVERY_UNLOC_CODE) + .Map(dest => dest.etd, src => src.ETD) + .Map(dest => dest.atd, src => src.ETA) + .Map(dest => dest.vessel, src => src.VESSEL) + .Map(dest => dest.vesselCode, src => src.VESSEL_CODE) + .Map(dest => dest.voyno, src => src.VOYNO) + .Map(dest => dest.transportMode, src => src.TRANSPORT_MODE) + .Map(dest => dest.totalCargoWeight, src => src.TOTAL_CARGO_WEIGHT) + .Map(dest => dest.noOfProbes, src => src.NO_OF_PROBES) + .Map(dest => dest.tempSet, src => src.TEMPSET) + .Map(dest => dest.tempId, src => src.TEMPID) + .Map(dest => dest.vent, src => src.VENT) + .Map(dest => dest.humidity, src => src.HUMIDITY) + .Map(dest => dest.commodityCodeType, src => src.COMMODITY_CODE_TYPE) + .Map(dest => dest.goodsCode, src => src.GOODSCODE) + .Map(dest => dest.goodsName, src => src.GOODSNAME) + .Map(dest => dest.isReefer, src => src.IS_REEFER) + .Map(dest => dest.cargoType, src => src.CARGO_TYPE) .Map(dest => dest.placeDeliveryId, src => src.PLACEDELIVERYID) .Map(dest => dest.placeDelivery, src => src.PLACEDELIVERY) .Map(dest => dest.portLoadId, src => src.PORTLOADID) diff --git a/Myshipping.Application/Service/BookingOrder/Dto/MSKBookingDto.cs b/Myshipping.Application/Service/BookingOrder/Dto/MSKBookingDto.cs index 63a1d863..b3d58a91 100644 --- a/Myshipping.Application/Service/BookingOrder/Dto/MSKBookingDto.cs +++ b/Myshipping.Application/Service/BookingOrder/Dto/MSKBookingDto.cs @@ -12,6 +12,11 @@ namespace Myshipping.Application /// public class MSKBookingDto { + /// + /// 记录ID + /// + public Nullable id { get; set; } + /// /// 船公司代码 /// diff --git a/Myshipping.Application/Service/BookingOrder/Dto/QueryBookingDeliveryRecordDto.cs b/Myshipping.Application/Service/BookingOrder/Dto/QueryBookingDeliveryRecordDto.cs index 97aac783..a963f3d2 100644 --- a/Myshipping.Application/Service/BookingOrder/Dto/QueryBookingDeliveryRecordDto.cs +++ b/Myshipping.Application/Service/BookingOrder/Dto/QueryBookingDeliveryRecordDto.cs @@ -132,5 +132,15 @@ namespace Myshipping.Application /// 价格所有者代码 /// public string PriceOwnerCompanyPartyCode { get; set; } + + /// + /// 始发地 + /// + public string PlaceReceiptCity { get; set; } + + /// + /// 目的地 + /// + public string PlaceDeliveryCity { get; set; } } } diff --git a/Myshipping.Application/Service/BookingOrder/IBookingMSKAPIService.cs b/Myshipping.Application/Service/BookingOrder/IBookingMSKAPIService.cs index e0489913..27a2958e 100644 --- a/Myshipping.Application/Service/BookingOrder/IBookingMSKAPIService.cs +++ b/Myshipping.Application/Service/BookingOrder/IBookingMSKAPIService.cs @@ -51,5 +51,12 @@ namespace Myshipping.Application /// 马士基API订舱ID /// 返回详情 Task GetInfo(long id); + + /// + /// 保存 + /// + /// 请求订舱详情 + /// 返回ID + Task Save(MSKBookingDto model); } } diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs index df5cab3a..c536a75e 100644 --- a/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs @@ -651,8 +651,6 @@ namespace Myshipping.Application } #endregion - - #region 派车任务 if (info.Main.TaskType == TaskBaseTypeEnum.TRUCK_DISPATCH) {