public ActionResult Save() { int Type = WebUtil.GetFormValue <int>("Type", (int)ECheckType.Local); int ProductType = WebUtil.GetFormValue <int>("ProductType", (int)EProductType.Goods); string ContractOrder = WebUtil.GetFormValue <string>("ContractOrder", string.Empty); DateTime CreateTime = WebUtil.GetFormValue <DateTime>("CreateTime", DateTime.Now); string Remark = WebUtil.GetFormValue <string>("Remark", string.Empty); string TargetNum = WebUtil.GetFormValue <string>("TargetNum", string.Empty); CheckStockEntity entity = new CheckStockEntity(); string orderNum = SequenceProvider.GetSequence(typeof(CheckStockEntity)); entity.OrderNum = orderNum; entity.Type = Type; entity.ProductType = ProductType; entity.ContractOrder = ContractOrder; entity.Status = (int)EAudite.Wait; entity.IsDelete = (int)EIsDelete.NotDelete; entity.CreateTime = CreateTime; entity.CreateUser = this.LoginUser.UserCode; entity.OperateType = (int)EOpType.PC; entity.IsComplete = (int)EBool.No; entity.Remark = Remark; entity.StorageNum = this.DefaultStore; List <ProductEntity> ListProducts = Session[CacheKey.JOOSHOW_CHECKDETAIL_CACHE] as List <ProductEntity>; ListProducts = ListProducts.IsNull() ? new List <ProductEntity>() : ListProducts; List <CheckStockInfoEntity> listDetail = new List <CheckStockInfoEntity>(); string storageNum = this.DefaultStore; foreach (ProductEntity key in ListProducts) { CheckStockInfoEntity detail = new CheckStockInfoEntity(); detail.OrderNum = orderNum; detail.TargetNum = key.SnNum; detail.StorageNum = storageNum; detail.CreateTime = DateTime.Now; listDetail.Add(detail); } Bill <CheckStockEntity, CheckStockInfoEntity> bill = new CheckOrder(); string returnValue = bill.Create(entity, listDetail); if (returnValue == EnumHelper.GetEnumDesc <EReturnStatus>(EReturnStatus.Success)) { this.ReturnJson.AddProperty("Key", "1000"); this.ReturnJson.AddProperty("Value", "盘点单创建成功"); } return(Content(this.ReturnJson.ToString())); }
/// <summary> /// 新增盘点单 /// </summary> /// <returns></returns> public ActionResult Create() { string CompanyID = WebUtil.GetFormValue <string>("CompanyID", string.Empty); InventoryOrderEntity entity = WebUtil.GetFormObject <InventoryOrderEntity>("Entity"); List <InventoryDetailEntity> list = WebUtil.GetFormObject <List <InventoryDetailEntity> >("List"); entity.SnNum = ConvertHelper.NewGuid(); entity.ProductType = (int)EProductType.Goods; entity.Status = (int)EAudite.Wait; entity.IsDelete = (int)EIsDelete.NotDelete; entity.CreateTime = DateTime.Now; entity.CompanyID = entity.CompanyID.IsEmpty() ? CompanyID : entity.CompanyID; entity.EquipmentNum = ""; entity.EquipmentCode = ""; Bill <InventoryOrderEntity, InventoryDetailEntity> bill = new CheckOrder(CompanyID); string returnValue = bill.Create(entity, list); DataResult result = new DataResult(); if (EnumHelper.GetEnumDesc <EReturnStatus>(EReturnStatus.Success) == returnValue) { result.Code = (int)EResponseCode.Success; result.Message = "盘点单创建成功"; } else if (returnValue == "1001") { result.Code = (int)EResponseCode.Exception; result.Message = "该仓库存在一个正在作业的盘点任务"; } else { result.Code = (int)EResponseCode.Exception; result.Message = "盘点单创建失败"; } return(Content(JsonHelper.SerializeObject(result))); }
public ActionResult Save() { int Type = WebUtil.GetFormValue<int>("Type", (int)ECheckType.Local); int ProductType = WebUtil.GetFormValue<int>("ProductType", (int)EProductType.Goods); string ContractOrder = WebUtil.GetFormValue<string>("ContractOrder", string.Empty); DateTime CreateTime = WebUtil.GetFormValue<DateTime>("CreateTime", DateTime.Now); string Remark = WebUtil.GetFormValue<string>("Remark", string.Empty); string TargetNum = WebUtil.GetFormValue<string>("TargetNum", string.Empty); CheckStockEntity entity = new CheckStockEntity(); string orderNum = SequenceProvider.GetSequence(typeof(CheckStockEntity)); entity.OrderNum = orderNum; entity.Type = Type; entity.ProductType = ProductType; entity.ContractOrder = ContractOrder; entity.Status = (int)EAudite.Wait; entity.IsDelete = (int)EIsDelete.NotDelete; entity.CreateTime = CreateTime; entity.CreateUser = this.LoginUser.UserCode; entity.OperateType = (int)EOpType.PC; entity.IsComplete = (int)EBool.No; entity.Remark = Remark; entity.StorageNum = this.DefaultStore; List<ProductEntity> ListProducts = Session[CacheKey.JOOSHOW_CHECKDETAIL_CACHE] as List<ProductEntity>; ListProducts = ListProducts.IsNull() ? new List<ProductEntity>() : ListProducts; List<CheckStockInfoEntity> listDetail = new List<CheckStockInfoEntity>(); string storageNum = this.DefaultStore; foreach (ProductEntity key in ListProducts) { CheckStockInfoEntity detail = new CheckStockInfoEntity(); detail.OrderNum = orderNum; detail.TargetNum = key.SnNum; detail.StorageNum = storageNum; detail.CreateTime = DateTime.Now; listDetail.Add(detail); } Bill<CheckStockEntity, CheckStockInfoEntity> bill = new CheckOrder(); string returnValue = bill.Create(entity, listDetail); if (returnValue == EnumHelper.GetEnumDesc<EReturnStatus>(EReturnStatus.Success)) { this.ReturnJson.AddProperty("Key", "1000"); this.ReturnJson.AddProperty("Value", "盘点单创建成功"); } return Content(this.ReturnJson.ToString()); }