| | |
| | | if (crnThread == null) { |
| | | return R.error("线程不存在"); |
| | | } |
| | | |
| | | CrnCommand command = crnThread.getPickAndPutCommand(sourceLocNo, targetLocNo, 9999, crnNo); |
| | | CrnCommand command = new CrnCommand(); |
| | | if (sourceLocNo.equals("1-1-1")){ |
| | | command = crnThread.getPickCommand(sourceLocNo, targetLocNo, 9999, crnNo); |
| | | }else if (targetLocNo.equals("1-1-1")){ |
| | | command = crnThread.getPutCommand(sourceLocNo, targetLocNo, 9999, crnNo); |
| | | }else { |
| | | command = crnThread.getPickAndPutCommand(sourceLocNo, targetLocNo, 9999, crnNo); |
| | | } |
| | | MessageQueue.offer(SlaveType.Crn, crnNo, new Task(2, command)); |
| | | return R.ok(); |
| | | } |
| | |
| | | //通知成功 |
| | | redisUtil.del(key); |
| | | |
| | | httpRequestLog.setResult(1); |
| | | |
| | | continue; |
| | | } |
| | | }catch (Exception e){ |
| | |
| | | dto.setSuperTaskNo(superTaskNo); |
| | | |
| | | //重试次数 |
| | | Config notifyFailTimesConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "notifyFailTimes")); |
| | | Config notifyFailTimesConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "notifyRetryTimes")); |
| | | if (notifyFailTimesConfig != null) { |
| | | dto.setFailTimes(Integer.parseInt(notifyFailTimesConfig.getValue())); |
| | | } |
| | |
| | | .eq("status", 1); |
| | | |
| | | if (currentCircleTaskCrnNo != null) { |
| | | currentCircleTaskCrnNo = currentCircleTaskCrnNo + 1; |
| | | // currentCircleTaskCrnNo = currentCircleTaskCrnNo + 1; |
| | | BasCrnp basCrnp = basCrnpService.selectOne(new EntityWrapper<BasCrnp>().eq("crn_no", currentCircleTaskCrnNo)); |
| | | List<WrkMast> currentCrnTask = wrkMastService.selectList(new EntityWrapper<WrkMast>().eq("crn_no", currentCircleTaskCrnNo)); |
| | | if (currentCrnTask.size() <= 1) { |
| | |
| | | public enum CrnTaskModeType { |
| | | |
| | | NONE(0), // 无 |
| | | PAKIN(1), // 入库 |
| | | PAKOUT(2), // 出库 |
| | | PAKIN(1), // 出库 |
| | | PAKOUT(2), // 入库 |
| | | LOC_MOVE(3), // 库位移转 |
| | | X_MOVE(4), // 站位移转 |
| | | Y_MOVE(5), // 站位移转 |
| | |
| | | OperateResultExOne<byte[]> commandReadResult = siemensNet.Read("DB100.0", (short) 2); |
| | | if (commandReadResult.IsSuccess) { |
| | | short commandRead = siemensNet.getByteTransform().TransInt16(commandReadResult.Content, 0); |
| | | if (commandRead == 1) { |
| | | if (commandRead == 1 || commandRead == 2) { |
| | | Thread.sleep(500); |
| | | }else { |
| | | commandResult = true; |
| | | } |
| | | } |
| | | } while (writeAck < 5); |
| | | }while (commandResult); |
| | | // while (writeAck < 5); |
| | | |
| | | if (!commandResult) { |
| | | if (commandResult) { |
| | | response.setMessage("堆垛机命令下发[id:{}] >>>>> {}" + command.getCrnNo() + "任务状态位异常"); |
| | | return response; |
| | | } |
| | |
| | | import com.zy.core.network.api.ZyStationConnectApi; |
| | | import com.zy.core.network.entity.ZyStationStatusEntity; |
| | | import java.util.Collections; |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | |
| | | import java.text.MessageFormat; |
| | |
| | | |
| | | private List<ZyStationStatusEntity> statusList; |
| | | private List<ZyStationStatusEntity> barcodeStatusList; |
| | | private List<ZyStationStatusEntity> scaleStatusList; |
| | | private SiemensS7Net siemensNet; |
| | | private DeviceConfig deviceConfig; |
| | | private RedisUtil redisUtil; |
| | |
| | | } |
| | | |
| | | statusList = JSONObject.parseArray(basDevp.getStationList(), ZyStationStatusEntity.class); |
| | | if (statusList != null) { |
| | | statusList.sort(Comparator.comparing(ZyStationStatusEntity::getStationId)); |
| | | } |
| | | barcodeStatusList = JSONObject.parseArray(basDevp.getBarcodeStationList(), ZyStationStatusEntity.class); |
| | | } |
| | | |
| | | OperateResultExOne<byte[]> result = siemensNet.Read("DB101.0", (short) (statusList.size() * 2)); |
| | | OperateResultExOne<byte[]> result = siemensNet.Read("DB100.0", (short) (statusList.size() * 8)); |
| | | if (result.IsSuccess) { |
| | | for (int i = 0; i < statusList.size(); i++) { |
| | | ZyStationStatusEntity statusEntity = statusList.get(i); // 站点编号 |
| | | boolean[] status = siemensNet.getByteTransform().TransBool(result.Content, i * 2, 2); |
| | | boolean[] status = siemensNet.getByteTransform().TransBool(result.Content, i * 8 + 6, 2); |
| | | statusEntity.setAutoing(status[0]); // 自动 |
| | | statusEntity.setLoading(status[1]); // 有物 |
| | | statusEntity.setInEnable(status[2]); // 可入 |
| | | statusEntity.setOutEnable(status[3]);// 可出 |
| | | statusEntity.setEmptyMk(status[4]); // 空板信号 |
| | | statusEntity.setFullPlt(status[5]); // 满托盘 |
| | | } |
| | | } |
| | | |
| | | OperateResultExOne<byte[]> result1 = siemensNet.Read("DB100.0", (short) (statusList.size() * 4)); |
| | | if (result1.IsSuccess) { |
| | | for (int i = 0; i < statusList.size(); i++) { |
| | | ZyStationStatusEntity statusEntity = statusList.get(i); |
| | | statusEntity.setTaskNo((int) siemensNet.getByteTransform().TransInt16(result1.Content, i * 4)); // 工作号 |
| | | statusEntity.setTargetStaNo((int) siemensNet.getByteTransform().TransInt16(result1.Content, i * 4 + 2)); // 目标站 |
| | | statusEntity.setTaskNo(siemensNet.getByteTransform().TransInt32(result.Content, i * 8)); // 工作号 |
| | | statusEntity.setTargetStaNo((int) siemensNet.getByteTransform().TransInt16(result.Content, i * 8 + 4)); // 目标站 |
| | | } |
| | | } |
| | | |
| | | // 条码扫描器 |
| | | OperateResultExOne<byte[]> result2 = siemensNet.Read("DB101.100", (short) (statusList.size() * 10)); |
| | | OperateResultExOne<byte[]> result2 = siemensNet.Read("DB101.0", (short) (barcodeStatusList.size() * 16)); |
| | | if (result2.IsSuccess) { |
| | | for (int i = 0; i < barcodeStatusList.size(); i++) { |
| | | ZyStationStatusEntity barcodeEntity = barcodeStatusList.get(i); |
| | |
| | | if (statusEntity == null) { |
| | | continue; |
| | | } |
| | | String barcode = siemensNet.getByteTransform().TransString(result2.Content, i * 10 + 2, 8, "UTF-8"); |
| | | String barcode = siemensNet.getByteTransform().TransString(result2.Content, i * 16, 4, "UTF-8"); |
| | | barcode = barcode.trim(); |
| | | barcodeEntity.setBarcode(barcode); |
| | | } |
| | |
| | | updateWrkSts = WrkStsType.OUTBOUND_RUN_COMPLETE.sts; |
| | | |
| | | //生成仿真站点数据 |
| | | List<StationObjModel> outStationList = basCrnp.getOutStationList$(); |
| | | if(outStationList.isEmpty()){ |
| | | News.info("堆垛机:{} 出库站点未设置", basCrnp.getCrnNo()); |
| | | continue; |
| | | } |
| | | |
| | | for (StationObjModel stationObjModel : outStationList) { |
| | | if (!stationObjModel.getStationId().equals(wrkMast.getSourceStaNo())) { |
| | | continue; |
| | | } |
| | | |
| | | StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, stationObjModel.getDeviceNo()); |
| | | if (stationThread == null) { |
| | | continue; |
| | | } |
| | | // List<StationObjModel> outStationList = basCrnp.getOutStationList$(); |
| | | // if(outStationList.isEmpty()){ |
| | | // News.info("堆垛机:{} 出库站点未设置", basCrnp.getCrnNo()); |
| | | // continue; |
| | | // } |
| | | // |
| | | // for (StationObjModel stationObjModel : outStationList) { |
| | | // if (!stationObjModel.getStationId().equals(wrkMast.getSourceStaNo())) { |
| | | // continue; |
| | | // } |
| | | // |
| | | // StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, stationObjModel.getDeviceNo()); |
| | | // if (stationThread == null) { |
| | | // continue; |
| | | // } |
| | | //生成仿真站点数据 |
| | | StationCommand command = stationThread.getMoveCommand(9998, wrkMast.getSourceStaNo(), 0, 0); |
| | | MessageQueue.offer(SlaveType.Devp, stationObjModel.getDeviceNo(), new Task(2, command)); |
| | | } |
| | | // StationCommand command = stationThread.getMoveCommand(9998, wrkMast.getSourceStaNo(), 0, 0); |
| | | // MessageQueue.offer(SlaveType.Devp, stationObjModel.getDeviceNo(), new Task(2, command)); |
| | | // } |
| | | }else if(wrkMast.getWrkSts() == WrkStsType.LOC_MOVE_RUN.sts){ |
| | | updateWrkSts = WrkStsType.COMPLETE_LOC_MOVE.sts; |
| | | }else{ |
| | |
| | | |
| | | CommandResponse sendCommand(CrnCommand command);//下发命令 |
| | | |
| | | CrnCommand getPickCommand(String sourceLocNo, String locNo, Integer wrkNo, Integer crnNo); |
| | | |
| | | CrnCommand getPutCommand(String sourceLocNo, String targetLocNo, Integer wrkNo, Integer crnNo); |
| | | } |
| | |
| | | return crnCommand; |
| | | } |
| | | |
| | | //入库 |
| | | @Override |
| | | public CrnCommand getPickCommand(String sourceLocNo, String targetLocNo, Integer taskNo, Integer crnNo) { |
| | | CrnCommand crnCommand = new CrnCommand(); |
| | | crnCommand.setCrnNo(crnNo); // 堆垛机编号 |
| | | crnCommand.setTaskNo(taskNo.shortValue()); // 工作号 |
| | | crnCommand.setTaskMode(CrnTaskModeType.PAKOUT.id.shortValue()); // 任务模式: 针对亿日进行修改 |
| | | crnCommand.setSourcePosX((short) Utils.getRow(sourceLocNo)); // 源库位排 |
| | | crnCommand.setSourcePosY((short) Utils.getBay(sourceLocNo)); // 源库位列 |
| | | crnCommand.setSourcePosZ((short) Utils.getLev(sourceLocNo)); // 源库位层 |
| | | crnCommand.setDestinationPosX((short) Utils.getRow(targetLocNo)); // 目标库位排 |
| | | crnCommand.setDestinationPosY((short) Utils.getBay(targetLocNo)); // 目标库位列 |
| | | crnCommand.setDestinationPosZ((short) Utils.getLev(targetLocNo)); // 目标库位层 |
| | | crnCommand.setCommand((short) 1); // 任务确认 |
| | | return crnCommand; |
| | | } |
| | | |
| | | //出库 |
| | | @Override |
| | | public CrnCommand getPutCommand(String sourceLocNo, String targetLocNo, Integer taskNo, Integer crnNo) { |
| | | CrnCommand crnCommand = new CrnCommand(); |
| | | crnCommand.setCrnNo(crnNo); // 堆垛机编号 |
| | | crnCommand.setTaskNo(taskNo.shortValue()); // 工作号 |
| | | crnCommand.setTaskMode(CrnTaskModeType.PAKIN.id.shortValue()); // 任务模式: 针对亿日进行修改 |
| | | crnCommand.setSourcePosX((short) Utils.getRow(sourceLocNo)); // 源库位排 |
| | | crnCommand.setSourcePosY((short) Utils.getBay(sourceLocNo)); // 源库位列 |
| | | crnCommand.setSourcePosZ((short) Utils.getLev(sourceLocNo)); // 源库位层 |
| | | crnCommand.setDestinationPosX((short) Utils.getRow(targetLocNo)); // 目标库位排 |
| | | crnCommand.setDestinationPosY((short) Utils.getBay(targetLocNo)); // 目标库位列 |
| | | crnCommand.setDestinationPosZ((short) Utils.getLev(targetLocNo)); // 目标库位层 |
| | | crnCommand.setCommand((short) 1); // 任务确认 |
| | | return crnCommand; |
| | | } |
| | | |
| | | @Override |
| | | public CrnCommand getMoveCommand(String targetLocNo, Integer taskNo, Integer crnNo) { |
| | | CrnCommand crnCommand = new CrnCommand(); |
| | |
| | | |
| | | String sourceLocNo = Utils.getLocNo(stationObjModel.getDeviceRow(), stationObjModel.getDeviceBay(), stationObjModel.getDeviceLev()); |
| | | |
| | | CrnCommand command = crnThread.getPickAndPutCommand(sourceLocNo, wrkMast.getLocNo(), wrkMast.getWrkNo(), crnNo); |
| | | // CrnCommand command = crnThread.getPickAndPutCommand(sourceLocNo, wrkMast.getLocNo(), wrkMast.getWrkNo(), crnNo); |
| | | CrnCommand command = crnThread.getPickCommand(sourceLocNo, wrkMast.getLocNo(), wrkMast.getWrkNo(), crnNo); |
| | | |
| | | |
| | | wrkMast.setWrkSts(WrkStsType.INBOUND_RUN.sts); |
| | | wrkMast.setCrnNo(crnNo); |
| | |
| | | |
| | | String targetLocNo = Utils.getLocNo(stationObjModel.getDeviceRow(), stationObjModel.getDeviceBay(), stationObjModel.getDeviceLev()); |
| | | |
| | | CrnCommand command = crnThread.getPickAndPutCommand(wrkMast.getSourceLocNo(), targetLocNo, wrkMast.getWrkNo(), crnNo); |
| | | // CrnCommand command = crnThread.getPickAndPutCommand(wrkMast.getSourceLocNo(), targetLocNo, wrkMast.getWrkNo(), crnNo); |
| | | CrnCommand command = crnThread.getPutCommand(wrkMast.getSourceLocNo(), targetLocNo, wrkMast.getWrkNo(), crnNo); |
| | | |
| | | wrkMast.setWrkSts(WrkStsType.OUTBOUND_RUN.sts); |
| | | wrkMast.setCrnNo(crnNo); |
| | |
| | | validation-timeout: 3000 |
| | | connection-test-query: select 1 |
| | | driver-class-name: com.mysql.jdbc.Driver |
| | | url: jdbc:mysql://127.0.0.1:3306/wcs?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai |
| | | url: jdbc:mysql://127.0.0.1:3306/yrwcs?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai |
| | | username: root |
| | | password: root |
| | | mvc: |
| | |
| | | |
| | | #License相关配置 |
| | | license: |
| | | subject: crnWcsDev |
| | | subject: yrwcs |
| | | publicAlias: publicCert |
| | | storePass: public_zhongyang_123456789 |
| | | licensePath: license.lic |