using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using CoreFS.CA06; using Pur.Entity.require_planEntiy; using Core.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Tool; using Infragistics.Win.UltraWinGrid; using com.hnshituo.pur.vo; using System.Collections; using Pur.Entity.configureEntity; using Pur.configure; using Pur.require_plan; using Pur.PublicTools; using Pur.Pop_upWindow; using Pur.Entity; namespace Pur.ck { public partial class frmPurUsePlan : FrmPmsBase { private string showType="1";//默认生产厂 public frmPurUsePlan() { InitializeComponent(); } /// /// 界面初始化 /// /// /// private void frmPurUsePlan_Load(object sender, EventArgs e) { showType = this.CustomInfo; if (String.IsNullOrEmpty(showType)) { MessageUtil.ShowTips("界面配置错误,请指定界面使用者[1:生产厂,2:供应部]"); return; } txt_status_LY.SelectedIndex = 1; ck_ctime.Checked = true; txtCreateTimeStart.Value = DateTime.Now.AddMonths(-1); txtCreateTimeEnd.Value = DateTime.Now.AddDays(2); GridHelper.SetExcludeColumnsActive(ultraGrid1.DisplayLayout.Bands[0], new string[] { "check", "REMARKUSE" }); GridHelper.SetExcludeColumnsActive(ultraGrid1.DisplayLayout.Bands[1], new string[] { "useQtyReq" }); GridHelper.SetExcludeColumnsActive(ultraGrid3.DisplayLayout.Bands[0], new string[] { "CHK"}); GridHelper.SetExcludeColumnsActive(ultraGrid2.DisplayLayout.Bands[0], new string[] { }); getUserPlanM(""); } #region toolbar事件 /// /// toolbar /// /// /// public override void ToolBar_Click(object sender, string ToolbarKey)//菜单toolbar按钮 { switch (ToolbarKey) { case "Query": getUserPlan(""); break; case "addPlanUserMD"://生成领用单 addPlanProgram(); break; case "sendPlanUserMD"://提交领用单 sendPlanProgram(); break; case "backPlanUserMD"://撤回领用单 backPlanProgram(); break; case "surePlanUserMD"://确认领用 surePlanProgram(); break; case "cancelPlanUserMD"://删除领用单 cancelPlanProgram(); break; case "printPlanUserMD"://删除领用单 printPlanProgram(); break; case "Quit"://退出 this.Close(); break; case "doExcel"://退出 doExcel(); break; } } /// /// 确认领用 /// private void surePlanProgram() { UltraGridRow uge = ultraGrid2.ActiveRow; if (uge == null) return; String strMrId = uge.Cells["MRID"].Value.ToString(); if (String.IsNullOrEmpty(strMrId)) { return; } if (testStatusM(strMrId, 6) == false) { return; } UsePlanM um = new UsePlanM(); um.MrId = strMrId; um.Status = "6"; um.UpdateName = UserInfo.GetUserName(); um.UpdateUserid = UserInfo.GetUserID(); um.UpdateTime = DateTime.Now; if (MessageUtil.ShowYesNoAndQuestion("已完成领用单:" + strMrId + "物料领用?") != DialogResult.Yes) { return; } CoreResult crt = this.execute("com.hnshituo.pur.requireplan.service.UsePlanMService", "doHandleM", new object[] { um }); if (crt.Resultcode != 0) { MessageUtil.ShowTips("操作失败:" + crt.Resultmsg); return; } MessageUtil.ShowTips("操作成功"); getUserPlanM(strMrId); } /// /// 导出Excel /// private void doExcel() { try { this.Cursor = Cursors.Default; if (ultraGrid2.ActiveRow == null) { MessageUtil.ShowTips("请选择需导出明细的领用单头!"); return; } //获取导出的采购计划行表 ArrayList alUltraGrid = new ArrayList(); alUltraGrid.Add(ultraGrid3); ArrayList alSheeft = new ArrayList(); alSheeft.Add("物料明细"); if (ultraGrid2.Rows.Count > 0) { GridHelper.ulGridToExcel(alUltraGrid, alSheeft, "领用单[" + ultraGrid2.ActiveRow.GetCellValue("mrId") + "]明细表");//导出excel } else { MessageUtil.ShowTips("领用单:" + ultraGrid2.ActiveRow.GetCellValue("mrId") + "无可导出明细!"); } } catch (Exception e) { MessageUtil.ShowTips("导出失败" + e.Message); } finally { this.Cursor = Cursors.Default; } } /// /// 添加领用单头 /// private void addPlanProgram() { try { frmUsePlanMAdd frm = new frmUsePlanMAdd(this.ob, showType); frm.ShowDialog(); if (frm.tips == "1") { string StrMrId = frm.mrId; getUserPlanM(StrMrId); } } catch (Exception e) { MessageUtil.ShowTips("新增失败!" + e); return; } } /// /// 查询领用计划 /// private void getUserPlan(String strMrId) { getUserPlanM(strMrId); } /// /// 打印领用单 /// private void printPlanProgram() { MessageUtil.ShowTips("开发中"); } /// /// 撤回领用大 /// private void backPlanProgram() { UltraGridRow uge = ultraGrid2.ActiveRow; if (uge == null) return; String strMrId = uge.Cells["MRID"].Value.ToString(); if (String.IsNullOrEmpty(strMrId)) { return; } if (testStatusM(strMrId, 11) == false) { return; } UsePlanM um = new UsePlanM(); um.MrId = strMrId; um.Status = "1"; um.UpdateName = UserInfo.GetUserName(); um.UpdateUserid = UserInfo.GetUserID(); um.UpdateTime = DateTime.Now; if (MessageUtil.ShowYesNoAndQuestion("确定撤回领用单:" + strMrId + "?") != DialogResult.Yes) { return; } CoreResult crt = this.execute("com.hnshituo.pur.requireplan.service.UsePlanMService", "doHandleM", new object[] { um }); if (crt.Resultcode != 0) { MessageUtil.ShowTips("操作失败:" + crt.Resultmsg); return; } MessageUtil.ShowTips("操作成功"); getUserPlanM(strMrId); } /// /// 取消提报领用单 /// private void cancelPlanProgram() { UltraGridRow uge = ultraGrid2.ActiveRow; if (uge == null) return; String strMrId = uge.Cells["MRID"].Value.ToString(); if (String.IsNullOrEmpty(strMrId)) { return; } if (testStatusM(strMrId, 10) == false) { return; } UsePlanM um = new UsePlanM(); um.MrId = strMrId; um.Status = "-1"; um.UpdateName = UserInfo.GetUserName(); um.UpdateUserid = UserInfo.GetUserID(); um.UpdateTime = DateTime.Now; if (MessageUtil.ShowYesNoAndQuestion("确定删除领用单:" + strMrId + "?") != DialogResult.Yes) { return; } CoreResult crt = this.execute("com.hnshituo.pur.requireplan.service.UsePlanMService", "doHandleM", new object[] { um }); if (crt.Resultcode != 0) { MessageUtil.ShowTips("操作失败:" + crt.Resultmsg); return; } MessageUtil.ShowTips("操作成功"); getUserPlan(strMrId); } /// /// 发送领用单 /// private void sendPlanProgram() { UltraGridRow uge = ultraGrid2.ActiveRow; if (uge == null) return; String strMrId = uge.Cells["MRID"].Value.ToString(); if (String.IsNullOrEmpty(strMrId)) { return; } if (testStatusM(strMrId, 2) == false) { return; } UsePlanM um = new UsePlanM(); um.MrId = strMrId; um.Status = "2"; um.UpdateName = UserInfo.GetUserName(); um.UpdateUserid = UserInfo.GetUserID(); um.UpdateTime = DateTime.Now; if (MessageUtil.ShowYesNoAndQuestion("确定提报领用单:" + strMrId + "?") != DialogResult.Yes) { return; } CoreResult crt = this.execute("com.hnshituo.pur.requireplan.service.UsePlanMService", "doHandleM", new object[] { um }); if (crt.Resultcode != 0) { MessageUtil.ShowTips("操作失败:"+crt.Resultmsg); return; } MessageUtil.ShowTips("操作成功"); getUserPlanM(strMrId); } #endregion #region 界面事件 /// /// 输入领用数量,计算总价 /// /// /// private void ultraGrid1_CellChange(object sender, CellEventArgs e) { UltraGridRow row = e.Cell.Row; if (e.Cell.Column.Key == "useQtyReq" && e.Cell.Row.HasParent()) { double bQtyOld = 0; double.TryParse(e.Cell.Value.ToString(), out bQtyOld); ultraGrid1.UpdateData(); //if (txt_InvPhysic.SelectedIndex==-1||txt_InvPhysic.SelectedIndex==0) //{ // MessageUtil.ShowTips("请选择待领料的仓库"); // txt_InvPhysic.Focus(); // e.Cell.Value = bQtyOld; // return; //} //if (txt_ItemClass.SelectedIndex == -1 || txt_ItemClass.SelectedIndex ==0) //{ // MessageUtil.ShowTips("请选择待领用物料中类"); // txt_ItemClass.Focus(); // e.Cell.Value = bQtyOld; // return; //} double canUseQty = 0; double noticeQtyReq = 0; double.TryParse(row.ParentRow.GetCellValue("canUseQty").ToString(), out canUseQty); double.TryParse(row.GetCellValue("QTYYCUSEABLE").ToString(), out noticeQtyReq); double bQtyNew = 0; double.TryParse(e.Cell.Value.ToString(), out bQtyNew); if (noticeQtyReq < bQtyNew) { MessageUtil.ShowTips("不能大于需求计划的可领用量"); e.Cell.Value = bQtyOld; return; } double allUseQty = 0;//全部编制量 foreach (UltraGridRow row1 in row.ParentRow.ChildBands[0].Rows) { double singleQty = 0; double.TryParse(row1.GetCellValue("useQtyReq").ToString(), out singleQty); allUseQty = allUseQty + singleQty; } if (canUseQty < allUseQty) { MessageUtil.ShowTips("不能大于采购计划的最大可编制量"); e.Cell.Value = bQtyOld; return; } row.ParentRow.Cells["UseQty"].Value = allUseQty; double bBugprice = 0;//计划价 double.TryParse(row.ParentRow.Cells["Bugprice"].Value.ToString(), out bBugprice); double bPriceaverage = 0;//采购平均价 double.TryParse(row.ParentRow.Cells["BUDGETAMT"].Value.ToString(), out bPriceaverage); row.ParentRow.Cells["bugpriceamt"].Value = allUseQty * bBugprice; row.ParentRow.Cells["priceaverageAMT"].Value = allUseQty * bPriceaverage; } else if (e.Cell.Column.Key == "REMARKUSE") { //if (txt_InvPhysic.Value == null) //{ // MessageUtil.ShowTips("请选择待领料的仓库"); // txt_InvPhysic.Focus(); // return; //} //if (txt_ItemClass.SelectedIndex == -1) //{ // MessageUtil.ShowTips("请选择待领用物料中类"); // txt_ItemClass.Focus(); // return; //} } e.Cell.Row.Activated = true; } /// /// 查询领用单数据 /// /// /// private void ultraGrid2_AfterRowActivate(object sender, EventArgs e) { UltraGridRow uge = ultraGrid2.ActiveRow; if (uge == null) return; UsePlanD pupe = new UsePlanD(); pupe.MrId = uge.Cells["MRID"].Value.ToString(); pupe.Validflag = "1"; if (String.IsNullOrEmpty(pupe.MrId)) { return; } DataTable dt = this.execute("com.hnshituo.pur.requireplan.service.UsePlanDService", "getUsePlanD", new object[] { pupe }); foreach (DataRow row in dt.Rows) { if (row["ITEMUOM"].ToString() == "基吨") { row["ITEMUOM"] = "吨"; } } GridHelper.CopyDataToDatatable(dt, dataTable3, true); GridHelper.RefreshAndAutoSize(ultraGrid3); //UsePlanM up = this.execute("com.hnshituo.pur.requireplan.service.UsePlanMService", "findById", new object[] { pupe.MrId }); //if (up == null) //{ // MessageUtil.ShowTips("未发现领料单头:" + pupe.MrId + "信息记录"); // return; //} //txt_InvPhysic.Value = up.InvPhysic; //txt_ItemClass.Value = up.ItemClass; getCanUseData(); } /// /// 查询时间控制 /// /// /// private void ck_ctime_CheckedChanged(object sender, EventArgs e) { if (ck_ctime.Checked == false) { txtCreateTimeEnd.Enabled = false; txtCreateTimeStart.Enabled = false; } else { txtCreateTimeEnd.Enabled = true; txtCreateTimeStart.Enabled = true; } } #endregion #region 公共函数 /// /// 查询可领用数据 /// private void getCanUseData() { dataSet1.Clear(); UltraGridRow uge = ultraGrid2.ActiveRow; if (uge == null) return; UsePlanD pupe = new UsePlanD(); String strMrid = uge.Cells["MRID"].Value.ToString(); UsePlanM up = this.execute("com.hnshituo.pur.requireplan.service.UsePlanMService", "findById", new object[] { strMrid }); if (up == null) { MessageUtil.ShowTips("未发现领料单头:" + strMrid + "信息记录"); return; } //txt_InvPhysic.Value = up.InvPhysic; //txt_ItemClass.Value = up.ItemClass; EntityPurPlanD pd = new EntityPurPlanD(); if (String.IsNullOrEmpty(up.ItemClass)) { MessageUtil.ShowTips("领用单物料类别不能为空"); return; } if (String.IsNullOrEmpty(up.InvPhysic)) { MessageUtil.ShowTips("领用单库区不能为空"); return; } if (String.IsNullOrEmpty(up.ReqOrgId)) { MessageUtil.ShowTips("领用单需求部门不能为空"); return; } if (showType == "1") { pd.UpdateName = up.ReqOrgId; } pd.ItemDescE = up.ItemClass; pd.DeleteName = up.InvPhysic; pd.ItemCode = txt_itemCode.Text.Trim(); pd.ItemName = txt_itemName.Text.Trim(); DataTable dt = this.execute("com.hnshituo.pur.purplan.service.PurPlanDService", "getCanOutBillPlanD", new object[] { pd }); DataTable dt2 = this.execute("com.hnshituo.pur.purplan.service.PurPlanDService", "getCanOutBillPlanRe1", new object[] { pd }); GridHelper.CopyDataToDatatable(dt, dataTable1, true); GridHelper.CopyDataToDatatable(dt2, dataTable4, true); foreach (DataRow rowq in dataTable1.Rows) { double QtyPur = 0; double QtyInstock = 0; double QtyReq = 0; double QtyUse = 0; double QtyWill = 0; double QtyReqPur = 0; double QtyLjh = 0; double.TryParse(rowq["qty"].ToString(), out QtyPur);//采购计划数量 double.TryParse(rowq["QTYLJH"].ToString(), out QtyLjh);//挂单量 double.TryParse(rowq["qtyYcUseable"].ToString(), out QtyInstock);//库存量 double.TryParse(rowq["qtyYc"].ToString(), out QtyReq);//通知发货量---生产厂 double.TryParse(rowq["qtyYcUsed"].ToString(), out QtyUse);//已经领用量(所有部门) double.TryParse(rowq["QTYPURED"].ToString(), out QtyWill);//待领用量(所有部门) //double.TryParse(rowq["QTYLK"].ToString(), out QtyReqPur);//采购核准量 double canUseQty = QtyInstock;//-----供应部可全部编制 if (showType == "1") { canUseQty = Math.Min(Math.Min(QtyPur, (QtyInstock - QtyLjh - QtyWill)), (QtyReq - QtyUse - QtyWill+QtyLjh));//------生产厂只能部分编制 //canUseQty = Math.Min(QtyPur, (Math.Min((QtyInstock - QtyWill), (QtyReq - QtyUse - QtyWill + QtyLjh)))); } else { canUseQty = QtyInstock - QtyWill;//------生产厂只能部分编制 } if (canUseQty <= 0) { rowq["canUseQty"] = 0; } else { rowq["canUseQty"] = canUseQty; } if (rowq["itemuom"].ToString() == "基吨") { rowq["itemuom"] = "吨"; } } GridHelper.RefreshAndAutoSizeExceptColumns(ultraGrid1, new UltraGridColumn[] { ultraGrid1.DisplayLayout.Bands[0].Columns["check"], ultraGrid1.DisplayLayout.Bands[0].Columns["UseQty"], ultraGrid1.DisplayLayout.Bands[0].Columns["REMARKUSE"] }); } /// /// 查询领用单主表 /// private void getUserPlanM(String strMrId) { dataSet1.Clear(); LYM.Clear(); LYC.Clear(); UsePlanM pupe = new UsePlanM(); pupe.Status = txt_status_LY.Value == null ? "" : txt_status_LY.Value.ToString().Trim(); pupe.MrId = txt_mrId_LY.Text.Trim(); if (showType == "1") { pupe.ApplyReqOrgId = UserInfo.GetDeptid(); } if (ck_ctime.Checked == true) { if (txtCreateTimeStart.Text != "") { pupe.CreateTime = Convert.ToDateTime(txtCreateTimeStart.Value); } if (txtCreateTimeEnd.Text != "") { pupe.DeleteTime = Convert.ToDateTime(txtCreateTimeEnd.Value); } } DataTable dt = this.execute("com.hnshituo.pur.requireplan.service.UsePlanMService", "find_UsePlanM", new object[] { pupe }); GridHelper.CopyDataToDatatable(dt, dataTable2, true); GridHelper.RefreshAndAutoSize(ultraGrid2); if (!String.IsNullOrEmpty(strMrId)) { publicPms.doActiveSelRow(ultraGrid2, "mrId", strMrId); } } /// /// 校验状态 /// /// /// private bool testStatusM(string strMrId, int i) { UsePlanM up = this.execute("com.hnshituo.pur.requireplan.service.UsePlanMService", "findById", new object[] { strMrId }); if (up == null) { MessageUtil.ShowTips("未发现领料单头:" + strMrId + "信息记录"); return false; } if (up.Validflag != "1") { MessageUtil.ShowTips("领料单头:" + strMrId + "信息记录可能已作废"); return false; } if (up.CreateUserid != UserInfo.GetUserID()) { MessageUtil.ShowTips("非本人创建领料单,无权限进行操作"); return false; } //新增行 if (i == 1) { if (up.Status != "1" && up.Status != "9") { MessageUtil.ShowTips("非提报和退回状态无法增删改"); return false; } //UltraGridRow uge = ultraGrid2.ActiveRow; //if (uge == null) //{ // MessageUtil.ShowTips("请选择领料单头"); // return false; //} //String strinv = uge.Cells["invPhysic"].Value.ToString(); //String strclass = uge.Cells["ITEMCLASS"].Value.ToString(); //if (up.InvPhysic != strInvPhysic) //{ // MessageUtil.ShowTips("非库区:" + strinv + "[" + up.InvPhysic + "] 物料,无法添加"); // return false; //} //if (up.ItemClass != strItemClass) //{ // MessageUtil.ShowTips("非物料类别:" + strclass + "[" + up.ItemClass + "] 物料,无法添加"); // return false; //} } //完成移库操作 else if (i == 6) { if (up.Status != "5") { MessageUtil.ShowTips("库房未出库,无法确认领用"); return false; } } //撤回操作 else if (i == 11) { if (up.Status != "2") { MessageUtil.ShowTips("不在待确认状态,无法撤回"); return false; } } //删除操作 else if (i == 10) { if (up.Status != "1" && up.Status != "9") { MessageUtil.ShowTips("不在待提报或者退回状态,无法删除"); return false; } } //提报 else if (i == 2) { if (up.Status != "1" && up.Status != "9") { MessageUtil.ShowTips("不在待提报状态,无法删除"); return false; } UsePlanD pupe = new UsePlanD(); pupe.MrId = strMrId; pupe.Validflag = "1"; int count = this.execute("com.hnshituo.pur.requireplan.service.UsePlanDService", "count", new object[] { pupe }); if (count <= 0) { MessageUtil.ShowTips("请编制有效的行信息,无法删除"); return false; } } else { MessageUtil.ShowTips("未知参数"); return false; } return true; } #endregion #region 领用单行编辑区 /// /// 查询按钮 /// /// /// private void btn_doQuery_canUse_Click(object sender, EventArgs e) { getCanUseData(); } /// /// 添加按钮 /// /// /// private void btn_add_d_Click(object sender, EventArgs e) { try { UltraGridRow row = ultraGrid2.ActiveRow; if (row == null) return; String strMrId = row.Cells["MRID"].Value.ToString(); if (String.IsNullOrEmpty(strMrId)) { return; } UsePlanM up = this.execute("com.hnshituo.pur.requireplan.service.UsePlanMService", "findById", new object[] { strMrId }); if (up == null) { MessageUtil.ShowTips("未发现领料单头:" + strMrId + "信息记录"); return; } if (testStatusM(strMrId, 1)==false) { return; } ultraGrid1.UpdateData(); //领用计划主表 ArrayList al = new ArrayList(); foreach (UltraGridRow uge in ultraGrid1.Rows) { if (!(bool)uge.Cells["Check"].Value) { continue; } int i = 0; foreach (UltraGridRow ugc in uge.ChildBands[0].Rows) { String strpurlineid = uge.Cells["mrLineId"].Value.ToString(); String strReceiveId = ugc.Cells["ITEMSTANDARDSID"].Value.ToString(); String strRequireId = ugc.Cells["ITEMUOMID"].Value.ToString(); if (String.IsNullOrEmpty(strpurlineid)) { MessageUtil.ShowTips("物料【" + uge.Cells["ITEMNAME"].Value.ToString() + "】的采购计划行为空"); return; } if (String.IsNullOrEmpty(strRequireId)) { MessageUtil.ShowTips("物料【" + uge.Cells["ITEMNAME"].Value.ToString() + "】的需求计划行号为空"); return; } if (String.IsNullOrEmpty(strReceiveId)) { MessageUtil.ShowTips("物料【" + uge.Cells["ITEMNAME"].Value.ToString() + "】的需求标识为空"); return; } double bQty = 0; double.TryParse(ugc.Cells["useQtyReq"].Value.ToString(), out bQty); if (bQty <= 0) { continue; } i = i + 1; double bBugprice = 0;//计划价 double.TryParse(uge.Cells["Bugprice"].Value.ToString(), out bBugprice); double bPriceaverage = 0;//采购平均价 double.TryParse(uge.Cells["BUDGETAMT"].Value.ToString(), out bPriceaverage); UsePlanD Upd = new UsePlanD(); Upd.PurLineId = strpurlineid; Upd.Qty = bQty;//申请量 Upd.QtyUse = bQty;//统计量 Upd.QtyPur = 0;//领用量 Upd.Status = "1";//未出库 Upd.PriceWithoutTaxAverage = bPriceaverage; Upd.ReceiveId = strReceiveId; Upd.PurRequireLineId = strRequireId; Upd.Validflag = "1"; Upd.CreateName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName(); Upd.CreateTime = DateTime.Now; Upd.CreateUserid = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserID(); Upd.RemarkUse = uge.Cells["RemarkUse"].Value.ToString(); al.Add(Upd);//添加领用单行标 } if (i <= 0) { MessageUtil.ShowTips("物料【" + uge.Cells["ITEMNAME"].Value.ToString() + "】的未编制有效需求领用量"); return; } } if (al.Count < 1) { Core.Mes.Client.Comm.Tool.MessageUtil.ShowTips("请勾选需领用的物料"); return; } if (MessageUtil.ShowYesNoAndQuestion("确定给领用单:" + strMrId + " 新增物料?") != DialogResult.Yes) { return; } CoreResult crt = this.execute("com.hnshituo.pur.requireplan.service.UsePlanDService", "insert_D", new object[] { strMrId,al }); if (crt.Resultcode != 0) { Core.Mes.Client.Comm.Tool.MessageUtil.ShowTips("添加失败:" + crt.Resultmsg); return; } Core.Mes.Client.Comm.Tool.MessageUtil.ShowTips("添加成功!"); getUserPlan(strMrId); getCanUseData(); } catch (Exception ex) { MessageUtil.ShowTips("领用单生成失败!" + ex); return; } } /// /// 删除按钮 /// /// /// private void btn_delete_d_Click(object sender, EventArgs e) { try { UltraGridRow row = ultraGrid2.ActiveRow; if (row == null) return; String strMrId = row.Cells["MRID"].Value.ToString(); UsePlanM up = this.execute("com.hnshituo.pur.requireplan.service.UsePlanMService", "findById", new object[] { strMrId }); if (up == null) { MessageUtil.ShowTips("未发现领料单头:" + strMrId + "信息记录"); return; } if (String.IsNullOrEmpty(strMrId)) { return; } ultraGrid3.UpdateData(); //领用计划主表 ArrayList al = new ArrayList(); foreach (UltraGridRow uge in ultraGrid3.Rows) { if (!(bool)uge.Cells["CHK"].Value) { continue; } String strpurlineid = uge.Cells["mrLineId"].Value.ToString(); if (String.IsNullOrEmpty(strpurlineid)) { MessageUtil.ShowTips("物料【" + uge.Cells["ITEMNAME"].Value.ToString() + "】的领用单行号为空"); return; } UsePlanD Upd = new UsePlanD(); Upd.MrLineId = strpurlineid; Upd.Validflag = "0"; Upd.DeleteName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName(); Upd.DeleteTime = DateTime.Now; Upd.DeleteUserid= CoreFS.SA06.CoreUserInfo.UserInfo.GetUserID(); al.Add(Upd);//添加领用单行标 } if (al.Count < 1) { Core.Mes.Client.Comm.Tool.MessageUtil.ShowTips("请勾选需领用的物料"); return; } if (MessageUtil.ShowYesNoAndQuestion("确定删除上述共:"+al.Count+"条行信息?") != DialogResult.Yes) { return; } CoreResult crt = this.execute("com.hnshituo.pur.requireplan.service.UsePlanDService", "delete_D", new object[] { strMrId,al }); if (crt.Resultcode != 0) { Core.Mes.Client.Comm.Tool.MessageUtil.ShowTips("删除失败!" + crt.Resultmsg); return; } Core.Mes.Client.Comm.Tool.MessageUtil.ShowTips("删除成功!"); getUserPlan(strMrId); getCanUseData(); } catch (Exception ex) { MessageUtil.ShowTips("删除领用单行失败!" + ex); return; } } #endregion } }