private List <DeliveryNotice> GetDeliveryNotices(List <DynamicObject> dynObjects) { DeliveryNotice notice = null; List <DeliveryNotice> notices = null; if (dynObjects == null || dynObjects.Count() == 0) { return(null); } notices = new List <DeliveryNotice>(); foreach (var item in dynObjects) { if (item != null) { notice = new DeliveryNotice(); notice.FBillNo = SQLUtils.GetFieldValue(item, "FBillNo"); notice.DeliveryStreetAddress = SQLUtils.GetFieldValue(item, "F_HS_DeliveryAddress"); notice.F_HS_DeliveryCity = SQLUtils.GetFieldValue(item, "F_HS_DeliveryCity"); notice.F_HS_DeliveryProvinces = SQLUtils.GetFieldValue(item, "F_HS_DeliveryProvinces"); notice.F_HS_RecipientCountry = SQLUtils.GetCountryNo(this.Context, item, "F_HS_RecipientCountry_Id"); notice.F_HS_PostCode = SQLUtils.GetFieldValue(item, "F_HS_PostCode"); notices.Add(notice); } } return(notices); }
/// <summary> /// 设置发货通知单明细信息 /// </summary> /// <param name="notice"></param> /// <param name="coll"></param> /// <param name="ctx"></param> private void SetDeliveryNoticeEntry(Context ctx, List <DynamicObject> objs, DeliveryNotice notice) { if (objs != null && objs.Count > 0) { notice.OrderEntry = new List <K3SalOrderEntryInfo>(); foreach (var item in objs) { if (item != null) { K3SalOrderEntryInfo entry = new K3SalOrderEntryInfo(); entry.FUnitId = SQLUtils.GetFieldValue(item, "unitNo"); //DynamicObject mat = item["MaterialID"] as DynamicObject; //entry.material.FNumber = SQLUtils.GetFieldValue(mat, "Name"); entry.FMaterialName = SQLUtils.GetFieldValue(item, "FNAME"); entry.F_HS_IsOil = SQLUtils.GetFieldValue(item, "F_HS_IsOil"); entry.F_HS_TotalWeight = Convert.ToDecimal(SQLUtils.GetFieldValue(item, "F_HS_TotalWeight")) / 100; entry.FQTY = Convert.ToDecimal(SQLUtils.GetFieldValue(item, "FQTY")); entry.FTAXPRICE = SetPriceByDecAmount(item); notice.OrderEntry.Add(entry); } } } }
/// <summary> /// 发货通知单轨迹明细信息 /// </summary> /// <param name="notice"></param> /// <returns></returns> private JArray DeliveryNoticeLocusEntryJson(DeliveryNotice notice) { JArray F_HS_LocusEntity = default(JArray); JObject data = default(JObject); if (notice != null && notice.LocusEntry != null && notice.LocusEntry.Count > 0) { F_HS_LocusEntity = new JArray(); foreach (var item in notice.LocusEntry) { data = new JObject(); data.Add("F_HS_Signtime", item.F_HS_Signtime); //签收时间 data.Add("F_HS_TrackInfo", item.F_HS_TrackInfo); //轨迹信息 data.Add("F_HS_AreaCode", item.F_HS_AreaCode); //地区编码 data.Add("F_HS_AreaName", item.F_HS_AreaName); //所在地 data.Add("F_HS_TarckStatus", item.F_HS_TarckStatus); //轨迹状态 F_HS_LocusEntity.Add(data); } } return(F_HS_LocusEntity); }
/// <summary> /// 发货通知单物流跟踪明细信息 /// </summary> /// <param name="notice"></param> /// <returns></returns> private JArray BuildDeliveryNoticeTraceEntryJson(DeliveryNotice notice) { JArray FDeliNoticeTrace = default(JArray); JObject data = default(JObject); if (notice != null && notice.TraceEntry != null && notice.TraceEntry.Count > 0) { FDeliNoticeTrace = new JArray(); foreach (var item in notice.TraceEntry) { data = new JObject(); JObject FLogComId = new JObject();//物流公司 FLogComId.Add("FCode", item.FLogComId); data.Add("FLogComId", FLogComId); JObject F_HS_ShipMethods = new JObject();//物流方式 F_HS_ShipMethods.Add("FNumber", item.F_HS_ShipMethods); data.Add("F_HS_ShipMethods", F_HS_ShipMethods); data.Add("FCarryBillNo", item.F_HS_CarryBillNO);//物流单号 data.Add("FTraceStatus", item.FTraceStatus); data.Add("F_HS_DeliDate", item.F_HS_DeliDate); //发货日期 data.Add("F_HS_QueryURL", item.F_HS_QueryURL); //查询网址 data.Add("F_HS_Channel", item.F_HS_Channel); //物流渠道 FDeliNoticeTrace.Add(data); } } return(FDeliNoticeTrace); }
/// <summary> /// 发货通知单明细信息 /// </summary> /// <param name="notice"></param> /// <returns></returns> private JArray BuildDeliveryNoitceEntryJson(DeliveryNotice notice) { JArray FEntity = default(JArray); JObject data = default(JObject); if (notice.Entry != null && notice.Entry.Count > 0) { FEntity = new JArray(); foreach (var item in notice.Entry) { data = new JObject(); JObject FMaterialID = new JObject();//物料编码 FMaterialID.Add("FNumber", item.FMaterialID); data.Add("FMaterialID", FMaterialID); JObject FUnitID = new JObject();//计价单位 FUnitID.Add("FNumber", item.FUnitID); data.Add("FUnitID", FUnitID); JObject FBaseUnitID = new JObject();//基本单位 FBaseUnitID.Add("FNumber", item.FBaseUnitID); data.Add("FBaseUnitID", FBaseUnitID); JObject FOutLmtUnit = new JObject();//超发控制单位类型 FOutLmtUnit.Add("FNumber", item.FOutLmtUnit); data.Add("FOutLmtUnit", FOutLmtUnit); FEntity.Add(data); } } return(FEntity); }
/// <summary> /// 将同步的数据转换为JSON格式 /// </summary> /// <param name="sourceData"></param> /// <param name="operationType"></param> /// <returns></returns> private JObject ConvertSynDataToJObj(AbsSynchroDataInfo sourceData, SynOperationType operationType) { DeliveryNotice notice = sourceData as DeliveryNotice; JObject baseData = default(JObject); if (notice != null) { baseData = new JObject(); JObject FBillTypeID = new JObject();//单据类型 FBillTypeID.Add("FNumber", ""); baseData.Add("FBillTypeID", FBillTypeID); baseData.Add("FBillNo", notice.FBillNo);//单据编号 baseData.Add("FDate", notice.FDate); JObject FSaleOrgId = new JObject();//销售组织 baseData.Add("FNumber", notice.FSaleOrgId); FSaleOrgId.Add("FSaleOrgId", FSaleOrgId); JObject FDeliveryOrgID = new JObject();//发货组织 FDeliveryOrgID.Add("FNumber", ""); baseData.Add("FDeliveryOrgID", FDeliveryOrgID); baseData.Add("FEntity", BuildDeliveryNoitceEntryJson(notice)); //明细信息 baseData.Add("SubHeadEntity", BuildDeliveryNoticeFinJson(notice)); //财务信息 baseData.Add("F_HS_LocusEntity", DeliveryNoticeLocusEntryJson(notice)); //轨迹明细信息 baseData.Add("FDeliNoticeTrace", BuildDeliveryNoticeTraceEntryJson(notice)); //物流跟踪明细信息 } return(baseData); }
private static void SetPackageLineItems(ProcessShipmentRequest request, DeliveryNotice notice) { request.RequestedShipment.RequestedPackageLineItems = new RequestedPackageLineItem[1]; request.RequestedShipment.RequestedPackageLineItems[0] = new RequestedPackageLineItem(); request.RequestedShipment.RequestedPackageLineItems[0].SequenceNumber = "1"; // Package weight information request.RequestedShipment.RequestedPackageLineItems[0].Weight = new Weight(); request.RequestedShipment.RequestedPackageLineItems[0].Weight.Value = 20.0M; request.RequestedShipment.RequestedPackageLineItems[0].Weight.Units = WeightUnits.KG; // package dimensions //request.RequestedShipment.RequestedPackageLineItems[0].Dimensions = new Dimensions(); //request.RequestedShipment.RequestedPackageLineItems[0].Dimensions.Length = "12"; //request.RequestedShipment.RequestedPackageLineItems[0].Dimensions.Width = "13"; //request.RequestedShipment.RequestedPackageLineItems[0].Dimensions.Height = "14"; //request.RequestedShipment.RequestedPackageLineItems[0].Dimensions.Units = LinearUnits.CM; // insured value //request.RequestedShipment.RequestedPackageLineItems[0].InsuredValue = new Money(); //request.RequestedShipment.RequestedPackageLineItems[0].InsuredValue.Amount = 100; //request.RequestedShipment.RequestedPackageLineItems[0].InsuredValue.Currency = notice.orderFin.FSettleCurrID; // Reference details request.RequestedShipment.RequestedPackageLineItems[0].CustomerReferences = new CustomerReference[1] { new CustomerReference() }; request.RequestedShipment.RequestedPackageLineItems[0].CustomerReferences[0].CustomerReferenceType = CustomerReferenceType.CUSTOMER_REFERENCE; request.RequestedShipment.RequestedPackageLineItems[0].CustomerReferences[0].Value = "testreference"; //if (notice != null) //{ // if (notice.Packages != null && notice.Packages.Count > 0) // { // request.RequestedShipment.RequestedPackageLineItems = new RequestedPackageLineItem[notice.Packages.Count]; // for (int i = 0; i < notice.Packages.Count; i++) // { // if (notice.Packages[i] != null) // { // Package package = notice.Packages[i]; // request.RequestedShipment.RequestedPackageLineItems[i] = new RequestedPackageLineItem(); // // // request.RequestedShipment.RequestedPackageLineItems[i].SequenceNumber = package.SequenceNumber; // // Package weight information // request.RequestedShipment.RequestedPackageLineItems[i].Weight = new Weight(); // request.RequestedShipment.RequestedPackageLineItems[i].Weight.Value = package.Weight; // request.RequestedShipment.RequestedPackageLineItems[i].Weight.Units = WeightUnits.KG; // // // request.RequestedShipment.RequestedPackageLineItems[i].Dimensions = new Dimensions(); // request.RequestedShipment.RequestedPackageLineItems[i].Dimensions.Length = package.Dimension.Length; // request.RequestedShipment.RequestedPackageLineItems[i].Dimensions.Width = package.Dimension.Width; // request.RequestedShipment.RequestedPackageLineItems[i].Dimensions.Height =package.Dimension.Height; // request.RequestedShipment.RequestedPackageLineItems[i].Dimensions.Units = LinearUnits.CM; // } // } // } //} }
private static void SetPayment(ProcessShipmentRequest request, DeliveryNotice notice) { request.RequestedShipment.ShippingChargesPayment = new Payment(); request.RequestedShipment.ShippingChargesPayment.PaymentType = PaymentType.SENDER; request.RequestedShipment.ShippingChargesPayment.Payor = new Payor(); request.RequestedShipment.ShippingChargesPayment.Payor.ResponsibleParty = new Party(); //request.RequestedShipment.ShippingChargesPayment.Payor.ResponsibleParty.AccountNumber = ConfigurationUtil.GetAppSetting("payoraccount"); // Replace "XXX" with client's account number request.RequestedShipment.ShippingChargesPayment.Payor.ResponsibleParty.Contact = new Contact(); request.RequestedShipment.ShippingChargesPayment.Payor.ResponsibleParty.Address = new Address(); request.RequestedShipment.ShippingChargesPayment.Payor.ResponsibleParty.Address.CountryCode = notice.F_HS_RecipientCountry; }
private static void SetRecipient(ProcessShipmentRequest request, DeliveryNotice notice) { request.RequestedShipment.Recipient = new Party(); request.RequestedShipment.Recipient.Contact = new Contact(); request.RequestedShipment.Recipient.Contact.PersonName = notice.F_HS_DeliveryName; request.RequestedShipment.Recipient.Contact.CompanyName = notice.FCustCompany; request.RequestedShipment.Recipient.Contact.PhoneNumber = notice.F_HS_MobilePhone; request.RequestedShipment.Recipient.Address = new Address(); request.RequestedShipment.Recipient.Address.StreetLines = GetDeliveryAddress(notice.F_HS_DeliveryAddress); request.RequestedShipment.Recipient.Address.City = notice.F_HS_DeliveryCity; request.RequestedShipment.Recipient.Address.StateOrProvinceCode = StateOrProvinceCode.GetStateOrProvinceCode(notice.F_HS_DeliveryProvinces); request.RequestedShipment.Recipient.Address.PostalCode = notice.F_HS_PostCode; request.RequestedShipment.Recipient.Address.CountryCode = notice.F_HS_RecipientCountry; request.RequestedShipment.Recipient.Address.Residential = true; }
private static ProcessShipmentRequest CreateShipmentRequest(DeliveryNotice notice) { // Build the ShipmentRequest ProcessShipmentRequest request = new ProcessShipmentRequest(); // request.WebAuthenticationDetail = SetWebAuthenticationDetail(); request.WebAuthenticationDetail.UserCredential = new WebAuthenticationCredential(); request.WebAuthenticationDetail.UserCredential.Key = "XXX"; // Replace "XXX" with the Key request.WebAuthenticationDetail.UserCredential.Password = "******"; // Replace "XXX" with the Password if (usePropertyFile()) //Set values from a file for testing purposes { request.WebAuthenticationDetail.UserCredential.Key = getProperty("key"); request.WebAuthenticationDetail.UserCredential.Password = getProperty("password"); } // request.ClientDetail = new ClientDetail(); request.ClientDetail.AccountNumber = "XXX"; // Replace "XXX" with the client's account number request.ClientDetail.MeterNumber = "XXX"; // Replace "XXX" with the client's meter number if (usePropertyFile()) //Set values from a file for testing purposes { request.ClientDetail.AccountNumber = getProperty("accountnumber"); request.ClientDetail.MeterNumber = getProperty("meternumber"); } // request.TransactionDetail = new TransactionDetail(); request.TransactionDetail.CustomerTransactionId = "***Express International Shipment Request using VC#***"; // The client will get the same value back in the response // request.Version = new VersionId(); // SetShipmentDetails(request); // SetSender(request); // SetRecipient(request, notice); // SetPayment(request); // SetLabelDetails(request); // SetPackageLineItems(request, notice); // SetCustomsClearanceDetails(request, notice); // return(request); }
/// <summary> /// 将抽象父类转换为子类 /// </summary> /// <param name="sourceDatas"></param> /// <returns></returns> public List <DeliveryNotice> ConvertAbsSynchroObject(IEnumerable <AbsSynchroDataInfo> sourceDatas) { if (sourceDatas != null) { if (sourceDatas.Count() > 0) { List <DeliveryNotice> notices = new List <DeliveryNotice>(); foreach (var item in sourceDatas) { if (item != null) { DeliveryNotice notice = item as DeliveryNotice; notices.Add(notice); } } return(notices); } } return(null); }
private static void SetCommodityDetails(ProcessShipmentRequest request, DeliveryNotice notice) { if (notice != null) { if (notice.OrderEntry != null && notice.OrderEntry.Count > 0) { request.RequestedShipment.CustomsClearanceDetail.Commodities = new Commodity[notice.OrderEntry.Count]; for (int i = 0; i < notice.OrderEntry.Count; i++) { if (notice.OrderEntry[i] != null) { K3SalOrderEntryInfo entry = notice.OrderEntry[i]; request.RequestedShipment.CustomsClearanceDetail.Commodities[i] = new Commodity(); request.RequestedShipment.CustomsClearanceDetail.Commodities[i].Name = entry.FMaterialName; request.RequestedShipment.CustomsClearanceDetail.Commodities[i].Description = GetDescription(entry.F_HS_IsOil); request.RequestedShipment.CustomsClearanceDetail.Commodities[i].NumberOfPieces = "1"; request.RequestedShipment.CustomsClearanceDetail.Commodities[i].CountryOfManufacture = "US"; request.RequestedShipment.CustomsClearanceDetail.Commodities[i].UnitPrice = new Money(); request.RequestedShipment.CustomsClearanceDetail.Commodities[i].UnitPrice.Currency = notice.orderFin.FSettleCurrID; request.RequestedShipment.CustomsClearanceDetail.Commodities[i].UnitPrice.Amount = entry.FTAXPRICE; request.RequestedShipment.CustomsClearanceDetail.Commodities[i].Weight = new Weight(); request.RequestedShipment.CustomsClearanceDetail.Commodities[i].Weight.Units = WeightUnits.KG; request.RequestedShipment.CustomsClearanceDetail.Commodities[i].Weight.Value = 0.1M /*entry.F_HS_TotalWeight / 100*/; request.RequestedShipment.CustomsClearanceDetail.Commodities[i].Quantity = entry.FQTY; request.RequestedShipment.CustomsClearanceDetail.Commodities[i].QuantitySpecified = true; request.RequestedShipment.CustomsClearanceDetail.Commodities[i].QuantityUnits = entry.FUnitId; request.RequestedShipment.CustomsClearanceDetail.Commodities[i].CustomsValue = new Money(); request.RequestedShipment.CustomsClearanceDetail.Commodities[i].CustomsValue.Amount = entry.FTAXPRICE; request.RequestedShipment.CustomsClearanceDetail.Commodities[i].CustomsValue.Currency = notice.orderFin.FSettleCurrID; } } } } }
/// <summary> /// 发货通知单财务信息 /// </summary> /// <param name="notice"></param> /// <returns></returns> private JObject BuildDeliveryNoticeFinJson(DeliveryNotice notice) { JObject SubHeadEntity = default(JObject); JObject data = default(JObject); if (notice != null && notice.DelNotFin != null) { SubHeadEntity = new JObject(); data = new JObject(); JObject FSettleOrgID = new JObject();//结算组织 FSettleOrgID.Add("FNumber", ""); data.Add("FSettleOrgID", FSettleOrgID); JObject FSettleTypeID = new JObject();//结算方式 FSettleTypeID.Add("FNumber", ""); data.Add("FSettleTypeID", FSettleTypeID); SubHeadEntity.Add("SubHeadEntity", data); } return(SubHeadEntity); }
private static List <DeliveryNotice> GetTrackingNumbers(Context ctx) { List <DeliveryNotice> noitces = null; DeliveryNotice notice = null; string sql = string.Format(@"/*dialect*/ select FBILLNO,F_HS_CARRYBILLNO from {0} where F_HS_DOCUMENTSTATUS = '{1}'", HSTableConst.HS_T_LogisticsInfo, LogisticsQuery.Query); DynamicObjectCollection coll = SQLUtils.GetObjects(ctx, sql); var group = from l in coll group l by l["FBILLNO"] into g select g; if (group != null && group.Count() > 0) { noitces = new List <DeliveryNotice>(); foreach (var g in group) { notice = new DeliveryNotice(); if (g != null) { notice.FBillNo = JsonUtils.ConvertObjectToString(g.ElementAt(0)["FBILLNO"]); foreach (var item in g) { DeliveryNoticeTraceEntry trace = new DeliveryNoticeTraceEntry(); trace.F_HS_CarryBillNO = JsonUtils.ConvertObjectToString(item["F_HS_CARRYBILLNO"]); notice.TraceEntry.Add(trace); noitces.Add(notice); } } } } return(noitces); }
private static ProcessShipmentRequest CreateShipmentRequest(DeliveryNotice notice) { // Build the ShipmentRequest ProcessShipmentRequest request = new ProcessShipmentRequest(); // request.WebAuthenticationDetail = SetWebAuthenticationDetail(); request.WebAuthenticationDetail.UserCredential = new WebAuthenticationCredential(); //request.WebAuthenticationDetail.UserCredential.Key = ConfigurationUtil.GetAppSetting("key"); //request.WebAuthenticationDetail.UserCredential.Password = ConfigurationUtil.GetAppSetting("password"); //request.ClientDetail = new ClientDetail(); //request.ClientDetail.AccountNumber = ConfigurationUtil.GetAppSetting("accountnumber"); //request.ClientDetail.MeterNumber = ConfigurationUtil.GetAppSetting("meternumber"); request.TransactionDetail = new TransactionDetail(); request.TransactionDetail.CustomerTransactionId = "***Express International Shipment Request using VC#***"; // The client will get the same value back in the response request.Version = new VersionId(); SetShipmentDetails(request); SetSender(request); SetRecipient(request, notice); SetPayment(request, notice); SetLabelDetails(request); SetPackageLineItems(request, notice); if (notice.F_HS_RecipientCountry.CompareTo("CN") != 0) { SetCustomsClearanceDetails(request, notice); } return(request); }
private static void SetCustomsClearanceDetails(ProcessShipmentRequest request, DeliveryNotice notice) { request.RequestedShipment.CustomsClearanceDetail = new CustomsClearanceDetail(); request.RequestedShipment.CustomsClearanceDetail.DutiesPayment = new Payment(); request.RequestedShipment.CustomsClearanceDetail.DutiesPayment.PaymentType = PaymentType.SENDER; request.RequestedShipment.CustomsClearanceDetail.DutiesPayment.Payor = new Payor(); request.RequestedShipment.CustomsClearanceDetail.DutiesPayment.Payor.ResponsibleParty = new Party(); request.RequestedShipment.CustomsClearanceDetail.DutiesPayment.Payor.ResponsibleParty.AccountNumber = "XXX"; // Replace "XXX" with the payor account number if (usePropertyFile()) //Set values from a file for testing purposes { request.RequestedShipment.CustomsClearanceDetail.DutiesPayment.Payor.ResponsibleParty.AccountNumber = getProperty("dutiesaccount"); } request.RequestedShipment.CustomsClearanceDetail.DutiesPayment.Payor.ResponsibleParty.Contact = new Contact(); request.RequestedShipment.CustomsClearanceDetail.DutiesPayment.Payor.ResponsibleParty.Address = new Address(); request.RequestedShipment.CustomsClearanceDetail.DutiesPayment.Payor.ResponsibleParty.Address.CountryCode = notice.F_HS_RecipientCountry; request.RequestedShipment.CustomsClearanceDetail.DocumentContent = InternationalDocumentContentType.NON_DOCUMENTS; // request.RequestedShipment.CustomsClearanceDetail.CustomsValue = new Money(); request.RequestedShipment.CustomsClearanceDetail.CustomsValue.Amount = notice.orderFin.FBillAmount; request.RequestedShipment.CustomsClearanceDetail.CustomsValue.Currency = notice.orderFin.FSettleCurrID; // SetCommodityDetails(request, notice); }
/// <summary> /// 获取发货通知单 /// </summary> /// <returns></returns> private List <DeliveryNotice> GetDeliveryNotices(Context ctx) { DeliveryNotice notice = new DeliveryNotice(); List <DeliveryNotice> notices = new List <DeliveryNotice>(); List <string> numbers = GetSelectedShipmentNos(); DynamicObjectCollection coll = GetObjects(ctx, numbers); var group = from c in coll where c["FDelBillNo"] != null group c by c["FDelBillNo"] into g select g; if (group != null && group.Count() > 0) { notices = new List <DeliveryNotice>(); foreach (var item in group) { if (item != null) { notice = new DeliveryNotice(); foreach (var obj in item) { if (obj != null) { notice.FShipmentBillNo.Add(SQLUtils.GetFieldValue(obj, "FShpBillNo")); } } notice.FBillNo = SQLUtils.GetFieldValue(item.ElementAt(0), "FDelBillNo"); notice.F_HS_DeliveryName = SQLUtils.GetFieldValue(item.ElementAt(0), "F_HS_DeliveryName"); notice.F_HS_MobilePhone = SQLUtils.GetFieldValue(item.ElementAt(0), "F_HS_MobilePhone"); notice.F_HS_DeliveryCity = SQLUtils.GetFieldValue(item.ElementAt(0), "F_HS_DeliveryCity"); notice.F_HS_DeliveryProvinces = SQLUtils.GetFieldValue(item.ElementAt(0), "F_HS_DeliveryProvinces"); notice.F_HS_DeliveryAddress = SQLUtils.GetFieldValue(item.ElementAt(0), "F_HS_DeliveryAddress"); notice.F_HS_RecipientCountry = SQLUtils.GetFieldValue(item.ElementAt(0), "F_HS_RecipientCountry"); notice.F_HS_PostCode = SQLUtils.GetFieldValue(item.ElementAt(0), "F_HS_PostCode"); notice.orderFin = new K3SaleOrderFinance(); notice.orderFin.FSettleCurrID = SQLUtils.GetFieldValue(item.ElementAt(0), "FSettleCurrID"); notice.orderFin.FBillAmount = Convert.ToDecimal(JsonUtils.ConvertObjectToString(SQLUtils.GetFieldValue(item.ElementAt(0), "FBillAmount"))); notice.F_HS_ShippingMethod = SQLUtils.GetFieldValue(item.ElementAt(0), "logisticsNo"); notice.F_HS_AllTotalWeight = Convert.ToDecimal(SQLUtils.GetFieldValue(item.ElementAt(0), "F_HS_AllTotalWeight")); notice.FDecAmount = Convert.ToDecimal(SQLUtils.GetFieldValue(item.ElementAt(0), "FDecAmount")); List <DynamicObject> entry = item.ToList(); SetDeliveryNoticeEntry(ctx, entry, notice); Dimension dim = new Dimension(); dim.Length = SQLUtils.GetFieldValue(item.ElementAt(0), "FLENGTH"); dim.Width = SQLUtils.GetFieldValue(item.ElementAt(0), "FWIDTH"); dim.Height = SQLUtils.GetFieldValue(item.ElementAt(0), "FHIGH"); dim.Units = "CM"; Package pac = new Package(); pac.Weight = Convert.ToDecimal(SQLUtils.GetFieldValue(item.ElementAt(0), "FBILLINGWEIGHT")) / 100; pac.Units = "KG"; pac.Dimension = dim; notice.Packages.Add(pac); notices.Add(notice); } } } return(notices); }
private static void SetCustomsClearanceDetails(ProcessShipmentRequest request, DeliveryNotice notice) { request.RequestedShipment.CustomsClearanceDetail = new CustomsClearanceDetail(); request.RequestedShipment.CustomsClearanceDetail.DutiesPayment = new Payment(); request.RequestedShipment.CustomsClearanceDetail.DutiesPayment.PaymentType = PaymentType.SENDER; request.RequestedShipment.CustomsClearanceDetail.DutiesPayment.Payor = new Payor(); request.RequestedShipment.CustomsClearanceDetail.DutiesPayment.Payor.ResponsibleParty = new Party(); //request.RequestedShipment.CustomsClearanceDetail.DutiesPayment.Payor.ResponsibleParty.AccountNumber = ConfigurationUtil.GetAppSetting("dutiesaccount"); // Replace "XXX" with the payor account number request.RequestedShipment.CustomsClearanceDetail.DutiesPayment.Payor.ResponsibleParty.Contact = new Contact(); request.RequestedShipment.CustomsClearanceDetail.DutiesPayment.Payor.ResponsibleParty.Address = new Address(); request.RequestedShipment.CustomsClearanceDetail.DutiesPayment.Payor.ResponsibleParty.Address.CountryCode = notice.F_HS_RecipientCountry; request.RequestedShipment.CustomsClearanceDetail.DocumentContent = InternationalDocumentContentType.NON_DOCUMENTS; // request.RequestedShipment.CustomsClearanceDetail.CustomsValue = new Money(); request.RequestedShipment.CustomsClearanceDetail.CustomsValue.Amount = notice.FDecAmount <= 0?1000: notice.FDecAmount; //request.RequestedShipment.CustomsClearanceDetail.CustomsValue.Currency = CurrencyCodes.GetCurrCodes(notice.orderFin.FSettleCurrID); // SetCommodityDetails(request, notice); }