| | |
| | | import com.zy.asrs.domain.enums.TaskStatusType; |
| | | import com.zy.asrs.entity.TaskWrk; |
| | | import com.zy.asrs.entity.ToWmsDTO; |
| | | import com.zy.asrs.entity.param.TaskOverParam; |
| | | import com.zy.asrs.entity.param.WMSAndAGVInterfaceParam; |
| | | import com.zy.asrs.entity.param.taskCreateParam; |
| | | import com.zy.asrs.service.OpenService; |
| | | import com.zy.asrs.service.TaskWrkService; |
| | | import com.zy.common.utils.HttpHandler; |
| | | import com.zy.core.DevpThread; |
| | | import com.zy.core.cache.MessageQueue; |
| | | import com.zy.core.cache.SlaveConnection; |
| | | import com.zy.core.enums.SlaveType; |
| | | import com.zy.core.model.DevpSlave; |
| | | import com.zy.core.model.Task; |
| | | import com.zy.core.model.protocol.StaProtocol; |
| | | import com.zy.core.properties.SlaveProperties; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | |
| | | @Autowired |
| | | private TaskWrkService taskWrkService; |
| | | @Autowired |
| | | private SlaveProperties slaveProperties; |
| | | |
| | | @Value("${wms.url}") |
| | | private String wmsUrl; |
| | | public ArrayList<String> wharfCode1 = new ArrayList<String>(){{ |
| | | add("J-1101"); add("J-1103"); add("J-1105"); add("J-1107"); add("J-1109"); add("J-1111"); |
| | | }}; |
| | | |
| | | @Override |
| | | public void taskCreate(taskCreateParam param) { |
| | |
| | | ToWmsDTO toWmsDTO = new ToWmsDTO(); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("x-api-key","7a15b5db-29b6-552c-8cff-0cfec3756da2"); |
| | | List<Integer> list = new ArrayList<>(); |
| | | list.add(1); |
| | | list.add(4); |
| | | List<Integer> list = getInEnableRoadway(); |
| | | |
| | | //TaskWrk taskWrk = taskWrkService.selectByTaskNo(param.getTaskNo()); |
| | | toWmsDTO.setWarehouseId("1688469798893297665"); |
| | | toWmsDTO.setContainerCode(param.getContainerCode()); |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void getAgvTaskOver(TaskOverParam param) { |
| | | Map<String,Integer> map = new HashMap<>(); |
| | | map.put("J-1101",102);map.put("J-1102",101); |
| | | map.put("J-1103",106);map.put("J-1104",105); |
| | | map.put("J-1105",110);map.put("J-1106",109); |
| | | map.put("J-1107",114);map.put("J-1108",113); |
| | | map.put("J-1109",118);map.put("J-1110",117); |
| | | map.put("J-1111",122);map.put("J-1112",121); |
| | | |
| | | // 根据输送线plc遍历 |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | | // 获取入库站信息 |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); |
| | | StaProtocol staProtocol = devpThread.getStation().get(map.get(param.getWharfCode())); |
| | | if (staProtocol == null) { |
| | | continue; |
| | | } else { |
| | | staProtocol = staProtocol.clone(); |
| | | } |
| | | Short workNo = staProtocol.getWorkNo(); |
| | | for (DevpSlave.Sta inSta : devp.getInSta()) { |
| | | if (inSta.getBackSta().equals(map.get(param.getWharfCode()))){ |
| | | if (wharfCode1.contains(param.getWharfCode())){ |
| | | if (!staProtocol.isLoading() && !staProtocol.isCar()){ |
| | | //AGV出库完成以后 |
| | | } |
| | | |
| | | }else { |
| | | if (staProtocol.isLoading() && !staProtocol.isCar() && workNo == 0){ |
| | | //AGV入库完成以后 |
| | | staProtocol.setWorkNo((short) 9998); |
| | | staProtocol.setStaNo(inSta.getStaNo().shortValue()); |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | if (result) { |
| | | |
| | | } else { |
| | | throw new RuntimeException("agv返回完成后,命令下发失败"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | public List<Integer> getInEnableRoadway(){ |
| | | int[] roadway = null; |
| | | List<Integer> list = new ArrayList<>(); |
| | | Map<Integer,Integer> map = new HashMap<>(); |
| | | map.put(103,1); |
| | | map.put(107,2); |
| | | map.put(111,3); |
| | | map.put(115,4); |
| | | map.put(119,5); |
| | | map.put(123,6); |
| | | map.put(300,7); |
| | | // 根据输送线plc遍历 |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | | // 遍历入库口 |
| | | for (DevpSlave.Sta inSta : devp.getInSta()) { |
| | | // 获取入库站信息 |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); |
| | | StaProtocol staProtocol = devpThread.getStation().get(inSta.getBackSta()); |
| | | if (staProtocol == null) { |
| | | continue; |
| | | } else { |
| | | staProtocol = staProtocol.clone(); |
| | | } |
| | | Short workNo = staProtocol.getWorkNo(); |
| | | if (workNo == 0 && !staProtocol.isLoading()){ |
| | | list.add(map.get(inSta.getStaNo())); |
| | | } |
| | | } |
| | | } |
| | | //roadway = list.stream().mapToInt(Integer::intValue).toArray(); |
| | | return list; |
| | | } |
| | | } |