337 lines
10 KiB
C#
337 lines
10 KiB
C#
using Infrastructure.Constant;
|
|
using Infrastructure.Extensions;
|
|
using JinianNet.JNTemplate;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.SignalR;
|
|
using Microsoft.IdentityModel.Tokens;
|
|
using Newtonsoft.Json;
|
|
using Newtonsoft.Json.Linq;
|
|
using NPOI.POIFS.Crypt.Dsig;
|
|
using Org.BouncyCastle.Asn1.X509;
|
|
using System.Text.Json;
|
|
using ZR.Admin.WebApi.Extensions;
|
|
using ZR.Admin.WebApi.Hubs;
|
|
using ZR.Model.MES.qc.DTO;
|
|
using ZR.Model.MES.qu;
|
|
using ZR.Service.mes.qc.IService;
|
|
using ZR.Service.System;
|
|
using static System.Runtime.InteropServices.JavaScript.JSType;
|
|
|
|
namespace ZR.Admin.WebApi.Controllers.mes.qc.IQC
|
|
{
|
|
|
|
|
|
[Route("mes/qc/FQC")]
|
|
public class FirstFQCController : BaseController
|
|
{
|
|
private readonly IFirstFQCService fQCService;
|
|
private readonly IQcQualityStatisticsFirstService qQCQualityStatisticsFirstService;
|
|
private readonly IHubContext<MessageHub> hubContext;
|
|
|
|
public FirstFQCController(IFirstFQCService fQCService, IHubContext<MessageHub> hubContext, IQcQualityStatisticsFirstService qQCQualityStatisticsFirstService)
|
|
{
|
|
this.fQCService = fQCService;
|
|
this.hubContext = hubContext;
|
|
this.qQCQualityStatisticsFirstService = qQCQualityStatisticsFirstService;
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 获取 检测项 填充 (首检)
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet("getcheckItemTable__first")]
|
|
public IActionResult GetcheckItemTable__first(string workorderID)
|
|
{
|
|
|
|
CheckItemTableDTO itemTableDTO = fQCService.GetCheckItemTable_first(workorderID);
|
|
|
|
return SUCCESS(itemTableDTO);
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 写入工序时间 (首检)
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet("writeProcessFlow_first")]
|
|
public IActionResult WriteProcessFlow_first(string workorderID,DateTime time)
|
|
{
|
|
|
|
int result = fQCService.WriteProcessFlow_first(workorderID, time);
|
|
|
|
return SUCCESS(result);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取 检测项 填充 (二检)
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet("getcheckItemTable__again")]
|
|
public IActionResult GetcheckItemTable__again(string workorderID)
|
|
{
|
|
|
|
CheckItemTableDTO itemTableDTO = fQCService.GetCheckItemTable_again(workorderID);
|
|
|
|
return SUCCESS(itemTableDTO);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取 检测项 填充 (三检)
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet("getcheckItemTable__thirty")]
|
|
public IActionResult GetcheckItemTable__thirty(string workorderID)
|
|
{
|
|
|
|
CheckItemTableDTO itemTableDTO = fQCService.GetCheckItemTable_thirty(workorderID);
|
|
|
|
return SUCCESS(itemTableDTO);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 获取当前工单 一检
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet("getcurrentWorkorder_first")]
|
|
public IActionResult GetcurrentWorkorder_first()
|
|
{
|
|
|
|
QcCurrentWorkorderDto workorder= fQCService.GetcurrentWorkorder_first();
|
|
|
|
return SUCCESS(workorder);
|
|
}
|
|
/// <summary>
|
|
/// 获取当前工单 二检
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet("getcurrentWorkorder_again")]
|
|
public IActionResult GetcurrentWorkorder_again()
|
|
{
|
|
|
|
QcCurrentWorkorderDto workorder = fQCService.GetcurrentWorkorder_again();
|
|
|
|
return SUCCESS(workorder);
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 获取当前工单 三检
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet("getcurrentWorkorder_thirty")]
|
|
public IActionResult GetcurrentWorkorder_thirty()
|
|
{
|
|
|
|
QcCurrentWorkorderDto workorder = fQCService.GetcurrentWorkorder_thirty();
|
|
|
|
return SUCCESS(workorder);
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 获取下一个工单 一检
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet("getcurrentWorkorder_next_first")]
|
|
public IActionResult GetcurrentWorkorder_next_first()
|
|
{
|
|
|
|
QcCurrentWorkorderDto workorder = fQCService.GetcurrentWorkorder_next_first();
|
|
|
|
return SUCCESS(workorder);
|
|
}
|
|
/// <summary>
|
|
/// 获取下一个工单 二检
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet("getcurrentWorkorder_next_again")]
|
|
public IActionResult GetcurrentWorkorder_next_again()
|
|
{
|
|
|
|
QcCurrentWorkorderDto workorder = fQCService.GetcurrentWorkorder_next_again();
|
|
|
|
return SUCCESS(workorder);
|
|
}
|
|
/// <summary>
|
|
/// 获取下一个工单 三检
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet("getcurrentWorkorder_next_thirty")]
|
|
public IActionResult GetcurrentWorkorder_next_thirty()
|
|
{
|
|
|
|
QcCurrentWorkorderDto workorder = fQCService.GetcurrentWorkorder_next_thirty();
|
|
|
|
Console.WriteLine("workorder" + workorder);
|
|
|
|
|
|
return SUCCESS(workorder);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取上一个工单 一检
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet("getcurrentWorkorder_previous_first")]
|
|
public IActionResult GetcurrentWorkorder_previous_first()
|
|
{
|
|
|
|
QcCurrentWorkorderDto workorder = fQCService.GetcurrentWorkorder_previous_first();
|
|
|
|
return SUCCESS(workorder);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取上一个工单 二检
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet("getcurrentWorkorder_previous_again")]
|
|
public IActionResult GetcurrentWorkorder_previous_again()
|
|
{
|
|
|
|
QcCurrentWorkorderDto workorder = fQCService.GetcurrentWorkorder_previous_again();
|
|
|
|
return SUCCESS(workorder);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取上一个工单 三检
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet("getcurrentWorkorder_previous_thirty")]
|
|
public IActionResult GetcurrentWorkorder_previous_thirty()
|
|
{
|
|
|
|
QcCurrentWorkorderDto workorder = fQCService.GetcurrentWorkorder_previous_thirty();
|
|
|
|
return SUCCESS(workorder);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 初检累加器
|
|
/// </summary>
|
|
/// <param name="workorder_id"></param>
|
|
/// <param name="checkid"></param>
|
|
/// <param name="number">要累加的值</param>
|
|
/// <returns></returns>
|
|
[HttpGet("accumulator_query_first")]
|
|
public IActionResult Accumulator_first(string workorder_id,int checkid,int number, string inspectionModule)
|
|
{
|
|
|
|
int result= fQCService.Accumulator_first(workorder_id, checkid, number, inspectionModule, HttpContext.GetName());
|
|
|
|
return SUCCESS(result);
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 二检累加器
|
|
/// </summary>
|
|
/// <param name="workorder_id"></param>
|
|
/// <param name="checkid"></param>
|
|
/// <param name="counter"></param>
|
|
/// <returns></returns>
|
|
[HttpGet("accumulator_query_again")]
|
|
public IActionResult Accumulator_again(string workorder_id, int checkid, int number, string inspectionModule)
|
|
{
|
|
|
|
int result = fQCService.Accumulator_again(workorder_id, checkid, number, inspectionModule, HttpContext.GetName());
|
|
|
|
return SUCCESS(result);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 三检累加器
|
|
/// </summary>
|
|
/// <param name="workorder_id"></param>
|
|
/// <param name="checkid"></param>
|
|
/// <param name="counter"></param>
|
|
/// <returns></returns>
|
|
[HttpGet("accumulator_query_thirty")]
|
|
public IActionResult Accumulator_thirty(string workorder_id, int checkid, int number, string inspectionModule)
|
|
{
|
|
|
|
int result = fQCService.Accumulator_thirty(workorder_id, checkid, number, inspectionModule, HttpContext.GetName());
|
|
|
|
return SUCCESS(result);
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 计算当前工单抛光总数
|
|
/// </summary>
|
|
/// <param name="workorder_id"></param>
|
|
/// <param name="checkid"></param>
|
|
/// <param name="counter"></param>
|
|
/// <returns></returns>
|
|
[HttpGet("calculate_polish_total_number")]
|
|
public IActionResult CalculatePolishTotalNumber(string workorder_id)
|
|
{
|
|
|
|
int AllNumber = fQCService.CalculatePolishTotalNumber(workorder_id);
|
|
|
|
return SUCCESS(AllNumber);
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 计算当前工单下的包装投入数==一次合格+抛光合格
|
|
/// </summary>
|
|
/// <param name="workorder_id"></param>
|
|
/// <returns></returns>
|
|
[HttpGet("calculate_packagingInvestment")]
|
|
public IActionResult CalculatePackagingInvestment(string workorder_id)
|
|
{
|
|
int AllNumber = fQCService.CalculatePackagingInvestment(workorder_id);
|
|
return SUCCESS(AllNumber);
|
|
|
|
}
|
|
|
|
|
|
// 更改工单状态为完成态
|
|
[HttpGet("update_workorder_status")]
|
|
public IActionResult UpdateWorkorderStatus(string workorderID)
|
|
{
|
|
int result= fQCService.UpdateWorkorderStatus(workorderID);
|
|
return SUCCESS(result);
|
|
}
|
|
|
|
|
|
// 生成质量统计报表
|
|
[HttpGet("generateQualityStatisticsTable")]
|
|
public IActionResult GenerateQualityStatisticsTable(string workorderID,string team, DateTime firstQuality_time)
|
|
{
|
|
|
|
int result = fQCService.GenerateQualityStatisticsTable(workorderID, team, firstQuality_time.ToLocalTime());
|
|
return SUCCESS(result);
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 获取工单号的开始时间
|
|
/// </summary>
|
|
/// <param name="workOrderId"></param>
|
|
/// <returns></returns>
|
|
[HttpGet("getQcQualityStatisticsFirstStartTime")]
|
|
public IActionResult GetQcQualityStatisticsFirstStartTime(string workOrderId)
|
|
{
|
|
if (string.IsNullOrEmpty(workOrderId))
|
|
{
|
|
return ToResponse(new ApiResult(500, "工单号传入异常!", "工单号传入异常!"));
|
|
}
|
|
var result = qQCQualityStatisticsFirstService.GetQcQualityStatisticsFirstStartTime(workOrderId);
|
|
return ToResponse(new ApiResult(200, result, result));
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|