2024-07-16 14:40:02 +08:00
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
using DOAN.Model.MES.product;
|
|
|
|
|
|
using DOAN.Model.MES.product.Dto;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using DOAN.Service.MES.product.IService;
|
|
|
|
|
|
using DOAN.Service.MES.product;
|
|
|
|
|
|
using DOAN.Admin.WebApi.Filters;
|
2024-07-16 16:34:43 +08:00
|
|
|
|
using Org.BouncyCastle.Crypto;
|
2024-07-16 14:40:02 +08:00
|
|
|
|
|
|
|
|
|
|
//创建时间:2024-07-16
|
|
|
|
|
|
namespace DOAN.Admin.WebApi.Controllers
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 生产工单
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[Verify]
|
2024-07-16 14:45:41 +08:00
|
|
|
|
[Route("mes/productManagement/ProWorkorder")]
|
2024-07-16 14:40:02 +08:00
|
|
|
|
public class ProWorkorderController : BaseController
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 生产工单接口
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private readonly IProWorkorderService _ProWorkorderService;
|
|
|
|
|
|
|
|
|
|
|
|
public ProWorkorderController(IProWorkorderService ProWorkorderService)
|
|
|
|
|
|
{
|
|
|
|
|
|
_ProWorkorderService = ProWorkorderService;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 查询生产工单列表
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="parm"></param>
|
|
|
|
|
|
/// <returns></returns>
|
2024-07-16 15:34:08 +08:00
|
|
|
|
[HttpPost("list")]
|
2024-07-16 14:40:02 +08:00
|
|
|
|
[ActionPermissionFilter(Permission = "productManagement:proworkorder:list")]
|
2024-07-16 15:34:08 +08:00
|
|
|
|
public IActionResult QueryProWorkorder([FromBody] ProWorkorderQueryDto parm)
|
2024-07-16 14:40:02 +08:00
|
|
|
|
{
|
|
|
|
|
|
var response = _ProWorkorderService.GetList(parm);
|
|
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 查询生产工单详情
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="Id"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpGet("{Id}")]
|
|
|
|
|
|
[ActionPermissionFilter(Permission = "productManagement:proworkorder:query")]
|
|
|
|
|
|
public IActionResult GetProWorkorder(string Id)
|
|
|
|
|
|
{
|
|
|
|
|
|
var response = _ProWorkorderService.GetInfo(Id);
|
|
|
|
|
|
|
|
|
|
|
|
var info = response.Adapt<ProWorkorder>();
|
|
|
|
|
|
return SUCCESS(info);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 添加生产工单
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
|
[ActionPermissionFilter(Permission = "productManagement:proworkorder:add")]
|
|
|
|
|
|
[Log(Title = "生产工单", BusinessType = BusinessType.INSERT)]
|
|
|
|
|
|
public IActionResult AddProWorkorder([FromBody] ProWorkorderDto parm)
|
|
|
|
|
|
{
|
|
|
|
|
|
var modal = parm.Adapt<ProWorkorder>().ToCreate(HttpContext);
|
|
|
|
|
|
|
|
|
|
|
|
var response = _ProWorkorderService.AddProWorkorder(modal);
|
|
|
|
|
|
|
|
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 更新生产工单
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpPut]
|
|
|
|
|
|
[ActionPermissionFilter(Permission = "productManagement:proworkorder:edit")]
|
|
|
|
|
|
[Log(Title = "生产工单", BusinessType = BusinessType.UPDATE)]
|
|
|
|
|
|
public IActionResult UpdateProWorkorder([FromBody] ProWorkorderDto parm)
|
|
|
|
|
|
{
|
|
|
|
|
|
var modal = parm.Adapt<ProWorkorder>().ToUpdate(HttpContext);
|
|
|
|
|
|
var response = _ProWorkorderService.UpdateProWorkorder(modal);
|
|
|
|
|
|
|
|
|
|
|
|
return ToResponse(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 删除生产工单
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpDelete("{ids}")]
|
|
|
|
|
|
[ActionPermissionFilter(Permission = "productManagement:proworkorder:delete")]
|
|
|
|
|
|
[Log(Title = "生产工单", BusinessType = BusinessType.DELETE)]
|
|
|
|
|
|
public IActionResult DeleteProWorkorder(string ids)
|
|
|
|
|
|
{
|
2024-07-16 15:00:28 +08:00
|
|
|
|
string[] idsArr = Tools.SpitStrArrary(ids);
|
2024-07-16 14:40:02 +08:00
|
|
|
|
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
|
|
|
|
|
|
|
|
|
|
|
|
var response = _ProWorkorderService.Delete(idsArr);
|
|
|
|
|
|
|
|
|
|
|
|
return ToResponse(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-07-16 16:34:43 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 生成工单号
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="parm"></param>
|
|
|
|
|
|
/// <returns>生成工单号 数量 </returns>
|
|
|
|
|
|
[HttpPost("Generate_workorder")]
|
|
|
|
|
|
public IActionResult Generate_workorder([FromBody] ProWorkorderQueryDto2 parm)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (parm.WorkorderDate <= DateTime.MinValue)
|
|
|
|
|
|
{
|
|
|
|
|
|
SUCCESS(null);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var response = _ProWorkorderService.Generate_workorder(parm);
|
|
|
|
|
|
|
|
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
}
|
2024-07-16 17:17:36 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 插入工单
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="parm"></param>
|
|
|
|
|
|
/// <returns>1成功 0失败</returns>
|
|
|
|
|
|
[HttpPost("insert_workorder")]
|
2024-07-16 17:28:52 +08:00
|
|
|
|
public IActionResult Insert_workOrder([FromBody] ProWorkorderDto2 parm)
|
2024-07-16 17:17:36 +08:00
|
|
|
|
{
|
|
|
|
|
|
if (parm != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
return SUCCESS(null);
|
|
|
|
|
|
}
|
|
|
|
|
|
ProWorkorder newparm= parm.Adapt<ProWorkorder>().ToCreate(HttpContext);
|
|
|
|
|
|
var response = _ProWorkorderService.Insert_workOrder(newparm,parm.next_id);
|
|
|
|
|
|
|
|
|
|
|
|
return SUCCESS(response);
|
2024-07-16 16:34:43 +08:00
|
|
|
|
|
2024-07-16 14:40:02 +08:00
|
|
|
|
|
2024-07-16 17:17:36 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-07-16 14:40:02 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|