177 lines
5.9 KiB
C#
Raw Normal View History

2024-09-04 16:31:41 +08:00

using Microsoft.AspNetCore.Mvc;
using DOAN.Admin.WebApi.Filters;
using DOAN.Model;
using DOAN.Model.MES.mm.Dto;
using DOAN.Model.MES.mm;
using System.Collections.Generic;
using DOAN.Service.group.IService;
using Aliyun.OSS;
using JinianNet.JNTemplate;
using DOAN.Service.MES.mm.IService;
//创建时间2024-08-30
namespace DOAN.WebApi.Controllers.MES.mm
{
/// <summary>
/// 物料需求计划
/// </summary>
[Verify]
[Route("mes/materialManagement/PreparantTask")]
public class MmPreparantTaskController : BaseController
{
private readonly IMmPreparantTaskService preparantTaskService;
2024-09-04 16:43:29 +08:00
2024-09-04 17:16:52 +08:00
public MmPreparantTaskController(IMmPreparantTaskService preparantTaskService)
2024-09-04 16:31:41 +08:00
{
2024-09-04 17:16:52 +08:00
this.preparantTaskService = preparantTaskService;
2024-09-04 16:31:41 +08:00
}
//TODO 获取产线
[HttpGet("get_route")]
public IActionResult GetProcessRouteList()
{
var response = preparantTaskService.GetProcessRouteList();
return SUCCESS(response);
}
2024-09-04 16:43:29 +08:00
//TODO 获取工单
[HttpGet("get_workoder")]
2024-09-04 17:16:52 +08:00
public IActionResult GetWorkOrder(DateTime searchDate, string route_code)
2024-09-04 16:43:29 +08:00
{
2024-09-04 17:16:52 +08:00
if (searchDate == DateTime.MinValue )
2024-09-04 16:43:29 +08:00
{
return SUCCESS(null);
2024-09-04 17:16:52 +08:00
2024-09-04 16:43:29 +08:00
}
var response = preparantTaskService.GetWorkOrder(searchDate, route_code);
return SUCCESS(response);
}
2024-09-05 09:12:37 +08:00
//TODO 获取任务
2024-09-04 17:25:16 +08:00
[HttpGet("get_task")]
public IActionResult GetTaskList(string workorder)
2024-09-04 17:16:52 +08:00
{
if (string.IsNullOrEmpty(workorder)) { return SUCCESS(null); }
2024-09-04 17:25:16 +08:00
var response = preparantTaskService.GetTaskList(workorder);
2024-09-04 17:16:52 +08:00
return SUCCESS(response);
}
2024-09-05 15:08:21 +08:00
//TODO 获取任务 配置详情 清单
2024-09-05 09:12:37 +08:00
[HttpGet("get_task_material")]
public IActionResult GetTaskMaterialInfo(string task_code)
{
if (string.IsNullOrEmpty(task_code)) { return SUCCESS(null); }
var response = preparantTaskService.GetTaskMaterialInfo(task_code);
return SUCCESS(response);
}
//TODO 获取任务与Bom配料要求对照
[HttpGet("get_task_material_bom_contrast")]
public IActionResult GetTaskMaterialBOMContrast(string task_code)
{
if (string.IsNullOrEmpty(task_code)) { return SUCCESS(null); }
var response = preparantTaskService.GetTaskMaterialBOMContrast(task_code);
return SUCCESS(response);
}
2024-09-04 16:43:29 +08:00
2024-09-05 10:34:08 +08:00
//TODO 新增任务
[HttpGet("new_task")]
public IActionResult AddNewTask(string workorder)
{
if (string.IsNullOrEmpty(workorder)) { return SUCCESS(null); }
2024-09-05 10:38:13 +08:00
int response = preparantTaskService.AddNewTask(workorder,HttpContext.GetName());
2024-09-05 10:34:08 +08:00
return SUCCESS(response);
}
2024-09-05 11:15:08 +08:00
2024-09-05 10:34:08 +08:00
//TODO 删除任务
[HttpGet("delete_task")]
public IActionResult DeleteTask(string task_code)
{
if (string.IsNullOrEmpty(task_code)) { return SUCCESS(null); }
int response = preparantTaskService.DeleteTask(task_code);
return SUCCESS(response);
}
2024-09-05 11:45:20 +08:00
//TODO 修改任务数量
[HttpPost("ModifyTask_num")]
public IActionResult ModifyTaskNum([FromBody] MmTaskMaterialInfoDto2 parm)
{
if(parm == null) { return SUCCESS(null); };
int response = preparantTaskService.ModifyTaskNum(parm,HttpContext.GetName());
return SUCCESS(response);
}
//TODO 表格形式查询工单 任务及其详情
[HttpPost("table_task")]
public IActionResult TableQuerytaskInfo([FromBody] FormsWorkoderAndTaskQuery parm)
{
if (parm == null) { return SUCCESS(null); };
var response = preparantTaskService.TableQuerytaskInfo(parm);
return SUCCESS(response);
}
2024-11-15 08:56:23 +08:00
//TODO 表格形式查询工单 任务及其详情 (按线别备料)
[HttpPost("table_task_byline")]
public IActionResult TableQuerytaskInfoBYline([FromBody] FormsWorkoderAndTaskQuery2 parm)
{
if (parm == null) { return SUCCESS(null); };
var response = preparantTaskService.TableQuerytaskInfoBYline(parm);
return SUCCESS(response);
}
2024-09-07 15:39:26 +08:00
//TODO 任务备料状态切换
[HttpGet("switch_task_preparation")]
public IActionResult SwitchTaskPreparation(string task_code,int preparation_status)
{
if(string.IsNullOrEmpty(task_code)) { return SUCCESS(null); };
var response = preparantTaskService.SwitchTaskPreparation(task_code, preparation_status);
return SUCCESS(response);
}
2024-09-05 11:45:20 +08:00
2024-09-05 10:34:08 +08:00
2024-09-09 09:03:55 +08:00
//TODO 备料大屏接口
[HttpGet("Preparationscreen")]
public IActionResult MaterialPreparationLargeScreen(DateTime toHandelDate)
{
if(toHandelDate==DateTime.MinValue) { return SUCCESS(null); };
var response = preparantTaskService.MaterialPreparationLargeScreen(toHandelDate);
return SUCCESS(response);
}
2024-11-15 08:56:23 +08:00
//TODO 导出excel 备料任务
/// <summary>
/// 导出excel 备料任务
/// </summary>
/// <param name="user"></param>
/// <returns></returns>
[HttpGet("export")]
[Log(Title = "导出excel", BusinessType = BusinessType.EXPORT)]
[AllowAnonymous]
2024-11-15 09:12:45 +08:00
public IActionResult ExportPreparantTask(DateTime searchDate1,DateTime searchDate2,string route_code)
2024-11-15 08:56:23 +08:00
{
2024-11-15 09:12:45 +08:00
FormsWorkoderAndTaskQuery2 parm=new FormsWorkoderAndTaskQuery2();
parm.searchDate = new []{searchDate1,searchDate2};
parm.route_code = route_code;
2024-11-15 08:56:23 +08:00
var list = preparantTaskService.ExportPreparantTask(parm);
2024-11-15 09:20:56 +08:00
var result = ExportExcelMini(list, "PreparantTask", "备料任务列表");
2024-11-15 08:56:23 +08:00
return ExportExcel(result.Item2, result.Item1);
}
2024-09-04 16:31:41 +08:00
}
}