private void DataGrid1_UpdateCommand(object source, DataGridCommandEventArgs e) { try { string newOutCount = ((TextBox)e.Item.Cells[10].Controls[0]).Text.Trim(); string OutSerial = e.Item.Cells[0].Text.Trim(); if (newOutCount == "") { this.Popup("请输入出库量"); return; } if (!this.JudgeIsNum(newOutCount, "出库量")) { return; } double dnewOutCount = Math.Round(double.Parse(newOutCount), 2); double doldOutCount = Math.Round(double.Parse(Session["oldOutCount"].ToString()), 2); double dLastCount = Math.Round(double.Parse(e.Item.Cells[9].Text.Trim()), 2); string strChangeCount = (dnewOutCount - doldOutCount).ToString(); string strNewCurCount = (dLastCount - dnewOutCount).ToString(); CMSMStruct.LoginStruct ls1 = (CMSMStruct.LoginStruct)Session["Login"]; Hashtable htpara = new Hashtable(); htpara.Add("strNewOutCount", newOutCount); htpara.Add("strNewCurCount", strNewCurCount); htpara.Add("strSerialOld", OutSerial); 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); CMSMStruct.MaterialSStruct msscur = msb1.GetMaterialInfo(e.Item.Cells[1].Text.Trim(), e.Item.Cells[2].Text.Trim()); if ((dnewOutCount - doldOutCount) > 0 && msscur.dCurCount < (dnewOutCount - doldOutCount)) { this.Popup("当前数量不足!"); return; } if (msb1.MaterialOutMod(htpara)) { this.Popup("原材料出库修正成功!"); this.DBbind(); return; } else { this.SetErrorMsgPageBydir("原材料出库修正失败!"); return; } } catch (Exception er) { this.clog.WriteLine(er); this.SetErrorMsgPageBydir("查询错误,请重试!"); return; } }