Example #1
0
        private void DataGrid1_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            try
            {
                Dept dept = new Dept();
                dept.cnvcDeptID = e.Item.Cells[0].Text;
                string strPriority = ((TextBox)e.Item.Cells[5].Controls[0]).Text;
                if (!this.JudgeIsNum(strPriority, "优先级"))
                {
                    return;
                }
                dept.cnnPriority = Convert.ToInt32(strPriority);
                OperLog operLog = new OperLog();
                operLog.cnvcOperID   = oper.strLoginID;
                operLog.cnvcDeptID   = oper.strDeptID;
                operLog.cnvcOperType = "调整部门优先级";

                GoodsFacade gf = new GoodsFacade();
                gf.UpdatePriority(dept, operLog);
                Popup("修改成功");
                this.DataGrid1.EditItemIndex = -1;
                BindGrid();
            }
            catch (Exception ex)
            {
                Popup(ex.Message);
            }
        }
        protected void btnCheck_Click(object sender, System.EventArgs e)
        {
            try
            {
                if (Session["tbProduceDetail"] == null)
                {
                    throw new Exception("请首先使用【计划查询】按钮,查询计划情况");
                }
                DataTable   dtProduce = (DataTable)Session["tbProduceDetail"];
                GoodsFacade gf        = new GoodsFacade();
                OperLog     operLog   = new OperLog();
                operLog.cnvcOperID   = oper.strLoginID;
                operLog.cnvcDeptID   = oper.strDeptID;
                operLog.cnvcOperType = "盘点入库";
                gf.ProduceCheck(dtProduce, operLog, ddlProduceDept.SelectedValue, txtProduceSerialNo.Text);
                Popup("盘点完成");
                //this.btnCheck.Enabled = false;
                this.DataGrid1.DataSource = null;
                this.DataGrid1.DataBind();
                Session["tbProduceDetail"] = null;

                this.bntEdit.Visible        = false;
                this.btnEndEdit.Visible     = false;
                this.btnEditConfirm.Visible = false;
            }
            catch (Exception ex)
            {
                Popup(ex.Message);
            }
        }
        private void btnClearDivideGoods_Click(object sender, System.EventArgs e)
        {
            //清除分货数据
            try
            {
                //string strwhhouse = this.ddlWarehouse.SelectedValue;
                ProduceLog pLog = new ProduceLog();
                pLog.cnnProduceSerialNo = decimal.Parse(txtProduceSerialNo.Text);
                pLog.cnvcOperID         = oper.strLoginID;

                OperLog operLog = new OperLog();
                operLog.cnvcOperID   = oper.strLoginID;
                operLog.cnvcDeptID   = oper.strDeptID;
                operLog.cnvcOperType = "清除分货数据";

                GoodsFacade goods = new GoodsFacade();
                goods.DeleteAssignLog(pLog, operLog);
                BindAssignLog(txtProduceSerialNo.Text);
                Popup("清除分货数据成功");
                this.btnQuery_Click(null, null);
                //this.btnDivideGoods.Enabled = false;
            }
            catch (Exception ex)
            {
                Popup(ex.Message);
            }
        }
        protected void btnEditConfirm_Click(object sender, System.EventArgs e)
        {
            try
            {
                //				if(txtProduceState.Text == "4")
                //				{
                //					throw new Exception("此订单已运输,不能修改分货量");
                //				}
                ArrayList alDetail = new ArrayList();
                foreach (DataGridItem dgi in this.DataGrid2.Items)
                {
                    string strCount = ((TextBox)dgi.Cells[11].Controls[1]).Text;
                    if (this.JudgeIsNull(strCount))
                    {
                        throw new Exception("请输入盘点量");
                    }
                    if (!this.JudgeIsNum(strCount))
                    {
                        throw new Exception("请输入数字");
                    }
                    AssignDetail assign = new AssignDetail();
                    assign.cnnAssignSerialNo  = Convert.ToDecimal(dgi.Cells[0].Text);
                    assign.cnnProduceSerialNo = Convert.ToDecimal(txtProduceSerialNo.Text);
                    assign.cnnOrderSerialNo   = Convert.ToDecimal(dgi.Cells[3].Text);
                    assign.cnvcProductCode    = dgi.Cells[6].Text;
                    assign.cnnCount           = Convert.ToDecimal(((TextBox)dgi.Cells[11].Controls[1]).Text);
                    string  strOrderType = dgi.Cells[13].Text;
                    decimal dOrderCount  = Convert.ToDecimal(dgi.Cells[10].Text);
                    if (strOrderType == "WDO")
                    {
                        if (dOrderCount > assign.cnnCount)
                        {
                            throw new Exception("外订定单分货量不能少于订单量");
                        }
                    }
                    alDetail.Add(assign);
                }

                OperLog operLog = new OperLog();
                operLog.cnvcOperID   = oper.strLoginID;
                operLog.cnvcDeptID   = oper.strDeptID;
                operLog.cnvcOperType = "调整分货量";

                GoodsFacade gf = new GoodsFacade();
                gf.BatchUpdateAssignLog(alDetail, operLog, txtProduceSerialNo.Text);

                this.Popup("修改成功");
                //this.DataGrid2.EditItemIndex = -1;
                BindAssignDetail();

                this.btnEdit.Visible        = true;
                this.btnEndEdit.Visible     = false;
                this.btnEditConfirm.Visible = false;
            }
            catch (Exception ex)
            {
                Popup(ex.Message);
            }
        }
Example #5
0
        private void DataGrid1_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            try
            {
                string strCheckCount = ((TextBox)e.Item.Cells[6].Controls[0]).Text;
                if (this.JudgeIsNull(strCheckCount))
                {
                    throw new Exception("请输入盘点量");
                }
                if (!this.JudgeIsNum(strCheckCount))
                {
                    throw new Exception("请输入数字");
                }
                string  strProduceCount = e.Item.Cells[5].Text;
                decimal dProduceCount   = Convert.ToDecimal(strProduceCount);
                decimal dCheckCount     = Convert.ToDecimal(strCheckCount);
                if (dCheckCount > dProduceCount)
                {
                    throw new Exception("盘点量过大,请手工调整");
                }
                if (Session["tbProduceDetail"] == null)
                {
                    ProduceCheckLog check = new ProduceCheckLog();
                    check.cnvcOperID         = oper.strLoginID;
                    check.cnnProduceSerialNo = Convert.ToDecimal(e.Item.Cells[0].Text);
                    check.cnvcInvCode        = e.Item.Cells[1].Text;
                    check.cnnCheckCount      = Convert.ToDecimal(strCheckCount);
                    GoodsFacade gf = new GoodsFacade();

                    OperLog operLog = new OperLog();
                    operLog.cnvcOperID   = oper.strLoginID;
                    operLog.cnvcDeptID   = oper.strDeptID;
                    operLog.cnvcOperType = "调整盘点量";

                    gf.UpdateProduceCheck(check, operLog);
                }
                else
                {
                    string    strCode   = e.Item.Cells[1].Text;
                    DataTable dtProduce = (DataTable)Session["tbProduceDetail"];
                    DataRow[] drProduct = dtProduce.Select("cnvcInvCode='" + strCode + "'");
                    drProduct[0]["cnnCheckCount"] = strCheckCount;
                    Session["tbProduceDetail"]    = dtProduce;
                }

                this.DataGrid1.EditItemIndex = -1;
                this.BindGrid();
                this.Popup("修改成功");
            }
            catch (Exception ex)
            {
                Popup(ex.Message);
            }
        }
        private void DataGrid2_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            try
            {
//				if(txtProduceState.Text == "4")
//				{
//					throw new Exception("此订单已运输,不能修改分货量");
//				}
                string strCount = ((TextBox)e.Item.Cells[11].Controls[0]).Text;
                if (this.JudgeIsNull(strCount))
                {
                    throw new Exception("请输入盘点量");
                }
                if (!this.JudgeIsNum(strCount))
                {
                    throw new Exception("请输入数字");
                }
                AssignDetail assign = new AssignDetail();
                assign.cnnAssignSerialNo  = Convert.ToDecimal(e.Item.Cells[0].Text);
                assign.cnnProduceSerialNo = Convert.ToDecimal(txtProduceSerialNo.Text);
                assign.cnnOrderSerialNo   = Convert.ToDecimal(e.Item.Cells[3].Text);
                assign.cnvcProductCode    = e.Item.Cells[6].Text;
                assign.cnnCount           = Convert.ToDecimal(((TextBox)e.Item.Cells[11].Controls[0]).Text);
                string  strOrderType = e.Item.Cells[14].Text;
                decimal dOrderCount  = Convert.ToDecimal(e.Item.Cells[10].Text);
                if (strOrderType == "WDO")
                {
                    if (dOrderCount > assign.cnnCount)
                    {
                        throw new Exception("外订定单分货量不能少于订单量");
                    }
                }
                OperLog operLog = new OperLog();
                operLog.cnvcOperID   = oper.strLoginID;
                operLog.cnvcDeptID   = oper.strDeptID;
                operLog.cnvcOperType = "调整分货量";

                GoodsFacade gf = new GoodsFacade();
                gf.UpdateAssignLog(assign, operLog);
                this.Popup("修改成功");
                this.DataGrid2.EditItemIndex = -1;
                BindAssignDetail();
            }
            catch (Exception ex)
            {
                Popup(ex.Message);
            }
        }
        private void Button1_Click(object sender, System.EventArgs e)
        {
            //分货出库
            string strWarehouse       = this.ddlWarehouse.SelectedValue;
            string strProduceSerialNo = this.txtProduceSerialNo.Text;

            try
            {
                OperLog operLog = new OperLog();
                operLog.cnvcOperID   = oper.strLoginID;
                operLog.cnvcDeptID   = oper.strDeptID;
                operLog.cnvcOperType = "分货出库";

                GoodsFacade gf = new GoodsFacade();
                gf.AssignOut(strProduceSerialNo, operLog, strWarehouse);
                this.CheckBox1.Checked = true;
                this.Popup("分货出库成功");
            }
            catch (Exception ex)
            {
                Popup(ex.Message);
            }
        }
        protected void btnDivideGoods_Click(object sender, System.EventArgs e)
        {
            try
            {
                ProduceLog pLog = new ProduceLog();
                pLog.cnnProduceSerialNo = decimal.Parse(txtProduceSerialNo.Text);
                pLog.cnvcOperID         = oper.strLoginID;

                OperLog operLog = new OperLog();
                operLog.cnvcOperID   = oper.strLoginID;
                operLog.cnvcDeptID   = oper.strDeptID;
                operLog.cnvcOperType = "分货";

                GoodsFacade goods = new GoodsFacade();
                goods.AddAssignLog(pLog, operLog);
                BindAssignLog(txtProduceSerialNo.Text);
                Popup("分货成功");
                //this.btnDivideGoods.Enabled = false;
            }
            catch (Exception ex)
            {
                Popup(ex.Message);
            }
        }
        protected void btnEditConfirm_Click(object sender, System.EventArgs e)
        {
            try
            {
                ArrayList alCheck = new ArrayList();
                foreach (DataGridItem dgi in this.DataGrid1.Items)
                {
                    string strCheckCount = ((TextBox)dgi.Cells[9].Controls[1]).Text;
                    if (this.JudgeIsNull(strCheckCount))
                    {
                        throw new Exception("请输入盘点量");
                    }
                    if (!this.JudgeIsNum(strCheckCount))
                    {
                        throw new Exception("请输入数字");
                    }
                    string strProduceCount = dgi.Cells[7].Text;
                    string strAssignCount  = dgi.Cells[8].Text;

                    decimal dProduceCount = Convert.ToDecimal(strProduceCount);
                    decimal dCheckCount   = Convert.ToDecimal(strCheckCount);
                    decimal dAssignCount  = Convert.ToDecimal(strAssignCount);
                    if (dCheckCount > dProduceCount - dAssignCount)
                    {
                        throw new Exception("盘点量过大,无法自动分货,请手工调整分货量");
                    }
                    if (Session["tbProduceDetail"] == null)
                    {
                        ProduceCheckLog check = new ProduceCheckLog();
                        check.cnvcOperID         = oper.strLoginID;
                        check.cnnProduceSerialNo = Convert.ToDecimal(dgi.Cells[0].Text);
                        check.cnvcCode           = dgi.Cells[1].Text;
                        check.cnnCheckCount      = Convert.ToDecimal(strCheckCount);
                        alCheck.Add(check);
                    }
                    else
                    {
                        string    strCode   = dgi.Cells[1].Text;
                        DataTable dtProduce = (DataTable)Session["tbProduceDetail"];
                        DataRow[] drProduct = dtProduce.Select("cnvcCode='" + strCode + "'");
                        drProduct[0]["cnnCheckCount"] = strCheckCount;
                        Session["tbProduceDetail"]    = dtProduce;
                    }
                }

                if (alCheck.Count > 0)
                {
                    GoodsFacade gf = new GoodsFacade();

                    OperLog operLog = new OperLog();
                    operLog.cnvcOperID   = oper.strLoginID;
                    operLog.cnvcDeptID   = oper.strDeptID;
                    operLog.cnvcOperType = "调整盘点量";

                    gf.BatchUpdateProduceCheck(alCheck, this.txtProduceSerialNo.Text, operLog);
                }

                //this.DataGrid1.EditItemIndex = -1;
                this.BindGrid();
                this.Popup("修改成功");
            }
            catch (Exception ex)
            {
                Popup(ex.Message);
            }
        }
        private void DataGrid1_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
//			AssignDetailLog detailLog = new AssignDetailLog();
//			detailLog.cnnAssignSerialNo = Convert.ToDecimal(txtProduceSerialNo.Text);
//			detailLog.cnnOrderSerialNo = Convert.ToDecimal(e.Item.Cells[0].Text);
//			detailLog.cnvcProductCode = e.Item.Cells[3].Text;
//			detailLog.cnnCount = Convert.ToDecimal(((TextBox) e.Item.Cells[8].Controls[0]).Text);
//			detailLog.cnvcOperID = oper.strLoginID;
//
//
//			detailLog.cnnPrice = Convert.ToDecimal(e.Item.Cells[6].Text);
//			detailLog.cnvcUnit = e.Item.Cells[5].Text;
//			detailLog.cnnOrderCount = Convert.ToDecimal(e.Item.Cells[7].Text);
//			detailLog.cnnSum = Math.Round(detailLog.cnnPrice*detailLog.cnnCount, 2);//Convert.ToDecimal(e.Item.Cells[9].Text);
//
//			GoodsFacade gf = new GoodsFacade();
//			gf.UpdateAssignLog(detailLog);
//

            try
            {
//				if(txtProduceState.Text == "4")
//					throw new Exception("已分货,无法调整盘点量");
                string strCheckCount = ((TextBox)e.Item.Cells[9].Controls[0]).Text;
                if (this.JudgeIsNull(strCheckCount))
                {
                    throw new Exception("请输入盘点量");
                }
                if (!this.JudgeIsNum(strCheckCount))
                {
                    throw new Exception("请输入数字");
                }
                string strProduceCount = e.Item.Cells[7].Text;
                string strAssignCount  = e.Item.Cells[8].Text;

                decimal dProduceCount = Convert.ToDecimal(strProduceCount);
                decimal dCheckCount   = Convert.ToDecimal(strCheckCount);
                decimal dAssignCount  = Convert.ToDecimal(strAssignCount);
                if (dCheckCount > dProduceCount - dAssignCount)
                {
                    throw new Exception("盘点量过大,无法自动分货,请手工调整分货量");
                }
                if (Session["tbProduceDetail"] == null)
                {
                    ProduceCheckLog check = new ProduceCheckLog();
                    check.cnvcOperID         = oper.strLoginID;
                    check.cnnProduceSerialNo = Convert.ToDecimal(e.Item.Cells[0].Text);
                    check.cnvcCode           = e.Item.Cells[1].Text;
                    check.cnnCheckCount      = Convert.ToDecimal(strCheckCount);
                    GoodsFacade gf = new GoodsFacade();

                    OperLog operLog = new OperLog();
                    operLog.cnvcOperID   = oper.strLoginID;
                    operLog.cnvcDeptID   = oper.strDeptID;
                    operLog.cnvcOperType = "调整盘点量";

                    gf.UpdateProduceCheck(check, operLog);
                }
                else
                {
//					if(Session["tbProduceDetail"] == null)
//					{
//						Popup("数据异常,请查询");
//						return;
//					}
                    string strCode = e.Item.Cells[1].Text;
                    //string strCheckCount = ((TextBox) e.Item.Cells[9].Controls[0]).Text;
                    DataTable dtProduce = (DataTable)Session["tbProduceDetail"];
                    DataRow[] drProduct = dtProduce.Select("cnvcCode='" + strCode + "'");
                    drProduct[0]["cnnCheckCount"] = strCheckCount;
                    Session["tbProduceDetail"]    = dtProduce;
                }

                this.DataGrid1.EditItemIndex = -1;
                this.BindGrid();
                this.Popup("修改成功");
            }
            catch (Exception ex)
            {
                Popup(ex.Message);
            }
        }
Example #11
0
        private void btnCheck_Click(object sender, System.EventArgs e)
        {
            try
            {
                if (Session["tbProduceDetail"] == null)
                {
                    //throw new Exception("请首先使用【盘点清单】按钮,查询盘点清单情况");
                    QueryProduceDetail();
                }
                DataTable dtProduce = (DataTable)Session["tbProduceDetail"];

                foreach (DataGridItem dgi in this.DataGrid1.Items)
                {
                    string strCheckCount = ((TextBox)dgi.Cells[6].Controls[1]).Text;
                    if (this.JudgeIsNull(strCheckCount))
                    {
                        throw new Exception("请输入盘点量");
                    }
                    if (!this.JudgeIsNum(strCheckCount))
                    {
                        throw new Exception("请输入数字");
                    }
                    string  strProduceCount = dgi.Cells[5].Text;
                    decimal dProduceCount   = Convert.ToDecimal(strProduceCount);
                    decimal dCheckCount     = Convert.ToDecimal(strCheckCount);
                    if (dCheckCount > dProduceCount)
                    {
                        throw new Exception("盘点量过大,请手工调整");
                    }

                    DropDownList ddlTeam     = (DropDownList)dgi.Cells[7].FindControl("ddlTeamText");
                    DropDownList ddlProducer = (DropDownList)dgi.Cells[8].FindControl("ddlProducerText");
                    if (ddlTeam.Items.Count == 0)
                    {
                        throw new Exception("请录入生产组");
                    }
                    if (ddlProducer.Items.Count == 0)
                    {
                        throw new Exception("请录入生产员");
                    }

//					if(Session["tbProduceDetail"] == null)
//					{
//						ProduceCheckLog check = new ProduceCheckLog();
//						check.cnvcOperID = oper.strLoginID;
//						check.cnnProduceSerialNo = Convert.ToDecimal(dgi.Cells[0].Text);
//						check.cnvcInvCode = dgi.Cells[1].Text;
//						check.cnnCheckCount = Convert.ToDecimal(strCheckCount);
//						check.cnnTeamID = Convert.ToInt32(ddlTeam.SelectedValue);
//						check.cnnProducerID = Convert.ToInt32(ddlProducer.SelectedValue);
//						GoodsFacade gf = new GoodsFacade();
//
//						OperLog operLog = new OperLog();
//						operLog.cnvcOperID = oper.strLoginID;
//						operLog.cnvcDeptID = oper.strDeptID;
//						operLog.cnvcOperType = "调整盘点量";
//
//						gf.UpdateProduceCheck(check,operLog);
//					}
//					else
//					{
                    string strCode = dgi.Cells[1].Text;
//						DataTable dtProduce = (DataTable) Session["tbProduceDetail"];
                    DataRow[] drProduct = dtProduce.Select("cnvcInvCode='" + strCode + "'");
                    drProduct[0]["cnnCheckCount"] = strCheckCount;
                    drProduct[0]["cnnTeamID"]     = ddlTeam.SelectedValue;
                    drProduct[0]["cnnProducerID"] = ddlProducer.SelectedValue;

                    //}

                    //this.DataGrid1.EditItemIndex = -1;
                }


                GoodsFacade gf      = new GoodsFacade();
                OperLog     operLog = new OperLog();
                operLog.cnvcOperID   = oper.strLoginID;
                operLog.cnvcDeptID   = oper.strDeptID;
                operLog.cnvcOperType = "生产盘点";
                gf.ProduceCheck(dtProduce, operLog, ddlProduceDept.SelectedValue, txtProduceSerialNo.Text);
                Session["tbProduceDetail"] = dtProduce;
                this.CheckBox1.Checked     = true;
                Popup("盘点完成");
                //this.btnCheck.Enabled = false;
                //this.DataGrid1.DataSource = null;
                //this.DataGrid1.DataBind();
                //Session["tbProduceDetail"] = null;
                btnQuery_Click(null, null);
            }
            catch (Exception ex)
            {
                Popup(ex.Message);
            }
        }