| | |
| | | */ |
| | | @RequestMapping("/task/sync/v1") |
| | | public R taskSync(@RequestBody TaskReportParam param) { |
| | | if (param == null || param.getSeqNum() == null || param.getQrCode() == null) { |
| | | if (param == null || param.getSeqNum() == null) { |
| | | return R.error("参数为空"); |
| | | } |
| | | if ((param.getQrCode().equals("00001547") || param.getQrCode().equals("1001")) && param.getTaskSts() == 15) { |
| | | if (param.getTaskSts() == 15 && (param.getQrCode().equals("00001547") || param.getQrCode().equals("1001"))) { |
| | | log.info("1001任务状态上报接收:{}", param); |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, 1); |
| | | Map<Integer, StaProtocol> station = devpThread.getStation(); |
| | |
| | | } else { |
| | | staProtocol = staProtocol.clone(); |
| | | } |
| | | if (!staProtocol.isLoading()) { |
| | | return R.error("站点无物"); |
| | | } |
| | | Random rand = new Random(); |
| | | staProtocol.setWorkNo(rand.nextInt(1000)); |
| | | staProtocol.setStaNo((short) 1004); |
| | |
| | | if (result) { |
| | | log.info("下发成功:{},{}", staProtocol.getWorkNo(), 1004); |
| | | } |
| | | } else if (param.getQrCode().equals("00001612") && param.getTaskSts() == 5) { |
| | | } else if (param.getTaskSts() == 5) { |
| | | log.info("1007任务状态上报接收:{}", param); |
| | | |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, 1); |
| | | Map<Integer, StaProtocol> station = devpThread.getStation(); |
| | | StaProtocol staProtocol = station.get(1007); |
| | | if (staProtocol == null) { |
| | | return R.error("未找到站点"); |
| | | } else { |
| | | staProtocol = staProtocol.clone(); |
| | | } |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, 1, new Task(3, staProtocol)); |
| | | if (result) { |
| | | log.info("下发成功:{},{}", staProtocol.getWorkNo(), 1007); |
| | | } |
| | | } |
| | | return R.ok(); |
| | | } |
| | |
| | | import com.zy.asrs.entity.BasRgv; |
| | | import com.zy.asrs.service.BasDevpService; |
| | | import com.zy.asrs.service.BasRgvService; |
| | | import com.zy.asrs.service.impl.CtuMainServiceImpl; |
| | | import com.zy.core.cache.MessageQueue; |
| | | import com.zy.core.cache.OutputQueue; |
| | | import com.zy.core.cache.SlaveConnection; |
| | |
| | | @Autowired |
| | | private BasRgvService basRgvService; |
| | | |
| | | |
| | | |
| | | @GetMapping("/io/mode/info/site") |
| | | @ManagerAuth(memo = "入出库模式") |
| | | public R ioMode(){ |
| | |
| | | |
| | | private boolean flag1007 = false; |
| | | |
| | | private Map<Integer, Long> staNoSet = new HashMap<>(); |
| | | |
| | | public Map<Integer, Long> getStaNoSet() { |
| | | return staNoSet; |
| | | } |
| | | |
| | | public void setStaNoSet(Map<Integer, Long> staNoSet) { |
| | | this.staNoSet = staNoSet; |
| | | } |
| | | |
| | | /** |
| | | * 入库,从拣料站到入库站(CTU取货站) |
| | | */ |
| | | public synchronized void generateStoreWrkFile(Integer mark) { |
| | | for (Map.Entry<Integer, Long> entry : staNoSet.entrySet()) { |
| | | if (entry.getValue() != null && System.currentTimeMillis() - entry.getValue() > 1000 * 60 * 5) { |
| | | log.info("超时:{}", entry.getKey()); |
| | | staNoSet.remove(entry.getKey()); |
| | | } |
| | | } |
| | | // 根据输送线plc遍历 |
| | | SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 1); |
| | | StaProtocol staProtocol = devpThread.getStation().get(1004); |
| | |
| | | staProtocol = staProtocol.clone(); |
| | | } |
| | | // 判断是否满足条件 |
| | | // if (!staProtocol.isLoading()) { |
| | | // return; |
| | | // } |
| | | if (!staProtocol.isLoading()) { |
| | | return; |
| | | } |
| | | Long i = staNoSet.get(staProtocol.getWorkNo()); |
| | | if (i != null) { |
| | | return; |
| | | } |
| | | // && staProtocol.isInEnable() |
| | | if (staProtocol.getWorkNo() > 0 && staProtocol.isAutoing() && !staProtocol.isEmptyMk() && staProtocol.isPakMk()) { |
| | | if (staProtocol.getStaNo() == 1004) { |
| | |
| | | } |
| | | staProtocol.setStaNo((short) 1007); |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, 1, new Task(2, staProtocol)); |
| | | staNoSet.put(staProtocol.getWorkNo(), System.currentTimeMillis()); |
| | | log.info("入库输送线下发:{},{}", staProtocol.getWorkNo(), 1007); |
| | | |
| | | } |
| | |
| | | } |
| | | SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 1); |
| | | StaProtocol staProtocol = devpThread.getStation().get(1001); |
| | | if (i >= 6) { |
| | | if (i >= 7) { |
| | | OpenBusSubmitParam openBusSubmitParam = new OpenBusSubmitParam(); |
| | | openBusSubmitParam.setBatch(DateUtils.convert(new Date())); |
| | | List<TaskDto> taskList = new ArrayList<>(); |
| | |
| | | |
| | | |
| | | //1001自动出 |
| | | //ctuMainService.autoOut(4); |
| | | ctuMainService.autoOut(4); |
| | | |
| | | //1007自动入 |
| | | //ctuMainService.autoIn(5); |
| | | ctuMainService.autoIn(5); |
| | | |
| | | //ctuMainService.updateSta(6); |
| | | |
| | |
| | | // 写数据 ID+目标站 |
| | | case 2: |
| | | write((StaProtocol) task.getData()); |
| | | log.error("输送线下发命令:" + ((StaProtocol) task.getData()).getWorkNo() + "," + ((StaProtocol) task.getData()).getStaNo()); |
| | | log.info("输送线下发命令:" + ((StaProtocol) task.getData()).getWorkNo() + "," + ((StaProtocol) task.getData()).getStaNo()); |
| | | break; |
| | | // 写数据 ID+目标站 |
| | | case 3: |
| | | write2((StaProtocol) task.getData()); |
| | | log.error("输送线下发命令:" + ((StaProtocol) task.getData()).getWorkNo() + "," + ((StaProtocol) task.getData()).getStaNo()); |
| | | log.info("输送线下发命令3:"); |
| | | break; |
| | | case 4: |
| | | write4((StaProtocol) task.getData()); |
| | | log.info("输送线下发命令4:"); |
| | | break; |
| | | default: |
| | | break; |
| | |
| | | if (!staProtocol.isPakMk() && !staProtocol.isLoading()) { |
| | | staProtocol.setPakMk(true); |
| | | } |
| | | } |
| | | } |
| | | |
| | | OperateResultExOne<byte[]> result4 = siemensS7Net.Read("DB102.0", (short) 2); |
| | | if (result4.IsSuccess) { |
| | | boolean[] status = siemensS7Net.getByteTransform().TransBool(result4.Content, 0, 1); |
| | | if (status[0] && status[1]) { |
| | | StaProtocol staProtocol = station.get(1007); |
| | | MessageQueue.offer(SlaveType.Devp, 1, new Task(4, staProtocol)); |
| | | log.info("复位1007"); |
| | | } |
| | | } |
| | | |
| | |
| | | do { |
| | | write = siemensS7Net.Write("DB102.0", array); |
| | | if (write.IsSuccess) { |
| | | log.error("写入输送线命令成功。输送线plc编号={},站点数据={},写入次数={}", slave.getId(), JSON.toJSON(staProtocol), writeCount); |
| | | log.error("写入输送线DB102.0命令成功3。输送线plc编号={},站点数据={},写入次数={}", slave.getId(), JSON.toJSON(staProtocol), writeCount); |
| | | break; |
| | | } else { |
| | | writeCount++; |
| | |
| | | } |
| | | } |
| | | |
| | | private void write4(StaProtocol staProtocol) throws InterruptedException { |
| | | if (null == staProtocol) { |
| | | return; |
| | | } |
| | | OperateResult write = null; |
| | | boolean[] array = new boolean[2]; |
| | | array[0] = false; |
| | | array[1] = false; |
| | | //任务下发次数 |
| | | int writeCount = 0; |
| | | do { |
| | | write = siemensS7Net.Write("DB102.0", array); |
| | | if (write.IsSuccess) { |
| | | log.error("44写入输送线DB102.0命令成功3。输送线plc编号={},站点数据={},写入次数={}", slave.getId(), JSON.toJSON(staProtocol), writeCount); |
| | | break; |
| | | } else { |
| | | writeCount++; |
| | | log.error("44写入输送线命令失败。输送线plc编号={},站点数据={},写入次数={}", slave.getId(), JSON.toJSON(staProtocol), writeCount); |
| | | } |
| | | } while (writeCount < 5); |
| | | |
| | | if (!write.IsSuccess) { |
| | | News.error("SiemensDevp" + " - 4" + " - 写入输送线站点数据失败。输送线plc编号={},站点数据={}", slave.getId(), JSON.toJSON(staProtocol)); |
| | | } |
| | | } |
| | | |
| | | // 更新入出库模式 |
| | | private void updateIoMode() throws InterruptedException { |
| | | if (this.ioModeOf2F != IoModeType.NONE) { |
| | |
| | | <div class="sidebar"> |
| | | <div class="nav"> |
| | | <ul class="cl-effect-4"> |
| | | <li><a id="console" onclick="nav(this.id)" class="nav-select" href="#">主控图</a></li> |
| | | <li><a id="pipeline" onclick="nav(this.id)" class="nav-unselect" href="#">输送设备</a></li> |
| | | |
| | | <li><a id="pipeline" onclick="nav(this.id)" class="nav-select" href="#">输送设备</a></li> |
| | | <li><a id="console" onclick="nav(this.id)" class="nav-unselect" href="#">主控图</a></li> |
| | | <li><a id="crn" onclick="nav(this.id)" class="nav-unselect" href="#">堆垛机</a></li> |
| | | <li><a id="rgv" onclick="nav(this.id)" class="nav-unselect" href="#">RGV</a></li> |
| | | </ul> |