171 lines
6.6 KiB
C#
171 lines
6.6 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
||
using Microsoft.AspNetCore.SignalR;
|
||
using Microsoft.IdentityModel.Tokens;
|
||
using ZR.Admin.WebApi.Extensions;
|
||
using ZR.Admin.WebApi.Hubs;
|
||
using ZR.Model.MES.qc.DTO;
|
||
using ZR.Service.mes.qc.IService;
|
||
|
||
namespace ZR.Admin.WebApi.Controllers.mes.qc.IQC
|
||
{
|
||
|
||
|
||
[Route("mes/qc/FQC/common")]
|
||
public class CommonFQCController : BaseController
|
||
{
|
||
private readonly ICommonFQCService _commonFQCService;
|
||
|
||
public CommonFQCController(ICommonFQCService commonFQCService)
|
||
{
|
||
this._commonFQCService = commonFQCService;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 检查工单状态
|
||
/// </summary>
|
||
/// <param name="workOrderId"></param>
|
||
/// <returns>0-未完成 1-已上线 2-已完成</returns>
|
||
[HttpGet("checkPackageWorkOrderStatus")]
|
||
public IActionResult CheckPackageWorkOrderStatus(string workOrderId)
|
||
{
|
||
if (string.IsNullOrEmpty(workOrderId))
|
||
{
|
||
return ToResponse(new ApiResult(500, "工单号传入异常!", "工单号传入异常!"));
|
||
}
|
||
int result = _commonFQCService.CheckPackageWorkOrderStatus(workOrderId);
|
||
if (result == -1)
|
||
{
|
||
return ToResponse(new ApiResult(500, "获取工单状态异常-01", result));
|
||
}
|
||
return ToResponse(new ApiResult(200, "ok", result));
|
||
}
|
||
|
||
/// <summary>
|
||
/// 检查工单在当日计划中的状态
|
||
/// </summary>
|
||
/// <param name="workOrderId"></param>
|
||
/// <returns>-1 -未知异常 0-正常 1-前边有未完成工单 2-最开始一个工单 3-最后一个工单</returns>
|
||
[HttpGet("checkPackageWorkOrderInListStatus")]
|
||
public IActionResult CheckPackageWorkOrderInListStatus(string workOrderId)
|
||
{
|
||
if (string.IsNullOrEmpty(workOrderId))
|
||
{
|
||
return ToResponse(new ApiResult(500, "工单号传入异常!", "工单号传入异常!"));
|
||
}
|
||
int result = _commonFQCService.CheckPackageWorkOrderInListStatus(workOrderId);
|
||
if (result == -1)
|
||
{
|
||
return ToResponse(new ApiResult(500, "获取工单状态异常-02", result));
|
||
}
|
||
return ToResponse(new ApiResult(200, "ok", result));
|
||
}
|
||
/// <summary>
|
||
/// 检查工单在当日未完成的工单计划中是第几个
|
||
/// </summary>
|
||
/// <param name="workOrderId">工单号</param>
|
||
/// <returns>[1当前位置,2总数, 3包装已完成, 4包装未完成]</returns>
|
||
[HttpGet("checkWorkOrderInDayListNum")]
|
||
public IActionResult CheckWorkOrderInDayListNum(string workOrderId)
|
||
{
|
||
if (string.IsNullOrEmpty(workOrderId))
|
||
{
|
||
return ToResponse(new ApiResult(500, "工单号传入异常!", "工单号传入异常!"));
|
||
}
|
||
var result = _commonFQCService.CheckWorkOrderInDayListNum(workOrderId);
|
||
if (result == null)
|
||
{
|
||
return ToResponse(new ApiResult(500, "获取工单计划编号异常-01", result));
|
||
}
|
||
return ToResponse(new ApiResult(200, "ok", result));
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取工单质量检测,首检,包装看板数据
|
||
/// </summary>
|
||
/// <param name="workOrderId">工单号</param>
|
||
/// <returns>QcCommonFqcBoardDto 看板数据</returns>
|
||
[HttpGet("getWorkOrderBoardData")]
|
||
public IActionResult GetWorkOrderBoardData(string workOrderId)
|
||
{
|
||
try
|
||
{
|
||
if (string.IsNullOrEmpty(workOrderId))
|
||
{
|
||
return ToResponse(new ApiResult(500, "工单号传入异常!", "工单号传入异常!"));
|
||
}
|
||
var result = _commonFQCService.GetWorkOrderBoardData(workOrderId);
|
||
if (result == null)
|
||
{
|
||
return ToResponse(new ApiResult(500, "获取看板数据异常-01:返回值为空", result));
|
||
}
|
||
return ToResponse(new ApiResult(200, "ok", result));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
return ToResponse(new ApiResult(500, "获取看板数据异常-02" + ex.Message, ex.Message));
|
||
}
|
||
|
||
}
|
||
/// <summary>
|
||
/// 获取质量检测工单,生产线数据列表
|
||
/// </summary>
|
||
/// <param name="query">查询值</param>
|
||
/// <returns>QcCommonFqcBoardDto 看板数据</returns>
|
||
[HttpPost("getWorkOrderFqcTableData")]
|
||
public IActionResult GetWorkOrderFqcTableData([FromBody] QcCommonFqcWorkerOrderDataQuery query)
|
||
{
|
||
try
|
||
{
|
||
var result = _commonFQCService.GetWorkOrderFqcData(query);
|
||
if (result == null)
|
||
{
|
||
return ToResponse(new ApiResult(500, "获取质量检测工单,生产线数据列表异常-01:返回值为空", result));
|
||
}
|
||
return ToResponse(new ApiResult(200, "ok", result));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
return ToResponse(new ApiResult(500, ex.Message, ex.Message));
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取产线,抛光,一次合格品质量报表看板数据
|
||
/// </summary>
|
||
/// <param name="query">查询值</param>
|
||
/// <returns>QcCommonFqcBoardDto 看板数据</returns>
|
||
[HttpPost("getProductAndPolishAndOneTimeFqcBoardData")]
|
||
public IActionResult GetProductAndPolishAndOneTimeFqcBoardData([FromBody] QcProductAndPolishAndOneTimeFqcBoardQuery query)
|
||
{
|
||
try
|
||
{
|
||
var result = _commonFQCService.GetProductAndPolishAndOneTimeFqcBoardData(query);
|
||
return ToResponse(new ApiResult(200, "ok", result));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
return ToResponse(new ApiResult(500, ex.Message, ex.Message));
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 零件号是否是门把手测试
|
||
/// </summary>
|
||
/// <param name="partnumber">零件号</param>
|
||
/// <returns>true false</returns>
|
||
[HttpGet("checkIsDoorknob")]
|
||
public IActionResult CheckIsDoorknob(string partnumber)
|
||
{
|
||
try
|
||
{
|
||
var result = _commonFQCService.CheckIsDoorknob(partnumber);
|
||
return ToResponse(new ApiResult(200, "ok", result));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
return ToResponse(new ApiResult(500, ex.Message, ex.Message));
|
||
}
|
||
}
|
||
}
|
||
}
|