Ejemplo n.º 1
0
        public ActionResult SupplierDetailList()
        {
            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;

            SupplierProvider provider = new SupplierProvider();
            SupplierEntity entity = new SupplierEntity();
            PageInfo pageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize };
            List<SupplierEntity> listResult = provider.GetList(entity, ref pageInfo);
            listResult = listResult.IsNull() ? new List<SupplierEntity>() : listResult;
            InStorageProvider inProvider = new InStorageProvider();
            foreach (SupplierEntity item in listResult)
            {
                item.Num = inProvider.GetNumBySupNum(item.SupNum, queryTime, storageNum);
            }
            string json = ConvertJson.ListToJson<SupplierEntity>(listResult, "List");
            this.ReturnJson.AddProperty("Data", new JsonObject(json));
            this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount);
            return Content(this.ReturnJson.ToString());
        }
Ejemplo n.º 2
0
        public ActionResult SupplierReportTOP10()
        {
            int queryTime = WebUtil.GetFormValue<int>("QueryTime", 0);
            int pageIndex = 1;
            int pageSize = 10;
            string storageNum = this.DefaultStore;

            InStorageProvider provider = new InStorageProvider();
            PageInfo pageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize };

            List<InStorageEntity> listResult = provider.GetListTOP10(queryTime, storageNum);
            listResult = listResult.IsNull() ? new List<InStorageEntity>() : listResult;
            SupplierProvider cusProvider = new SupplierProvider();
            foreach (InStorageEntity item in listResult)
            {
                SupplierEntity tempItem = cusProvider.GetSupplier(item.SupNum);
                item.SupName = tempItem.SupName;
                item.Description = tempItem.Description;
            }
            /*******************************************订单数量排名前十的供应商饼图数据****************************************************/
            StringBuilder sb = new StringBuilder();
            sb.Append("<pie>");
            listResult.ForEach(a =>
            {
                if (a.Num > 0)
                {
                    sb.AppendFormat("<slice title=\"{0}\">{1}</slice>", a.SupName, a.Num.ToString());
                }
            });
            sb.Append("</pie>");
            this.ReturnJson.AddProperty("InStorageData", sb.ToString());
            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());
        }
Ejemplo n.º 3
0
        public ActionResult ProductInOutReportList()
        {
            int queryTime = WebUtil.GetFormValue<int>("QueryTime", 0);
            string storageNum = this.DefaultStore;
            int pageIndex = WebUtil.GetFormValue<int>("pageIndex", 0);
            int pageSize = WebUtil.GetFormValue<int>("pageSize", 0);

            string Key = "InOutReprt" + DateTime.Now.AddDays(-queryTime).ToString("yyMMdd") + DateTime.Now.ToString("yyMMdd") + storageNum;
            List<ProductEntity> listResult = CacheHelper.Get(Key) as List<ProductEntity>;
            if (listResult.IsNullOrEmpty())
            {
                listResult = new List<ProductEntity>();
                InStorageProvider inProvider = new InStorageProvider();
                List<ReportChart> listInSource = inProvider.GetChartTop((int)EAudite.Pass, this.DefaultStore, DateTime.Now.AddDays(-queryTime), DateTime.Now);
                if (!listInSource.IsNullOrEmpty())
                {
                    foreach (ReportChart chart in listInSource)
                    {
                        ProductEntity entity = new ProductEntity();
                        entity.SnNum = chart.ProductNum;
                        entity.BarCode = chart.BarCode;
                        entity.ProductName = chart.ProductName;
                        entity.InStorageNum = chart.Num;
                        entity.Size = chart.Size.IsEmpty() ? "" : chart.Size;
                        listResult.Add(entity);
                    }
                }
                OutStorageProvider outProvider = new OutStorageProvider();
                List<ReportChart> listOutSource = listInSource = outProvider.GetChartTop((int)EAudite.Pass, this.DefaultStore, DateTime.Now.AddDays(-queryTime), DateTime.Now);
                if (!listOutSource.IsNullOrEmpty())
                {
                    foreach (ReportChart chart in listOutSource)
                    {
                        if (listResult.Exists(a => a.SnNum == chart.ProductNum))
                        {
                            ProductEntity entity = listResult.First(a => a.SnNum == chart.ProductNum);
                            entity.OutStorageNum = chart.Num;
                        }
                        else
                        {
                            ProductEntity entity = new ProductEntity();
                            entity.SnNum = chart.ProductNum;
                            entity.BarCode = chart.BarCode;
                            entity.ProductName = chart.ProductName;
                            entity.OutStorageNum = chart.Num;
                            entity.Size = chart.Size.IsEmpty() ? "" : chart.Size;
                            listResult.Add(entity);
                        }
                    }
                }
                if (!listResult.IsNullOrEmpty())
                {
                    double inTotalNum = listResult.Sum(a => a.InStorageNum);
                    double outTotalNum = listResult.Sum(a => a.OutStorageNum);
                    listResult.ForEach(a =>
                    {
                        a.InStorageNumPCT = inTotalNum > 0 ? a.InStorageNum*100 / inTotalNum : 0;
                        a.OutStorageNumPCT = outTotalNum > 0 ? a.OutStorageNum*100 / outTotalNum : 0;
                    });
                    CacheHelper.Insert(Key, listResult, null, DateTime.Now.AddMinutes(30));
                }
            }
            int rowCount = listResult.Count;
            listResult = listResult.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList();
            string json = ConvertJson.ListToJson<ProductEntity>(listResult, "List");
            this.ReturnJson.AddProperty("Data", new JsonObject(json));
            this.ReturnJson.AddProperty("RowCount", rowCount);
            return Content(this.ReturnJson.ToString());
        }
Ejemplo n.º 4
0
        public ActionResult InStorageReportDetail()
        {
            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;

            PageInfo procPageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize };
            InStorageProvider provider = new InStorageProvider();
            List<Proc_InStorageReportEntity> detailList = provider.GetList(queryTime, ref procPageInfo, storageNum);
            detailList = detailList == null ? new List<Proc_InStorageReportEntity>() : detailList;
            detailList.ForEach(a =>
            {
                a.Amount = a.Amount / 10000;
            });
            string jsonDetail = ConvertJson.ListToJson<Proc_InStorageReportEntity>(detailList, "List");
            this.ReturnJson.AddProperty("Data", new JsonObject(jsonDetail));
            this.ReturnJson.AddProperty("RowCount", procPageInfo.RowCount);
            return Content(this.ReturnJson.ToString());
        }
Ejemplo n.º 5
0
        public ActionResult InStorageAmpie()
        {
            int queryTime = WebUtil.GetFormValue<int>("QueryTime", 0);
            int pageIndex = WebUtil.GetFormValue<int>("pageIndex", 0);
            int pageSize = 10;
            string storageNum = this.DefaultStore;

            PageInfo procPageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize };
            InStorageProvider provider = new InStorageProvider();
            List<Proc_InStorageReportEntity> detailList = provider.GetList(queryTime, ref procPageInfo, storageNum);
            detailList = detailList == null ? new List<Proc_InStorageReportEntity>() : detailList;

            StringBuilder sb = new StringBuilder();
            sb.Append("<chart>");
            sb.Append("<series>");
            int index = 0;
            detailList.ForEach(a =>
            {
                //日期
                sb.AppendFormat("<value xid=\"{0}\">{1}</value>", index.ToString(), a.CreateTime.ToString("MM-dd"));
                index++;
            });
            index = 0;
            sb.Append("</series>");
            sb.Append("<graphs>");
            sb.Append("<graph gid=\"1\">");
            detailList.ForEach(a =>
            {
                //数量
                sb.AppendFormat("<value xid=\"{0}\">{1}</value>", index.ToString(), a.Num.ToString());
                index++;
            });
            index = 0;
            sb.Append("</graph>");
            sb.Append("<graph gid=\"2\">");
            detailList.ForEach(a =>
            {
                //数量
                sb.AppendFormat("<value xid=\"{0}\">{1}</value>", index.ToString(), (a.Amount / 10000).ToString());
                index++;
            });
            sb.Append("</graph>");
            sb.Append("</graphs>");
            sb.Append("</chart>");
            this.ReturnJson.AddProperty("InStorageData", sb.ToString());
            this.ReturnJson.AddProperty("RowCount", procPageInfo.RowCount);
            return Content(this.ReturnJson.ToString());
        }
Ejemplo n.º 6
0
        public ActionResult BindPieData()
        {
            int queryTime = WebUtil.GetFormValue<int>("QueryTime", 0);
            string storageNum = this.DefaultStore;
            InStorageProvider inProvider = new InStorageProvider();
            List<ReportChart> listInSource = inProvider.GetChartTop((int)EAudite.Pass, this.DefaultStore, DateTime.Now.AddDays(-queryTime), DateTime.Now);
            StringBuilder sbInStorage = new StringBuilder();
            sbInStorage.Append("<pie>");
            listInSource.ForEach(a =>
            {
                sbInStorage.AppendFormat("<slice title=\"{0}\">{1}</slice>", a.ProductName, a.Num);
            });
            sbInStorage.Append("</pie>");

            OutStorageProvider outProvider = new OutStorageProvider();
            listInSource = outProvider.GetChartTop((int)EAudite.Pass, this.DefaultStore, DateTime.Now.AddDays(-queryTime), DateTime.Now);
            StringBuilder sbOutStorage = new StringBuilder();
            sbOutStorage.Append("<pie>");
            listInSource.ForEach(a =>
            {
                sbOutStorage.AppendFormat("<slice title=\"{0}\">{1}</slice>", a.ProductName, a.Num);
            });
            sbOutStorage.Append("</pie>");
            this.ReturnJson.AddProperty("InStorageData", sbInStorage.ToString());
            this.ReturnJson.AddProperty("OutStorageData", sbOutStorage.ToString());
            return Content(this.ReturnJson.ToString());
        }
Ejemplo n.º 7
0
 public ActionResult EditNum()
 {
     string snNum = WebUtil.GetFormValue<string>("SnNum", string.Empty);
     double num = WebUtil.GetFormValue<double>("num", 0);
     InStorageProvider provider = new InStorageProvider();
     int line = provider.EditInOrderNum(snNum, num);
     List<InStorDetailEntity> list = Session[CacheKey.TEMPDATA_CACHE_INSTORDETAIL] as List<InStorDetailEntity>;
     if (!list.IsNullOrEmpty())
     {
         if (list.Exists(a => a.SnNum == snNum))
         {
             InStorDetailEntity detail = list.First(a => a.SnNum == snNum);
             detail.Num = num;
             detail.Amount = num * detail.Amount;
         }
     }
     return Content(string.Empty);
 }