Example #1
0
        public IActionResult WarehouseOperation(Warehouse warehouse)
        {
            //增加入库记录
            warehouse.InDate = DateTime.Now;
            _BJDbContext.Warehouse.Add(warehouse);

            //修改库存信息
            var inventoryInfo = _BJDbContext.InventoryInfo.Where(i => i.MaterialName == warehouse.MaterialName &&
                                                                 i.DepotSite == warehouse.DepotSite).FirstOrDefault();

            if (inventoryInfo != null)
            {
                inventoryInfo.TotalCount  += warehouse.Count;
                inventoryInfo.RemainCount += warehouse.Count;
            }
            else
            {
                inventoryInfo = new InventoryInfo()
                {
                    DepotSite    = warehouse.DepotSite,
                    MaterialName = warehouse.MaterialName,
                    RemainCount  = warehouse.Count,
                    TotalCount   = warehouse.Count,
                    UpdateDate   = DateTime.Now
                };
                _BJDbContext.InventoryInfo.Add(inventoryInfo);
            }
            _BJDbContext.SaveChanges();

            return(RedirectToAction("InventoryList", "RawMaterial"));
        }
Example #2
0
 public IActionResult CreateInventoryInfo(InventoryInfo inventoryInfo)
 {
     inventoryInfo.UpdateDate = DateTime.Now;
     _BJDbContext.Add(inventoryInfo);
     _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 CreateProcessInfo(ProcessInfo processInfo)
 {
     processInfo.CreateDate = DateTime.Now;
     _BJDbContext.Add(processInfo);
     _BJDbContext.SaveChanges();
     return(RedirectToAction("MaterialBill", "Order"));
 }
 public IActionResult CreateOrder(Order order)
 {
     order.CreateDate  = DateTime.Now;
     order.OrderNumber = DateTime.Now.ToString("yyyyMMdd") + "_" + new Random().Next(1, 9999);
     _BJDbContext.Add(order);
     _BJDbContext.SaveChanges();
     return(RedirectToAction("OrderList"));
 }
        public IActionResult Register(string name, string password)
        {
            if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(password))
            {
                return(View());
            }

            var account = _BJDbContext.Account.Where(a => a.UserName == name && a.Password == password).FirstOrDefault();

            if (account != null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            account = new Account()
            {
                Password = password,
                UserName = name
            };
            _BJDbContext.Add(account);
            _BJDbContext.SaveChanges();

            return(RedirectToAction("Login"));
        }