void wMSM105MatGetBindingSource_CurrentChanged(object sender, EventArgs e) { WMS_M105_MatGet temp = this.wMSM105MatGetBindingSource.Current as WMS_M105_MatGet; if (temp != null) { this.wMSM105MatGetDetailBindingSource.DataSource = matGetService.GetMatDetailQuery().Where(a => a.RequestNo == temp.RequestNo).ToList(); } }
public void Create(WMS_M105_MatGet WMS_M105_MatGet) { WMS_M105_MatGet.CreateDt = DateTime.Now; tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User; WMS_M105_MatGet.CreateUser = tempUser.UserName; WMS_M105_MatGet.Validate(); this.WMS_M105_MatGetRepository.Add(WMS_M105_MatGet); this.runtimeService.Commit(); }
public void Update(WMS_M105_MatGet WMS_M105_MatGet) { WMS_M105_MatGet.ModifyDt = DateTime.Now; tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User; WMS_M105_MatGet.ModifyUser = tempUser.UserName; WMS_M105_MatGet.Validate(); var existstb_Sys_Menu = this.GetById(WMS_M105_MatGet.Id); this.WMS_M105_MatGetRepository.SetValues(WMS_M105_MatGet, existstb_Sys_Menu); this.runtimeService.Commit(); }
private void OpenForm(string formText, string btnCommand) { WMS_M105_MatGet temp = this.wMSM105MatGetBindingSource.Current as WMS_M105_MatGet; WMS105MatGetEditForm edit = new WMS105MatGetEditForm(temp, matGetService); edit.Text = formText; edit.Tag = btnCommand; if (edit.ShowDialog() != DialogResult.OK) { this.wMSM105MatGetBindingSource.CancelEdit(); } else { wMSM105MatGetBindingSource_CurrentChanged(null, null); } }
public override void OnBtnCommand(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { // MessageBox.Show(e.Item.Caption); //新增 if (e.Item.Caption == BtnCommandEnum.Add) { this.wMSM105MatGetBindingSource.AddNew(); WMS_M105_MatGet temp = this.wMSM105MatGetBindingSource.Current as WMS_M105_MatGet; 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_M105_MatGet tempData = this.wMSM105MatGetBindingSource.Current as WMS_M105_MatGet; matGetService.Delete(tempData.Id); this.wMSM105MatGetBindingSource.RemoveCurrent(); } } }
public WMS105MatGetEditForm(WMS_M105_MatGet inStore, IWMS_M105_MatGetService matGetService) { InitializeComponent(); this.tempData = inStore; this.matGetService = matGetService; }
public void Save(WMS_M105_MatGet matGet, List <WMS_M105_MatGetDetail> matDetailList) { tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User; var existslotTx = this.GetById(matGet.Id); if (existslotTx == null) { matGet.CompCode = tempUser.CompCode; matGet.CreateDt = DateTime.Now; matGet.CreateUser = tempUser.UserName; matGet.Validate(); this.WMS_M105_MatGetRepository.Add(matGet); } else { matGet.ModifyDt = DateTime.Now; matGet.ModifyUser = tempUser.UserName; matGet.Validate(); this.WMS_M105_MatGetRepository.SetValues(matGet, existslotTx); } if (matDetailList != null) { foreach (var detail in matDetailList) { var existstLotTxNG = this.WMS_M105_MatGetDetailRepository.GetByID(detail.Id); if (existstLotTxNG == null) { detail.CompCode = tempUser.CompCode; detail.CreateDt = DateTime.Now; detail.CreateUser = tempUser.UserName; detail.RequestNo = matGet.RequestNo; detail.Validate(); this.WMS_M105_MatGetDetailRepository.Add(detail); //更新库存 var matStore = this.WMS_M105_MatSotreRepository.GetMany(a => a.MatSpecCode == detail.MatSpecCode).SingleOrDefault(); if (matStore != null) { matStore.StoreAmount += detail.ReqQty; } else { matStore = new WMS_M105_MatSotre(); matStore.CompCode = detail.CompCode; matStore.MatSpecCode = detail.MatSpecCode; matStore.MatSpec = detail.MatSpec; matStore.MatType = detail.MatType; matStore.Suppode = detail.Suppode; matStore.StoreAmount = detail.ReqQty; this.WMS_M105_MatSotreRepository.Add(matStore); } } else { //更新库存 var matStore = this.WMS_M105_MatSotreRepository.GetMany(a => a.MatSpecCode == detail.MatSpecCode).SingleOrDefault(); if (matStore != null) { matStore.StoreAmount += (detail.ReqQty - existstLotTxNG.ReqQty); } else { matStore = new WMS_M105_MatSotre(); matStore.CompCode = detail.CompCode; matStore.MatSpecCode = detail.MatSpecCode; matStore.MatSpec = detail.MatSpec; matStore.MatType = detail.MatType; matStore.Suppode = detail.Suppode; matStore.StoreAmount = detail.ReqQty; this.WMS_M105_MatSotreRepository.Add(matStore); } this.WMS_M105_MatGetDetailRepository.SetValues(detail, existstLotTxNG); } } } this.runtimeService.Commit(); }