public void Create(WMS_C103_Stock WMS_C103_Stock) { WMS_C103_Stock.CreateDt = DateTime.Now; tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User; WMS_C103_Stock.CreateUser = tempUser.UserName; WMS_C103_Stock.Validate(); this.WMS_C103_StockRepository.Add(WMS_C103_Stock); this.runtimeService.Commit(); }
public void Update(WMS_C103_Stock WMS_C103_Stock) { WMS_C103_Stock.ModifyDt = DateTime.Now; tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User; WMS_C103_Stock.ModifyUser = tempUser.UserName; WMS_C103_Stock.Validate(); var existstb_Sys_Menu = this.GetById(WMS_C103_Stock.Id); this.WMS_C103_StockRepository.SetValues(WMS_C103_Stock, existstb_Sys_Menu); this.runtimeService.Commit(); }
private void OpenForm(string formText, string btnCommand) { WMS_C103_Stock temp = this.wMSC103StockBindingSource.Current as WMS_C103_Stock; StockEditForm edit = new StockEditForm(temp); edit.Text = formText; edit.Tag = btnCommand; if (edit.ShowDialog() != DialogResult.OK) { this.wMSC103StockBindingSource.CancelEdit(); } }
public override void OnBtnCommand(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { // MessageBox.Show(e.Item.Caption); //新增 if (e.Item.Caption == BtnCommandEnum.Add) { this.wMSC103StockBindingSource.AddNew(); OpenForm("库存资料新增", BtnCommandEnum.Add); } else if (e.Item.Caption == BtnCommandEnum.Edit) { OpenForm("库存资料修改", BtnCommandEnum.Edit); } else if (e.Item.Caption == BtnCommandEnum.Delete) { if (ERPHelper.Instance.MessageDel()) { WMS_C103_Stock user = this.wMSC103StockBindingSource.Current as WMS_C103_Stock; stockService.Delete(user.Id); this.wMSC103StockBindingSource.RemoveCurrent(); } } }
public void Save(WMS_C101_InStore instore, List <WMS_C102_InStoreDetail> instoreDetailList) { //if (instore.BeforeAmount < instore.ActualAmount) // throw new AppException("实际入库数不能大于计划入库数"); tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User; var existslotTx = this.GetById(instore.Id); if (existslotTx == null) { instore.CreateDt = DateTime.Now; instore.CreateUser = tempUser.UserName; instore.Validate(); this.WMS_C101_InStoreRepository.Add(instore); } else { instore.ModifyDt = DateTime.Now; instore.ModifyUser = tempUser.UserName; instore.Validate(); this.WMS_C101_InStoreRepository.SetValues(instore, existslotTx); } if (instoreDetailList != null) { foreach (var detail in instoreDetailList) { var existstLotTxNG = this.instoreDetailRepository.GetByID(detail.Id); if (existstLotTxNG == null) { detail.CreateDt = DateTime.Now; detail.CreateUser = tempUser.UserName; detail.Validate(); this.instoreDetailRepository.Add(detail); WMS_C103_Stock stock = new WMS_C103_Stock(); stock.InStoreDetailId = detail.Id; stock.InStoreId = detail.InStoreId; stock.StoreAmount = detail.Amount; stock.StockStatus = "合格"; stock.ARCode = detail.ARCode; stock.SuppLot = detail.SuppLot; stock.SuppCode = instore.SuppCode; stock.PartSpec = detail.PartSpec; stock.MatClass2 = detail.MatClass2; stock.CreateDt = DateTime.Now; stock.CreateUser = tempUser.UserName; this.stockRepository.Add(stock); } //else if (existstLotTxNG.Amount != detail.Amount) //{ // //如果已经入库的修改,则判断是否已经出库,如果已经出库,则不允许修改 // var stock = this.stockRepository.GetMany(i => i.InStoreDetailId == detail.Id).FirstOrDefault(); // if (stock != null) // { // var outstore = this.outstoreDetailRepository.GetMany(i => i.StockId == stock.Id).FirstOrDefault(); // if (outstore != null) // throw new AppException(string.Format("单号{0}在{1}已出库,不允许修改", detail.ARCode)); // else // { // //stock.LotNo = detail.LotNo; // stock.ARCode = detail.ARCode; // stock.StoreAmount = detail.Amount; // stock.ModifyDt = DateTime.Now; // stock.ModifyUser = tempUser.UserName; // stock.SuppLot = detail.SuppLot; // detail.Validate(); // this.instoreDetailRepository.SetValues(detail, existstLotTxNG); // } // } // //detail.Validate(); // // this.instoreDetailRepository.SetValues(detail, existstLotTxNG); //} } } this.runtimeService.Commit(); }
public StockEditForm(WMS_C103_Stock tempData) { InitializeComponent(); this.tempData = tempData; }