281 lines
9.1 KiB
C#
Raw Normal View History

2025-07-21 13:18:14 +08:00
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 13:18:14 +08:00
//创建时间2025-07-21
namespace DOAN.Admin.WebApi.Controllers
{
/// <summary>
/// 叫料需求表
/// </summary>
[Verify]
2025-08-04 17:27:16 +08:00
[Route("mes/materialManagement/paintedparts_call/mmcall")]
2025-08-04 17:31:09 +08:00
public class MmCallController : BaseController
2025-07-21 13:18:14 +08:00
{
/// <summary>
/// 叫料需求表接口
/// </summary>
2025-08-04 17:27:16 +08:00
private readonly IMmCallService _MmCallService;
2025-07-21 13:18:14 +08:00
2025-08-04 17:31:09 +08:00
public MmCallController(IMmCallService mmcallService)
2025-07-21 13:18:14 +08:00
{
2025-08-04 17:27:16 +08:00
_MmCallService = mmcallService;
2025-07-21 13:18:14 +08:00
}
/// <summary>
/// 查询叫料需求表列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
[HttpGet("list")]
[AllowAnonymous]
2025-08-04 17:27:16 +08:00
public IActionResult Querymmcall([FromQuery] MmCallQueryDto parm)
2025-07-21 13:18:14 +08:00
{
2025-08-04 17:27:16 +08:00
var response = _MmCallService.GetList(parm);
2025-07-21 13:18:14 +08:00
return SUCCESS(response);
}
/// <summary>
/// 查询叫料需求表详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
[HttpGet("{Id}")]
2025-08-04 17:27:16 +08:00
[ActionPermissionFilter(Permission = "materialManagement:mmcall:query")]
public IActionResult Getmmcall(string Id)
2025-07-21 13:18:14 +08:00
{
2025-08-04 17:27:16 +08:00
var response = _MmCallService.GetInfo(Id);
2025-07-21 13:18:14 +08:00
2025-08-04 17:27:16 +08:00
var info = response.Adapt<MmCallMrp>();
2025-07-21 13:18:14 +08:00
return SUCCESS(info);
}
/// <summary>
/// 添加叫料需求表
/// </summary>
/// <returns></returns>
[HttpPost]
2025-08-04 17:27:16 +08:00
[ActionPermissionFilter(Permission = "materialManagement:mmcall:add")]
2025-07-21 13:18:14 +08:00
[Log(Title = "叫料需求表", BusinessType = BusinessType.INSERT)]
2025-08-04 17:27:16 +08:00
public IActionResult Addmmcall([FromBody] MmCallDto parm)
2025-07-21 13:18:14 +08:00
{
2025-08-04 17:27:16 +08:00
var modal = parm.Adapt<MmCallMrp>().ToCreate(HttpContext);
2025-07-21 13:18:14 +08:00
2025-08-04 17:27:16 +08:00
var response = _MmCallService.AddMmCallMrp(modal);
2025-07-21 13:18:14 +08:00
return SUCCESS(response);
}
/// <summary>
/// 更新叫料需求表
/// </summary>
/// <returns></returns>
[HttpPut]
2025-08-04 17:27:16 +08:00
[ActionPermissionFilter(Permission = "materialManagement:mmcall:edit")]
2025-07-21 13:18:14 +08:00
[Log(Title = "叫料需求表", BusinessType = BusinessType.UPDATE)]
2025-08-04 17:27:16 +08:00
public IActionResult Updatemmcall([FromBody] MmCallDto parm)
2025-07-21 13:18:14 +08:00
{
2025-08-04 17:27:16 +08:00
var modal = parm.Adapt<MmCallMrp>().ToUpdate(HttpContext);
var response = _MmCallService.UpdateMmCallMrp(modal);
2025-07-21 13:18:14 +08:00
return ToResponse(response);
}
/// <summary>
/// 删除叫料需求表
/// </summary>
/// <returns></returns>
[HttpDelete("{ids}")]
2025-08-04 17:27:16 +08:00
[ActionPermissionFilter(Permission = "materialManagement:mmcall:delete")]
2025-07-21 13:18:14 +08:00
[Log(Title = "叫料需求表", BusinessType = BusinessType.DELETE)]
2025-08-04 17:27:16 +08:00
public IActionResult Deletemmcall(string ids)
2025-07-21 13:18:14 +08:00
{
int[] idsArr = Tools.SpitIntArrary(ids);
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
2025-08-04 17:27:16 +08:00
var response = _MmCallService.Delete(idsArr);
2025-07-21 13:18:14 +08:00
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, "线别不能为空"));
}
2025-07-21 13:18:14 +08:00
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));
}
}
2025-07-21 13:18:14 +08:00
/// <summary>
2025-08-04 17:27:16 +08:00
/// 涂装油漆件产线叫料
/// </summary>
/// <returns></returns>
2025-08-04 17:27:16 +08:00
[HttpPost("DoLineCallMaterial")]
[AllowAnonymous]
2025-08-04 17:27:16 +08:00
[Log(Title = "涂装油漆件产线叫料", BusinessType = BusinessType.OTHER)]
public IActionResult DoLineCallMaterial([FromBody] MmCallAndReceiveDto parm)
{
try
{
2025-08-07 08:49:23 +08:00
if (string.IsNullOrEmpty(parm.Id))
{
2025-08-07 08:49:23 +08:00
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>
2025-08-04 17:27:16 +08:00
/// 涂装油漆件产线领料
/// </summary>
/// <returns></returns>
2025-08-04 17:27:16 +08:00
[HttpPost("DoLineReceiveMaterial")]
[AllowAnonymous]
2025-08-04 17:27:16 +08:00
[Log(Title = "涂装油漆件产线领料", BusinessType = BusinessType.OTHER)]
public IActionResult DoLineReceiveMaterial([FromBody] MmCallAndReceiveDto parm)
{
try
{
if (parm == null || string.IsNullOrEmpty(parm.Id))
{
2025-08-04 17:27:16 +08:00
return ToResponse(new ApiResult(500, "id不可为空"));
}
2025-08-04 17:27:16 +08:00
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)
2025-08-04 17:27:16 +08:00
{
try
{
if (parm == null || string.IsNullOrEmpty(parm.Id))
{
2025-08-04 17:27:16 +08:00
return ToResponse(new ApiResult(500, "id不可为空"));
}
2025-08-04 17:27:16 +08:00
var response = _MmCallService.DoLineReturnBackMaterial(parm);
return SUCCESS(response);
}
catch (Exception ex)
{
return ToResponse(new ApiResult(500, ex.Message));
}
}
2025-08-07 08:49:23 +08:00
/// <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);
}
2025-07-21 13:18:14 +08:00
/// <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);
}
2025-07-21 13:18:14 +08:00
}
}