1
This commit is contained in:
parent
e30d2ed2d2
commit
96f2f807dd
@ -1,209 +1,169 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using DOAN.Admin.WebApi.Filters;
|
||||
using DOAN.Service.JobKanban.IService;
|
||||
using DOAN.Service.JobKanban;
|
||||
using DOAN.Model.MES.product.Dto;
|
||||
using DOAN.Model.MES.product;
|
||||
namespace DOAN.WebApi.Controllers.JobKanban
|
||||
using DOAN.Service.JobKanban.IService;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace DOAN.WebApi.Controllers.JobKanban;
|
||||
|
||||
/// <summary>
|
||||
/// 工单进度接口
|
||||
/// </summary>
|
||||
[AllowAnonymous]
|
||||
[Route("kanban/workorderProgress")]
|
||||
public class WorkOrderProgressController : BaseController
|
||||
{
|
||||
/// <summary>
|
||||
/// 工单进度接口
|
||||
/// </summary>
|
||||
[AllowAnonymous]
|
||||
[Route("kanban/workorderProgress")]
|
||||
public class WorkOrderProgressController : BaseController
|
||||
private readonly IWorkorderProgressService workorderProgressService;
|
||||
|
||||
|
||||
public WorkOrderProgressController(IWorkorderProgressService workorderProgressService)
|
||||
{
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
//TODO 根据班组 ,产线 和日期获取all工单
|
||||
[HttpGet("get_workorder_list")]
|
||||
public IActionResult GetWorkOrderList(string group_code, string line_code, DateTime handleDate)
|
||||
{
|
||||
if (string.IsNullOrEmpty(group_code) || string.IsNullOrEmpty(line_code) || handleDate == DateTime.MinValue)
|
||||
{
|
||||
return SUCCESS(null);
|
||||
}
|
||||
var response = workorderProgressService.GetWorkOrderList(group_code, line_code, handleDate);
|
||||
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工单list (未完成的)
|
||||
/// </summary>
|
||||
/// <param name="today"></param>
|
||||
/// <param name="LineCode"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("get_workorder_nofinish")]
|
||||
public IActionResult GetWorkOrderListNoFinish(DateTime today, string line_code, string group_code)
|
||||
{
|
||||
if (today == DateTime.MinValue || string.IsNullOrEmpty(line_code)|| string.IsNullOrEmpty(group_code))
|
||||
{
|
||||
return SUCCESS(null);
|
||||
}
|
||||
var response = workorderProgressService.GetWorkOrderListNoFinish(today, line_code, group_code);
|
||||
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")]
|
||||
public IActionResult GetKanbanNum(DateTime today, string line_code, string group_code)
|
||||
{
|
||||
if (today == DateTime.MinValue || string.IsNullOrEmpty(line_code) || string.IsNullOrEmpty(group_code))
|
||||
{
|
||||
return SUCCESS(null);
|
||||
}
|
||||
var response = workorderProgressService.GetKanbanNum(today, line_code, group_code);
|
||||
return SUCCESS(response);
|
||||
|
||||
}
|
||||
//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);
|
||||
}
|
||||
|
||||
//TODO 获取某条产线 某个日期,某个班组的生产中的工单 上位机接口 (废弃)
|
||||
[HttpGet("get_producting_workorder")]
|
||||
public IActionResult GetProductingWorkorder(string line_code, DateTime handleDate)
|
||||
{
|
||||
if ( string.IsNullOrEmpty(line_code) || handleDate < DateTime.MinValue.AddMonths(1))
|
||||
{
|
||||
return ToResponse(new ApiResult(210, "paramter is null",-1));
|
||||
}
|
||||
var response = workorderProgressService.GetProductingWorkorder( line_code, handleDate);
|
||||
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);
|
||||
|
||||
return SUCCESS(response);
|
||||
|
||||
}
|
||||
|
||||
//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);
|
||||
}
|
||||
|
||||
//TODO 防错并且报工
|
||||
/// <summary>
|
||||
/// 防错并且报工
|
||||
/// </summary>
|
||||
/// <param name="workorder"></param>
|
||||
/// <param name="labelContext"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="CustomException"></exception>
|
||||
[HttpGet("errorProofingAndReportingWork")]
|
||||
public IActionResult ErrorProofingAndReportingWork(string workorder,string labelContext)
|
||||
{
|
||||
if (string.IsNullOrEmpty(labelContext) || string.IsNullOrEmpty(workorder))
|
||||
{
|
||||
throw new CustomException("workorder或者labelContext为空");
|
||||
}
|
||||
|
||||
int response= workorderProgressService.ErrorProofingAndReportingWork(workorder, labelContext);
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// TODO 完成 工单和报工 (启用)
|
||||
/// </summary>
|
||||
/// <param name="workorder"></param>
|
||||
/// <returns></returns.
|
||||
[HttpGet("finish_and_report_workorder")]
|
||||
public IActionResult FinishAndReportWorkorder(string workorder,int finish_num)
|
||||
{
|
||||
if (string.IsNullOrEmpty(workorder))
|
||||
{
|
||||
return SUCCESS(null);
|
||||
}
|
||||
var response = workorderProgressService.FinishAndReportWorkorder(workorder, finish_num);
|
||||
return SUCCESS(response);
|
||||
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
//TODO 根据班组 ,产线 和日期获取all工单
|
||||
[HttpGet("get_workorder_list")]
|
||||
public IActionResult GetWorkOrderList(string group_code, string line_code, DateTime handleDate)
|
||||
{
|
||||
if (string.IsNullOrEmpty(group_code) || string.IsNullOrEmpty(line_code) || handleDate == DateTime.MinValue)
|
||||
return SUCCESS(null);
|
||||
var response = workorderProgressService.GetWorkOrderList(group_code, line_code, handleDate);
|
||||
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工单list (未完成的)
|
||||
/// </summary>
|
||||
/// <param name="today"></param>
|
||||
/// <param name="LineCode"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("get_workorder_nofinish")]
|
||||
public IActionResult GetWorkOrderListNoFinish(DateTime today, string line_code, string group_code)
|
||||
{
|
||||
if (today == DateTime.MinValue || string.IsNullOrEmpty(line_code) || string.IsNullOrEmpty(group_code))
|
||||
return SUCCESS(null);
|
||||
var response = workorderProgressService.GetWorkOrderListNoFinish(today, line_code, group_code);
|
||||
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")]
|
||||
public IActionResult GetKanbanNum(DateTime today, string line_code, string group_code)
|
||||
{
|
||||
if (today == DateTime.MinValue || string.IsNullOrEmpty(line_code) || string.IsNullOrEmpty(group_code))
|
||||
return SUCCESS(null);
|
||||
var response = workorderProgressService.GetKanbanNum(today, line_code, group_code);
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
//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);
|
||||
}
|
||||
|
||||
//TODO 获取某条产线 某个日期,某个班组的生产中的工单 上位机接口 (废弃)
|
||||
[HttpGet("get_producting_workorder")]
|
||||
public IActionResult GetProductingWorkorder(string line_code, DateTime handleDate)
|
||||
{
|
||||
if (string.IsNullOrEmpty(line_code) || handleDate < DateTime.MinValue.AddMonths(1))
|
||||
return ToResponse(new ApiResult(210, "paramter is null", -1));
|
||||
var response = workorderProgressService.GetProductingWorkorder(line_code, handleDate);
|
||||
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);
|
||||
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
//TODO 扫码校验判断标签是否与当前工单匹配 0 不匹配 1匹配 (废弃)
|
||||
[HttpGet("label_workorder_match")]
|
||||
public IActionResult LabelWorkOrderMatch(string LabelContext, string workOrder)
|
||||
{
|
||||
if (string.IsNullOrEmpty(LabelContext) || string.IsNullOrEmpty(workOrder)) return SUCCESS(null);
|
||||
var response = workorderProgressService.LabelWorkOrderMatch(LabelContext, workOrder);
|
||||
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
//TODO 防错并且报工
|
||||
/// <summary>
|
||||
/// 防错并且报工
|
||||
/// </summary>
|
||||
/// <param name="workorder"></param>
|
||||
/// <param name="labelContext"></param>
|
||||
/// <returns> -1 不属于产品不属于此工单 0 报工失败 1 成功报工 </returns>
|
||||
/// <exception cref="CustomException"></exception>
|
||||
[HttpGet("errorProofingAndReportingWork")]
|
||||
public IActionResult ErrorProofingAndReportingWork(string workorder, string labelContext)
|
||||
{
|
||||
if (string.IsNullOrEmpty(labelContext) || string.IsNullOrEmpty(workorder))
|
||||
throw new CustomException("workorder或者labelContext为空");
|
||||
var response = workorderProgressService.ErrorProofingAndReportingWork(workorder, labelContext);
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// TODO 完成 工单和报工 (启用)
|
||||
/// </summary>
|
||||
/// <param name="workorder"></param>
|
||||
/// <returns></returns.
|
||||
[HttpGet("finish_and_report_workorder")]
|
||||
public IActionResult FinishAndReportWorkorder(string workorder, int finish_num)
|
||||
{
|
||||
if (string.IsNullOrEmpty(workorder)) return SUCCESS(null);
|
||||
var response = workorderProgressService.FinishAndReportWorkorder(workorder, finish_num);
|
||||
return SUCCESS(response);
|
||||
}
|
||||
}
|
||||
@ -284,7 +284,7 @@ namespace DOAN.Service.JobKanban
|
||||
.IgnoreColumns("CreatedTime")
|
||||
.IgnoreColumns("LineCode")
|
||||
.IgnoreColumns("CreatedBy")
|
||||
.SetColumns(it => it.FinishedNum== it.FinishedNum+1)
|
||||
.UpdateColumns(it => it.FinishedNum== it.FinishedNum+1)
|
||||
.ExecuteCommand();//存在更新
|
||||
|
||||
return result;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user