Esempio n. 1
0
        /// <summary>
        /// 修改出库单的数量
        /// </summary>
        /// <param name="snNum"></param>
        /// <param name="num"></param>
        /// <returns></returns>
        public int EditInOrderNum(string snNum, double num)
        {
            OutStoDetailEntity detail = new OutStoDetailEntity();
            detail = new OutStoDetailEntity();
            detail.Include(a => new { a.OrderNum, a.Num,a.OutPrice,a.Amount });
            detail.Where(a => a.SnNum == snNum);
            detail = this.OutStoDetail.GetSingle(detail);

            int line = 0;
            if (detail != null)
            {
                string orderNum = detail.OrderNum;
                OutStoDetailEntity editDetail = new OutStoDetailEntity();
                editDetail.Num = num;
                editDetail.Amount = editDetail.Num * editDetail.OutPrice;
                editDetail.IncludeNum(true).IncludeAmount(true);
                editDetail.Where(a => a.SnNum == snNum);
                line = this.OutStoDetail.Update(editDetail);

                OutStoDetailEntity orderDetail = new OutStoDetailEntity();
                orderDetail.Include(a => new { a.Num, a.Amount });
                orderDetail.Where(a => a.OrderNum == orderNum);
                List<OutStoDetailEntity> list = this.OutStoDetail.GetList(orderDetail);

                OutStorageEntity entity = new OutStorageEntity();
                entity.Num = list.Sum(a=>a.Num);
                entity.Amount = list.Sum(a => a.Amount);
                entity.IncludeNum(true).IncludeAmount(true);
                entity.Where(a => a.OrderNum == orderNum);
                line += this.OutStorage.Update(entity);
            }
            return line;
        }
        public ActionResult AddOrderDetailProduct([ModelBinder(typeof(JsonBinder<string[]>))] string[] ProductItems,
            [ModelBinder(typeof(JsonBinder<string[]>))] string[] SnItems,
            [ModelBinder(typeof(JsonBinder<int[]>))]int[] QtyItems)
        {
            List<OutStoDetailEntity> list = Session[CacheKey.TEMPDATA_CACHE_OUTSTORDETAIL] as List<OutStoDetailEntity>;
            list = list.IsNull() ? new List<OutStoDetailEntity>() : list;

            OrderProvider provider = new OrderProvider();
            for (int i = 0; i < ProductItems.Length; i++)
            {
                string snNum = SnItems[i];
                int qty = QtyItems[i];
                string productNum = ProductItems[i];
                OrderDetailEntity detail = provider.GetOrderDetailBySnNum(snNum);
                detail = detail.IsNull() ? new OrderDetailEntity() : detail;
                if (detail.IsNotNull())
                {
                    list.Remove(a => a.ContractSn == detail.SnNum);
                    OutStoDetailEntity entity = new OutStoDetailEntity();
                    entity.SnNum = SequenceProvider.GetSequence(typeof(OutStoDetailEntity));
                    entity.ProductName = detail.ProductName;
                    entity.BarCode = detail.BarCode;
                    entity.ContractOrder = detail.OrderNum;
                    entity.ContractSn = detail.SnNum;
                    entity.BatchNum = "";
                    entity.ProductNum = detail.ProductNum;
                    entity.LocalNum = ResourceManager.GetSettingEntity("STORE_DEFAULT_MATERIAL_LocalNum").Value;//detail.LocalNum;
                    entity.LocalName = ResourceManager.GetSettingEntity("STORE_DEFAULT_MATERIAL_LocalName").Value;//detail.LocalName;
                    entity.StorageNum = this.DefaultStore;
                    entity.Num = qty;
                    entity.IsPick = (int)EBool.No;
                    entity.Size = detail.Size.IsEmpty() ? "" : detail.Size;
                    entity.RealNum = detail.RealNum;
                    entity.OutPrice = 0;//detail.InPrice;
                    entity.Amount = 0;//detail.InPrice * entity.Num;
                    entity.CreateTime = DateTime.Now;
                    list.Add(entity);
                }
            }
            if (!list.IsNullOrEmpty())
            {
                Session[CacheKey.TEMPDATA_CACHE_OUTSTORDETAIL] = list;
            }
            return Content(string.Empty);
        }
Esempio n. 3
0
        public ActionResult Detail()
        {
            string orderNum = WebUtil.GetQueryStringValue<string>("orderNum", string.Empty);
            string flag = WebUtil.GetQueryStringValue<string>("flag", string.Empty);
            Bill<OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder();
            OutStorageEntity entity = new OutStorageEntity();
            entity.OrderNum = orderNum;
            entity = bill.GetOrder(entity);
            entity = entity.IsNull() ? new OutStorageEntity() : entity;
            ViewBag.Entity = entity;
            ViewBag.OutType = EnumHelper.GetEnumDesc<EOutType>(entity.OutType);
            ViewBag.Status = EnumHelper.GetEnumDesc<EAudite>(entity.Status);

            OutStoDetailEntity detail = new OutStoDetailEntity();
            detail.OrderNum = orderNum;
            List<OutStoDetailEntity> listResult = bill.GetOrderDetail(detail);
            listResult = listResult.IsNull() ? new List<OutStoDetailEntity>() : listResult;

            ProductProvider provider = new ProductProvider();
            List<ProductEntity> list = provider.GetListByCache();
            list = list.IsNull() ? new List<ProductEntity>() : list;
            listResult.ForEach(a =>
            {
                ProductEntity product = null;
                if (a.BarCode.IsEmpty())
                {
                    product = list.SingleOrDefault(b => b.SnNum == a.ProductNum);
                }
                else
                {
                    product = list.SingleOrDefault(b => b.SnNum == a.ProductNum && b.BarCode == a.BarCode);
                }
                if (product.IsNotNull())
                {
                    a.Size = product.Size.IsEmpty() ? "" : product.Size;
                }
                else
                {
                    a.Size = "";
                }
            });
            ViewBag.Detail = listResult;
            ViewBag.Flag = flag;
            return View();
        }
Esempio n. 4
0
 public static OutStoDetail_CE ToCE(OutStoDetailEntity item)
 {
     OutStoDetail_CE target = new OutStoDetail_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.LocalNum=item.LocalNum;
     target.StorageNum=item.StorageNum;
     target.Num=item.Num;
     target.IsPick=item.IsPick;
     target.RealNum=item.RealNum;
     target.OutPrice=item.OutPrice;
     target.Amount=item.Amount;
     target.CreateTime=item.CreateTime;
     return target;
 }
 public ActionResult Load()
 {
     string OrderNum = WebUtil.GetFormValue<string>("OrderNum", string.Empty);
     if (!OrderNum.IsEmpty())
     {
         ReturnProvider provider = new ReturnProvider();
         ReturnOrderEntity backEntity = provider.CheckOrder(OrderNum);
         if (backEntity != null && backEntity.Status == (int)EAudite.Wait)
         {
             this.ReturnJson.AddProperty("d", "1001");
             return Content(this.ReturnJson.ToString());
         }
         Bill<OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder();
         OutStorageEntity entity = new OutStorageEntity();
         entity.OrderNum = OrderNum;
         entity = bill.GetOrder(entity);
         if (entity.IsNotNull())
         {
             if (entity.Status != (int)EAudite.Pass)
             {
                 this.ReturnJson.AddProperty("d", "1002");
                 return Content(this.ReturnJson.ToString());
             }
             this.ReturnJson.AddProperty("CusNum", entity.CusNum);
             this.ReturnJson.AddProperty("CusName", entity.CusName);
             this.ReturnJson.AddProperty("Address", entity.Address);
             this.ReturnJson.AddProperty("Contact", entity.Contact);
             this.ReturnJson.AddProperty("Phone", entity.Phone);
             //加载详细内容
             OutStoDetailEntity detail = new OutStoDetailEntity();
             detail.OrderNum = OrderNum;
             List<OutStoDetailEntity> list = bill.GetOrderDetail(detail);
             list = list.IsNull() ? new List<OutStoDetailEntity>() : list;
             //获得已经退货的数量
             List<ReturnDetailEntity> listResult = provider.GetDetailByOrder(OrderNum);
             if (!listResult.IsNullOrEmpty())
             {
                 list.ForEach(a =>
                 {
                     double qty = listResult.Where(b => b.BarCode == a.BarCode && b.ProductNum == a.ProductNum && b.LocalNum == a.LocalNum && b.StorageNum == a.StorageNum && b.BatchNum==a.BatchNum).Sum(b => b.BackNum);
                     a.BackNum = qty;
                 });
             }
             Session[CacheKey.TEMPDATE_CACHE_RETURNPRODUCTDETAIL] = list;
             string json = ConvertJson.ListToJson<OutStoDetailEntity>(list, "List");
             this.ReturnJson.AddProperty("data", json);
         }
     }
     return Content(this.ReturnJson.ToString());
 }
        public ActionResult Edit()
        {
            //退货单号
            string OrderNum = WebUtil.GetFormValue<string>("OrderNum", string.Empty);
            if (!OrderNum.IsEmpty())
            {
                //退货单部分
                Bill<ReturnOrderEntity, ReturnDetailEntity> bill = new ReturnOrder();
                ReturnOrderEntity entity = new ReturnOrderEntity();
                entity.OrderNum = OrderNum;
                entity = bill.GetOrder(entity);
                if (entity.Status != (int)EAudite.Wait)
                {
                    this.ReturnJson.AddProperty("d", "1001");
                    return Content(this.ReturnJson.ToString());
                }
                ReturnDetailEntity detail = new ReturnDetailEntity();
                detail.OrderNum = OrderNum;
                List<ReturnDetailEntity> listDetails = bill.GetOrderDetail(detail);
                //出货单部分
                Bill<OutStorageEntity, OutStoDetailEntity> provider = new OutStorageOrder();
                OutStoDetailEntity items = new OutStoDetailEntity();
                items.OrderNum = entity.ContractOrder;
                List<OutStoDetailEntity> list = provider.GetOrderDetail(items);

                //已经退货部分
                ReturnProvider returnProvider = new ReturnProvider();
                List<ReturnDetailEntity> listResult = returnProvider.GetDetailByOrder(entity.ContractOrder);

                if (!list.IsNullOrEmpty())
                {
                    list.ForEach(a =>
                    {
                        ReturnDetailEntity item = listDetails.FirstOrDefault(b => b.BarCode == a.BarCode && b.ProductNum == a.ProductNum && b.LocalNum == a.LocalNum && b.StorageNum == a.StorageNum);
                        if (item != null)
                        {
                            a.Qty = item.BackNum;
                        }
                        a.BackNum = listResult.Where(b => b.BarCode == a.BarCode && b.ProductNum == a.ProductNum && b.LocalNum == a.LocalNum && b.StorageNum == a.StorageNum).Sum(b => b.BackNum);
                    });
                }
                Session[CacheKey.TEMPDATE_CACHE_RETURNPRODUCTDETAIL] = list;
                string json = ConvertJson.ListToJson<OutStoDetailEntity>(list, "List");
                this.ReturnJson.AddProperty("data", json);
            }
            return Content(this.ReturnJson.ToString());
        }
 public ActionResult GetList()
 {
     int Status = WebUtil.GetFormValue<int>("Status", 0);
     string OrderNum = WebUtil.GetFormValue<string>("OrderNum", string.Empty);
     string CusName = WebUtil.GetFormValue<string>("CusName", string.Empty);
     string beginTime = WebUtil.GetFormValue<string>("beginTime", string.Empty);
     string endTime = WebUtil.GetFormValue<string>("endTime", string.Empty);
     string order = WebUtil.GetFormValue<string>("order", string.Empty);
     int OutType = WebUtil.GetFormValue<int>("OutType", 0);
     string planNum = WebUtil.GetFormValue<string>("planNum");
     int pageSize = WebUtil.GetFormValue<int>("PageSize", 10);
     int pageIndex = WebUtil.GetFormValue<int>("PageIndex", 1);
     PageInfo pageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize };
     OutStorageEntity entity = new OutStorageEntity();
     if (Status > 0)
     {
         entity.Where(a => a.Status == Status);
     }
     if (!OrderNum.IsEmpty())
     {
         entity.Where("OrderNum", ECondition.Like, "%" + OrderNum + "%");
     }
     if (!CusName.IsEmpty())
     {
         entity.Begin<OutStorageEntity>()
             .And<OutStorageEntity>("CusNum", ECondition.Like, "%" + CusName + "%")
             .Or<OutStorageEntity>("CusName", ECondition.Like, "%" + CusName + "%")
             .End<OutStorageEntity>()
             ;
     }
     if (!beginTime.IsEmpty() && !endTime.IsEmpty())
     {
         entity.Where("OrderTime", ECondition.Between, ConvertHelper.ToType<DateTime>(beginTime), ConvertHelper.ToType<DateTime>(endTime));
     }
     entity.And(a => a.StorageNum == this.DefaultStore);
     if (!order.IsEmpty())
     {
         OrderProvider orderProvider = new OrderProvider();
         List<string> listContractOrder = orderProvider.GetOrderPlan(order);
         listContractOrder = listContractOrder.IsNull() ? new List<string>() : listContractOrder;
         if (listContractOrder.Count == 0)
         {
             listContractOrder.Add(order);
         }
         entity.And("ContractOrder", ECondition.In, listContractOrder.ToArray());
     }
     if (OutType > 0)
     {
         entity.And(a => a.OutType == OutType);
     }
     if (!planNum.IsEmpty())
     {
         OutStoDetailEntity detail = new OutStoDetailEntity();
         detail.Where("ContractOrder", ECondition.Like, "%" + planNum + "%");
         entity.Left<OutStoDetailEntity>(detail, new Params<string, string>() { Item1 = "OrderNum", Item2 = "OrderNum" });
     }
     Bill<OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder();
     List<OutStorageEntity> listResult = bill.GetList(entity, ref pageInfo);
     listResult = listResult == null ? new List<OutStorageEntity>() : listResult;
     string json = ConvertJson.ListToJson<OutStorageEntity>(listResult, "List");
     this.ReturnJson.AddProperty("Data", json);
     this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount);
     return Content(this.ReturnJson.ToString());
 }
 public ActionResult AddProduct([ModelBinder(typeof(JsonBinder<List<LocalProductEntity>>))] List<LocalProductEntity> list)
 {
     List<OutStoDetailEntity> ListCache = Session[CacheKey.TEMPDATA_CACHE_OUTSTORDETAIL] as List<OutStoDetailEntity>;
     ListCache = ListCache.IsNull() ? new List<OutStoDetailEntity>() : ListCache;
     if (!list.IsNullOrEmpty())
     {
         List<ProductEntity> ListSource = new ProductProvider().GetListByCache();
         foreach (LocalProductEntity item in list)
         {
             ProductEntity product = ListSource.FirstOrDefault(a => a.SnNum == item.ProductNum);
             if (product.IsNotNull())
             {
                 if (!ListCache.Exists(a => a.ProductNum == item.ProductNum && a.BatchNum == item.BatchNum && a.LocalNum == item.LocalNum))
                 {
                     OutStoDetailEntity entity = new OutStoDetailEntity();
                     entity.SnNum = SequenceProvider.GetSequence(typeof(OutStoDetailEntity));
                     entity.ProductName = product.ProductName;
                     entity.BarCode = product.BarCode;
                     entity.BatchNum = item.BatchNum;
                     entity.ProductNum = product.SnNum;
                     entity.LocalNum = item.LocalNum;
                     entity.LocalName = item.LocalName;
                     entity.StorageNum = this.DefaultStore;
                     entity.Num = item.Num;
                     entity.IsPick = (int)EBool.No;
                     entity.Size = product.Size.IsEmpty() ? "" : product.Size;
                     entity.RealNum = 0;
                     entity.OutPrice = product.InPrice;
                     entity.Amount = product.InPrice * entity.Num;
                     entity.CreateTime = DateTime.Now;
                     ListCache.Add(entity);
                 }
                 else
                 {
                     OutStoDetailEntity entity = ListCache.First(a => a.ProductNum == item.ProductNum && a.BatchNum == item.BatchNum && a.LocalNum == item.LocalNum);
                     entity.Num += item.Num;
                     entity.OutPrice = product.InPrice;
                     entity.Amount = product.InPrice * entity.Num;
                     entity.CreateTime = DateTime.Now;
                 }
             }
         }
     }
     if (!ListCache.IsNullOrEmpty())
     {
         Session[CacheKey.TEMPDATA_CACHE_OUTSTORDETAIL] = ListCache;
     }
     return Content(string.Empty);
 }
Esempio n. 9
0
 /// <summary>
 /// 获得订单详细查询
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public List<OutStoDetailEntity> GetOrderDetail(OutStoDetailEntity entity)
 {
     entity.IncludeAll();
     List<OutStoDetailEntity> list = this.OutStoDetail.GetList(entity);
     if (!list.IsNullOrEmpty())
     {
         List<LocationEntity> listLocation = new LocationProvider().GetList();
         listLocation = listLocation == null ? new List<LocationEntity>() : listLocation;
         foreach (OutStoDetailEntity item in list)
         {
             LocationEntity location = listLocation.FirstOrDefault(a => a.LocalNum == item.LocalNum);
             item.LocalName = location == null ? "" : location.LocalName;
             if (item.Amount == 0)
             {
                 item.Amount = item.OutPrice * item.Num;
             }
         }
     }
     return list;
 }
Esempio n. 10
0
        public ActionResult Print()
        {
            string orderNum = WebUtil.GetQueryStringValue<string>("orderNum", string.Empty);
            Bill<OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder();
            OutStorageEntity entity = new OutStorageEntity();
            entity.OrderNum = orderNum;
            entity = bill.GetOrder(entity);
            entity = entity.IsNull() ? new OutStorageEntity() : entity;
            ViewBag.Entity = entity;

            OutStoDetailEntity detail = new OutStoDetailEntity();
            detail.OrderNum = orderNum;
            List<OutStoDetailEntity> listResult = bill.GetOrderDetail(detail);
            listResult = listResult.IsNull() ? new List<OutStoDetailEntity>() : listResult;
            OrderProvider orderProvider = new OrderProvider();
            foreach (OutStoDetailEntity item in listResult)
            {
                OrderDetailEntity orderDetail = new OrderDetailEntity();
                orderDetail.Where(a => a.SnNum == item.ContractSn).And(a => a.OrderNum == item.ContractOrder);
                orderDetail = orderProvider.GetOrderDetail(orderDetail);
                if (orderDetail != null)
                {
                    item.Qty = orderDetail.Num;
                }
            }
            ViewBag.Detail = listResult;
            return View();
        }
Esempio n. 11
0
        public ActionResult Edit()
        {
            string orderNum = WebUtil.GetQueryStringValue<string>("orderNum", string.Empty);
            Bill<OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder();
            OutStorageEntity entity = new OutStorageEntity();
            entity.OrderNum = orderNum;
            entity = bill.GetOrder(entity);
            entity = entity.IsNull() ? new OutStorageEntity() : entity;
            ViewBag.Entity = entity;
            ViewBag.OutType = EnumHelper.GetOptions<EInType>(entity.OutType, "请选择入库单类型");
            ViewBag.ProductType = EnumHelper.GetOptions<EProductType>(entity.ProductType, "请选择入库产品类型");

            OutStoDetailEntity detail = new OutStoDetailEntity();
            detail.OrderNum = orderNum;
            List<OutStoDetailEntity> listResult = bill.GetOrderDetail(detail);
            listResult = listResult.IsNull() ? new List<OutStoDetailEntity>() : listResult;

            ProductProvider provider = new ProductProvider();
            List<ProductEntity> list = provider.GetListByCache();
            list = list.IsNull() ? new List<ProductEntity>() : list;
            listResult.ForEach(a =>
            {
                ProductEntity product = null;
                if (a.BarCode.IsEmpty())
                {
                    product = list.SingleOrDefault(b => b.SnNum == a.ProductNum);
                }
                else
                {
                    product = list.SingleOrDefault(b => b.SnNum == a.ProductNum && b.BarCode == a.BarCode);
                }
                a.OutPrice = product != null ? product.OutPrice : 0;
                if (product != null)
                {
                    a.Size = product.Size.IsEmpty() ? "" : product.Size;
                }
                else
                {
                    a.Size = "";
                }
            });
            Session[CacheKey.TEMPDATA_CACHE_OUTSTORDETAIL] = listResult;
            return View();
        }