Example #1
0
        private void DataGrid1_UpdateCommand(object source, DataGridCommandEventArgs e)
        {
            try
            {
                string newEnterCount = ((TextBox)e.Item.Cells[10].Controls[0]).Text.Trim();
                string EnterSerial   = e.Item.Cells[0].Text.Trim();
                if (newEnterCount == "")
                {
                    this.Popup("请输入入库量");
                    return;
                }
                if (!this.JudgeIsNum(newEnterCount, "入库量"))
                {
                    return;
                }

                double dnewEnterCount = Math.Round(double.Parse(newEnterCount), 2);
                double doldEnterCount = Math.Round(double.Parse(Session["oldEnterCount"].ToString()), 2);
                double dLastCount     = Math.Round(double.Parse(e.Item.Cells[9].Text.Trim()), 2);
                string strChangeCount = (doldEnterCount - dnewEnterCount).ToString();
                string strNewCurCount = (dLastCount + dnewEnterCount).ToString();

                CMSMStruct.LoginStruct ls1 = (CMSMStruct.LoginStruct)Session["Login"];
                Hashtable htpara           = new Hashtable();
                htpara.Add("strNewEnterCount", newEnterCount);
                htpara.Add("strNewCurCount", strNewCurCount);
                htpara.Add("strSerialOld", EnterSerial);
                htpara.Add("strOperDate", DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString());
                htpara.Add("strOperName", ls1.strOperName);
                htpara.Add("strDeptID", ls1.strNewDeptID);
                htpara.Add("strChangeCount", strChangeCount);
                htpara.Add("strMaterialCode", e.Item.Cells[2].Text.Trim());
                htpara.Add("strBatchNo", e.Item.Cells[1].Text.Trim());

                Hashtable htapp   = (Hashtable)Application["appconf"];
                string    strcons = (string)htapp["cons"];
                msb1 = new MaterialSBusi(strcons);

                if (msb1.MaterialEnterMod(htpara))
                {
                    this.Popup("原材料入库修正成功!");
                    this.DBbind();
                    return;
                }
                else
                {
                    this.SetErrorMsgPageBydir("原材料入库修正失败!");
                    return;
                }
            }
            catch (Exception er)
            {
                this.clog.WriteLine(er);
                this.SetErrorMsgPageBydir("查询错误,请重试!");
                return;
            }
        }