产品校验接口

This commit is contained in:
qianhao.xu 2025-04-09 10:27:09 +08:00
parent 53c246168e
commit 70ef9bd6d3
5 changed files with 221 additions and 0 deletions

View File

@ -0,0 +1,61 @@
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
{
/// <summary>
/// 首件检验标签和末件检验标签打印接口
/// </summary>
[Route("mes/Mobile/PrintAndReportWork")]
public class PADPrintAndReportWork2Controller : BaseController
{
/// <summary>
/// 打印和报工表接口
/// </summary>
private readonly IPADPrintAndReportWork2Service printAndReportWorkService;
public PADPrintAndReportWork2Controller(IPADPrintAndReportWork2Service printAndReportWork2Service)
{
this.printAndReportWorkService = printAndReportWorkService;
}
// TODO 获取首件检验标签
public IActionResult GetFirstInspectionLabel(string workorder)
{
var response = printAndReportWorkService.GetFirstInspectionLabel(workorder);
return SUCCESS(response);
}
//TODO 校验首标签
public IActionResult CheckFirstInspectionLabel(string workorder,string first_label)
{
var response = printAndReportWorkService.CheckFirstInspectionLabel(workorder, first_label);
return SUCCESS(response);
}
//TODO 获取末件检验标签
public IActionResult GetEndInspectionLabel(string workorder)
{
var response = printAndReportWorkService.GetEndInspectionLabel(workorder);
return SUCCESS(response);
}
//TODO 校验末件标签
}
}

View File

@ -10,6 +10,9 @@ using Infrastructure.Converter;
namespace DOAN.WebApi.Controllers.Mobile.product
{
/// <summary>
/// 此接口废弃
/// </summary>
[Route("mes/Mobile/PrintAndReportWork")]
public class PADPrintAndReportWorkController : BaseController

View File

@ -0,0 +1,55 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
namespace DOAN.Model.Mobile
{
/// <summary>
/// 标签检验
/// </summary>
[SugarTable("pro_inspection_label")]
public class ProInspectionLabel
{
/// <summary>
/// 雪花
/// </summary>
[SugarColumn(IsPrimaryKey = true, IsIdentity = false)]
public string Id { get; set; }
/// <summary>
/// 工单号
/// </summary>
[SugarColumn(ColumnName = "workorder")]
public string Workorder { get; set; }
[SugarColumn(ColumnName = "first_label")]
public string FirstLabel { get; set; }
[SugarColumn(ColumnName = "end_label")]
public string EndLabel { get; set; }
/// <summary>
/// CreatedTime
/// </summary>
[SugarColumn(ColumnName = "created_time")]
public DateTime? CreatedTime { get; set; }
/// <summary>
/// UpdatedBy
/// </summary>
[SugarColumn(ColumnName = "updated_by")]
public string UpdatedBy { get; set; }
/// <summary>
/// UpdatedTime
/// </summary>
[SugarColumn(ColumnName = "updated_time")]
public DateTime? UpdatedTime { get; set; }
}
}

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DOAN.Service.Mobile.IService
{
public interface IPADPrintAndReportWork2Service
{
string GetFirstInspectionLabel(string workorder);
string CheckFirstInspectionLabel(string workorder, string first_label);
string GetEndInspectionLabel(string workorder);
string CheckEndInspectionLabel(string workorder, string end_label);
}
}

View File

@ -0,0 +1,84 @@
using DOAN.Model.MES.product;
using DOAN.Model.Mobile;
using DOAN.Service.Mobile.IService;
using Infrastructure.Attribute;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DOAN.Service.Mobile
{
[AppService(ServiceType = typeof(IPADPrintAndReportWork2Service), ServiceLifetime = LifeTime.Transient)]
public class PADPrintAndReportWork2Service : BaseService<ProReportwork>, IPADPrintAndReportWork2Service
{
public string GetFirstInspectionLabel(string workorder)
{
return Context.Queryable<ProInspectionLabel>().Where(it => it.Workorder == workorder).Select(it => it.FirstLabel).First();
}
public string CheckFirstInspectionLabel(string workorder, string first_label)
{
if (!string.IsNullOrEmpty(first_label))
{
string[] stringArray = first_label.Split("|");
if (stringArray.Length > 0)
{
if (stringArray[0] == workorder)
{
return "合格";
}
else
{
return "标签不匹配";
}
}
else
{
return "标签异常";
}
}
else
{
return "标签异常";
}
}
public string CheckEndInspectionLabel(string workorder, string end_label)
{
if (!string.IsNullOrEmpty(end_label))
{
string[] stringArray = end_label.Split("|");
if (stringArray.Length > 0)
{
if (stringArray[0] == workorder)
{
return "合格";
}
else
{
return "标签不匹配";
}
}
else
{
return "标签异常";
}
}
else
{
return "标签异常";
}
}
public string GetEndInspectionLabel(string workorder)
{
return Context.Queryable<ProInspectionLabel>().Where(it => it.Workorder == workorder).Select(it => it.EndLabel).First();
}
}
}