diff --git a/DOAN.Admin.WebApi/Controllers/Mobile/product/PADPrintAndReportWork2Controller.cs b/DOAN.Admin.WebApi/Controllers/Mobile/product/PADPrintAndReportWork2Controller.cs new file mode 100644 index 0000000..b86e691 --- /dev/null +++ b/DOAN.Admin.WebApi/Controllers/Mobile/product/PADPrintAndReportWork2Controller.cs @@ -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 +{ + /// + /// 首件检验标签和末件检验标签打印接口 + /// + + [Route("mes/Mobile/PrintAndReportWork")] + public class PADPrintAndReportWork2Controller : BaseController + { + /// + /// 打印和报工表接口 + /// + 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 校验末件标签 + + + + + } +} \ No newline at end of file diff --git a/DOAN.Admin.WebApi/Controllers/Mobile/product/PADPrintAndReportWorkController.cs b/DOAN.Admin.WebApi/Controllers/Mobile/product/PADPrintAndReportWorkController.cs index 2d97a73..6881869 100644 --- a/DOAN.Admin.WebApi/Controllers/Mobile/product/PADPrintAndReportWorkController.cs +++ b/DOAN.Admin.WebApi/Controllers/Mobile/product/PADPrintAndReportWorkController.cs @@ -10,6 +10,9 @@ using Infrastructure.Converter; namespace DOAN.WebApi.Controllers.Mobile.product { + /// + /// 此接口废弃 + /// [Route("mes/Mobile/PrintAndReportWork")] public class PADPrintAndReportWorkController : BaseController diff --git a/DOAN.Model/Mobile/ProInspectionLabel.cs b/DOAN.Model/Mobile/ProInspectionLabel.cs new file mode 100644 index 0000000..2158ab3 --- /dev/null +++ b/DOAN.Model/Mobile/ProInspectionLabel.cs @@ -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 +{ + /// + /// 标签检验 + /// + [SugarTable("pro_inspection_label")] + public class ProInspectionLabel + { + /// + /// 雪花 + /// + [SugarColumn(IsPrimaryKey = true, IsIdentity = false)] + public string Id { get; set; } + + /// + /// 工单号 + /// + [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; } + + + /// + /// CreatedTime + /// + [SugarColumn(ColumnName = "created_time")] + public DateTime? CreatedTime { get; set; } + + /// + /// UpdatedBy + /// + [SugarColumn(ColumnName = "updated_by")] + public string UpdatedBy { get; set; } + + /// + /// UpdatedTime + /// + [SugarColumn(ColumnName = "updated_time")] + public DateTime? UpdatedTime { get; set; } + } +} diff --git a/DOAN.Service/Mobile/IService/IPADPrintAndReportWork2Service.cs b/DOAN.Service/Mobile/IService/IPADPrintAndReportWork2Service.cs new file mode 100644 index 0000000..187a749 --- /dev/null +++ b/DOAN.Service/Mobile/IService/IPADPrintAndReportWork2Service.cs @@ -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); + } +} diff --git a/DOAN.Service/Mobile/PADPrintAndReportWork2Service.cs b/DOAN.Service/Mobile/PADPrintAndReportWork2Service.cs new file mode 100644 index 0000000..078f24c --- /dev/null +++ b/DOAN.Service/Mobile/PADPrintAndReportWork2Service.cs @@ -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, IPADPrintAndReportWork2Service + { + + public string GetFirstInspectionLabel(string workorder) + { + return Context.Queryable().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().Where(it => it.Workorder == workorder).Select(it => it.EndLabel).First(); + } + + + } +}