using Microsoft.AspNetCore.Mvc;
using ZR.Model.Dto;
using ZR.Service.Business.IBusinessService;
using ZR.Admin.WebApi.Extensions;
using ZR.Admin.WebApi.Filters;
using ZR.Service.mes.wms.IService;
using ZR.Model.MES.wms.Dto;
using ZR.Model.MES.wms;
using Aliyun.OSS;
//创建时间:2024-04-17
namespace ZR.Admin.WebApi.Controllers
{
///
/// 成品入库检验
///
[Verify]
[Route("/mes/wm/WmFgentryInspect")]
public class WmFgentryInspectController : BaseController
{
///
/// 成品入库检验接口
///
private readonly IWmFgentryInspectService _WmFgentryInspectService;
public WmFgentryInspectController(IWmFgentryInspectService WmFgentryInspectService)
{
_WmFgentryInspectService = WmFgentryInspectService;
}
///
/// 把包装数据转换为检验数据
///
///
///
[HttpGet("transform")]
public IActionResult Transform(string workorder)
{
if(string.IsNullOrEmpty(workorder) == null)
{
return SUCCESS(workorder);
}
var response = _WmFgentryInspectService.TransformData(workorder);
return SUCCESS(response);
}
///
/// 查询成品入库检验列表
///
///
///
[HttpGet("list")]
[ActionPermissionFilter(Permission = "wmsManagement:wmfgentryinspect:list")]
public IActionResult QueryWmFgentryInspect([FromQuery] WmFgentryInspectQueryDto parm)
{
var response = _WmFgentryInspectService.GetList(parm);
return SUCCESS(response);
}
///
/// 查询成品入库检验列表 一级
///
///
///
[HttpGet("first_level_list")]
[ActionPermissionFilter(Permission = "wmsManagement:wmfgentryinspect:list")]
public IActionResult QueryWmFgentryInspect_first([FromQuery] WmFgentryInspectQueryDto parm)
{
var response = _WmFgentryInspectService.GetList_first(parm);
return SUCCESS(response);
}
///
/// 查询成品入库检验列表 二级
///
///
///
[HttpGet("second_level_list")]
[ActionPermissionFilter(Permission = "wmsManagement:wmfgentryinspect:list")]
public IActionResult QueryWmFgentryInspect_second([FromQuery] WmFgentryInspectQueryDto parm)
{
var response = _WmFgentryInspectService.GetList_second(parm);
return SUCCESS(response);
}
///
/// 查询成品入库检验详情
///
///
///
[HttpGet("{Id}")]
[ActionPermissionFilter(Permission = "wmsManagement:wmfgentryinspect:query")]
public IActionResult GetWmFgentryInspect(int Id)
{
var response = _WmFgentryInspectService.GetInfo(Id);
var info = response.Adapt();
return SUCCESS(info);
}
///
/// 添加成品入库检验
///
///
[HttpPost]
[ActionPermissionFilter(Permission = "wmsManagement:wmfgentryinspect:add")]
[Log(Title = "成品入库检验", BusinessType = BusinessType.INSERT)]
public IActionResult AddWmFgentryInspect([FromBody] WmFgentryInspectDto parm)
{
var modal = parm.Adapt().ToCreate(HttpContext);
var response = _WmFgentryInspectService.AddWmFgentryInspect(modal);
return SUCCESS(response);
}
///
/// 更新成品入库检验
///
///
[HttpPut]
[ActionPermissionFilter(Permission = "wmsManagement:wmfgentryinspect:edit")]
[Log(Title = "成品入库检验", BusinessType = BusinessType.UPDATE)]
public IActionResult UpdateWmFgentryInspect([FromBody] WmFgentryInspectDto parm)
{
var modal = parm.Adapt().ToUpdate(HttpContext);
var response = _WmFgentryInspectService.UpdateWmFgentryInspect(modal);
return ToResponse(response);
}
///
/// 删除成品入库检验
///
///
[HttpDelete("{ids}")]
[ActionPermissionFilter(Permission = "wmsManagement:wmfgentryinspect:delete")]
[Log(Title = "成品入库检验", BusinessType = BusinessType.DELETE)]
public IActionResult DeleteWmFgentryInspect(string ids)
{
int[] idsArr = Tools.SpitIntArrary(ids);
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
var response = _WmFgentryInspectService.Delete(idsArr);
return ToResponse(response);
}
///
/// 批量修改合适数据
///
///
[HttpPost("batchQualified")]
public IActionResult BatchQualified([FromBody]string[] packcode_select)
{
if (packcode_select == null || packcode_select.Length <= 0)
{
return SUCCESS(null);
}
var response = _WmFgentryInspectService.BatchQualified(packcode_select, HttpContext.GetName());
return ToResponse(response);
}
///
/// 批量修改合适数据
///
///
[HttpPost("batchUnQualified")]
public IActionResult BatchUnQualified([FromBody] string[] packcode_select)
{
if (packcode_select == null || packcode_select.Length <= 0)
{
return SUCCESS(null);
}
var response = _WmFgentryInspectService.BatchUnQualified(packcode_select, HttpContext.GetName());
return ToResponse(response);
}
///
/// 设置全部合格
///
///
///
[HttpGet("setAllQualified")]
public IActionResult SetAllQualified(string workorder_selected)
{
if (string.IsNullOrEmpty(workorder_selected))
{
return SUCCESS(null);
}
var response = _WmFgentryInspectService.SetAllQualified(workorder_selected, HttpContext.GetName());
return ToResponse(response);
}
}
}