コード例 #1
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);
            }
        }
コード例 #2
0
        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);
            }
        }