using DOAN.Admin.WebApi.Filters;
using DOAN.Model.MES.product;
using DOAN.Model.MES.product.Dto;
using DOAN.Service.Mobile;
using Microsoft.AspNetCore.Mvc;
using DOAN.Service.Mobile.IService;
using DOAN.Model.Mobile.Dto;
using DOAN.Service.MES.product.IService;
using Infrastructure.Converter;
namespace DOAN.WebApi.Controllers.Mobile.product
{
///
/// 此接口废弃
///
[Route("mes/Mobile/PrintAndReportWork")]
public class PADPrintAndReportWorkController : BaseController
{
///
/// 打印和报工表接口
///
private readonly IPADPrintAndReportWorkService printAndReportWorkService;
public PADPrintAndReportWorkController(IPADPrintAndReportWorkService printAndReportWorkService)
{
this.printAndReportWorkService = printAndReportWorkService;
}
//TODO 检验箱标签
[HttpGet("inspectionBoxLabel")]
public IActionResult InspectionBoxLabel(string box_label,string workorder)
{
if(string.IsNullOrEmpty(box_label))
{
return ToResponse(ResultCode.NO_DATA, "箱标签不能为空");
}
if (string.IsNullOrEmpty(workorder))
{
return ToResponse(ResultCode.NO_DATA, "工单号不能为空");
}
var result = printAndReportWorkService.InspectionBoxLabel(box_label, workorder);
return SUCCESS(result);
}
//TODO 检验产品标签
[HttpGet("inspectionProductLabel")]
public IActionResult InspectionProductLabel(string product_label, string workorder)
{
if (string.IsNullOrEmpty(product_label))
{
return ToResponse(ResultCode.NO_DATA, "产品标签不能为空");
}
if (string.IsNullOrEmpty(workorder))
{
return ToResponse(ResultCode.NO_DATA, "工单号不能为空");
}
var result = printAndReportWorkService.InspectionProductLabel(product_label, workorder);
return SUCCESS(result);
}
//TODO 箱子标签和产品标签关联,及产品标签检验,及其工单报工
///
///
///
///
/// -1是产品检验不通过,其他是报工数量
[HttpPost("box_label_and_product_label")]
public IActionResult BoxLabelAndProductLabel([FromBody] BoxLabelAndProductLabelDto boxLabelAndProductLabelDto)
{
if (string.IsNullOrEmpty(boxLabelAndProductLabelDto.BoxLabel))
{
return ToResponse(ResultCode.NO_DATA, "箱标签不能为空");
}
if (boxLabelAndProductLabelDto.ProductLabelArray.Length<=0)
{
return ToResponse(ResultCode.NO_DATA, "产品标签不能为空");
}
if (string.IsNullOrEmpty(boxLabelAndProductLabelDto.Workorder))
{
return ToResponse(ResultCode.NO_DATA, "工单号不能为空");
}
var result = printAndReportWorkService.BoxLabelAndProductLabel(boxLabelAndProductLabelDto);
return SUCCESS(result);
}
}
}