コード例 #1
0
ファイル: ReturnProvider.cs プロジェクト: liorld/-WMS
        /// <summary>
        /// 查询单据分页
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="pageInfo"></param>
        /// <returns></returns>
        public List <ReturnOrderEntity> GetList(ReturnOrderEntity entity, ref PageInfo pageInfo)
        {
            entity.IncludeAll();
            entity.Where(a => a.IsDelete == (int)EIsDelete.NotDelete);
            entity.And("Status", ECondition.Eth, (int)EAudite.Pass);
            entity.OrderBy(a => a.ID, EOrderBy.DESC);
            ReturnDetailEntity detail = new ReturnDetailEntity();

            detail.Include(a => new { ProductName = a.ProductName, BarCode = a.BarCode, ProductNum = a.ProductNum });
            entity.Left <ReturnDetailEntity>(detail, new Params <string, string>()
            {
                Item1 = "OrderNum", Item2 = "OrderNum"
            });
            int rowCount = 0;
            List <ReturnOrderEntity> listResult = this.ReturnOrder.GetList(entity, pageInfo.PageSize, pageInfo.PageIndex, out rowCount);
            int allNum = GetAllNum();

            if (!listResult.IsNullOrEmpty())
            {
                foreach (ReturnOrderEntity item in listResult)
                {
                    item.NumPCT = ((float)item.Num * 100.00f) / allNum;
                }
            }
            pageInfo.RowCount = rowCount;
            return(listResult);
        }
コード例 #2
0
ファイル: ReturnProvider.cs プロジェクト: liorld/-WMS
        /// <summary>
        /// 根据关联单号查询已经退货的的情况
        /// </summary>
        /// <param name="orderNum"></param>
        /// <returns></returns>
        public List <ReturnDetailEntity> GetDetailByOrder(string orderNum)
        {
            ReturnDetailEntity entity = new ReturnDetailEntity();

            entity.IncludeAll();
            ReturnOrderEntity order = new ReturnOrderEntity();

            entity.Left <ReturnOrderEntity>(order, new Params <string, string>()
            {
                Item1 = "OrderNum", Item2 = "OrderNum"
            });
            order.Where(a => a.Status == (int)EAudite.Pass);
            order.Where(a => a.ContractOrder == orderNum);
            List <ReturnDetailEntity> list = this.ReturnDetail.GetList(entity);

            return(list);
        }
コード例 #3
0
        public ActionResult GetList()
        {
            int      status    = WebUtil.GetFormValue <int>("Status", 0);
            string   orderNum  = WebUtil.GetFormValue <string>("OrderNum", 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);
            PageInfo pageInfo  = new PageInfo()
            {
                PageIndex = pageIndex, PageSize = pageSize
            };
            ReturnOrderEntity entity = new ReturnOrderEntity();

            if (status > 0)
            {
                entity.Where(a => a.Status == status);
            }
            if (!orderNum.IsEmpty())
            {
                entity.Where("OrderNum", ECondition.Like, "%" + orderNum + "%");
            }
            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);
            Bill <ReturnOrderEntity, ReturnDetailEntity> bill = new ReturnOrder();
            List <ReturnOrderEntity> listResult = bill.GetList(entity, ref pageInfo);

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

            this.ReturnJson.AddProperty("Data", json);
            this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount);
            return(Content(this.ReturnJson.ToString()));
        }
コード例 #4
0
ファイル: ReturnProvider.cs プロジェクト: liorld/-WMS
        /// <summary>
        /// 用于判断该订单是否已经正在出库
        /// </summary>
        /// <returns></returns>
        public ReturnOrderEntity CheckOrder(string orderNum)
        {
            ReturnDetailEntity entity = new ReturnDetailEntity()
            {
                ContractOrder = orderNum
            };
            ReturnOrderEntity order = new ReturnOrderEntity();

            order.Where(a => a.Status == (int)EAudite.Wait);
            order.IncludeAll();
            entity.Left <ReturnOrderEntity>(order, new Params <string, string>()
            {
                Item1 = "OrderNum", Item2 = "OrderNum"
            });
            order = this.ReturnOrder.GetSingle(order);
            return(order);
        }
コード例 #5
0
ファイル: ReturnProvider.cs プロジェクト: liorld/-WMS
        /// <summary>
        /// 获得所有退货数量
        /// </summary>
        /// <returns></returns>
        public int GetAllNum()
        {
            ReturnOrderEntity entity = new ReturnOrderEntity();

            entity.IncludeNum(true);
            entity.Where("Status", ECondition.Eth, (int)EAudite.Pass);
            entity.And("IsDelete", ECondition.Eth, (int)EIsDelete.NotDelete);
            int allNum = 0;

            try
            {
                allNum = this.ReturnOrder.Sum <int>(entity);
            }
            catch (Exception e)
            {
                allNum = 0;
                log.Info(e.Message);
            }
            return(allNum);
        }
コード例 #6
0
        public ActionResult ToExcel()
        {
            int      status    = WebUtil.GetFormValue <int>("Status", 0);
            string   orderNum  = WebUtil.GetFormValue <string>("OrderNum", string.Empty);
            string   beginTime = WebUtil.GetFormValue <string>("beginTime", string.Empty);
            string   endTime   = WebUtil.GetFormValue <string>("endTime", string.Empty);
            int      pageSize  = Int32.MaxValue;
            int      pageIndex = WebUtil.GetFormValue <int>("PageIndex", 1);
            PageInfo pageInfo  = new PageInfo()
            {
                PageIndex = pageIndex, PageSize = pageSize
            };
            ReturnOrderEntity entity = new ReturnOrderEntity();

            if (status > 0)
            {
                entity.Where(a => a.Status == status);
            }
            if (!orderNum.IsEmpty())
            {
                entity.Where("OrderNum", ECondition.Like, "%" + orderNum + "%");
            }
            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);
            Bill <ReturnOrderEntity, ReturnDetailEntity> bill = new ReturnOrder();
            List <ReturnOrderEntity> listResult = bill.GetList(entity, ref pageInfo);

            listResult = listResult == null ? new List <ReturnOrderEntity>() : 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("创建时间"));
                foreach (ReturnOrderEntity t in listResult)
                {
                    DataRow row = dt.NewRow();
                    row[0] = t.OrderNum;
                    row[1] = EnumHelper.GetEnumDesc <ECheckType>(t.ReturnType);
                    row[2] = t.Num;
                    row[3] = t.ContractOrder;
                    row[4] = EnumHelper.GetEnumDesc <EAudite>(t.Status);
                    row[5] = t.CreateUserName;
                    row[6] = EnumHelper.GetEnumDesc <EOpType>(t.OperateType);
                    row[7] = t.CreateTime.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());
            }
            else
            {
                this.ReturnJson.AddProperty("d", "无数据导出!");
            }
            return(Content(this.ReturnJson.ToString()));
        }