Пример #1
0
        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);
            }
        }
Пример #2
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);
            }
        }