Beispiel #1
0
        /// <summary>
        /// 查询盘点差异单
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public List <InventoryDifEntity> GetList(InventoryDifEntity entity)
        {
            entity.IncludeAll();
            entity.Where(item => item.CompanyID == entity.CompanyID);
            if (entity.OrderSnNum.IsNotEmpty())
            {
                entity.And(item => item.OrderSnNum == entity.OrderSnNum);
            }
            if (entity.OrderNum.IsNotEmpty())
            {
                entity.And("OrderNum", ECondition.Like, "%" + entity.OrderNum + "%");
            }
            if (entity.LocalNum.IsNotEmpty())
            {
                entity.And(item => item.LocalNum == entity.LocalNum);
            }
            if (entity.LocalName.IsNotEmpty())
            {
                entity.And("LocalName", ECondition.Like, "%" + entity.LocalName + "%");
            }
            if (entity.StorageNum.IsNotEmpty())
            {
                entity.And(item => item.StorageNum == entity.StorageNum);
            }
            if (entity.ProductNum.IsNotEmpty())
            {
                entity.And(item => item.ProductNum == entity.ProductNum);
            }
            if (entity.BarCode.IsNotEmpty())
            {
                entity.And("BarCode", ECondition.Like, "%" + entity.BarCode + "%");
            }
            if (entity.ProductName.IsNotEmpty())
            {
                entity.And("ProductName", ECondition.Like, "%" + entity.ProductName + "%");
            }
            if (entity.BatchNum.IsNotEmpty())
            {
                entity.And("BatchNum", ECondition.Like, "%" + entity.BatchNum + "%");
            }
            ProductEntity product = new ProductEntity();

            product.Include(a => new { Size = a.Size, CateName = a.CateName, UnitName = a.UnitName });
            entity.Left <ProductEntity>(product, new Params <string, string>()
            {
                Item1 = "ProductNum", Item2 = "SnNum"
            });

            StorageEntity Storage = new StorageEntity();

            Storage.Include(a => new { StorageName = a.StorageName });
            entity.Left <StorageEntity>(Storage, new Params <string, string>()
            {
                Item1 = "StorageNum", Item2 = "SnNum"
            });

            List <InventoryDifEntity> listResult = this.InventoryDif.GetList(entity);

            return(listResult);
        }
Beispiel #2
0
        /// <summary>
        /// 新增盘差数据
        /// </summary>
        /// <returns></returns>
        public ActionResult AddDif()
        {
            string CompanyID = WebUtil.GetFormValue <string>("CompanyID");

            InventoryDifEntity entity   = WebUtil.GetFormObject <InventoryDifEntity>("Entity");
            CheckOrderExt      provider = new CheckOrderExt(CompanyID);

            InventoryDetailEntity check = new InventoryDetailEntity();

            check.OrderSnNum = entity.OrderSnNum;
            check.TargetNum  = entity.ProductNum;
            check.CompanyID  = CompanyID;
            DataResult dataResult = null;
            int        count      = provider.GetCount(check);

            if (count == 0)
            {
                dataResult = new DataResult()
                {
                    Code    = (int)EResponseCode.Exception,
                    Message = "该产品不在盘点任务内"
                };

                return(Content(JsonHelper.SerializeObject(dataResult)));
            }
            int line = provider.AddDif(entity);

            dataResult = new DataResult()
            {
                Code    = (int)EResponseCode.Success,
                Message = "响应成功"
            };
            return(Content(JsonHelper.SerializeObject(dataResult)));
        }
Beispiel #3
0
        /// <summary>
        /// 根据唯一编号删除盘点差异单
        /// </summary>
        /// <param name="SnNum"></param>
        /// <returns></returns>
        public int DeleteDif(string SnNum)
        {
            InventoryDifEntity entity = new InventoryDifEntity();

            entity.Where(item => item.SnNum == SnNum).And(item => item.CompanyID == this.CompanyID);
            int line = this.InventoryDif.Delete(entity);

            return(line);
        }
        public ActionResult SaveDif()
        {
            InventoryDifEntity entity    = WebUtil.GetFormObject <InventoryDifEntity>("Entity");
            string             CompanyID = this.CompanyID;

            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic.Add("CompanyID", CompanyID);
            dic.Add("Entity", JsonConvert.SerializeObject(entity));

            ITopClient client = new TopClientDefault();
            string     result = client.Execute(CheckApiName.CheckApiName_SaveDif, dic);

            return(Content(result));
        }
Beispiel #5
0
        /// <summary>
        /// 保存盘点差异单
        /// </summary>
        /// <returns></returns>
        public ActionResult SaveDif()
        {
            string             CompanyID = WebUtil.GetFormValue <string>("CompanyID");
            InventoryDifEntity entity    = WebUtil.GetFormObject <InventoryDifEntity>("Entity");

            CheckOrderExt provider = new CheckOrderExt(CompanyID);

            int        line       = provider.SaveDif(entity);
            DataResult dataResult = new DataResult()
            {
                Code    = (int)EResponseCode.Success,
                Message = "响应成功"
            };

            return(Content(JsonHelper.SerializeObject(dataResult)));
        }
Beispiel #6
0
        /// <summary>
        /// 查询分页
        /// </summary>
        /// <returns></returns>
        public ActionResult GetDifPage()
        {
            string CompanyID   = WebUtil.GetFormValue <string>("CompanyID");
            string OrderSnNum  = WebUtil.GetFormValue <string>("OrderSnNum");
            string OrderNum    = WebUtil.GetFormValue <string>("OrderNum");
            string LocalNum    = WebUtil.GetFormValue <string>("LocalNum");
            string LocalName   = WebUtil.GetFormValue <string>("LocalName");
            string StorageNum  = WebUtil.GetFormValue <string>("StorageNum");
            string ProductNum  = WebUtil.GetFormValue <string>("ProductNum");
            string BarCode     = WebUtil.GetFormValue <string>("BarCode");
            string ProductName = WebUtil.GetFormValue <string>("ProductName");
            string BatchNum    = WebUtil.GetFormValue <string>("BatchNum");

            int PageIndex = WebUtil.GetFormValue <int>("PageIndex", 1);
            int PageSize  = WebUtil.GetFormValue <int>("PageSize", 5);

            PageInfo pageInfo = new PageInfo()
            {
                PageIndex = PageIndex, PageSize = PageSize
            };
            CheckOrderExt      provider = new CheckOrderExt(CompanyID);
            InventoryDifEntity entity   = new InventoryDifEntity()
            {
                OrderSnNum  = OrderSnNum,
                CompanyID   = CompanyID,
                OrderNum    = OrderNum,
                LocalNum    = LocalNum,
                LocalName   = LocalName,
                StorageNum  = StorageNum,
                ProductNum  = ProductNum,
                BarCode     = BarCode,
                ProductName = ProductName,
                BatchNum    = BatchNum
            };
            List <InventoryDifEntity>           listResult = provider.GetList(entity, ref pageInfo);
            DataListResult <InventoryDifEntity> dataResult = new DataListResult <InventoryDifEntity>()
            {
                Code     = (int)EResponseCode.Success,
                Message  = "响应成功",
                Result   = listResult,
                PageInfo = pageInfo
            };

            return(Content(JsonHelper.SerializeObject(dataResult)));
        }
Beispiel #7
0
        /// <summary>
        /// 保存盘点差异单
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int SaveDif(InventoryDifEntity entity)
        {
            entity.DifQty = entity.FirstQty - entity.LocalQty;
            LocationProvider provider = new LocationProvider(this.CompanyID);
            LocationEntity   Location = provider.GetSingleByNum(entity.LocalNum);

            if (Location != null)
            {
                entity.LocalName = Location.LocalName;
            }
            entity.Include(a => new { a.BatchNum, a.LocalNum, a.LocalName, a.FirstQty, a.DifQty });
            entity.Where(a => a.SnNum == entity.SnNum)
            .And(a => a.CompanyID == this.CompanyID)
            ;
            int line = this.InventoryDif.Update(entity);

            return(line);
        }
Beispiel #8
0
        /// <summary>
        /// 新增盘差数据
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int AddDif(InventoryDifEntity entity)
        {
            int line = 0;

            //检查是否库位存在该产品
            InventoryDifEntity check = new InventoryDifEntity();

            check.Where(a => a.ProductNum == entity.ProductNum)
            .And(a => a.LocalNum == entity.LocalNum)
            .And(a => a.BatchNum == entity.BatchNum)
            .And(a => a.CompanyID == this.CompanyID)
            ;
            check.IncludeAll();
            check = this.InventoryDif.GetSingle(check);
            if (check.IsNotNull())
            {
                check.FirstQty = entity.FirstQty;
                check.IncludeFirstQty(true);
                check.Where(a => a.SnNum == check.SnNum);
                line = this.InventoryDif.Update(check);
            }
            else
            {
                LocationProvider provider = new LocationProvider(this.CompanyID);
                LocationEntity   Location = provider.GetSingleByNum(entity.LocalNum);
                if (Location != null)
                {
                    entity.LocalName = Location.LocalName;
                }
                entity.DifQty     = entity.FirstQty - entity.LocalQty;
                entity.SnNum      = ConvertHelper.NewGuid();
                entity.CreateTime = DateTime.Now;
                entity.CompanyID  = this.CompanyID;
                entity.IncludeAll();
                line = this.InventoryDif.Add(entity);
            }
            return(line);
        }