public IActionResult UpdateOrder(Order order) { var oldOrder = _BJDbContext.Find <Order>(order.Id); oldOrder.CompanyName = order.CompanyName; oldOrder.WorkerName = order.WorkerName; oldOrder.ModleNum = order.ModleNum; oldOrder.ProductName = order.ProductName; oldOrder.Size = order.Size; oldOrder.Count = order.Count; _BJDbContext.Update(oldOrder); _BJDbContext.SaveChanges(); return(RedirectToAction("OrderList")); }
public IActionResult ProductShip(Ship ship) { var success = true; var message = string.Empty; var order = _BJDbContext.Order.Find(int.Parse(ship.OrderId)); if (ship.Count > order.Count) { success = false; message = "出货量超出订单要求,请修改!"; } if (success) { ship.CreateDate = DateTime.Now; _BJDbContext.Add(ship); _BJDbContext.SaveChanges(); order.IsShip = true; _BJDbContext.Update(order); _BJDbContext.SaveChanges(); message = $"{order.CompanyName}的订单{order.ProductName}出货成功!"; } return(Json(new { success, message })); }
public IActionResult UpdateInventoryInfo(InventoryInfo inventoryInfo) { var inventory = _BJDbContext.InventoryInfo.Where(i => i.MaterialName == inventoryInfo.MaterialName && i.DepotSite == inventoryInfo.DepotSite && i.Id != inventoryInfo.Id).FirstOrDefault(); if (inventory != null) { inventory.RemainCount += inventoryInfo.RemainCount; inventory.TotalCount += inventoryInfo.TotalCount; inventory.Remark = inventoryInfo.Remark; inventory.UpdateDate = DateTime.Now; var oldInventoryInfo = _BJDbContext.Find <InventoryInfo>(inventoryInfo.Id); _BJDbContext.Remove(oldInventoryInfo); } else { var oldInventoryInfo = _BJDbContext.Find <InventoryInfo>(inventoryInfo.Id); oldInventoryInfo.MaterialName = inventoryInfo.MaterialName; oldInventoryInfo.RemainCount = inventoryInfo.RemainCount; oldInventoryInfo.TotalCount = inventoryInfo.TotalCount; oldInventoryInfo.DepotSite = inventoryInfo.DepotSite; oldInventoryInfo.Remark = inventoryInfo.Remark; oldInventoryInfo.UpdateDate = DateTime.Now; _BJDbContext.Update(oldInventoryInfo); } _BJDbContext.SaveChanges(); return(RedirectToAction("InventoryList")); }
public IActionResult UpdateInferiorProduct(BadPart badPart) { var oldBadPart = _BJDbContext.Find <BadPart>(badPart.Id); oldBadPart.BadCount = badPart.BadCount; _BJDbContext.Update(oldBadPart); _BJDbContext.SaveChanges(); return(RedirectToAction("InferiorProduct")); }
public IActionResult UpdateProcessInfo(ProcessInfo processInfo) { var oldProcessInfo = _BJDbContext.Find <ProcessInfo>(processInfo.Id); oldProcessInfo.WorkName = processInfo.WorkName; oldProcessInfo.EquipInfoId = processInfo.EquipInfoId; _BJDbContext.Update(oldProcessInfo); _BJDbContext.SaveChanges(); return(RedirectToAction("MaterialBill", "Order")); }