281 lines
9.1 KiB
C#
281 lines
9.1 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
||
using DOAN.Model.Dto;
|
||
|
||
using DOAN.Admin.WebApi.Filters;
|
||
using DOAN.Service.MES.mm.paintedparts_call.IService;
|
||
using DOAN.Model.MES.mm.paintedparts_call;
|
||
using DOAN.Model.MES.mm.paintedparts_call.Dto;
|
||
using JinianNet.JNTemplate;
|
||
|
||
//创建时间:2025-07-21
|
||
namespace DOAN.Admin.WebApi.Controllers
|
||
{
|
||
/// <summary>
|
||
/// 叫料需求表
|
||
/// </summary>
|
||
[Verify]
|
||
[Route("mes/materialManagement/paintedparts_call/mmcall")]
|
||
public class MmCallController : BaseController
|
||
{
|
||
/// <summary>
|
||
/// 叫料需求表接口
|
||
/// </summary>
|
||
private readonly IMmCallService _MmCallService;
|
||
|
||
public MmCallController(IMmCallService mmcallService)
|
||
{
|
||
_MmCallService = mmcallService;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 查询叫料需求表列表
|
||
/// </summary>
|
||
/// <param name="parm"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("list")]
|
||
[AllowAnonymous]
|
||
public IActionResult Querymmcall([FromQuery] MmCallQueryDto parm)
|
||
{
|
||
var response = _MmCallService.GetList(parm);
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 查询叫料需求表详情
|
||
/// </summary>
|
||
/// <param name="Id"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("{Id}")]
|
||
[ActionPermissionFilter(Permission = "materialManagement:mmcall:query")]
|
||
public IActionResult Getmmcall(string Id)
|
||
{
|
||
var response = _MmCallService.GetInfo(Id);
|
||
|
||
var info = response.Adapt<MmCallMrp>();
|
||
return SUCCESS(info);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 添加叫料需求表
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost]
|
||
[ActionPermissionFilter(Permission = "materialManagement:mmcall:add")]
|
||
[Log(Title = "叫料需求表", BusinessType = BusinessType.INSERT)]
|
||
public IActionResult Addmmcall([FromBody] MmCallDto parm)
|
||
{
|
||
var modal = parm.Adapt<MmCallMrp>().ToCreate(HttpContext);
|
||
|
||
var response = _MmCallService.AddMmCallMrp(modal);
|
||
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 更新叫料需求表
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPut]
|
||
[ActionPermissionFilter(Permission = "materialManagement:mmcall:edit")]
|
||
[Log(Title = "叫料需求表", BusinessType = BusinessType.UPDATE)]
|
||
public IActionResult Updatemmcall([FromBody] MmCallDto parm)
|
||
{
|
||
var modal = parm.Adapt<MmCallMrp>().ToUpdate(HttpContext);
|
||
var response = _MmCallService.UpdateMmCallMrp(modal);
|
||
|
||
return ToResponse(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 删除叫料需求表
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpDelete("{ids}")]
|
||
[ActionPermissionFilter(Permission = "materialManagement:mmcall:delete")]
|
||
[Log(Title = "叫料需求表", BusinessType = BusinessType.DELETE)]
|
||
public IActionResult Deletemmcall(string ids)
|
||
{
|
||
int[] idsArr = Tools.SpitIntArrary(ids);
|
||
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
|
||
|
||
var response = _MmCallService.Delete(idsArr);
|
||
|
||
return ToResponse(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 生成产线油漆件MRP
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost("GenerateLineMmCallMRP")]
|
||
[AllowAnonymous]
|
||
[Log(Title = "生成产线油漆件MRP", BusinessType = BusinessType.OTHER)]
|
||
public IActionResult GenerateLineMmCallMRP([FromBody] MmCallMrpGenerateDto parm)
|
||
{
|
||
try
|
||
{
|
||
if (string.IsNullOrEmpty(parm.LineCode))
|
||
{
|
||
return ToResponse(new ApiResult(500, "线别不能为空"));
|
||
}
|
||
|
||
if (!parm.WorkOrderDate.HasValue)
|
||
{
|
||
return ToResponse(new ApiResult(500, "日期不能为空"));
|
||
}
|
||
int response = _MmCallService.GenerateLineMmCallMRP(parm);
|
||
if (response == 0)
|
||
{
|
||
return ToResponse(new ApiResult(200, $"线别:{parm.LineCode}无油漆件"));
|
||
}
|
||
return ToResponse(new ApiResult(200, "ok"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
return ToResponse(new ApiResult(500,ex.Message));
|
||
}
|
||
|
||
}
|
||
|
||
/// <summary>
|
||
/// 涂装油漆件产线叫料
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost("DoLineCallMaterial")]
|
||
[AllowAnonymous]
|
||
[Log(Title = "涂装油漆件产线叫料", BusinessType = BusinessType.OTHER)]
|
||
public IActionResult DoLineCallMaterial([FromBody] MmCallAndReceiveDto parm)
|
||
{
|
||
try
|
||
{
|
||
if (string.IsNullOrEmpty(parm.Id))
|
||
{
|
||
return ToResponse(new ApiResult(500, "Id不可为空"));
|
||
}
|
||
var response = _MmCallService.DoLineCallMaterial(parm);
|
||
|
||
return SUCCESS(response);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
return ToResponse(new ApiResult(500, ex.Message));
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 涂装油漆件产线领料
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost("DoLineReceiveMaterial")]
|
||
[AllowAnonymous]
|
||
[Log(Title = "涂装油漆件产线领料", BusinessType = BusinessType.OTHER)]
|
||
public IActionResult DoLineReceiveMaterial([FromBody] MmCallAndReceiveDto parm)
|
||
{
|
||
try
|
||
{
|
||
if (parm == null || string.IsNullOrEmpty(parm.Id))
|
||
{
|
||
return ToResponse(new ApiResult(500, "id不可为空"));
|
||
}
|
||
var response = _MmCallService.DoLineReceiveMaterial(parm);
|
||
|
||
return SUCCESS(response);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
return ToResponse(new ApiResult(500, ex.Message));
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 涂装油漆件产线退料
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost("DoLineReturnBackMaterial")]
|
||
[AllowAnonymous]
|
||
[Log(Title = "涂装油漆件产线退料", BusinessType = BusinessType.OTHER)]
|
||
public IActionResult DoLineReturnBackMaterial([FromBody] MmCallAndReceiveDto parm)
|
||
{
|
||
try
|
||
{
|
||
if (parm == null || string.IsNullOrEmpty(parm.Id))
|
||
{
|
||
return ToResponse(new ApiResult(500, "id不可为空"));
|
||
}
|
||
|
||
var response = _MmCallService.DoLineReturnBackMaterial(parm);
|
||
|
||
return SUCCESS(response);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
return ToResponse(new ApiResult(500, ex.Message));
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// (PDA)查询组清单
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpGet("GetLineOptions")]
|
||
[AllowAnonymous]
|
||
public IActionResult GetLineOptions()
|
||
{
|
||
var response = _MmCallService.GetLineOptions();
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// (PDA)查询叫料MRP需求表列表
|
||
/// </summary>
|
||
/// <param name="parm"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("QueryCallMaterialMRPList")]
|
||
[AllowAnonymous]
|
||
public IActionResult QueryCallMaterialMRPList([FromQuery] MmCallQueryDto parm)
|
||
{
|
||
var response = _MmCallService.GetPDACallMaterialMrpList(parm);
|
||
return SUCCESS(response);
|
||
}
|
||
/// <summary>
|
||
/// (PDA)查询叫料MRP需求表列表
|
||
/// </summary>
|
||
/// <param name="parm"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("QueryCallReceiveList")]
|
||
[AllowAnonymous]
|
||
public IActionResult QueryCallReceiveList([FromQuery] MmCallQueryDto parm)
|
||
{
|
||
var response = _MmCallService.GetPDACallReceiveList(parm);
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// (Web)获取大屏叫料列表
|
||
/// </summary>
|
||
/// <param name="parm"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("GetWebBoradCallReceiveList")]
|
||
[AllowAnonymous]
|
||
public IActionResult GetWebBoradCallReceiveList([FromQuery] MmCallQueryDto parm)
|
||
{
|
||
var response = _MmCallService.GetWebBoradCallReceiveList(parm);
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// (Web)获取大屏叫料列表
|
||
/// </summary>
|
||
/// <param name="parm"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("GetWebBoardCallReturnBackList")]
|
||
[AllowAnonymous]
|
||
public IActionResult GetWebBoardCallReturnBackList([FromQuery] MmCallQueryDto parm)
|
||
{
|
||
var response = _MmCallService.GetWebBoardCallReturnBackList(parm);
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
}
|
||
} |