| | |
| | | using Microsoft.AspNetCore.SignalR; |
| | | using Elastic.Clients.Elasticsearch.Tasks; |
| | | using Microsoft.AspNetCore.SignalR; |
| | | using RazorEngine.Compilation.ImpromptuInterface.Dynamic; |
| | | using System; |
| | | using System.Collections.Generic; |
| | |
| | | taskInfo.EndCeng = "3"; |
| | | taskInfo.EndLie = "65"; |
| | | taskInfo.EndPai = int.Parse(roadWay.Substring(1,2)).ToString(); |
| | | |
| | | |
| | | // 移库任务 |
| | | if (taskType == "2") |
| | | { |
| | | if (roadWay == endRoadWay) // 同巷道移库,获取目标地址 |
| | | { |
| | | taskInfo = GetEndPai(endLocat.Substring(1, 2), endLocat.Substring(0, 2), endLocat.Substring(4, 2), endLocat.Substring(6, 2)); |
| | | taskInfo = GetEndPai(endRoadWay.Substring(1, 2),endLocat.Substring(2, 2), endLocat.Substring(0, 2), endLocat.Substring(4, 2), endLocat.Substring(6, 2)); |
| | | } |
| | | else // 跨巷道移库,获取三楼出库口 |
| | | { |
| | |
| | | } |
| | | |
| | | } |
| | | //根据巷道口和层数确认出库工位排 |
| | | |
| | | |
| | | switch (roadWay) |
| | | { |
| | | case "R01": |
| | | |
| | | if (taskInfo.EndCeng == "1") |
| | | { |
| | | taskInfo.EndPai = "2"; |
| | | } |
| | | if (taskInfo.EndCeng == "2" || taskInfo.EndCeng == "3") |
| | | { |
| | | taskInfo.EndPai = "3"; |
| | | } |
| | | break; |
| | | case "R02": |
| | | |
| | | if (taskInfo.EndCeng == "1") |
| | | { |
| | | taskInfo.EndPai = "2"; |
| | | } |
| | | if (taskInfo.EndCeng == "2" || taskInfo.EndCeng == "3") |
| | | { |
| | | taskInfo.EndPai = "3"; |
| | | } |
| | | break; |
| | | case "R03": |
| | | if (taskInfo.EndCeng == "1") |
| | | { |
| | | taskInfo.EndPai = "2"; |
| | | } |
| | | if (taskInfo.EndCeng == "2" || taskInfo.EndCeng == "3") |
| | | { |
| | | taskInfo.EndPai = "3"; |
| | | } |
| | | break; |
| | | case "R04": |
| | | if (taskInfo.EndCeng == "1") |
| | | { |
| | | taskInfo.EndPai = "2"; |
| | | } |
| | | if (taskInfo.EndCeng == "2" || taskInfo.EndCeng == "3") |
| | | { |
| | | taskInfo.EndPai = "3"; |
| | | } |
| | | break; |
| | | case "R05": |
| | | if (taskInfo.EndCeng == "1") |
| | | { |
| | | taskInfo.EndPai = "2"; |
| | | } |
| | | if (taskInfo.EndCeng == "2" || taskInfo.EndCeng == "3") |
| | | { |
| | | taskInfo.EndPai = "3"; |
| | | } |
| | | break; |
| | | case "R06": |
| | | if (taskInfo.EndCeng == "1" || taskInfo.EndCeng == "2" ) |
| | | { |
| | | taskInfo.EndPai = "2"; |
| | | } |
| | | if ( taskInfo.EndCeng == "3") |
| | | { |
| | | taskInfo.EndPai = "3"; |
| | | } |
| | | break; |
| | | case "R07": |
| | | if (taskInfo.EndCeng == "1" ) |
| | | { |
| | | taskInfo.EndPai = "2"; |
| | | } |
| | | if ( taskInfo.EndCeng == "2" || taskInfo.EndCeng == "3") |
| | | { |
| | | taskInfo.EndPai = "3"; |
| | | } |
| | | break; |
| | | case "R08": |
| | | if (taskInfo.EndCeng == "1") |
| | | { |
| | | 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; |
| | | } |
| | | |
| | | return taskInfo; |
| | | } |
| | |
| | | /// </summary> |
| | | /// <param name="startStation"></param> |
| | | /// <returns></returns> |
| | | public static PlcTaskInfo GetPlcIp(string startStation) |
| | | public static PLCUtil GetPlcIp(string startStation) |
| | | { |
| | | PlcTaskInfo taskInfo = new PlcTaskInfo(); |
| | | |
| | | 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" }; |
| | | 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" }; |
| | | var conveyList2 = new List<string>() { "252", "254", "260", "262", "272", "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" }; |
| | | if (conveyList1.Contains(startStation)) |
| | | { |
| | | taskInfo.Ip = "10.18.51.110"; |
| | | strIp = "10.18.51.110"; |
| | | } |
| | | else if (conveyList2.Contains(startStation)) |
| | | { |
| | | |
| | | taskInfo.Ip = "10.18.51.120"; |
| | | strIp = "10.18.51.120"; |
| | | } |
| | | else if (conveyList3.Contains(startStation)) |
| | | { |
| | | |
| | | taskInfo.Ip = "10.18.51.130"; |
| | | strIp = "10.18.51.130"; |
| | | } |
| | | else |
| | | { |
| | | throw new Exception("工位未查询到"); |
| | | throw Oops.Bah("工位未查询到"); |
| | | } |
| | | |
| | | return taskInfo; |
| | | var plcConveyorConn = PLCTaskAction.listPlcConn.First(m => m.PlcIP == strIp); |
| | | return plcConveyorConn; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 根据wms目标地址转换为Plc目标地址 |
| | | /// </summary> |
| | | /// <param name="road">巷道</param> |
| | | /// <param name="lie">列</param> |
| | | /// <param name="pai">排</param> |
| | | /// <param name="ceng">层</param> |
| | | /// <param name="dept">深度</param> |
| | | /// <returns></returns> |
| | | public static PlcTaskInfo GetEndPai(string lie, string pai,string ceng, string dept) |
| | | public static PlcTaskInfo GetEndPai(string road,string lie, string pai,string ceng, string dept) |
| | | { |
| | | var roadNum = int.Parse(lie); |
| | | var roadNum = int.Parse(road); |
| | | var lieNum = int.Parse(lie); |
| | | var paiNum = int.Parse(pai); |
| | | var cengNum = int.Parse(ceng); |
| | | var deptNum = int.Parse(dept); |
| | | |
| | | var paiVal = 0; |
| | |
| | | } |
| | | |
| | | PlcTaskInfo taskInfo = new PlcTaskInfo(); |
| | | taskInfo.EndPai = pai; |
| | | taskInfo.EndCeng = ceng; |
| | | taskInfo.EndLie = paiVal.ToString(); |
| | | taskInfo.EndPai = paiVal.ToString(); |
| | | taskInfo.EndCeng = cengNum.ToString(); |
| | | taskInfo.EndLie = lieNum.ToString() ; |
| | | |
| | | return taskInfo; |
| | | } |
| | |
| | | public static string GetRoadwayByStationNew(string StationNum) |
| | | { |
| | | string value = ""; |
| | | 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 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" }; |
| | | |
| | | if (conveyList1.Contains(StationNum)) |
| | | var ipInfo = _db.Queryable<WcsPlc>().Where(s => s.Type == PLCTypeEnum.StackingMachine || s.Type == PLCTypeEnum.ConveyorLine); |
| | | var ip1 = ipInfo.First(m => m.Text == "1层托盘输送线"); |
| | | var ip2 = ipInfo.First(m => m.Text == "2层托盘输送线"); |
| | | var ip3 = ipInfo.First(m => m.Text == "3层托盘输送线"); |
| | | |
| | | if (ip1 != null) |
| | | { |
| | | value = "1"; |
| | | } |
| | | else if (conveyList2.Contains(StationNum)) |
| | | { |
| | | value = "2"; |
| | | } |
| | | else if (conveyList3.Contains(StationNum)) |
| | | { |
| | | value = "3"; |
| | | } |
| | | else |
| | | { |
| | | throw new Exception("工位未查询到"); |
| | | var dev1 = PLCTaskAction.plcDevices.Where(m => m.IsDelete == false && m.PlcId == ip1.Id).Select(m => m.StationNum).ToList(); |
| | | if (dev1.Contains(StationNum)) |
| | | { |
| | | value = "1"; |
| | | return value; |
| | | } |
| | | } |
| | | |
| | | return value; |
| | | if (ip2 != null) |
| | | { |
| | | var dev2 = PLCTaskAction.plcDevices.Where(m => m.IsDelete == false && m.PlcId == ip2.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; |
| | | } |
| | | } |
| | | |
| | | throw new Exception("工位未查询到"); |
| | | } |
| | | |
| | | /// <summary> |