177 lines
5.9 KiB
C#
177 lines
5.9 KiB
C#
|
||
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;
|
||
|
||
public MmPreparantTaskController(IMmPreparantTaskService preparantTaskService)
|
||
{
|
||
this.preparantTaskService = preparantTaskService;
|
||
}
|
||
|
||
//TODO 获取产线
|
||
[HttpGet("get_route")]
|
||
public IActionResult GetProcessRouteList()
|
||
{
|
||
var response = preparantTaskService.GetProcessRouteList();
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
//TODO 获取工单
|
||
[HttpGet("get_workoder")]
|
||
public IActionResult GetWorkOrder(DateTime searchDate, string route_code)
|
||
{
|
||
if (searchDate == DateTime.MinValue )
|
||
{
|
||
return SUCCESS(null);
|
||
|
||
}
|
||
var response = preparantTaskService.GetWorkOrder(searchDate, route_code);
|
||
return SUCCESS(response);
|
||
|
||
}
|
||
|
||
//TODO 获取任务
|
||
[HttpGet("get_task")]
|
||
public IActionResult GetTaskList(string workorder)
|
||
{
|
||
if (string.IsNullOrEmpty(workorder)) { return SUCCESS(null); }
|
||
var response = preparantTaskService.GetTaskList(workorder);
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
//TODO 获取任务 配置详情 清单
|
||
|
||
[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);
|
||
}
|
||
|
||
//TODO 新增任务
|
||
[HttpGet("new_task")]
|
||
public IActionResult AddNewTask(string workorder)
|
||
{
|
||
if (string.IsNullOrEmpty(workorder)) { return SUCCESS(null); }
|
||
|
||
int response = preparantTaskService.AddNewTask(workorder,HttpContext.GetName());
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
|
||
//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);
|
||
}
|
||
|
||
//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);
|
||
}
|
||
|
||
//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);
|
||
}
|
||
|
||
//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);
|
||
}
|
||
|
||
|
||
//TODO 备料大屏接口
|
||
[HttpGet("Preparationscreen")]
|
||
public IActionResult MaterialPreparationLargeScreen(DateTime toHandelDate)
|
||
{
|
||
if(toHandelDate==DateTime.MinValue) { return SUCCESS(null); };
|
||
|
||
var response = preparantTaskService.MaterialPreparationLargeScreen(toHandelDate);
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
|
||
//TODO 导出excel 备料任务
|
||
|
||
/// <summary>
|
||
/// 导出excel 备料任务
|
||
/// </summary>
|
||
/// <param name="user"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("export")]
|
||
[Log(Title = "导出excel", BusinessType = BusinessType.EXPORT)]
|
||
[AllowAnonymous]
|
||
public IActionResult ExportPreparantTask(DateTime searchDate1,DateTime searchDate2,string route_code)
|
||
{
|
||
FormsWorkoderAndTaskQuery2 parm=new FormsWorkoderAndTaskQuery2();
|
||
parm.searchDate = new []{searchDate1,searchDate2};
|
||
parm.route_code = route_code;
|
||
|
||
|
||
|
||
var list = preparantTaskService.ExportPreparantTask(parm);
|
||
|
||
var result = ExportExcelMini(list, "PreparantTask", "备料任务列表");
|
||
return ExportExcel(result.Item2, result.Item1);
|
||
}
|
||
}
|
||
} |