From 43b2af8956d54dc3a53f211c53d8af582806b6ba Mon Sep 17 00:00:00 2001
From: Rodney Chen <rodney.chen@hotmail.com>
Date: 星期二, 08 四月 2025 11:18:58 +0800
Subject: [PATCH] 备料任务合并发料只适用于包装车间工单发料 备料任务增加根据发料类型,调用相应发料单据的ERP接口

---
 Tiger.Business.WMS/Common/Preparation.cs |   37 ++++++++++++++++++++++++++++++++-----
 1 files changed, 32 insertions(+), 5 deletions(-)

diff --git a/Tiger.Business.WMS/Common/Preparation.cs b/Tiger.Business.WMS/Common/Preparation.cs
index cb21723..9862cc5 100644
--- a/Tiger.Business.WMS/Common/Preparation.cs
+++ b/Tiger.Business.WMS/Common/Preparation.cs
@@ -1,4 +1,5 @@
-锘縰sing Rhea.Common;
+锘縰sing MailKit.Search;
+using Rhea.Common;
 using SqlSugar;
 using System;
 using System.Collections.Generic;
@@ -72,6 +73,15 @@
 	                    };
 	                }
 	            }
+                //鍚堝苟鍙戞枡鍙�傜敤浜庡寘瑁呰溅闂村伐鍗曞彂鏂欙紝闆呰揪鍖呰杞﹂棿缂栫爜锛�1002310010030758
+                else if (Order.WS_CODE != "1002310010030758")
+                {
+                    action.IsSuccessed = false;
+                    //action.LocaleMsg = Biz.L("澶囨枡浠诲姟[{0}]涓嶆槸鍖呰杞﹂棿宸ュ崟鍙戞枡锛屾棤娉曞悎骞跺崟鎹彂鏂�");
+                    action.LocaleMsg = Biz.L("WMS.Out_BIZ_WMS_PREP.AddOrder.PrepNot1002310010030758", Order.ORDER_NO);
+                    return action;
+                }
+
 	            if (!src.IsNullOrEmpty() && src.ORDER_NO != Order.ORDER_NO)
 	            {
 	                action.IsSuccessed = false;
@@ -79,9 +89,9 @@
 	                action.LocaleMsg = Biz.L("WMS.Out_BIZ_WMS_PREP.AddOrder.NoFound", orderNo, src.ORDER_NO, Order.ORDER_NO);
 	                return action;
 	            }
-	
-	            // 鏌ヨ鍗曟嵁鏄庣粏锛屽苟鍚堝苟鍒板鏂欏崟鐨勫鏂欐槑缁嗕腑
-	            var dtls = bizType.GetPickList(orderNo);
+
+                // 鏌ヨ鍗曟嵁鏄庣粏锛屽苟鍚堝苟鍒板鏂欏崟鐨勫鏂欐槑缁嗕腑
+                var dtls = bizType.GetPickList(orderNo);
 	            if (dtls.Sum(q => q.QTY_ACT_REQ) <= 0)
 	            {
 	                action.IsSuccessed = false;
@@ -89,6 +99,23 @@
 	                action.LocaleMsg = Biz.L("WMS.Out_BIZ_WMS_PREP.AddOrder.NoNeedPrep", orderNo);
 	                return action;
 	            }
+                //鍚堝苟鍙戞枡鍙�傜敤浜庡寘瑁呰溅闂村伐鍗曞彂鏂�
+                if (src.IsNullOrEmpty() && Order.BIZ_TYPE == BIZ_WMS_PREP.BIZ_TYPEs.WorkOrder.GetValue())
+                {
+                    var wo = Biz.Db.Queryable<BIZ_MES_WO>().Where(q => q.ORDER_NO == orderNo).First();
+                    //闆呰揪鍖呰杞﹂棿缂栫爜锛�1002310010030758
+                    if (wo?.WS_CODE == "1002310010030758")
+                    {
+                        Order.WS_CODE = wo.WS_CODE;
+                    }
+                    else
+                    {
+                        action.IsSuccessed = false;
+                        //action.LocaleMsg = Biz.L("鍗曟嵁[{0}]涓嶆槸鍖呰杞﹂棿宸ュ崟锛屾棤娉曞悎骞跺崟鎹彂鏂�");
+                        action.LocaleMsg = Biz.L("WMS.Out_BIZ_WMS_PREP.AddOrder.WoNot1002310010030758", orderNo);
+                        return action;
+                    }
+                }
 
                 Order.SourceOrders = Order.SourceOrders ?? new();
                 Order.SourceDetails = Order.SourceDetails ?? new();
@@ -168,7 +195,7 @@
                 {
                     var o = db.Storageable(Order, UserCode).WhereColumns(t => new { t.ORDER_NO, t.GHOST_ROW }).ToStorage();
                     o.AsInsertable.ExecuteCommand();
-                    o.AsUpdateable.IgnoreColumns(q => q.ID).UpdateColumns(q => new { q.SOURCE_CODE, q.SOURCE_ORDER, q.UPDATE_TIME, q.UPDATE_USER }).ExecuteCommand();
+                    o.AsUpdateable.IgnoreColumns(q => q.ID).UpdateColumns(q => new { q.WS_CODE, q.SOURCE_CODE, q.SOURCE_ORDER, q.UPDATE_TIME, q.UPDATE_USER }).ExecuteCommand();
                     db.Storageable(Order.SourceOrders, UserCode).WhereColumns(t => new { t.ORDER_NO, t.SOURCE_ORDER, t.GHOST_ROW }).ToStorage().AsInsertable.ExecuteCommand();
                     db.Storageable(Order.SourceDetails, UserCode).WhereColumns(t => new { t.ORDER_NO, t.ITEM_CODE, t.GHOST_ROW }).ToStorage().AsInsertable.ExecuteCommand();
                     var d = db.Storageable(Order.Details, UserCode).WhereColumns(t => new { t.ORDER_NO, t.ITEM_CODE, t.GHOST_ROW }).ToStorage();

--
Gitblit v1.9.3