Пример #1
0
        public ActionResult AddProduct()
        {
            string ProductNum = WebUtil.GetFormValue<string>("SnNum", string.Empty);
            string BarCode = WebUtil.GetFormValue<string>("BarCode", string.Empty);
            string ProductName = WebUtil.GetFormValue<string>("ProductName", string.Empty);
            string BatchNum = WebUtil.GetFormValue<string>("ProductBatch", string.Empty);
            string LocalNum = WebUtil.GetFormValue<string>("LocalNum", string.Empty);
            string Size = WebUtil.GetFormValue<string>("Size", string.Empty);
            double LocalQty = WebUtil.GetFormValue<double>("LocalQty", 0);
            double Num = WebUtil.GetFormValue<double>("Num", 0);
            double InPrice = WebUtil.GetFormValue<double>("Price", 0);

            InStorDetailEntity entity = new InStorDetailEntity();
            entity.SnNum = SequenceProvider.GetSequence(typeof(InStorDetailEntity));
            entity.OrderNum = string.Empty;
            entity.ProductName = ProductName;
            entity.BarCode = BarCode;
            entity.ProductNum = ProductNum;
            entity.Num = Num;
            entity.IsPick = (int)EBool.No;
            entity.RealNum = 0;
            entity.InPrice = InPrice;
            entity.CreateTime = DateTime.Now;
            entity.LocalNum = LocalNum;
            LocationEntity localtion = new LocationProvider().GetSingleByNumCache(LocalNum);
            if (localtion != null)
            {
                entity.LocalName = new LocationProvider().GetSingleByNumCache(LocalNum).LocalName;
            }
            else
            {
                entity.LocalName = "";
            }
            entity.Amount = entity.InPrice * entity.Num;
            entity.StorageNum = this.DefaultPStore;
            entity.Size = Size;
            entity.BatchNum = BatchNum;
            entity.TotalPrice = entity.Num * entity.InPrice;
            List<InStorDetailEntity> list = Session[CacheKey.TEMPDATA_CACHE_INSTORDETAIL] as List<InStorDetailEntity>;
            list = list.IsNull() ? new List<InStorDetailEntity>() : list;
            list.Add(entity);
            Session[CacheKey.TEMPDATA_CACHE_INSTORDETAIL] = list;

            return Content(string.Empty);
        }
Пример #2
0
 public static InStorDetail_CE ToCE(InStorDetailEntity item)
 {
     InStorDetail_CE target = new InStorDetail_CE();
     target.ID=item.ID;
     target.SnNum=item.SnNum;
     target.OrderNum=item.OrderNum;
     target.ProductName=item.ProductName;
     target.BarCode=item.BarCode;
     target.ProductNum=item.ProductNum;
     target.BatchNum=item.BatchNum;
     target.Num=item.Num;
     target.IsPick=item.IsPick;
     target.RealNum=item.RealNum;
     target.InPrice=item.InPrice;
     target.Amount=item.Amount;
     target.CreateTime=item.CreateTime;
     target.LocalNum=item.LocalNum;
     target.StorageNum=item.StorageNum;
     return target;
 }
Пример #3
0
        public ActionResult Detail()
        {
            string orderNum = WebUtil.GetQueryStringValue<string>("orderNum",string.Empty);
            string flag = WebUtil.GetQueryStringValue<string>("flag", "1");
            Bill<InStorageEntity, InStorDetailEntity> bill = new InStorageOrder();
            InStorageEntity entity = new InStorageEntity();
            entity.OrderNum = orderNum;
            entity = bill.GetOrder(entity);
            entity=entity==null ? new InStorageEntity(): entity;
            entity.InTypeLable = EnumHelper.GetEnumDesc<EInType>(entity.InType);
            entity.StatusLable = EnumHelper.GetEnumDesc<EAudite>(entity.Status);
            ViewBag.InStorage=entity;
            ViewBag.Flag = flag;

            InStorDetailEntity detail=new InStorDetailEntity();
            detail.OrderNum=orderNum;
            List<InStorDetailEntity> list=bill.GetOrderDetail(detail);
            list = list == null ? new List<InStorDetailEntity>() : list;
            ViewBag.Detail = list;
            return View();
        }
Пример #4
0
        /// <summary>
        /// 编辑入库单详细数量
        /// </summary>
        /// <param name="snNum"></param>
        /// <param name="num"></param>
        /// <returns></returns>
        public int EditInOrderNum(string snNum, double num)
        {
            InStorDetailEntity detail = new InStorDetailEntity();
            detail = new InStorDetailEntity();
            detail.Include(a => new { a.OrderNum, a.Num, a.InPrice });
            detail.Where(a => a.SnNum == snNum);
            detail = this.InStorDetail.GetSingle(detail);

            int line = 0;
            if (detail != null)
            {
                InStorDetailEntity editEntity = new InStorDetailEntity();
                editEntity.IncludeNum(true).IncludeAmount(true);
                editEntity.Num = num;
                editEntity.Amount = num * detail.InPrice;
                editEntity.Where(a => a.SnNum == snNum);
                line = this.InStorDetail.Update(editEntity);

                string orderNum = detail.OrderNum;
                detail = new InStorDetailEntity();
                detail.IncludeNum(true).IncludeAmount(true);
                detail.Where(a => a.OrderNum == orderNum);
                List<InStorDetailEntity> list = this.InStorDetail.GetList(detail);

                double total = list.Sum(a => a.Num);
                double amount = list.Sum(a => a.Amount);
                InStorageEntity entity = new InStorageEntity();
                entity.Num = total;
                entity.Amount=amount;
                entity.IncludeNum(true).IncludeAmount(true);
                entity.Where(a => a.OrderNum == orderNum);

                line += this.InStorage.Update(entity);
            }
            return line;
        }
Пример #5
0
        public ActionResult Edit()
        {
            Session[CacheKey.TEMPDATA_CACHE_INSTORDETAIL] = null;
            string orderNum = WebUtil.GetQueryStringValue<string>("orderNum", string.Empty);
            Bill<InStorageEntity, InStorDetailEntity> bill = new InStorageOrder();
            InStorageEntity entity = new InStorageEntity();
            entity.OrderNum = orderNum;
            entity = bill.GetOrder(entity);
            entity = entity == null ? new InStorageEntity() : entity;
            entity.InTypeLable = EnumHelper.GetEnumDesc<EInType>(entity.InType);
            entity.StatusLable = EnumHelper.GetEnumDesc<EAudite>(entity.Status);
            ViewBag.InStorage = entity;
            ViewBag.InType = EnumHelper.GetOptions<EInType>(entity.InType, "请选择入库单类型");
            ViewBag.ProductType = EnumHelper.GetOptions<EProductType>(entity.Status, "请选择入库产品类型");

            InStorDetailEntity detail = new InStorDetailEntity();
            detail.OrderNum = orderNum;
            List<InStorDetailEntity> list = bill.GetOrderDetail(detail);
            list = list == null ? new List<InStorDetailEntity>() : list;
            if (list.IsNullOrEmpty() == false)
            {
                foreach (InStorDetailEntity item in list)
                {
                    item.Size = item.Size.IsEmpty() ? "" : item.Size;
                    item.Amount = item.Amount == 0 ? item.InPrice * item.Num : item.Amount;
                    item.TotalPrice = item.Amount;
                }
                Session[CacheKey.TEMPDATA_CACHE_INSTORDETAIL] = list;
            }
            ViewBag.Detail = list;
            return View();
        }