protected void btnDelete_Click(object sender, EventArgs e) { string strID = this.txtID.Text; int Count = bll.GetRowCount("VUsed_WMS_BillMaster", string.Format("BillID='{0}'", this.txtID.Text.Trim())); if (Count > 0) { JScript.Instance.ShowMessage(this.updatePanel, "该盘点单号已被其它单据使用,请调整后再删除!"); return; } string[] comds = new string[2]; comds[0] = "WMS.DeleteBillMaster"; comds[1] = "WMS.DeleteBillDetail"; List <DataParameter[]> paras = new List <DataParameter[]>(); paras.Add(new DataParameter[] { new DataParameter("{0}", "'" + strID + "'") }); paras.Add(new DataParameter[] { new DataParameter("{0}", string.Format("BillID='{0}'", strID)) }); bll.ExecTran(comds, paras); AddOperateLog("盘库单", "删除单号:" + strID); btnNext_Click(sender, e); if (this.txtID.Text == strID) { btnPre_Click(sender, e); if (this.txtID.Text == strID) { BindDataNull(); } } }
protected void btnSave_Click(object sender, EventArgs e) { UpdateTempSub(this.dgViewSub1); string[] Commands = new string[3]; DataParameter[] para; if (strID == "") //新增 { int Count = bll.GetRowCount("WMS_BillMaster", string.Format("BillID='{0}'", this.txtID.Text.Trim())); if (Count > 0) { JScript.ShowMessage(this.updatePanel1, "该入库单已经存在!"); return; } para = new DataParameter[] { new DataParameter("@BillID", this.txtID.Text.Trim()), new DataParameter("@BillDate", this.txtBillDate.DateValue), new DataParameter("@BillTypeCode", this.ddlBillTypeCode.SelectedValue), new DataParameter("@AreaCode", ""), new DataParameter("@FactoryID", this.ddlFactoryID.SelectedValue), new DataParameter("@Memo", this.txtMemo.Text.Trim()), new DataParameter("@BatchNo", this.txtBatchNo.Text.Trim()), new DataParameter("@SourceBillNo", this.txtSourceBillNo.Text.Trim()), new DataParameter("@Creator", Session["EmployeeCode"].ToString()), new DataParameter("@Updater", Session["EmployeeCode"].ToString()) }; Commands[0] = "WMS.InsertInStockBill"; } else //修改 { para = new DataParameter[] { new DataParameter("@BillDate", this.txtBillDate.DateValue), new DataParameter("@BillTypeCode", this.ddlBillTypeCode.SelectedValue), new DataParameter("@AreaCode", ""), new DataParameter("@FactoryID", this.ddlFactoryID.SelectedValue), new DataParameter("@Memo", this.txtMemo.Text.Trim()), new DataParameter("@BatchNo", this.txtBatchNo.Text.Trim()), new DataParameter("@SourceBillNo", this.txtSourceBillNo.Text.Trim()), new DataParameter("@Updater", Session["EmployeeCode"].ToString()), new DataParameter("{0}", string.Format("BillID='{0}'", this.txtID.Text.Trim())) }; Commands[0] = "WMS.UpdateInStock"; } try { DataTable dt = (DataTable)ViewState[FormID + "_Edit_dgViewSub1"]; Commands[1] = "WMS.DeleteBillDetail"; Commands[2] = "WMS.InsertInStockDetail"; bll.ExecTran(Commands, para, "BillID", new DataTable[] { dt }); } catch (Exception ex) { JScript.ShowMessage(this.updatePanel1, ex.Message); return; } Response.Redirect(FormID + "View.aspx?SubModuleCode=" + SubModuleCode + "&FormID=" + Server.UrlEncode(FormID) + "&SqlCmd=" + SqlCmd + "&ID=" + Server.UrlEncode(this.txtID.Text)); }
protected void btnDeletet_Click(object sender, EventArgs e) { string strColorCode = "'-1',"; BLL.BLLBase bll = new BLL.BLLBase(); for (int i = 0; i < this.GridView1.Rows.Count; i++) { CheckBox cb = (CheckBox)(this.GridView1.Rows[i].FindControl("cbSelect")); if (cb != null && cb.Checked) { HyperLink hk = (HyperLink)(this.GridView1.Rows[i].FindControl("HyperLink1")); //判断能否删除 int Count = bll.GetRowCount("VUsed_WMS_BillMaster", string.Format("BillID='{0}'", hk.Text)); if (Count > 0) { JScript.ShowMessage(this.UpdatePanel1, hk.Text + "移库单号被其它单据使用,请调整后再删除!"); return; } strColorCode += "'" + hk.Text + "',"; } } strColorCode += "'-1'"; string[] comds = new string[2]; comds[0] = "WMS.DeleteBillMaster"; comds[1] = "WMS.DeleteBillDetail"; List <DataParameter[]> paras = new List <DataParameter[]>(); paras.Add(new DataParameter[] { new DataParameter("{0}", strColorCode) }); paras.Add(new DataParameter[] { new DataParameter("{0}", string.Format("BillID in ({0})", strColorCode)) }); bll.ExecTran(comds, paras); AddOperateLog("移库单", "删除单号:" + strColorCode.Replace("'-1',", "").Replace(",'-1'", "")); this.hdnRowIndex.Value = "0"; dvscrollX.Value = "0"; dvscrollY.Value = "0"; DataTable dt = SetBtnEnabled(int.Parse(ViewState["CurrentPage"].ToString()), SqlCmd, ViewState["filter"].ToString(), pageSize, GridView1, btnFirst, btnPre, btnNext, btnLast, btnToPage, lblCurrentPage, this.UpdatePanel1); SetBindDataSub(dt); }
protected void btnDeletet_Click(object sender, EventArgs e) { string strColorCode = "'-1',"; BLL.BLLBase bll = new BLL.BLLBase(); for (int i = 0; i < this.GridView1.Rows.Count; i++) { CheckBox cb = (CheckBox)(this.GridView1.Rows[i].FindControl("cbSelect")); if (cb != null && cb.Checked) { HyperLink hk = (HyperLink)(this.GridView1.Rows[i].FindControl("HyperLink1")); //判断能否删除 int Count = bll.GetRowCount("VUsed_WMS_BillMaster", string.Format("BillID='{0}'", hk.Text)); if (Count > 0) { JScript.Instance.ShowMessage(this.UpdatePanel1, hk.Text + "移库单号被其它单据使用,请调整后再删除!"); return; } strColorCode += "'" + hk.Text + "',"; } } strColorCode += "'-1'"; string[] comds = new string[2]; comds[0] = "WMS.DeleteBillMaster"; comds[1] = "WMS.DeleteBillDetail"; List<DataParameter[]> paras = new List<DataParameter[]>(); paras.Add(new DataParameter[] { new DataParameter("{0}", strColorCode) }); paras.Add(new DataParameter[] { new DataParameter("{0}", string.Format("BillID in ({0})", strColorCode)) }); bll.ExecTran(comds, paras); AddOperateLog("移库单", "删除单号:" + strColorCode.Replace("'-1',", "").Replace(",'-1'", "")); this.hdnRowIndex.Value = "0"; dvscrollX.Value = "0"; dvscrollY.Value = "0"; DataTable dt = SetBtnEnabled(int.Parse(ViewState["CurrentPage"].ToString()), SqlCmd, ViewState["filter"].ToString(), pageSize, GridView1, btnFirst, btnPre, btnNext, btnLast, btnToPage, lblCurrentPage, this.UpdatePanel1); SetBindDataSub(dt); }
protected void btnSave_Click(object sender, EventArgs e) { List <string> comds = new List <string>(); List <DataParameter[]> paras = new List <DataParameter[]>(); comds.Add("Security.DeleteUserArea"); paras.Add(new DataParameter[] { new DataParameter("@UserID", this.txtUserID.Value) }); foreach (ListItem cbox in chkArea.Items) { if (cbox.Selected) { comds.Add("Security.InsertUserArea"); paras.Add(new DataParameter[] { new DataParameter("@UserID", this.txtUserID.Value), new DataParameter("@AreaCode", cbox.Value) }); } } bll.ExecTran(comds.ToArray(), paras); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Resize", "alert('数据保存成功!'); Close();", true); }
protected void btnSave_Click(object sender, EventArgs e) { UpdateTempSub(this.dgViewSub1); string[] Commands = new string[3]; DataParameter[] para; if (strID == "") //新增 { int Count = bll.GetRowCount("WMS_BillMaster", string.Format("BillID='{0}'", this.txtID.Text.Trim())); if (Count > 0) { JScript.Instance.ShowMessage(this.updatePanel1, "该移库库单已经存在!"); return; } para = new DataParameter[] { new DataParameter("@BillID", this.txtID.Text.Trim()), new DataParameter("@BillDate", this.txtBillDate.DateValue), new DataParameter("@BillTypeCode", "030"), new DataParameter("@AreaCode", this.ddlAreaCode.SelectedValue), new DataParameter("@Memo", this.txtMemo.Text.Trim()), new DataParameter("@Creator", Session["EmployeeCode"].ToString()), new DataParameter("@Updater", Session["EmployeeCode"].ToString()) }; Commands[0] = "WMS.InsertMoveStockBill"; } else //修改 { para = new DataParameter[] { new DataParameter("@BillDate", this.txtBillDate.DateValue), new DataParameter("@AreaCode", this.ddlAreaCode.SelectedValue), new DataParameter("@Memo", this.txtMemo.Text.Trim()), new DataParameter("@Updater", Session["EmployeeCode"].ToString()), new DataParameter("{0}", string.Format("BillID='{0}'", this.txtID.Text.Trim())) }; Commands[0] = "WMS.UpdateMoveStock"; } DataTable dt = (DataTable)ViewState[FormID + "_Edit_dgViewSub1"]; //判断货位是否被其他单据锁定 for (int i = 0; i < dt.Rows.Count; i++) { int count = 0; count = bll.GetRowCount("Cmd_Cell", string.Format("CellCode='{0}' and IsLock=1", dt.Rows[i]["CellCode"])); if (count > 0) { JScript.Instance.ShowMessage(this.updatePanel1, "货位 " + dt.Rows[i]["CellCode"].ToString() + "已经被其它单据锁定,不能移库!"); return; } count = bll.GetRowCount("Cmd_Cell", string.Format("CellCode='{0}' and IsLock=1", dt.Rows[i]["NewCellCode"])); if (count > 0) { JScript.Instance.ShowMessage(this.updatePanel1, "货位 " + dt.Rows[i]["NewCellCode"].ToString() + "已经被其它单据锁定,不能移库!"); return; } } try { Commands[1] = "WMS.DeleteBillDetail"; Commands[2] = "WMS.InsertMoveStockDetail"; bll.ExecTran(Commands, para, "BillID", new DataTable[] { dt }); } catch (Exception ex) { JScript.Instance.ShowMessage(this.updatePanel1, ex.Message); return; } Response.Redirect(FormID + "View.aspx?SubModuleCode=" + SubModuleCode + "&FormID=" + Server.UrlEncode(FormID) + "&SqlCmd=" + SqlCmd + "&ID=" + Server.UrlEncode(this.txtID.Text)); }
protected void btnSave_Click(object sender, EventArgs e) { UpdateTempSub(this.dgViewSub1); string[] Commands = new string[3]; DataParameter[] para; //判断库存 DataTable dt = (DataTable)ViewState[FormID + "_Edit_dgViewSub1"]; DataTable dtProduct = dt.DefaultView.ToTable("Product", true, new string[] { "ProductCode", "ProductName" }); for (int i = 0; i < dtProduct.Rows.Count; i++) { object o = dt.Compute("Count(ProductCode)", string.Format("ProductCode='{0}'", dtProduct.Rows[i]["ProductCode"])); if (o != null) { int Qty = int.Parse(o.ToString()); if (Qty > 1) { string Message = dtProduct.Rows[i]["ProductName"].ToString() + " 重复,请重新修改后保存!"; JScript.ShowMessage(this.updatePanel1, Message); return; } } o = dt.Compute("Sum(Quantity)", string.Format("ProductCode='{0}'", dtProduct.Rows[i]["ProductCode"])); if (o != null) { int Qty = int.Parse(o.ToString()); DataTable dtProductQty = bll.FillDataTable("WMS.SelectProductQty", new DataParameter[] { new DataParameter("@BillID", this.txtID.Text), new DataParameter("@ProductCode", dtProduct.Rows[i]["ProductCode"].ToString()) }); int StockQty = 0; bool blnvalue = false; if (dtProductQty.Rows.Count == 0) { blnvalue = true; } else { StockQty = int.Parse(dtProductQty.Rows[0]["StockQty"].ToString()); if (Qty > StockQty) { blnvalue = true; } } if (blnvalue) { JScript.ShowMessage(this.updatePanel1, dtProduct.Rows[i]["ProductName"].ToString() + "现有库存数量为:" + StockQty.ToString() + ", 库存不足,请修改出库数量。"); return; } } } if (strID == "") //新增 { int Count = bll.GetRowCount("WMS_BillMaster", string.Format("BillID='{0}'", this.txtID.Text.Trim())); if (Count > 0) { JScript.ShowMessage(this.updatePanel1, "该出库单已经存在!"); return; } para = new DataParameter[] { new DataParameter("@BillID", this.txtID.Text.Trim()), new DataParameter("@BillDate", this.txtBillDate.DateValue), new DataParameter("@BillTypeCode", this.ddlBillTypeCode.SelectedValue), new DataParameter("@AreaCode", ""), new DataParameter("@SourceBillNo", this.txtSourceBillNo.Text), new DataParameter("@BatchNo", this.txtBatchNo.Text), new DataParameter("@Memo", this.txtMemo.Text.Trim()), new DataParameter("@Creator", Session["EmployeeCode"].ToString()), new DataParameter("@Updater", Session["EmployeeCode"].ToString()) }; Commands[0] = "WMS.InsertOutStockBill"; } else //修改 { para = new DataParameter[] { new DataParameter("@BillDate", this.txtBillDate.DateValue), new DataParameter("@BillTypeCode", this.ddlBillTypeCode.SelectedValue), new DataParameter("@AreaCode", ""), new DataParameter("@SourceBillNo", this.txtSourceBillNo.Text), new DataParameter("@BatchNo", this.txtBatchNo.Text), new DataParameter("@Memo", this.txtMemo.Text.Trim()), new DataParameter("@Updater", Session["EmployeeCode"].ToString()), new DataParameter("{0}", string.Format("BillID='{0}'", this.txtID.Text.Trim())) }; Commands[0] = "WMS.UpdateOutStock"; } try { Commands[1] = "WMS.DeleteBillDetail"; Commands[2] = "WMS.InsertOutStockDetail"; bll.ExecTran(Commands, para, "BillID", new DataTable[] { dt }); } catch (Exception ex) { JScript.ShowMessage(this.updatePanel1, ex.Message); return; } Response.Redirect(FormID + "View.aspx?SubModuleCode=" + SubModuleCode + "&FormID=" + Server.UrlEncode(FormID) + "&SqlCmd=" + SqlCmd + "&ID=" + Server.UrlEncode(this.txtID.Text)); }
protected void btnSave_Click(object sender, EventArgs e) { UpdateTempSub(this.dgViewSub1); DataTable dt = (DataTable)ViewState[FormID + "_Edit_dgViewSub1"]; DataTable dtProduct = dt.DefaultView.ToTable("Product", true, new string[] { "ProductCode", "ProductName" }); for (int i = 0; i < dtProduct.Rows.Count; i++) { object o = dt.Compute("Count(ProductCode)", string.Format("ProductCode='{0}' and IsLock='0'", dtProduct.Rows[i]["ProductCode"])); if (o != null) { int Qty = int.Parse(o.ToString()); if (Qty > 1) { JScript.ShowMessage(this.updatePanel1, dtProduct.Rows[i]["ProductName"].ToString() + " 重复,请重新修改后保存!"); return; } } } DataRow[] drs = dt.Select("IsLock='0'"); string[] Comds = new string[drs.Length + 1]; List <DataParameter[]> paras = new List <DataParameter[]>(); DataParameter[] para; for (int i = 0; i < drs.Length; i++) { DataRow dr = drs[i]; int HasCount = bll.GetRowCount("WMS_Pallet", string.Format("PalletCode='{0}' and RowID='{1}'", dr["PalletCode"].ToString(), dr["RowID"].ToString())); if (HasCount > 0) { Comds[i] = "WMS.UpdatePallet"; para = new DataParameter[] { new DataParameter("@ProductCode", dr["ProductCode"].ToString()), new DataParameter("@Quantity", dr["Quantity"].ToString()), new DataParameter("@Weight", dr["Weight"].ToString()), new DataParameter("@Memo", dr["Memo"].ToString()), new DataParameter("@PalletCode", dr["PalletCode"].ToString()), new DataParameter("@RowID", dr["RowID"].ToString()), new DataParameter("@Creator", Session["EmployeeCode"].ToString()), new DataParameter("@Updater", Session["EmployeeCode"].ToString()) }; } else { Comds[i] = "WMS.InsertPallet"; para = new DataParameter[] { new DataParameter("@PalletCode", dr["PalletCode"].ToString()), new DataParameter("@RowID", dr["RowID"].ToString()), new DataParameter("@ProductCode", dr["ProductCode"].ToString()), new DataParameter("@Quantity", dr["Quantity"].ToString()), new DataParameter("@Weight", dr["Weight"].ToString()), new DataParameter("@Memo", dr["Memo"].ToString()), new DataParameter("@Creator", Session["EmployeeCode"].ToString()), new DataParameter("@Updater", Session["EmployeeCode"].ToString()) }; } paras.Add(para); } Comds[drs.Length] = "WMS.SpCreateTaskByPallet"; para = new DataParameter[] { new DataParameter("@PalletCode", this.txtSearch.Text), new DataParameter("@UserName", Session["EmployeeCode"].ToString()) }; paras.Add(para); try { bll.ExecTran(Comds, paras); this.txtSearch.Text = ""; this.txtSearch.Attributes.Remove("ReadOnly"); BindData(""); } catch (Exception ex) { JScript.ShowMessage(this.updatePanel1, ex.Message); BindData(this.txtSearch.Text); return; } }
/// <summary> /// 中間數據庫插入WCS數據庫,并轉入WCS_Task /// </summary> /// <param name="dt"></param> internal static void InsertTaskToWcs(DataTable dt, bool blnUpdateAck) { lock (Locker1) { try { BLL.BLLBase bllStock = new BLLBase("StockDB"); bool blnCheck = true; string SubTaskID = ""; //判斷中間表貨位是否正常 for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = dt.Rows[i]; if (dr["from_location_id"].ToString().Trim().Length == 6) { if (bllStock.GetRowCount("CMD_CEll", string.Format("AreaCode='{0}' and CellName='{1}'", dr["equipment"].ToString(), dr["from_location_id"].ToString())) == 0) { MCP.Logger.Error("WMS明細ID:" + dr["subtask_id"].ToString() + "分配貨位出錯!庫區" + dr["equipment"].ToString() + "不存在貨位:" + dr["from_location_id"].ToString()); blnCheck = false; break; } } if (dr["to_location_id"].ToString().Trim().Length == 6) { if (bllStock.GetRowCount("CMD_CEll", string.Format("AreaCode='{0}' and CellName='{1}'", dr["equipment"].ToString(), dr["to_location_id"].ToString())) == 0) { MCP.Logger.Error("WMS明細ID:" + dr["subtask_id"].ToString() + "分配貨位出錯!庫區" + dr["equipment"].ToString() + "不存在貨位:" + dr["to_location_id"].ToString()); blnCheck = false; break; } } SubTaskID = dr["subtask_id"].ToString() + ","; } if (!blnCheck) { return; } //删除现有数据,避免重复 bllStock.ExecNonQuery("WCS.DeleteAsrsTaskTMP", new DataParameter[] { new DataParameter("{0}", SubTaskID.TrimEnd(',')) }); //插入中間表 bllStock.BatchInsertTable(dt, "AsrsTask_TMP"); DataTable dtTaskID = dt.DefaultView.ToTable(true, "task_id"); List <string> MiddleComds = new List <string>(); List <DataParameter[]> Middleparas = new List <DataParameter[]>(); List <string> StockComds = new List <string>(); List <DataParameter[]> Stockparas = new List <DataParameter[]>(); for (int i = 0; i < dtTaskID.Rows.Count; i++) { DataRow[] drsTask = dt.Select(string.Format("task_id='{0}'", dtTaskID.Rows[i]["task_id"].ToString())); //更新中間表状态 string taskID = drsTask[0]["task_id"].ToString(); string SubtaskID = drsTask[0]["subtask_id"].ToString(); MiddleComds.Add("Middle.UpdateAsrsTaskAck"); MiddleComds.Add("Middle.UpdateAsrsSubTaskAck"); string strWhere = string.Format("subtask_id='{0}'", SubtaskID); if (drsTask.Length > 1) { strWhere = "1=1"; } Middleparas.Add(new DataParameter[] { new DataParameter("@TaskID", taskID) }); Middleparas.Add(new DataParameter[] { new DataParameter("@TaskID", taskID), new DataParameter("{0}", strWhere) }); for (int j = 0; j < drsTask.Length; j++) { SubtaskID = drsTask[j]["subtask_id"].ToString(); StockComds.Add("WCS.InsertWCSTask"); Stockparas.Add(new DataParameter[] { new DataParameter("@subtaskid", SubtaskID) }); } } bllStock.ExecTran(StockComds.ToArray(), Stockparas); BLL.BLLBase bllMiddle = new BLLBase("MiddleDB"); if (blnUpdateAck) { bllMiddle.ExecTran(MiddleComds.ToArray(), Middleparas); } } catch (Exception ex) { throw ex; } } }