From df512779d2215464755a8a5cb35c9d8d88e5d9dd Mon Sep 17 00:00:00 2001
From: liudl <673013083@qq.com>
Date: 星期五, 31 十月 2025 13:24:10 +0800
Subject: [PATCH] 组盘回传

---
 Admin.NET/WCS.Application/OpenApi/DemoOpenApi.cs |   53 ++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 36 insertions(+), 17 deletions(-)

diff --git a/Admin.NET/WCS.Application/OpenApi/DemoOpenApi.cs b/Admin.NET/WCS.Application/OpenApi/DemoOpenApi.cs
index 6e228e8..33e1063 100644
--- a/Admin.NET/WCS.Application/OpenApi/DemoOpenApi.cs
+++ b/Admin.NET/WCS.Application/OpenApi/DemoOpenApi.cs
@@ -525,9 +525,10 @@
     /// <returns>鍙嶉淇℃伅</returns>
     [HttpPost]
     [AllowAnonymous]
-    public IsBaleModel2 HttpInConfirm(PortModel models)
+    public ResponseModel HttpInConfirm(PortModel models)
     {
-
+        ResponseModel result = new ResponseModel();
+        result.StatusCode = 0;
         try
         {
             string str = JsonConvert.SerializeObject(models);
@@ -565,7 +566,7 @@
             var modDevice = _db.Queryable<WcsPosition>().Where(s => s.StationNum == portno && s.Text == "PLC").First();
 
             var (res1, val) = plcConn.GetPlcDBValue(modDevice.PosType, listPlcDevice.DbNumber, modDevice.PlcPos);
-            if (val.ToString() == "120")
+            if (val.ToString() == "120" || val.ToString() == "130")
             {
                 //璇诲彇鎴愬姛鍚庡啓鍏�130
                 modDevice = _db.Queryable<WcsPosition>().Where(s => s.StationNum == portno && s.Text == "WCS").First();
@@ -573,14 +574,17 @@
                 if (ret.IsSucceed)
                 {
                     //鍥炰紶WMS鍙斁淇″彿
-                    return new IsBaleModel2() { Success = 0, Message = "鎺ュ彈鎴愬姛" };
+                    result.Msg = "鎺ュ彈鎴愬姛";
+                    return result;
                 }
             }
-            return new IsBaleModel2() { Success = -1, Message = "璇诲彇PLC鐐逛綅淇℃伅澶辫触" };
+            result.StatusCode = -1;
+            result.Msg = "璇诲彇PLC鐐逛綅淇℃伅澶辫触";
+            return result;
         }
         catch (Exception ex)
         {
-            return new IsBaleModel2() { Success = -1, Message = ex.Message };
+            return new ResponseModel() { StatusCode = -1, Msg = ex.Message };
         }
     }
 
@@ -592,8 +596,10 @@
     /// <returns>鍙嶉淇℃伅</returns>
     [HttpPost]
     [AllowAnonymous]
-    public IsBaleModel2 HttpInRequest(PortRequestModel models)
+    public ResponseModel HttpInRequest(PortRequestModel models)
     {
+        ResponseModel result = new ResponseModel();
+        result.StatusCode = 0;
         try
         {
             string str = JsonConvert.SerializeObject(models);
@@ -631,17 +637,26 @@
             plcConn.SetPlcDBValue(modDevice.PosType, listPlcDevice.DbNumber, modDevice.PlcPos, models.TaskNo);//鍐欏叆浠诲姟鍙�
                                                                                                               //
             modDevice = _db.Queryable<WcsPosition>().Where(s => s.StationNum == portno && s.Text == "WCS").First();
+            //鍒ゆ柇褰撳墠鐘舵�佹槸鍚﹁PLC璁剧疆涓�150锛屽鏋滄槸鍒欏洖浼燱MS鍙斁璐т俊鍙�
+            //var (djRes, djVal) = plcConn.GetPlcDBValue(modDevice.PosType, listPlcDevice.DbNumber, modDevice.PlcPos);
+            //if (djVal == "150")
+            //{
+            //    return new ResponseModel() { StatusCode = 0, Msg = "PLC鍏佽鏀捐揣" };
+            //}
             var ret = plcConn.SetPlcDBValue(modDevice.PosType, listPlcDevice.DbNumber, modDevice.PlcPos, "140");//鍐欏叆寮�濮嬫斁璐т俊鍙�
-            if (ret.IsSucceed)
+            if (ret.IsSucceed == true)
             {
-                //鍥炰紶WMS鏀捐揣淇″彿
-                return new IsBaleModel2() { Success = 0, Message = "鎺ュ彈鎴愬姛" };
+                result.Msg = "PLC鍏佽鏀捐揣";
+                return result;
             }
-            return new IsBaleModel2() { Success = -1, Message = "璇诲彇PLC鐐逛綅淇℃伅澶辫触" };
+
+            result.StatusCode = -1;
+            result.Msg = "璇诲彇PLC鐐逛綅淇℃伅澶辫触";
+            return result;
         }
         catch (Exception ex)
         {
-            return new IsBaleModel2() { Success = -1, Message = ex.Message };
+            return new ResponseModel() { StatusCode = -1, Msg = ex.Message };
         }
     }
 
@@ -654,9 +669,10 @@
     /// <returns>鍙嶉淇℃伅</returns>
     [HttpPost]
     [AllowAnonymous]
-    public IsBaleModel2 HttpInFinish(PortModel models)
+    public ResponseModel HttpInFinish(PortModel models)
     {
-
+        ResponseModel result = new ResponseModel();
+        result.StatusCode = 0;
         try
         {
             string str = JsonConvert.SerializeObject(models);
@@ -696,13 +712,16 @@
             if (ret.IsSucceed)
             {
                 //鍥炰紶WMS鏀捐揣淇″彿
-                return new IsBaleModel2() { Success = 0, Message = "鎺ュ彈鎴愬姛" };
+                result.Msg = "鎺ュ彈鎴愬姛";
+                return result;
             }
-            return new IsBaleModel2() { Success = -1, Message = "璇诲彇PLC鐐逛綅淇℃伅澶辫触" };
+            result.StatusCode = -1;
+            result.Msg = "璇诲彇PLC鐐逛綅淇℃伅澶辫触";
+            return result;
         }
         catch (Exception ex)
         {
-            return new IsBaleModel2() { Success = -1, Message = ex.Message };
+            return new ResponseModel() { StatusCode = -1, Msg = ex.Message };
         }
     }
 

--
Gitblit v1.8.0