public ActionResult Query(ERP_M001_Product model) { SetPage(); var result = productService.GetList(PageModel); //var result = from a in entity.UserInfoes // join b in entity.CompanyInfoes on a.CompCode equals b.CompCode // select // new UserInfoDto() // { // CompCode = b.Name, // UserCode = a.UserCode, // UserName = a.UserName, // Position = a.Position, // Phone = a.Phone, // Mail = a.Mail, // BirthDay = a.BirthDay, // Remarks = a.Remarks, // CreateDt = a.CreateDt, // CreateUser = a.CreateUser // }; //result = result.OrderBy(a => a.CreateDt).Skip((MyPage.Page - 1)*MyPage.PageSize).Take(MyPage.PageSize); return(ToDataGridResult(result, PageModel.ItemCount)); }
public override void OnBtnCommand(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { // MessageBox.Show(e.Item.Caption); //新增 if (e.Item.Caption == BtnCommandEnum.Add) { eRPM001ProductBindingSource.AddNew(); ERP_M001_Product temp = eRPM001ProductBindingSource.Current as ERP_M001_Product; //temp.PartType = treeCodeType.FocusedNode[treeColumnCode] != null ? treeCodeType.FocusedNode[treeColumnCode].ToString() : null; //temp.CompCode = "K10"; EditForm("产品资料新增", BtnCommandEnum.Add); } else if (e.Item.Caption == BtnCommandEnum.Edit) { EditForm("产品资料修改", BtnCommandEnum.Edit); } else if (e.Item.Caption == BtnCommandEnum.Delete) { if (ERPHelper.Instance.MessageDel()) { ERP_M001_Product temp = eRPM001ProductBindingSource.Current as ERP_M001_Product; productService.Delete(temp.Id); eRPM001ProductBindingSource.RemoveCurrent(); } } }
public void Update(ERP_M001_Product ERP_M001_Product) { ERP_M001_Product.ModifyDt = DateTime.Now; tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User; ERP_M001_Product.ModifyUser = tempUser.UserName; ERP_M001_Product.Validate(); var existstb_Sys_Menu = this.GetById(ERP_M001_Product.Id); this.ERP_M001_ProductRepository.SetValues(ERP_M001_Product, existstb_Sys_Menu); this.runtimeService.Commit(); }
public void Create(ERP_M001_Product ERP_M001_Product) { ERP_M001_Product.CreateDt = DateTime.Now; tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User; ERP_M001_Product.CreateUser = tempUser.UserName; ERP_M001_Product.CompCode = tempUser.CompCode; ERP_M001_Product.Validate(); this.ERP_M001_ProductRepository.Add(ERP_M001_Product); //foreach (var custpack in productViewModel.CustPackList) // this.custPackRepository.Add(custpack); this.runtimeService.Commit(); }
/// <summary> /// 产品行改变 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void eRPM001ProductBindingSource_CurrentChanged(object sender, EventArgs e) { ERP_M001_Product temp = eRPM001ProductBindingSource.Current as ERP_M001_Product ?? new ERP_M001_Product(); if (temp != null) { this.eRPM001ProductMaterialBindingSource.DataSource = productService.GetMaterialByProdutCode(temp.PartNo); this.eRPM001ProductPackInfoBindingSource.DataSource = productService.GetPackInfoByPartNo(temp.PartNo); this.eRPM001ProductSemiProductBindingSource.DataSource = productService.GetProductSemiByPartNo(temp.PartNo); this.eRPM001ProductProcessFlowBindingSource.DataSource = productService.GetProcessFlowByProdutCode(temp.PartNo).OrderBy(a => a.ProcessSeqNo).ToList(); this.eRPM001ProductProdInfoBindingSource.DataSource = productService.GetProdInfoByProdutCode(temp.PartNo).OrderBy(a => a.TechSeqNo).ToList(); this.gridMaterial.BestFitColumns(); this.gridPacking.BestFitColumns(); this.gridSemi.BestFitColumns(); this.gridProcess.BestFitColumns(); this.gridProdInfo.BestFitColumns(); } }
private void EditForm(string formText, string btnCommand) { ERP_M001_Product temp = eRPM001ProductBindingSource.Current as ERP_M001_Product; ProductEditForm edit = new ProductEditForm(temp, productService); edit.Text = formText; edit.Tag = btnCommand; if (edit.ShowDialog() != DialogResult.OK) { eRPM001ProductBindingSource.CancelEdit(); InitData(); } else { eRPM001ProductBindingSource_CurrentChanged(null, null); } }
public void Save(ERP_M001_Product ERP_M001_Product, List <ERP_M001_Product_Material> materialList, List <ERP_M001_Product_PackInfo> packInfoList, List <ERP_M001_Product_SemiProduct> semiProdList, List <ERP_M001_Product_ProcessFlow> processList, List <ERP_M001_Product_ProdInfo> prodInfoList) { tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User; var existsProduct = this.GetById(ERP_M001_Product.Id); if (existsProduct == null) { var existPartNo = this.GetByPartNo(ERP_M001_Product.PartNo); if (existPartNo != null) { throw new AppException("产品代号已存在,请检查"); } ERP_M001_Product.CreateDt = DateTime.Now; ERP_M001_Product.CreateUser = tempUser.UserName; ERP_M001_Product.CompCode = tempUser.CompCode; ERP_M001_Product.Validate(); this.ERP_M001_ProductRepository.Add(ERP_M001_Product); } else { ERP_M001_Product.ModifyDt = DateTime.Now; ERP_M001_Product.ModifyUser = tempUser.UserName; ERP_M001_Product.Validate(); this.ERP_M001_ProductRepository.SetValues(ERP_M001_Product, existsProduct); } if (packInfoList != null) { //string sql = string.Format("Delete ERP_M001_Product_PackInfo where PartNo = '{0}'", ERP_M001_Product.PartNo); //this.packInfoRepository.GetDbContext().Database.ExecuteSqlCommand(sql); foreach (var packInfo in packInfoList) { var existsPackInfo = this.packInfoRepository.GetByID(packInfo.Id); if (existsPackInfo == null) { packInfo.CompCode = tempUser.CompCode; packInfo.CreateDt = DateTime.Now; packInfo.CreateUser = tempUser.UserName; packInfo.PartNo = ERP_M001_Product.PartNo; packInfo.Validate(); this.packInfoRepository.Add(packInfo); } else { packInfo.ModifyDt = DateTime.Now; packInfo.ModifyUser = tempUser.UserName; packInfo.Validate(); this.packInfoRepository.SetValues(packInfo, existsPackInfo); } } } if (materialList != null) { //string sql = string.Format("Delete ERP_M001_Product_Material where ProductCode = '{0}'", ERP_M001_Product.PartNo); //this.materialRepository.GetDbContext().Database.ExecuteSqlCommand(sql); foreach (var material in materialList) { var existsmaterial = this.materialRepository.GetByID(material.Id); if (existsmaterial == null) { material.CompCode = tempUser.CompCode; material.CreateDt = DateTime.Now; material.CreateUser = tempUser.UserName; material.ProductCode = ERP_M001_Product.PartNo; material.Validate(); this.materialRepository.Add(material); } else { material.ModifyDt = DateTime.Now; material.ModifyUser = tempUser.UserName; material.Validate(); this.materialRepository.SetValues(material, existsmaterial); } } } if (semiProdList != null) { //string sql = string.Format("Delete ERP_M001_Product_SemiProduct where PartNo = '{0}'", ERP_M001_Product.PartNo); //this.semiProductRepository.GetDbContext().Database.ExecuteSqlCommand(sql); foreach (var semiProd in semiProdList) { var existssemiProd = this.semiProductRepository.GetByID(semiProd.Id); if (existssemiProd == null) { semiProd.CompCode = tempUser.CompCode; semiProd.CreateDt = DateTime.Now; semiProd.CreateUser = tempUser.UserName; semiProd.PartNo = ERP_M001_Product.PartNo; semiProd.Validate(); this.semiProductRepository.Add(semiProd); } else { semiProd.ModifyDt = DateTime.Now; semiProd.ModifyUser = tempUser.UserName; semiProd.Validate(); this.semiProductRepository.SetValues(semiProd, existssemiProd); } } } if (processList != null) { string sql = string.Format("Delete ERP_M001_Product_Process where PartNo = '{0}'", ERP_M001_Product.PartNo); this.processFlowRepository.GetDbContext().Database.ExecuteSqlCommand(sql); foreach (var processDetail in processList) { processDetail.PartNo = ERP_M001_Product.PartNo; processDetail.PFCode = ERP_M001_Product.ProcessFlow; processDetail.CompCode = tempUser.CompCode; processDetail.PartNo = ERP_M001_Product.PartNo; processDetail.Validate(); this.processFlowRepository.Add(processDetail); } } if (prodInfoList != null) { string sql = string.Format("Delete ERP_M001_Product_ProdInfo where PartNo = '{0}'", ERP_M001_Product.PartNo); prodInfoReopsitory.GetDbContext().Database.ExecuteSqlCommand(sql); foreach (var prodInfo in prodInfoList) { prodInfo.CompCode = ERP_M001_Product.PartNo; prodInfo.PFCode = ERP_M001_Product.ProcessFlow; prodInfo.CompCode = tempUser.CompCode; prodInfo.PartNo = ERP_M001_Product.PartNo; prodInfo.Validate(); this.prodInfoReopsitory.Add(prodInfo); } } this.runtimeService.Commit(); }
public void Save(ERP_M001_Product ERP_M001_Product, List <ERP_M001_Product_Material> materialList, List <ERP_M001_Product_PackInfo> packInfoList, List <ERP_M001_Product_SemiProduct> semiProdList) { tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User; var existsProduct = this.GetById(ERP_M001_Product.Id); if (existsProduct == null) { ERP_M001_Product.CreateDt = DateTime.Now; ERP_M001_Product.CreateUser = tempUser.UserName; ERP_M001_Product.CompCode = tempUser.CompCode; ERP_M001_Product.Validate(); this.ERP_M001_ProductRepository.Add(ERP_M001_Product); } else { ERP_M001_Product.ModifyDt = DateTime.Now; ERP_M001_Product.ModifyUser = tempUser.UserName; ERP_M001_Product.Validate(); this.ERP_M001_ProductRepository.SetValues(ERP_M001_Product, existsProduct); } if (packInfoList != null) { foreach (var file in packInfoList) { var existstfile = this.packInfoRepository.GetByID(file.Id); if (existstfile == null) { file.CompCode = tempUser.CompCode; file.CreateDt = DateTime.Now; file.CreateUser = tempUser.UserName; file.Validate(); this.packInfoRepository.Add(file); } else { file.ModifyDt = DateTime.Now; file.ModifyUser = tempUser.UserName; file.Validate(); this.packInfoRepository.SetValues(file, existstfile); } } } if (materialList != null) { foreach (var material in materialList) { var existstmaterial = this.materialRepository.GetByID(material.Id); if (existstmaterial == null) { material.CompCode = tempUser.CompCode; material.CreateDt = DateTime.Now; material.CreateUser = tempUser.UserName; material.Validate(); this.materialRepository.Add(material); } else { material.ModifyDt = DateTime.Now; material.ModifyUser = tempUser.UserName; material.Validate(); this.materialRepository.SetValues(material, existstmaterial); } } } if (semiProdList != null) { foreach (var processFlow in semiProdList) { var existsttemp = this.semiProductRepository.GetByID(processFlow.Id); if (existsttemp == null) { processFlow.CompCode = tempUser.CompCode; processFlow.CreateDt = DateTime.Now; processFlow.CreateUser = tempUser.UserName; processFlow.Validate(); this.semiProductRepository.Add(processFlow); } else { processFlow.ModifyDt = DateTime.Now; processFlow.ModifyUser = tempUser.UserName; processFlow.Validate(); this.semiProductRepository.SetValues(processFlow, existsttemp); } } } this.runtimeService.Commit(); }
public ProductEditForm(ERP_M001_Product tempData, IProductService productService) { InitializeComponent(); this.productService = productService; this.tempData = tempData; }