From 0caa59dda5ede8b93c4fd47f095bbf716f57383b Mon Sep 17 00:00:00 2001
From: wxw <Administrator@DESKTOP-5BIMHQ3>
Date: 星期四, 13 十一月 2025 11:03:19 +0800
Subject: [PATCH] 开发LIMS质量结果下发接口

---
 Wms/Wms/Controllers/DownApiController.cs |   63 +++++++++++++++++++++++++------
 1 files changed, 51 insertions(+), 12 deletions(-)

diff --git a/Wms/Wms/Controllers/DownApiController.cs b/Wms/Wms/Controllers/DownApiController.cs
index 42bd8ac..bafc2ce 100644
--- a/Wms/Wms/Controllers/DownApiController.cs
+++ b/Wms/Wms/Controllers/DownApiController.cs
@@ -21,6 +21,7 @@
 using Microsoft.Extensions.Logging;
 using ZXing.QrCode.Internal;
 using Model.ModelVm.BllCheckVm;
+using System.DirectoryServices.Protocols;
 
 namespace Wms.Controllers
 {
@@ -683,7 +684,7 @@
                 }
                 string taskNo = "";
                 //鍏蜂綋澶勭悊鏂规硶
-                _rcsserver.GetPalletNo(pallmsg, _config.AgvHost + _config.GenAgvSchedulingTask, out taskNo);
+                _rcsserver.GetPalletNo(pallmsg, _config.AgvHost + _config.GenAgvSchedulingTask, _config.MesHost + _config.MesPanClearPallet, out taskNo);
 
                 resultModel = new AgvResultModel { code = "0", message = "鍙《鎴愬姛!", data = taskNo, reqCode = "" };
                 var jsonData2 = JsonConvert.SerializeObject(resultModel);
@@ -730,13 +731,13 @@
                     LogFile.SaveLogToFile($"AGV鐢宠鍌ㄤ綅-杩斿洖鎶ユ枃锛�( {jsonData3} ),", logStr);
                     return Ok(resultModel);
                 }
-                if (string.IsNullOrWhiteSpace(pallmsg.PalletNo))
-                {
-                    resultModel = new AgvResultModel { code = "1", message = "鐢宠妗跺彿涓虹┖!", data = "", reqCode = "" };
-                    var jsonData3 = JsonConvert.SerializeObject(resultModel);
-                    LogFile.SaveLogToFile($"AGV鐢宠鍌ㄤ綅-杩斿洖鎶ユ枃锛�( {jsonData3} ),", logStr);
-                    return Ok(resultModel);
-                }
+                //if (string.IsNullOrWhiteSpace(pallmsg.PalletNo))
+                //{
+                //    resultModel = new AgvResultModel { code = "1", message = "鐢宠妗跺彿涓虹┖!", data = "", reqCode = "" };
+                //    var jsonData3 = JsonConvert.SerializeObject(resultModel);
+                //    LogFile.SaveLogToFile($"AGV鐢宠鍌ㄤ綅-杩斿洖鎶ユ枃锛�( {jsonData3} ),", logStr);
+                //    return Ok(resultModel);
+                //}
                 string taskNo = "";
                 //鍏蜂綋澶勭悊鏂规硶
                 _rcsserver.ApplyLocatNo(pallmsg, _config.AgvHost + _config.GenAgvSchedulingTask, out taskNo);
@@ -757,16 +758,20 @@
             }
         }
         /// <summary>
-        /// 灏嗗噣妗舵敼涓鸿剰妗跺苟鎷夊埌鑴忔《鍖�
+        /// MES灏嗗噣妗舵敼涓鸿剰妗跺苟鎷夊埌鑴忔《鍖�
         /// </summary>
         /// <param name="pallmsg"></param>
         /// <returns></returns>
         [HttpPost]
         public IActionResult ChangePalletStatus(Pallnetmsg pallmsg)
         {
+            var logStr = $@".\log\MES\MES灏嗗噣妗舵敼涓鸿剰妗跺苟鎷夊埌鑴忔《鍖�" + DateTime.Now.ToString("yyyyMMdd") + ".txt";
             var result = new ErpModel { Success = -1, Message = "", };
             try
             {
+                var jsonData = JsonConvert.SerializeObject(pallmsg);
+                LogFile.SaveLogToFile($"MES灏嗗噣妗舵敼涓鸿剰妗跺苟鎷夊埌鑴忔《鍖�-璇锋眰鎶ユ枃锛�( {jsonData} ),", logStr);
+
                 if (string.IsNullOrWhiteSpace(pallmsg.PalletNo))
                 {
                     result.Message = "妗剁紪鍙蜂笉鑳戒负绌猴紒";
@@ -779,22 +784,28 @@
             }
             catch (Exception e)
             {
+                LogFile.SaveLogToFile($"MES灏嗗噣妗舵敼涓鸿剰妗跺苟鎷夊埌鑴忔《鍖哄紓甯革細( {e.Message} ),", logStr);
+
                 result.Message = e.Message;
                 return Ok(result);
             }
         }
 
         /// <summary>
-        /// MES涓嬪彂娓呮礂閿佸畾鑴忔《
+        /// MES涓嬪彂娓呮礂鎸囧畾鑴忔《
         /// </summary>
         /// <param name="pallmsg"></param>
         /// <returns></returns>
         [HttpPost]
         public IActionResult CleanPallet(Pallnetmsg pallmsg)
         {
-            var result = new ErpModel { Success = -1, Message = "", };
+            var logStr = $@".\log\MES\MES涓嬪彂娓呮礂鎸囧畾鑴忔《" + DateTime.Now.ToString("yyyyMMdd") + ".txt";
+            ErpModel result = new ErpModel { Success = -1, Message = "" };
             try
             {
+                var jsonData = JsonConvert.SerializeObject(pallmsg);
+                LogFile.SaveLogToFile($"MES涓嬪彂娓呮礂鎸囧畾鑴忔《-璇锋眰鎶ユ枃锛�( {jsonData} ),", logStr);
+
                 if (string.IsNullOrWhiteSpace(pallmsg.Location))
                 {
                     result.Message = "鍙枡浣嶇疆涓虹┖锛�";
@@ -807,11 +818,39 @@
                 }
                 _rcsserver.CleanPallet(pallmsg, _config.AgvHost + _config.GenAgvSchedulingTask);
                 result.Success = 0;
-                result.Message = "鍙《鎴愬姛锛�";
+                result.Message = "鎿嶄綔鎴愬姛锛�";
                 return Ok(result);
             }
             catch (Exception e)
             {
+                LogFile.SaveLogToFile($"MES涓嬪彂娓呮礂鎸囧畾鑴忔《寮傚父锛�( {e.Message} ),", logStr);
+                result.Message = e.Message;
+                return Ok(result);
+            }
+        }
+        /// <summary>
+        /// LIMS璐ㄩ噺缁撴灉涓嬪彂
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        [HttpPost]
+        public IActionResult QualityResult(QualityResultVm model)
+        {
+            var logStr = $@".\log\LIMS\LIMS璐ㄩ噺缁撴灉涓嬪彂" + DateTime.Now.ToString("yyyyMMdd") + ".txt";
+            ErpModel result = new ErpModel { Success = -1, Message = "" };
+            try
+            {
+                var jsonData = JsonConvert.SerializeObject(model);
+                LogFile.SaveLogToFile($"LIMS璐ㄩ噺缁撴灉涓嬪彂-璇锋眰鎶ユ枃锛�( {jsonData} ),", logStr);
+
+                _rcsserver.QualityResult(model);
+                result.Success = 0;
+                result.Message = "鎿嶄綔鎴愬姛锛�";
+                return Ok(result);
+            }
+            catch (Exception e)
+            {
+                LogFile.SaveLogToFile($"LIMS璐ㄩ噺缁撴灉涓嬪彂寮傚父锛�( {e.Message} ),", logStr);
                 result.Message = e.Message;
                 return Ok(result);
             }

--
Gitblit v1.8.0