public StockOutBill( WarehouseStockOut oStockOut, OrderInformation oOrder, List<StockOutSku> oOutSkus) { this.oStockOut = oStockOut; this.oOrder = oOrder; this.oOutSkus = oOutSkus; }
public ActionResult StockOutAddDB(WarehouseStockOut model) { if (!base.CheckPrivilege("EnablePrepare"))//制表权限验证 return RedirectToAction("ErrorPage", "Home", new { message = "Sorry you have no privilege to visit the Page" }); WarehouseStockOut newOut = (from o in dbEntity.WarehouseStockOuts where o.WhID == model.WhID && o.Code == model.Code select o).SingleOrDefault(); if (newOut == null) { newOut = new WarehouseStockOut { WhID = model.WhID, OutType = model.OutType, ShipID = model.ShipID, Remark = model.Remark, Prepared = CurrentSession.UserID }; ModelEnum.NoteType refType = GetRefType((Guid)model.OutType); if (refType != ModelEnum.NoteType.NONE && !model.RefID.HasValue) { return Error("关联单据号必填", Url.Action("StockOutAdd", new { whID = model.WhID })); } newOut.RefType = (byte)refType; if (refType != ModelEnum.NoteType.NONE) newOut.RefID = model.RefID; dbEntity.WarehouseStockOuts.Add(newOut); } else if (newOut.Deleted) { newOut.Deleted = false; newOut.OutType = model.OutType; newOut.ShipID = model.ShipID; newOut.Remark = model.Remark; ModelEnum.NoteType refType = GetRefType((Guid)model.OutType); newOut.RefType = model.RefType; if (model.RefType != (byte)ModelEnum.NoteType.NONE) newOut.RefID = model.RefID; } else { return Error("代码冲突", Url.Action("StockOutAdd", new { whID = model.WhID })); } dbEntity.SaveChanges(); return RedirectToAction("StockOutEdit", new { outID = newOut.Gid }); }
public ActionResult StockOutEditDB(WarehouseStockOut model) { if (!base.CheckPrivilege("EnablePrepare"))//制表权限验证 return RedirectToAction("ErrorPage", "Home", new { message = "Sorry you have no privilege to visit the Page" }); WarehouseStockOut stockOut = dbEntity.WarehouseStockOuts.Find(model.Gid); if (stockOut == null || stockOut.Deleted) { return Error("出库单不存在", Url.Action("StockOut")); } else if (model.Ostatus != (byte)ModelEnum.StockOutStatus.NONE) { return Error("出库单状态不正确", Url.Action("StockOut")); } else { stockOut.OutType = model.OutType; stockOut.ShipID = model.ShipID; stockOut.Remark = model.Remark; ModelEnum.NoteType refType = GetRefType((Guid)model.OutType); if (refType != ModelEnum.NoteType.NONE && !model.RefID.HasValue) { return Error("关联单据号必填", Url.Action("StockOut")); } stockOut.RefType = (byte)refType; if (refType != ModelEnum.NoteType.NONE) stockOut.RefID = model.RefID; dbEntity.SaveChanges(); return RedirectToAction("StockOut"); } }
/// <summary> /// 添加出库记录 /// </summary> /// <param name="whID">仓库ID</param> /// <returns></returns> public ActionResult StockOutAdd(Guid whID) { if (!base.CheckPrivilege("EnablePrepare"))//制表权限验证 return RedirectToAction("ErrorPage", "Home", new { message = "Sorry you have no privilege to visit the Page" }); WarehouseInformation warehouse = dbEntity.WarehouseInformations.Find(whID); if(warehouse == null || warehouse.Deleted) { return Error("仓库不存在", Url.Action("StockOut")); } else { Guid? SaleGid = (from cat in dbEntity.GeneralStandardCategorys where cat.Code == "Sale" && !cat.Deleted select cat.Gid).SingleOrDefault(); if (SaleGid == null) { return Error("标准分类出现异常", Url.Action("Index", "Home")); } WarehouseStockOut model = new WarehouseStockOut { WhID = whID, Warehouse = warehouse, OutType = SaleGid, RefType = (byte)ModelEnum.NoteType.ORDER, RefID = Guid.Empty }; #region 运输公司下拉列表 List<WarehouseShipping> shippings = (from shipping in dbEntity.WarehouseShippings .Include("Shipper.FullName") .Include("Shipper.FullName.ResourceItems") where shipping.WhID == whID && !shipping.Deleted select shipping).ToList(); List<SelectListItem> list = (from shipping in shippings select new SelectListItem { Text = shipping.Shipper.FullName.GetResource(CurrentSession.Culture), Value = shipping.ShipID.ToString() }).ToList(); ViewBag.Shippings = list; #endregion 运输公司下拉列表 #region 类型下拉列表 ViewBag.RefType = base.GetSelectList(model.RefTypeList); #endregion 类型下拉列表 return View(model); } }