From 9d5055d60bb77697d7197d19a8ecd549bff09b09 Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周四, 28 11月 2024 13:30:56 +0800
Subject: [PATCH] 核对标签工位

---
 LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/WmsTask/WmsOperationTaskService.cs              |   37 ++++++++++++++++++
 LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/WmsTask/WmsRbLineTask/Dto/ValidateLabelInput.cs |   25 ++++++++++++
 2 files changed, 62 insertions(+), 0 deletions(-)

diff --git a/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/WmsTask/WmsOperationTaskService.cs b/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/WmsTask/WmsOperationTaskService.cs
index 4ac2060..dc62396 100644
--- a/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/WmsTask/WmsOperationTaskService.cs
+++ b/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/WmsTask/WmsOperationTaskService.cs
@@ -18,15 +18,18 @@
     private readonly SqlSugarRepository<WmsStockQuan> _wmsStockQuanRep;
     private readonly SqlSugarRepository<Mes_Package_Gather> _mesPackageGatherRep;
     private readonly SqlSugarRepository<SysConfig> _sysConfigRep;
+    private readonly SqlSugarRepository<Mes_BatchOrderUPI_New> _mesBatchOrderUpiRep;
     public WmsOperationTaskService(SqlSugarRepository<WmsRbLineTask> rep, SqlSugarRepository<WmsStockQuan> wmsStockQuanRep
         , SqlSugarRepository<Mes_Package_Gather> mesPackageGatherRep
         , SqlSugarRepository<SysConfig> sysConfigRep
+        , SqlSugarRepository<Mes_BatchOrderUPI_New> mesBatchOrderUpiRep
         )
     {
         _sysConfigRep = sysConfigRep;
         _mesPackageGatherRep = mesPackageGatherRep;
         _rep = rep;
         _wmsStockQuanRep = wmsStockQuanRep;
+        _mesBatchOrderUpiRep = mesBatchOrderUpiRep;
     }
 
 
@@ -122,5 +125,39 @@
         output.QiTaoReuslt = _QiTaoReuslt;
         return output;
     }
+
+
+    /// <summary>
+    /// 鏍稿鏍囩
+    /// </summary>
+    /// <param name="input"></param>
+    /// <returns></returns>
+    [HttpPost]
+    [ApiDescriptionSettings(Name = "ValdateLabel")]
+    [Description("WmsOperationTask/ValdateLabel")]
+    public async Task<Mes_Package_Gather> ValdateLabel(ValidateLabelInput input)
+    {
+        if (input == null || input.PackageCode == null || input.Upi == null)
+        {
+            throw Oops.Oh("鍙傛暟涓嶈兘涓虹┖");
+        }
+
+        var singleUpi = await _mesBatchOrderUpiRep.AsQueryable().Where(x => x.UPI == input.Upi).FirstAsync();
+        if (singleUpi == null)
+        {
+            throw Oops.Oh($"娌℃湁鎵惧埌閮ㄤ欢鏉$爜{input.Upi}鐨勬暟鎹�");
+        }
+        if (singleUpi.PackageCode != input.PackageCode)
+        {
+            throw Oops.Oh($"閮ㄤ欢鏉$爜{input.Upi}鎵�灞炲寘鏄瘂singleUpi.PackageCode},璺熸壂鎻忕殑鍖呭彿{input.PackageCode}涓嶇");
+        }
+
+        var singlePackage = await _mesPackageGatherRep.AsQueryable().Where(x => x.PackageCode == input.PackageCode).FirstAsync();
+        if (singlePackage == null)
+        {
+            throw Oops.Oh($"娌℃湁鎵惧埌鍖呭彿{input.PackageCode}鐨勬眹鎬绘暟鎹�");
+        }
+        return singlePackage;
+    }
 }
 
diff --git a/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/WmsTask/WmsRbLineTask/Dto/ValidateLabelInput.cs b/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/WmsTask/WmsRbLineTask/Dto/ValidateLabelInput.cs
new file mode 100644
index 0000000..1bbdfb7
--- /dev/null
+++ b/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/WmsTask/WmsRbLineTask/Dto/ValidateLabelInput.cs
@@ -0,0 +1,25 @@
+锘縰sing Admin.NET.Core;
+using System.ComponentModel.DataAnnotations;
+
+namespace Admin.NET.Application;
+
+/// <summary>
+/// 鏍稿鏍囩杈撳叆鍙傛暟
+/// </summary>
+public class ValidateLabelInput
+{
+
+    /// <summary>
+    /// 鍖呰鍙�
+    /// </summary>
+    public virtual string PackageCode { get; set; }
+
+
+    /// <summary>
+    /// 閮ㄤ欢鏉$爜
+    /// </summary>
+    public virtual string Upi { get; set; }
+
+}
+
+

--
Gitblit v1.9.3