From c6342a8eb6d2c40e9a21deab63b5babb3def3025 Mon Sep 17 00:00:00 2001
From: Rodney Chen <rodney.chen@hotmail.com>
Date: 星期日, 13 四月 2025 17:14:50 +0800
Subject: [PATCH] 物料扩展表增加字段 上架需要按物料的默认储位进行限制,不允许上架到其他储位 没有默认储位则不限制,需要记录并调用接口反写到U9

---
 Tiger.Business.MES/iERP/U9C_MES.cs                       |    1 +
 Tiger.Api/Language.db                                    |    0 
 Tiger.Model.Net/Entitys/BAS/BAS_ITEM_EXT.cs              |    5 +++++
 Tiger.Business.WMS/Transaction/Yada/In_BIZ_U9_RECEIPT.cs |   18 +++++++++++++++++-
 Tiger.Business.WMS/Common/WmsTask.cs                     |   28 ++++++++++++++++++++++++++++
 5 files changed, 51 insertions(+), 1 deletions(-)

diff --git a/Tiger.Api/Language.db b/Tiger.Api/Language.db
index d00248d..dd343fe 100644
--- a/Tiger.Api/Language.db
+++ b/Tiger.Api/Language.db
Binary files differ
diff --git a/Tiger.Business.MES/iERP/U9C_MES.cs b/Tiger.Business.MES/iERP/U9C_MES.cs
index 21d54c8..5f517ad 100644
--- a/Tiger.Business.MES/iERP/U9C_MES.cs
+++ b/Tiger.Business.MES/iERP/U9C_MES.cs
@@ -81,6 +81,7 @@
                             Remark = (di["Remark"] ?? "").ToString(),
                             Packaging = (di["Packaging"] ?? "").ToString(),
                             SapCode = (di["Code1"] ?? "").ToString(),
+                            ReceiptMode = (di["ReceiptMode"] ?? "").ToInt32(),
                         };
                         itemExts.Add(extInfo);
                     }
diff --git a/Tiger.Business.WMS/Common/WmsTask.cs b/Tiger.Business.WMS/Common/WmsTask.cs
index 852a03c..ea0da0c 100644
--- a/Tiger.Business.WMS/Common/WmsTask.cs
+++ b/Tiger.Business.WMS/Common/WmsTask.cs
@@ -8,6 +8,7 @@
 using Tiger.IBusiness;
 using Tiger.Model;
 using Tiger.Model.Entitys.MES.Position;
+using Tiger.Model.Entitys.MES.U9C;
 using static IronPython.Modules._ast;
 
 namespace Tiger.Business.WMS.Transaction
@@ -793,6 +794,33 @@
             action.Data.MqttMsg = msg;
             return action;
         }
+
+        /// <summary>
+        /// 璁剧疆褰撳墠鐗╂枡鐨勯粯璁ゅ偍浣�
+        /// </summary>
+        public ApiAction<ScanOutput> SetDefaultLocation(DbClient db, BAS_ITEM Item, WMS_LOCATION location)
+        {
+            var action = new ApiAction<ScanOutput>(new ScanOutput());
+
+            //璋冪敤璁剧疆榛樿鍌ㄤ綅鎺ュ彛
+            //var iInput = new CreateRcvLineLocationInput
+            //{
+
+            //};
+            //var result = await DI.Resolve<IWMS_U9C>().CreateRcvLineLocation(iInput);
+            //if (!result.IsSuccessed)
+            //{
+            //    action.IsSuccessed = false;
+            //    action.LocaleMsg = result.LocaleMsg;
+            //}
+            //else
+            {
+                Item.DEFAULT_LOCATION = location.LOCATION_CODE;
+                db.Updateable(Item, UserCode).UpdateColumns(q => new { q.DEFAULT_LOCATION, q.UPDATE_TIME, q.UPDATE_USER }).ExecuteCommand();
+            }
+
+            return action;
+        }
         #endregion Functions
 
         /// <summary>
diff --git a/Tiger.Business.WMS/Transaction/Yada/In_BIZ_U9_RECEIPT.cs b/Tiger.Business.WMS/Transaction/Yada/In_BIZ_U9_RECEIPT.cs
index 12720db..a034d84 100644
--- a/Tiger.Business.WMS/Transaction/Yada/In_BIZ_U9_RECEIPT.cs
+++ b/Tiger.Business.WMS/Transaction/Yada/In_BIZ_U9_RECEIPT.cs
@@ -13,6 +13,7 @@
 using Tiger.Business.WMS.Sharetronic.Shelf;
 using Tiger.Model.Entitys.MES.U9C;
 using Tiger.Model.MES.Yada;
+using static IronPython.Modules._ast;
 
 namespace Tiger.Business.WMS.Transaction
 {
@@ -106,6 +107,14 @@
                         action.LocaleMsg = Biz.L("WMS.Default.ScanItem.ItemCodeNotExistsOrNotActive", inv.ItemInfo.ITEM_CODE.IsNullOrEmpty(inv.Barcode.ItemCode));
                         return SetOutPutMqttMsg(action, input.Locale);
                     }
+                    //榛樿鍌ㄤ綅楠岃瘉
+                    if (!inv.ItemInfo.DEFAULT_LOCATION.IsNullOrEmpty() && inv.ItemInfo.DEFAULT_LOCATION != CurScanShelf.LocationCode)
+                    {
+	                    action.IsSuccessed = false;
+	                    //action.LocaleMsg = Biz.L("鐗╂枡[{0}]鍙厑璁镐笂鏋跺埌鍌ㄤ綅[{0}]锛岃閲嶆柊鎵弿鍌ㄤ綅");
+	                    action.LocaleMsg = Biz.L("WMS.Default.ScanItem.DefaultLocationError", inv.ItemInfo.ITEM_CODE, inv.ItemInfo.DEFAULT_LOCATION);
+	                    return SetOutPutMqttMsg(action, input.Locale);
+                    }
                     CurInvItem = inv;
                 }
 
@@ -181,6 +190,7 @@
                         action.LocaleMsg = Biz.L($"WMS.Default.ScanShelf.ItemAlreadyExistsInLocation", nLocation.LOCATION_CODE, locationData.SN);
                         return SetOutPutMqttMsg(action, input.Locale);
                     }
+                    CurScanShelf.Location = nLocation;
                     CurScanShelf.LocationCode = nLocation.LOCATION_CODE;
                 }
                 else
@@ -304,7 +314,13 @@
                 });
 
                 //瀹屾垚鎵�鏈夊鐞嗗悗浣跨敤浜嬪姟淇濆瓨鏁版嵁
-                action = DoIfFinish(action, input.Locale);
+                action = DoIfFinish(action, input.Locale, () => {
+                    //璁剧疆褰撳墠鐗╂枡鐨勯粯璁ゅ偍浣�
+                    if (CurInvItem.ItemInfo.DEFAULT_LOCATION.IsNullOrEmpty())
+                    {
+                        SetDefaultLocation(MainDB, CurInvItem.ItemInfo, nLocation);
+                    }
+                });
             }
             catch (Exception ex)
             {
diff --git a/Tiger.Model.Net/Entitys/BAS/BAS_ITEM_EXT.cs b/Tiger.Model.Net/Entitys/BAS/BAS_ITEM_EXT.cs
index 02f30a9..b3e2a6f 100644
--- a/Tiger.Model.Net/Entitys/BAS/BAS_ITEM_EXT.cs
+++ b/Tiger.Model.Net/Entitys/BAS/BAS_ITEM_EXT.cs
@@ -78,6 +78,11 @@
         /// </summary>
         [DisplayName("SAP鏂欏彿")]
         public string SapCode { get; set; }
+        /// <summary>
+		/// 鎵撳嵃妯″紡
+		/// </summary>
+		[DisplayName("鎵撳嵃妯″紡")]
+        public int ReceiptMode { get; set; }
         #endregion
 
         #region 铏氭嫙灞炴��

--
Gitblit v1.9.3