From 64723e0a8d6744fec2b8bd9899387aff1fc5ccaa Mon Sep 17 00:00:00 2001 From: "qianhao.xu" Date: Fri, 11 Apr 2025 17:01:31 +0800 Subject: [PATCH] =?UTF-8?q?=20=20=20=20CreatedBy=3D"U3=E5=92=8CU5"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PADPrintAndReportWork2Controller.cs | 2 +- .../PADPrintAndReportWork3Controller.cs | 73 ++++++++ DOAN.Model/Mobile/ProInspectionLabel.cs | 8 + .../IPADPrintAndReportWork3Service.cs | 17 ++ .../Mobile/PADPrintAndReportWork3Service.cs | 173 ++++++++++++++++++ 5 files changed, 272 insertions(+), 1 deletion(-) create mode 100644 DOAN.Admin.WebApi/Controllers/Mobile/product/PADPrintAndReportWork3Controller.cs create mode 100644 DOAN.Service/Mobile/IService/IPADPrintAndReportWork3Service.cs create mode 100644 DOAN.Service/Mobile/PADPrintAndReportWork3Service.cs diff --git a/DOAN.Admin.WebApi/Controllers/Mobile/product/PADPrintAndReportWork2Controller.cs b/DOAN.Admin.WebApi/Controllers/Mobile/product/PADPrintAndReportWork2Controller.cs index db6377d..aaf188e 100644 --- a/DOAN.Admin.WebApi/Controllers/Mobile/product/PADPrintAndReportWork2Controller.cs +++ b/DOAN.Admin.WebApi/Controllers/Mobile/product/PADPrintAndReportWork2Controller.cs @@ -11,7 +11,7 @@ using Infrastructure.Converter; namespace DOAN.WebApi.Controllers.Mobile.product { /// - /// 首件检验标签和末件检验标签打印接口 + /// 首件检验标签和末件检验标签打印接口 U13和U16 /// [Route("mes/Mobile/PrintAndReportWork2")] diff --git a/DOAN.Admin.WebApi/Controllers/Mobile/product/PADPrintAndReportWork3Controller.cs b/DOAN.Admin.WebApi/Controllers/Mobile/product/PADPrintAndReportWork3Controller.cs new file mode 100644 index 0000000..fc46ba0 --- /dev/null +++ b/DOAN.Admin.WebApi/Controllers/Mobile/product/PADPrintAndReportWork3Controller.cs @@ -0,0 +1,73 @@ +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/PrintAndReportWork3")] + public class PADPrintAndReportWork3Controller : BaseController + { + /// + /// 打印和报工表接口 U3和U5线 + /// + private readonly IPADPrintAndReportWork3Service printAndReportWork3Service; + + public PADPrintAndReportWork3Controller(IPADPrintAndReportWork3Service _printAndReportWork3Service) + { + this.printAndReportWork3Service = _printAndReportWork3Service; + } + + // TODO 获取首件检验标签 + [HttpGet("firstInspectionLabel")] + public IActionResult GetFirstInspectionLabel(string workorder) + { + var response = printAndReportWork3Service.GetFirstInspectionLabel(workorder); + return SUCCESS(response); + } + + //TODO 校验箱子标签 + [HttpGet("CheckBoxInspectionLabel")] + public IActionResult CheckBoxInspectionLabel(string workorder, string box_label) + { + var response = printAndReportWork3Service.CheckBoxInspectionLabel(workorder, box_label); + return SUCCESS(response); + return SUCCESS(true); + } + + //TODO 校验首标签 + [HttpGet("CheckfirstInspectionLabel")] + public IActionResult CheckFirstInspectionLabel(string workorder, string first_label) + { + var response = printAndReportWork3Service.CheckFirstInspectionLabel(workorder, first_label); + return SUCCESS(response); + } + + + //TODO 获取末件检验标签 + [HttpGet("getendinspectionlabel")] + public IActionResult GetEndInspectionLabel(string workorder) + { + var response = printAndReportWork3Service.GetEndInspectionLabel(workorder); + return SUCCESS(response); + } + + + + //TODO 校验末件标签 + [HttpGet("CheckEndInspectionLabel")] + public IActionResult CheckEndInspectionLabel(string workorder, string end_label) + { + var response = printAndReportWork3Service.CheckEndInspectionLabel(workorder, end_label); + return SUCCESS(response); + } + + + + } +} diff --git a/DOAN.Model/Mobile/ProInspectionLabel.cs b/DOAN.Model/Mobile/ProInspectionLabel.cs index 2158ab3..fabd4bc 100644 --- a/DOAN.Model/Mobile/ProInspectionLabel.cs +++ b/DOAN.Model/Mobile/ProInspectionLabel.cs @@ -34,6 +34,14 @@ namespace DOAN.Model.Mobile public string EndLabel { get; set; } + + + /// + /// created_by + /// + [SugarColumn(ColumnName = "created_by")] + public string CreatedBy { get; set; } + /// /// CreatedTime /// diff --git a/DOAN.Service/Mobile/IService/IPADPrintAndReportWork3Service.cs b/DOAN.Service/Mobile/IService/IPADPrintAndReportWork3Service.cs new file mode 100644 index 0000000..2f75fb7 --- /dev/null +++ b/DOAN.Service/Mobile/IService/IPADPrintAndReportWork3Service.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DOAN.Service.Mobile.IService +{ + public interface IPADPrintAndReportWork3Service + { + string GetFirstInspectionLabel(string workorder); + string CheckBoxInspectionLabel(string workorder, string box_label); + string CheckFirstInspectionLabel(string workorder, string first_label); + string GetEndInspectionLabel(string workorder); + string CheckEndInspectionLabel(string workorder, string end_label); + } +} diff --git a/DOAN.Service/Mobile/PADPrintAndReportWork3Service.cs b/DOAN.Service/Mobile/PADPrintAndReportWork3Service.cs new file mode 100644 index 0000000..e26facd --- /dev/null +++ b/DOAN.Service/Mobile/PADPrintAndReportWork3Service.cs @@ -0,0 +1,173 @@ +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(IPADPrintAndReportWork3Service), ServiceLifetime = LifeTime.Transient)] + public class PADPrintAndReportWork3Service : BaseService, IPADPrintAndReportWork3Service + { + public string GetFirstInspectionLabel(string workorder) + { + return Context.Queryable().Where(it => it.Workorder == workorder).Select(it => it.FirstLabel).First() ?? ""; + + } + + + public string CheckBoxInspectionLabel(string workorder, string box_label) + { + try + { + if (string.IsNullOrEmpty(box_label)) + { + return "箱标签传入为空!"; + } + //TODO U3 U5 箱标签解析 + string[] box_labelArray= box_label.Split('/'); + if(box_labelArray.Length <=1) + { + return "箱标签解析失败!"; + } + + // 提取工单规格 + string workorderProductionCode = Context.Queryable().Where(it => it.Workorder == workorder).Select(it => it.ProductionCode).First(); + if (string.IsNullOrEmpty(workorderProductionCode)) + { + return "工单规格异常,规格为空!"; + } + if (box_labelArray[0] == workorderProductionCode) + { + return "合格"; + } + else + { + return "外箱标签规格与工单规格不匹配"; + } + + } + catch (Exception) + { + throw; + } + } + public string CheckFirstInspectionLabel(string workorder, string first_label) + { + if (!string.IsNullOrEmpty(first_label)) + { + first_label = first_label.Replace(" ", " "); + string workorderSpecification = Context.Queryable().Where(it => it.Workorder == workorder).Select(it => it.Specification).First(); + if (string.IsNullOrEmpty(workorderSpecification)) + { + return "工单规格异常,规格为空!"; + } + if (first_label.Contains(workorderSpecification)) + { + bool isExist = Context.Queryable().Where(it => it.Workorder == workorder).Any(); + if (isExist) + { + + Context.Updateable() + .Where(it => it.Workorder == workorder) + .SetColumns(it => new ProInspectionLabel() { FirstLabel = first_label, UpdatedTime = DateTime.Now, UpdatedBy = "U3和U5" }) + .ExecuteCommand(); + + + } + else + { + ProInspectionLabel insert = new ProInspectionLabel() + { + Id = XueHua, + Workorder = workorder, + FirstLabel = first_label, + CreatedTime = DateTime.Now, + CreatedBy="U3和U5" + + + }; + + + Context.Insertable(insert).ExecuteCommand(); + } + + return "合格"; + } + else + { + return "标签不匹配"; + } + + } + else + { + return "标签异常"; + } + } + + public string CheckEndInspectionLabel(string workorder, string end_label) + { + if (!string.IsNullOrEmpty(end_label)) + { + end_label = end_label.Replace(" ", " "); + string workorderSpecification = Context.Queryable().Where(it => it.Workorder == workorder).Select(it => it.Specification).First(); + if (string.IsNullOrEmpty(workorderSpecification)) + { + return "工单规格异常,规格为空!"; + } + if (end_label.Contains(workorderSpecification)) + { + bool isExist = Context.Queryable().Where(it => it.Workorder == workorder).Any(); + if (isExist) + { + + Context.Updateable() + .Where(it => it.Workorder == workorder) + .SetColumns(it => new ProInspectionLabel() { EndLabel = end_label, UpdatedTime = DateTime.Now , UpdatedBy = "U3和U5" }) + .ExecuteCommand(); + + + } + else + { + ProInspectionLabel insert = new ProInspectionLabel() + { + Id = XueHua, + Workorder = workorder, + EndLabel = end_label, + CreatedTime = DateTime.Now, + CreatedBy = "U3和U5" + + }; + + + Context.Insertable(insert).ExecuteCommand(); + } + + return "合格"; + } + else + { + return "标签不匹配"; + } + + } + else + { + return "标签异常"; + } + } + + public string GetEndInspectionLabel(string workorder) + { + return Context.Queryable().Where(it => it.Workorder == workorder).Select(it => it.EndLabel).First() ?? ""; + } + + } +}