//获取打印标签所需数据 public static WaybillInfo PostWaybillInfos(string waybillId, PackageInfo packageInfo, string jpExpressSec, string excludePackaged) { WaybillInfo waybillInfo = null; string packageInfoJson = null; string jpExpSecId = null; if (!packageInfo.IsNull()) { packageInfoJson = JsonConvert.SerializeObject(packageInfo, Formatting.Indented, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore }); } if (!jpExpressSec.IsNullOrEmpty()) { jpExpSecId = jpExpressSec; } var resData = ApiHelper.Post("/v1/api/print/waybill-label.json?waybill_id=" + waybillId + "&packages=" + packageInfoJson + "&jp_express_section_id=" + jpExpSecId + "&excludePackaged=" + excludePackaged, null); try { var durianJson = ApiHelper.DeserializeJson <DurianResult <WaybillInfo> >(resData); if (durianJson.errCd == 0) { waybillInfo = durianJson.result; } else { MessageBox.Show(durianJson.errMsg); if (durianJson.errCd == -600 || durianJson.errCd == -601) { Properties.Settings.Default.ACCESS_TOKEN = ""; Properties.Settings.Default.Save(); } } } catch (Exception) { MessageBox.Show("数据解析错误."); } return(waybillInfo); }
//保存 void _barbtnSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { this.Cursor = Cursors.WaitCursor; if (validationProvider.Validate() && validate()) { WaybillInfo waybillInfo = new WaybillInfo(); #region 发货方 waybillInfo.Code = txtCode.Text.Trim(); waybillInfo.ConsignorSite = Identity.CurrentEmployee.SiteID; waybillInfo.CustomersType = txtCustomersType.Text; waybillInfo.LogisticsType = lueLogisticsType.EditValue.ToString(); waybillInfo.DispatchType = lueDispatchType.EditValue.ToString(); waybillInfo.SettlementType = lueSettlementType.EditValue.ToString(); waybillInfo.Consignor = (btneConsignor.Tag as CoCustomers).ID; waybillInfo.ConsignorLinkMan = txtConsignorLinkMan.Text.Trim(); waybillInfo.ConsignorTel = txtConsignorTel.Text.Trim(); waybillInfo.ConsignorPhone = txtConsignorPhone.Text.Trim(); waybillInfo.ConsignorAddress = txtConsignorAddress.Text.Trim(); if (lueServiceEmployee.Tag == null) waybillInfo.ServiceEmployee = null; else waybillInfo.ServiceEmployee = (lueServiceEmployee.Tag as CoEmployee).ID; if (lueSalesmanEmployee.Tag == null) waybillInfo.SalesmanEmployee = null; else waybillInfo.SalesmanEmployee = (lueSalesmanEmployee.Tag as CoEmployee).ID; #endregion #region 收货方 waybillInfo.DestinationSite = (btneDestinationSite.Tag as CoSite).ID; waybillInfo.Destination = (btneDestination.Tag as CoDestination).ID; waybillInfo.Consignee = cbxConsignee.Text; waybillInfo.ConsigneeLinkMan = txtConsigneeLinkMan.Text.Trim(); waybillInfo.ConsigneeTel = txtConsigneeTel.Text.Trim(); waybillInfo.ConsigneeAddress = memoConsigneeAddress.Text.Trim(); #endregion #region 费用信息 waybillInfo.StorageFee = seStorageFee.Value; waybillInfo.ReceiptFee = seReceiptFee.Value; waybillInfo.RemoteFee = seRemoteFee.Value; waybillInfo.OtherFee = seOtherFee.Value; waybillInfo.TakeTheirFee = seTakeTheirFee.Value; waybillInfo.PickUpGoodsFee = sePickUpGoodsFee.Value; waybillInfo.DeliveryRMBFee = seDeliveryRMBFee.Value; waybillInfo.DeliveryHKDFee = seDeliveryHKDFee.Value; waybillInfo.CustomsDlearanceFee = seCustomsDlearanceFee.Value; waybillInfo.AdditionalPage = Convert.ToInt16(seAdditionalPage.Value); waybillInfo.AdditionalPageFee = seAdditionalPageFee.Value; waybillInfo.ProtocolNo = txtProtocolNo.Text.Trim(); waybillInfo.ReceivableAmount = seReceivableAmount.Value; waybillInfo.PaidAmount = sePaidAmount.Value; waybillInfo.PaymentFlag = cePaymentFlag.Checked; #endregion #region 其它信息 waybillInfo.DispatchUnifiedNum = txtDispatchUnifiedNum.Text.Trim(); waybillInfo.DispatchAttachment = txtDispatchAttachment.Text.Trim(); waybillInfo.DispatchEntrancePermit = txtDispatchEntrancePermit.Text.Trim(); waybillInfo.DispatchReceiptAddress = txtDispatchReceiptAddress.Text.Trim(); waybillInfo.ReceiptFlag = ceReceiptFlag.Checked; waybillInfo.ReceiptCode = txtReceiptCode.Text.Trim(); waybillInfo.Remark = txtRemark.Text.Trim(); waybillInfo.CreateUser = Identity.CurrentUser.UserName; waybillInfo.CreateDate = DateTime.Now; #endregion foreach (WaybillGoods goods in lstWaybillGoods) { goods.WaybillCode = waybillInfo.Code; goods.Valid = true; } WcfServiceHelper.Client.InsertWaybillInfo(waybillInfo, lstWaybillGoods.ToArray()); ClearPanel(groupControlConsignor.Controls); ClearPanel(groupControlConsignee.Controls); ClearPanel(groupControlFee.Controls); ClearPanel(groupControlOther.Controls); ControlsHelper.ShowAlertMessage(this.ParentForm, "保存", "保存成功"); } } catch (Exception ex) { ControlsHelper.ShowErrorMessage("保存失败", ex.Message); } finally { this.Cursor = Cursors.Default; } }
//增加额外信息 private void AddExtraInfo(WaybillInfo waybillInfo, string store) { //着店号-条码 if (!waybillInfo.fandi_no_big.IsNullOrEmpty() && waybillInfo.fandi_no_big.Trim().Length < 4) { var tmpFandiNoBig = waybillInfo.fandi_no_big.Trim(); var len = waybillInfo.fandi_no_big.Trim().Length; for (var i = 0; i < 4 - len; i++) { tmpFandiNoBig = "$" + tmpFandiNoBig; } waybillInfo.ArrivalShopNo = "C" + tmpFandiNoBig + waybillInfo.fandi_no_small + "D"; } else { waybillInfo.ArrivalShopNo = "C" + waybillInfo.fandi_no_big + waybillInfo.fandi_no_small + "D"; } //配送会社信息 switch (store) { case "NRT": waybillInfo.StoreHouseShort = "成田店"; waybillInfo.StoreHouseTel = "0476-49-7727"; waybillInfo.StoreHouseFax = ""; waybillInfo.StoreHouseCd = "7054"; waybillInfo.StoreCompanyTel = "0476-49-7727"; waybillInfo.StoreCompanyFax = "0476-35-6194"; waybillInfo.StoreHouseLong = "エムオーエアロジスティックス(株)/SX 成田営業所"; break; case "OSK": waybillInfo.StoreHouseShort = "佐川急便(株)りんくう"; waybillInfo.StoreHouseTel = "072-458-1500"; waybillInfo.StoreHouseFax = ""; waybillInfo.StoreHouseCd = "3104"; waybillInfo.StoreCompanyTel = "06-6777-1823"; waybillInfo.StoreCompanyFax = "06-6777-1824"; waybillInfo.StoreHouseLong = "HYジャパンエクスプレス(株)/SX 岸和田営業所"; break; case "TOKYO": waybillInfo.StoreHouseShort = "东京店"; waybillInfo.StoreHouseTel = "东京电话"; waybillInfo.StoreHouseFax = "东京传真"; waybillInfo.StoreHouseCd = "东京出荷场"; waybillInfo.StoreCompanyTel = "会社电话"; waybillInfo.StoreCompanyFax = "会社传真"; waybillInfo.StoreHouseLong = "エムオーエアロジスティックス(株)/SX 东京営業所"; break; case "SUK": waybillInfo.StoreHouseShort = "未知"; waybillInfo.StoreHouseTel = ""; waybillInfo.StoreHouseFax = ""; waybillInfo.StoreHouseCd = ""; waybillInfo.StoreCompanyTel = "81-476356118"; waybillInfo.StoreCompanyFax = "81-476356194"; waybillInfo.StoreHouseLong = "エムオーエアロジスティックス(株式会社)"; break; default: waybillInfo.StoreHouseShort = "默认店"; waybillInfo.StoreHouseTel = "默认电话"; waybillInfo.StoreHouseFax = "默认传真"; waybillInfo.StoreHouseCd = "默认出荷场"; waybillInfo.StoreCompanyTel = "默认会社电话"; waybillInfo.StoreCompanyFax = "默认会社传真"; waybillInfo.StoreHouseLong = "エムオーエアロジスティックス(株)/SX 默认営業所"; break; } }