You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

142 lines
8.9 KiB
C#

using Mapster;
using Myshipping.Application.EDI;
using Myshipping.Application.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace Myshipping.Application
{
public class BookingEDIMapper : IRegister
{
public void Register(TypeAdapterConfig config)
{
config.ForType<BookingOrder, MsOpSeaeEDIBaseModel>()
.Map(dest => dest.WEITUO, src => src.WEITUO)
.Map(dest => dest.ORDERNO, src => src.CUSTNO)
.Map(dest => dest.MBLNO, src => src.MBLNO)
.Map(dest => dest.BLFRT, src => src.BLFRT)
.Map(dest => dest.VESSEL, src => src.VESSEL)
//.Map(dest => dest.VOYNO, src => src.VOYNO)//这里去掉映射,以后航次号都是取内部航次
.Map(dest => dest.ETD, src => src.ETD.HasValue ? src.ETD.Value.ToString("yyyy-MM-dd") : "")
.Map(dest => dest.ETA, src => src.ETA.HasValue ? src.ETA.Value.ToString("yyyy-MM-dd") : "")
.Map(dest => dest.CLOSINGDATE, src => src.CLOSINGDATE.HasValue ? src.CLOSINGDATE.Value.ToString("yyyy-MM-dd") : "")
.Map(dest => dest.SIREMARK, src => src.SIREMARK)
.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.MARKS, src => src.MARKS)
.Map(dest => dest.DESCRIPTION, src => src.DESCRIPTION)
.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.DESTINATIONID, src => src.DESTINATIONID)
.Map(dest => dest.DESTINATION, src => src.DESTINATION)
.Map(dest => dest.PKGS, src => src.PKGS.HasValue ? src.PKGS.Value : 0)
.Map(dest => dest.KINDPKGS, src => src.KINDPKGS)
.Map(dest => dest.KGS, src => src.KGS.HasValue ? src.KGS.Value : 0)
.Map(dest => dest.CBM, src => src.CBM.HasValue ? src.CBM.Value : 0)
.Map(dest => dest.CARGOID, src => src.CARGOID)
.Map(dest => dest.DCLASS, src => src.DCLASS)
.Map(dest => dest.DUNNO, src => src.DUNNO)
.Map(dest => dest.TEMPSET, src => src.TEMPSET)
.Map(dest => dest.REEFERF, src => src.REEFERF)
.Map(dest => dest.HUMIDITY, src => src.HUMIDITY)
.Map(dest => dest.PREPARDAT, src => src.PREPARDAT)
.Map(dest => dest.PAYABLEAT, src => src.PAYABLEAT)
.Map(dest => dest.PREPARDATID, src => src.PREPARDATID)
.Map(dest => dest.PAYABLEATID, src => src.PAYABLEATID)
.Map(dest => dest.ISSUETYPE, src => src.ISSUETYPE)
.Map(dest => dest.NOBILL, src => src.NOBILL)
.Map(dest => dest.ISSUEPLACE, src => src.ISSUEPLACE)
.Map(dest => dest.COPYNOBILL, src => src.COPYNOBILL)
.Map(dest => dest.ISSUEPLACEID, src => src.ISSUEPLACEID)
.Map(dest => dest.SERVICE, src => src.SERVICE)
.Map(dest => dest.CONTRACTNO, src => src.CONTRACTNO)//运费协议号=约号
.Map(dest => dest.CONSIGNEEDOORADDR, src => src.CONSIGNEEDOORADDR)
.Map(dest => dest.SHIPPERDOORADDR, src => src.SHIPPERDOORADDR)
.Map(dest => dest.SCACCODE, src => src.SCACCODE)
.Map(dest => dest.ISCONTAINERSOC, src => src.ISCONTAINERSOC)
.Map(dest => dest.FREIGHTPAYER, src => src.FREIGHTPAYER)
.Map(dest => dest.PLACEDELIVERYID, src => src.PLACEDELIVERYID)
.Map(dest => dest.PLACEDELIVERY, src => src.PLACEDELIVERY)
.Map(dest => dest.CARRIER, src => src.CARRIER)
.Map(dest => dest.CARRIERID, src => src.CARRIERID)
.Map(dest => dest.GOODSCODE, src => src.GOODSCODE);
config.ForType<BookingCtn, MsOpSeaeCtnEDIBaseModel>()
.Map(dest => dest.CTNNUM, src => src.CTNNUM.HasValue? src.CTNNUM.Value:0)
.Map(dest => dest.CNTRNO, src => src.CNTRNO)
.Map(dest => dest.SEALNO, src => src.SEALNO)
.Map(dest => dest.PKGS, src => src.PKGS.HasValue? src.PKGS.Value:0)
.Map(dest => dest.KINDPKGS, src => src.KINDPKGS)
.Map(dest => dest.KGS, src => src.KGS.HasValue ? src.KGS.Value:0)
.Map(dest => dest.CBM, src => src.CBM.HasValue ? src.CBM.Value : 0)
.Map(dest => dest.TAREWEIGHT, src => src.TAREWEIGHT.HasValue ? src.TAREWEIGHT.Value : 0);
config.ForType<BookingCtnDetail, MsOpSeaeCtnDetailEDIBaseModel>()
//.Map(dest => dest.CNTRNO, src => src.CNTRNO)
.Map(dest => dest.HSCODE, src => src.HSCODE)
.Map(dest => dest.MARKS, src => src.MARKS)
.Map(dest => dest.DESCRIPTION, src => src.DESCRIPTION)
.Map(dest => dest.PKGS, src => src.PKGS.HasValue ? src.PKGS.Value : 0)
.Map(dest => dest.KINDPKGS, src => src.KINDPKGS)
.Map(dest => dest.KGS, src => src.KGS.HasValue ? src.KGS.Value : 0)
.Map(dest => dest.CBM, src => src.CBM.HasValue ? src.CBM.Value : 0);
config.ForType<MSKBookingDto, BookingDeliveryRecord>()
.Map(dest => dest.CARRIERID, src => src.carrierId)
.Map(dest => dest.BookingId, src => src.bookingId)
.Map(dest => dest.PRICE_REFERENCE, src => src.priceReference)
.Map(dest => dest.PRODUCT_CODE, src => src.productCode)
.Map(dest => dest.SENDER, src => src.sender)
.Map(dest => dest.BOOKEDBY_COMPANY_NAME, src => src.bookedByCompanyName)
.Map(dest => dest.BOOKEDBY_COMPANY_PARTYCODE, src => src.bookedByMaerskPartyCode)
.Map(dest => dest.BOOKEDBY_COMPANY_CONTACT, src => src.bookedByCompanyContactName)
.Map(dest => dest.BOOKEDBY_COMPANY_CONTACT_EMAIL, src => src.bookedByCompanyContactEmail)
.Map(dest => dest.IS_BOOKING_PART_OWN_PRICE, src => src.isBookingPartOwnPrice)
.Map(dest => dest.PRICE_OWNER_COMPANY_NAME, src => src.priceOwnerCompanyName)
.Map(dest => dest.PRICE_OWNER_COMPANY_PARTYCODE, src => src.priceOwnerMaerskPartyCode)
.Map(dest => dest.PRICE_OWNER_COMPANY_CONTACT, src => src.priceOwnerContactName)
.Map(dest => dest.PRICE_OWNER_COMPANY_CONTACT_EMAIL, src => src.priceOwnerContactEmail)
.Map(dest => dest.CARRIER_CODE, src => src.carrierCode)
.Map(dest => dest.EARLIEST_DEPARTURE_DATE, src => src.earliestDepartureDate)
.Map(dest => dest.EXPORT_SERVICE_MODE, src => src.exportServiceMode)
.Map(dest => dest.IMPORT_SERVICE_MODE, src => src.importServiceMode)
.Map(dest => dest.PLACERECEIPT_CITY, src => src.placeOfReceiptCityName)
.Map(dest => dest.PLACERECEIPT_UNLOC_CODE, src => src.placeOfReceiptUnLocCode)
.Map(dest => dest.PLACEDELIVERY_CITY, src => src.placeOfDeliveryCityName)
.Map(dest => dest.PLACEDELIVERY_UNLOC_CODE, src => src.placeOfDeliveryUnLocCode)
.Map(dest => dest.ETD, src => src.originDepartureDateTimeLocal)
.Map(dest => dest.ETA, src => src.destinationArrivalDateTimeLocal)
.Map(dest => dest.VESSEL, src => src.vesselName)
.Map(dest => dest.VESSEL_CODE, src => src.carrierVesselCode)
.Map(dest => dest.VOYNO, src => src.exportVoyageNumber)
.Map(dest => dest.TRANSPORT_MODE, src => src.transportMode)
.Map(dest => dest.TOTAL_CARGO_WEIGHT, src => src.totalCargoWeight)
.Map(dest => dest.NO_OF_PROBES, src => src.noOfProbes)
.Map(dest => dest.TEMPSET, src => src.temperature)
.Map(dest => dest.VENT, src => src.ventilation)
.Map(dest => dest.HUMIDITY, src => src.humidity)
.Map(dest => dest.COMMODITY_CODE_TYPE, src => src.commodityCodeType)
.Map(dest => dest.GOODSCODE, src => src.commodityCode)
.Map(dest => dest.GOODSNAME, src => src.commodityName);
config.ForType<MSKBookingCtnInfo, BookingDeliveryRecordCtn>()
.Map(dest => dest.CTN_CODE, src => src.ctnCode)
.Map(dest => dest.CTN_NUM, src => src.ctnNum)
.Map(dest => dest.CTN_SUFFER_WEIGHT, src => src.ctnSufferWeight);
}
}
}