2024-09-19 09:34:54 +08:00
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
using DOAN.Admin.WebApi.Filters;
|
|
|
|
|
|
using DOAN.Service.JobKanban.IService;
|
2024-09-19 10:03:04 +08:00
|
|
|
|
using DOAN.Service.JobKanban;
|
2024-09-19 14:41:13 +08:00
|
|
|
|
using DOAN.Model.MES.product.Dto;
|
|
|
|
|
|
using DOAN.Model.MES.product;
|
2024-09-19 09:34:54 +08:00
|
|
|
|
namespace DOAN.WebApi.Controllers.JobKanban
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 工单进度接口
|
|
|
|
|
|
/// </summary>
|
2024-09-19 10:17:18 +08:00
|
|
|
|
[AllowAnonymous]
|
2024-09-19 09:34:54 +08:00
|
|
|
|
[Route("kanban/workorderProgress")]
|
|
|
|
|
|
public class WorkOrderProgressController : BaseController
|
|
|
|
|
|
{
|
|
|
|
|
|
private readonly IWorkorderProgressService workorderProgressService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public WorkOrderProgressController(IWorkorderProgressService workorderProgressService)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.workorderProgressService = workorderProgressService;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//TODO 获取产线
|
|
|
|
|
|
[HttpGet("get_routes")]
|
|
|
|
|
|
public IActionResult GetRoutes()
|
|
|
|
|
|
{
|
|
|
|
|
|
var response = workorderProgressService.GetRoutes();
|
|
|
|
|
|
|
|
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//TODO 获取班组
|
|
|
|
|
|
[HttpGet("get_group")]
|
|
|
|
|
|
public IActionResult GetGroups()
|
|
|
|
|
|
{
|
|
|
|
|
|
var response = workorderProgressService.GetGroups();
|
|
|
|
|
|
|
|
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-19 09:42:54 +08:00
|
|
|
|
//TODO 根据班组 ,产线 和日期获取all工单
|
|
|
|
|
|
[HttpGet("get_workorder_list")]
|
2024-09-19 09:53:04 +08:00
|
|
|
|
public IActionResult GetWorkOrderList(string group_code, string line_code, DateTime handleDate)
|
2024-09-19 09:42:54 +08:00
|
|
|
|
{
|
2024-09-19 09:53:04 +08:00
|
|
|
|
if (string.IsNullOrEmpty(group_code) || string.IsNullOrEmpty(line_code) || handleDate == DateTime.MinValue)
|
2024-09-19 09:42:54 +08:00
|
|
|
|
{
|
|
|
|
|
|
return SUCCESS(null);
|
|
|
|
|
|
}
|
|
|
|
|
|
var response = workorderProgressService.GetWorkOrderList(group_code, line_code, handleDate);
|
|
|
|
|
|
|
|
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-19 10:03:04 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 工单list (未完成的)
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="today"></param>
|
|
|
|
|
|
/// <param name="LineCode"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpGet("get_workorder_nofinish")]
|
2024-09-19 10:51:31 +08:00
|
|
|
|
public IActionResult GetWorkOrderListNoFinish(DateTime today, string line_code, string group_code)
|
2024-09-19 10:03:04 +08:00
|
|
|
|
{
|
2024-09-19 10:51:31 +08:00
|
|
|
|
if (today == DateTime.MinValue || string.IsNullOrEmpty(line_code)|| string.IsNullOrEmpty(group_code))
|
2024-09-19 10:03:04 +08:00
|
|
|
|
{
|
|
|
|
|
|
return SUCCESS(null);
|
|
|
|
|
|
}
|
2024-09-19 10:51:31 +08:00
|
|
|
|
var response = workorderProgressService.GetWorkOrderListNoFinish(today, line_code, group_code);
|
2024-09-19 10:03:04 +08:00
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获取工单详情
|
|
|
|
|
|
[HttpGet("get_workorder_detail")]
|
|
|
|
|
|
public IActionResult GetWorkOrderDetail(string workorder)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (string.IsNullOrEmpty(workorder))
|
|
|
|
|
|
{
|
|
|
|
|
|
return SUCCESS(null);
|
|
|
|
|
|
}
|
|
|
|
|
|
var response = workorderProgressService.GetWorkOrderDetail(workorder);
|
|
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取今日总任务数 ,剩余任务数
|
|
|
|
|
|
[HttpGet("get_num_list")]
|
2024-09-19 11:15:11 +08:00
|
|
|
|
public IActionResult GetKanbanNum(DateTime today, string line_code, string group_code)
|
2024-09-19 10:03:04 +08:00
|
|
|
|
{
|
2024-09-19 11:15:11 +08:00
|
|
|
|
if (today == DateTime.MinValue || string.IsNullOrEmpty(line_code) || string.IsNullOrEmpty(group_code))
|
2024-09-19 10:03:04 +08:00
|
|
|
|
{
|
|
|
|
|
|
return SUCCESS(null);
|
|
|
|
|
|
}
|
2024-09-19 11:15:11 +08:00
|
|
|
|
var response = workorderProgressService.GetKanbanNum(today, line_code, group_code);
|
2024-09-19 10:03:04 +08:00
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2024-09-19 09:53:04 +08:00
|
|
|
|
//TODO 开始某个工单
|
|
|
|
|
|
[HttpGet("start_workorder")]
|
|
|
|
|
|
public IActionResult StartWorkOrder(string workorder)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (string.IsNullOrEmpty(workorder))
|
|
|
|
|
|
{
|
|
|
|
|
|
return SUCCESS(null);
|
|
|
|
|
|
}
|
|
|
|
|
|
var response = workorderProgressService.StartWorkOrder(workorder);
|
|
|
|
|
|
|
|
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//TODO 完成某一个工单
|
|
|
|
|
|
[HttpGet("finish_workorder")]
|
|
|
|
|
|
public IActionResult FinishWorkOrder(string workorder)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (string.IsNullOrEmpty(workorder))
|
|
|
|
|
|
{
|
|
|
|
|
|
return SUCCESS(null);
|
|
|
|
|
|
}
|
|
|
|
|
|
var response = workorderProgressService.FinishWorkOrder(workorder);
|
|
|
|
|
|
|
|
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
}
|
2024-09-19 09:42:54 +08:00
|
|
|
|
|
2024-09-19 10:17:18 +08:00
|
|
|
|
//TODO 获取某条产线 某个日期,某个班组的生产中的工单 上位机接口
|
2024-09-19 10:03:04 +08:00
|
|
|
|
[HttpGet("get_producting_workorder")]
|
2024-09-26 10:44:33 +08:00
|
|
|
|
public IActionResult GetProductingWorkorder(string line_code, DateTime handleDate)
|
2024-09-19 10:03:04 +08:00
|
|
|
|
{
|
2024-09-26 10:44:33 +08:00
|
|
|
|
if ( string.IsNullOrEmpty(line_code) || handleDate < DateTime.MinValue.AddMonths(1))
|
2024-09-19 10:03:04 +08:00
|
|
|
|
{
|
2024-09-27 10:56:01 +08:00
|
|
|
|
return ToResponse(new ApiResult(210, "paramter is null",-1));
|
2024-09-19 10:03:04 +08:00
|
|
|
|
}
|
2024-09-26 10:44:33 +08:00
|
|
|
|
var response = workorderProgressService.GetProductingWorkorder( line_code, handleDate);
|
2024-09-27 10:56:01 +08:00
|
|
|
|
if (response == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
return ToResponse(new ApiResult(200, "There is no ongoing any workorder, please contact doan","no_workorder"));
|
|
|
|
|
|
}
|
|
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
//TODO 添加标签日志 上位机接口
|
|
|
|
|
|
[HttpGet("add_label_log")]
|
|
|
|
|
|
public IActionResult AddLabelLog(string labelContext, string workOrder)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (string.IsNullOrEmpty(labelContext) || string.IsNullOrEmpty(workOrder))
|
|
|
|
|
|
{
|
|
|
|
|
|
return ToResponse(new ApiResult(210, "paramter is null", -1));
|
|
|
|
|
|
}
|
|
|
|
|
|
var response = workorderProgressService.AddLabelLog(labelContext, workOrder);
|
|
|
|
|
|
|
2024-09-19 10:03:04 +08:00
|
|
|
|
return SUCCESS(response);
|
2024-09-27 10:56:01 +08:00
|
|
|
|
|
2024-09-19 10:03:04 +08:00
|
|
|
|
}
|
2024-09-19 09:34:54 +08:00
|
|
|
|
|
2024-09-19 14:33:52 +08:00
|
|
|
|
//TODO 扫码校验判断标签是否与当前工单匹配 0 不匹配 1匹配
|
|
|
|
|
|
[HttpGet("label_workorder_match")]
|
|
|
|
|
|
public IActionResult LabelWorkOrderMatch(string LabelContext,string workOrder)
|
|
|
|
|
|
{
|
|
|
|
|
|
if(string.IsNullOrEmpty(LabelContext)||string.IsNullOrEmpty(workOrder))
|
|
|
|
|
|
{
|
|
|
|
|
|
return SUCCESS(null);
|
|
|
|
|
|
}
|
|
|
|
|
|
int response = workorderProgressService.LabelWorkOrderMatch( LabelContext, workOrder);
|
|
|
|
|
|
|
|
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-19 14:41:13 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// TODO 完成 工单和报工 (启用)
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="workorder"></param>
|
2024-09-19 15:39:51 +08:00
|
|
|
|
/// <returns></returns.
|
|
|
|
|
|
[HttpGet("finish_and_report_workorder")]
|
|
|
|
|
|
public IActionResult FinishAndReportWorkorder(string workorder,int finish_num)
|
2024-09-19 14:41:13 +08:00
|
|
|
|
{
|
2024-09-19 15:39:51 +08:00
|
|
|
|
if (string.IsNullOrEmpty(workorder))
|
2024-09-19 14:41:13 +08:00
|
|
|
|
{
|
|
|
|
|
|
return SUCCESS(null);
|
|
|
|
|
|
}
|
2024-09-19 15:39:51 +08:00
|
|
|
|
var response = workorderProgressService.FinishAndReportWorkorder(workorder, finish_num);
|
2024-09-19 14:41:13 +08:00
|
|
|
|
return SUCCESS(response);
|
2024-09-19 15:39:51 +08:00
|
|
|
|
|
2024-09-19 14:41:13 +08:00
|
|
|
|
}
|
2024-09-19 14:33:52 +08:00
|
|
|
|
|
|
|
|
|
|
|
2024-09-19 09:34:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|