5 changed files with 262 additions and 33 deletions
@ -0,0 +1,23 @@ |
|||
using System.Collections.Generic; |
|||
using WebApiClient; |
|||
using WebApiClient.Attributes; |
|||
using AMESCoreStudio.WebApi; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using AMESCoreStudio.WebApi.Models.AMES; |
|||
using AMESCoreStudio.WebApi.Models.BAS; |
|||
using AMESCoreStudio.CommonTools.Result; |
|||
using AMESCoreStudio.WebApi.DTO.AMES; |
|||
|
|||
namespace AMESCoreStudio.Web |
|||
{ |
|||
[JsonReturn] |
|||
public interface IRPT: IHttpApi |
|||
{ |
|||
/// <summary>
|
|||
/// 生產即時效率
|
|||
/// </summary>
|
|||
/// <returns></returns>
|
|||
[WebApiClient.Attributes.HttpGet("api/RPT/GetRPT001View")] |
|||
ITask<RPT001ViewDto> GetRPT001View(string sDate, string eDate); |
|||
} |
|||
} |
@ -0,0 +1,73 @@ |
|||
using AMESCoreStudio.CommonTools.Result; |
|||
using AMESCoreStudio.WebApi.Models.BAS; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using System.Threading.Tasks; |
|||
using System; |
|||
using System.Net.Mail; |
|||
using Microsoft.Extensions.Configuration; |
|||
using System.Net; |
|||
using System.Linq; |
|||
using System.Text.RegularExpressions; |
|||
using System.IO; |
|||
using AMESCoreStudio.WebApi.Controllers.AMES; |
|||
using AMESCoreStudio.WebApi.DTO.AMES; |
|||
|
|||
|
|||
namespace AMESCoreStudio.WebApi.Controllers.BLL |
|||
{ |
|||
/// <summary>
|
|||
/// 報表資料
|
|||
/// </summary>
|
|||
[Route("api/[controller]")]
|
|||
[ApiController] |
|||
public class RPTController : Controller |
|||
{ |
|||
private readonly AMESContext _context; |
|||
private readonly IConfiguration _config; |
|||
|
|||
/// <summary>
|
|||
/// 建構式
|
|||
/// </summary>
|
|||
/// <param name="context"></param>
|
|||
public RPTController(AMESContext context, IConfiguration config) |
|||
{ |
|||
_config = config; |
|||
_context = context; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 生產即時效率
|
|||
/// </summary>
|
|||
/// <param name="sDate">開始日期</param>
|
|||
/// <param name="eDate">結束日期</param>
|
|||
/// <returns></returns>
|
|||
[HttpGet("GetRPT001View")] |
|||
public async Task<RPT001ViewDto> GetRPT001View(string sDate, string eDate) |
|||
{ |
|||
if (string.IsNullOrWhiteSpace(sDate) || string.IsNullOrWhiteSpace(eDate)) |
|||
{ |
|||
sDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).ToString("yyyy/MM/dd"); |
|||
eDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month)).ToString("yyyy/MM/dd"); |
|||
} |
|||
|
|||
var result = new RPT001ViewDto(); |
|||
// 未結工單數
|
|||
var a = await new WipInfosController(_context).GetWipInfoPCS008(new DTO.AMES.WipInfoDto |
|||
{ |
|||
date_str = sDate, |
|||
date_end = eDate |
|||
}); |
|||
result.openOrderWipQty = a.DataTotal; |
|||
|
|||
// 完工入庫數:GetFqcInhouseMasterMultiQuery
|
|||
var b = await new FqcInhouseMasterController(_context).GetFqcInhouseMasteMultiQuery("", "", "", "", date_str: sDate, date_end: eDate, ""); |
|||
result.finishedProducts = b.DataTotal; |
|||
|
|||
//異常工時:GetExceptionWorktimeByQueryWHS009
|
|||
//var c = new ExceptionWorktimesController(_context).GetExceptionWorktimeByQueryWHS009("*", "*", "*", "*", sDate, eDate);
|
|||
|
|||
return result; |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,73 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
|
|||
#nullable disable |
|||
|
|||
namespace AMESCoreStudio.WebApi.DTO.AMES |
|||
{ |
|||
public partial class RPT001ViewDto |
|||
{ |
|||
public RPT001ViewDto() |
|||
{ |
|||
|
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 生產力
|
|||
/// </summary>
|
|||
public double productiveForces { get; set; } = 0.0; |
|||
|
|||
/// <summary>
|
|||
/// 生產效率
|
|||
/// </summary>
|
|||
public double productivity { get; set; } = 0.0; |
|||
|
|||
/// <summary>
|
|||
/// IPQC合格率
|
|||
/// </summary>
|
|||
public double ipqc { get; set; } = 0.0; |
|||
|
|||
/// <summary>
|
|||
/// 測試直通率
|
|||
/// </summary>
|
|||
public double test { get; set; } = 0.0; |
|||
|
|||
/// <summary>
|
|||
/// FQC合格率
|
|||
/// </summary>
|
|||
public double fqc { get; set; } = 0.0; |
|||
|
|||
/// <summary>
|
|||
/// 出勤率
|
|||
/// </summary>
|
|||
public double attendance { get; set; } = 0.0; |
|||
|
|||
/// <summary>
|
|||
/// 加班工時
|
|||
/// </summary>
|
|||
public double overtime { get; set; } = 0.0; |
|||
|
|||
/// <summary>
|
|||
/// 無效工時
|
|||
/// </summary>
|
|||
public double invalidHours { get; set; } = 0.0; |
|||
|
|||
/// <summary>
|
|||
/// 未結工單數
|
|||
/// </summary>
|
|||
public int openOrderWipQty { get; set; } = 0; |
|||
|
|||
/// <summary>
|
|||
/// 完工入庫數
|
|||
/// </summary>
|
|||
public int finishedProducts { get; set; } = 0; |
|||
|
|||
/// <summary>
|
|||
/// 異常工時
|
|||
/// </summary>
|
|||
public double abnormalTime { get; set; } = 0.0; |
|||
|
|||
} |
|||
} |
Loading…
Reference in new issue