private void Datagrid2_UpdateCommand(object source, DataGridCommandEventArgs e) { string strRdCode = this.ddlRdCode.SelectedValue; if (strRdCode == "") { this.SetErrorMsgPageBydir("调拨单据信息不全,请重试!"); return; } string stroutcount = "0"; string strLostcount = "0"; string strrealcount = "0"; decimal dlostcount = 0; Entity.RdRecordDetail rrd = new RdRecordDetail(); if (strRdCode == "RD006") { stroutcount = e.Item.Cells[5].Text.Trim(); strLostcount = ((TextBox)e.Item.Cells[6].Controls[0]).Text.Trim(); strrealcount = ((TextBox)e.Item.Cells[7].Controls[0]).Text.Trim(); if (strLostcount == "" || !this.JudgeIsNum(strLostcount)) { this.Popup("损耗数量不能为空且必须是数字!"); return; } if (strrealcount == "" || !this.JudgeIsNum(strrealcount)) { this.Popup("入库数量不能为空且必须是数字!"); return; } string strRate = Helper.Query("select cniChangRate from tbComputationUnit where cnvcComunitCode=(select cnvcSTComunitCode from tbInventory where cnvcInvCode='" + e.Item.Cells[1].Text.Trim() + "')").Rows[0]["cniChangRate"].ToString(); decimal doutcount = Math.Round(decimal.Parse(stroutcount) * decimal.Parse(strRate), 2); dlostcount = Math.Round(decimal.Parse(strLostcount) * decimal.Parse(strRate), 2); decimal drealcount = Math.Round(decimal.Parse(strrealcount) * decimal.Parse(strRate), 2); if (doutcount != drealcount + dlostcount) { this.Popup("损耗数量+入库数量不等于出库数量"); return; } rrd.cnnRdID = int.Parse(e.Item.Cells[0].Text.Trim()); rrd.cnvcInvCode = e.Item.Cells[1].Text.Trim(); rrd.cnnQuantity = Math.Round(decimal.Parse(strrealcount), 2); if (rrd.cnnRdID.ToString() == "" || rrd.cnnRdID == 0) { this.Popup("调拨单标识不正确!"); return; } } Entity.OperLog ol = new AMSApp.zhenghua.Entity.OperLog(); ol.cnvcOperType = "修改调拨单子表"; ol.cnvcOperID = this.oper.strLoginID; ol.cnvcDeptID = this.oper.strDeptID; StorageFacade sto = new StorageFacade(); int ret = sto.UpdateRdRecordMoveDetail(strRdCode, ol, rrd, strLostcount); if (ret > 0) { this.Popup("修改调拨单子表明细成功!"); this.DBBind(); } else { this.Popup("修改调拨单子表明细失败!"); } }