Beispiel #1
0
        public static CheckStockInfo_CE ToCE(CheckStockInfoEntity item)
        {
            CheckStockInfo_CE target = new CheckStockInfo_CE();

            target.ID         = item.ID;
            target.OrderNum   = item.OrderNum;
            target.StorageNum = item.StorageNum;
            target.TargetNum  = item.TargetNum;
            target.CreateTime = item.CreateTime;
            return(target);
        }
        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()));
        }
Beispiel #3
0
        public ActionResult Edit()
        {
            string orderNum = WebUtil.GetQueryStringValue <string>("OrderNum", string.Empty);
            Bill <CheckStockEntity, CheckStockInfoEntity> bill = new CheckOrder();
            CheckStockEntity entity = new CheckStockEntity();

            entity.OrderNum = orderNum;
            entity          = bill.GetOrder(entity);
            if (entity.IsNull())
            {
                return(Redirect("/Check/Product/List"));
            }
            string checkType = EnumHelper.GetOptions <ECheckType>(entity.Type);

            ViewBag.CheckType   = checkType;
            ViewBag.ProductType = EnumHelper.GetOptions <EProductType>(entity.ProductType);
            ViewBag.Entity      = entity;
            CheckStockInfoEntity info = new CheckStockInfoEntity();

            info.OrderNum = orderNum;
            List <CheckStockInfoEntity> list = bill.GetOrderDetail(info);

            List <ProductEntity> ListProducts = new List <ProductEntity>();
            List <ProductEntity> ListSource   = new ProductProvider().GetListByCache();

            if (!list.IsNullOrEmpty())
            {
                Parallel.ForEach(list, item =>
                {
                    if (ListSource.Exists(a => a.SnNum == item.TargetNum))
                    {
                        ProductEntity target = ListSource.FirstOrDefault(a => a.SnNum == item.TargetNum);
                        ListProducts.Add(target);
                    }
                });
            }
            Session[CacheKey.JOOSHOW_CHECKDETAIL_CACHE] = ListProducts;
            return(View());
        }