生产大屏工单明细
This commit is contained in:
parent
8cf5bf6e5f
commit
31ea66b1b7
@ -96,5 +96,17 @@ namespace DOAN.WebApi.Controllers
|
||||
return File(fileBytes,contnetType,fileName);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 生产大屏报表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("productionReport")]
|
||||
public IActionResult ProductionReport()
|
||||
{
|
||||
var response = _ReportService.ProductionReport(DateTime.Now);
|
||||
return SUCCESS(response);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -120,4 +120,19 @@ namespace DOAN.Model.MES.report
|
||||
public int PlanNum { get; set; }
|
||||
public int CompletionNum { get; set; }
|
||||
}
|
||||
|
||||
public class ProductionReportModel
|
||||
{
|
||||
public string WorkOrder { get; set; }
|
||||
public string GroupName { get; set; }
|
||||
public string LineName { get; set; }
|
||||
public string ProductionName { get; set; }
|
||||
public int PlanNum { get; set; }
|
||||
public int CompletionNum { get; set; }
|
||||
public double CompletionRate { get; set; }
|
||||
public double QualifiedRate { get; set; }
|
||||
public double UnqualifiedRate { get; set; }
|
||||
public string StatusName { get; set; }
|
||||
public int? Status { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,5 +20,7 @@ namespace DOAN.Service.MES.report.IService
|
||||
List<ProductionCompletionRate> ProductionCompletionRate(DateTime dateTime);
|
||||
|
||||
List<ProductionCompletionRate> MonthlyProductionCompletionRate(DateTime dateTime);
|
||||
|
||||
List<ProductionReportModel> ProductionReport(DateTime dateTime);
|
||||
}
|
||||
}
|
||||
|
||||
@ -310,5 +310,32 @@ namespace DOAN.Service.MES.report
|
||||
return (firstDay, lastDayDate);
|
||||
}
|
||||
|
||||
|
||||
public List<ProductionReportModel> ProductionReport(DateTime dateTime)
|
||||
{
|
||||
var dt = dateTime.ToString("yyyy-MM-dd");
|
||||
var woList = Context.Queryable<ProWorkorder>()
|
||||
.LeftJoin<ProReportwork>((a, b) => a.Workorder == b.FkWorkorder)
|
||||
.LeftJoin<BaseWorkRoute>((a, b, c) => a.LineCode == c.Code)
|
||||
.LeftJoin<BaseGroup>((a, b, c, d) => a.GroupCode == d.GroupCode)
|
||||
.Where((a, b, c, d) => a.WorkorderDate.Value.ToString("yyyy-MM-dd") == dt)
|
||||
.Select((a, b, c, d) => new ProductionReportModel
|
||||
{
|
||||
WorkOrder = a.Workorder,
|
||||
ProductionName = a.ProductionName,
|
||||
PlanNum = a.DeliveryNum ?? 0,
|
||||
CompletionNum = b.FinishedNum ?? 0,
|
||||
CompletionRate = SqlFunc.Round((b.FinishedNum ?? 0) * 100.0 / (a.DeliveryNum ?? 0), 2),
|
||||
QualifiedRate = b.FinishedNum.HasValue ? SqlFunc.Round((b.QualifiedNumber ?? 0) * 100.0 / (b.FinishedNum ?? 0), 2) : 0,
|
||||
UnqualifiedRate = b.FinishedNum.HasValue ? SqlFunc.Round((b.UnqualifiedNumber ?? 0) * 100.0 / (b.FinishedNum ?? 0), 2) : 0,
|
||||
Status = a.Status,
|
||||
LineName = c.Name,
|
||||
GroupName = d.GroupName
|
||||
}).ToList();
|
||||
|
||||
woList.ForEach(t => t.StatusName = GetStatusName(t.Status ?? 0));
|
||||
|
||||
return woList;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user