2024-08-30 18:08:45 +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;
|
2024-08-31 09:10:28 +08:00
|
|
|
|
using Aliyun.OSS;
|
|
|
|
|
|
using JinianNet.JNTemplate;
|
2024-08-30 18:08:45 +08:00
|
|
|
|
//创建时间:2024-08-30
|
|
|
|
|
|
namespace DOAN.Admin.WebApi.Controllers
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 物料需求计划
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[Verify]
|
2024-08-30 18:11:47 +08:00
|
|
|
|
[Route("mes/materialManagement/MmRequirePlan")]
|
2024-08-30 18:08:45 +08:00
|
|
|
|
public class MmRequirePlanController : BaseController
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 物料需求计划接口
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private readonly IMmRequirePlanService _MmRequirePlanService;
|
|
|
|
|
|
|
|
|
|
|
|
public MmRequirePlanController(IMmRequirePlanService MmRequirePlanService)
|
|
|
|
|
|
{
|
|
|
|
|
|
_MmRequirePlanService = MmRequirePlanService;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-08-31 09:10:28 +08:00
|
|
|
|
//TODO 生成物料需求计划
|
|
|
|
|
|
[HttpGet("generate")]
|
|
|
|
|
|
public IActionResult GenerateMmRequirePlan(DateTime? plan_date)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (plan_date == null || plan_date == DateTime.MinValue)
|
|
|
|
|
|
{
|
|
|
|
|
|
SUCCESS(null);
|
|
|
|
|
|
}
|
|
|
|
|
|
var response = _MmRequirePlanService.GenerateMmRequirePlan(plan_date.Value, HttpContext.GetName());
|
|
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-08-30 18:08:45 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 查询物料需求计划列表
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="parm"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpGet("list")]
|
|
|
|
|
|
[ActionPermissionFilter(Permission = "materialManagement:mmrequireplan:list")]
|
|
|
|
|
|
public IActionResult QueryMmRequirePlan([FromQuery] MmRequirePlanQueryDto parm)
|
|
|
|
|
|
{
|
|
|
|
|
|
var response = _MmRequirePlanService.GetList(parm);
|
|
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 查询物料需求计划详情
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="Id"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpGet("{Id}")]
|
|
|
|
|
|
[ActionPermissionFilter(Permission = "materialManagement:mmrequireplan:query")]
|
|
|
|
|
|
public IActionResult GetMmRequirePlan(string Id)
|
|
|
|
|
|
{
|
|
|
|
|
|
var response = _MmRequirePlanService.GetInfo(Id);
|
2024-08-31 09:10:28 +08:00
|
|
|
|
|
2024-08-30 18:08:45 +08:00
|
|
|
|
var info = response.Adapt<MmRequirePlan>();
|
|
|
|
|
|
return SUCCESS(info);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 添加物料需求计划
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
|
[ActionPermissionFilter(Permission = "materialManagement:mmrequireplan:add")]
|
|
|
|
|
|
[Log(Title = "物料需求计划", BusinessType = BusinessType.INSERT)]
|
|
|
|
|
|
public IActionResult AddMmRequirePlan([FromBody] MmRequirePlanDto parm)
|
|
|
|
|
|
{
|
|
|
|
|
|
var modal = parm.Adapt<MmRequirePlan>().ToCreate(HttpContext);
|
|
|
|
|
|
|
|
|
|
|
|
var response = _MmRequirePlanService.AddMmRequirePlan(modal);
|
|
|
|
|
|
|
|
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 更新物料需求计划
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpPut]
|
|
|
|
|
|
[ActionPermissionFilter(Permission = "materialManagement:mmrequireplan:edit")]
|
|
|
|
|
|
[Log(Title = "物料需求计划", BusinessType = BusinessType.UPDATE)]
|
|
|
|
|
|
public IActionResult UpdateMmRequirePlan([FromBody] MmRequirePlanDto parm)
|
|
|
|
|
|
{
|
|
|
|
|
|
var modal = parm.Adapt<MmRequirePlan>().ToUpdate(HttpContext);
|
|
|
|
|
|
var response = _MmRequirePlanService.UpdateMmRequirePlan(modal);
|
|
|
|
|
|
|
|
|
|
|
|
return ToResponse(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 删除物料需求计划
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpDelete("{ids}")]
|
|
|
|
|
|
[ActionPermissionFilter(Permission = "materialManagement:mmrequireplan:delete")]
|
|
|
|
|
|
[Log(Title = "物料需求计划", BusinessType = BusinessType.DELETE)]
|
|
|
|
|
|
public IActionResult DeleteMmRequirePlan(string ids)
|
|
|
|
|
|
{
|
2024-08-30 18:15:38 +08:00
|
|
|
|
string[] idsArr = Tools.SpitStrArrary(ids);
|
2024-08-30 18:08:45 +08:00
|
|
|
|
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
|
|
|
|
|
|
|
|
|
|
|
|
var response = _MmRequirePlanService.Delete(idsArr);
|
|
|
|
|
|
|
|
|
|
|
|
return ToResponse(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-08-31 10:18:25 +08:00
|
|
|
|
//TODO 修改足料和缺料
|
|
|
|
|
|
[HttpGet("update_material_status")]
|
|
|
|
|
|
public IActionResult UpdateMaterialStatus(string id, int status)
|
|
|
|
|
|
{
|
|
|
|
|
|
var response = _MmRequirePlanService.UpdateMaterialStatus(id, status, HttpContext.GetName());
|
|
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
}
|
2024-08-30 18:08:45 +08:00
|
|
|
|
|
2024-08-31 10:28:56 +08:00
|
|
|
|
//TODO 一键足料、缺料
|
|
|
|
|
|
[HttpGet("all_update_material_status")]
|
2024-09-14 16:34:31 +08:00
|
|
|
|
public IActionResult AllUpdateMaterialStatus(DateTime? handledate, int status)
|
2024-08-31 10:28:56 +08:00
|
|
|
|
{
|
|
|
|
|
|
var response = _MmRequirePlanService.AllUpdateMaterialStatus(handledate, status, HttpContext.GetName());
|
|
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2024-08-30 18:08:45 +08:00
|
|
|
|
|
|
|
|
|
|
|
2024-09-14 16:34:31 +08:00
|
|
|
|
// TODO 检测是否可以和ERP库存通讯
|
|
|
|
|
|
[HttpGet("check_communication_ERP_inv")]
|
|
|
|
|
|
public IActionResult CheckCommunicationERPInventory()
|
|
|
|
|
|
{
|
|
|
|
|
|
var response = _MmRequirePlanService.CheckCommunicationERPInventory();
|
|
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-20 10:18:19 +08:00
|
|
|
|
//TODO 根据产线和日期查询物料需求计划
|
|
|
|
|
|
|
|
|
|
|
|
[HttpPost("get_material_require_plan_byline")]
|
|
|
|
|
|
public IActionResult GetMaterialRequirePlanByline([FromBody] MmRequirePlanQueryDto2 parm)
|
|
|
|
|
|
{
|
|
|
|
|
|
var response = _MmRequirePlanService.GetMaterialRequirePlanByline(parm);
|
|
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-14 16:34:31 +08:00
|
|
|
|
|
2024-08-30 18:08:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|