From 52d1e37bb116c995b601728bfe81e3816c3944c9 Mon Sep 17 00:00:00 2001
From: 南骏 池 <chiffly@163.com>
Date: 星期五, 27 六月 2025 08:22:33 +0800
Subject: [PATCH] 1.携客云到货单主表新增单据类型字段 2.条码入库前拆分

---
 service/base/MesPrintMangeer.cs |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/service/base/MesPrintMangeer.cs b/service/base/MesPrintMangeer.cs
index dc68505..264514d 100644
--- a/service/base/MesPrintMangeer.cs
+++ b/service/base/MesPrintMangeer.cs
@@ -75,6 +75,39 @@
         //     public List<dynamic> oldBarInfo { get; set; }
         // }
 
+        public dynamic getCfBeforeInfo(dynamic query) // 浣跨敤鍏蜂綋绫诲瀷鏇夸唬dynamic
+        {
+            // 鍙傛暟鏍¢獙
+            if (string.IsNullOrEmpty(query?.cfBarcode))
+                throw new ArgumentException("鎷嗗垎鏉$爜涓嶈兘涓虹┖");
+            if (string.IsNullOrEmpty(query?.barcode))
+                throw new ArgumentException("鍘熷鏉$爜涓嶈兘涓虹┖");
+
+            // 浣跨敤寮虹被鍨嬪弬鏁�
+            var sqlParams = new List<SugarParameter> {
+                new("@cfBar", query.cfBarcode.Trim()),
+                new("@oldBar", query.barcode.Trim())
+            };
+
+            var sql = @"SELECT TOP 1 C.ITEM_NO,C.item_name,C.item_model,B.OLDQTY as QUANTITY,B.CREATE_DATE, '鎷嗗垎鏉$爜' AS BarType,B.ITEM_BARCODE,GETDATE() as print_date
+            FROM MES_INV_ITEM_BARCODES B
+            LEFT JOIN MES_ITEMS C ON C.item_id = B.ITEM_ID
+            WHERE B.ITEM_BARCODE = @cfBar
+
+            UNION ALL
+
+            SELECT TOP 1 C.ITEM_NO,C.item_name,C.item_model,B.QUANTITY as QUANTITY,B.CREATE_DATE, '鍘熷鏉$爜' AS BarType,B.ITEM_BARCODE,GETDATE() as print_date
+            FROM  MES_INV_ITEM_BARCODES B
+            LEFT JOIN MES_ITEMS C ON C.item_id = B.ITEM_ID
+            WHERE B.ITEM_BARCODE = @oldBar";
+
+            var mergedData = Db.Ado.SqlQuery<dynamic>(sql, sqlParams);
+
+            if (mergedData.Count < 2) throw new Exception("鏉$爜淇℃伅瀛樺湪寮傚父锛岃鑱旂郴绠$悊鍛橈紒");
+
+            return mergedData;
+        }
+
 
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3