示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            txt_CreateTime.Text = time.ToString("yyyy-MM-dd HH:mm");
            //if (!IsPostBack)
            //{
                if (Session["UserID"] != null)
                {
                    Guid id = (Guid)Session["UserID"];
                    ModulePrivilege Mprivilege = _SysUserManagementService.GetPrivilegeByUserid(id);
                    if (!(bool)Mprivilege[Privilege.添加.ToString()])
                    {
                        btn_Add.Enabled = false;
                        btn_Save.Enabled = false;
                        btn_SaveAndClose.Enabled = false;
                    }
                }
                Txt_MAWBBarCode.Focus();
                mawb = new MAWB();
                Session["mawb"] = mawb;
                if (gv_Bag.Rows.Count == 0)
                {
                    btn_Close.Visible = false;
                }

                //txt_UpdateTime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm");

            //}
        }
示例#2
0
 /// <summary>
 /// 导出总运单号
 /// </summary>
 /// <param name="dataSource">总运单</param>
 /// <param name="dataSource2">子运单数据</param>
 /// <param name="hawbtype">导出类型</param>
 public NpoiHelper(MAWB dataSource,IList<HAWB> dataSource2,ExportType hawbtype)
 {
     if (dataSource == null) throw new ArgumentNullException("dataSource", @"总运单不能为空");
     _mawbDataSource = dataSource;
     _hawbDataSources = dataSource2;
     _hawbtype=hawbtype;
 }
 /// <summary>
 /// 修改总运单
 /// </summary>
 /// <param name="mawb">总运单</param>
 public void ModifyMAWB(MAWB mawb)
 {
     if (mawb == null)
         throw new ArgumentNullException("MAWB is null");
     IUnitOfWork unitOfWork = _mawbRepository.UnitOfWork;
     _mawbRepository.Modify(mawb);
     //complete changes in this unit of work
     unitOfWork.CommitAndRefreshChanges();
 }
 /// <summary>
 /// 新增总运单
 /// </summary>
 /// <param name="mawb">总运单</param>
 public void AddMAWB(MAWB mawb)
 {
     if (mawb == null)
         throw new ArgumentNullException("MAWB is null");
     IUnitOfWork unitOfWork = _mawbRepository.UnitOfWork;
     _mawbRepository.Add(mawb);
     //complete changes in this unit of work
     unitOfWork.Commit();
 }
示例#5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         Txt_MAWBBarCode.Focus();
         if (Request.QueryString["BarCode"] != "" && Request.QueryString["BarCode"] != null)
         {
             
                 if (!bool.Parse(Request.QueryString["Privilege"]))
                 {
                     btn_Add.Enabled = false;
                     btn_Save.Enabled = false;
                     btn_SaveAndClose.Enabled = false;
                     btn_Close.Enabled = false;
                 }
                 else
                 {
                     if (txt_Status.Text != "打开")
                     {
                         if (Request.QueryString["Privilege1"]!=null)
                         {
                             if (!bool.Parse(Request.QueryString["Privilege1"]))
                             {
                                 btn_Add.Enabled = false;
                                 btn_Save.Enabled = false;
                                 btn_SaveAndClose.Enabled = false;
                                 btn_Close.Enabled = false;
                             }
                         }
                         
                     }
                 }
             ViewState["UrlReferrer"] = Request.UrlReferrer;
             mawb = _mawbservice.FindMAWBByBarcode(Request.QueryString["BarCode"]);
             if (mawb != null)
             {
                 Evaluate(mawb);
                 
             }
             else
             {
                 Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "show", "<script>alert('没有相关记录!');location='MawbManagement.aspx'</script>");
             }
         }
         else
         {
             Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "show", "<script>alert('没有相关记录!');location='MawbManagement.aspx'</script>");
         }
     }
 }
示例#6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Request.QueryString["BarCode"] != ""&&Request.QueryString["BarCode"] !=null)
         {
             
             Uri url = Request.UrlReferrer;
             ViewState["UrlReferrer"] = Request.UrlReferrer;
             mawb = _mawbService.FindMAWBByBarcode(Request.QueryString["BarCode"]);
             if (mawb != null)
             {
                 Evaluate(mawb);
                 
                 if (!bool.Parse(Request.QueryString["Privilege"]))
                 {
                     But_Update.Enabled = false;
                 }
                 else
                 {
                     if (txt_Status.Text != "打开")
                     {
                         if (!bool.Parse(Request.QueryString["aPrivilege1"]))
                         {
                             But_Update.Enabled = false;
                         }
                     }
                         
                 }
                 if (!bool.Parse(Request.QueryString["aPrivilege2"]))
                 {
                     btn_DeriveAccept.Enabled = false;
                     btn_DeriveSince.Enabled = false;
                 }
             }
             else
             {
                 //Response.Redirect("<script>alert('!');</script>");
                 Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "show", "<script>alert('没有相关记录!');location="+url+"</script>"); 
                 
             }
         }
         else
         {
             Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "show", "<script>alert('没有相关记录!');location='MawbManagement.aspx'</script>");
            
         }
     }
 }
示例#7
0
 /// <summary>
 /// 页面控件赋值
 /// </summary>
 /// <param name="mawb"></param>
 protected void Evaluate(MAWB mawb)
 {
     lbl_MAWBBarCode.Text = mawb.BarCode;
     txt_CreateTime.Text = mawb.CreateTime.ToString("yyyy-MM-dd HH:mm");
     if (mawb.LockedTime != null)
     {
         txt_LockTime.Text = mawb.LockedTime.Value.ToString("yyyy-MM-dd HH:mm");
     }
     lbtn_FLTNo.Text = mawb.FlightNo;
     txt_TotalVolume.Text = mawb.TotalVolume.ToString();
     Txt_TotalWeight.Text = mawb.TotalWeight.ToString();
     txt_Status.Text = mawb.Status.ToString().Replace("0","打开").Replace("1","关闭");
     gv_MAWB.DataSource = mawb.Packages;
     gv_MAWB.DataBind();
 }
示例#8
0
        /// <summary>
        /// 页面控件赋值
        /// </summary>
        /// <param name="mawb"></param>
        protected void Evaluate(MAWB mawb)
        {
            txt_FLTNo.Text = mawb.FlightNo;
            txt_From.Text = mawb.From;
            txt_To.Text = mawb.To;
            txt_CreateTime.Text = mawb.CreateTime.ToString("yyyy-MM-dd HH:mm");
            if (mawb.LockedTime != null)
            {
                txt_UpdateTime.Text = mawb.LockedTime.Value.ToString("yyyy-MM-dd HH:mm");
            }
            Txt_MAWBBarCode.Text = mawb.BarCode;
            txt_Status.Text = mawb.Status.ToString().Replace("0","打开").Replace("1","关闭");
            Txt_TotalWeight.Text = mawb.TotalWeight.ToString();
            txt_TotalVolume.Text = mawb.TotalVolume.ToString();
            gv_Bag.DataSource = mawb.Packages;
            gv_Bag.DataBind();
            if (gv_Bag.Rows.Count == 0)
            {
                btn_Close.Visible = false;
            }
                

        }
示例#9
0
        /// <summary>
        /// 删除总运单里的包
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btn_Close_Click(object sender, EventArgs e)
        {
            bool ok = false;
            if (mawb == null)
            {
                mawb = _mawbservice.FindMAWBByBarcode(Request.QueryString["BarCode"]);
            }
            for (int i = gv_Bag.Rows.Count - 1; i > -1; i--)
            {
                if (((CheckBox)gv_Bag.Rows[i].FindControl("chkId")).Checked)
                {
                    ok = true;
                    string barcode = ((Label)gv_Bag.Rows[i].FindControl("lbl_BagBarCode")).Text;

                    Package pack = _packageservice.FindPackageByBarcode(barcode);

                    mawb.Packages.Remove(pack);
                    Txt_TotalWeight.Text = mawb.TotalWeight.ToString();
                    txt_TotalVolume.Text = mawb.TotalVolume.ToString();
                }
            }
            if (ok == true)
            {
                ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "alert('删除成功!')", true);
                _mawbservice.ModifyMAWB(mawb);
                if (mawb.Packages == null)
                {
                    btn_Close.Visible = false;
                }
                gv_Bag.DataSource = mawb.Packages;
                gv_Bag.DataBind();
            }
            else
            {
                ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "alert('请选择要删除的记录!')", true);
               
            }
        }
示例#10
0
        /// <summary>
        /// 保存方法
        /// </summary>
        /// <param name="type">保存类型0:保存,1:保存并关闭</param>
        protected void Addmawb(int type)
        {
            if (mawb == null)
            {
                mawb = _mawbservice.FindMAWBByBarcode(Txt_MAWBBarCode.Text.Trim().ToUpper());
            }
            if (Txt_MAWBBarCode.Text.Trim() == "")
            {
                ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "alert('请输入总运单号!')", true);
            }
            else if (txt_FLTNo.Text.Trim() == "")
            {
                ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "alert('请输入航班号!')", true);
            }
            else
            {
                if (Txt_TotalWeight.Text.Trim() != "")
                {
                    mawb.TotalWeight = decimal.Parse(Txt_TotalWeight.Text.Trim());
                }
                if (txt_TotalVolume.Text.Trim() != "")
                {
                    mawb.TotalVolume = decimal.Parse(txt_TotalVolume.Text.Trim());
                }
                if (type == 1)
                {
                    mawb.Status = 1;
                }
                else
                {
                    mawb.Status = 0;
                }
                if (Regex.IsMatch(txt_From.Text.Trim(), RRegion) && Regex.IsMatch(txt_To.Text.Trim(), RRegion))
                {
                    mawb.BarCode = Txt_MAWBBarCode.Text.Trim().ToUpper();
                    mawb.FlightNo = txt_FLTNo.Text.Trim().ToUpper();
                    mawb.From = txt_From.Text.Trim().ToUpper();
                    mawb.To = txt_To.Text.Trim().ToUpper();
                    mawb.CreateTime = DateTime.Parse(txt_CreateTime.Text.Trim());
                    mawb.LockedTime = DateTime.Now;
                    mawb.Operator = "ceshi";
                    _mawbservice.ModifyMAWB(mawb);
                    Txt_MAWBBarCode.Text = string.Empty;
                    txt_FLTNo.Text = string.Empty;
                    txt_CreateTime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm");
                    txt_From.Text = string.Empty;
                    txt_To.Text = string.Empty;
                    txt_Status.Text = string.Empty;
                    Txt_TotalWeight.Text = string.Empty;
                    txt_TotalVolume.Text = string.Empty;
                    gv_Bag.DataSource = null;
                    gv_Bag.DataBind();
                    btn_Close.Visible = false;
                    ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "Url()", true);
                    //Response.Write("<script>alert('修改成功!');location='MawbManagement.aspx'</script>");

                }
                else
                {
                    ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "alert('机场三字码只能输入字母并为3位!')", true);
                }
            }
        }
示例#11
0
        /// <summary>
        /// 总运单添加包
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btn_Add_Click(object sender, EventArgs e)
        {
            bool ok = true;
            if (Txt_BagBarCode.Text.Trim() == "")
            {
                ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "alert('请输入总运单号!')", true);
                //Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "show", "<script>alert('请输入总运单号!')</script>");
            }
            else
            {
                package = _packageservice.FindPackageByBarcode(Txt_BagBarCode.Text.Trim());
                if (package != null)
                {
                    if (_mawbservice.JudgeMIDIsNull(package.BarCode))
                    {
                        //mawb = (MAWB)Session["mawb"];
                        if (mawb == null)
                        {
                            mawb = _mawbservice.FindMAWBByBarcode(Request.QueryString["BarCode"]);
                        }
                        if (mawb.Packages.Count == 0)
                        {
                            mawb.Packages.Add(package);
                        }
                        else
                        {
                            foreach (Package pack in mawb.Packages)
                            {
                                if (package.BarCode == pack.BarCode)
                                {
                                    ok = false;
                                    break;
                                }
                            }
                        }
                        if (ok)
                        {
                            mawb.Packages.Add(package);
                            _mawbservice.ModifyMAWB(mawb);
                            Txt_TotalWeight.Text = mawb.TotalWeight.ToString();
                            txt_TotalVolume.Text = mawb.TotalVolume.ToString();
                            gv_Bag.DataSource = mawb.Packages;
                            gv_Bag.DataBind();
                        }
                        else
                        {
                            ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "alert('该包已经添加,不能再次进行添加!')", true);
                        }
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "alert('该包已经添加,不能再次进行添加!')", true);
                        //Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "show", "<script>alert('!')</script>");
                    }
                }
                else
                {
                    ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "alert('没有该包记录!')", true);
                    
                }

            }
            if (gv_Bag.Rows.Count != 0)
            {
                btn_Close.Visible = true;
            }
            Txt_BagBarCode.Text = string.Empty;
            Txt_BagBarCode.Focus();
        }
示例#12
0
     private void FixupMAWB(MAWB previousValue, bool skipKeys = false)
     {
         if (IsDeserializing)
         {
             return;
         }
 
         if (previousValue != null && previousValue.Packages.Contains(this))
         {
             previousValue.Packages.Remove(this);
         }
 
         if (MAWB != null)
         {
             if (!MAWB.Packages.Contains(this))
             {
                 MAWB.Packages.Add(this);
             }
 
             MID = MAWB.MID;
         }
         else if (!skipKeys)
         {
             MID = null;
         }
 
         if (ChangeTracker.ChangeTrackingEnabled)
         {
             if (ChangeTracker.OriginalValues.ContainsKey("MAWB")
                 && (ChangeTracker.OriginalValues["MAWB"] == MAWB))
             {
                 ChangeTracker.OriginalValues.Remove("MAWB");
             }
             else
             {
                 ChangeTracker.RecordOriginalValue("MAWB", previousValue);
             }
             if (MAWB != null && !MAWB.ChangeTracker.ChangeTrackingEnabled)
             {
                 MAWB.StartTracking();
             }
         }
     }
示例#13
0
 /// <summary>
 /// 总运单添加包裹
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btn_Add_Click(object sender, EventArgs e)
 {
     bool ok = true;
     if (Txt_BagBarCode.Text.Trim() == "")
     {
         ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "alert('请输入运单号!')", true);
         Txt_BagBarCode.Focus();
     }
     else
     {
         if (mawb == null)
         {
             mawb = (MAWB)Session["mawb"];
         }
         package = _packageservice.FindPackageByBarcode(Txt_BagBarCode.Text.Trim());
         
         if (package != null)
         {
             
             if (_mawbservice.JudgeMIDIsNull(package.BarCode))//判断包裹是否已经存在总运单号
             {
                 if (mawb.JudgePackage(package))
                 {
                     mawb.Packages.Add(package);
                     Txt_TotalWeight.Text = mawb.TotalWeight.ToString();
                     txt_TotalVolume.Text = mawb.TotalVolume.ToString();
                     txt_Pice.Text = package.Piece.ToString();
                     gv_Bag.DataSource = mawb.Packages;
                     gv_Bag.DataBind();
                     Session.Remove("mawb");
                     Session["mawb"] = mawb;
                 }
                 else
                 {
                     ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "alert('该包已经添加,不能再次进行添加!')", true);
                 }
                 //if (mawb.Packages.Count == 0)
                 //{
                 //    mawb.Packages.Add(package);
                    
                 //}
                 //else
                 //{
                 //    foreach (Package pack in mawb.Packages)
                 //    {
                 //        if (package.BarCode == pack.BarCode)
                 //        {
                 //            ok = false;
                 //            break;
                 //        }
                 //    }
                 //}
                 //if (ok)
                 //{
                     
                 //}
                 //else
                 //{
                     
                 //}
             }
             else
             {
                 ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "alert('该包已经添加,不能再次进行添加!')", true);
             }
            
         }
         else
         {
             ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "alert('没有该包记录!')", true);
         }
         
     }
     if (gv_Bag.Rows.Count != 0)
     {
         btn_Close.Visible = true;
     }
     Txt_BagBarCode.Text = string.Empty;
     Txt_BagBarCode.Focus();
 }
示例#14
0
        /// <summary>
        /// 删除总运单里的包
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btn_Close_Click(object sender, EventArgs e)
        {
            bool ok = false;
            if (mawb == null)
            {
                mawb = (MAWB)Session["mawb"];
            }
            for (int i = gv_Bag.Rows.Count - 1; i > -1; i--)
            {
                string Bar = string.Empty;
                if (((CheckBox)gv_Bag.Rows[i].FindControl("chkId")).Checked)
                {
                    ok = true;
                    Bar = gv_Bag.DataKeys[i].Value.ToString();
                    foreach (Package pk in mawb.Packages)
                    {
                        if (pk.BarCode == Bar)
                        {
                            package = pk;
                        }
                    }
                    mawb.Packages.Remove(package);
                    Txt_TotalWeight.Text = mawb.TotalWeight.ToString();
                    txt_TotalVolume.Text = mawb.TotalVolume.ToString();
                }
            }
            if (ok == true)
            {
                ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "alert('移除成功!')", true);

                gv_Bag.DataSource = mawb.Packages;
                gv_Bag.DataBind();
                if (gv_Bag.Rows.Count == 0)
                {
                    btn_Close.Visible = false;
                }
               
            }
            else
            {
                ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "alert('请选择要移除的记录!')", true);
            }
        }
示例#15
0
        /// <summary>
        /// 保存方法
        /// </summary>
        /// <param name="type">保存类型0:保存,1:保存并关闭</param>
        protected void Addmawb(int type)
        {
            mawb = (MAWB)Session["mawb"];

            if (Txt_MAWBBarCode.Text.Trim() == "")
            {
                ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "alert('请输入总运单号!')", true);
            }
            else if (txt_FLTNo.Text.Trim() == "")
            {
                ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "alert('请输入航班号!')", true);
            }
            else
            {
                if (Txt_TotalWeight.Text.Trim() != "")
                {
                    mawb.TotalWeight = decimal.Parse(Txt_TotalWeight.Text.Trim());
                }
                if (txt_TotalVolume.Text.Trim() != "")
                {
                    mawb.TotalVolume = decimal.Parse(txt_TotalVolume.Text.Trim());
                }
                if (type == 1)
                {
                    mawb.Status = 1;
                }
                if (Regex.IsMatch(txt_From.Text.Trim(), RRegion) && Regex.IsMatch(txt_To.Text.Trim(), RRegion))
                {
                    mawb.MID = Guid.NewGuid();
                    mawb.BarCode = Txt_MAWBBarCode.Text.Trim().ToUpper();
                    mawb.FlightNo = txt_FLTNo.Text.Trim().ToUpper();
                    mawb.From = txt_From.Text.Trim().ToUpper();
                    mawb.To = txt_To.Text.Trim().ToUpper();
                    mawb.CreateTime = DateTime.Parse(txt_CreateTime.Text.Trim());
                    mawb.Operator = _SysUserManagementService.GetUserById((Guid)Session["UserID"]).LoginName;
                    try
                    {
                        //todo 睿策操作,location参数不确认
                        _logisticsService.PackPackageToMAWB(mawb, (Guid)Session["UserID"], "undefine", DateTime.Now);

                        mawb.IsSubmit = "0";
                        _mawbservice.AddMAWB(mawb);

                        ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "alert('添加成功!')", true);
                        Session["mawb"] = null;
                        Txt_MAWBBarCode.Text = string.Empty;
                        txt_FLTNo.Text = string.Empty;
                        txt_CreateTime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm");
                        txt_From.Text = string.Empty;
                        txt_To.Text = string.Empty;
                        txt_Pice.Text = string.Empty;
                        Txt_TotalWeight.Text = string.Empty;
                        txt_TotalVolume.Text = string.Empty;
                        gv_Bag.DataSource = null;
                        gv_Bag.DataBind();
                        btn_Close.Visible = true;
                    }
                    catch(Exception ex)
                    {
                        ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "",
                                                            "alert('" + ex.Message + "')", true);
                    }
                }
                else
                {
                    ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "", "alert('机场三字码只能输入字母并为3位!')", true);
                }
            }
        }