Esempio n. 1
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());
 }
Esempio 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());
 }
        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);
        }
Esempio n. 4
0
 public ActionResult Detail(string snNum)
 {
     ProductEntity entity = null;
     if (!snNum.IsEmpty())
     {
         ProductProvider provider = new ProductProvider();
         entity = provider.GetProductBySn(snNum);
         ViewBag.Category = BaseHelper.GetProductCategory(entity.CateNum);
         ViewBag.Storage = LocalHelper.GetStorageNumList(entity.StorageNum);
         ViewBag.Local = LocalHelper.GetLocalNumList(entity.StorageNum, entity.DefaultLocal);
         ViewBag.Customer = BaseHelper.GetCustomerList(entity.CusNum);
         ViewBag.Goods = entity;
         ViewBag.Unit = BaseHelper.GetMeasureNameList(entity.UnitNum);
     }
     else
     {
         ViewBag.Goods = new ProductEntity();
         ViewBag.Category = BaseHelper.GetProductCategory(string.Empty);
         ViewBag.Storage = LocalHelper.GetStorageNumList(string.Empty);
         ViewBag.Local = LocalHelper.GetLocalNumList(string.Empty, string.Empty);
         ViewBag.Customer = BaseHelper.GetCustomerList(string.Empty);
         ViewBag.Unit = BaseHelper.GetMeasureNameList(string.Empty);
     }
     return View();
 }
Esempio n. 5
0
 /// <summary>
 /// 新增产品信息
 /// </summary>
 /// <param name="ce"></param>
 /// <returns></returns>
 public int Add(Product_CE ce)
 {
     if (ce != null)
     {
         ProductEntity entity = Product_To.To(ce);
         ProductProvider provider = new ProductProvider();
         int line = provider.Add(entity);
         return line;
     }
     return 0;
 }
Esempio n. 6
0
 public ActionResult GoodsDetail(string snNum)
 {
     ProductEntity entity = new ProductEntity();
     ProductProvider provider = new ProductProvider();
     entity = provider.GetProductBySn(snNum);
     ViewBag.Category = BaseHelper.GetProductCategory(entity.CateNum);
     ViewBag.Storage = LocalHelper.GetStorageNumList(entity.StorageNum);
     ViewBag.Local = LocalHelper.GetLocalNumList(entity.StorageNum, entity.DefaultLocal);
     ViewBag.Customer = BaseHelper.GetCustomerList(entity.CusNum);
     ViewBag.Goods = entity;
     //ViewBag.Unit = EnumHelper.GetOptions<EUnit>(entity.Unit, "请选择单位");
     ViewBag.Unit = BaseHelper.GetMeasureNameList(entity.UnitNum);
     return View();
 }
Esempio n. 7
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;
 }
Esempio n. 8
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();
        }
 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);
 }
Esempio n. 10
0
 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. 11
0
 public ActionResult LoadProduct([ModelBinder(typeof(JsonBinder<List<LocalProductEntity>>))]List<LocalProductEntity> list)
 {
     List<BadReportDetailEntity> ListProducts = Session[CacheKey.TEMPDATA_CACHE_BADPRODUCTDETAIL] as List<BadReportDetailEntity>;
     ListProducts = ListProducts.IsNull() ? new List<BadReportDetailEntity>() : ListProducts;
     if (!list.IsNullOrEmpty())
     {
         LocationProvider localProvider = new LocationProvider();
         foreach (LocalProductEntity item in list)
         {
             string BarCode = item.BarCode;
             string ProductNum = item.ProductNum;
             string StorageNum = item.StorageNum;
             string FromLocalNum = item.LocalNum;
             string BatchNum = item.BatchNum;
             if (ListProducts.Exists(a => a.BarCode == BarCode && a.ProductNum == ProductNum && a.BatchNum == BatchNum && a.StorageNum == StorageNum && a.FromLocalNum == FromLocalNum))
             {
                 BadReportDetailEntity entity = ListProducts.FirstOrDefault(a => a.BarCode == BarCode && a.ProductNum == ProductNum && a.BatchNum == BatchNum && a.StorageNum == StorageNum && a.FromLocalNum == FromLocalNum);
                 entity.Num += item.Num;
             }
             else
             {
                 BadReportDetailEntity entity = new BadReportDetailEntity();
                 entity.SnNum = SequenceProvider.GetSequence(typeof(BadReportDetailEntity));
                 ProductProvider provider = new ProductProvider();
                 ProductEntity product = provider.GetProductBySn(ProductNum);
                 entity.ProductName = product.ProductName;
                 entity.BarCode = product.BarCode;
                 entity.ProductNum = product.SnNum;
                 entity.BatchNum = item.BatchNum;
                 entity.LocalNum = item.Num;
                 entity.Num = item.Qty;
                 entity.Amount = product.InPrice * item.Num;
                 entity.InPrice = product.InPrice;
                 entity.CreateTime = DateTime.Now;
                 entity.StorageNum = StorageNum;
                 entity.FromLocalNum = item.LocalNum;
                 LocationEntity fromLocal = localProvider.GetSingleByNumCache(item.LocalNum);
                 if (fromLocal != null)
                 {
                     entity.FromLocalName = fromLocal.LocalName;
                 }
                 LocationEntity localtion = localProvider.GetDefaultLocal(StorageNum, ELocalType.Bad);
                 if (localtion != null)
                 {
                     entity.ToLocalNum = localtion.LocalNum;
                 }
                 ListProducts.Add(entity);
             }
         }
         Session[CacheKey.TEMPDATA_CACHE_BADPRODUCTDETAIL] = ListProducts;
     }
     return Content(string.Empty);
 }
Esempio n. 12
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();
        }
Esempio n. 13
0
        public ActionResult ToExcel()
        {
            PageInfo pageInfo = new Git.Framework.DataTypes.PageInfo() { PageIndex = 1, PageSize = Int32.MaxValue };
            string ProductName = WebUtil.GetFormValue<string>("ProductName", string.Empty);
            int pageIndex = WebUtil.GetFormValue<int>("pageIndex", 0);
            int pageSize = WebUtil.GetFormValue<int>("pageSize", 0);
            string CateNum = WebUtil.GetFormValue<string>("CateNum", string.Empty);
            ProductProvider provider = new ProductProvider();
            ProductEntity entity = new ProductEntity();
            if (!ProductName.IsEmpty())
            {
                entity.Where<ProductEntity>("ProductName", ECondition.Like, "%" + ProductName + "%");
            }
            if (!CateNum.IsEmpty())
            {
                entity.Where<ProductEntity>("CateNum", ECondition.Eth, CateNum);
            }
            List<ProductEntity> listResult = provider.GetList(entity, ref pageInfo);

            listResult = listResult.IsNull() ? new List<ProductEntity>() : listResult;
            if (listResult.IsNotNull())
            {
                DataTable dt = new DataTable();
                dt.Columns.Add(new DataColumn("序号 "));
                dt.Columns.Add(new DataColumn("产品编号"));
                dt.Columns.Add(new DataColumn("条码编号"));
                dt.Columns.Add(new DataColumn("产品名称"));
                dt.Columns.Add(new DataColumn("类别名称"));
                dt.Columns.Add(new DataColumn("库存数"));
                dt.Columns.Add(new DataColumn("预警值下线"));
                dt.Columns.Add(new DataColumn("预警值上线"));
                dt.Columns.Add(new DataColumn("单位"));
                dt.Columns.Add(new DataColumn("平均价格"));
                dt.Columns.Add(new DataColumn("进口价格"));
                dt.Columns.Add(new DataColumn("出口价格"));
                dt.Columns.Add(new DataColumn("净重"));
                dt.Columns.Add(new DataColumn("毛重"));
                dt.Columns.Add(new DataColumn("备注"));
                int count = 1;
                foreach (ProductEntity t in listResult)
                {
                    DataRow row = dt.NewRow();
                    row[0] = count;
                    row[1] = t.SnNum;
                    row[2] = t.BarCode;
                    row[3] = t.ProductName;
                    row[4] = t.CateName;
                    row[5] = t.Num;
                    row[6] = t.MinNum;
                    row[7] = t.MaxNum;
                    row[8] = t.UnitName;
                    row[9] = t.AvgPrice;
                    row[10] = t.InPrice;
                    row[11] = t.OutPrice;
                    row[12] = t.NetWeight.ToString();
                    row[13] = t.GrossWeight.ToString();
                    row[14] = t.Remark;
                    dt.Rows.Add(row);
                    count++;
                }
                string filePath = Server.MapPath("~/UploadFiles/");
                if (!System.IO.Directory.Exists(filePath))
                {
                    System.IO.Directory.CreateDirectory(filePath);
                }
                string filename = string.Format("产品管理{0}.xls", DateTime.Now.ToString("yyyyMMddHHmmss"));
                NPOIExcel excel = new NPOIExcel("产品管理", "产品", System.IO.Path.Combine(filePath, filename));
                excel.ToExcel(dt);
                this.ReturnJson.AddProperty("Path", ("/UploadFiles/" + filename).Escape());
            }
            else
            {
                this.ReturnJson.AddProperty("d", "无数据导出!");
            }
            return Content(this.ReturnJson.ToString());
        }
Esempio n. 14
0
 public ActionResult GetList()
 {
     string ProductName = WebUtil.GetFormValue<string>("ProductName", string.Empty);
     int pageIndex = WebUtil.GetFormValue<int>("pageIndex", 0);
     int pageSize = WebUtil.GetFormValue<int>("pageSize", 0);
     string CateNum = WebUtil.GetFormValue<string>("CateNum", string.Empty);
     ProductProvider provider = new ProductProvider();
     ProductEntity entity = new ProductEntity();
     if (!ProductName.IsEmpty())
     {
         entity.Begin<ProductEntity>()
          .Where<ProductEntity>("ProductName", ECondition.Like, "%" + ProductName + "%")
          .Or<ProductEntity>("SnNum", ECondition.Like, "%" + ProductName + "%")
          .Or<ProductEntity>("BarCode", ECondition.Like, "%" + ProductName + "%")
          .End<ProductEntity>();
     }
     if (!CateNum.IsEmpty())
     {
         entity.Where<ProductEntity>("CateNum", ECondition.Eth, CateNum);
     }
     PageInfo pageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize };
     List<ProductEntity> listResult = provider.GetList(entity, ref pageInfo);
     string json = ConvertJson.ListToJson<ProductEntity>(listResult, "List");
     this.ReturnJson.AddProperty("Data", new JsonObject(json));
     this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount);
     return Content(this.ReturnJson.ToString());
 }
Esempio n. 15
0
 public ActionResult EditProduct([ModelBinder(typeof(JsonBinder<ProductEntity>))] ProductEntity entity)
 {
     if (entity.SnNum.IsEmpty())
     {
         entity.SnNum = SequenceProvider.GetSequence(typeof(ProductEntity));
         if (entity.CusNum.IsEmpty())
         {
             entity.CusName = "";
         }
         entity.Num = 0;
         entity.IsDelete = (int)EIsDelete.NotDelete;
         entity.CreateTime = DateTime.Now;
         entity.CreateUser = this.LoginUserCode;
         int line = new ProductProvider().Add(entity);
         if (line > 0)
         {
             this.ReturnJson.AddProperty("d", "success");
         }
     }
     else
     {
         if (entity.CusNum.IsEmpty())
         {
             entity.CusName = "";
         }
         entity.Num = 0;
         int line = new ProductProvider().Update(entity);
         if (line > 0)
         {
             this.ReturnJson.AddProperty("d", "success");
         }
     }
     return Content(this.ReturnJson.ToString());
 }
Esempio n. 16
0
 public ActionResult Delete(string SnNum)
 {
     ProductProvider provider = new ProductProvider();
     int line = provider.Delete(SnNum);
     if (line > 0)
     {
         this.ReturnJson.AddProperty("d", "success");
     }
     else
     {
         this.ReturnJson.AddProperty("d", "");
     }
     return Content(this.ReturnJson.ToString());
 }
Esempio n. 17
0
 public ActionResult BatchDel(string SnNum)
 {
     ProductProvider provider = new ProductProvider();
     var list = SnNum.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
     List<string> ls = new List<string>();
     int line = 0;
     foreach (string t in list)
     {
         line += provider.Delete(t);
     }
     if (line > 0)
     {
         this.ReturnJson.AddProperty("d", "success");
     }
     else
     {
         this.ReturnJson.AddProperty("d", "");
     }
     return Content(this.ReturnJson.ToString());
 }
Esempio n. 18
0
 /// <summary>
 /// 根据产品条码查询产品的集合
 /// </summary>
 /// <param name="name"></param>
 /// <returns></returns>
 public List<Product_CE> GetListByBarCode(string barCode)
 {
     if (barCode.IsEmpty())
     {
         return null;
     }
     ProductProvider provider = new ProductProvider();
     List<ProductEntity> list = provider.GetProductByBarCode(barCode);
     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;
 }
Esempio n. 19
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);
 }
Esempio n. 20
0
        public ActionResult OutStorageReport()
        {
            int queryTime = WebUtil.GetFormValue<int>("QueryTime", 0);
            int pageIndex = WebUtil.GetFormValue<int>("pageIndex", 0);
            int pageSize = WebUtil.GetFormValue<int>("pageSize", 0);
            string storageNum = this.DefaultStore;

            ProductProvider provider = new ProductProvider();
            OutStorageEntity entity = new OutStorageEntity();
            PageInfo pageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize };
            if (queryTime > 0)
            {
                entity.Where("CreateTime", ECondition.Between, DateTime.Now.AddDays(-queryTime), DateTime.Now);
            }
            if (storageNum.IsNotNull())
            {
                entity.Where("StorageNum", ECondition.Eth, storageNum);
            }
            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", new JsonObject(json));
            this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount);
            return Content(this.ReturnJson.ToString());
        }
Esempio n. 21
0
        public ActionResult ToProductReportExcel()
        {
            PageInfo pageInfo = new Git.Framework.DataTypes.PageInfo() { PageIndex = 1, PageSize = Int32.MaxValue };
            string searchKey = WebUtil.GetFormValue<string>("ProductName", string.Empty);
            string beginTime = WebUtil.GetFormValue<string>("BeginTime", string.Empty);
            string endTime = WebUtil.GetFormValue<string>("EndTime", string.Empty);
            string storageNum = this.DefaultStore;

            ProductProvider provider = new ProductProvider();
            ProductEntity entity = new ProductEntity();
            if (!searchKey.IsEmpty())
            {
                entity.Begin<ProductEntity>()
                 .Where<ProductEntity>("ProductName", ECondition.Like, "%" + searchKey + "%")
                 .Or<ProductEntity>("SnNum", ECondition.Like, "%" + searchKey + "%")
                 .Or<ProductEntity>("BarCode", ECondition.Like, "%" + searchKey + "%")
                 .End<ProductEntity>();
            }
            if (!beginTime.IsEmpty() && !endTime.IsEmpty())
            {
                entity.Where("CreateTime", ECondition.Between, ConvertHelper.ToType<DateTime>(beginTime), ConvertHelper.ToType<DateTime>(endTime));
            }
            if (storageNum.IsNotNull())
            {
                entity.Where("StorageNum", ECondition.Eth, storageNum);
            }
            List<ProductEntity> listResult = provider.GetList(entity, ref pageInfo, searchKey, beginTime, endTime);
            listResult = listResult.IsNull() ? new List<ProductEntity>() : listResult;
            if (!listResult.IsNullOrEmpty())
            {
                DataTable dt = new DataTable();
                dt.Columns.Add(new DataColumn("序号 "));
                dt.Columns.Add(new DataColumn("产品编号"));
                dt.Columns.Add(new DataColumn("产品条码"));
                dt.Columns.Add(new DataColumn("产品名称"));
                dt.Columns.Add(new DataColumn("类别名称"));
                dt.Columns.Add(new DataColumn("预警值下限"));
                dt.Columns.Add(new DataColumn("预警值上限"));
                dt.Columns.Add(new DataColumn("规格"));
                dt.Columns.Add(new DataColumn("价格"));
                dt.Columns.Add(new DataColumn("库存数"));
                dt.Columns.Add(new DataColumn("进货总数"));
                dt.Columns.Add(new DataColumn("出货总数"));
                dt.Columns.Add(new DataColumn("报损总数"));

                int count = 1;
                foreach (ProductEntity t in listResult)
                {
                    DataRow row = dt.NewRow();
                    row[0] = count;
                    row[1] = t.SnNum;
                    row[2] = t.BarCode;
                    row[3] = t.ProductName;
                    row[4] = t.CateName;
                    row[5] = t.MinNum;
                    row[6] = t.MaxNum;
                    row[7] = t.Size;
                    row[8] = t.AvgPrice;
                    row[9] = t.LocalProductNum;
                    row[10] = t.InStorageNum;
                    row[11] = t.OutStorageNum;
                    row[12] = t.BadReportNum;
                    dt.Rows.Add(row);
                    count++;
                }
                DataRow rowTemp = dt.NewRow();
                rowTemp[0] = count;
                rowTemp[1] = "";
                rowTemp[2] = "";
                rowTemp[3] = "";
                rowTemp[4] = "";
                rowTemp[5] = "";
                rowTemp[6] = "";
                rowTemp[7] = "";
                rowTemp[8] = "总计";
                rowTemp[9] = listResult[0].TotalLocalProductNum;
                rowTemp[10] = listResult[0].TotalInStorageNum;
                rowTemp[11] = listResult[0].TotalOutStorageNum;
                rowTemp[12] = listResult[0].TotalBadReportNum;
                dt.Rows.Add(rowTemp);
                string filePath = Server.MapPath("~/UploadFiles/");
                if (!System.IO.Directory.Exists(filePath))
                {
                    System.IO.Directory.CreateDirectory(filePath);
                }
                string filename = string.Format("产品在线库存报表{0}.xls", DateTime.Now.ToString("yyyyMMddHHmmss"));
                AsposeExcel excel = new AsposeExcel(System.IO.Path.Combine(filePath, filename), "");
                excel.DatatableToExcel(dt, "产品在线库存报表", "产品在线库存报表");
                this.ReturnJson.AddProperty("Path", ("/UploadFiles/" + filename).Escape());
                this.ReturnJson.AddProperty("Path", ("/UploadFiles/" + filename).Escape());
            }
            else
            {
                this.ReturnJson.AddProperty("d", "无数据导出!");
            }
            return Content(this.ReturnJson.ToString());
        }
Esempio n. 22
0
 /// <summary>
 /// 根据产品SN号码查询产品的详细信息
 /// SNNum为产品的唯一编号
 /// </summary>
 /// <param name="name"></param>
 /// <returns></returns>
 public Product_CE GetProductBySn(string snNum)
 {
     if (snNum.IsEmpty())
     {
         return null;
     }
     ProductProvider provider = new ProductProvider();
     ProductEntity entity = provider.GetProductBySn(snNum);
     if (entity != null)
     {
         Product_CE productCe = Product_To.ToCE(entity);
         return productCe;
     }
     return null;
 }
Esempio n. 23
0
        public ActionResult ProductReportList()
        {
            string searchKey = WebUtil.GetFormValue<string>("ProductName", string.Empty);
            string beginTime = WebUtil.GetFormValue<string>("BeginTime", string.Empty);
            string endTime = WebUtil.GetFormValue<string>("EndTime", string.Empty);
            int pageIndex = WebUtil.GetFormValue<int>("pageIndex", 0);
            int pageSize = WebUtil.GetFormValue<int>("pageSize", 0);
            string storageNum = this.DefaultStore;
            ProductProvider provider = new ProductProvider();
            ProductEntity entity = new ProductEntity();
            entity.StorageNum = storageNum;
            if (!searchKey.IsEmpty())
            {
                entity.Begin<ProductEntity>()
                 .Where<ProductEntity>("ProductName", ECondition.Like, "%" + searchKey + "%")
                 .Or<ProductEntity>("SnNum", ECondition.Like, "%" + searchKey + "%")
                 .Or<ProductEntity>("BarCode", ECondition.Like, "%" + searchKey + "%")
                 .End<ProductEntity>();
            }
            if (!beginTime.IsEmpty() && !endTime.IsEmpty())
            {
                entity.Where("CreateTime", ECondition.Between, ConvertHelper.ToType<DateTime>(beginTime), ConvertHelper.ToType<DateTime>(endTime));
            }

            PageInfo pageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize };
            List<ProductEntity> listResult = provider.GetList(entity, ref pageInfo, searchKey, beginTime, endTime);
            string json = ConvertJson.ListToJson<ProductEntity>(listResult, "List");
            this.ReturnJson.AddProperty("Data", new JsonObject(json));
            this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount);
            return Content(this.ReturnJson.ToString());
        }
Esempio n. 24
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();
        }