2025-11-12 17:32:28 +08:00
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
2025-11-18 14:54:03 +08:00
|
|
|
|
using RIZO.Model.Mes.Dto.GatherData;
|
2025-11-18 11:39:58 +08:00
|
|
|
|
using RIZO.Model.Mes.Dto.WorkOrderInfo;
|
|
|
|
|
|
using RIZO.Model.Mes.WorkOrderInfo;
|
|
|
|
|
|
using RIZO.Service.Mes.IMesService.WorkOrderInfo;
|
2025-11-18 19:17:51 +08:00
|
|
|
|
using RIZO.Service.Mes.WorkOrderInfo;
|
2025-11-12 17:32:28 +08:00
|
|
|
|
|
|
|
|
|
|
//创建时间:2025-11-12
|
2025-11-18 11:39:58 +08:00
|
|
|
|
namespace RIZO.Admin.WebApi.Controllers.Mes.WorkOrderInfo
|
2025-11-12 17:32:28 +08:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 工单主表
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[Route("mes/WorkOrder")]
|
2025-11-13 09:28:34 +08:00
|
|
|
|
[AllowAnonymous]
|
2025-11-12 17:32:28 +08:00
|
|
|
|
public class WorkOrderController : BaseController
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 工单主表接口
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private readonly IWorkOrderService _WorkOrderService;
|
|
|
|
|
|
|
|
|
|
|
|
public WorkOrderController(IWorkOrderService WorkOrderService)
|
|
|
|
|
|
{
|
|
|
|
|
|
_WorkOrderService = WorkOrderService;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 查询工单主表列表
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="parm"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpGet("list")]
|
|
|
|
|
|
[ActionPermissionFilter(Permission = "workorder:list")]
|
|
|
|
|
|
public IActionResult QueryWorkOrder([FromQuery] WorkOrderQueryDto parm)
|
|
|
|
|
|
{
|
|
|
|
|
|
var response = _WorkOrderService.GetList(parm);
|
|
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 查询工单主表详情
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="Id"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpGet("{Id}")]
|
|
|
|
|
|
[ActionPermissionFilter(Permission = "workorder:query")]
|
|
|
|
|
|
public IActionResult GetWorkOrder(long Id)
|
|
|
|
|
|
{
|
|
|
|
|
|
var response = _WorkOrderService.GetInfo(Id);
|
|
|
|
|
|
|
|
|
|
|
|
var info = response.Adapt<WorkOrderDto>();
|
|
|
|
|
|
return SUCCESS(info);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 添加工单主表
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
|
[ActionPermissionFilter(Permission = "workorder:add")]
|
|
|
|
|
|
[Log(Title = "工单主表", BusinessType = BusinessType.INSERT)]
|
|
|
|
|
|
public IActionResult AddWorkOrder([FromBody] WorkOrderDto parm)
|
|
|
|
|
|
{
|
2025-11-18 11:39:58 +08:00
|
|
|
|
var modal = parm.Adapt<WorkOrder>().ToCreate(HttpContext);
|
2025-11-12 17:32:28 +08:00
|
|
|
|
|
|
|
|
|
|
var response = _WorkOrderService.AddWorkOrder(modal);
|
|
|
|
|
|
|
|
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 更新工单主表
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpPut]
|
|
|
|
|
|
[ActionPermissionFilter(Permission = "workorder:edit")]
|
|
|
|
|
|
[Log(Title = "工单主表", BusinessType = BusinessType.UPDATE)]
|
|
|
|
|
|
public IActionResult UpdateWorkOrder([FromBody] WorkOrderDto parm)
|
|
|
|
|
|
{
|
2025-11-18 11:39:58 +08:00
|
|
|
|
var modal = parm.Adapt<WorkOrder>().ToUpdate(HttpContext);
|
2025-11-12 17:32:28 +08:00
|
|
|
|
var response = _WorkOrderService.UpdateWorkOrder(modal);
|
|
|
|
|
|
|
|
|
|
|
|
return ToResponse(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 删除工单主表
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpPost("delete/{ids}")]
|
|
|
|
|
|
[ActionPermissionFilter(Permission = "workorder:delete")]
|
|
|
|
|
|
[Log(Title = "工单主表", BusinessType = BusinessType.DELETE)]
|
|
|
|
|
|
public IActionResult DeleteWorkOrder([FromRoute]string ids)
|
|
|
|
|
|
{
|
|
|
|
|
|
var idArr = Tools.SplitAndConvert<long>(ids);
|
|
|
|
|
|
|
|
|
|
|
|
return ToResponse(_WorkOrderService.Delete(idArr));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-18 14:54:03 +08:00
|
|
|
|
/// <summary>
|
2025-11-25 09:32:28 +08:00
|
|
|
|
/// 扫流卡码新增工单主表
|
2025-11-18 14:54:03 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
2025-11-22 10:14:35 +08:00
|
|
|
|
[HttpPost("createWorkOrderBySacnCode")]
|
|
|
|
|
|
[Log(Title = "扫码新增工单主表", BusinessType = BusinessType.INSERT)]
|
|
|
|
|
|
public IActionResult CreateWorkOrderBySacnCode([FromBody] FlowCard flowCard)
|
2025-11-18 14:54:03 +08:00
|
|
|
|
{
|
2025-11-22 10:14:35 +08:00
|
|
|
|
var response = _WorkOrderService.CreateWorkOrderBySacnCode(flowCard);
|
2025-11-18 14:54:03 +08:00
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-18 18:49:17 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 变更工单状态
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpPost("changeWorkOrderState")]
|
|
|
|
|
|
[Log(Title = "变更工单状态(执行中/已完成)", BusinessType = BusinessType.UPDATE)]
|
|
|
|
|
|
public IActionResult ChangeWorkOrderState([FromBody] WorkOrderState parm)
|
|
|
|
|
|
{
|
|
|
|
|
|
var response = _WorkOrderService.ChangeWorkOrderState(parm);
|
|
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
}
|
2025-11-18 19:17:51 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 导出工单数据
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpGet("export")]
|
|
|
|
|
|
//[ActionPermissionFilter(Permission = "processinfo:export")]
|
|
|
|
|
|
[Log(Title = "工单数据", BusinessType = BusinessType.EXPORT)]
|
|
|
|
|
|
public IActionResult Export([FromQuery] WorkOrderQueryDto parm)
|
|
|
|
|
|
{
|
|
|
|
|
|
var list = _WorkOrderService.GetListExport(parm).Result;
|
|
|
|
|
|
if (list == null || list.Count <= 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
return ToResponse(ResultCode.FAIL, "没有要导出的数据");
|
|
|
|
|
|
}
|
|
|
|
|
|
var (sFileName, sFilePath) = ExportExcelMini(list, "工单数据", "工单数据");
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(sFilePath))
|
|
|
|
|
|
{
|
|
|
|
|
|
return ToResponse(ResultCode.FAIL, "Excel生成失败");
|
|
|
|
|
|
}
|
|
|
|
|
|
return PhysicalFile(
|
|
|
|
|
|
sFilePath,
|
|
|
|
|
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
|
|
|
|
sFileName,
|
|
|
|
|
|
true
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
2025-11-12 17:32:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|