public List <AssImminentExpiryDto> GetImminentExpiryAss(QueryAssAnalysisInputDto inputDto) { var asset = _assetsRepository.GetAll().Where(a => a.ISINWAREHOUSE == 1 && a.EXPIRYDATE >= inputDto.StarTime && a.EXPIRYDATE <= inputDto.EndTime).OrderBy(a => a.EXPIRYDATE).OrderBy(a => a.EXPIRYDATE).Select(a => new AssImminentExpiryDto() { ASSID = a.ASSID, SN = a.SN, ExpiryDate = a.EXPIRYDATE, IMAGE = a.IMAGE }); return(asset.ToList()); }
public List <BarChartDto> GetAssSaleAnalysisChart(QueryAssAnalysisInputDto inputDto) { var types = (from type1 in SMOWMSDbContext.AssetsTypes where type1.TLEVEL == 1 select new { Level1 = type1.TYPEID, Level2 = "", Level3 = "" }).Union(from type1 in SMOWMSDbContext.AssetsTypes where type1.TLEVEL == 2 select new { Level1 = type1.PARENTTYPEID, Level2 = type1.TYPEID, Level3 = "" }).Union(from type1 in SMOWMSDbContext.AssetsTypes join type2 in SMOWMSDbContext.AssetsTypes on type1.PARENTTYPEID equals type2.TYPEID where type1.TLEVEL == 3 select new { Level1 = type2.PARENTTYPEID, Level2 = type1.PARENTTYPEID, Level3 = type1.TYPEID }); var poRowResult = from assTemplate in SMOWMSDbContext.AssTemplates from type in types from type2 in SMOWMSDbContext.AssetsTypes join sorow in SMOWMSDbContext.AssSalesOrderRows on assTemplate.TEMPLATEID equals sorow.TEMPLATEID from so in SMOWMSDbContext.AssSalesOrders where ((assTemplate.TYPEID == type.Level1 && type.Level2 == "") || (assTemplate.TYPEID == type.Level2 && type.Level3 == "") || assTemplate.TYPEID == type.Level3) && sorow.CREATEDATE >= inputDto.StarTime && sorow.CREATEDATE <= inputDto.EndTime && so.STATUS > 0 && type.Level1 == type2.TYPEID && so.SOID == sorow.SOID select new BarChartDto() { XValue = type2.NAME, YValue = sorow.QUANTSALED }; var poRowfresult = from assQuantDto in poRowResult group assQuantDto by new { assQuantDto.XValue } into quant select new BarChartDto() { XValue = quant.Key.XValue, YValue = quant.Sum(a => a.YValue) }; var t3 = poRowfresult.ToList(); return(t3); }
private void Bind() { try { QueryAssAnalysisInputDto inputDto = new QueryAssAnalysisInputDto { StarTime = startTime, EndTime = endTime }; var rows = _autofacConfig.AssAnalysisService.GetImminentExpiryAss(inputDto); lvRow.DataSource = rows; lvRow.DataBind(); } catch (Exception ex) { Toast(ex.Message); } }
private void Bind() { try { QueryAssAnalysisInputDto inputDto = new QueryAssAnalysisInputDto { StarTime = startTime, EndTime = endTime }; var chartInfo = _autofacConfig.AssAnalysisService.GetAssSaleAnalysisChart(inputDto); bc.DataSource = chartInfo; bc.DataBind(); var rows = _autofacConfig.AssAnalysisService.GetAssSaleAnalysis(inputDto); lv.DataSource = rows; lv.DataBind(); } catch (Exception ex) { Toast(ex.Message); } }
public List <AssSaleAnalysisDto> GetAssSaleAnalysis(QueryAssAnalysisInputDto inputDto) { var types = (from type1 in SMOWMSDbContext.AssetsTypes where type1.TLEVEL == 1 select new { Level1 = type1.TYPEID, Level2 = "", Level3 = "" }).Union(from type1 in SMOWMSDbContext.AssetsTypes where type1.TLEVEL == 2 select new { Level1 = type1.PARENTTYPEID, Level2 = type1.TYPEID, Level3 = "" }).Union(from type1 in SMOWMSDbContext.AssetsTypes join type2 in SMOWMSDbContext.AssetsTypes on type1.PARENTTYPEID equals type2.TYPEID where type1.TLEVEL == 3 select new { Level1 = type2.PARENTTYPEID, Level2 = type1.PARENTTYPEID, Level3 = type1.TYPEID }); var poRowResult = from assTemplate in SMOWMSDbContext.AssTemplates from type in types from so in SMOWMSDbContext.AssSalesOrders join sorow in SMOWMSDbContext.AssSalesOrderRows on assTemplate.TEMPLATEID equals sorow.TEMPLATEID where ((assTemplate.TYPEID == type.Level1 && type.Level2 == "") || (assTemplate.TYPEID == type.Level2 && type.Level3 == "") || assTemplate.TYPEID == type.Level3) && sorow.CREATEDATE >= inputDto.StarTime && sorow.CREATEDATE <= inputDto.EndTime && so.STATUS > 0 && so.SOID == sorow.SOID select new AssSaleAnalysisDto() { IMAGE = assTemplate.IMAGE, NAME = assTemplate.NAME, TEMPLATEID = assTemplate.TEMPLATEID, QUANTSALED = sorow.QUANTSALED, QUANTOUT = 0, QUANTRETREATED = 0 }; var poRowfresult = from assQuantDto in poRowResult group assQuantDto by new { assQuantDto.TEMPLATEID, assQuantDto.IMAGE, assQuantDto.NAME } into quant select new AssSaleAnalysisDto() { IMAGE = quant.Key.IMAGE, NAME = quant.Key.NAME, TEMPLATEID = quant.Key.TEMPLATEID, QUANTSALED = quant.Sum(a => a.QUANTSALED), QUANTOUT = 0, QUANTRETREATED = 0 }; var t3 = poRowfresult.ToList(); return(t3); }