/// <summary>
        /// 未完成盘点列表
        /// </summary>
        /// <returns></returns>
        public IActionResult Index()
        {
            const string sql   = "SELECT * FROM Asset_Stock WHERE IsDel=0 AND IsFinish=0";
            var          stock = _db.FetchBySql <Stock>(sql);

            return(View(stock));
        }
Example #2
0
        /// <summary>
        /// 部门月度汇总
        /// </summary>
        /// <param name="year"></param>
        /// <returns></returns>
        public List <SummaryViewModel> DeptMonthSummary(int year, bool isContainsDeletedDept = false)
        {
            string sql  = "SELECT DeptId AS Id,Month AS DateUnit,SUM(HJ) AS HJ,SUM(ML) AS ML,SUM(ZMML) AS ML,SUM(XY) AS XY FROM Base_MonthReport WHERE Year=@Year AND IsDel=0 GROUP BY DeptId,Month";
            var    list = db.FetchBySql <SummaryViewModel>(sql, new { Year = year });

            var depts = DeptUtil.All();

            var result = new List <SummaryViewModel>();

            foreach (var dept in depts.OrderBy(d => d.Sort))
            {
                var datas = list.Where(m => m.Id == dept.Id);
                for (var i = 1; i <= 12; i++)
                {
                    var data = datas.Where(d => d.DateUnit == i).SingleOrDefault();
                    if (data == null)
                    {
                        result.Add(new SummaryViewModel
                        {
                            Id       = dept.Id,
                            Name     = dept.Name,
                            HJ       = 0,
                            ZMML     = 0,
                            YJ       = 0,
                            ML       = 0,
                            DateUnit = i,
                            Year     = year,
                            XY       = 0
                        });
                    }
                    else
                    {
                        result.Add(new SummaryViewModel
                        {
                            Id       = dept.Id,
                            Name     = dept.Name,
                            HJ       = data.HJ,
                            ZMML     = data.ZMML,
                            YJ       = data.YJ,
                            ML       = data.ML,
                            DateUnit = i,
                            Year     = year,
                            XY       = data.XY
                        });
                    }
                }
            }
            return(result);
        }
Example #3
0
        public List <IdSummaryDto> DeptSummary()
        {
            var sql = "SELECT DeptId AS Id,COUNT(0) AS Num FROM Asset_Asset WHERE IsDel=0 GROUP BY DeptId";

            return(_db.FetchBySql <IdSummaryDto>(sql).ToList());
        }