예제 #1
0
        /// <summary>
        /// 加工工艺用料总排行
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public ProcessingRankingRetModel GetProcessingRankingListReport(EndingStocksRequest request)
        {
            SqlParameter[] par = new SqlParameter[]
            {
                new SqlParameter("@ProcessFactoryCode", request.ProcessFactoryCode),
                new SqlParameter("@MaterialCode", request.MaterialCode),
                new SqlParameter("@MaterialNames", request.MaterialNameSelect),
                new SqlParameter("@SpecificationModel", request.SpecificationModel),
                new SqlParameter("@Year", request.Year),
                new SqlParameter("@Month", request.Month),
            };
            var ret = new ProcessingRankingRetModel();

            try
            {
                var list = Db.Context.FromProc("ProcessingRankingListReport_Proc").AddParameter(par).ToList <ProcessingRankingReportModel>();
                if (list.Count > 0)
                {
                    ret.Name = list.Select(p => p.ProcessingTechnologyName).ToList();
                    ret.Data = list.Select(p => p.WeightSmallPlan).ToList();
                }
                return(ret);
            }
            catch (Exception)
            {
                return(ret);
            }
        }
예제 #2
0
        /// <summary>
        /// 原材料用量总排行
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public MaterialRankingListReportRetModel GetMaterialRankingListReport(EndingStocksRequest request)
        {
            SqlParameter[] par = new SqlParameter[]
            {
                new SqlParameter("@ProcessFactoryCode", request.ProcessFactoryCode),
                new SqlParameter("@MaterialNames", request.MaterialNameSelect),
                new SqlParameter("@SpecificationModel", request.SpecificationModel),
                new SqlParameter("@Year", request.Year),
                new SqlParameter("@Month", request.Month),
            };
            var ret = new MaterialRankingListReportRetModel();

            try
            {
                var list = Db.Context.FromProc("MaterialRankingListReport_Proc").AddParameter(par).ToList <MaterialRankingListReportModel>();
                if (list.Count > 0)
                {
                    ret.Name = list.Select(p => p.MaterialName + " " + p.SpecificationModel).ToList();
                    var dataList = new List <DataModel>();
                    list.ForEach(x =>
                    {
                        var item  = new DataModel();
                        item.y    = x.WeightSmallPlan;
                        item.code = x.MaterialCode;
                        dataList.Add(item);
                    });
                    ret.Data = dataList;
                }
                return(ret);
            }
            catch (Exception)
            {
                return(ret);
            }
        }
예제 #3
0
 public HttpResponseMessage GetMaterialTotalStockReport([FromUri] EndingStocksRequest request)
 {
     try
     {
         var data = _esLogic.GetMaterialTotalStockReport(request);
         return(AjaxResult.Success(data).ToJsonApi());
     }
     catch (Exception)
     {
         return(AjaxResult.Error("操作失败").ToJsonApi());
     }
 }
예제 #4
0
        /// <summary>
        /// 原材料总库存及订单需求量历史分析
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public MaterialTotalHistoryStockRetModel GetMaterialTotalHistoryStockReport(EndingStocksRequest request)
        {
            SqlParameter[] par = new SqlParameter[]
            {
                new SqlParameter("@ProcessFactoryCode", request.ProcessFactoryCode),
                new SqlParameter("@MaterialCode", request.MaterialCode),
                new SqlParameter("@MaterialNames", request.MaterialNameSelect),
                new SqlParameter("@SpecificationModel", request.SpecificationModel),
                new SqlParameter("@Year", request.Year),
                new SqlParameter("@Month", request.Month),
            };
            var ret = new MaterialTotalHistoryStockRetModel();

            try
            {
                var list = Db.Context.FromProc("MaterialTotalStockHistoryReport_Proc").AddParameter(par).ToList <MaterialTotalHistoryStockReportModel>();
                if (list.Count > 0)
                {
                    if (string.IsNullOrEmpty(request.MaterialCode))
                    {
                        list = list.GroupBy(p => new { p.Yar, p.Mth, p.Dayi })
                               .Select(p => new MaterialTotalHistoryStockReportModel
                        {
                            Yar             = p.Key.Yar,
                            Mth             = p.Key.Mth,
                            Dayi            = p.Key.Dayi,
                            WeightSmallPlan = p.Sum(y => y.WeightSmallPlan),
                            Count           = p.Sum(y => y.Count)
                        }).ToList();
                    }

                    if (request.Month == 0)
                    {
                        ret.Name = list.Select(p => p.Mth).ToList();
                    }
                    else
                    {
                        ret.Name = list.Select(p => p.Dayi).ToList();
                    }
                    ret.Data1 = list.Select(p => p.Count).ToList();
                    ret.Data2 = list.Select(p => p.WeightSmallPlan).ToList();
                }
                return(ret);
            }
            catch (Exception)
            {
                return(ret);
            }
        }
예제 #5
0
        /// <summary>
        ///材料月度计划量及批次计划量统计
        /// </summary>
        /// <returns></returns>
        public DataTable GetMonthBatchPlanReport(EndingStocksRequest request)
        {
            string where = " WHERE a.Examinestatus='审核完成' ";
            if (request.Year > 0)
            {
                where += " and YEAR(a.insertTime)=" + request.Year;
                if (request.Month > 0)
                {
                    where += " and MONTH(a.insertTime)=" + request.Month;
                }
            }
            string sql = @"SELECT
                            ISNULL(dbo.GetCompanyParentName_fun(tc.CompanyCode),tc.CompanyFullName) AS CompanyName, 
                             (
                                SELECT ISNULL(SUM(a.PlanTotal+ISNULL(b.SupplyPlanNum,0)),0) AS PlanTotal 
								FROM TbRawMaterialMonthDemandPlan a
								LEFT JOIN TbRawMaterialMonthDemandSupplyPlan b ON a.DemandPlanCode=b.DemandPlanCode AND b.IsSupply=0 AND b.Examinestatus='审核完成'
								@WHERE
                                AND a.WorkAreaCode IN
                                (
                                  SELECT CompanyCode from dbo.GetCompanyChild_fun(tc.CompanyCode) WHERE OrgType=4
                                )
                             ) PlanTotal, --月度计划量
                             (
                                SELECT ISNULL(sum(BatchPlanTotal),0) AS BatchPlanTotal 
								FROM TbFactoryBatchNeedPlan a
								@WHERE
                                AND 
                                a.WorkAreaCode IN
                                (
                                  SELECT CompanyCode from dbo.GetCompanyChild_fun(tc.CompanyCode) WHERE OrgType=4
                                ) 
                             )BatchPlanTotal --批次计划量
                            FROM TbCompany tc
                            LEFT JOIN TbProjectCompany b ON tc.CompanyCode=b.CompanyCode
                            WHERE 
                            tc.OrgType=@OrgType 
                            AND b.ProjectId=@ProjectId
                            ORDER BY PlanTotal desc"    ;

            sql = sql.Replace("@WHERE", where);
            sql = sql.Replace("@ProjectId", request.ProjectId);
            sql = sql.Replace("@OrgType", request.OrgType);
            var retData = Db.Context.FromSql(sql).ToDataTable();

            return(retData);
        }
예제 #6
0
        /// <summary>
        /// 加工工艺用料总排行
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public ActionResult GetProcessingRankingListReport(EndingStocksRequest request)
        {
            var data = _esLogic.GetProcessingRankingListReport(request);

            return(Content(data.ToJson()));
        }
예제 #7
0
        /// <summary>
        /// 原材料总库存及订单需求量历史分析
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public ActionResult GetMaterialTotalHistoryStockReport(EndingStocksRequest request)
        {
            var data = _esLogic.GetMaterialTotalHistoryStockReport(request);

            return(Content(data.ToJson()));
        }
예제 #8
0
        /// <summary>
        /// 原材料总库存用量统计
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public MaterialTotalStockReportRetModel GetMaterialTotalStockReport(EndingStocksRequest request)
        {
            SqlParameter[] par = new SqlParameter[]
            {
                new SqlParameter("@ProcessFactoryCode", request.ProcessFactoryCode),
                new SqlParameter("@MaterialNames", request.MaterialNameSelect),
                new SqlParameter("@SpecificationModel", request.SpecificationModel),
            };
            var ret = new MaterialTotalStockReportRetModel();

            try
            {
                var list = Db.Context.FromProc("MaterialTotalStockReport_Proc").AddParameter(par).ToList <MaterialTotalStockReportModel>();
                if (list.Count > 0)
                {
                    if (string.IsNullOrEmpty(request.ProcessFactoryCode))
                    {
                        list = list.GroupBy(p => new { p.MaterialCode, p.MaterialName, p.SpecificationModel })
                               .Select(p => new MaterialTotalStockReportModel
                        {
                            MaterialCode       = p.Key.MaterialCode,
                            MaterialName       = p.Key.MaterialName,
                            SpecificationModel = p.Key.SpecificationModel,
                            WeightSmallPlan    = p.Sum(y => y.WeightSmallPlan),
                            Count = p.Sum(y => y.Count)
                        }).ToList();
                    }
                    ret.Name = list.Select(p => p.MaterialName + " " + p.SpecificationModel).ToList();
                    var dataList1 = new List <DataModel>();
                    var dataList2 = new List <DataModel>();
                    list.ForEach(x =>
                    {
                        var item = new DataModel()
                        {
                            y         = x.Count,
                            code      = x.MaterialCode,
                            point     = -1,
                            RebarType = x.RebarType
                        };
                        dataList1.Add(item);
                        var item2 = new DataModel()
                        {
                            y         = x.WeightSmallPlan,
                            code      = x.MaterialCode,
                            point     = x.Point,
                            RebarType = x.RebarType
                        };
                        dataList2.Add(item2);
                    });
                    decimal xg1   = 0;
                    decimal jzgj1 = 0;
                    if (dataList1.Count > 0)
                    {
                        xg1   = dataList1.Where(p => p.RebarType == "SectionSteel").Sum(p => p.y);
                        jzgj1 = dataList1.Where(p => p.RebarType == "BuildingSteel").Sum(p => p.y);
                    }
                    decimal xg2   = 0;
                    decimal jzgj2 = 0;
                    if (dataList2.Count > 0)
                    {
                        xg2   = dataList2.Where(p => p.RebarType == "SectionSteel").Sum(p => p.y);
                        jzgj2 = dataList2.Where(p => p.RebarType == "BuildingSteel").Sum(p => p.y);
                    }

                    var sumRebarType = new RebarTypeDataModel()
                    {
                        xg1   = xg1,
                        xg2   = xg2,
                        jzgj1 = jzgj1,
                        jzgj2 = jzgj2
                    };
                    ret.SumRebarTypeData = sumRebarType;
                    ret.Data1            = dataList1;
                    ret.Data2            = dataList2;
                }
                return(ret);
            }
            catch (Exception)
            {
                return(ret);
            }
        }