Files
kunshan-bzfm-mes-backend/DOAN.Admin.WebApi/Controllers/Mobile/ReportFlowController.cs

186 lines
5.9 KiB
C#
Raw Normal View History

2024-12-22 15:12:10 +08:00
using DOAN.Model.Mobile.ReportFlow.Dto;
2024-12-03 19:21:32 +08:00
using DOAN.Service.Mobile.IService;
2024-12-21 10:02:13 +08:00
using Infrastructure.Converter;
2024-12-03 19:21:32 +08:00
using Microsoft.AspNetCore.Mvc;
namespace DOAN.Admin.WebApi.Controllers.Mobile;
/// <summary>
/// 工序流转卡
/// </summary>
[AllowAnonymous]
2024-12-03 19:40:37 +08:00
[Route("mobile/reportflow")]
2024-12-03 19:21:32 +08:00
public class ReportFlowController : BaseController
{
//IReportFlowService
private readonly IReportFlowService _reportFlowService;
public ReportFlowController(IReportFlowService reportFlowService)
{
_reportFlowService = reportFlowService;
}
2024-12-21 10:02:13 +08:00
/// <summary>
/// 根据指定日期获取工单列表
/// </summary>
/// <param name="startDate"></param>
/// <param name="endDate"></param>
/// <returns></returns>
/// <exception cref="CustomException"></exception>
[HttpGet("get_workorders_by_date")]
public IActionResult GetWorkOrdersByDate(DateTime startDate, DateTime endDate)
{
startDate = DOANConvertDate.ConvertLocalDate(startDate);
endDate = DOANConvertDate.ConvertLocalDate(endDate);
if(startDate == DateTime.MinValue||endDate==DateTime.MinValue)
{
throw new CustomException("date is error");
}
var response = _reportFlowService.GetWorkOrdersByDate(startDate, endDate);
return SUCCESS(response);
}
2024-12-03 19:21:32 +08:00
//TODO 查询工单详情
2024-12-03 19:51:09 +08:00
/// <summary>
/// 查询工单详情
/// </summary>
/// <param name="workOrder">工单号</param>
/// <returns></returns>
/// <exception cref="CustomException"></exception>
2024-12-03 19:21:32 +08:00
[HttpGet("get_workorder_detail")]
public IActionResult GetWorkOrderDetail(string workOrder)
{
if (string.IsNullOrEmpty(workOrder))
throw new CustomException("workOrderId 是空");
2024-12-03 19:51:09 +08:00
var response = _reportFlowService.GetWorkOrderDetail(workOrder);
if (response == null)
{
2024-12-04 10:35:39 +08:00
return ToResponse(ResultCode.SUCCESS, "工单不存在");
2024-12-03 19:51:09 +08:00
}
return SUCCESS(response);
2024-12-03 19:21:32 +08:00
}
2024-12-03 19:39:52 +08:00
//TODO 查询工序报工详情
2024-12-03 19:51:09 +08:00
/// <summary>
/// 查询某个工序报工详情
/// </summary>
/// <param name="workorder"></param>
/// <param name="process"></param>
/// <returns></returns>
/// <exception cref="CustomException"></exception>
2024-12-03 19:39:52 +08:00
[HttpGet("get_process_reportwork_detail")]
2024-12-03 20:10:18 +08:00
public IActionResult GetProcessReportWorkDetail(string workorder, int processId)
2024-12-03 19:39:52 +08:00
{
2024-12-03 20:10:18 +08:00
if (string.IsNullOrEmpty(workorder))
2024-12-03 19:39:52 +08:00
{
2024-12-04 10:35:39 +08:00
throw new CustomException("workorder is null");
2024-12-03 19:39:52 +08:00
}
2024-12-04 10:35:39 +08:00
return ToResponse(ResultCode.SUCCESS,_reportFlowService.GetProcessReportWorkDetail(workorder, processId));
2024-12-03 19:39:52 +08:00
}
2024-12-22 15:12:10 +08:00
2024-12-10 16:41:20 +08:00
//TODO 领料工序
[HttpGet("feed_process_reportwork")]
2024-12-16 13:46:46 +08:00
public IActionResult FeedProcessReportwork(string workorder, int processId, int finish_num,string stove_code,string feed_order,string process_operator)
2024-12-10 16:41:20 +08:00
{
if (string.IsNullOrEmpty(workorder))
{
throw new CustomException("workorder or process is null");
}
2024-12-16 13:46:46 +08:00
return SUCCESS(_reportFlowService.FeedProcessReportwork(workorder, processId, finish_num, stove_code, feed_order, process_operator));
2024-12-10 16:41:20 +08:00
}
2024-12-03 19:39:52 +08:00
//TODO 工序报工
2024-12-03 19:51:09 +08:00
/// <summary>
/// 工序报工
/// </summary>
/// <param name="workorder"></param>
/// <param name="process"></param>
/// <param name="finish_num"></param>
/// <param name="bad_num"></param>
/// <returns></returns>
/// <exception cref="CustomException"></exception>
2024-12-03 19:39:52 +08:00
[HttpGet("process_reportwork")]
2024-12-22 15:12:10 +08:00
public IActionResult ProcessReportWork([FromQuery]ProReportWorkDto proReportWorkDto)
2024-12-03 19:39:52 +08:00
{
2024-12-22 15:12:10 +08:00
if (string.IsNullOrEmpty(proReportWorkDto.workorder))
2024-12-03 19:39:52 +08:00
{
throw new CustomException("workorder or process is null");
}
2024-12-22 15:12:10 +08:00
return SUCCESS(_reportFlowService.ProcessReportWork(proReportWorkDto.workorder, proReportWorkDto. processId, proReportWorkDto.finish_num, proReportWorkDto.bad_num, proReportWorkDto.process_operator));
2024-12-03 19:39:52 +08:00
}
2024-12-10 16:41:20 +08:00
//TODO 出货工序
[HttpGet("shipment_process_reportwork")]
2024-12-16 13:46:46 +08:00
public IActionResult ShipmentProcessReportwork(string workorder, int processId, int finish_num, int bad_num, string customer_order, string process_operator)
2024-12-10 16:41:20 +08:00
{
if (string.IsNullOrEmpty(workorder))
{
throw new CustomException("workorder or process is null");
}
2024-12-16 13:46:46 +08:00
return SUCCESS(_reportFlowService.ShipmentProcessReportwork(workorder, processId, finish_num, bad_num, customer_order, process_operator));
2024-12-10 16:41:20 +08:00
}
2024-12-03 19:51:09 +08:00
//TODO 获取工单下的报工列表
[HttpGet("get_workorder_reportwork_list")]
public IActionResult GetWorkOrderReportWorkList(string workorder)
{
if (string.IsNullOrEmpty(workorder))
{
throw new CustomException("workorder is null");
}
return SUCCESS(_reportFlowService.GetWorkOrderReportWorkList(workorder));
}
2024-12-21 10:02:13 +08:00
//TODO 输入姓名拼音,查询此人今日报工记录
[HttpGet("get_report_info_by_name")]
2024-12-23 18:34:58 +08:00
public IActionResult GetReportInfoByName([FromQuery] ProReportWorkDto2 query )
2024-12-21 10:02:13 +08:00
{
2024-12-23 18:34:58 +08:00
if (string.IsNullOrEmpty(query.name))
2024-12-21 10:02:13 +08:00
{
throw new CustomException("name is null");
}
2024-12-23 18:34:58 +08:00
var response= _reportFlowService.GetReportInfoByName(query);
2024-12-21 10:02:13 +08:00
return SUCCESS(response);
}
//TODO 根据工艺路线获取所有工序
[HttpGet("get_process_by_route")]
public IActionResult GetProcessByRoute(int route_id=32)
{
var response = _reportFlowService.GetProcessByRoute(route_id);
return SUCCESS(response);
}
//TODO 输入工序id 查询今天报工记录
[HttpGet("get_report_by_processid")]
2024-12-23 18:34:58 +08:00
public IActionResult GetReportByProcessId([FromQuery] ProReportWorkDto3 query)
2024-12-21 10:02:13 +08:00
{
2024-12-23 18:34:58 +08:00
if (query.processId <= 0) {
2024-12-21 10:02:13 +08:00
throw new CustomException("processId is error");
}
2024-12-23 18:34:58 +08:00
var response = _reportFlowService.GetReportByProcessId(query);
2024-12-21 10:02:13 +08:00
return SUCCESS(response);
}
2024-12-03 19:51:09 +08:00
2024-12-03 20:10:18 +08:00
2024-12-03 19:21:32 +08:00
2024-12-03 19:39:52 +08:00
2024-12-03 19:21:32 +08:00
}