Exemplo n.º 1
0
 public static ShipmentInformationKey ToShipmentInformationKey(this IShipmentInformationKey k)
 {
     return(new ShipmentInformationKey(k));
 }
        protected ShipmentInformation CreateShipmentInformation(IShipmentInformationKey shipmentInformationKey, MovementOrderDTO order)
        {
            LoadCount.AddRead(EntityTypes.ShipmentInformation);

            var truncated = false;
            var shipmentInfo = new ShipmentInformation
                {
                    DateCreated = shipmentInformationKey.ShipmentInfoKey_DateCreated,
                    Sequence = shipmentInformationKey.ShipmentInfoKey_Sequence,
                    
                    Status = ShipmentStatusExtensions.FromOrderStatID(order.Status),
                    PalletWeight = (double?) order.PalletOR,
                    PalletQuantity = (int)(order.PalletQty ?? 0),
                    FreightBillType = order.FreightBillType.AnyTruncate(Constants.StringLengths.FreightBillType, ref truncated),
                    ShipmentMethod = order.ShipVia.AnyTruncate(Constants.StringLengths.ShipmentMethod, ref truncated),
                    DriverName = order.Driver.AnyTruncate(Constants.StringLengths.DriverName, ref truncated),
                    CarrierName = order.Carrier.AnyTruncate(Constants.StringLengths.CarrierName, ref truncated),
                    TrailerLicenseNumber = order.TrlNbr.AnyTruncate(Constants.StringLengths.TrailerLicenseNumber, ref truncated),
                    ContainerSeal = order.ContSeal.AnyTruncate(Constants.StringLengths.ContainerSeal, ref truncated),

                    RequiredDeliveryDate = order.DelDueDate,
                    ShipmentDate = order.Date ?? order.SchdShipDate,

                    InternalNotes = order.InternalNotes.AnyTruncate(Constants.StringLengths.ShipmentInformationNotes, ref truncated),
                    ExternalNotes = order.ExternalNotes.AnyTruncate(Constants.StringLengths.ShipmentInformationNotes, ref truncated),
                    SpecialInstructions = order.SpecialInstructions.AnyTruncate(Constants.StringLengths.ShipmentInformationNotes, ref truncated),

                    ShipFrom = new ShippingLabel
                        {
                            Name = order.CCompany.AnyTruncate(Constants.StringLengths.ShippingLabelName, ref truncated),
                            Address = new Address
                            {
                                AddressLine1 = order.CAddress1.AnyTruncate(Constants.StringLengths.AddressLine, ref truncated),
                                AddressLine2 = order.CAddress2.AnyTruncate(Constants.StringLengths.AddressLine, ref truncated),
                                AddressLine3 = order.CAddress3.AnyTruncate(Constants.StringLengths.AddressLine, ref truncated),
                                City = order.CCity.AnyTruncate(Constants.StringLengths.AddressCity, ref truncated),
                                State = order.CState.AnyTruncate(Constants.StringLengths.AddressState, ref truncated),
                                PostalCode = order.CZip.AnyTruncate(Constants.StringLengths.AddressPostalCode, ref truncated),
                                Country = order.CCountry.AnyTruncate(Constants.StringLengths.AddressCountry, ref truncated)
                            }
                        },
                    ShipTo = new ShippingLabel
                        {
                            Name = order.SCompany.AnyTruncate(Constants.StringLengths.ShippingLabelName, ref truncated),
                            Phone = order.SPhone.AnyTruncate(Constants.StringLengths.PhoneNumber, ref truncated),
                            Address = new Address
                            {
                                AddressLine1 = order.SAddress1.AnyTruncate(Constants.StringLengths.AddressLine, ref truncated),
                                AddressLine2 = order.SAddress2.AnyTruncate(Constants.StringLengths.AddressLine, ref truncated),
                                AddressLine3 = order.SAddress3.AnyTruncate(Constants.StringLengths.AddressLine, ref truncated),
                                City = order.SCity.AnyTruncate(Constants.StringLengths.AddressCity, ref truncated),
                                State = order.SState.AnyTruncate(Constants.StringLengths.AddressState, ref truncated),
                                PostalCode = order.SZip.AnyTruncate(Constants.StringLengths.AddressPostalCode, ref truncated),
                                Country = order.SCountry.AnyTruncate(Constants.StringLengths.AddressCountry, ref truncated)
                            }
                        },
                    FreightBill = new ShippingLabel
                        {
                            Name = order.Company.AnyTruncate(Constants.StringLengths.ShippingLabelName, ref truncated),
                            Phone = order.Phone.AnyTruncate(Constants.StringLengths.PhoneNumber, ref truncated),
                            EMail = order.Email.AnyTruncate(Constants.StringLengths.Email, ref truncated),
                            Fax = order.Fax.AnyTruncate(Constants.StringLengths.Fax, ref truncated),
                            Address = new Address
                            {
                                AddressLine1 = order.Address1.AnyTruncate(Constants.StringLengths.AddressLine, ref truncated),
                                AddressLine2 = order.Address2.AnyTruncate(Constants.StringLengths.AddressLine, ref truncated),
                                AddressLine3 = order.Address3.AnyTruncate(Constants.StringLengths.AddressLine, ref truncated),
                                City = order.City.AnyTruncate(Constants.StringLengths.AddressCity, ref truncated),
                                State = order.State.AnyTruncate(Constants.StringLengths.AddressState, ref truncated),
                                PostalCode = order.Zip.AnyTruncate(Constants.StringLengths.AddressPostalCode, ref truncated),
                                Country = order.Country.AnyTruncate(Constants.StringLengths.AddressCountry, ref truncated)
                            }
                        }
                };

            return shipmentInfo;
        }