From 5ebca0d5d35a8d29ffabc1cc78080a393ce92368 Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周四, 28 11月 2024 11:23:51 +0800
Subject: [PATCH] 判断齐套

---
 LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/WmsTask/WmsRbLineTask/Dto/ValidateQiTaoOutput.cs |   20 ++++++++++
 LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/WmsTask/WmsRbLineTask/Dto/ValidateQiTaoInput.cs  |   19 +++++++++
 LA24030_LuLiPackageLine_Wms/Admin.NET.Core/Const/CommonConst.cs                                            |    4 +-
 LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/WmsTask/WmsOperationTaskService.cs               |   56 +++++++++++++++++++++++++++
 4 files changed, 96 insertions(+), 3 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 10276d2..c884e1d 100644
--- a/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/WmsTask/WmsOperationTaskService.cs
+++ b/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/WmsTask/WmsOperationTaskService.cs
@@ -4,6 +4,9 @@
 using System.Data;
 using System.Web;
 using System.Text;
+using DocumentFormat.OpenXml.Office.CustomUI;
+using Microsoft.CodeAnalysis.Operations;
+
 namespace Admin.NET.Application;
 /// <summary>
 /// 鎿嶄綔浠诲姟鏈嶅姟
@@ -13,8 +16,15 @@
 {
     private readonly SqlSugarRepository<WmsRbLineTask> _rep;
     private readonly SqlSugarRepository<WmsStockQuan> _wmsStockQuanRep;
-    public WmsOperationTaskService(SqlSugarRepository<WmsRbLineTask> rep, SqlSugarRepository<WmsStockQuan> wmsStockQuanRep)
+    private readonly SqlSugarRepository<Mes_Package_Gather> _mesPackageGatherRep;
+    private readonly SqlSugarRepository<SysConfig> _sysConfigRep;
+    public WmsOperationTaskService(SqlSugarRepository<WmsRbLineTask> rep, SqlSugarRepository<WmsStockQuan> wmsStockQuanRep
+        , SqlSugarRepository<Mes_Package_Gather> mesPackageGatherRep
+        , SqlSugarRepository<SysConfig> sysConfigRep
+        )
     {
+        _sysConfigRep = sysConfigRep;
+        _mesPackageGatherRep = mesPackageGatherRep;
         _rep = rep;
         _wmsStockQuanRep = wmsStockQuanRep;
     }
@@ -59,6 +69,50 @@
 
     }
 
+    /// <summary>
+    /// 鍒ゆ柇榻愬
+    /// </summary>
+    /// <param name="input"></param>
+    /// <returns></returns>
+    [HttpPost]
+    [ApiDescriptionSettings(Name = "ValdateQiTao")]
+    [Description("WmsOperationTask/ValdateQiTao")]
+    public async Task<ValidateQiTaoOutput> ValdateQiTao(ValidateQiTaoInput input)
+    {
+        ValidateQiTaoOutput output = new ValidateQiTaoOutput();
+        if (input == null || input.PackageCode == null)
+        {
+            throw Oops.Oh("鍙傛暟涓嶈兘涓虹┖");
+        }
+        var singlePackage = await _mesPackageGatherRep.AsQueryable().Where(x => x.PackageCode == input.PackageCode).FirstAsync();
+        if (singlePackage == null)
+        {
+            throw Oops.Oh($"娌℃湁鎵惧埌鍖呭彿{input.PackageCode}鐨勬眹鎬绘暟鎹�");
+        }
 
+        var setValue = "";
+        var _QiTaoReuslt = "";
+        var other_orderList = await _mesPackageGatherRep.AsQueryable().Where(x => x.Info5 == singlePackage.Info5 && x.PackageCode != input.PackageCode).ToListAsync();
+        var num = other_orderList.Where(x => x.UpiStatus == UpiStatusEnum.鍒濆 || x.UpiStatus == UpiStatusEnum.涓嶉綈鍖�).Count();
+        if (num > 0)
+        {
+            //涓嶉綈濂�
+            setValue = $"{input.PackageCode}|涓嶉綈濂�";
+            _QiTaoReuslt = "涓嶉綈濂�";
+        }
+        else
+        {
+            setValue = $"{input.PackageCode}|榻愬";
+            _QiTaoReuslt = "榻愬";
+        }
+
+        var sysConfig = await _sysConfigRep.GetFirstAsync(x => x.Code == CommonConst.WmsBZ30_QiTao);
+        sysConfig.Value = setValue;
+        await _sysConfigRep.UpdateAsync(sysConfig);
+
+        output = singlePackage.Adapt<ValidateQiTaoOutput>();
+        output.QiTaoReuslt = _QiTaoReuslt;
+        return output;
+    }
 }
 
diff --git a/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/WmsTask/WmsRbLineTask/Dto/ValidateQiTaoInput.cs b/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/WmsTask/WmsRbLineTask/Dto/ValidateQiTaoInput.cs
new file mode 100644
index 0000000..4372021
--- /dev/null
+++ b/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/WmsTask/WmsRbLineTask/Dto/ValidateQiTaoInput.cs
@@ -0,0 +1,19 @@
+锘縰sing Admin.NET.Core;
+using System.ComponentModel.DataAnnotations;
+
+namespace Admin.NET.Application;
+
+/// <summary>
+/// 鍒ゆ柇榻愬杈撳叆鍙傛暟
+/// </summary>
+public class ValidateQiTaoInput
+{
+
+    /// <summary>
+    /// 鍖呰鍙�
+    /// </summary>
+    public virtual string PackageCode { get; set; }
+
+}
+
+
diff --git a/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/WmsTask/WmsRbLineTask/Dto/ValidateQiTaoOutput.cs b/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/WmsTask/WmsRbLineTask/Dto/ValidateQiTaoOutput.cs
new file mode 100644
index 0000000..44d86d6
--- /dev/null
+++ b/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/WmsTask/WmsRbLineTask/Dto/ValidateQiTaoOutput.cs
@@ -0,0 +1,20 @@
+锘縰sing Admin.NET.Application.Entity;
+using Admin.NET.Core;
+using System.ComponentModel.DataAnnotations;
+
+namespace Admin.NET.Application;
+
+/// <summary>
+/// 鍒ゆ柇榻愬杈撳嚭鍙傛暟
+/// </summary>
+public class ValidateQiTaoOutput: Mes_Package_Gather
+{
+
+    /// <summary>
+    /// 榻愬缁撴灉
+    /// </summary>
+    public virtual string QiTaoReuslt { get; set; }
+
+}
+
+
diff --git a/LA24030_LuLiPackageLine_Wms/Admin.NET.Core/Const/CommonConst.cs b/LA24030_LuLiPackageLine_Wms/Admin.NET.Core/Const/CommonConst.cs
index a01457c..0a22a6b 100644
--- a/LA24030_LuLiPackageLine_Wms/Admin.NET.Core/Const/CommonConst.cs
+++ b/LA24030_LuLiPackageLine_Wms/Admin.NET.Core/Const/CommonConst.cs
@@ -99,9 +99,9 @@
     public const string SysAddQCOrder = "sys_add_qc_order";
 
     /// <summary>
-    /// ASN鍗曞垱寤虹敓鎴愯窡韪爜绫诲瀷	:涓�缁寸爜銆佷簩缁寸爜
+    /// BZ30涓嬬嚎鐐归綈濂楀垽鏂� 銆怑ditby shaocx,2024-11-28銆�
     /// </summary>
-    public const string SysCreateSnCodeType = "sys_create_sncode_type";
+    public const string WmsBZ30_QiTao = "wms_bz30_qitao";
 
 
     /// <summary>

--
Gitblit v1.9.3