203 lines
5.9 KiB
C#
203 lines
5.9 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
||
using ZR.Admin.WebApi.Extensions;
|
||
using ZR.Model.Dto;
|
||
using ZR.Service.Business.IBusinessService;
|
||
|
||
//创建时间:2025-01-02
|
||
namespace ZR.Admin.WebApi.Controllers
|
||
{
|
||
/// <summary>
|
||
/// 质量GP12业务模块
|
||
/// </summary>
|
||
[Route("/mes/qc/gp12/QcGp12Controller")]
|
||
public class QcGp12Controller : BaseController
|
||
{
|
||
/// <summary>
|
||
/// 质量GP12业务模块接口
|
||
/// </summary>
|
||
private readonly IQcGp12Service _QcGp12Service;
|
||
|
||
public QcGp12Controller(IQcGp12Service QcGp12Service)
|
||
{
|
||
_QcGp12Service = QcGp12Service;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取班组下拉
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpGet("GetGroupOptions")]
|
||
[AllowAnonymous]
|
||
public IActionResult GetGroupOptions()
|
||
{
|
||
var response = _QcGp12Service.GetGroupOptions();
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取站点下拉
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpGet("GetStieOptions")]
|
||
[AllowAnonymous]
|
||
public IActionResult GetStieOptions()
|
||
{
|
||
var response = _QcGp12Service.GetStieOptions();
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取缺陷项初始数据
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpGet("GetDefectInitOptions")]
|
||
[AllowAnonymous]
|
||
public IActionResult GetDefectInitOptions()
|
||
{
|
||
var response = _QcGp12Service.GetDefectInitOptions();
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取缺陷项列表初始数据
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpGet("GetDefectTableOptions")]
|
||
[AllowAnonymous]
|
||
public IActionResult GetDefectTableOptions()
|
||
{
|
||
var response = _QcGp12Service.GetDefectTableOptions();
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 解析标签
|
||
/// </summary>
|
||
/// <param name="label">标签内容</param>
|
||
/// <param name="type">解析方式</param>
|
||
/// <returns></returns>
|
||
[HttpGet("AnalyzeLabel")]
|
||
[AllowAnonymous]
|
||
public IActionResult AnalyzeLabel(string label, int type)
|
||
{
|
||
var response = _QcGp12Service.AnalyzeLabelToDto(label, type);
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 开始工单
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost("StartGP12WorkOrder")]
|
||
[AllowAnonymous]
|
||
public IActionResult StartGP12WorkOrder([FromBody] QcGp12WorkorderDetailDto parm)
|
||
{
|
||
var modal = parm.Adapt<QcGp12WorkorderDetailDto>().ToCreate(HttpContext);
|
||
|
||
var response = _QcGp12Service.StartGP12WorkOrder(modal);
|
||
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 修改缺陷项
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost("ChangeWorkOrderDefect")]
|
||
[AllowAnonymous]
|
||
public IActionResult StartGP12WorkOrder([FromBody] QcGp12WorkorderDefectDto parm)
|
||
{
|
||
var modal = parm.Adapt<QcGp12WorkorderDefectDto>().ToCreate(HttpContext);
|
||
|
||
var response = _QcGp12Service.ChangeWorkOrderDefect(modal);
|
||
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取工单缺陷项
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpGet("GetWorkOrderDefectList")]
|
||
[AllowAnonymous]
|
||
public IActionResult GetWorkOrderDefectList(string workOrder)
|
||
{
|
||
var response = _QcGp12Service.GetWorkOrderDefectList(workOrder);
|
||
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 扫描内标签,添加标签记录
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost("ScanInnerLabel")]
|
||
[AllowAnonymous]
|
||
public IActionResult ScanInnerLabel([FromBody] QcGp12LabelScanDto parm)
|
||
{
|
||
try
|
||
{
|
||
var modal = parm.Adapt<QcGp12LabelScanDto>().ToCreate(HttpContext);
|
||
|
||
var response = _QcGp12Service.ScanInnerLabel(modal);
|
||
|
||
return SUCCESS(response);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
return SUCCESS("请刷新页面,错误代码:" + ex.Message);
|
||
}
|
||
|
||
}
|
||
|
||
/// <summary>
|
||
/// 结束工单,并生成质量报表
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpGet("EndGP12WorkOrderAndCreateStatistics")]
|
||
[AllowAnonymous]
|
||
public IActionResult EndGP12WorkOrderAndCreateStatistics(string workOrder)
|
||
{
|
||
var response = _QcGp12Service.EndGP12WorkOrderAndCreateStatistics(workOrder);
|
||
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 更新工单相关信息
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpGet("UpdateWorkOrderDetail")]
|
||
[AllowAnonymous]
|
||
public IActionResult UpdateWorkOrderDetail(string workOrder)
|
||
{
|
||
var response = _QcGp12Service.UpdateWorkOrderDetail(workOrder);
|
||
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 自动生成标签记录
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost("GenerateVirtualLabel")]
|
||
[AllowAnonymous]
|
||
public IActionResult GenerateVirtualLabel([FromBody] QcGp12WorkorderDetailDto parm)
|
||
{
|
||
try
|
||
{
|
||
var modal = parm.Adapt<QcGp12WorkorderDetailDto>().ToCreate(HttpContext);
|
||
|
||
var response = _QcGp12Service.GenerateVirtualLabel(modal);
|
||
|
||
return SUCCESS(response);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
return ToResponse(ApiResult.Error(ex.Message));
|
||
}
|
||
|
||
}
|
||
}
|
||
}
|