212 lines
6.3 KiB
C#
212 lines
6.3 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
||
using ZR.Admin.WebApi.Extensions;
|
||
using ZR.Admin.WebApi.Filters;
|
||
using ZR.Model.Business;
|
||
using ZR.Model.Dto;
|
||
using ZR.Service.Business.IBusinessService;
|
||
|
||
//创建时间:2025-01-02
|
||
namespace ZR.Admin.WebApi.Controllers
|
||
{
|
||
/// <summary>
|
||
/// 质量BackEnd业务模块
|
||
/// </summary>
|
||
[Route("/mes/qc/BackEnd/QcBackEndController")]
|
||
public class QcBackEndController : BaseController
|
||
{
|
||
/// <summary>
|
||
/// 质量BackEnd业务模块接口
|
||
/// </summary>
|
||
private readonly IQcBackEndService _QcBackEndService;
|
||
|
||
public QcBackEndController(IQcBackEndService QcBackEndService)
|
||
{
|
||
_QcBackEndService = QcBackEndService;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取班组下拉
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpGet("GetGroupOptions")]
|
||
[AllowAnonymous]
|
||
public IActionResult GetGroupOptions()
|
||
{
|
||
var response = _QcBackEndService.GetGroupOptions();
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取站点下拉
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpGet("GetStieOptions")]
|
||
[AllowAnonymous]
|
||
public IActionResult GetStieOptions()
|
||
{
|
||
var response = _QcBackEndService.GetStieOptions();
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取缺陷项初始数据
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpGet("GetDefectInitOptions")]
|
||
[AllowAnonymous]
|
||
public IActionResult GetDefectInitOptions()
|
||
{
|
||
var response = _QcBackEndService.GetDefectInitOptions();
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取缺陷项列表初始数据
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpGet("GetDefectTableOptions")]
|
||
[AllowAnonymous]
|
||
public IActionResult GetDefectTableOptions()
|
||
{
|
||
var response = _QcBackEndService.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 = _QcBackEndService.AnalyzeLabelToDto(label, type);
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 开始工单
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost("StartBackEndWorkOrder")]
|
||
[AllowAnonymous]
|
||
public IActionResult StartBackEndWorkOrder([FromBody] QcBackEndWorkorderDetailDto parm)
|
||
{
|
||
try
|
||
{
|
||
var modal = parm.Adapt<QcBackEndWorkorderDetailDto>().ToCreate(HttpContext);
|
||
|
||
var response = _QcBackEndService.StartBackEndWorkOrder(modal);
|
||
|
||
return SUCCESS(response);
|
||
}
|
||
catch (Exception e)
|
||
{
|
||
return ToResponse(new ApiResult(500, "开启工单异常:" + e.Message));
|
||
}
|
||
|
||
}
|
||
|
||
/// <summary>
|
||
/// 修改缺陷项
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost("ChangeWorkOrderDefect")]
|
||
[AllowAnonymous]
|
||
public IActionResult StartBackEndWorkOrder([FromBody] QcBackEndWorkorderDefectDto parm)
|
||
{
|
||
var modal = parm.Adapt<QcBackEndWorkorderDefectDto>().ToCreate(HttpContext);
|
||
|
||
var response = _QcBackEndService.ChangeWorkOrderDefect(modal);
|
||
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取工单缺陷项
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpGet("GetWorkOrderDefectList")]
|
||
[AllowAnonymous]
|
||
public IActionResult GetWorkOrderDefectList(string workOrder)
|
||
{
|
||
var response = _QcBackEndService.GetWorkOrderDefectList(workOrder);
|
||
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 扫描内标签,添加标签记录
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost("ScanInnerLabel")]
|
||
[AllowAnonymous]
|
||
public IActionResult ScanInnerLabel([FromBody] QcBackEndLabelScanDto parm)
|
||
{
|
||
try
|
||
{
|
||
var modal = parm.Adapt<QcBackEndLabelScanDto>().ToCreate(HttpContext);
|
||
|
||
var response = _QcBackEndService.ScanInnerLabel(modal);
|
||
|
||
return SUCCESS(response);
|
||
}catch(Exception ex)
|
||
{
|
||
return SUCCESS("请刷新页面,错误代码:" + ex.Message);
|
||
}
|
||
|
||
}
|
||
|
||
/// <summary>
|
||
/// 结束工单,并生成质量报表
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpGet("EndBackEndWorkOrderAndCreateStatistics")]
|
||
[AllowAnonymous]
|
||
public IActionResult EndBackEndWorkOrderAndCreateStatistics(string workOrder)
|
||
{
|
||
var response = _QcBackEndService.EndBackEndWorkOrderAndCreateStatistics(workOrder);
|
||
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 更新工单相关信息
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpGet("UpdateWorkOrderDetail")]
|
||
[AllowAnonymous]
|
||
public IActionResult UpdateWorkOrderDetail(string workOrder)
|
||
{
|
||
var response = _QcBackEndService.UpdateWorkOrderDetail(workOrder);
|
||
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 自动生成标签记录
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost("GenerateVirtualLabel")]
|
||
[AllowAnonymous]
|
||
public IActionResult GenerateVirtualLabel([FromBody] QcBackEndWorkorderDetailDto parm)
|
||
{
|
||
try
|
||
{
|
||
var modal = parm.Adapt<QcBackEndWorkorderDetailDto>().ToCreate(HttpContext);
|
||
|
||
var response = _QcBackEndService.GenerateVirtualLabel(modal);
|
||
|
||
return SUCCESS(response);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
return ToResponse(ApiResult.Error(ex.Message));
|
||
}
|
||
|
||
}
|
||
}
|
||
}
|