| | |
| | | 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; |
| | | } |
| | |
| | | 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" }; |
| | | 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)) |
| | |
| | | /// <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; |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | // 获取转换后的起始排列层 |
| | | PlcTaskInfo startTaskInfo = PLCCommon.GetEndPai(modTask.StartLocate.Substring(1, 2), |
| | | // 获取转换后的起始排列层 06010101 |
| | | PlcTaskInfo startTaskInfo = PLCCommon.GetEndPai(modTask.StartRoadway.Substring(1, 2), modTask.StartLocate.Substring(2, 2), |
| | | modTask.StartLocate.Substring(0, 2), modTask.StartLocate.Substring(4, 2), |
| | | modTask.StartLocate.Substring(6, 2)); |
| | | |
| | |
| | | if (listResult.All(s => s.IsSucceed)) |
| | | { |
| | | // 写入跺机任务下发完成 |
| | | plcConn.SetPlcDBValue(modDevice.PosType, modDevice.DbNumber, modDevice.WcsPos, "830"); |
| | | var ret = plcConn.SetPlcDBValue(modDevice.PosType, modDevice.DbNumber, modDevice.WcsPos, "830"); |
| | | |
| | | // 将移库任务待执行改为正在执行 |
| | | _db.Updateable<WcsTask>() |
| | |
| | | var (res, val) = plcConn.GetPlcDBValue(PLCDataTypeEnum.String, modDevice.DbNumber, modPosTask.PlcPos); |
| | | |
| | | var modPosEndStation = modDevice.listStation.FirstOrDefault(m => m.Text == "目的工位"); |
| | | var (endStationRes, endStation) = plcConn.GetPlcDBValue(PLCDataTypeEnum.String, modDevice.DbNumber, modPosTask.PlcPos); |
| | | var (endStationRes, endStation) = plcConn.GetPlcDBValue(PLCDataTypeEnum.String, modDevice.DbNumber, modPosEndStation.PlcPos); |
| | | if (res.IsSucceed) |
| | | { |
| | | // 获取任务信息 |
| | |
| | | if (plcConveyorConn.Connected) |
| | | { |
| | | // 根据目标地址和巷道获取放货工位对应的排列层 |
| | | PlcTaskInfo taskInfo = PLCCommon.GetCTaskInfo(modTask.EndLocate, modTask.TaskType.ToString(), |
| | | PlcTaskInfo taskInfo = PLCCommon.GetCTaskInfo(modTask.EndLocate, ((int)modTask.TaskType).ToString(), |
| | | modTask.StartRoadway, modTask.EndRoadway); |
| | | // 根据工位号获取工位信息 |
| | | var wcsDevice = PLCTaskAction.plcDevices.First(s => s.PlcId == plcConveyorConn.PlcId && s.Level == DeviceLevelEnum.Station && s.StationNum == taskInfo.EndStation); |
| | |
| | | var listResult = new List<Result>(); |
| | | //任务号 |
| | | var modPosTask = listPos.FirstOrDefault(s => s.Text == "任务号"); |
| | | listResult.Add(plcConn.SetPlcDBValue(modPosTask.PosType, modDevice.DbNumber, modPosTask.PlcPos, modTask.TaskNo)); |
| | | listResult.Add(plcConveyorConn.SetPlcDBValue(modPosTask.PosType, wcsDevice.DbNumber, modPosTask.PlcPos, modTask.TaskNo)); |
| | | //任务类型 |
| | | var modPosTaskType = listPos.FirstOrDefault(s => s.Text == "任务类型"); |
| | | listResult.Add(plcConn.SetPlcDBValue(modPosTaskType.PosType, modDevice.DbNumber, modPosTaskType.PlcPos, ((int)modTask.TaskType).ToString())); |
| | | listResult.Add(plcConveyorConn.SetPlcDBValue(modPosTaskType.PosType, wcsDevice.DbNumber, modPosTaskType.PlcPos, ((int)modTask.TaskType).ToString())); |
| | | //托盘号 |
| | | var modPosPalletNo = listPos.FirstOrDefault(s => s.Text == "托盘码"); |
| | | listResult.Add(plcConn.SetPlcDBValue(modPosPalletNo.PosType, modDevice.DbNumber, modPosPalletNo.PlcPos, modTask.PalletNo)); |
| | | listResult.Add(plcConveyorConn.SetPlcDBValue(modPosPalletNo.PosType, wcsDevice.DbNumber, modPosPalletNo.PlcPos, modTask.PalletNo)); |
| | | //起始工位 |
| | | var modPosLocatNo = listPos.FirstOrDefault(s => s.Text == "起始工位"); |
| | | listResult.Add(plcConn.SetPlcDBValue(modPosLocatNo.PosType, modDevice.DbNumber, modPosLocatNo.PlcPos, taskInfo.EndStation)); |
| | | listResult.Add(plcConveyorConn.SetPlcDBValue(modPosLocatNo.PosType, wcsDevice.DbNumber, modPosLocatNo.PlcPos, taskInfo.EndStation)); |
| | | // 目标工位 |
| | | var modPosEndLocatNo = listPos.FirstOrDefault(s => s.Text == "目的工位"); |
| | | listResult.Add(plcConn.SetPlcDBValue(modPosEndLocatNo.PosType, modDevice.DbNumber, modPosEndLocatNo.PlcPos, outCode)); |
| | | listResult.Add(plcConveyorConn.SetPlcDBValue(modPosEndLocatNo.PosType, wcsDevice.DbNumber, modPosEndLocatNo.PlcPos, outCode)); |
| | | |
| | | // 是否写入成功 |
| | | if (listResult.All(s => s.IsSucceed)) |