2024-01-29 16:55:45 +08:00

199 lines
5.8 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 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 IHubContext<MessageHub> hubContext;
public FirstFQCController(IFirstFQCService fQCService, IHubContext<MessageHub> hubContext)
{
this.fQCService = fQCService;
this.hubContext = hubContext;
}
/// <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("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")]
public IActionResult GetcurrentWorkorder()
{
QcCurrentWorkorderDto workorder= fQCService.GetcurrentWorkorder();
return SUCCESS(workorder);
}
/// <summary>
/// 获取下一个工单
/// </summary>
/// <returns></returns>
[HttpGet("getcurrentWorkorder_next")]
public IActionResult GetcurrentWorkorder_next()
{
QcCurrentWorkorderDto workorder = fQCService.GetcurrentWorkorder_next();
return SUCCESS(workorder);
}
/// <summary>
/// 获取上一个工单
/// </summary>
/// <returns></returns>
[HttpGet("getcurrentWorkorder_previous")]
public IActionResult GetcurrentWorkorder_previous()
{
QcCurrentWorkorderDto workorder = fQCService.GetcurrentWorkorder_previous();
return SUCCESS(workorder);
}
/// <summary>
/// 初检累加器
/// </summary>
/// <param name="workorder_id"></param>
/// <param name="checkid"></param>
/// <param name="counter"></param>
/// <returns></returns>
[HttpGet("accumulator_query_first")]
public IActionResult Accumulator_first(string workorder_id,int checkid,int counter)
{
int result= fQCService.Accumulator_first(workorder_id, checkid, counter, HttpContext.GetName());
return SUCCESS(counter);
}
/// <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 counter)
{
int result = fQCService.Accumulator_again(workorder_id, checkid, counter, HttpContext.GetName());
return SUCCESS(counter);
}
/// <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 counter)
{
int result = fQCService.Accumulator_thirty(workorder_id, checkid, counter, HttpContext.GetName());
return SUCCESS(counter);
}
/// <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);
}
}
}