private void BtnSave_Click(object sender, EventArgs e) { try { bs.EndEdit(); if (_bill.单据类型 != (int)BillType.OtherInOut) { MessageHelper.ShowError("请输入有效的单据类型!其他出入库单据类型为:" + (int)BillType.OtherInOut); return; } if (_bill.子单据类型 != (int)SubBillType.OtherIn) { MessageHelper.ShowError("维护的子单据类型无效!其他入库类型为:" + (int)SubBillType.OtherIn); return; } var detailList = (List <TB_OTHER_IN>)bs.DataSource; if (detailList.Count == 0) { MessageHelper.ShowError("请维护其他入库明细!"); return; } SpareEntities db = EntitiesFactory.CreateSpareInstance(); BillHandler.AddOtherIn(db, _bill.VWToBill(GlobalVar.Oper.DeptCode), detailList); EntitiesFactory.SaveDb(db); NotifyController.AddStockSafeQty(db, GlobalVar.Oper.OperName); MessageHelper.ShowInfo("保存成功!"); } catch (Exception ex) { MessageHelper.ShowInfo(ex.ToString()); } }
private void BtnDeliver_Click(object sender, EventArgs e) { if (_bill == null || _bill.单据编号 == null) { MessageHelper.ShowInfo("请选择单据"); return; } if (MessageHelper.ShowQuestion("确定要执行选定的领用单?") == DialogResult.Yes) { SpareEntities db = EntitiesFactory.CreateSpareInstance(); var outlist = SpareOutController.GetList(db, _bill.单据编号); foreach (var spout in outlist) { if (string.IsNullOrEmpty(spout.TakeUser)) { MessageHelper.ShowError("领用详细中的领用人信息不能为空!"); return; } } BillHandler.FinishMaterialOut(db, _bill.VWToBill(GlobalVar.Oper.DeptCode), outlist); EntitiesFactory.SaveDb(db); NotifyController.AddStockSafeQty(db, GlobalVar.Oper.OperName); MessageHelper.ShowInfo("保存成功!"); } }
private void btnExecute_Click(object sender, EventArgs e) { if (_bill == null || _bill.单据编号 == null) { MessageHelper.ShowInfo("请选择单据!"); return; } if (MessageHelper.ShowQuestion("确定要执行选定的领用还回单?") == DialogResult.Yes) { SpareEntities db = EntitiesFactory.CreateSpareInstance(); var returnlist = db.TB_RETURN.Where(p => p.BillNum == _bill.单据编号).ToList(); BillHandler.ExecuteSpareReturn(db, _bill.VWToBill(GlobalVar.Oper.DeptCode), returnlist); EntitiesFactory.SaveDb(db); NotifyController.AddStockSafeQty(db, GlobalVar.Oper.OperName); MessageHelper.ShowInfo("保存成功!"); } }
private void btnAdjust_Click(object sender, EventArgs e) { if (_bill == null || _bill.单据编号 == null) { MessageHelper.ShowInfo("请选择单据!"); return; } if (_bill.状态 != (int)BillState.New && _bill.状态 != (int)BillState.Handling) { MessageHelper.ShowError("非新建或执行中单据,禁止对库存进行调整!"); return; } if (MessageHelper.ShowQuestion("是否确定要对库存进行调整?") == DialogResult.Yes) { BillHandler.AdjustStockByInventoryLoc(_db, _bill.VWToBill(GlobalVar.Oper.DeptCode)); EntitiesFactory.SaveDb(_db); NotifyController.AddStockSafeQty(_db, GlobalVar.Oper.OperName); MessageHelper.ShowInfo("调整库存成功!"); SetMasterDataSource(grid.PageSize); } }