From 0ed359496e85acedd4fef75dcf0145cfb60811b5 Mon Sep 17 00:00:00 2001 From: "qianhao.xu" Date: Wed, 9 Apr 2025 15:55:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E6=98=AF=E5=90=A6=E9=A6=96?= =?UTF-8?q?=E4=BB=B6=E6=A0=87=E7=AD=BE=E6=98=AF=E5=90=A6=E5=90=88=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProInspectionLabel.cs | 57 +++++++++++++++++++ .../OnlyPrintProductLabelController.cs | 10 +++- .../Views/MainWindow.xaml.cs | 10 ++-- 3 files changed, 71 insertions(+), 6 deletions(-) create mode 100644 linesider_screen_bankend/Models/linesider_sreen_bankend.Models/ProInspectionLabel.cs diff --git a/linesider_screen_bankend/Models/linesider_sreen_bankend.Models/ProInspectionLabel.cs b/linesider_screen_bankend/Models/linesider_sreen_bankend.Models/ProInspectionLabel.cs new file mode 100644 index 0000000..04fd715 --- /dev/null +++ b/linesider_screen_bankend/Models/linesider_sreen_bankend.Models/ProInspectionLabel.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml.Linq; +using SqlSugar; +using System; + +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/linesider_screen_bankend/linesider_screen_bankend/Controller/OnlyPrintProductLabelController.cs b/linesider_screen_bankend/linesider_screen_bankend/Controller/OnlyPrintProductLabelController.cs index e0c770a..345b5cf 100644 --- a/linesider_screen_bankend/linesider_screen_bankend/Controller/OnlyPrintProductLabelController.cs +++ b/linesider_screen_bankend/linesider_screen_bankend/Controller/OnlyPrintProductLabelController.cs @@ -14,6 +14,7 @@ using System.Configuration; using linesider_screen_bankend.Core.Tools.HttpHepler; using System.Net.Http; using static Mysqlx.Crud.Order.Types; +using DOAN.Model.Mobile; namespace linesider_screen_bankend.Controller { @@ -118,7 +119,14 @@ namespace linesider_screen_bankend.Controller string workorder = queryParams["workorder"]; try { - + string FirstLabel= SqlSugarHelper.Db.Queryable().Where(x => x.Workorder == workorder).Select(it => it.FirstLabel).First(); + + if (string.IsNullOrEmpty(FirstLabel)) + { + // 返回成功响应 + await this.HttpContext.SendApiFailAsync(500, "首件标签未通过"); + return; + } await this.HttpContext.SendApiSuccessAsync(null); } catch (Exception ex) diff --git a/linesider_screen_bankend/linesider_screen_bankend/Views/MainWindow.xaml.cs b/linesider_screen_bankend/linesider_screen_bankend/Views/MainWindow.xaml.cs index 7a734bc..cf252fc 100644 --- a/linesider_screen_bankend/linesider_screen_bankend/Views/MainWindow.xaml.cs +++ b/linesider_screen_bankend/linesider_screen_bankend/Views/MainWindow.xaml.cs @@ -91,11 +91,11 @@ namespace linesider_screen_bankend.Views var server = new WebServer(o => o .WithUrlPrefix(url) .WithMode(HttpListenerMode.EmbedIO)) - .WithCors( - origins: "http://localhost:7005", - headers: "content-type,authorization", - methods: "GET,POST,PUT,DELETE" - ) + .WithCors( + origins: "http://localhost:7005", + headers: "content-type,authorization", + methods: "GET,POST,PUT,DELETE" + ) .WithWebApi("/print_api", m => m .WithController(() => new PrintCommunicationController(AddLog)) .WithController(() => new OnlyPrintProductLabelController(AddLog)))