protected void GVBind() { List<ETS.GGGETSApp.Domain.Application.Entities.HAWB> list = _hawbService.FindPagedHAWBs(pageIndex, pageCount); if (list.Count > 0) { this.GV_Bdemand.DataSource = list; this.GV_Bdemand.DataBind(); } else { ETS.GGGETSApp.Domain.Application.Entities.HAWB Hawb = new ETS.GGGETSApp.Domain.Application.Entities.HAWB(); list.Add(Hawb); GV_Bdemand.DataSource = list; GV_Bdemand.DataBind(); foreach (GridViewRow gvr in GV_Bdemand.Rows) { ((LinkButton)gvr.FindControl("lb_Select") as LinkButton).Visible = false; ((LinkButton)gvr.FindControl("lb_Eit") as LinkButton).Visible = false; ((LinkButton)gvr.FindControl("lb_Colse") as LinkButton).Visible = false; } } if (list.Count < pageCount) { But_Down.Enabled = false; But_Goup.Enabled = false; } else { But_Goup.Enabled = false; } Session["pageIndex"] = pageIndex; Session["pageCount"] = pageCount; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.Gv_BaleXinXi.DataSource = null; this.Gv_BaleXinXi.DataBind(); if (Request.QueryString["BarCode"] != "" && Request.QueryString["BarCode"] != null) { hawb = _IHawbService.FindHAWBByBarCode(Request.QueryString["BarCode"].ToString()); Session["HAWB"] = hawb; if (hawb.Item.Count > 0) { Gv_BaleXinXi.DataSource = hawb.Item; Gv_BaleXinXi.DataBind(); } else { Item item = new Item(); List<Item> list = new List<Item>(); list.Add(item); Gv_BaleXinXi.DataSource = list; Gv_BaleXinXi.DataBind(); foreach (GridViewRow gvr in Gv_BaleXinXi.Rows) { ((Label)gvr.FindControl("lbl_n") as Label).Visible = false; ((Label)gvr.FindControl("lbl_Weight") as Label).Visible = false; ((LinkButton)gvr.FindControl("lbt_Eit") as LinkButton).Visible = false; ((LinkButton)gvr.FindControl("lbt_Delete") as LinkButton).Visible = false; } } Evaluate(); } } }
public void ChangeHAWB(HAWB hawb) { if (hawb == null) throw new ArgumentNullException("HAWB is null"); IUnitOfWork unitOfWork = _hawbRepository.UnitOfWork as IUnitOfWork; _hawbRepository.Modify(hawb); //complete changes in this unit of work unitOfWork.CommitAndRefreshChanges(); }
public void AddHAWB(HAWB newHAWB) { if (newHAWB ==null) throw new ArgumentNullException("HAWB is null"); IUnitOfWork unitOfWork = _hawbRepository.UnitOfWork as IUnitOfWork; _hawbRepository.Add(newHAWB); //complete changes in this unit of work unitOfWork.Commit(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { listcountry = _countryservice.FindAllCountries(); listregion = _regionservice.FindAllRegionCodes(); if (!string.IsNullOrWhiteSpace(Request.QueryString["BarCode"])) { BarCode = Request.QueryString["BarCode"]; hawb = _hawbService.LoadHAWBByBarCode(BarCode); if (Request.UrlReferrer != null) { ViewState["UrlReferrer"] = Request.UrlReferrer.ToString(); } if (Session["UserID"] != null) { Storage(hawb); if (Request.QueryString["Privilege"]!=null) { if (!bool.Parse(Request.QueryString["Privilege"])) { But_Update.Enabled = false; } } if(Request.QueryString["Privilege1"]!=null) { if (!bool.Parse(Request.QueryString["Privilege1"])) { btn_DeriveAccept.Enabled = false; btn_DeriveSince.Enabled = false; } } } else { Response.Write("<script>alert('没有访问权限!');location='../HOME.aspx'</script>"); } } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('没有该运单!')</script>"); if (ViewState["UrlReferrer"] != null) { Response.Redirect((string)ViewState["UrlReferrer"]); } else { Response.Redirect("../Navigation.aspx"); } } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["jilu"] != null) { int i = Int32.Parse(Session["jilu"].ToString()); if (i > 0) { hawbUpdate = (ETS.GGGETSApp.Domain.Application.Entities.HAWB)Session["hawb"]; Evaluate(); } } if (Session["item"] == null) { lt.Add(item); Gv_BaleXinXi.DataSource = lt; Gv_BaleXinXi.DataBind(); foreach (GridViewRow gvr in Gv_BaleXinXi.Rows) { ((Label)gvr.FindControl("lbl_n") as Label).Visible = false; ((Label)gvr.FindControl("lbl_Weight") as Label).Visible = false; ((LinkButton)gvr.FindControl("lbt_Eit") as LinkButton).Visible = false; ((LinkButton)gvr.FindControl("lbt_Delete") as LinkButton).Visible = false; } } else { lt.Add((Item)Session["item"]); Gv_BaleXinXi.DataSource = lt; Gv_BaleXinXi.DataBind(); } } }
protected void Page_Load(object sender, EventArgs e) { hawb = (HAWB)Session["HAWB"]; if (!IsPostBack) { if (Session["HAWB"] != null) { if (Request.QueryString["type"] == "Amend")//修改页面显示 { type = Request.QueryString["type"]; ViewState["type"] = type; But_AddHAWB.Text = "保 存"; gv_Box.DataSource = hawb.HAWBBoxes; gv_Box.DataBind(); GV_item.DataSource = hawb.HAWBItems; GV_item.DataBind(); } else //新建页面显示 { item = new HAWBItem(); box = new HAWBBox(); gv_item(); gv_box(); But_AddHAWB.Text = "创 建"; } Evaluate(); BoxType(); ViewState["UrlReferrer"] = Request.UrlReferrer.ToString(); } else { Response.Write("<script>alert('请先填写用户信息!');location='HAWBAdd.aspx'</script>"); } } }
public void TestAddHAWB() { //实力化一个虚假运单对象 HAWB HAWBObj = new HAWB { HID=Guid.NewGuid(), BarCode = "2010", //条形码 Carrier = "中国航空", //承运单位 SettleType = 0, //预算方式 ServiceType = 0, //快件或包裹 CreateTime = DateTime.Now, //创建日期 Status = 0, //运单状态 ShipperName = "沈志伟", //发件人姓名或者公司 ShipperContactor = "沈志伟", //发件人姓名 ShipperCountry = "01", //发件人国家 ShipperRegion = "021", //发件人区号 ShipperAddress = "test address", //发件人地址 ShipperZipCode = "200435", //发件人邮编 ShipperTel = "13817011234", //发件人联系电话 ConsigneeContactor = "李宏", //收件人姓名 ConsigneeCountry = "02", //收件人国家 ConsigneeRegion = "022", //收件人区号 ConsigneeAddress = "Japan address", //收件人地址 ConsigneeZipCode = "201011", //收件人邮编 ConsigneeTel = "120120", //收件人联系电话 WeightType = 2, //计重方式 TotalVolume = 10, //总体积 TotalWeight = 10, //总重量 Piece = 10, //件数 IsInternational = true //是否是国际运单 }; //定义盒子 HAWBBox HAWBBox01 = new HAWBBox { BoxType = 0, //盒子类型 Weight = 10, //重量 TransCurrency = 0, //运费货币 Piece = 10 //件数 }; HAWBBox HAWBBox02 = new HAWBBox { BoxType = 0, //盒子类型 Weight = 20, //重量 TransCurrency = 0, //运费货币 Piece = 20 //件数 }; //定义货物 HAWBItem HAWBItem01 = new HAWBItem { Name = "货物01", //货物名称 Piece = 10, //货物件数 UnitAmount = 10, //单价 TotalAmount = 10 //总价 }; HAWBItem HAWBItem02 = new HAWBItem { Name = "货物02", //货物名称 Piece = 20, //货物件数 UnitAmount = 20, //单价 TotalAmount = 20 //总价 }; //定义企业用户 User user01 = new User { LoginName = "test001", //注册名 Password = "******", //密码 RealName = "张三", //真实姓名 //Department = "研发部", //部门名称 //PostCode = "200435", //邮政编码 Phone = "110", //电话 //CountryCode = "01", //国家编号 //RegionCode = "01", //区域编号 //Address = "XXX路XXX号", //地址 UpdateTime = DateTime.Now, //更新日期 CreateTime = DateTime.Now, //创建日期 Operator = "沈志伟", //操作人 FeeDiscountType = 0, //费用折扣类型 FeeDiscountRate = 1, //费用折扣率 WeightDiscountType = 0, //重量折扣类型 WeightDiscountRate = 1, //重量折扣率 SettleType = 0, //结算类型 WeightCalType = 0, //计量方式 Status = 0 //可用状态 }; //in HAWBObj.HAWBBoxes.Add(HAWBBox01); //HAWBObj.HAWBBox.Add(HAWBBox02); //HAWBObj.HAWBItems.Add(HAWBItem01); //HAWBObj.HAWBItem.Add(HAWBItem02); HAWBObj.User = user01; //begin _HAWBManagementService.AddHAWB(HAWBObj); }
/// <summary> /// 包添加运单操作 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btn_Add_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txt_BarCode.Text.Trim())) { ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "alert('请输入运单号!')", true); txt_BarCode.Focus(); } else { if (!string.IsNullOrEmpty(Txt_BagBarCode.Text.Trim()) && !string.IsNullOrEmpty(Txt_DestinationRegionCode.Text.Trim()) && !string.IsNullOrEmpty(Txt_OriginalRegionCode.Text.Trim())) { hawb = _hawbservice.FindHAWBByBarCode(txt_BarCode.Text.Trim()); if (hawb != null) { //再分配运单前首先确保包存在 if (string.IsNullOrEmpty(Txt_BagBarCode.Text.Trim())) { ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "alert('请先输入包号!')", true); txt_BarCode.Focus(); return; } else { package = (Package)Session["package"]; if (package == null) package = new Package(); } if (package.JudgeHAWB(hawb))//判断运单是否在该包里面 { bool isMix; if (rbtn_PackageType.SelectedValue == "0")//判断是否混包 { isMix = false; } else { isMix = true; } if (_packageservice.JudgePIDIsNull(hawb.BarCode))//判断该运单是否已经打包 { hawb.Status = 1;//已打包 package.HAWBs.Add(hawb); txt_Pice.Text = package.Piece.ToString(); Txt_TotalWeight.Text = package.TotalWeight.ToString(); gv_HAWB.DataSource = package.HAWBs; gv_HAWB.DataBind(); Session["package"] = package; } else { ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "alert('该运单已经添加,不能再次进行添加!')", true); } } else { ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "alert('该运单已经添加,不能再次进行添加!')", true); } } else { ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "alert('没有该运单记录!')", true); } } else { ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "alert('请先输入包的信息!')", true); } } if (gv_HAWB.Rows.Count != 0) { btn_Close.Visible = true; } txt_BarCode.Text = string.Empty; txt_BarCode.Focus(); }
/// <summary> /// 删除包里面的运单 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btn_Close_Click(object sender, EventArgs e) { if (package == null) { package = (Package)Session["package"]; } bool Ok = false; for (int i = gv_HAWB.Rows.Count - 1; i > -1; i--) { string Bar = string.Empty; if (((CheckBox)gv_HAWB.Rows[i].FindControl("chkId")).Checked) { Ok = true; Bar = gv_HAWB.DataKeys[i].Value.ToString(); foreach (HAWB ha in package.HAWBs) { if (ha.BarCode == Bar) { hawb = ha; } } package.HAWBs.Remove(hawb); //特殊操作,SESSION里面加成员保存没有问题,但是如果是减成员就会没有任何效果 hawb.PID = null; hawb.Status = 0; _hawbservice.ChangeHAWB(hawb); txt_Pice.Text = package.Piece.ToString(); Txt_TotalWeight.Text = package.TotalWeight.ToString(); } } if (Ok == true) { ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "alert('删除成功!')", true); if (package.HAWBs.Count == 0) { btn_Close.Visible = false; } gv_HAWB.DataSource = package.HAWBs; gv_HAWB.DataBind(); txt_BarCode.Focus(); } else { ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "alert('请选择要移除的记录!')", true); } }
/// <summary> /// 导出发票 /// </summary> /// <param name="dataSource">数据源</param> /// <param name="hawbId">运单号或承运单号</param> public NpoiHelper(HAWB dataSource,string hawbId) { if (dataSource == null||string.IsNullOrEmpty(hawbId)) throw new ArgumentNullException("dataSource", @"运单或运单号不能为空"); _hawbDataSource = dataSource; _hawbId=hawbId; }
/// <summary> /// 页面控件赋值 /// </summary> protected void Evaluate() { if (Session["HAWB"] != null)//判断信息页面传的值是否为空 { hawb = (HAWB)Session["HAWB"]; } if (Session["DeliverBook"] != null)//判断选择历史按钮是否又记录 { Addbook = (AddressBook)Session["DeliverBook"]; } if (Addbook != null) { Txt_DeliverName.Text = Addbook.Name; Txt_DeliverAddress.Text = Addbook.Address; foreach (CountryCode countrycode in listcountry) { if (countrycode.CountryCode1 == Addbook.CountryCode) { Txt_DeliverCountry.Text = countrycode.CountryName; break; } } foreach (RegionCode regioncode in listregion) { if (regioncode.RegionCode1 == Addbook.RegionCode) { Txt_DeliverRegion.Text = regioncode.RegionName; break; } } Txt_DeliverProvince.Text = Addbook.Provience; Txt_DeliverZipCode.Text = Addbook.PostCode; Txt_DeliverContactor.Text = Addbook.ContactorName; Txt_DeliverTel.Text = Addbook.Phone; } else { string CompanyCode = string.Empty; string DepCode = string.Empty; if (Session["compayCode"] != null) { CompanyCode = Session["compayCode"].ToString(); } if (Session["DepCode"] != null) { DepCode = Session["DepCode"].ToString(); } if (!string.IsNullOrEmpty(DepCode) && !string.IsNullOrEmpty(CompanyCode)) { IList<AddressBook> ressbook = _deparservice.FindAllForwarderAddressesByDepCodeAndCompanyCode(DepCode, CompanyCode); if (ressbook != null) { foreach (AddressBook address in ressbook) { if (address.AddressType == 2) { Txt_DeliverName.Text = address.Name; Txt_DeliverAddress.Text = address.Address; Txt_DeliverCountry.Text = CountrySwitch(address.CountryCode,1); Txt_DeliverRegion.Text = RegionSwitch(address.RegionCode, 1); Txt_DeliverProvince.Text = address.Provience; Txt_DeliverZipCode.Text = address.PostCode; Txt_DeliverContactor.Text = address.ContactorName; Txt_DeliverTel.Text = address.Phone; break; } } } } } }
/// <summary> /// 添加按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btn_AddDeliver_Click1(object sender, EventArgs e) { if (hawb == null) { hawb = (HAWB)Session["HAWB"]; } if (Txt_DeliverName.Text.Trim() == "") { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('名称不能为空!')</script>"); Txt_DeliverName.Focus(); } else if (Txt_DeliverAddress.Text.Trim() == "") { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('地址不能为空!')</script>"); Txt_DeliverAddress.Focus(); } else if (Txt_DeliverCountry.Text.Trim() == "") { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('国家不能为空!')</script>"); Txt_DeliverCountry.Focus(); } else if (Txt_DeliverRegion.Text.Trim() == "") { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('地区不能为空!')</script>"); Txt_DeliverRegion.Focus(); } else if (Txt_DeliverZipCode.Text.Trim() == "") { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('邮编不能为空!')</script>"); Txt_DeliverZipCode.Focus(); } else if (Txt_DeliverContactor.Text.Trim() == "") { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('联系人不能为空!')</script>"); Txt_DeliverContactor.Focus(); } else if (Txt_DeliverTel.Text.Trim() == "") { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('电话不能为空!')</script>"); Txt_DeliverTel.Focus(); } else { if (!RTel.IsMatch(Txt_DeliverTel.Text.Trim())) { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('电话号码格式不正确!')</script>"); Txt_DeliverTel.Focus(); } else { if (!string.IsNullOrEmpty(CountrySwitch(Txt_DeliverCountry.Text.Trim().ToUpper(), 0)) && !string.IsNullOrEmpty(RegionSwitch(Txt_DeliverRegion.Text.Trim().ToUpper(), 0))) { hawb.DeliverName = Txt_DeliverName.Text.Trim().ToUpper(); hawb.DeliverAddress = Txt_DeliverAddress.Text.Trim().ToUpper(); hawb.DeliverCountry = CountrySwitch(Txt_DeliverCountry.Text.Trim().ToUpper(), 0); hawb.DeliverRegion = RegionSwitch(Txt_DeliverRegion.Text.Trim().ToUpper(), 0); hawb.DeliverContactor = Txt_DeliverContactor.Text.Trim().ToUpper(); hawb.DeliverZipCode = Txt_DeliverZipCode.Text.Trim().ToUpper(); hawb.DeliverTel = Txt_DeliverTel.Text.Trim().ToUpper(); Session["HAWB"] = hawb; Session.Remove("ComCode"); Session.Remove("DepCode"); Response.Write("<script>window.parent.location = 'HAWBAdd.aspx';</script>");//刷新前一个页面 Page.ClientScript.RegisterStartupScript(this.GetType(), "myscript", "<script>closeList2();</script>");//关闭层 } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "myscript", "<script>alert('请输入正确的国家和地区!')</script>"); } } } }
/// <summary> /// HWAB赋值 /// </summary> private void Storage() { if (ViewState["update"] != null) { Update = (int)ViewState["update"]; } hawb = (HAWB)Session["HAWB"]; if (Update == 0) { if (hawb == null) { hawb = new HAWB(); Department depar = (Department)Session["Department"]; hawb.Department = depar; hawb.HID = Guid.NewGuid(); hawb.CreateTime = DateTime.Now; hawb.DID = depar.DID; } } else { hawb.Status = int.Parse(DDl_Status.SelectedValue); } hawb.SettleType = int.Parse(DDl_SettleType.SelectedValue); hawb.BarCode = Txt_BarCode.Text.Trim().ToUpper(); hawb.ShipperName = Txt_ShipperName.Text.Trim().ToUpper(); hawb.ShipperAddress = Txt_ShipperAddress.Text.Trim().ToUpper(); hawb.ShipperCountry = CountrySwitch(Txt_ShipperCountry.Text.Trim().ToUpper()); hawb.ShipperRegion = RegionSwitch(Txt_ShipperRegion.Text.Trim().ToUpper()); hawb.ShipperContactor = Txt_ShipperContactor.Text.Trim().ToUpper(); hawb.ShipperTel = Txt_ShipperTel.Text.Trim().ToUpper(); hawb.ShipperZipCode = Txt_ShipperZipCode.Text.Trim().ToUpper(); hawb.ConsigneeName = Txt_ConsigneeName.Text.Trim().ToUpper(); hawb.ConsigneeContactor = Txt_ConsigneeContactor.Text.Trim().ToUpper(); hawb.ConsigneeAddress = Txt_ConsigneeAddress.Text.Trim().ToUpper(); hawb.ConsigneeCountry = CountrySwitch(Txt_ConsigneeCountry.Text.Trim().ToUpper()); hawb.ConsigneeRegion = RegionSwitch(Txt_ConsigneeRegion.Text.Trim().ToUpper()); hawb.ConsigneeTel = Txt_ConsigneeTel.Text.Trim().ToUpper(); hawb.ConsigneeZipCode = Txt_ConsigneeZipCode.Text.Trim().ToUpper(); hawb.UpdateTime = DateTime.Now; if (Deliver.Visible) { hawb.DeliverName = Txt_DeliverName.Text.Trim().ToUpper(); hawb.DeliverAddress = Txt_DeliverAddress.Text.Trim().ToUpper(); hawb.DeliverCountry = CountrySwitch(Txt_DeliverCountry.Text.Trim().ToUpper()); hawb.DeliverRegion = RegionSwitch(Txt_DeliverRegion.Text.Trim().ToUpper()); hawb.DeliverContactor = Txt_DeliverContactor.Text.Trim().ToUpper(); hawb.DeliverZipCode = Txt_DeliverZipCode.Text.Trim().ToUpper(); hawb.DeliverTel = Txt_DeliverTel.Text.Trim().ToUpper(); } Session.Remove("HAWB"); Session["HAWB"] = hawb; }
/// <summary> /// 页面控件赋值 /// </summary> protected void Evaluate() { hawb = (HAWB)Session["HAWB"]; if (hawb != null) { Txt_BarCode.Text = hawb.BarCode; Department depar = hawb.Department; Txt_Account1.Text = depar.CompanyCode; Txt_Account2.Text = depar.DepCode; DDl_SettleType.SelectedValue = depar.SettleType.ToString(); DDl_Status.SelectedValue = hawb.Status.ToString(); } if (Session["AddressShipperBook"] != null)//判断发件人历史记录是否又记录 { AddressBook AddderssShipper = (AddressBook)Session["AddressShipperBook"]; foreach (CountryCode code in listcountry) { if (code.CountryCode1 == AddderssShipper.CountryCode) { Txt_ShipperCountry.Text = code.CountryName; break; } } foreach (RegionCode code in listregion) { if (code.RegionCode1 == AddderssShipper.RegionCode) { Txt_ShipperRegion.Text = code.RegionName; break; } } lbl_ShipperAddressAid.Text = AddderssShipper.AID.ToString(); Txt_ShipperName.Text = AddderssShipper.Name; Txt_ShipperContactor.Text = AddderssShipper.ContactorName; Txt_ShipperAddress.Text = AddderssShipper.Address; Txt_ShipperTel.Text = AddderssShipper.Phone; Txt_ShipperZipCode.Text = AddderssShipper.PostCode; } else { if (hawb != null) { Department depar = hawb.Department; lbl_ShipperAddressAid.Text = depar.DID.ToString(); Txt_ShipperName.Text = hawb.ShipperName; Txt_ShipperContactor.Text = hawb.ShipperContactor; foreach (CountryCode code in listcountry) { if (code.CountryCode1 == hawb.ShipperCountry) { Txt_ShipperCountry.Text = code.CountryName; break; } } foreach (RegionCode code in listregion) { if (code.RegionCode1 == hawb.ShipperRegion) { Txt_ShipperRegion.Text = code.RegionName; break; } } Txt_ShipperAddress.Text = hawb.ShipperAddress; Txt_ShipperTel.Text = hawb.ShipperTel; Txt_ShipperZipCode.Text = hawb.ShipperZipCode; } } if (Session["AddressConsigneeBook"] != null)//判断收件人历史是否又记录 { AddressBook AddderssConsignee = (AddressBook)Session["AddressConsigneeBook"]; Txt_ConsigneeName.Text = AddderssConsignee.Name; Txt_ConsigneeContactor.Text = AddderssConsignee.ContactorName; foreach (CountryCode code in listcountry) { if (code.CountryCode1 == AddderssConsignee.CountryCode) { Txt_ConsigneeCountry.Text = code.CountryName; break; } } foreach (RegionCode code in listregion) { if (code.RegionCode1 == AddderssConsignee.RegionCode) { Txt_ConsigneeRegion.Text = code.RegionName; break; } } Txt_ConsigneeAddress.Text = AddderssConsignee.Address; Txt_ConsigneeTel.Text = AddderssConsignee.Phone; Txt_ConsigneeZipCode.Text = AddderssConsignee.PostCode; } else { if (hawb != null) { if (hawb.ConsigneeName != "") { foreach (CountryCode code in listcountry) { if (code.CountryCode1 == hawb.ConsigneeCountry) { Txt_ConsigneeCountry.Text = code.CountryName; break; } } foreach (RegionCode code in listregion) { if (code.RegionCode1 == hawb.ConsigneeRegion) { Txt_ConsigneeRegion.Text = code.RegionName; break; } } Txt_ConsigneeName.Text = hawb.ConsigneeName; Txt_ConsigneeContactor.Text = hawb.ConsigneeContactor; Txt_ConsigneeAddress.Text = hawb.ConsigneeAddress; Txt_ConsigneeTel.Text = hawb.ConsigneeTel; Txt_ConsigneeZipCode.Text = hawb.ConsigneeZipCode; } else { ConsigneeEvaluate(Txt_Account1.Text.Trim().ToUpper(),Txt_Account2.Text.Trim().ToUpper()); } } } if (Session["AddressDeliverBook"] != null)//判断交付人历史是否有记录 { AddressBook AddderssDeliver = (AddressBook)Session["AddressDeliverBook"]; Txt_DeliverName.Text = AddderssDeliver.Name; Txt_DeliverAddress.Text = AddderssDeliver.ContactorName; foreach (CountryCode code in listcountry) { if (code.CountryCode1 == AddderssDeliver.CountryCode) { Txt_DeliverCountry.Text = code.CountryName; break; } } foreach (RegionCode code in listregion) { if (code.RegionCode1 == AddderssDeliver.RegionCode) { Txt_DeliverRegion.Text = code.RegionName; break; } } Txt_DeliverContactor.Text = AddderssDeliver.Address; Txt_DeliverZipCode.Text = AddderssDeliver.PostCode; Txt_DeliverTel.Text = AddderssDeliver.Phone; } else { if (hawb != null) { if (hawb.DeliverName != "" && hawb.DeliverName != null) { Txt_DeliverName.Text = hawb.DeliverName; Txt_DeliverAddress.Text = hawb.DeliverAddress; foreach (CountryCode code in listcountry) { if (code.CountryCode1 == hawb.DeliverCountry) { Txt_DeliverCountry.Text = code.CountryName; break; } } foreach (RegionCode code in listregion) { if (code.RegionCode1 == hawb.DeliverRegion) { Txt_DeliverRegion.Text = code.RegionName; break; } } Txt_DeliverContactor.Text = hawb.DeliverContactor; Txt_DeliverZipCode.Text = hawb.DeliverZipCode; Txt_DeliverTel.Text = hawb.DeliverTel; } } } }
/// <summary> /// 包添加运单 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btn_Add_Click(object sender, EventArgs e) { if (txt_BarCode.Text.Trim() == "") { ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "alert('请输入运单号!');", true); } else { hawb = _hawbservice.FindHAWBByBarCode(txt_BarCode.Text.Trim()); if (hawb != null) { package = _packageservice.FindPackageByBarcode(lbtn_BagBarCode.Text); if (package == null) { package = new Package(); } if (_packageservice.JudgePIDIsNull(hawb.BarCode))//判断运单是否已存在包号 { if (package.JudgeHAWB(hawb))//判断该包是否存在该条运单 { //if (_packageservice.JudgeRegionCodeIsRepeat(hawb.BarCode, txt_Destination.Text.Trim().ToUpper(), package.IsMixed)) //{ package.HAWBs.Add(hawb); _packageservice.ModifyPackage(package); txt_Pice.Text = package.Piece.ToString(); Txt_TotalWeight.Text = package.TotalWeight.ToString(); gv_HAWB.DataSource = package.HAWBs; gv_HAWB.DataBind(); //} //else //{ // ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "alert('包目的地和运单目的地不一直!')", true); //} } else { ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "alert('该运单已经添加,不能再次进行添加!')", true); } } else { ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "alert('该运单已经添加,不能再次进行添加!')", true); } } else { ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "alert('没有该运单记录!')", true); } } if (gv_HAWB.Rows.Count != 0) { btn_Close.Visible = true; } txt_BarCode.Text = string.Empty; txt_BarCode.Focus(); }
/// <summary> /// 包添加运单 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btn_Add_Click(object sender, EventArgs e) { string type = rbtn_PackageType.SelectedValue; if (txt_BarCode.Text.Trim() == "") { ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "alert('请输入运单号!')", true); txt_BarCode.Focus(); } else { if (Txt_BagBarCode.Text.Trim() != "" && Txt_DestinationRegionCode.Text.Trim() != ""&&Txt_OriginalRegionCode.Text.Trim()!="") { hawb = _hawbservice.FindHAWBByBarCode(txt_BarCode.Text.Trim()); if (hawb != null) { package = (Package)Session["package"]; if (package == null) { package = new Package(); } if (package.JudgeHAWB(hawb))//判断运单是否在该包里面 { bool isMix; if (rbtn_PackageType.SelectedValue == "0")//判断是否混包 { isMix = false; } else { isMix = true; } if (_packageservice.JudgePIDIsNull(hawb.BarCode))//判断该运单是否已经打包 { //if (_packageservice.JudgeRegionCodeIsRepeat(hawb.BarCode, Txt_Region.Text.Trim().ToUpper(), isMix)) //{ package.HAWBs.Add(hawb); txt_Pice.Text = package.Piece.ToString(); Txt_TotalWeight.Text = package.TotalWeight.ToString(); gv_HAWB.DataSource = package.HAWBs; gv_HAWB.DataBind(); Session["package"] = package; //} //else //{ // ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "alert('包目的地和运单目的地不一直!')", true); //} } else { ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "alert('该运单已经添加,不能再次进行添加!')", true); } } else { ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "alert('该运单已经添加,不能再次进行添加!')", true); } } else { ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "alert('没有该运单记录!')", true); } } else { ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "alert('请先输入包的信息!')", true); } } if (gv_HAWB.Rows.Count != 0) { btn_Close.Visible = true; } txt_BarCode.Text = string.Empty; txt_BarCode.Focus(); }
/// <summary> /// 页面控件赋值 /// </summary> protected void Storage(HAWB hawb) { Txt_BarCode.Text = hawb.BarCode; Department depar = hawb.Department; Txt_Account1.Text = depar.CompanyCode; Txt_Account2.Text = depar.DepCode; DDl_SettleType.SelectedValue = hawb.SettleType.ToString(); switch (hawb.Status) { case 0: txt_Status.Text = "待审核"; break; case 1: txt_Status.Text = "取货"; break; case 2: txt_Status.Text = "核单"; break; case 3: txt_Status.Text = "派送"; break; case 4: txt_Status.Text = "in包"; break; } Txt_ShipperName.Text = hawb.ShipperName; Txt_ShipperContactor.Text = hawb.ShipperContactor; Txt_ShipperAddress.Text = hawb.ShipperAddress; Txt_ShipperTel.Text = hawb.ShipperTel; Txt_ShipperZipCode.Text = hawb.ShipperZipCode; Txt_ConsigneeName.Text = hawb.ConsigneeName; Txt_ConsigneeContactor.Text = hawb.ConsigneeContactor; Txt_ConsigneeAddress.Text = hawb.ConsigneeAddress; Txt_ConsigneeTel.Text = hawb.ConsigneeTel; Txt_ConsigneeZipCode.Text = hawb.ConsigneeZipCode; if (hawb.DeliverName != "" && hawb.DeliverName!=null) { foreach (CountryCode code in listcountry) { if (code.CountryCode1 == hawb.ShipperCountry) { Txt_ShipperCountry.Text = code.CountryName; } if (code.CountryCode1 == hawb.ConsigneeCountry) { Txt_ConsigneeCountry.Text = code.CountryName; } if (code.CountryCode1 == hawb.DeliverCountry) { Txt_DeliverCountry.Text = code.CountryName; } } foreach (RegionCode code in listregion) { if (code.RegionCode1 == hawb.ShipperRegion) { Txt_ShipperRegion.Text = code.RegionName; } if (code.RegionCode1 == hawb.ConsigneeRegion) { Txt_ConsigneeRegion.Text = code.RegionName; } if (code.RegionCode1 == hawb.DeliverRegion) { Txt_DeliverRegion.Text = code.RegionName; } } Deliver.Visible = true; Txt_DeliverName.Text = hawb.DeliverName; Txt_DeliverAddress.Text = hawb.DeliverAddress; Txt_DeliverContactor.Text = hawb.DeliverContactor; Txt_DeliverZipCode.Text = hawb.DeliverZipCode; Txt_DeliverTel.Text = hawb.DeliverTel; Txt_CarrierHAWBBarCode.Text = hawb.CarrierHAWBBarCode; Txt_Carrier.Text = hawb.Carrier; } else { Deliver.Visible = false; foreach (CountryCode code in listcountry) { if (code.CountryCode1 == hawb.ShipperCountry) { Txt_ShipperCountry.Text = code.CountryName; } if (code.CountryCode1 == hawb.ConsigneeCountry) { Txt_ConsigneeCountry.Text = code.CountryName; } } foreach (RegionCode code in listregion) { if (code.RegionCode1 == hawb.ShipperRegion) { Txt_ShipperRegion.Text = code.RegionName;; } if (code.RegionCode1 == hawb.ConsigneeRegion) { Txt_ConsigneeRegion.Text = code.RegionName; } } rbt_BoxType.SelectedValue = hawb.ServiceType.ToString(); rbt_payer.SelectedValue = hawb.BillTax.ToString(); Rbl_SpecialInstruction.SelectedValue = hawb.SpecialInstruction; ddl_WeightType.SelectedValue = hawb.WeightType.ToString(); hawb.CalculateTotalWeight(); txt_TotalWeight.Text = hawb.TotalWeight.ToString(); lbl_Piece.Text = hawb.Piece.ToString(); lbl_TotalVolume.Text = hawb.TotalVolume.ToString(); txt_Remark.Text = hawb.Remark; Txt_Carrier.Text = hawb.Carrier; Txt_CarrierHAWBBarCode.Text = hawb.CarrierHAWBBarCode; gv_Box.DataSource = hawb.HAWBBoxes; gv_Box.DataBind(); GV_item.DataSource = hawb.HAWBItems; GV_item.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["UserID"] != null) { Guid id = (Guid)Session["UserID"]; ModulePrivilege Mprivilege = _sysUserManagementService.GetPrivilegeByUserid(id); DropDownList(); Txt_BarCode.Focus(); listcountry = _countryservice.FindAllCountries(); listregion = _regionservice.FindAllRegionCodes(); if (!string.IsNullOrEmpty(Request.QueryString["BarCode"])) { if (!(bool)Mprivilege[Privilege.修改.ToString()]) { But_Next.Enabled = false; } Update = Convert.ToInt32(Request.QueryString["update"]); ViewState["update"] = Update; hawb = _hawbService.LoadHAWBByBarCode(Request.QueryString["BarCode"].ToString()); Session["HAWB"] = hawb; if (hawb.DeliverName != "" && hawb.DeliverName != null) { this.Deliver.Visible = true; this.lbtn_AddConsignee.Enabled = true; } Evaluate(); DDl_Status.Visible = true; lbl_Status.Visible = true; } else { if (Session["HAWB"] != null) { hawb = (HAWB)Session["HAWB"]; if (hawb.DeliverName != null && hawb.DeliverName != "") { this.Deliver.Visible = true; this.lbtn_AddConsignee.Enabled = false; Txt_ConsigneeName.Focus(); } } if (!(bool)Mprivilege[Privilege.添加.ToString()]) { But_Next.Enabled = false; } Evaluate(); DDl_Status.Visible = false; lbl_Status.Visible = false; } } else { Response.Write("<script>alert('没有访问权限!');location='../HOME.aspx'</script>"); } } }
/// <summary> /// 清除交付人信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void but_cancel_Click(object sender, EventArgs e) { Txt_DeliverName.Text = string.Empty; Txt_DeliverAddress.Text = string.Empty; Txt_DeliverCountry.Text = string.Empty; Txt_DeliverRegion.Text = string.Empty; Txt_DeliverContactor.Text = string.Empty; Txt_DeliverZipCode.Text = string.Empty; Txt_DeliverTel.Text = string.Empty; Txt_ConsigneeName.Text = string.Empty; Txt_ConsigneeAddress.Text = string.Empty; Txt_ConsigneeCountry.Text = string.Empty; Txt_ConsigneeRegion.Text = string.Empty; Txt_ConsigneeContactor.Text = string.Empty; Txt_ConsigneeZipCode.Text = string.Empty; Txt_ConsigneeTel.Text = string.Empty; Deliver.Visible = false; //delivertitle.Visible = false; lbtn_AddConsignee.Enabled = true; if (hawb == null) { hawb = (HAWB)Session["HAWB"]; } hawb.DeliverAddress = null; hawb.DeliverContactor = null; hawb.DeliverCountry = null; hawb.DeliverName = null; hawb.DeliverRegion = null; hawb.DeliverTel = null; hawb.DeliverZipCode = null; Session.Remove("HAWB"); Session["HAWB"] = hawb; Session.Remove("AddressDeliverBook"); }
public NpoiHelper(HAWB dataSource) { if (dataSource == null) throw new ArgumentNullException("dataSource", @"运单不能为空"); _hawbDataSource = dataSource; }
/// <summary> /// 为包裹新增运单 /// true:判断运单重复并且插入 /// false:未插入 /// </summary> /// <param name="hawb">运单</param> /// <returns></returns> public bool JudgeHAWB(HAWB hawb) { bool judge = true; if (string.IsNullOrEmpty(Convert.ToString(hawb.PID))) { if (this.HAWBs.Count != 0) { foreach (HAWB hawbObj in this.HAWBs) { if (hawb.BarCode.Equals(hawbObj.BarCode)) { judge = false; break; } } } } return judge; }
private void FixupHAWB(HAWB previousValue) { if (IsDeserializing) { return; } if (previousValue != null && previousValue.HAWBBoxes.Contains(this)) { previousValue.HAWBBoxes.Remove(this); } if (HAWB != null) { if (!HAWB.HAWBBoxes.Contains(this)) { HAWB.HAWBBoxes.Add(this); } HID = HAWB.HID; } if (ChangeTracker.ChangeTrackingEnabled) { if (ChangeTracker.OriginalValues.ContainsKey("HAWB") && (ChangeTracker.OriginalValues["HAWB"] == HAWB)) { ChangeTracker.OriginalValues.Remove("HAWB"); } else { ChangeTracker.RecordOriginalValue("HAWB", previousValue); } if (HAWB != null && !HAWB.ChangeTracker.ChangeTrackingEnabled) { HAWB.StartTracking(); } } }