public ActionResult GetList()
        {
            int    status    = WebUtil.GetFormValue <int>("Status", 0);
            string orderNum  = WebUtil.GetFormValue <string>("OrderNum", string.Empty);
            string supName   = WebUtil.GetFormValue <string>("SupName", string.Empty);
            string beginTime = WebUtil.GetFormValue <string>("beginTime", string.Empty);
            string endTime   = WebUtil.GetFormValue <string>("endTime", string.Empty);
            int    pageSize  = WebUtil.GetFormValue <int>("PageSize", 10);
            int    pageIndex = WebUtil.GetFormValue <int>("PageIndex", 1);
            int    InType    = WebUtil.GetFormValue <int>("InType", 0);
            string planNum   = WebUtil.GetFormValue <string>("planNum", string.Empty);

            PageInfo pageInfo = new PageInfo()
            {
                PageIndex = pageIndex, PageSize = pageSize
            };
            InStorageEntity entity = new InStorageEntity();

            if (status > 0)
            {
                entity.Where(a => a.Status == status);
            }
            if (!orderNum.IsEmpty())
            {
                entity.Where("OrderNum", ECondition.Like, "%" + orderNum + "%");
            }
            if (!supName.IsEmpty())
            {
                entity.AndBegin <InStorageEntity>()
                .And <InStorageEntity>("SupNum", ECondition.Like, "%" + supName + "%")
                .Or <InStorageEntity>("SupName", ECondition.Like, "%" + supName + "%")
                .End <InStorageEntity>()
                ;
            }
            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 (InType > 0)
            {
                entity.And(a => a.InType == InType);
            }
            if (!planNum.IsEmpty())
            {
                entity.And("ContractOrder", ECondition.Like, "%" + planNum + "%");
            }

            Bill <InStorageEntity, InStorDetailEntity> bill = new InStorageOrder();
            List <InStorageEntity> listResult = bill.GetList(entity, ref pageInfo);

            listResult = listResult == null ? new List <InStorageEntity>() : listResult;
            string json = ConvertJson.ListToJson <InStorageEntity>(listResult, "List");

            this.ReturnJson.AddProperty("Data", json);
            this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount);
            return(Content(this.ReturnJson.ToString()));
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获得某个供应商的所有订购产品数量
        /// </summary>
        /// <param name="supNum"></param>
        /// <param name="queryTime"></param>
        /// <param name="storageNum"></param>
        /// <returns></returns>
        public double GetNumBySupNum(string supNum, int queryTime, string storageNum)
        {
            InStorageEntity entity = new InStorageEntity();

            entity.IncludeNum(true);
            entity.Where("CreateTime", ECondition.Between, DateTime.Now.AddDays(-queryTime), DateTime.Now);
            entity.And("StorageNum", ECondition.Eth, storageNum);
            entity.And("SupNum", ECondition.Eth, supNum);
            entity.And("Status", ECondition.Eth, (int)EAudite.Pass);
            entity.And("IsDelete", ECondition.Eth, (int)EIsDelete.NotDelete);
            double allNum = 0;

            try
            {
                allNum = this.InStorage.Sum <double>(entity);
            }
            catch (Exception e)
            {
                allNum = 0;
                log.Info(e.Message);
            }
            return(allNum);
        }