Ejemplo n.º 1
0
        public ActionResult AddAll()
        {
            string productNum = WebUtil.GetFormValue<string>("productNum",string.Empty);
            string cateNum = WebUtil.GetFormValue<string>("cateNum", string.Empty);
            ProductProvider provider = new ProductProvider();
            List<ProductEntity> listSource = provider.GetListByCache();
            if (!listSource.IsNullOrEmpty())
            {
                List<ProductEntity> listResult = listSource;
                if (!productNum.IsEmpty())
                {
                    listResult = listResult.Where(a => a.BarCode.Contains(productNum) || a.ProductName.Contains(productNum)).ToList();
                }
                if (!cateNum.IsEmpty())
                {
                    listResult = listResult.Where(a => a.CateNum == cateNum || a.CateName == cateNum).ToList();
                }

                List<ProductEntity> ListProducts = Session[CacheKey.JOOSHOW_CHECKDETAIL_CACHE] as List<ProductEntity>;
                ListProducts = ListProducts.IsNull() ? new List<ProductEntity>() : ListProducts;

                foreach (ProductEntity item in listResult)
                {
                    if (!ListProducts.Exists(a => a.SnNum == item.SnNum))
                    {
                        ListProducts.Add(item);
                    }
                }
                Session[CacheKey.JOOSHOW_CHECKDETAIL_CACHE] = ListProducts;
            }
            return Content(string.Empty);
        }
Ejemplo n.º 2
0
 public ActionResult AutoSinProduct(string ProductNum)
 {
     ProductProvider provider = new ProductProvider();
     List<ProductEntity> list = provider.GetListByCache();
     ProductEntity entity = null;
     if (!list.IsNullOrEmpty() && !ProductNum.IsEmpty())
     {
         entity = list.FirstOrDefault(a => a.SnNum == ProductNum);
     }
     entity = entity.IsNull() ? new ProductEntity() : entity;
     List<ProductEntity> listSource = new List<ProductEntity>();
     listSource.Add(entity);
     StringBuilder sb = new StringBuilder();
     JsonObject jsonObject = null;
     foreach (ProductEntity t in listSource)
     {
         jsonObject = new JsonObject();
         jsonObject.AddProperty("BarCode", t.BarCode);
         jsonObject.AddProperty("ProductName", t.ProductName);
         jsonObject.AddProperty("SnNum", t.SnNum);
         jsonObject.AddProperty("CateNum", t.CateNum);
         jsonObject.AddProperty("CateName", t.CateName);
         jsonObject.AddProperty("InPrice", t.InPrice);
         jsonObject.AddProperty("Unit", t.UnitNum);
         jsonObject.AddProperty("UnitName", t.UnitName);
         jsonObject.AddProperty("Size", t.Size.Escape());
         jsonObject.AddProperty("Num", t.Num);
         sb.Append(jsonObject.ToString() + "\n");
     }
     if (sb.Length == 0)
     {
         sb.Append("\n");
     }
     return Content(sb.ToString());
 }
Ejemplo n.º 3
0
 public ActionResult AutoProduct(string productName)
 {
     ProductProvider provider = new ProductProvider();
     List<ProductEntity> list = provider.GetListByCache();
     if (!list.IsNullOrEmpty() && !productName.IsEmpty())
     {
         list = list.Where(a => a.ProductName.Contains(productName) || a.BarCode.Contains(productName) || a.SnNum.Contains(productName)).ToList();
     }
     list = list.IsNull() ? new List<ProductEntity>() : list;
     StringBuilder sb = new StringBuilder();
     JsonObject jsonObject = null;
     foreach (ProductEntity t in list)
     {
         jsonObject = new JsonObject();
         jsonObject.AddProperty("BarCode", t.BarCode);
         jsonObject.AddProperty("ProductName", t.ProductName);
         jsonObject.AddProperty("SnNum", t.SnNum);
         jsonObject.AddProperty("CateNum", t.CateNum);
         jsonObject.AddProperty("CateName", t.CateName);
         jsonObject.AddProperty("InPrice", t.InPrice);
         jsonObject.AddProperty("Unit", t.UnitNum);
         jsonObject.AddProperty("UnitName", t.UnitName);
         jsonObject.AddProperty("Size", t.Size);
         jsonObject.AddProperty("Num", t.Num);
         sb.Append(jsonObject.ToString() + "\n");
     }
     if (sb.Length == 0)
     {
         sb.Append("\n");
     }
     return Content(sb.ToString());
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 查询所有的产信息
 /// </summary>
 /// <returns></returns>
 public List<Product_CE> GetList()
 {
     ProductProvider provider = new ProductProvider();
     List<ProductEntity> list = provider.GetListByCache();
     if (!list.IsNullOrEmpty())
     {
         List<Product_CE> listResult = new List<Product_CE>();
         foreach (ProductEntity iten in list)
         {
             Product_CE ce = Product_To.ToCE(iten);
             listResult.Add(ce);
         }
         return listResult;
     }
     return null;
 }
Ejemplo n.º 5
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();
        }
Ejemplo n.º 6
0
 public ActionResult AddProduct([ModelBinder(typeof(JsonBinder<string[]>))] string[] ProductItems)
 {
     List<ProductEntity> ListProducts = Session[CacheKey.JOOSHOW_CHECKDETAIL_CACHE] as List<ProductEntity>;
     ListProducts = ListProducts.IsNull() ? new List<ProductEntity>() : ListProducts;
     if (!ProductItems.IsNullOrEmpty())
     {
         ProductProvider provider = new ProductProvider();
         List<ProductEntity> ListSource = provider.GetListByCache();
         ListSource = ListSource.IsNull() ? new List<ProductEntity>() : ListSource;
         foreach (string key in ProductItems)
         {
             if (ListSource.Exists(a => a.SnNum == key))
             {
                 ProductEntity entity = ListSource.First(a => a.SnNum == key);
                 if (!ListProducts.Exists(a => a.SnNum == entity.SnNum))
                 {
                     ListProducts.Add(entity);
                 }
             }
         }
     }
     Session[CacheKey.JOOSHOW_CHECKDETAIL_CACHE] = ListProducts;
     return Content(string.Empty);
 }
Ejemplo n.º 7
0
 public ActionResult LoadProduct([ModelBinder(typeof(JsonBinder<List<MoveOrderDetailEntity>>))] List<MoveOrderDetailEntity> List)
 {
     List<MoveOrderDetailEntity> listResult = Session[CacheKey.TEMPDATA_CACHE_MOVERODUCTDETAIL] as List<MoveOrderDetailEntity>;
     listResult = listResult.IsNull() ? new List<MoveOrderDetailEntity>() : listResult;
     if (!List.IsNullOrEmpty())
     {
         string storageNum = this.DefaultStore;
         ProductProvider provider = new ProductProvider();
         List<ProductEntity> listProduct = provider.GetListByCache();
         LocationProvider localProvider = new LocationProvider();
         List<LocationEntity> listLocals = localProvider.GetList(storageNum);
         foreach (MoveOrderDetailEntity item in List)
         {
             ProductEntity product = listProduct.FirstOrDefault(a => a.BarCode == item.BarCode && a.SnNum == item.ProductNum);
             if (product != null)
             {
                 MoveOrderDetailEntity entity = new MoveOrderDetailEntity();
                 entity.SnNum = SequenceProvider.GetSequence(typeof(MoveOrderDetailEntity));
                 entity.ProductName = product.ProductName;
                 entity.BarCode = product.BarCode;
                 entity.ProductNum = product.SnNum;
                 entity.BatchNum = item.BatchNum;
                 entity.Num = item.Num;
                 entity.InPrice = product.InPrice;
                 entity.Amout = entity.InPrice * item.Num;
                 entity.IsPick = (int)EBool.Yes;
                 entity.RealNum = item.Num;
                 entity.CreateTime = DateTime.Now;
                 entity.StorageNum = storageNum;
                 entity.FromLocalNum = item.FromLocalNum;
                 entity.ToLocalNum = item.ToLocalNum;
                 LocationEntity local = listLocals.FirstOrDefault(a => a.LocalNum == item.FromLocalNum);
                 entity.FromLocalName = local != null ? local.LocalName : "";
                 local = listLocals.FirstOrDefault(a => a.LocalNum == item.ToLocalNum);
                 entity.ToLocalName = local != null ? local.LocalName : "";
                 listResult.Add(entity);
             }
         }
         Session[CacheKey.TEMPDATA_CACHE_MOVERODUCTDETAIL] = listResult;
     }
     return Content(string.Empty);
 }
Ejemplo n.º 8
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();
        }