2024-06-07 11:04:26 +08:00
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
2023-11-16 13:35:43 +08:00
|
|
|
|
using ZR.Model.mes.pro;
|
2023-11-16 18:33:43 +08:00
|
|
|
|
using ZR.Model.MES.pro.DTO;
|
2023-11-16 13:35:43 +08:00
|
|
|
|
using ZR.Service.mes.pro.IService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace ZR.Admin.WebApi.Controllers.MES.pro
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
[Route("mes/pro/workorder")]
|
|
|
|
|
|
public class ProWorkorderController : BaseController
|
|
|
|
|
|
{
|
|
|
|
|
|
private readonly IProWorkorderService proWorkorderService;
|
|
|
|
|
|
|
|
|
|
|
|
public ProWorkorderController(IProWorkorderService proWorkorderService)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.proWorkorderService = proWorkorderService;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-11-16 16:13:30 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取所有非排产工单
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="pageNum"></param>
|
|
|
|
|
|
/// <param name="pageSize"></param>
|
|
|
|
|
|
/// <param name="year"></param>
|
|
|
|
|
|
/// <param name="week"></param>
|
|
|
|
|
|
/// <param name="date"></param>
|
|
|
|
|
|
/// <returns></returns>
|
2023-11-16 13:35:43 +08:00
|
|
|
|
[HttpGet("getworkorderListwithoutschedule")]
|
|
|
|
|
|
public IActionResult GetWorkorderListWithoutSchedule(int pageNum, int pageSize, int year = -1, int week = -1, int date = -1)
|
|
|
|
|
|
{
|
2023-11-24 08:45:24 +08:00
|
|
|
|
(List<ProWorkorder>, int) data = proWorkorderService.GetWorkorderList(pageNum, pageSize, year, week, date, 0);
|
2023-11-16 13:35:43 +08:00
|
|
|
|
|
|
|
|
|
|
return ToResponse(new ApiResult(200, "success", data));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-11-27 16:28:16 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 甘特图
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="year"></param>
|
|
|
|
|
|
/// <param name="week"></param>
|
|
|
|
|
|
/// <param name="date"></param>
|
|
|
|
|
|
/// <returns></returns>
|
2024-06-07 11:04:26 +08:00
|
|
|
|
|
2023-11-27 16:28:16 +08:00
|
|
|
|
[HttpGet("GetGanttList")]
|
|
|
|
|
|
public IActionResult GetGanttList(int year = -1, int week = -1, int date = -1)
|
|
|
|
|
|
{
|
|
|
|
|
|
GanttTaskDTO data = proWorkorderService.GetGanttList(year, week, date);
|
|
|
|
|
|
|
|
|
|
|
|
return ToResponse(new ApiResult(200, "success", data));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-11-16 16:13:30 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取所有排产工单
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="pageNum"></param>
|
|
|
|
|
|
/// <param name="pageSize"></param>
|
|
|
|
|
|
/// <param name="year"></param>
|
|
|
|
|
|
/// <param name="week"></param>
|
|
|
|
|
|
/// <param name="date"></param>
|
|
|
|
|
|
/// <returns></returns>
|
2023-11-16 13:35:43 +08:00
|
|
|
|
[HttpGet("getworkorderListwithschedule")]
|
|
|
|
|
|
public IActionResult GetWorkorderListWithSchedule(int pageNum, int pageSize, int year = -1, int week = -1, int date = -1)
|
|
|
|
|
|
{
|
2023-11-24 08:45:24 +08:00
|
|
|
|
(List<ProWorkorder>, int) data = proWorkorderService.GetWorkorderList(pageNum, pageSize, year, week, date, 1);
|
2023-11-16 13:35:43 +08:00
|
|
|
|
|
|
|
|
|
|
return ToResponse(new ApiResult(200, "success", data));
|
|
|
|
|
|
}
|
2023-11-16 16:13:30 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 根据工单ID,设置为排产状态
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">工单ID</param>
|
|
|
|
|
|
/// <param name="arrange_starttime">预计开始时间</param>
|
|
|
|
|
|
/// <param name="arrange_endtime">预计结束时间</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpGet("setschedule")]
|
2023-11-22 18:10:42 +08:00
|
|
|
|
public IActionResult SetSchedule(string id, DateTime arrange_starttime, DateTime arrange_endtime)
|
2023-11-16 16:13:30 +08:00
|
|
|
|
{
|
|
|
|
|
|
|
2023-11-22 18:10:42 +08:00
|
|
|
|
|
|
|
|
|
|
int data = proWorkorderService.SetWorkorderSechedule(id, arrange_starttime, arrange_endtime);
|
2023-11-16 16:13:30 +08:00
|
|
|
|
|
|
|
|
|
|
return ToResponse(new ApiResult(200, "success", data));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 根据工单ID,设置为非排产状态
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">工单ID</param>
|
|
|
|
|
|
/// <returns></returns>
|
2023-11-22 18:10:42 +08:00
|
|
|
|
[HttpGet("resetschedule/{id}")]
|
2023-11-16 16:13:30 +08:00
|
|
|
|
public IActionResult ResetSchedule(string id)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
int data = proWorkorderService.ResetWorkorderSechedule(id);
|
|
|
|
|
|
|
|
|
|
|
|
return ToResponse(new ApiResult(200, "success", data));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-11-23 15:00:56 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2023-11-24 09:27:19 +08:00
|
|
|
|
/// 下达开始领料指令
|
2023-11-23 15:00:56 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">工单ID</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpGet("releaseProduction/{id}")]
|
|
|
|
|
|
public IActionResult ReleaseProduction(string id)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
2023-11-24 17:16:49 +08:00
|
|
|
|
int data = proWorkorderService.ReleaseProduction(id, HttpContext);
|
2023-11-23 15:00:56 +08:00
|
|
|
|
|
|
|
|
|
|
return ToResponse(new ApiResult(200, "success", data));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-11-24 17:16:49 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-11-16 16:13:30 +08:00
|
|
|
|
/// <summary>
|
2023-11-20 08:50:45 +08:00
|
|
|
|
/// 对当前的,排产工单排序
|
2023-11-16 16:13:30 +08:00
|
|
|
|
/// </summary>
|
2023-11-20 08:50:45 +08:00
|
|
|
|
/// <param name="parameter">列表参数,一个是工单ID,一个是排序号</param>
|
2023-11-16 16:13:30 +08:00
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpPost("sortschedule")]
|
2023-11-16 18:33:43 +08:00
|
|
|
|
public IActionResult SortSchedule([FromBody] List<ProWorkorderSortDTO> parameter)
|
2023-11-16 16:13:30 +08:00
|
|
|
|
{
|
2023-11-20 08:50:45 +08:00
|
|
|
|
int sum = 0;
|
|
|
|
|
|
foreach (ProWorkorderSortDTO item in parameter)
|
|
|
|
|
|
{
|
2024-06-07 11:04:26 +08:00
|
|
|
|
if (!string.IsNullOrEmpty(item.id))
|
2023-11-20 08:50:45 +08:00
|
|
|
|
{
|
|
|
|
|
|
int data = proWorkorderService.SortWorkorderSchedule(item.id, item.order);
|
|
|
|
|
|
sum += data;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-11-16 16:13:30 +08:00
|
|
|
|
|
2023-11-20 08:50:45 +08:00
|
|
|
|
return ToResponse(new ApiResult(200, "success", sum));
|
2023-11-16 16:13:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-11-16 13:35:43 +08:00
|
|
|
|
}
|