From 53d6a24cb335b0c9b4449e1211ce8ea644d68d67 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期五, 31 五月 2024 20:48:53 +0800
Subject: [PATCH] 可根据图号更改下料口车轮数量入库条件

---
 代码管理/PCS/WCS_Server/WIDESEA_WCS/ToMES/ToMesServer.cs |   42 +++++++++++++++++++++++++++++++++---------
 1 files changed, 33 insertions(+), 9 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/ToMES/ToMesServer.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/ToMES/ToMesServer.cs"
index 5f48525..81c8f3a 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/ToMES/ToMesServer.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/ToMES/ToMesServer.cs"
@@ -1,14 +1,19 @@
 锘縰sing Newtonsoft.Json;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
 using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Runtime.InteropServices;
 using System.Text;
 using System.Threading.Tasks;
+using WIDESEA_Comm.LogInfo;
 using WIDESEA_Common;
 using WIDESEA_Core.FreeDB;
 using WIDESEA_Core.Utilities;
 using WIDESEA_Entity.DomainModels;
+using WIDESEA_Entity.ToAGV;
 using static FreeSql.Internal.GlobalFilter;
 
 namespace WIDESEA_WCS
@@ -46,23 +51,26 @@
         {
             WebResponseContent content = new WebResponseContent();
             FreeDB freeDB = new FreeDB();
+            dt_mes_head mes_Head = null;
             try
             {
                 Mes_WorkInfo workInfo = JsonConvert.DeserializeObject<Mes_WorkInfo>(json.ToString());
 
                 if (workInfo == null)
                 {
-                    return content.Error("宸ュ崟淇℃伅鏁版嵁涓虹┖");
+                    //return content.Error("宸ュ崟淇℃伅鏁版嵁涓虹┖");
+                    throw new Exception("宸ュ崟淇℃伅鏁版嵁涓虹┖");
                 }
 
                 var mesinfo = freeDB.Select<dt_mes_head>().Where(x => x.jobID == workInfo.jobID).First();
                 if (mesinfo != null)
                 {
-                    return content.Error($"宸ュ崟鍙穥mesinfo.jobID}宸插瓨鍦�,璇锋牳瀹炲悗閲嶆柊鍙戦�侊紒");
+                    //return content.Error($"宸ュ崟缂栧彿{mesinfo.jobID}宸插瓨鍦�,璇锋牳瀹炲悗閲嶆柊鍙戦�侊紒");
+                    throw new Exception($"宸ュ崟缂栧彿{mesinfo.jobID}宸插瓨鍦�,璇锋牳瀹炲悗閲嶆柊鍙戦�侊紒");
                 }
 
                 Guid head = Guid.NewGuid();
-                dt_mes_head mes_Head = new dt_mes_head
+                mes_Head = new dt_mes_head
                 {
                     mes_id = head,
                     CreateTime = DateTime.Now,
@@ -79,14 +87,15 @@
                     quantity = workInfo.quantity,
                     reqID = workInfo.reqID,
                     reqIDLineNo = workInfo.reqIDLineNo,
-                    stackNoRange = workInfo.stackNoRange,
+                    stackNoRange = 5,
+                    //stackNoRange = workInfo.stackNoRange,
                     typeID = workInfo.typeID,
                     workOrder = workInfo.workOrder,
                     processCode = workInfo.processCode,
                     finishNum = 0,
-                    //skip_op_1 = false,
-                    //skip_op_2 = false,
-                    //skip_op_3 = false,
+                    skip_op_1 = false,
+                    skip_op_2 = false,
+                    skip_op_3 = false,
                 };
                 freeDB.Add(mes_Head);
 
@@ -104,12 +113,27 @@
                     };
                     freeDB.Add(mes_Detail);
                 }
-                return content.OK();
+
+                #region 鏌ヨ褰撳墠宸ュ崟鐨勫浘鍙蜂俊鎭槸鍚﹀瓨鍦�
+                var dt_Geometry_Data = Pipeline.QueryMateriel(workInfo.drawingNo);
+                //var dt_Geometry_Data1 = Pipeline.QueryMateriel1(workInfo.drawingNo);
+                if (dt_Geometry_Data == null /*&& dt_Geometry_Data1 == null*/)
+                {
+                    throw new Exception($"鏈壘鍒板浘鍙凤細{workInfo.drawingNo}鐨勮溅杞俊鎭紒宸ュ崟缂栧彿锛歿workInfo.jobID}");
+                }
+                #endregion
+                //WriteWMSLog.LogAdd(requestTask.TASK_NO, "鎴愬姛 ", "AGV", "WMS", postJson, report, "涓嬪彂AGV浠诲姟", "SendAGVTask", respone.Msg);
+                //return content.OK();
+                content.OK();
             }
             catch (Exception ex)
             {
-                return content.Error(ex.Message);
+                //return content.Error(ex.Message);
+                content.Error(ex.Message);
             }
+
+            WritePCSLog.LogAdd("", content.Status ? "鎴愬姛 " : "澶辫触", "PCS", "MES", JsonConvert.SerializeObject(mes_Head), JsonConvert.SerializeObject(content), $"MES涓嬪彂宸ュ崟", "AddMes_Info", content.Message);
+            return content;
         }
     }
 }

--
Gitblit v1.9.3