From b3cbeec348e826813c176340f1b0010bb2ece2cd Mon Sep 17 00:00:00 2001
From: cnf <3200815559@qq.com>
Date: 星期三, 12 二月 2025 16:13:55 +0800
Subject: [PATCH] 新增销售订单保存接口,销售退货通知单保存接口,销售发货通知单保存接口

---
 MESApplication/bin/Debug/net8.0/MESApplication.pdb |    0 
 MES.Service/service/BasicData/MesRohInManager.cs   |   44 -----------
 MESApplication/bin/Debug/net8.0/MESApplication.exe |    0 
 MES.Service/Dto/webApi/PLM/RelatedObject.cs        |   17 ++++
 MESApplication/bin/Debug/net8.0/MES.Service.pdb    |    0 
 MESApplication/bin/Debug/net8.0/MESApplication.dll |    0 
 MES.Service/Dto/webApi/PLM/StdDocument.cs          |   23 +++++
 MES.Service/bin/Debug/net8.0/MES.Service.dll       |    0 
 MES.Service/service/WomcaaManager.cs               |    4 
 MESApplication/bin/Debug/net8.0/MES.Service.dll    |    0 
 MES.Service/bin/Debug/net8.0/MES.Service.pdb       |    0 
 MES.Service/service/PLM/PLMManager.cs              |  115 ++++++++++++++++++++++++++++
 12 files changed, 153 insertions(+), 50 deletions(-)

diff --git a/MES.Service/Dto/webApi/PLM/RelatedObject.cs b/MES.Service/Dto/webApi/PLM/RelatedObject.cs
new file mode 100644
index 0000000..cdee91e
--- /dev/null
+++ b/MES.Service/Dto/webApi/PLM/RelatedObject.cs
@@ -0,0 +1,17 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MES.Service.Dto.webApi.PLM;
+
+public class RelatedObject
+{
+    //瀹炰綋涓婚敭
+    public long? FID { get; set; }
+    //鐗╂枡缂栫爜
+    public string? FRE_FCode { get; set; }
+    //鐩稿叧瀵硅薄
+    public long? FRelatedObject { get; set; }
+}
diff --git a/MES.Service/Dto/webApi/PLM/StdDocument.cs b/MES.Service/Dto/webApi/PLM/StdDocument.cs
new file mode 100644
index 0000000..151a151
--- /dev/null
+++ b/MES.Service/Dto/webApi/PLM/StdDocument.cs
@@ -0,0 +1,23 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MES.Service.Dto.webApi.PLM;
+
+public class StdDocument
+{
+    //瀹炰綋涓婚敭
+    public long? FID { get; set; }
+    //缂栫爜
+    public string? FCode { get; set; }
+    //鍚嶇О
+    public string? FName { get; set; }
+    //鐗╃悊鏂囦欢鍚�
+    public string? FPhysicalFileName { get; set; }
+    //鐗╃悊鏂囦欢
+    public string? FFileId { get; set; }
+    //鍏宠仈瀵硅薄 杞殑 pdf
+    public string? FRelevantObject { get; set; }
+}
diff --git a/MES.Service/bin/Debug/net8.0/MES.Service.dll b/MES.Service/bin/Debug/net8.0/MES.Service.dll
index 0a2ca83..298ad08 100644
--- a/MES.Service/bin/Debug/net8.0/MES.Service.dll
+++ b/MES.Service/bin/Debug/net8.0/MES.Service.dll
Binary files differ
diff --git a/MES.Service/bin/Debug/net8.0/MES.Service.pdb b/MES.Service/bin/Debug/net8.0/MES.Service.pdb
index 546e71f..1bf036c 100644
--- a/MES.Service/bin/Debug/net8.0/MES.Service.pdb
+++ b/MES.Service/bin/Debug/net8.0/MES.Service.pdb
Binary files differ
diff --git a/MES.Service/service/BasicData/MesRohInManager.cs b/MES.Service/service/BasicData/MesRohInManager.cs
index 9589ed2..640ff4c 100644
--- a/MES.Service/service/BasicData/MesRohInManager.cs
+++ b/MES.Service/service/BasicData/MesRohInManager.cs
@@ -37,50 +37,6 @@
         }) > 0;
     }
 
-    // 鎻掑叆鏁版嵁鐨勬柟娉�
-    private bool InsertData(SqlSugarScope db, MesRohIn mesRohIn,
-        List<MesRohInData> mesRohInDatas, string FBILLTYPE)
-    {
-        switch (FBILLTYPE)
-        {
-            case "A":
-            {
-                var decimals = mesRohInDatas.Select(s => s.Id).ToArray();
-
-                if (mesRohIn.Id != null) base.DeleteById(mesRohIn.Id);
-
-                if (decimals.Length > 0)
-                    db.Deleteable<MesRohInData>().In(decimals).ExecuteCommand();
-
-                var insert = base.Insert(mesRohIn);
-                var insertRange =
-                    rohInDataManager.InsertRange(mesRohInDatas);
-
-                if (insert && insertRange) return true;
-                throw new NotImplementedException("鎻掑叆澶辫触");
-            }
-            case "B":
-            {
-                var decimals = mesRohInDatas.Select(s => s.Id).ToArray();
-                if (base.DeleteById(mesRohIn.Id) && db
-                        .Deleteable<MesRohInData>().In(decimals)
-                        .ExecuteCommand() > 0)
-                {
-                    var insert = base.Insert(mesRohIn);
-                    var insertRange =
-                        rohInDataManager.InsertRange(mesRohInDatas);
-
-                    if (insert && insertRange) return true;
-                    throw new NotImplementedException("鎻掑叆澶辫触");
-                }
-
-                break;
-            }
-        }
-
-        throw new NotImplementedException("閲囪喘璁㈠崟绫诲瀷閿欒");
-    }
-
     // 鏇存柊鏁版嵁鐨勬柟娉�
     private bool UpdateData(SqlSugarScope db, MesRohIn mesRohIn,
         List<MesRohInData> mesRohInDatas)
diff --git a/MES.Service/service/PLM/PLMManager.cs b/MES.Service/service/PLM/PLMManager.cs
index 315c03b..eb82984 100644
--- a/MES.Service/service/PLM/PLMManager.cs
+++ b/MES.Service/service/PLM/PLMManager.cs
@@ -7,9 +7,19 @@
 
 public class PLMManager
 {
-    public List<BaseObject> RetrieveDrawings(string ItemNo)
+    public List<StdDocument> RetrieveDrawings(string ItemNo)
     {
-        return GetPlmCfgBase(ItemNo);
+        List<BaseObject> baseObjects = GetPlmCfgBase(ItemNo);
+
+        List<RelatedObject> relatedObjects = GetPlmCfgRelatedObject(baseObjects[0].FID);
+
+        // 妫�鏌ヨ繑鍥炵粨鏋滄槸鍚︿负绌�
+        if (relatedObjects == null || !relatedObjects.Any())
+        {
+            throw new NotImplementedException("杩斿洖缁撴灉涓虹┖");
+        }
+        List<StdDocument> stdDocuments = GetPlmStdDocument(relatedObjects);
+        return stdDocuments;
     }
 
 
@@ -29,7 +39,7 @@
         //string fieldKeys = "FCode,FFileId,FRelevantObject";
         //string FilterString = "FID='-2146304'";
         string fieldKeys = "FID,FCode,FName";
-        string FilterString = "FCode='5.03.14.1414'";
+        string FilterString = string.Format(@"FCode='{0}'", ItemNo);
         string OrderString = "";
         int TopRowCount = 0;
         int StartRow = 0;
@@ -59,4 +69,103 @@
             return entity;
         }).ToList();
     }
+
+    public List<RelatedObject> GetPlmCfgRelatedObject(long? FRelatedObject)
+    {
+        //娉ㄦ剰 1锛氭澶勪笉鍐嶄娇鐢ㄥ弬鏁板舰寮忎紶鍏ョ敤鎴峰悕鍙婂瘑鐮佺瓑鏁忔劅淇℃伅锛屾敼涓哄湪鐧诲綍閰嶇疆鏂囦欢涓缃��
+        //娉ㄦ剰 2锛氬繀椤诲厛閰嶇疆绗笁鏂圭郴缁熺櫥褰曟巿鏉冧俊鎭悗锛屽啀杩涜涓氬姟鎿嶄綔锛岃鎯呭弬鑰冨悇璇█鐗堟湰SDK浠嬬粛涓殑鐧诲綍閰嶇疆鏂囦欢璇存槑銆�
+        //璇诲彇閰嶇疆锛屽垵濮嬪寲SDK
+        K3CloudApi client = new K3CloudApi();
+        //鐢ㄤ簬璁板綍缁撴灉
+        StringBuilder Info = new StringBuilder();
+        //涓氬姟瀵硅薄鏍囪瘑
+        //string formId = "PLM_STD_DOCUMENT";
+        string formId = "PLM_CFG_RELATEDOBJECT";
+        DateTime dt = DateTime.Now;
+        //鏌ヨ瀛楁闆嗗悎锛屽嵆杩斿洖鍝簺鏁版嵁锛屼笉鑳戒负绌猴紝鏍规嵁涓嶅悓涓氬姟鍗曟嵁濉啓涓嶅悓鐨勫瓧娈靛悕锛屼互涓嬩粎涓虹ず渚�
+        //string fieldKeys = "FCode,FFileId,FRelevantObject";
+        //string FilterString = "FID='-2146304'";
+        string fieldKeys = "FID,FRE_FCode,FRelatedObject";
+        string FilterString = string.Format(@"FRelatedObject='{0}'", FRelatedObject);
+        string OrderString = "";
+        int TopRowCount = 0;
+        int StartRow = 0;
+        int Limit = 0;
+
+        var param = new QueryParam()
+        {
+            FormId = formId,
+            FieldKeys = fieldKeys,
+            FilterString = FilterString,
+            OrderString = OrderString,
+            TopRowCount = TopRowCount,
+            StartRow = StartRow,
+            Limit = Limit
+        };
+        //璋冪敤鎺ュ彛
+        var result = client.ExecuteBillQuery(param.ToJson());
+
+        return result.Select(s =>
+        {
+            var entity = new RelatedObject
+            {
+                FID = (long)s[0],
+                FRE_FCode = (string)s[1],
+                FRelatedObject = (long)s[2],
+            };
+            return entity;
+        }).ToList();
+    }
+
+    public List<StdDocument> GetPlmStdDocument(List<RelatedObject> relatedObjects)
+    {
+        //娉ㄦ剰 1锛氭澶勪笉鍐嶄娇鐢ㄥ弬鏁板舰寮忎紶鍏ョ敤鎴峰悕鍙婂瘑鐮佺瓑鏁忔劅淇℃伅锛屾敼涓哄湪鐧诲綍閰嶇疆鏂囦欢涓缃��
+        //娉ㄦ剰 2锛氬繀椤诲厛閰嶇疆绗笁鏂圭郴缁熺櫥褰曟巿鏉冧俊鎭悗锛屽啀杩涜涓氬姟鎿嶄綔锛岃鎯呭弬鑰冨悇璇█鐗堟湰SDK浠嬬粛涓殑鐧诲綍閰嶇疆鏂囦欢璇存槑銆�
+        //璇诲彇閰嶇疆锛屽垵濮嬪寲SDK
+        K3CloudApi client = new K3CloudApi();
+        //鐢ㄤ簬璁板綍缁撴灉
+        StringBuilder Info = new StringBuilder();
+        //涓氬姟瀵硅薄鏍囪瘑
+        string formId = "PLM_STD_DOCUMENT";
+        DateTime dt = DateTime.Now;
+        //鏌ヨ瀛楁闆嗗悎锛屽嵆杩斿洖鍝簺鏁版嵁锛屼笉鑳戒负绌猴紝鏍规嵁涓嶅悓涓氬姟鍗曟嵁濉啓涓嶅悓鐨勫瓧娈靛悕锛屼互涓嬩粎涓虹ず渚�
+        string fieldKeys = "FID,FCode,FName,FPhysicalFileName,FFileId,FRelevantObject";
+        // 鎻愬彇 FID 鍊�
+        var fidList = relatedObjects.Select(obj => obj.FID.ToString()).ToList();
+        // 灏� FID 鍊肩敤閫楀彿鍒嗛殧锛屽苟鍖呰9鍦ㄥ崟寮曞彿涓�
+        string fids = string.Join(",", fidList.Select(fid => $"'{fid}'"));
+        // 鏋勫缓 FilterString
+        string FilterString = $"FID in ({fids})";
+        string OrderString = "";
+        int TopRowCount = 0;
+        int StartRow = 0;
+        int Limit = 0;
+
+        var param = new QueryParam()
+        {
+            FormId = formId,
+            FieldKeys = fieldKeys,
+            FilterString = FilterString,
+            OrderString = OrderString,
+            TopRowCount = TopRowCount,
+            StartRow = StartRow,
+            Limit = Limit
+        };
+        //璋冪敤鎺ュ彛
+        var result = client.ExecuteBillQuery(param.ToJson());
+
+        return result.Select(s =>
+        {
+            var entity = new StdDocument
+            {
+                FID = (long)s[0],
+                FCode = (string)s[1],
+                FName = (string)s[2],
+                FPhysicalFileName = (string)s[3],
+                FFileId = (string)s[4],
+                FRelevantObject = (string)s[5],
+            };
+            return entity;
+        }).ToList();
+    }
 }
diff --git a/MES.Service/service/WomcaaManager.cs b/MES.Service/service/WomcaaManager.cs
index 121bb55..27a1cbe 100644
--- a/MES.Service/service/WomcaaManager.cs
+++ b/MES.Service/service/WomcaaManager.cs
@@ -1,9 +1,7 @@
-锘縰sing Dm;
-using MES.Service.DB;
+锘縰sing MES.Service.DB;
 using MES.Service.Dto.webApi;
 using MES.Service.Modes;
 using SqlSugar;
-using System.Net.NetworkInformation;
 
 namespace MES.Service.service;
 
diff --git a/MESApplication/bin/Debug/net8.0/MES.Service.dll b/MESApplication/bin/Debug/net8.0/MES.Service.dll
index 0a2ca83..298ad08 100644
--- a/MESApplication/bin/Debug/net8.0/MES.Service.dll
+++ b/MESApplication/bin/Debug/net8.0/MES.Service.dll
Binary files differ
diff --git a/MESApplication/bin/Debug/net8.0/MES.Service.pdb b/MESApplication/bin/Debug/net8.0/MES.Service.pdb
index 546e71f..1bf036c 100644
--- a/MESApplication/bin/Debug/net8.0/MES.Service.pdb
+++ b/MESApplication/bin/Debug/net8.0/MES.Service.pdb
Binary files differ
diff --git a/MESApplication/bin/Debug/net8.0/MESApplication.dll b/MESApplication/bin/Debug/net8.0/MESApplication.dll
index 348ee2c..d90536b 100644
--- a/MESApplication/bin/Debug/net8.0/MESApplication.dll
+++ b/MESApplication/bin/Debug/net8.0/MESApplication.dll
Binary files differ
diff --git a/MESApplication/bin/Debug/net8.0/MESApplication.exe b/MESApplication/bin/Debug/net8.0/MESApplication.exe
index 228ec58..0f9911f 100644
--- a/MESApplication/bin/Debug/net8.0/MESApplication.exe
+++ b/MESApplication/bin/Debug/net8.0/MESApplication.exe
Binary files differ
diff --git a/MESApplication/bin/Debug/net8.0/MESApplication.pdb b/MESApplication/bin/Debug/net8.0/MESApplication.pdb
index d3b4a9a..743ccdd 100644
--- a/MESApplication/bin/Debug/net8.0/MESApplication.pdb
+++ b/MESApplication/bin/Debug/net8.0/MESApplication.pdb
Binary files differ

--
Gitblit v1.9.3