208 lines
6.5 KiB
C#
208 lines
6.5 KiB
C#
using DOAN.Admin.WebApi.Filters;
|
|
using DOAN.Service.Mobile;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using DOAN.Service.Mobile.IService;
|
|
using DOAN.Model.Mobile.Dto;
|
|
|
|
namespace DOAN.Admin.Mobile.Controllers
|
|
{
|
|
/// <summary>
|
|
/// 移动端 备料任务
|
|
/// </summary>
|
|
|
|
[Route("mes/Mobile/PreparationTask")]
|
|
public class PreparationTaskController : BaseController
|
|
{
|
|
private readonly IPreparationTaskService preparationTask;
|
|
|
|
public PreparationTaskController(IPreparationTaskService preparationTask)
|
|
{
|
|
this.preparationTask = preparationTask;
|
|
|
|
|
|
}
|
|
|
|
//TODO 传入日期获取所有的线
|
|
[HttpGet("get_lines")]
|
|
public IActionResult GetLines()
|
|
{
|
|
var response = preparationTask.GetLines();
|
|
|
|
return SUCCESS(response);
|
|
}
|
|
|
|
//TODO 传入日期和线 获取当日线下所有工单
|
|
[HttpGet("get_workorder")]
|
|
public IActionResult GetWorkOrderList(DateTime HandleDate, string route_code)
|
|
{
|
|
var response = preparationTask.GetWorkOrderList(HandleDate, route_code);
|
|
|
|
return SUCCESS(response);
|
|
}
|
|
|
|
//TODO 解析原材料码 返回原材料详情
|
|
[HttpGet("parse_material_code")]
|
|
public IActionResult ParseMaterialCode(string materialCode)
|
|
{
|
|
var response = preparationTask.ParseMaterialCode(materialCode);
|
|
|
|
return SUCCESS(response);
|
|
}
|
|
|
|
//TODO 获取工单下所有任务
|
|
[HttpGet("get_workorder_task")]
|
|
public IActionResult GetWorkOrderTasks(string workorder)
|
|
{
|
|
if (string.IsNullOrEmpty(workorder)) return SUCCESS(null);
|
|
|
|
var response = preparationTask.GetWorkorderTask(workorder);
|
|
|
|
return SUCCESS(response);
|
|
}
|
|
|
|
//TODO 获取任务下的配料详情
|
|
[HttpGet("get_task_info")]
|
|
public IActionResult GetTaskInfos(string task_code)
|
|
{
|
|
|
|
if (string.IsNullOrEmpty(task_code)) return SUCCESS(null);
|
|
|
|
var response = preparationTask.GetTaskInfos(task_code);
|
|
|
|
return SUCCESS(response);
|
|
}
|
|
|
|
//TODO 生成任务及其任务详情
|
|
[HttpPost("generate_ingredient_task")]
|
|
public IActionResult GenerateIngredientTask([FromBody] IngredientTaskRequestForm form)
|
|
{
|
|
if (form == null || string.IsNullOrEmpty(form.workorder) || form.Ingredient_task == null || form.Ingredient_task.Count() == 0)
|
|
{
|
|
return SUCCESS(null);
|
|
}
|
|
var response = preparationTask.GenerateIngredientTask(form);
|
|
|
|
return SUCCESS(response);
|
|
|
|
}
|
|
|
|
#region 产线任务
|
|
|
|
/// <summary>
|
|
/// 查询线别任务
|
|
/// </summary>
|
|
/// <param name="lineCode"></param>
|
|
/// <param name="hadleDate"></param>
|
|
/// <returns></returns>
|
|
[HttpGet("search_task_byline")]
|
|
public IActionResult SearchTaskByLine(string lineCode, DateTime hadleDate)
|
|
{
|
|
if (string.IsNullOrEmpty(lineCode) || hadleDate == DateTime.MinValue)
|
|
{
|
|
|
|
return SUCCESS(null);
|
|
}
|
|
var response = preparationTask.SearchTaskByLine(lineCode, hadleDate);
|
|
|
|
return SUCCESS(response);
|
|
}
|
|
|
|
//TODO 获取任务下的配料详情
|
|
[HttpGet("get_task_info_byline")]
|
|
public IActionResult GetTaskInfosByLine(string task_code)
|
|
{
|
|
|
|
if (string.IsNullOrEmpty(task_code)) return SUCCESS(null);
|
|
|
|
var response = preparationTask.GetTaskInfosByLine(task_code);
|
|
|
|
return SUCCESS(response);
|
|
|
|
}
|
|
|
|
//TODO 校验指定日期产线是否有工单 是否有备料需求
|
|
[HttpGet("check_any_peratation_material_requirement")]
|
|
public IActionResult CheckAnyPerationMaterialRequirement(DateTime handleDate,string line_code)
|
|
{
|
|
if(handleDate == DateTime.MinValue.AddYears(1)&&string.IsNullOrEmpty(line_code))
|
|
{
|
|
throw new CustomException("请求参数错误");
|
|
}
|
|
|
|
var response = preparationTask.CheckAnyPerationMaterialRequirement(handleDate, line_code);
|
|
|
|
return SUCCESS(response);
|
|
|
|
}
|
|
|
|
|
|
//TODO 提交前校验 物料是否在指定日期 指定线内
|
|
[HttpPost("check_material_isin_date_and_line")]
|
|
public IActionResult CheckMaterialIsInDateAndLine([FromBody] CheckMaterialDto checkMaterial)
|
|
{
|
|
if (checkMaterial == null || string.IsNullOrEmpty(checkMaterial.LineCode) || string.IsNullOrEmpty(checkMaterial.LineCode) || checkMaterial.HandelDate < DateTime.MinValue.AddYears(1)) throw new CustomException("请求参数错误");
|
|
|
|
|
|
var response = preparationTask.CheckMaterialIsInDateAndLine(checkMaterial);
|
|
|
|
return SUCCESS(response);
|
|
|
|
}
|
|
|
|
|
|
//TODO 生成任务及其任务详情
|
|
|
|
[HttpPost("generate_ingredient_task_byline")]
|
|
public IActionResult GenerateIngredientTaskByline([FromBody] IngredientTaskRequestForm2 form)
|
|
{
|
|
if (form == null || string.IsNullOrEmpty(form.lineCode) || form.Ingredient_task == null || form.Ingredient_task.Count() == 0)
|
|
{
|
|
return SUCCESS(null);
|
|
}
|
|
var response = preparationTask.GenerateIngredientTaskByline(form);
|
|
|
|
return SUCCESS(response);
|
|
|
|
}
|
|
|
|
//TODO 删除任务
|
|
[HttpGet("delete_task")]
|
|
public IActionResult DeleteTask(string task_code)
|
|
{
|
|
if (string.IsNullOrEmpty(task_code)) throw new CustomException("请求参数错误");
|
|
var response = preparationTask.DeletePreparationMaterialTask(task_code);
|
|
|
|
return SUCCESS(response);
|
|
|
|
}
|
|
|
|
//TODO 删除备料任务详情
|
|
[HttpGet("delete_preparation_material_info")]
|
|
public IActionResult DeletePreparationMaterialInfo(string id)
|
|
{
|
|
if (string.IsNullOrEmpty(id)) throw new CustomException("请求参数错误");
|
|
|
|
var response = preparationTask.DeletePreparationMaterialInfo(id);
|
|
|
|
return SUCCESS(response);
|
|
}
|
|
|
|
//TODO 修改备料任务详情数量
|
|
[HttpGet("update_preparation_material_num")]
|
|
public IActionResult UpdatePreParationMaterialNum(string id, decimal num)
|
|
{
|
|
if (string.IsNullOrEmpty(id)) throw new CustomException("请求参数错误");
|
|
|
|
var response = preparationTask.UpdatePreParationMaterialNum(id,num);
|
|
|
|
return SUCCESS(response);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|