Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            List <string> idCodeList = Session["idCodeList"] as List <string>;
            string        idcodetext = Session["idcodetext"] as string;

            if (idCodeList != null)
            {
                PrintContent += "LODOP.SET_PRINT_PAGESIZE(1,600,400,\"\");";
                for (int i = 0; i < idCodeList.Count; i++)
                {
                    PrintContent += "LODOP.ADD_PRINT_TEXT(5, 20, " + System.Configuration.ConfigurationManager.AppSettings["MLabelWidth"]
                                    + ", " + System.Configuration.ConfigurationManager.AppSettings["MLabelHeight"]
                                    + ",\"" + idcodetext + "\");";
                    PrintContent += "LODOP.ADD_PRINT_BARCODE(30, 20, " + System.Configuration.ConfigurationManager.AppSettings["MLabelWidth"]
                                    + ", " + System.Configuration.ConfigurationManager.AppSettings["MLabelHeight"]
                                    + ", \"128A\", \"" + idCodeList[i] + "\");";
                    PrintContent += "LODOP.ADD_PRINT_TEXT(130, 20, " + System.Configuration.ConfigurationManager.AppSettings["MLabelWidth"]
                                    + ", " + System.Configuration.ConfigurationManager.AppSettings["MLabelHeight"]
                                    + ",\"" + System.Configuration.ConfigurationManager.AppSettings["rootOrgan"] + "\");";
                    PrintContent += "LODOP.NewPage();";
                }
                WHMatBLL bll = BLLFactory.CreateBLL <WHMatBLL>();
                bll.SignMatIDCodePrintCount(idCodeList);
            }

            Session["idCodeList"] = null;
        }
Example #2
0
        private void BindData()
        {
            WHMatBLL bll       = null;
            DataPage dp        = new DataPage();
            WHMat    condition = new WHMat();

            try
            {
                bll = BLLFactory.CreateBLL <WHMatBLL>();

                PagerHelper.InitPageControl(this.AspNetPager1, dp, true);
                condition.ID           = this.hiMatID.Value;
                condition.IDCodeStatus = this.CodeStatus.SelectedValue;
                condition.SpecCode     = this.MatSpec.SelectedValue;
                dp = bll.GetMatIDCodeList(condition, dp);

                List <MatIDCode> list = dp.Result as List <MatIDCode>;
                this.GvList.DataSource = list;
                this.GvList.DataBind();

                for (int i = 0; i < this.GvList.Rows.Count; i++)
                {
                    Label lblBarCode = this.GvList.Rows[i].Cells[2].FindControl("lblBarCode") as Label;
                    lblBarCode.Text = this.GvList.Rows[i].Cells[1].Text;
                }

                PagerHelper.SetPageControl(AspNetPager1, dp, true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #3
0
        protected void btSave_Click(object sender, EventArgs e)
        {
            WHMat    info = new WHMat();
            WHMatBLL bll  = null;

            try
            {
                UIBindHelper.BindModelByControls(this.Page, info);

                bll = BLLFactory.CreateBLL <WHMatBLL>();

                if (this.hiID.Value == "")
                {
                    bll.Insert(info);
                }
                else
                {
                    info.CREATEUSER = this.HiCREATEUSER.Value;
                    info.CREATETIME = DateTime.Parse(this.HiCREATETIME.Value);
                    info.ID         = this.hiID.Value;
                    bll.Update(info);
                }

                ClientScript.RegisterStartupScript(this.GetType(), "myjs", "parent.refreshData();parent.closeAppWindow1();", true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #4
0
        private void BindData()
        {
            string   id   = Request.QueryString["id"];
            WHMatBLL bll  = null;
            WHMat    info = new WHMat();

            try
            {
                bll = BLLFactory.CreateBLL <WHMatBLL>();
                if (string.IsNullOrEmpty(id) == false)
                {
                    info.ID = id;
                    info    = bll.Get(info);

                    UIBindHelper.BindForm(this.Page, info);
                    this.hiID.Value         = info.ID;
                    this.HiCREATEUSER.Value = info.CREATEUSER;
                    this.HiCREATETIME.Value = info.CREATETIME.ToString();
                }
                else
                {
                    info = new WHMat();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #5
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentEncoding = Encoding.UTF8;
            context.Response.ContentType     = "application/json";

            string idCode  = context.Request.QueryString["IDCode"];
            string matCode = context.Request.QueryString["MatCode"];

            WHMatBLL bll = BLLFactory.CreateBLL <WHMatBLL>();

            WHMat mat = null;

            bool exists = false;

            if (string.IsNullOrEmpty(idCode) == false)
            {
                //根据识别码
                mat = bll.GetMatByIDCode(idCode);
                if (mat != null)
                {
                    mat.BarCode = idCode;

                    //判断条码是否已入库
                    WHMatAmount amount = new StockBLL().GetStockByBarCode(idCode);
                    exists = amount != null ? true : false;
                    if (amount != null)
                    {
                        mat.Warehouse = amount.Warehouse;
                        mat.SaveSite  = amount.SaveSite;
                    }
                }
            }
            else
            {
                //根据货品编号
                mat = bll.GetMatByMatCode(matCode);
                if (mat != null)
                {
                    mat.BarCode = "";
                }
            }

            if (mat == null)
            {
                mat = new WHMat();
                if (mat != null)
                {
                    mat.MatCode = "none";
                }
            }

            MatGetResult result = LAF.Common.Util.BindHelper.CopyToModel <MatGetResult, WHMat>(mat);

            result.CheckResult = exists == true?"该条码已入库,无需再次操作":"";

            context.Response.Write(LAF.Common.Serialization.JsonConvertHelper.GetSerializes(result));
        }
Example #6
0
        protected void btAdd_Click(object sender, EventArgs e)
        {
            WHMatBLL bll = BLLFactory.CreateBLL <WHMatBLL>();

            bll.BuildMatIDCode(new WHMat {
                ID = this.hiMatID.Value, MatCode = this.MatCode.Text, SpecCode = this.MatSpec.SelectedValue
            }, int.Parse(this.Count.Text));

            this.BindData();
        }
Example #7
0
        protected void btDelete_Click(object sender, EventArgs e)
        {
            ArrayList     pkArray = null;
            WHMatBLL      bll     = null;
            List <string> msgList = new List <string>();

            try
            {
                bll = BLLFactory.CreateBLL <WHMatBLL>();

                pkArray = GvHelper.GetPKValueByChk(this.GvList, 0, "cbxSelect", 0);

                for (int i = 0; i < this.GvList.Rows.Count; i++)
                {
                    CheckBox cbxSelect = this.GvList.Rows[i].Cells[0].FindControl("cbxSelect") as CheckBox;

                    if (cbxSelect.Checked == false)
                    {
                        continue;
                    }

                    WHMat mat = new WHMat();
                    mat.ID      = this.GvList.DataKeys[i]["ID"].ToString();
                    mat.MatName = this.GvList.Rows[i].Cells[2].Text;

                    //判断是否已使用
                    bool r = bll.IsUse(mat);
                    if (r == true)
                    {
                        msgList.Add(mat.MatName);
                        continue;
                    }

                    //删除
                    bll.Delete(mat);
                }
                string msg = string.Join(",", msgList.ToArray());
                if (msg != "")
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "myjs", "MSI('提示','" + msg + "货品已使用,无法删除');", true);
                }

                this.BindData();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #8
0
        protected void btDelete_Click(object sender, EventArgs e)
        {
            ArrayList     pkArray = null;
            WHMatBLL      bll     = null;
            List <string> msgList = new List <string>();

            try
            {
                bll = BLLFactory.CreateBLL <WHMatBLL>();

                pkArray = GvHelper.GetPKValueByChk(this.GvList, 0, "cbxSelect", 0);

                for (int i = 0; i < this.GvList.Rows.Count; i++)
                {
                    CheckBox cbxSelect = this.GvList.Rows[i].Cells[0].FindControl("cbxSelect") as CheckBox;

                    if (cbxSelect.Checked == false)
                    {
                        continue;
                    }


                    //判断是否已使用
                    if (this.GvList.Rows[i].Cells[4].Text != "0")
                    {
                        msgList.Add(this.GvList.Rows[i].Cells[1].Text);
                        continue;
                    }

                    bll.DeleteMatIDCode(new MatIDCode {
                        IDCode = this.GvList.Rows[i].Cells[1].Text
                    });
                }
                string msg = string.Join(",", msgList.ToArray());
                if (msg != "")
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "myjs", "MSI('提示','" + msg + "条码已使用,无法删除');", true);
                }

                this.BindData();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #9
0
        private void BindData()
        {
            WHMatBLL bll       = null;
            DataPage dp        = new DataPage();
            WHMat    condition = new WHMat();

            try
            {
                bll = BLLFactory.CreateBLL <WHMatBLL>();
                condition.MatName = this.Description.Text;

                PagerHelper.InitPageControl(this.AspNetPager1, dp, true);
                dp = bll.GetList(condition, dp);

                List <WHMat> list = dp.Result as List <WHMat>;
                this.GvList.DataSource = list;
                this.GvList.DataBind();

                for (int i = 0; i < this.GvList.Rows.Count; i++)
                {
                    string click = string.Format("return edit('{0}');", this.GvList.DataKeys[i]["ID"].ToString());

                    (this.GvList.Rows[i].Cells[10].Controls[0] as WebControl).Attributes.Add("onclick", click);

                    LinkButton lbtBuildCode = this.GvList.Rows[i].Cells[11].FindControl("lbtBuildCode") as LinkButton;

                    lbtBuildCode.PostBackUrl = "BuildMatIDCode.aspx?matID=" + this.GvList.DataKeys[i]["ID"].ToString();

                    LinkButton lbtSetSpec = this.GvList.Rows[i].Cells[12].FindControl("lbtSetSpec") as LinkButton;

                    lbtSetSpec.PostBackUrl = "ManageMatSpec.aspx?matID=" + this.GvList.DataKeys[i]["ID"].ToString();
                }
                PagerHelper.SetPageControl(AspNetPager1, dp, true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }