From 96f2053a1a93193dc5f4eb064aaf455b2d692f0c Mon Sep 17 00:00:00 2001
From: wxw <Administrator@DESKTOP-5BIMHQ3>
Date: 星期五, 20 六月 2025 13:31:57 +0800
Subject: [PATCH] 优化入库流程

---
 Admin.NET/WCS.Application/PLC/PLCCommon.cs |  635 ++++++++++++++++++++++++++-------------------------------
 1 files changed, 294 insertions(+), 341 deletions(-)

diff --git a/Admin.NET/WCS.Application/PLC/PLCCommon.cs b/Admin.NET/WCS.Application/PLC/PLCCommon.cs
index 1fe2a42..f79e8c4 100644
--- a/Admin.NET/WCS.Application/PLC/PLCCommon.cs
+++ b/Admin.NET/WCS.Application/PLC/PLCCommon.cs
@@ -23,16 +23,20 @@
     /// <returns></returns>
     public static PlcTaskInfo GetCTaskInfo(string endLocat,string taskType,string roadWay,string endRoadWay) 
     {
+        if (!endLocat.IsNullOrEmpty()) 
+        {
+            endLocat = endLocat.PadLeft(3, '0');
+        }
+
         // 鍚勫眰杈撻�佺嚎璺烘満鏀捐揣宸ヤ綅闆嗗悎
-        var conveyList1 = new List<string>() { "033", "039", "044", "051", "059" };
-        var conveyList2 = new List<string>() { "205", "234" };
-        var conveyList3 = new List<string>() { "440", "443" };
+        var conveyList1 = new List<string>() { "152", "153", "155", "160", "094", "019", "037", "054", "078" };
+        var conveyList4 = new List<string>() { "266", "265"};
 
         PlcTaskInfo taskInfo = new PlcTaskInfo();
         taskInfo.EndCeng = "3";
-        taskInfo.EndLie = "65";
+        taskInfo.EndLie = "60";
         taskInfo.EndPai = int.Parse(roadWay.Substring(1,2)).ToString();
-        
+        taskInfo.StartStation = "0";
 
         // 绉诲簱浠诲姟
         if (taskType == "2") 
@@ -41,40 +45,31 @@
             {
                 taskInfo = GetEndPai(endRoadWay.Substring(1, 2),endLocat.Substring(2, 2), endLocat.Substring(0, 2), endLocat.Substring(4, 2), endLocat.Substring(6, 2));
             }
-            else                                                                    // 璺ㄥ贩閬撶Щ搴擄紝鑾峰彇涓夋ゼ鍑哄簱鍙�
+            else                                                                    // 璺ㄥ贩閬撶Щ搴擄紝鑾峰彇涓�妤煎嚭搴撳彛
             {
-                taskInfo.Ip = "10.18.51.130";
+                taskInfo.Ip = "192.168.120.1";
                 switch (roadWay)
                 {
                     case "R01":
-                        taskInfo.EndStation = "402";
+                        taskInfo.EndStation = "004";
                         break;
                     case "R02":
-                        taskInfo.EndStation = "406";
+                        taskInfo.EndStation = "099";
                         break;
                     case "R03":
-                        taskInfo.EndStation = "410";
+                        taskInfo.EndStation = "107";
                         break;
                     case "R04":
-                        taskInfo.EndStation = "414";
+                        taskInfo.EndStation = "115";
                         break;
                     case "R05":
-                        taskInfo.EndStation = "418";
+                        taskInfo.EndStation = "125";
                         break;
                     case "R06":
-                        taskInfo.EndStation = "422";
+                        taskInfo.EndStation = "133";
                         break;
                     case "R07":
-                        taskInfo.EndStation = "426";
-                        break;
-                    case "R08":
-                        taskInfo.EndStation = "430";
-                        break;
-                    case "R09":
-                        taskInfo.EndStation = "434";
-                        break;
-                    case "R10":
-                        taskInfo.EndStation = "438";
+                        taskInfo.EndStation = "141";
                         break;
                 }
             }
@@ -85,120 +80,60 @@
         {
             if (conveyList1.Contains(endLocat))
             {
-                taskInfo.Ip = "10.18.51.110";
+                taskInfo.Ip = "192.168.120.1";
                 taskInfo.EndCeng = "1";
                 #region 涓�灞傝緭閫佺嚎
                 switch (roadWay)
                 {
                     case "R01":
-                        taskInfo.EndStation = "147";
+                        taskInfo.EndStation = "004";
                         break;
                     case "R02":
-                        taskInfo.EndStation = "139";
+                        taskInfo.EndStation = "099";
                         break;
                     case "R03":
-                        taskInfo.EndStation = "129";
+                        taskInfo.EndStation = "107";
                         break;
                     case "R04":
-                        taskInfo.EndStation = "121";
+                        taskInfo.EndStation = "115";
                         break;
                     case "R05":
-                        taskInfo.EndStation = "111";
+                        taskInfo.EndStation = "125";
                         break;
                     case "R06":
-                        taskInfo.EndStation = "103";
+                        taskInfo.EndStation = "133";
                         break;
                     case "R07":
-                        taskInfo.EndStation = "093";
-                        break;
-                    case "R08":
-                        taskInfo.EndStation = "85";
-                        break;
-                    case "R09":
-                        taskInfo.EndStation = "75";
-                        break;
-                    case "R10":
-                        taskInfo.EndStation = "67";
+                        taskInfo.EndStation = "141";
                         break;
                 }
                 #endregion
             }
-            else if (conveyList2.Contains(endLocat))
+            else if (conveyList4.Contains(endLocat))
             {
-                #region 浜屽眰杈撻�佺嚎
-                taskInfo.Ip = "10.18.51.120";
+                taskInfo.Ip = "192.168.120.90";
                 taskInfo.EndCeng = "2";
-                switch (roadWay)
+                #region 鍥涘眰杈撻�佺嚎
+                switch (endLocat)
                 {
-                    case "R01":
-                        taskInfo.EndStation = "254";
+                    case "266":
+                        //if (roadWay == "R06") 
+                        //{
+                        //    taskInfo.Ip = "192.168.120.1";
+                        //    taskInfo.EndCeng = "1";
+                        //    taskInfo.EndStation = "133";
+                        //    break;
+                        //}
+
+                        taskInfo.EndStation = "277";
                         break;
-                    case "R02":
-                        taskInfo.EndStation = "262";
-                        break;
-                    case "R03":
-                        taskInfo.EndStation = "272";
-                        break;
-                    case "R04":
-                        taskInfo.EndStation = "280";
-                        break;
-                    case "R05":
-                        taskInfo.EndStation = "290";
-                        break;
-                    case "R06":
-                        taskInfo.EndStation = "294";
-                        break;
-                    case "R07":
-                        taskInfo.EndStation = "309";
-                        break;
-                    case "R08":
-                        taskInfo.EndStation = "317";
-                        break;
-                    case "R09":
-                        taskInfo.EndStation = "327";
-                        break;
-                    case "R10":
-                        taskInfo.EndStation = "331";
-                        break;
-                }
-                #endregion
-            }
-            else if (conveyList3.Contains(endLocat))
-            {
-                #region 涓夊眰杈撻�佺嚎
-                taskInfo.Ip = "10.18.51.130";
-                taskInfo.EndCeng = "3";
-                switch (roadWay)
-                {
-                    case "R01":
-                        taskInfo.EndStation = "402";
-                        break;
-                    case "R02":
-                        taskInfo.EndStation = "406";
-                        break;
-                    case "R03":
-                        taskInfo.EndStation = "410";
-                        break;
-                    case "R04":
-                        taskInfo.EndStation = "414";
-                        break;
-                    case "R05":
-                        taskInfo.EndStation = "418";
-                        break;
-                    case "R06":
-                        taskInfo.EndStation = "422";
-                        break;
-                    case "R07":
-                        taskInfo.EndStation = "426";
-                        break;
-                    case "R08":
-                        taskInfo.EndStation = "430";
-                        break;
-                    case "R09":
-                        taskInfo.EndStation = "434";
-                        break;
-                    case "R10":
-                        taskInfo.EndStation = "438";
+                    case "265":
+                        if (roadWay == "R05")
+                        {
+                            taskInfo.EndStation = "253";
+                            break;
+                        }
+                        taskInfo.EndStation = "250";
                         break;
                 }
                 #endregion
@@ -211,7 +146,7 @@
         }
         //鏍规嵁宸烽亾鍙e拰灞傛暟纭鍑哄簱宸ヤ綅鎺�
 
-
+        //---------------------寰呮敼
         switch (roadWay)
         {
             case "R01":
@@ -220,9 +155,9 @@
                 {
                     taskInfo.EndPai = "2";
                 }
-                if (taskInfo.EndCeng == "2" || taskInfo.EndCeng == "3")
+                if (taskInfo.EndCeng == "2")
                 {
-                    taskInfo.EndPai = "3";
+                    taskInfo.EndPai = "2";
                 }
                 break;
             case "R02":
@@ -231,9 +166,9 @@
                 {
                     taskInfo.EndPai = "2";
                 }
-                if (taskInfo.EndCeng == "2" || taskInfo.EndCeng == "3")
+                if (taskInfo.EndCeng == "2")
                 {
-                    taskInfo.EndPai = "3";
+                    taskInfo.EndPai = "2";
                 }
                 break;
             case "R03":
@@ -241,9 +176,9 @@
                 {
                     taskInfo.EndPai = "2";
                 }
-                if (taskInfo.EndCeng == "2" || taskInfo.EndCeng == "3")
+                if (taskInfo.EndCeng == "2")
                 {
-                    taskInfo.EndPai = "3";
+                    taskInfo.EndPai = "2";
                 }
                 break;
             case "R04":
@@ -251,9 +186,9 @@
                 {
                     taskInfo.EndPai = "2";
                 }
-                if (taskInfo.EndCeng == "2" || taskInfo.EndCeng == "3")
+                if (taskInfo.EndCeng == "2")
                 {
-                    taskInfo.EndPai = "3";
+                    taskInfo.EndPai = "2";
                 }
                 break;
             case "R05":
@@ -261,17 +196,24 @@
                 {
                     taskInfo.EndPai = "2";
                 }
-                if (taskInfo.EndCeng == "2" || taskInfo.EndCeng == "3")
+                if (taskInfo.EndCeng == "2")
                 {
-                    taskInfo.EndPai = "3";
+                    if (endLocat == "265")
+                    {
+                        taskInfo.EndPai = "2";
+                    }
+                    if (endLocat == "266")
+                    {
+                        taskInfo.EndPai = "3";
+                    }
                 }
                 break;
             case "R06":
-                if (taskInfo.EndCeng == "1" || taskInfo.EndCeng == "2" )
+                if (taskInfo.EndCeng == "1")
                 {
                     taskInfo.EndPai = "2";
                 }
-                if ( taskInfo.EndCeng == "3")
+                if ( taskInfo.EndCeng == "2")
                 {
                     taskInfo.EndPai = "3";
                 }
@@ -281,39 +223,9 @@
                 {
                     taskInfo.EndPai = "2";
                 }
-                if ( taskInfo.EndCeng == "2" || taskInfo.EndCeng == "3")
-                {
-                    taskInfo.EndPai = "3";
-                }
-                break;
-            case "R08":
-                if (taskInfo.EndCeng == "1")
+                if ( taskInfo.EndCeng == "2")
                 {
                     taskInfo.EndPai = "2";
-                }
-                if (taskInfo.EndCeng == "2" || taskInfo.EndCeng == "3")
-                {
-                    taskInfo.EndPai = "3";
-                }
-                break;
-            case "R09":
-                if (taskInfo.EndCeng == "1")
-                {
-                    taskInfo.EndPai = "2";
-                }
-                if (taskInfo.EndCeng == "2" || taskInfo.EndCeng == "3")
-                {
-                    taskInfo.EndPai = "3";
-                }
-                break;
-            case "R10":
-                if (taskInfo.EndCeng == "1" || taskInfo.EndCeng == "2")
-                {
-                    taskInfo.EndPai = "2";
-                }
-                if (taskInfo.EndCeng == "3")
-                {
-                    taskInfo.EndPai = "3";
                 }
                 break;
         }
@@ -329,22 +241,17 @@
     public static PLCUtil GetPlcIp(string startStation) 
     {
         string strIp = "";
-        var conveyList1 = new List<string>() { "147", "145", "139", "137", "129", "127", "121", "119", "111", "109", "103", "101", "093", "091", "085", "083", "075", "073", "067", "065","033","039","044" ,"051","059"};
-        var conveyList2 = new List<string>() { "205", "234", "252", "254", "260", "262", "270", "272", "278", "280", "288", "290", "294", "301", "307", "309", "315", "317", "325", "327", "331", "337" };
-        var conveyList3 = new List<string>() { "401", "402", "405", "406", "409", "410", "413", "414", "417", "418", "421", "422", "425", "426", "429", "430", "433", "434", "437", "438" };
+        startStation = startStation.PadLeft(3, '0');
+        var conveyList1 = new List<string>() { "078","093", "094", "155", "160", "063", "072", "050", "045", "048", "052", "056", "055", "032", "027", "030", "034", "039", "038", "015", "010", "017", "021", "020", "003", "004", "097", "099", "105", "107", "113", "115", "123", "125", "131", "133", "139", "141", "152", "153", "019", "037", "054" };
+        var conveyList4 = new List<string>() { "265", "266", "250", "253", "277" };
         if (conveyList1.Contains(startStation))
         {
-            strIp = "10.18.51.110";
+            strIp = "192.168.120.1";
         }
-        else if (conveyList2.Contains(startStation))
+        else if (conveyList4.Contains(startStation))
         {
 
-            strIp = "10.18.51.120";
-        }
-        else if (conveyList3.Contains(startStation))
-        {
-
-            strIp = "10.18.51.130";
+            strIp = "192.168.120.90";
         }
         else
         {
@@ -380,22 +287,22 @@
             {
                 if (deptNum == 1)
                 {
-                    paiVal = 3;
+                    paiVal = 2;
                 }
                 else
                 {
-                    paiVal = 4;
+                    paiVal = 1;
                 }
             }
             else
             {
                 if (deptNum == 1)
                 {
-                    paiVal = 1;
+                    paiVal = 3;
                 }
                 else
                 {
-                    paiVal = 2;
+                    paiVal = 4;
                 }
             }
 
@@ -407,23 +314,23 @@
             {
                 if (deptNum == 1)
                 {
-                    paiVal = 3;
+                    paiVal = 2;
                 }
                 else
                 {
-                    paiVal = 4;
+                    paiVal = 1;
                 }
             }
             else
             {
                 if (deptNum == 1)
                 {
-                    paiVal = 2;
+                    paiVal = 3;
 
                 }
                 else
                 {
-                    paiVal = 1;
+                    paiVal = 4;
 
                 }
             }
@@ -439,14 +346,15 @@
         }
         return taskInfo;
     }
-    
+
     /// <summary>
     /// 鏍规嵁宸烽亾鍜屽眰鏁扮‘瀹氬贩閬撳彛鍏ュ簱宸ヤ綅
     /// </summary>
     /// <param name="endRoadway"></param>
     /// <param name="ceng"></param>
+    /// <param name="startStation">璧峰宸ヤ綅</param>
     /// <returns></returns>
-    public static string RoadwayToStationNum(string endRoadway, string ceng)
+    public static string RoadwayToStationNum(string endRoadway, string ceng,string startStation="")
     {
         string stationNum = "";
         switch (endRoadway)
@@ -454,141 +362,78 @@
             case "R01":
                 if (ceng == "1")
                 {
-                    stationNum = "145";
+                    stationNum = "003";
                 }
                 if (ceng == "2")
                 {
-                    stationNum = "252";
-                }
-                if (ceng == "3")
-                {
-                    stationNum = "401";
+                    stationNum = "";
                 }
                 break;
             case "R02":
                 if (ceng == "1")
                 {
-                    stationNum = "137";
+                    stationNum = "097";
                 }
                 if (ceng == "2")
                 {
-                    stationNum = "260";
-                }
-                if (ceng == "3")
-                {
-                    stationNum = "405";
+                    stationNum = "";
                 }
                 break;
             case "R03":
                 if (ceng == "1")
                 {
-                    stationNum = "127";
+                    stationNum = "105";
                 }
                 if (ceng == "2")
                 {
-                    stationNum = "270";
-                }
-                if (ceng == "3")
-                {
-                    stationNum = "409";
+                    stationNum = "";
                 }
                 break;
             case "R04":
                 if (ceng == "1")
                 {
-                    stationNum = "119";
+                    stationNum = "113";
                 }
                 if (ceng == "2")
                 {
-                    stationNum = "278";
-                }
-                if (ceng == "3")
-                {
-                    stationNum = "413";
+                    stationNum = "";
                 }
                 break;
             case "R05":
                 if (ceng == "1")
                 {
-                    stationNum = "109";
+                    stationNum = "123";
                 }
                 if (ceng == "2")
                 {
-                    stationNum = "288";
-                }
-                if (ceng == "3")
-                {
-                    stationNum = "417";
+                    if (startStation == "265")
+                    {
+                        stationNum = "253";
+                    }
+                    if (startStation == "266")
+                    {
+                        stationNum = "277";
+                    }
                 }
                 break;
             case "R06":
                 if (ceng == "1")
                 {
-                    stationNum = "101";
+                    stationNum = "131";
                 }
                 if (ceng == "2")
                 {
-                    stationNum = "301";
-                }
-                if (ceng == "3")
-                {
-                    stationNum = "421";
+                    stationNum = "250";
                 }
                 break;
             case "R07":
                 if (ceng == "1")
                 {
-                    stationNum = "091";
+                    stationNum = "139";
                 }
                 if (ceng == "2")
                 {
-                    stationNum = "307";
-                }
-                if (ceng == "3")
-                {
-                    stationNum = "425";
-                }
-                break;
-            case "R08":
-                if (ceng == "1")
-                {
-                    stationNum = "83";
-                }
-                if (ceng == "2")
-                {
-                    stationNum = "315";
-                }
-                if (ceng == "3")
-                {
-                    stationNum = "429";
-                }
-                break;
-            case "R09":
-                if (ceng == "1")
-                {
-                    stationNum = "73";
-                }
-                if (ceng == "2")
-                {
-                    stationNum = "325";
-                }
-                if (ceng == "3")
-                {
-                    stationNum = "433";
-                }
-                break;
-            case "R10":
-                if (ceng == "1")
-                {
-                    stationNum = "65";
-                }
-                if (ceng == "2")
-                {
-                    stationNum = "337";
-                }
-                if (ceng == "3")
-                {
-                    stationNum = "437";
+                    stationNum = "";
                 }
                 break;
         }
@@ -596,6 +441,71 @@
         return stationNum;
     }
 
+    /// <summary>
+    /// 鏍规嵁宸烽亾鍙峰拰灞傛暟鑾峰彇鍑哄簱宸ヤ綅
+    /// </summary>
+    /// <param name="endRoadway">宸烽亾锛歊0X</param>
+    /// <param name="ceng">灞傛暟</param>
+    /// <returns>鍑哄簱宸ヤ綅鍙�</returns>
+    public static string RoadwayToOutStationNum(string endRoadway, string ceng)
+    {
+        string stationNum = "";
+        switch (endRoadway)
+        {
+            case "R01":
+                if (ceng == "1")
+                {
+                    stationNum = "004";
+                }
+                break;
+            case "R02":
+                if (ceng == "1")
+                {
+                    stationNum = "099";
+                }
+                break;
+            case "R03":
+                if (ceng == "1")
+                {
+                    stationNum = "107";
+                }
+                break;
+            case "R04":
+                if (ceng == "1")
+                {
+                    stationNum = "115";
+                }
+                break;
+            case "R05":
+                if (ceng == "1")
+                {
+                    stationNum = "125";
+                }
+                if (ceng == "4")
+                {
+                    stationNum = "277,253";
+                }
+                break;
+            case "R06":
+                if (ceng == "1")
+                {
+                    stationNum = "133";
+                }
+                if (ceng == "4")
+                {
+                    stationNum = "250";
+                }
+                break;
+            case "R07":
+                if (ceng == "1")
+                {
+                    stationNum = "141";
+                }
+                break;
+        }
+
+        return stationNum;
+    }
 
     /// <summary>
     /// 鏍规嵁宸ヤ綅鍙疯幏鍙栧搴斿贩閬� 
@@ -604,17 +514,18 @@
     /// <returns>璺烘満鑱旀満</returns>
     public static string GetRoadwayByStation(string StationNum)
     {
+        if (!StationNum.IsNullOrEmpty())
+        {
+            StationNum = StationNum.PadLeft(3, '0');
+        }
         string value = "";
-        var conveyList1 = new List<string>() { "147", "145", "252", "254", "401", "402", };
-        var conveyList2 = new List<string>() { "139", "137", "260", "262", "405", "406", };
-        var conveyList3 = new List<string>() { "129", "127", "272", "270", "409", "410", };
-        var conveyList4 = new List<string>() { "121", "119", "278", "280", "413", "414", };
-        var conveyList5 = new List<string>() { "111", "109", "288", "290", "417", "418", };
-        var conveyList6 = new List<string>() { "103", "101", "294", "301", "421", "422", };
-        var conveyList7 = new List<string>() { "093", "091", "307", "309", "425", "426", };
-        var conveyList8 = new List<string>() { "085", "083", "315", "317", "429", "430", };
-        var conveyList9 = new List<string>() { "075", "073", "325", "327", "433", "434", };
-        var conveyList10 = new List<string>() { "067", "065", "331", "337", "437", "438", };
+        var conveyList1 = new List<string>() { "003", "004", };
+        var conveyList2 = new List<string>() { "097", "099", };
+        var conveyList3 = new List<string>() { "105", "107", };
+        var conveyList4 = new List<string>() { "113", "115", };
+        var conveyList5 = new List<string>() { "123", "125", "277", "253", };
+        var conveyList6 = new List<string>() { "131", "133", "250" };
+        var conveyList7 = new List<string>() { "139", "141", };
 
         if (conveyList1.Contains(StationNum))
         {
@@ -644,18 +555,6 @@
         {
             value = "R07";
         }
-        else if (conveyList8.Contains(StationNum))
-        {
-            value = "R08";
-        }
-        else if (conveyList9.Contains(StationNum))
-        {
-            value = "R09";
-        }
-        else if (conveyList10.Contains(StationNum))
-        {
-            value = "R10";
-        }
 
         return value;
     }
@@ -671,11 +570,9 @@
         //var conveyList1 = new List<string>() { "147", "145", "139", "137", "129", "127", "121", "119", "111", "109", "103", "101", "093", "091", "085", "083", "075", "073", "067", "065" };
         //var conveyList2 = new List<string>() { "252", "254", "260", "262", "272", "270", "278", "280", "288", "290", "294", "301", "307", "309", "315", "317", "325", "327", "331", "337" };
         //var conveyList3 = new List<string>() { "401", "402", "405", "406", "409", "410", "413", "414", "417", "418", "421", "422", "425", "426", "429", "430", "433", "434", "437", "438" };
-
-       var ipInfo = _db.Queryable<WcsPlc>().Where(s =>  s.Type == PLCTypeEnum.ConveyorLine && s.IsDelete == false).ToList();  //s.Type == PLCTypeEnum.StackingMachine ||
+        var ipInfo = _db.Queryable<WcsPlc>().Where(s =>  s.Type == PLCTypeEnum.ConveyorLine && s.IsDelete == false).ToList();  //s.Type == PLCTypeEnum.StackingMachine ||
         var ip1 = ipInfo.First(m => m.Text == "1灞傛墭鐩樿緭閫佺嚎");
-        var ip2 = ipInfo.First(m => m.Text == "2灞傛墭鐩樿緭閫佺嚎");
-        var ip3 = ipInfo.First(m => m.Text == "3灞傛墭鐩樿緭閫佺嚎");
+        var ip4 = ipInfo.First(m => m.Text == "4灞傛墭鐩樿緭閫佺嚎");
 
         if (ip1 != null) 
         {
@@ -687,22 +584,12 @@
             }
         }
 
-        if (ip2 != null)
+        if (ip4 != null)
         {
-            var dev2 = PLCTaskAction.plcDevices.Where(m => m.IsDelete == false && m.PlcId == ip2.Id).Select(m => m.StationNum).ToList();
+            var dev2 = PLCTaskAction.plcDevices.Where(m => m.IsDelete == false && m.PlcId == ip4.Id).Select(m => m.StationNum).ToList();
             if (dev2.Contains(StationNum))
             {
                 value = "2";
-                return value;
-            }
-        }
-
-        if (ip3 != null)
-        {
-            var dev3 = PLCTaskAction.plcDevices.Where(m => m.IsDelete == false && m.PlcId == ip3.Id).Select(m => m.StationNum).ToList();
-            if (dev3.Contains(StationNum))
-            {
-                value = "3";
                 return value;
             }
         }
@@ -716,97 +603,163 @@
     /// <param name="roadway">宸烽亾鍙�</param>
     /// <param name="ceng">杩炴帴闆嗗悎</param>
     /// <returns></returns>
-    public static StokInfo GetStokePlc(string roadway, string ceng)
+    public static StokInfo GetStokePlc(string roadway, string ceng,string startStation="")
     {
 
         StokInfo sInfo = new StokInfo();
         sInfo.Pai = "2";
 
-
         switch (roadway)
         {
             case "R01":
-                sInfo.Ip = "10.18.51.10";
+                sInfo.Ip = "192.168.120.110";
                 if (ceng == "1")
                 {
                     sInfo.Pai = "3";
                 }
                 break;
             case "R02":
-                sInfo.Ip = "10.18.51.20";
+                sInfo.Ip = "192.168.120.120";
                 if (ceng == "1")
                 {
                     sInfo.Pai = "3";
                 }
                 break;
             case "R03":
-                sInfo.Ip = "10.18.51.30";
+                sInfo.Ip = "192.168.120.130";
                 if (ceng == "1")
                 {
                     sInfo.Pai = "3";
                 }
                 break;
             case "R04":
-                sInfo.Ip = "10.18.51.40";
+                sInfo.Ip = "192.168.120.140";
                 if (ceng == "1")
                 {
                     sInfo.Pai = "3";
                 }
                 break;
             case "R05":
-                sInfo.Ip = "10.18.51.50";
-                if (ceng == "1")
+                sInfo.Ip = "192.168.120.150";
+                if (ceng == "1" || ceng == "2")
                 {
                     sInfo.Pai = "3";
                 }
+
+                if (ceng == "1")
+                {
+                    sInfo.Pai = "3";
+                } 
+                else if (ceng == "2") 
+                {
+                    if (startStation == "253") 
+                    {
+                        sInfo.Pai = "2";
+                    }
+
+                    if (startStation == "277") 
+                    {
+                        sInfo.Pai = "3";
+                    }
+                }
                 break;
             case "R06":
-                sInfo.Ip = "10.18.51.60";
+                sInfo.Ip = "192.168.120.160";
                 if (ceng == "2" || ceng == "1")
                 {
                     sInfo.Pai = "3";
                 }
                 break;
             case "R07":
-                sInfo.Ip = "10.18.51.70";
+                sInfo.Ip = "192.168.120.170";
                 if (ceng == "1")
-                {
-                    sInfo.Pai = "3";
-                }
-                break;
-            case "R08":
-                sInfo.Ip = "10.18.51.80";
-                if (ceng == "1")
-                {
-                    sInfo.Pai = "3";
-                }
-                break;
-            case "R09":
-                sInfo.Ip = "10.18.51.90";
-                if (ceng == "1")
-                {
-                    sInfo.Pai = "3";
-                }
-                break;
-            case "R10":
-                sInfo.Ip = "10.18.51.100";
-                if (ceng == "2" || ceng == "1")
                 {
                     sInfo.Pai = "3";
                 }
                 break;
         }
 
-        sInfo.Lie = "65";
+        sInfo.Lie = "60";
         sInfo.Ceng = "1";
 
         if (ceng == "2")
         {
             sInfo.Ceng = "2";
         }
-        if (ceng == "3")
+        return sInfo;
+    }
+
+    /// <summary>
+    /// 鏍规嵁宸烽亾鍙枫�佸眰鏁� 鑾峰彇瀵瑰簲鐨勮泛鏈篒P鍙婂嚭搴撳伐浣嶆帓鍒楀眰淇℃伅   绋嬪簭鎴愬姛鎻愬嚭鏉�
+    /// </summary>
+    /// <param name="roadway">宸烽亾鍙�</param>
+    /// <param name="ceng">杩炴帴闆嗗悎</param>
+    /// <returns></returns>
+    public static StokInfo GetOutStokePlc(string roadway, string ceng)
+    {
+        // 2鎺� 60鍒� 1灞�
+        StokInfo sInfo = new StokInfo();
+        sInfo.Pai = "2";
+
+        switch (roadway)
         {
-            sInfo.Ceng = "3";
+            case "R01":
+                sInfo.Ip = "192.168.120.110";
+                if (ceng == "1")
+                {
+                    sInfo.Pai = "3";
+                }
+                break;
+            case "R02":
+                sInfo.Ip = "192.168.120.120";
+                if (ceng == "1")
+                {
+                    sInfo.Pai = "3";
+                }
+                break;
+            case "R03":
+                sInfo.Ip = "192.168.120.130";
+                if (ceng == "1")
+                {
+                    sInfo.Pai = "3";
+                }
+                break;
+            case "R04":
+                sInfo.Ip = "192.168.120.140";
+                if (ceng == "1")
+                {
+                    sInfo.Pai = "3";
+                }
+                break;
+            case "R05":
+                sInfo.Ip = "192.168.120.150";
+                if (ceng == "1")
+                {
+                    sInfo.Pai = "2";
+                }
+                break;
+            case "R06":
+                sInfo.Ip = "192.168.120.160";
+                if (ceng == "2" || ceng == "1")
+                {
+                    sInfo.Pai = "3";
+                }
+                break;
+            case "R07":
+                sInfo.Ip = "192.168.120.170";
+                if (ceng == "1")
+                {
+                    sInfo.Pai = "3";
+                }
+                break;
+        }
+
+        sInfo.Lie = "60";
+        sInfo.Ceng = "1";
+
+        if (ceng == "4")
+        {
+            sInfo.Ceng = "4";
         }
         return sInfo;
     }
@@ -834,22 +787,22 @@
             {
                 if (deptNum == 1)
                 {
-                    paiVal = 3;
+                    paiVal = 2;
                 }
                 else
                 {
-                    paiVal = 4;
+                    paiVal = 1;
                 }
             }
             else
             {
                 if (deptNum == 1)
                 {
-                    paiVal = 2;
+                    paiVal = 3;
                 }
                 else
                 {
-                    paiVal = 1;
+                    paiVal = 4;
                 }
             }
 
@@ -861,23 +814,23 @@
             {
                 if (deptNum == 1)
                 {
-                    paiVal = 3;
+                    paiVal = 2;
                 }
                 else
                 {
-                    paiVal = 4;
+                    paiVal = 1;
                 }
             }
             else
             {
                 if (deptNum == 1)
                 {
-                    paiVal = 2;
+                    paiVal = 3;
 
                 }
                 else
                 {
-                    paiVal = 1;
+                    paiVal = 4;
 
                 }
             }

--
Gitblit v1.8.0