//更新采购单 public void UpdatePurchase(PurchaseViewModel model) { var purchase = _purchaseRepository.FindBy(x => x.PurchaseId == model.PurchaseId).Include(z => z.PurchaseApplication.Item).Include(z => z.PurchaseApplication.PurchaseApplicationHeader.RequestHeader).FirstOrDefault(); if (purchase == null) { return; } purchase.CurrentPurchasePrice = model.Price; purchase.ReadyForInStock = model.ReadyForInStock; if (Math.Abs(purchase.CurrentPurchasePrice - purchase.PurchaseApplication.Item.Price) > 0.00001) { purchase.IsPriceChange = true; } if (purchase.ReadyForInStock == purchase.PurchaseTotal) { if (purchase.PurchaseApplication.PurchaseApplicationHeader.RequestHeader.RequestCategory == RequestCategoriesEnum.材料需求) { purchase.Status = ProcessStatusEnum.采购完成; purchase.LastDeliveryDate = DateTime.Now; } else { purchase.Status = ProcessStatusEnum.退货申请完成; } } if (model.IsDeleted) { purchase.IsDeleted = true; purchase.PurchaseApplication.ProcessStatus = ProcessStatusEnum.申请审核中; purchase.PurchaseApplication.AuditStatus = AuditStatusEnum.未审批; purchase.Status = ProcessStatusEnum.申请审核中; } purchase.Note = model.Note; purchase.UpdateDate = DateTime.Now; purchase.DeliveryDate = model.DeliveryDate; purchase.CorrectionTotal = model.CorrectionTotal; _purchaseRepository.Edit(purchase); _purchaseRepository.Save(); UpdatePurchaseProcessStatus(purchase.PurchaseId, purchase.Status); }
public ActionResult Edit(int id) { if (repo.Edit(id) == null) { return(HttpNotFound()); } repo.DeleteConfirmed(id); return(RedirectToAction("Create", "Purchase")); }