コード例 #1
0
        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()));
        }
コード例 #2
0
        /// <summary>
        /// 查询入库单分页列表
        /// </summary>
        /// <returns></returns>
        public ActionResult GetOrderList()
        {
            string CompanyID     = WebUtil.GetFormValue <string>("CompanyID");
            int    PageIndex     = WebUtil.GetFormValue <int>("PageIndex", 1);
            int    PageSize      = WebUtil.GetFormValue <int>("PageSize", 10);
            string OrderNum      = WebUtil.GetFormValue <string>("OrderNum");
            int    InType        = WebUtil.GetFormValue <int>("InType", 0);
            string SupNum        = WebUtil.GetFormValue <string>("SupNum");
            string SupName       = WebUtil.GetFormValue <string>("SupName");
            string Phone         = WebUtil.GetFormValue <string>("Phone");
            string StorageNum    = WebUtil.GetFormValue <string>("StorageNum");
            string ContractOrder = WebUtil.GetFormValue <string>("ContractOrder");
            int    Status        = WebUtil.GetFormValue <int>("Status", 0);
            string BeginTime     = WebUtil.GetFormValue <string>("BeginTime");
            string EndTime       = WebUtil.GetFormValue <string>("EndTime");

            InStorageEntity entity = new InStorageEntity();

            entity.CompanyID     = CompanyID;
            entity.OrderNum      = OrderNum;
            entity.InType        = InType;
            entity.SupNum        = SupNum;
            entity.SupName       = SupName;
            entity.Phone         = Phone;
            entity.StorageNum    = StorageNum;
            entity.ContractOrder = ContractOrder;
            entity.Status        = Status;
            entity.BeginTime     = BeginTime;
            entity.EndTime       = EndTime;

            Bill <InStorageEntity, InStorDetailEntity> bill = new InStorageOrder(CompanyID);
            PageInfo pageInfo = new PageInfo()
            {
                PageIndex = PageIndex, PageSize = PageSize
            };
            List <InStorageEntity>           listResult = bill.GetList(entity, ref pageInfo);
            DataListResult <InStorageEntity> dataResult = new DataListResult <InStorageEntity>()
            {
                Code     = (int)EResponseCode.Success,
                Message  = "响应成功",
                Result   = listResult,
                PageInfo = pageInfo
            };

            return(Content(JsonHelper.SerializeObject(dataResult)));
        }
コード例 #3
0
        /// <summary>
        /// 导出Excel
        /// </summary>
        /// <returns></returns>
        public ActionResult ToExcel()
        {
            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  = Int32.MaxValue;
            int      pageIndex = 1;
            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));
            }
            Bill <InStorageEntity, InStorDetailEntity> bill = new InStorageOrder();
            List <InStorageEntity> listResult = bill.GetList(entity, ref pageInfo);

            listResult = listResult == null ? new List <InStorageEntity>() : listResult;
            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("创建时间"));
            foreach (InStorageEntity t in listResult)
            {
                DataRow row = dt.NewRow();
                row[0] = t.OrderNum;
                row[1] = EnumHelper.GetEnumDesc <EInType>(t.InType);
                row[2] = t.SupName;
                row[3] = t.ContractOrder;
                row[4] = t.Num;
                row[5] = t.Amount.ToString("0.00") + " 元";
                row[6] = EnumHelper.GetEnumDesc <EAudite>(t.Status);
                row[7] = t.CreateUserName;
                row[8] = EnumHelper.GetEnumDesc <EOpType>(t.OperateType);
                row[9] = t.OrderTime.ToString("yyyy-MM-dd");
                dt.Rows.Add(row);
            }
            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());

            return(Content(this.ReturnJson.ToString()));
        }
コード例 #4
0
        public ActionResult InStorageReport()
        {
            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;

            InStorageEntity entity = new InStorageEntity();
            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<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", new JsonObject(json));
            this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount);
            return Content(this.ReturnJson.ToString());
        }
コード例 #5
0
        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());
        }
コード例 #6
0
        /// <summary>
        /// 导出Excel
        /// </summary>
        /// <returns></returns>
        public ActionResult ToExcel()
        {
            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 = Int32.MaxValue;
            int pageIndex = 1;
            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));
            }
            Bill<InStorageEntity, InStorDetailEntity> bill = new InStorageOrder();
            List<InStorageEntity> listResult = bill.GetList(entity, ref pageInfo);
            listResult = listResult == null ? new List<InStorageEntity>() : listResult;
            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("创建时间"));
            foreach (InStorageEntity t in listResult)
            {
                DataRow row = dt.NewRow();
                row[0] = t.OrderNum;
                row[1] = EnumHelper.GetEnumDesc<EInType>(t.InType);
                row[2] = t.SupName;
                row[3] = t.ContractOrder;
                row[4] = t.Num;
                row[5] = t.Amount.ToString("0.00")+" 元";
                row[6] = EnumHelper.GetEnumDesc<EAudite>(t.Status);
                row[7] = t.CreateUserName;
                row[8] = EnumHelper.GetEnumDesc<EOpType>(t.OperateType);
                row[9] = t.OrderTime.ToString("yyyy-MM-dd");
                dt.Rows.Add(row);
            }
            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());

            return Content(this.ReturnJson.ToString());
        }