protected void btnCheck_Click(object sender, EventArgs e) { string userName = ToolCode.Tool.GetUser().UserName; string inventoryNumber = ToolManager.GetQueryString("InventoryNumber"); string sql = string.Format(@" select Auditor from StockInventoryLog where InventoryNumber ='{0}' ", inventoryNumber); string tempstr = SqlHelper.GetScalar(sql); if (!string.IsNullOrEmpty(tempstr)) { lbMsg.Text = string.Format("审核失败!原因:该盘点单已由" + tempstr + "审核,请勿重复审核!"); return; } string result = StoreroomToolManager.CheckStockInventoryLog(inventoryNumber, userName); if (result.Equals("1")) { Response.Redirect("StockInventoryLogList.aspx"); } else { lbMsg.Text = string.Format("审核失败!原因:" + result); } }
/// <summary> /// 原材料生产出库审核 /// </summary> /// <param name="auditor"></param> /// <param name="warehouseNumber"></param> /// <returns></returns> public static string SCCKAuditor(string auditor, string warehouseNumber) { string error = string.Empty; List <string> sqls = new List <string>(); // string sql = string.Format(@" update MaterialStock set StockQty =vmq.StockQty-mwld.Qty from MaterialWarehouseLogDetail mwld //inner join MaterialStock vmq on mwld.MaterialNumber =vmq.MaterialNumber //where mwld.WarehouseNumber='{0}' ", warehouseNumber); // sqls.Add(sql); //写入欠料明细 // string sql = string.Format(@" //insert into T_LessMaterialBreakdown(WarehouseNumber ,DocumentNumber ,MaterialNumber ,RowNumber ,LeadTime ,CustomerMaterialNumber //,LibraryQty,StockQty ,LessMaterialQty ,CreateTime ,IsLessMaterial ) //select mwld.WarehouseNumber,mwld.DocumentNumber ,mwld. MaterialNumber,mwld.RowNumber , //mwld.LeadTime ,mwld.CustomerMaterialNumber,mwld. Qty,vmq.StockQty, //case when vmq.StockQty<0 then mwld.Qty else //vmq.StockQty -mwld.Qty end,'{1}','未还料' from MaterialWarehouseLogDetail mwld //inner join MaterialStock vmq on mwld.MaterialNumber =vmq.MaterialNumber //where mwld.WarehouseNumber='{0}' //and vmq.StockQty-mwld.Qty <0", warehouseNumber, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); // sqls.Add(sql); string sql = string.Format(@"insert into T_LessMaterialBreakdown(WarehouseNumber ,DocumentNumber ,MaterialNumber ,RowNumber ,LeadTime ,CustomerMaterialNumber ,LibraryQty,StockQty ,LessMaterialQty ,CreateTime ,IsLessMaterial ) select '',mwld.DocumentNumber ,mwld. MaterialNumber,'', '' ,mwld.CustomerMaterialNumber,mwld. Qty,vmq.StockQty, case when vmq.StockQty<0 then 0-mwld.Qty else vmq.StockQty -mwld.Qty end,'{1}','未还料' from ( select DocumentNumber,MaterialNumber,CustomerMaterialNumber,SUM(Qty) Qty from MaterialWarehouseLogDetail where WarehouseNumber ='{0}' group by DocumentNumber,MaterialNumber,CustomerMaterialNumber) mwld inner join MaterialStock vmq on mwld.MaterialNumber =vmq.MaterialNumber where vmq.StockQty-mwld.Qty <0 ", warehouseNumber, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); sqls.Add(sql); //更新库存 sql = string.Format(@" update MaterialStock set StockQty = case when a.ChangeDirection='入库' then StockQty +a.Qty else StockQty-a.Qty end ,UpdateTime =CONVERT (varchar(100),GETDATE(),120) from ( select mwld.MaterialNumber,mwl.ChangeDirection,sum(mwld.Qty) as Qty from MaterialWarehouseLogDetail mwld inner join MarerialWarehouseLog mwl on mwld.WarehouseNumber =mwl.WarehouseNumber where mwl.WarehouseNumber='{0}' and mwld.Qty>0 group by mwld.MaterialNumber,mwl.ChangeDirection) a inner join MaterialStock ms on ms.MaterialNumber=a.MaterialNumber where ms.WarehouseName ='ycl' ", warehouseNumber); sqls.Add(sql); sql = string.Format(@" update MarerialWarehouseLog set Auditor='{0}' , CheckTime='{1}' where WarehouseNumber ='{2}'", auditor, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), warehouseNumber); sqls.Add(sql); //更新瞬时库存数量 sqls.Add(StoreroomToolManager.GetUpDateInventoryQtySql(warehouseNumber)); //写入流水账 sqls.Add(StoreroomToolManager.WriteMateriLSZ(warehouseNumber, auditor)); return(SqlHelper.BatchExecuteSql(sqls, ref error) ? "1" : error); }
protected void btnSubmit_Click(object sender, EventArgs e) { string warehouseNumber = ToolManager.GetQueryString("WarehouseNumber"); string cgOrderNumber = txtCGorderNumber.Text.Trim(); string supplMareitNumber = txtSuppliMateriNumber.Text.Trim(); string qty = txtQty.Text; string remark = txtRemark.Text; if (string.IsNullOrEmpty(cgOrderNumber) || string.IsNullOrEmpty(supplMareitNumber) || string.IsNullOrEmpty(qty)) { lbSubmit.Text = "信息填写不完整"; return; } string error = string.Empty; bool result = StoreroomToolManager.AddCCTLCKDetail(warehouseNumber, cgOrderNumber, supplMareitNumber, qty, remark, ref error); if (result) { Response.Write(ToolManager.GetClosePageJS()); Response.End(); return; } else { lbSubmit.Text = "添加失败!原因:" + error; } }
protected void btnSubmit_Click(object sender, EventArgs e) { string error = string.Empty; string warehouseNumber = ToolManager.GetQueryString("WarehouseNumber"); lbMsg.Text = StoreroomToolManager.AddYPCK(warehouseNumber, drpOrderNumber.SelectedValue, ref error) ? "添加成功" : "添加失败!原因:" + error; }
public void ProcessRequest(HttpContext context) { string result = string.Empty; string sql = string.Empty; //取原材料或者产品 if (ToolManager.CheckQueryString("IsMaterial")) { //原材料 if (ToolManager.GetQueryString("IsMaterial").Equals("true")) { sql = string.Format(@" select top 20 MaterialNumber,MaterialName from MarerialInfoTable "); sql += string.Format(@" where MaterialNumber like '%{0}%' or MaterialNumber like'%{0}' or MaterialNumber like '{0}%' or MaterialName like '%{0}%' or MaterialName like'%{0}' or MaterialName like '{0}%' order by MaterialNumber asc", ToolManager.GetQueryString("MaterialNumber")); DataTable dt = SqlHelper.GetTable(sql); if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { result += string.Format(" <tr><td>{0}</td><td>{1}</td></tr>", dr["MaterialName"], dr["MaterialNumber"]); } } } else//产品 { } } //取库存数量 if (ToolManager.CheckQueryString("TableName")) { string tableName = ToolManager.GetQueryString("TableName"); string warehouseNumber = ToolManager.GetQueryString("WarehouseNumber"); //出入库编号 string supplierMaterialNumberStr = string.Empty; //供应商物料编号字符串 string customerMaterialNumberStr = string.Empty; //客户物料编号字符串 string qty = string.Empty; //库存数量 //原材料 if (ToolManager.GetQueryString("IsMaterialForQty").Equals("true")) { string materialNumber = ToolManager.GetQueryString("MaterialNumber"); //原材料编号 sql = string.Format(@"select SupplierMaterialNumber from MaterialSupplierProperty where MaterialNumber='{0}'", materialNumber); supplierMaterialNumberStr = ControlBindManager.GetOption(sql, "SupplierMaterialNumber", "SupplierMaterialNumber"); sql = string.Format(@" select CustomerMaterialNumber from MaterialCustomerProperty where MaterialNumber='{0}'", materialNumber); customerMaterialNumberStr = ControlBindManager.GetOption(sql, "CustomerMaterialNumber", "CustomerMaterialNumber"); qty = StoreroomToolManager.GetinventoryQty(materialNumber, "", "", warehouseNumber, tableName, ToolEnum.ProductType.Marerial); result = supplierMaterialNumberStr + "^" + customerMaterialNumberStr + "^" + qty; } else //产品 { } } context.Response.ContentType = "text/plain"; context.Response.Write(result); }
protected void btnSubmit_Click(object sender, EventArgs e) { string error = string.Empty; string warehouseNumber = ToolManager.GetQueryString("WarehouseNumber"); lbMsg.Text = StoreroomToolManager.AddYPRK(warehouseNumber, txtSuppilMateriNumber.Text.Trim() , txtQty.Text.Trim(), txtRemark.Text, ref error) ? "添加成功" : "添加失败!原因:" + error; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string error = string.Empty; //删除 if (ToolManager.CheckQueryString("ids")) { string ids = ToolManager.GetQueryString("ids"); string temp = StoreroomToolManager.MarerialWarehouseLogListDelete(ids); bool restult = temp == "1" ? true : false; if (restult) { Tool.WriteLog(Tool.LogType.Operating, "删除原材料出入库信息" + ToolManager.ReplaceSingleQuotesToBlank(ids), "删除成功"); Response.Write(temp); Response.End(); return; } else { Tool.WriteLog(Tool.LogType.Operating, "删除原材料出入库信息" + ToolManager.ReplaceSingleQuotesToBlank(ids), "删除失败!原因" + temp); Response.Write(temp); Response.End(); return; } } //查询 if (ToolManager.CheckQueryString("pageIndex")) { GetPage("AddOrEditMarerialWarehouseLog.aspx", "btnSearch", "Transfer", "260", "600"); } //审核 if (ToolManager.CheckQueryString("check")) { string check = ToolManager.GetQueryString("check"); string temp = MarerialWarehouseLogListManager.AuditorMarerialWarehouseLog(ToolCode.Tool.GetUser().UserNumber, check); bool result = temp == "1" ? true : false; if (result) { Tool.WriteLog(Tool.LogType.Operating, "审核原材料出入库信息" + ToolManager.ReplaceSingleQuotesToBlank(check), "审核成功"); Response.Write(temp); Response.End(); return; } else { Tool.WriteLog(Tool.LogType.Operating, "审核原材料出入库信息" + ToolManager.ReplaceSingleQuotesToBlank(check), "审核失败!原因" + temp); Response.Write(temp); Response.End(); return; } } divAdd.Visible = ToolCode.Tool.GetUserMenuFunc("L0404", "Add"); divDelete.Visible = ToolCode.Tool.GetUserMenuFunc("L0404", "Delete"); //divCheck.Visible = ToolCode.Tool.GetUserMenuFunc("L0404", "Audit"); } }
private string checkProductHouse(string check) { string auditor = ToolCode.Tool.GetUser().UserNumber; //string CheckTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); //string error = string.Empty; //string sql = string.Format(@" update ProductWarehouseLog set Auditor='{0}' , CheckTime='{1}' where WarehouseNumber in ({2})", // Auditor, CheckTime, check); //return SqlHelper.ExecuteSql(sql, ref error) == true ? "1" : error; return(StoreroomToolManager.AutiorProductWarehouseLog(check, auditor)); }
public void ProcessRequest(HttpContext context) { string result = string.Empty; if (ToolManager.GetQueryString("IsQueryOdersNumber").Equals("true")) //查询订单的ajax请求 { string sql = string.Format(@" select distinct top 10 InventoryNumber from StockInventoryLog where InventoryNumber like '%{0}%' or InventoryNumber like'%{0}' or InventoryNumber like '{0}%' order by InventoryNumber desc ", ToolManager.GetQueryString("OdersNumber")); DataTable dt = SqlHelper.GetTable(sql); if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { result += string.Format(" <tr><td>{0}</td></tr>", dr["InventoryNumber"]); } } } else if (ToolManager.GetQueryString("IsQueryOdersNumber").Equals("false")) { string odersNumber = ToolManager.GetQueryString("OdersNumber"); //盘点编号 string sql = string.Format(@"select distinct (mo.MaterialNumber+'^'+mo.Version) as Value, (p.ProductName+' 【'+mo.Version+'】') as Text from (select * from StockInventoryLogDetail where [Version] !='0') mo inner join Product p on mo.MaterialNumber=p.ProductNumber where mo.InventoryNumber='{0}' ", odersNumber); result = "<option value =\"\">- - - - - 请 选 择 - - - - -</option>"; DataTable dt = SqlHelper.GetTable(sql); foreach (DataRow dr in dt.Rows) { result += string.Format(" <option value ='{0}'>{1}</option> ", dr["Value"], dr["Text"]); } } else { string ordersNumber = ToolManager.GetQueryString("OdersNumber"); //盘点 string product = ToolManager.GetQueryString("Prouduct"); if (string.IsNullOrEmpty(product)) { result = ""; } else { string warehouseNumber = ToolManager.GetQueryString("WarehouseNumber"); string[] products = product.Split('^'); string inventoryQty = StoreroomToolManager.GetinventoryQty("", products[0], products[1], warehouseNumber, "ProductStock", "ProductWarehouseLog", ToolEnum.ProductType.Product); inventoryQty = inventoryQty == "" ? "0" : inventoryQty; result = inventoryQty; } } context.Response.ContentType = "text/plain"; context.Response.Write(result); }
protected void drpProduct_SelectedIndexChanged(object sender, EventArgs e) { string products = drpProduct.SelectedValue; string[] temp = products.Split('^'); if (string.IsNullOrEmpty(products)) { lbInventoryQty.Text = ""; return; } lbInventoryQty.Text = StoreroomToolManager.GetinventoryQty("", temp[0], temp[1], warehouseNumber, "ProductStock", "ProductWarehouseLog", ToolEnum.ProductType.Product); }
protected void Page_Load(object sender, EventArgs e) { string requestString = ToolManager.GetRequestString("Action"); if (requestString != null) { if (!(requestString == "Save")) { if (requestString == "Get") { this.Get(); } else if (requestString == "Delete") { this.Delete(); } else if (requestString == "Autior") { string str2 = string.Empty; try { string auditor = ToolCode.Tool.GetUser().UserNumber; string number = "'" + Request["WarehouseNumber"] + "'"; string tempResult = StoreroomToolManager.AutiorProductWarehouseLog(number, auditor); if (!tempResult.Equals("1")) { str2 = JsonConvert.SerializeObject(new { Status = false, Msg = tempResult }); } else { str2 = JsonConvert.SerializeObject(new { Status = true, Msg = string.Empty }); } base.Response.Write(str2); HttpContext.Current.ApplicationInstance.CompleteRequest(); } catch (Exception exception) { str2 = JsonConvert.SerializeObject(new { Status = false, Msg = exception.Message }); base.Response.Write(str2); HttpContext.Current.ApplicationInstance.CompleteRequest(); } } } else { this.Save(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { trPlanNumberOrderNumber.Visible = false; Check(); string warehouseNumber = ToolManager.GetQueryString("WarehouseNumber"); lbWarehouseNumber.Text = warehouseNumber; if (ToolManager.CheckQueryString("DocumentNumber") && ToolManager.CheckQueryString("WarehouseNumber") && ToolManager.CheckQueryString("ProductNumber") && ToolManager.CheckQueryString("Version") && ToolManager.CheckQueryString("PlanNumberOrderNumber") && ToolManager.CheckQueryString("RowNumber") ) { string documentNumber = ToolManager.GetQueryString("DocumentNumber"); string productNumber = ToolManager.GetQueryString("ProductNumber"); string version = ToolManager.GetQueryString("Version"); string planNumberOrderNumber = ToolManager.GetQueryString("PlanNumberOrderNumber"); string rowNumber = ToolManager.GetQueryString("RowNumber"); string sql = string.Format(@" select * from ProductWarehouseLogDetail where WarehouseNumber='{0}' and DocumentNumber='{1}' and ProductNumber ='{2}' and Version ='{3}' and RowNumber='{4}' and OrdersNumber='{5}'", warehouseNumber, documentNumber, productNumber, version, rowNumber, planNumberOrderNumber); DataTable dt = SqlHelper.GetTable(sql); if (dt.Rows.Count > 0) { DataRow dr = dt.Rows[0]; lbOdersNumber.Text = dr["DocumentNumber"] == null ? "" : dr["DocumentNumber"].ToString(); lbProduct.Text = dr["ProductNumber"].ToString() + "|" + dr["Version"].ToString(); txtCustomerProductNumber.Text = dr["CustomerProductNumber"] == null ? "" : dr["CustomerProductNumber"].ToString(); txtQty.Text = dr["Qty"] == null ? "" : dr["Qty"].ToString(); lbOldQty.Text = dr["Qty"] == null ? "" : dr["Qty"].ToString(); txtReason.Text = dr["ReturnReason"] == null ? "" : dr["ReturnReason"].ToString() == "" ? "无" : dr["ReturnReason"].ToString(); txtRemark.Text = dr["Remark"] == null ? "" : dr["Remark"].ToString(); txtInventoryQty.Text = StoreroomToolManager.GetinventoryQty("", dr["ProductNumber"].ToString(), dr["Version"].ToString(), warehouseNumber , "ProductStock", "ProductWarehouseLog", ToolEnum.ProductType.Product); lbOrdersNumber.Text = dr["OrdersNumber"] == null ? "" : dr["OrdersNumber"].ToString(); lbRowNumber.Text = dr["RowNumber"] == null ? "" : dr["RowNumber"].ToString(); txtOdersNumber.Visible = false; lbOdersNumber.Visible = true; drpProduct.Visible = false; btnSubmit.Text = "修改"; if (!planNumberOrderNumber.Equals("0")) { trPlanNumberOrderNumber.Visible = false; trRowNumber.Visible = false; } } } } }
protected void btnUpload_Click(object sender, EventArgs e) { string year = drpYear.SelectedValue; string month = drpMonth.SelectedValue; string error = string.Empty; if (StoreroomToolManager.ImpT_ExaminationLog_KFList(year, month, FU_Excel, Server, ref error)) { lbMsg.Text = "导入成功"; } else { lbMsg.Text = "导入失败!<br/>" + error; } }
protected void btnCheck_Click(object sender, EventArgs e) { string auditor = ToolCode.Tool.GetUser().UserNumber; string number = "'" + ToolManager.GetQueryString("WarehouseNumber") + "'"; string result = StoreroomToolManager.AutiorProductWarehouseLog(number, auditor); if (result.Equals("1")) { Response.Redirect("ProductWarehouseLogList.aspx"); } else { lbSubmit.Text = "审核失败!原因:" + result; } }
protected void btnSubmit_Click(object sender, EventArgs e) { string error = string.Empty; string year = drpYear.SelectedValue; string month = drpMonth.SelectedValue; if (StoreroomToolManager.AddWarehousePerformanceReviewLog(year, month, ref error)) { Response.Write(ToolManager.GetClosePageJS()); Response.End(); return; } else { lbMsg.Text = "上报失败!原因:" + error; } }
protected void btnCheck_Click(object sender, EventArgs e) { string userName = ToolCode.Tool.GetUser().UserName; string error = string.Empty; warehouseNumber = ToolManager.GetQueryString("WarehouseNumber"); type = Server.UrlDecode(ToolManager.GetQueryString("type")).Trim(); bool result = StoreroomToolManager.SHYPCRK(warehouseNumber, type, userName, ref error); if (result) { Response.Redirect("SampleCRK.aspx"); } else { lbMsg.Text = "审核失败!原因:" + error; } }
protected void btnUpload_Click(object sender, EventArgs e) { string error = string.Empty; bool result = StoreroomToolManager.ImpMarerialScrapLogList(FU_Excel, Server, ref error); if (result == true) { lbMsg.Text = "导入成功"; Tool.WriteLog(Tool.LogType.Operating, "导入报废信息", "导入成功!"); return; } else { lbMsg.Text = error; Tool.WriteLog(Tool.LogType.Operating, "导入报废信息", "导入失败!原因" + error); return; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Check(); BindDrpProduct(); if (ToolManager.CheckQueryString("DocumentNumber") && ToolManager.CheckQueryString("WarehouseNumber") && ToolManager.CheckQueryString("ProductNumber") && ToolManager.CheckQueryString("Version")) { string documentNumber = "无"; string warehouseNumber = ToolManager.GetQueryString("WarehouseNumber"); string productNumber = ToolManager.GetQueryString("ProductNumber"); string version = ToolManager.GetQueryString("Version"); string sql = string.Format(@" select ReturnReason ,Qty ,Remark from ProductWarehouseLogDetail where WarehouseNumber ='{0}' and DocumentNumber ='{1}' and ProductNumber ='{2}' and Version ='{3}'", warehouseNumber, documentNumber , productNumber, version); DataTable dt = SqlHelper.GetTable(sql); if (dt.Rows.Count > 0) { DataRow dr = dt.Rows[0]; txtProductNumber.Text = productNumber; txtVersion.Text = version; lbProduct.Text = productNumber + "|" + version; txtQty.Text = dr["Qty"] == null ? "" : dr["Qty"].ToString(); lbOldQty.Text = dr["Qty"] == null ? "" : dr["Qty"].ToString(); txtReason.Text = dr["ReturnReason"] == null ? "" : dr["ReturnReason"].ToString(); txtRemark.Text = dr["Remark"] == null ? "" : dr["Remark"].ToString(); lbInventoryQty.Text = StoreroomToolManager.GetinventoryQty("", productNumber, version, warehouseNumber, "ProductStock", "ProductWarehouseLog", ToolEnum.ProductType.Product); btnSubmit.Text = "修改"; drpProduct.Visible = false; lbProduct.Visible = true; } } else { btnSubmit.Text = "添加"; drpProduct.Visible = true; lbProduct.Visible = false; } } }
protected void btnCheck_Click(object sender, EventArgs e) { string error = string.Empty; string userId = ToolCode.Tool.GetUser().UserNumber; string userName = ToolCode.Tool.GetUser().UserName; warehousenumber = ToolManager.GetQueryString("WarehouseNumber"); bool result = StoreroomToolManager.FPCRKCheck(warehousenumber, userId, userName, ref error); if (result) { Response.Redirect("ScarpWarehouseLogList.aspx"); } else { lbMsg.Text = "审核失败!原因:" + error; return; } }
protected void btnUpload_Click(object sender, EventArgs e) { bool result = false; string error = string.Empty; string type = drpType.SelectedValue; try { if (type.Equals("0"))//原材料库存数量导入 { result = StoreroomToolManager.ImpMaterialQty(FU_Excel, Server, ref error); } else if (type.Equals("1"))//产品库存数量 { result = StoreroomToolManager.ImpProductQty(FU_Excel, Server, ref error); } lbMsg.Text = result ? "导入成功!" : "导入失败<br/>" + error; } catch (Exception ex) { lbMsg.Text = "请检查导入类型和所选的excel模板是否一致!" + ex.Message; return; } }
protected void btnSubmit_Click(object sender, EventArgs e) { string qty = txtQty.Text; string reason = txtReason.Text; string remark = txtRemark.Text; string inventoryQty = lbInventoryQty.Text; List <string> sqls = new List <string>(); string sql = string.Empty; string error = string.Empty; bool result = false; if (btnSubmit.Text.Equals("添加")) { string temp = drpProduct.SelectedValue; string[] products = temp.Split('^'); string productNumber = txtProductNumber.Text.Trim(); string version = txtVersion.Text.Trim(); if (!ProductManager.IsExit(productNumber, version)) { lbSubmit.Text = "系统不存在该产成品编号和版本,请重新输入!"; return; } //if (Convert.ToInt32(inventoryQty) < Convert.ToInt32(qty)) //{ // lbSubmit.Text = "库存数量小于出库数量!无法出库"; // return; //} if (StoreroomToolManager.IsExitForProductWarehouseLogDetail(warehouseNumber, "无", productNumber, version)) { lbSubmit.Text = "已存在相同记录!"; return; } sql = string.Format(@" insert into ProductWarehouseLogDetail (WarehouseNumber ,DocumentNumber ,ProductNumber ,Version ,ReturnReason ,Qty ,InventoryQty ,Remark ,RowNumber) values('{0}','无','{1}','{2}','{3}',{4},0,'{5}','无') " , warehouseNumber, productNumber, version, reason, qty, remark); sqls.Add(sql); result = SqlHelper.BatchExecuteSql(sqls, ref error); lbSubmit.Text = result == true ? "添加成功" : "添加失败,原因:" + error; if (result) { Tool.WriteLog(Tool.LogType.Operating, "增加产品报废出库信息" + warehouseNumber, "增加成功"); Response.Write("<script>window.close();</script>"); return; } else { Tool.WriteLog(Tool.LogType.Operating, "增加产品报废出库信息" + warehouseNumber, "增加失败!原因" + error); return; } } else { string documentNumber = "无"; string warehouseNumber = ToolManager.GetQueryString("WarehouseNumber"); string productNumber = ToolManager.GetQueryString("ProductNumber"); string version = ToolManager.GetQueryString("Version"); //string oldQty = lbOldQty.Text; //int poor = Convert.ToInt32(qty) - Convert.ToInt32(oldQty); //算差值 //if (poor > 0) //还要出库 //{ // if (Convert.ToInt32(inventoryQty) < poor) //库存数量小于要修改的差 // { // lbSubmit.Text = "库存数量低!无法进行此操作"; // return; // } //} //poor = 0 - poor;//取反 sql = string.Format(@" update ProductWarehouseLogDetail set ReturnReason ='{0}',Qty ='{1}',Remark ='{2}' where WarehouseNumber ='{3}' and DocumentNumber ='{4}' and ProductNumber ='{5}' and Version ='{6}' " , reason, qty, remark, warehouseNumber, documentNumber, productNumber, version); sqls.Add(sql); result = SqlHelper.BatchExecuteSql(sqls, ref error); lbSubmit.Text = result == true ? "修改成功" : "修改失败,原因:" + error; if (result) { Tool.WriteLog(Tool.LogType.Operating, "编辑产品报废出库明细" + warehouseNumber, "编辑成功"); Response.Write("<script>window.close();</script>"); return; } else { Tool.WriteLog(Tool.LogType.Operating, "编辑产品报废出库明细" + warehouseNumber, "编辑失败!原因" + error); return; } } }
public void ProcessRequest(HttpContext context) { string result = string.Empty; if (ToolManager.GetQueryString("IsQueryOdersNumber").Equals("true")) //查询销售订单的ajax请求 { string changeDirection = System.Web.HttpContext.Current.Server.UrlDecode(ToolManager.GetQueryString("ChangeDirection")).Trim(); string conditon = string.Empty; switch (changeDirection) { case "退货入库": conditon = " and so.OdersType ='正常订单' "; break; case "包装入库": conditon = " and so.OdersType ='正常订单' "; break; case "维修入库": conditon = " and so.OdersType ='维修订单' "; break; case "销售出库": conditon = " and so.OdersType ='正常订单' "; break; case "样品出库": conditon = " and so.OdersType ='样品订单' "; break; case "维修出库": conditon = " and so.OdersType ='维修订单' "; break; } string sql = string.Format(@"select distinct top 10 t.OdersNumber from ( select distinct top 10 mo.OdersNumber from MachineOderDetail mo inner join SaleOder so on so.OdersNumber =mo.OdersNumber where 1=1 {1} order by mo.OdersNumber desc) t where t.OdersNumber like '%{0}%' or t.OdersNumber like'%{0}' or t.OdersNumber like '{0}%' ", ToolManager.GetQueryString("OdersNumber"), conditon); DataTable dt = SqlHelper.GetTable(sql); if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { result += string.Format(" <tr><td>{0}</td></tr>", dr["OdersNumber"]); } } } else if (ToolManager.GetQueryString("IsQueryOdersNumber").Equals("false")) { string odersNumber = ToolManager.GetQueryString("OdersNumber"); //销售订单号 string sql = string.Format(@"select distinct (mo.ProductNumber+'^'+mo.Version) as Value, (p.ProductName+' 【'+mo.Version+'】') as Text from MachineOderDetail mo inner join Product p on mo.ProductNumber=p.ProductNumber where mo.OdersNumber='{0}' ", odersNumber); result = "<option value =\"\">- - - - - 请 选 择 - - - - -</option>"; DataTable dt = SqlHelper.GetTable(sql); foreach (DataRow dr in dt.Rows) { result += string.Format(" <option value ='{0}'>{1}</option> ", dr["Value"], dr["Text"]); } } else { string ordersNumber = ToolManager.GetQueryString("OdersNumber"); string product = ToolManager.GetQueryString("Prouduct"); if (string.IsNullOrEmpty(product)) { result = "^"; } else { string warehouseNumber = ToolManager.GetQueryString("WarehouseNumber"); string[] products = product.Split('^'); string sql = string.Format(@"select CustomerProductNumber from ProductCustomerProperty where CustomerId=( select CustomerId from SaleOder where OdersNumber ='{0}') and ProductNumber='{1}' and Version ='{2}'", ordersNumber, products[0], products[1]); result = SqlHelper.GetScalar(sql); string inventoryQty = StoreroomToolManager.GetinventoryQty("", products[0], products[1], warehouseNumber, "ProductStock", "ProductWarehouseLog", ToolEnum.ProductType.Product); inventoryQty = inventoryQty == "" ? "0" : inventoryQty; result = result + "^" + inventoryQty; } } context.Response.ContentType = "text/plain"; context.Response.Write(result); }
/// <summary> /// 销售出库(贸易)审核 /// </summary> /// <param name="warehouseNumber"></param> /// <returns></returns> public static string CheckMYXS(string auditor, string warehouseNumber) { string sql = string.Empty; DataTable dtTemp = new DataTable(); string result = string.Empty; List <string> sqls = new List <string>(); string error = string.Empty; sql = string.Format(@"select mwld.DocumentNumber ,mwld.MaterialNumber ,mwld.LeadTime from MaterialWarehouseLogDetail mwld inner join MarerialWarehouseLog mwl on mwl.WarehouseNumber =mwld.WarehouseNumber left join TradingOrderDetail cod on mwld.DocumentNumber=cod.OdersNumber and mwld.MaterialNumber =cod.ProductNumber and mwld.LeadTime =cod.Delivery and mwld.RowNumber =cod.RowNumber where mwld.Qty -cod.NonDeliveryQty >0 and mwl.WarehouseNumber ='{0}'", warehouseNumber); dtTemp = SqlHelper.GetTable(sql); if (dtTemp.Rows.Count > 0) { foreach (DataRow dr in dtTemp.Rows) { result += string.Format(" 订单编号为:{0} 原材料编号为:{1} 交期为{2}的记录的数量大于订单未交数量! " , dr["DocumentNumber"], dr["MaterialNumber"], dr["LeadTime"]); } return(result); } //纠错 仅限于销售出库(贸易) string tempsql1 = string.Format(@" DELETE MaterialWarehouseLogDetail WHERE WarehouseNumber = '{0}' AND Qty < 0; ", warehouseNumber); SqlHelper.ExecuteSql(tempsql1); //更新订单完成数量 //sqls.Add(GetUpdateQtySql(warehouseNumber)); //生成送货单 List <string> sqlsTemp = GetSqlForShSHD(warehouseNumber); if (sqlsTemp.Count > 0) { sqls.AddRange(sqlsTemp); } sql = string.Format(@" INSERT INTO T_LessMaterialBreakdown(WarehouseNumber ,DocumentNumber ,MaterialNumber ,RowNumber ,LeadTime ,CustomerMaterialNumber ,LibraryQty,StockQty ,LessMaterialQty ,CreateTime ,IsLessMaterial) SELECT '', mwld.DocumentNumber , mwld. MaterialNumber, '', '' , mwld.CustomerMaterialNumber, mwld. Qty, vmq.StockQty, CASE WHEN vmq.StockQty<0 THEN 0-mwld.Qty ELSE vmq.StockQty -mwld.Qty END, '{1}', '未还料' FROM (SELECT DocumentNumber, MaterialNumber, CustomerMaterialNumber, SUM(Qty) Qty FROM MaterialWarehouseLogDetail WHERE WarehouseNumber ='{0}' GROUP BY DocumentNumber, MaterialNumber, CustomerMaterialNumber) mwld INNER JOIN MaterialStock vmq ON mwld.MaterialNumber =vmq.MaterialNumber WHERE vmq.StockQty-mwld.Qty <0 ", warehouseNumber, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); sqls.Add(sql); //更新库存 sql = string.Format(@"update MaterialStock set StockQty = case when a.ChangeDirection='入库' then StockQty +a.Qty else StockQty-a.Qty end ,UpdateTime =CONVERT (varchar(100),GETDATE(),120) from ( select mwld.MaterialNumber,mwl.ChangeDirection,sum(mwld.Qty) as Qty from MaterialWarehouseLogDetail mwld inner join MarerialWarehouseLog mwl on mwld.WarehouseNumber =mwl.WarehouseNumber where mwl.WarehouseNumber='{0}' group by mwld.MaterialNumber,mwl.ChangeDirection) a inner join MaterialStock ms on ms.MaterialNumber=a.MaterialNumber where ms.WarehouseName ='ycl' ", warehouseNumber); sqls.Add(sql); sql = string.Format(@" update MarerialWarehouseLog set Auditor='{0}' , CheckTime='{1}' where WarehouseNumber ='{2}'", auditor, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), warehouseNumber); sqls.Add(sql); //更新瞬时库存数量 sqls.Add(StoreroomToolManager.GetUpDateInventoryQtySql(warehouseNumber)); //写入流水账 sqls.Add(StoreroomToolManager.WriteMateriLSZ(warehouseNumber, auditor)); sql = string.Format(" delete DeliveryNoteDetailed where DeliveryQty=0 ");//清除发货数量为0的送货单 sqls.Add(sql); return(SqlHelper.BatchExecuteSql(sqls, ref error) ? "1" : error); }
/// <summary> /// 原材料出入库审核【单条审核】 /// </summary> /// <param name="auditor"></param> /// <param name="warehouseNumber"></param> /// <returns></returns> public static string AuditorMarerialWarehouseLogForWarehouseNumber(string auditor, string warehouseNumber) { string checksqls = string.Format(@" select CheckTime from MarerialWarehouseLog where WarehouseNumber='{0}'", warehouseNumber); if (!string.IsNullOrEmpty(SqlHelper.GetScalar(checksqls))) { return("该单已审核,请勿重复审核!"); } List <string> sqls = new List <string>(); DataTable dtTemp = null; string result = string.Empty; string sql = string.Format(@" select COUNT(*) from MaterialWarehouseLogDetail where WarehouseNumber='{0}'", warehouseNumber); if (SqlHelper.GetScalar(sql).Equals("0")) { return("没有需要审核的记录!"); } sql = string.Format("select Type from MarerialWarehouseLog where WarehouseNumber='{0}'", warehouseNumber); string type = SqlHelper.GetScalar(sql); if (type.Equals("生产出库") || type.Equals("包装出库")) { return(SCCKAuditor(auditor, warehouseNumber)); } if (type.Equals("销售出库(贸易)")) { return(CheckMYXS(auditor, warehouseNumber)); } //步骤一:检测采购入库和销售出库(贸易)的数量-订单未交数量是否大于0(大于0为异常数据) if (type.Equals("采购入库")) { sql = string.Format(@" select t.DocumentNumber ,t.MaterialNumber ,t.LeadTime from ( select WarehouseNumber,DocumentNumber,MaterialNumber,LeadTime,sum(isnull(Qty,0)) qty from MaterialWarehouseLogDetail where WarehouseNumber ='{0}' group by WarehouseNumber,DocumentNumber,MaterialNumber,LeadTime )t left join CertificateOrdersDetail cod on t.DocumentNumber=cod.OrdersNumber and t.MaterialNumber =cod.MaterialNumber and t.LeadTime =cod.LeadTime where t.Qty -cod.NonDeliveryQty >0", warehouseNumber); dtTemp = SqlHelper.GetTable(sql); if (dtTemp.Rows.Count > 0) { foreach (DataRow dr in dtTemp.Rows) { result += "<br/>" + string.Format(" 订单编号为:{0} 原材料编号为:{1} 交期为{2}的记录数量大于订单未交数量! " , dr["DocumentNumber"], dr["MaterialNumber"], dr["LeadTime"]); } return(result); } //sqls.AddRange(FinancialManager.GetCSYF(warehouseNumber)); } else if (type.Equals("销售出库(贸易)")) { sql = string.Format(@"select mwld.DocumentNumber ,mwld.MaterialNumber ,mwld.LeadTime from MaterialWarehouseLogDetail mwld inner join MarerialWarehouseLog mwl on mwl.WarehouseNumber =mwld.WarehouseNumber left join TradingOrderDetail cod on mwld.DocumentNumber=cod.OdersNumber and mwld.MaterialNumber =cod.ProductNumber and mwld.LeadTime =cod.Delivery and mwld.RowNumber =cod.RowNumber where mwld.Qty -cod.NonDeliveryQty >0 and mwl.WarehouseNumber ='{0}'", warehouseNumber); dtTemp = SqlHelper.GetTable(sql); if (dtTemp.Rows.Count > 0) { foreach (DataRow dr in dtTemp.Rows) { result += string.Format(" 订单编号为:{0} 原材料编号为:{1} 交期为{2}的记录的数量大于订单未交数量! " , dr["DocumentNumber"], dr["MaterialNumber"], dr["LeadTime"]); } return(result); } //纠错 仅限于销售出库(贸易) string tempsql1 = string.Format(@" DELETE MaterialWarehouseLogDetail WHERE WarehouseNumber = '{0}' AND Qty < 0; ", warehouseNumber); SqlHelper.ExecuteSql(tempsql1); //更新订单完成数量 sqls.Add(GetUpdateQtySql(warehouseNumber)); //生成送货单 List <string> sqlsTemp = GetSqlForShSHD(warehouseNumber); if (sqlsTemp.Count > 0) { sqls.AddRange(sqlsTemp); } } //步骤二:检测库存数量是否满足出库 if (type.Equals("销售出库(贸易)")) { string tempchecksql = string.Format(@" select COUNT (*) from ( select t.MaterialNumber,t.WarehouseName, (ISNULL ( ms.StockQty,0)-t.Qty) as 差 from ( select mwld.MaterialNumber ,sum( mwld.Qty ) as Qty,mwl.WarehouseName from MaterialWarehouseLogDetail mwld inner join MarerialWarehouseLog mwl on mwld.WarehouseNumber=mwl.WarehouseNumber where mwl.ChangeDirection ='出库' and mwl.WarehouseNumber in ('{0}') and mwld.Qty>0 group by mwld.MaterialNumber,mwl.WarehouseName ) t left join MaterialStock ms on t.MaterialNumber=ms.MaterialNumber ) t where 差<0", warehouseNumber); if (!SqlHelper.GetScalar(tempchecksql).Equals("0")) { return("当前库存数量低,无法满足当前出库操作。"); } //return SqlHelper.GetScalar(sql).Equals("0") ? true : false; } else { //if (!CheckInventoryQty("'" + warehouseNumber + "'")) //{ // return "当前库存数量低,无法满足当前出库操作。"; //} } //步骤三:同步更新库存数量 并产生应付 同步更新采购入库的已交货数量 string paymentdays = string.Empty; string mode = string.Empty; string CGOrderNumbers = string.Empty; string error = string.Empty; sql = string.Format(@"select * from V_MaterialWarehouseLogDetail_Detail where 出入库编号='{0}' ", warehouseNumber); dtTemp = SqlHelper.GetTable(sql); foreach (DataRow dr in dtTemp.Rows) { if (type.Equals("采购入库")) //产生应付 { sql = string.Format(@"update CertificateOrdersDetail set DeliveryQty +={0} where OrdersNumber='{1}' and MaterialNumber='{2}' and LeadTime ='{3}' and Status ='未完成' ", dr["数量"], dr["订单编号"], dr["原材料编号"], dr["交期"]); //同步更新采购入库的已交货数量 sqls.Add(sql); CGOrderNumbers += string.Format("'{0}',", dr["订单编号"]); } //同步更新库存数量 //sqls.Add(GetUpdateInventoryQtySql(dr["原材料编号"].ToString(), dr["仓库ID"].ToString(), dr["数量"].ToString(), dr["方向"].ToString())); } string timeNow = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); //类型为采购入库=======生成预付第二层信息 sql = string.Format(@"insert into T_AccountsPayable_Detail(ReceiptNo,PurchaseOrderNumber ,PurchaseContractNumber,MaterialNumber ,SupplierMaterialNumber ,Description,PurchaseCount,NumberOfArrival,UnitPrice ,SumPrice ,TransportNo,LeadTime,CreateTime ) select vmld.WarehouseNumber ,vmld.DocumentNumber ,co.HTNumber,co.MaterialNumber,co.SupplierMaterialNumber,mit.Description ,co.OrderQty ,vmld.Qty,co.UnitPrice ,co.UnitPrice *vmld.Qty ,vmld.RoadTransport,vmld.LeadTime,'{1}' from ( select mwl.Type,mwld.* from MarerialWarehouseLog mwl inner join MaterialWarehouseLogDetail mwld on mwl.WarehouseNumber =mwld.WarehouseNumber ) vmld inner join ( select co.HTNumber ,co.PaymentMode ,cod.* from CertificateOrders co inner join CertificateOrdersDetail cod on co.OrdersNumber=cod.OrdersNumber ) co on vmld.DocumentNumber = co.OrdersNumber and vmld.MaterialNumber =co.MaterialNumber and vmld.LeadTime =co.LeadTime inner join MarerialInfoTable mit on vmld .MaterialNumber =mit.MaterialNumber where vmld.WarehouseNumber ='{0}' and vmld.Type ='采购入库' ", warehouseNumber, timeNow); sqls.Add(sql); //类型为采购入库的生成应付第一层 sql = string.Format(@"insert into T_AccountsPayable_Main(OrdersNumber,CreateTime ,CGHTNumber ,ArrivalNumber,SumPrice ,ArrivalPrice ,SupplierId,PaymentTypes,PaymentMode,DeliveryDate) select a.OrdersNumber ,'{0}',co.HTNumber ,a.到货数量,a.订单总价,a.到货总价,si.SupplierId ,si.PayType,si.PaymentMode,CONVERT(varchar(100), GETDATE(), 23) from ( select co.OrdersNumber,SUM(vmld.Qty ) as 到货数量,SUM (vmld .Qty *co.UnitPrice ) as 到货总价,SUM( co.SumPrice) as 订单总价 from ( select mwl.Type,mwld.* from MarerialWarehouseLog mwl inner join MaterialWarehouseLogDetail mwld on mwl.WarehouseNumber =mwld.WarehouseNumber ) vmld inner join ( select co.HTNumber ,co.PaymentMode,co.SupplierId ,cod.* from CertificateOrders co inner join CertificateOrdersDetail cod on co.OrdersNumber=cod.OrdersNumber ) co on vmld.DocumentNumber = co.OrdersNumber and vmld.MaterialNumber =co.MaterialNumber and vmld.LeadTime =co.LeadTime inner join MarerialInfoTable mit on vmld .MaterialNumber =mit.MaterialNumber inner join SupplierInfo si on co.SupplierId=si.SupplierId where vmld.WarehouseNumber ='{1}' and vmld.Type ='采购入库' and co.PaymentMode!='YFBF' and co.PaymentMode!='YFQK' group by co.OrdersNumber) a inner join CertificateOrders co on a.OrdersNumber =co.OrdersNumber inner join SupplierInfo si on co.SupplierId =si.SupplierId ", timeNow, warehouseNumber); sqls.Add(sql); //统一更新库存数量 // sql = string.Format(@"update MaterialStock set StockQty = //case when mwl.ChangeDirection='入库' then StockQty +a.Qty else StockQty-a.Qty end //,UpdateTime =CONVERT (varchar(100),GETDATE(),120) from //( select mwld.MaterialNumber,sum(mwld.Qty) as Qty from MaterialWarehouseLogDetail mwld // inner join MarerialWarehouseLog mwl on // mwld.WarehouseNumber =mwl.WarehouseNumber // where mwl.WarehouseNumber='{0}' // group by mwld.MaterialNumber) a // inner join MaterialStock ms on ms.MaterialNumber=a.MaterialNumber // where ms.WarehouseName ='ycl' // ", warehouseNumber); sql = string.Format(@"update MaterialStock set StockQty = case when a.ChangeDirection='入库' then StockQty +a.Qty else StockQty-a.Qty end ,UpdateTime =CONVERT (varchar(100),GETDATE(),120) from ( select mwld.MaterialNumber,mwl.ChangeDirection,sum(mwld.Qty) as Qty from MaterialWarehouseLogDetail mwld inner join MarerialWarehouseLog mwl on mwld.WarehouseNumber =mwl.WarehouseNumber where mwl.WarehouseNumber='{0}' group by mwld.MaterialNumber,mwl.ChangeDirection) a inner join MaterialStock ms on ms.MaterialNumber=a.MaterialNumber where ms.WarehouseName ='ycl' ", warehouseNumber); sqls.Add(sql); //如果是采购退料出库则反写出库单号至采购订单上 if (type.Equals("采购退料出库")) { string tempSql = string.Format(@" update CertificateOrders set CCTCOrdersNumber='{0}' where OrdersNumber in ( select distinct DocumentNumber from MaterialWarehouseLogDetail where WarehouseNumber='{0}' )", warehouseNumber); sqls.Add(tempSql); //warehouseNumber } //步骤四:同步更新采购入库订单明细的已交货、未交货、状态以及整条订单状态 sql = string.Format("update CertificateOrdersDetail set NonDeliveryQty =OrderQty-DeliveryQty"); sqls.Add(sql); sql = string.Format("update CertificateOrdersDetail set Status ='已完成' where NonDeliveryQty=0"); sqls.Add(sql); if (!string.IsNullOrEmpty(CGOrderNumbers)) { sql = string.Format(@"update CertificateOrders set OrderStatus ='已完成' where OrdersNumber in ( select OrdersNumber from CertificateOrdersDetail where OrdersNumber in({0}) group by OrdersNumber having SUM(NonDeliveryQty )=0 ) and OrderStatus ='未完成'", CGOrderNumbers.TrimEnd(',')); //更新采购订单主表的状态 sqls.Add(sql); } sql = string.Format(@" update MarerialWarehouseLog set Auditor='{0}' , CheckTime='{1}' where WarehouseNumber ='{2}'", auditor, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), warehouseNumber); sqls.Add(sql); //更新瞬时库存数量 sqls.Add(StoreroomToolManager.GetUpDateInventoryQtySql(warehouseNumber)); //写入流水账 sqls.Add(StoreroomToolManager.WriteMateriLSZ(warehouseNumber, auditor)); sql = string.Format(" delete DeliveryNoteDetailed where DeliveryQty=0 ");//清除发货数量为0的送货单 sqls.Add(sql); return(SqlHelper.BatchExecuteSql(sqls, ref error) ? "1" : error); }
protected void btnSubmit_Click(object sender, EventArgs e) { string warehouseNumber = ToolManager.GetQueryString("WarehouseNumber"); string planNumber = string.Empty; string customerMaterilNumber = txtCustomerMaterilNumber.Text.Trim(); string material = string.Empty; string qty = txtQty.Text; string sql = string.Empty; if (string.IsNullOrEmpty(customerMaterilNumber) || string.IsNullOrEmpty(qty) || string.IsNullOrEmpty(customerMaterilNumber)) { lbSubmit.Text = "信息填写不完整"; return; } if (drpType.SelectedValue == "供应商物料编号") { sql = string.Format(@"select top 1 MaterialNumber from MaterialSupplierProperty where SupplierMaterialNumber='{0}'", customerMaterilNumber); if (SqlHelper.GetScalar(sql).Equals("")) { lbSubmit.Text = "未知的供应商物料编号!"; return; } else { material = SqlHelper.GetScalar(sql); } } if (drpType.SelectedValue == "客户物料编号") { sql = string.Format(@"select top 1 MaterialNumber from MaterialCustomerProperty where CustomerMaterialNumber='{0}'", customerMaterilNumber); if (SqlHelper.GetScalar(sql).Equals("")) { lbSubmit.Text = "未知的客户物料编号!"; return; } else { material = SqlHelper.GetScalar(sql); } } if (drpType.SelectedValue == "瑞普迪编号") { sql = string.Format(@"select top 1 MaterialNumber from MarerialInfoTable where MaterialNumber='{0}'", customerMaterilNumber); if (SqlHelper.GetScalar(sql).Equals("")) { lbSubmit.Text = "未知的瑞普迪编号!"; return; } else { material = SqlHelper.GetScalar(sql); } } if (drpType.SelectedValue == "物料描述") { sql = string.Format(@"select top 1 MaterialNumber from MarerialInfoTable where Description='{0}'", customerMaterilNumber); if (SqlHelper.GetScalar(sql).Equals("")) { lbSubmit.Text = "未知的物料描述!"; return; } else { material = SqlHelper.GetScalar(sql); } } string remark = txtRemark.Text; string error = string.Empty; bool result = StoreroomToolManager.AddFLCKDetail(warehouseNumber, planNumber, customerMaterilNumber, material, qty, remark, ref error); if (result) { Response.Write(ToolManager.GetClosePageJS()); Response.End(); return; } else { lbSubmit.Text = "添加失败!原因:" + error; } }