| | |
| | | import com.zy.asrs.mapper.*; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.common.model.LocTypeDto; |
| | | import com.zy.common.model.MatDto; |
| | | import com.zy.common.model.SearchLocParam; |
| | | import com.zy.common.model.StartupDto; |
| | | import com.zy.common.model.*; |
| | | import com.zy.common.model.enums.WrkChargeType; |
| | | import com.zy.common.service.CommonService; |
| | | import com.zy.common.service.erp.ErpService; |
| | | import com.zy.common.utils.CollectionUtils; |
| | | import com.zy.common.utils.HttpHandler; |
| | | import com.zy.common.utils.*; |
| | | import com.zy.core.CrnThread; |
| | | import com.zy.core.DevpThread; |
| | | import com.zy.core.News; |
| | |
| | | import com.zy.core.model.*; |
| | | import com.zy.core.model.command.CrnCommand; |
| | | import com.zy.core.model.command.LedCommand; |
| | | import com.zy.core.model.command.ShuttleCommand; |
| | | import com.zy.core.model.command.SteCommand; |
| | | import com.zy.core.model.protocol.CrnProtocol; |
| | | import com.zy.core.model.protocol.ShuttleProtocol; |
| | | import com.zy.core.model.protocol.StaProtocol; |
| | | import com.zy.core.model.protocol.SteProtocol; |
| | | import com.zy.core.properties.SlaveProperties; |
| | | import com.zy.core.thread.BarcodeThread; |
| | | import com.zy.core.thread.LedThread; |
| | | import com.zy.core.thread.SiemensDevpThread; |
| | | import com.zy.core.thread.SteThread; |
| | | import com.zy.core.thread.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | |
| | | private OrderMapper orderMapper; |
| | | @Autowired |
| | | private OrderDetlMapper orderDetlMapper; |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | /** |
| | | * 组托 |
| | |
| | | staProtocol = staProtocol.clone(); |
| | | } |
| | | Short workNo = staProtocol.getWorkNo(); |
| | | // 尺寸检测异常 |
| | | boolean back = false; |
| | | String errMsg = "异常:"; |
| | | if (staProtocol.isFrontErr()) { |
| | | errMsg = errMsg+"前超限;"; |
| | | back = true; |
| | | } |
| | | if (staProtocol.isBackErr()) { |
| | | errMsg = errMsg+"后超限"; |
| | | back = true; |
| | | } |
| | | if (staProtocol.isHighErr()) { |
| | | errMsg = errMsg+"高超限"; |
| | | back = true; |
| | | } |
| | | if (staProtocol.isLeftErr()) { |
| | | errMsg = errMsg+"左超限"; |
| | | back = true; |
| | | } |
| | | if (staProtocol.isRightErr()) { |
| | | errMsg = errMsg+"右超限"; |
| | | back = true; |
| | | } |
| | | if (staProtocol.isWeightErr()) { |
| | | errMsg = errMsg+"超重"; |
| | | back = true; |
| | | } |
| | | if (staProtocol.isBarcodeErr()) { |
| | | errMsg = errMsg+"扫码失败"; |
| | | back = true; |
| | | } |
| | | // 退回 |
| | | if (back) { |
| | | // led 异常显示 |
| | | LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed()); |
| | | if (ledThread != null) { |
| | | MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errMsg)); |
| | | } |
| | | continue; |
| | | } |
| | | // 判断是否满足入库条件 |
| | | if (staProtocol.isAutoing() && staProtocol.isLoading() |
| | | && staProtocol.isInEnable() |
| | | && !staProtocol.isEmptyMk() && (workNo == 0 || (workNo >= 9990 && workNo <= 9999)) |
| | | && staProtocol.isPakMk()) { |
| | | |
| | | // 尺寸检测异常 |
| | | boolean back = false; |
| | | String errMsg = ""; |
| | | if (staProtocol.isFrontErr()) { |
| | | errMsg = "前超限"; |
| | | back = true; |
| | | } |
| | | if (!back && staProtocol.isBackErr()) { |
| | | errMsg = "后超限"; |
| | | back = true; |
| | | } |
| | | if (!back && staProtocol.isHighErr()) { |
| | | errMsg = "高超限"; |
| | | back = true; |
| | | } |
| | | if (!back && staProtocol.isLeftErr()) { |
| | | errMsg = "左超限"; |
| | | back = true; |
| | | } |
| | | if (!back && staProtocol.isRightErr()) { |
| | | errMsg = "右超限"; |
| | | back = true; |
| | | } |
| | | if (!back && staProtocol.isWeightErr()) { |
| | | errMsg = "超重"; |
| | | back = true; |
| | | } |
| | | if (!back && staProtocol.isBarcodeErr()) { |
| | | errMsg = "扫码失败"; |
| | | back = true; |
| | | } |
| | | |
| | | // 退回 |
| | | if (back) { |
| | | News.warn("扫码入库失败,{}入库站因{}异常,托盘已被退回", inSta.getStaNo(), errMsg); |
| | | staProtocol.setWorkNo((short) 32002); |
| | | staProtocol.setStaNo(inSta.getBackSta().shortValue()); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | |
| | | // led 异常显示 |
| | | LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed()); |
| | | if (ledThread != null) { |
| | | MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errMsg)); |
| | | } |
| | | continue; |
| | | } |
| | | |
| | | // 获取条码扫描仪信息 |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcode()); |
| | |
| | | String barcode = barcodeThread.getBarcode(); |
| | | if(!Cools.isEmpty(barcode)) { |
| | | // News.info("{}号条码扫描器检测条码信息:{}", inSta.getBarcode(), barcode); |
| | | if("NG".endsWith(barcode) || "NoRead".equals(barcode) || "empty".equals(barcode)) { |
| | | if("NG".endsWith(barcode) || "NoRead".equals(barcode) || "empty".equals(barcode)|| "00000000".equals(barcode)) { |
| | | staProtocol.setWorkNo((short) 32002); |
| | | staProtocol.setStaNo(inSta.getBackSta().shortValue()); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | |
| | | if (staProtocol.getWorkNo() > 0 && staProtocol.getWorkNo() < 9990) { |
| | | wrkMast = wrkMastMapper.selectPickStep(staProtocol.getWorkNo()); |
| | | if (null == wrkMast) { |
| | | News.error("{}任务号错误,暂无拣料任务!", staProtocol.getWorkNo()); |
| | | continue; |
| | | } |
| | | } else { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 入出库 ===>> 四向穿梭车入出库作业下发 |
| | | */ |
| | | public synchronized void shuttleIoExecute() { |
| | | for (ShuttleSlave shuttle : slaveProperties.getShuttle()) { |
| | | //获取四向穿梭车信息 |
| | | ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttle.getId()); |
| | | ShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol(); |
| | | if (shuttleProtocol == null) { |
| | | continue; |
| | | } |
| | | |
| | | // 只有当四向穿梭车空闲 并且无任务时才继续执行 |
| | | if (shuttleProtocol.getBusyStatusType() == ShuttleStatusType.IDLE && shuttleProtocol.getTaskNo() == 0) { |
| | | //入出库逻辑 |
| | | for (WrkMast wrkSts : wrkMastMapper.selectList(new EntityWrapper<WrkMast>().eq("wrk_sts", 2))) { |
| | | //分配任务号 |
| | | shuttleProtocol.setTaskNo(wrkSts.getWrkNo().shortValue()); |
| | | //分配源库位 |
| | | shuttleProtocol.setSourceLocNo(wrkSts.getSourceLocNo()); |
| | | //分配目标库位 |
| | | shuttleProtocol.setLocNo(wrkSts.getLocNo()); |
| | | |
| | | //计算路径 |
| | | List<NavigateNode> calc = NavigateUtils.calc(wrkSts.getSourceLocNo(), wrkSts.getLocNo(), "in"); |
| | | //获取分段路径 |
| | | ArrayList<ArrayList<NavigateNode>> data = NavigateUtils.getSectionPath(calc); |
| | | //将此map存入redis中 |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | //执行步序 |
| | | map.put("step", 0); |
| | | //路径数据 |
| | | map.put("path", data); |
| | | //工作号 |
| | | map.put("wrk_no", wrkSts.getWrkNo()); |
| | | //任务数据保存到redis |
| | | redisUtil.set("wrk_no_" + wrkSts.getWrkNo().shortValue(), JSON.toJSONString(map)); |
| | | } |
| | | |
| | | } else if (shuttleProtocol.getBusyStatusType() == ShuttleStatusType.IDLE && shuttleProtocol.getTaskNo() != 0) { |
| | | //四向穿梭车空闲 并且有任务 |
| | | Object o = redisUtil.get("wrk_no_" + shuttleProtocol.getTaskNo()); |
| | | HashMap map = JSON.parseObject(o.toString(), HashMap.class); |
| | | //当前步序 |
| | | int step = Integer.parseInt(map.get("step").toString()); |
| | | //当前路径数据 |
| | | Object data = map.get("path"); |
| | | ArrayList pathList = JSON.parseObject(data.toString(), ArrayList.class); |
| | | //取第一条路径 |
| | | Object o1 = pathList.get(step); |
| | | ArrayList path = JSON.parseObject(o1.toString(), ArrayList.class); |
| | | |
| | | int size = path.size(); |
| | | //开始路径 |
| | | JSONObject startPath = JSON.parseObject(path.get(0).toString()); |
| | | System.out.println(startPath); |
| | | //目标路径 |
| | | JSONObject endPath = JSON.parseObject(path.get(size - 1).toString()); |
| | | System.out.println(endPath); |
| | | |
| | | //下发命令 |
| | | ShuttleCommand command = new ShuttleCommand(); |
| | | command.setCommandWord((short) 1); |
| | | command.setStartCodeNum(NavigatePositionConvert.xyToPosition(startPath.getIntValue("x"), startPath.getIntValue("y"))); |
| | | command.setMiddleCodeNum((short) 0); |
| | | command.setDistCodeNum(NavigatePositionConvert.xyToPosition(endPath.getIntValue("x"), endPath.getIntValue("y"))); |
| | | command.setStartToDistDistance(1000); |
| | | command.setMiddleToDistDistance(1000); |
| | | command.setRunDirection(ShuttleRunDirection.get(startPath.get("direction").toString()).id); |
| | | command.setPalletLift((short) 1); |
| | | command.setForceMoveDistance(1000); |
| | | command.setChargeSwitch((short) 2); |
| | | command.setIOControl((short) 0); |
| | | command.setRunSpeed((short) 1000); |
| | | command.setRadarTmp((short) 0); |
| | | command.setCommandEnd((short) 1); |
| | | |
| | | if (!MessageQueue.offer(SlaveType.Shuttle, shuttleProtocol.getShuttleNo().intValue(), new Task(2, command))) { |
| | | News.error("四向穿梭车命令下发失败,穿梭车号={},任务数据={}", shuttleProtocol.getShuttleNo(), JSON.toJSON(command)); |
| | | } else { |
| | | News.info("四向穿梭车命令下发成功,穿梭车号={},任务数据={}", shuttleProtocol.getShuttleNo(), JSON.toJSON(command)); |
| | | |
| | | //判断数据是否执行完成 |
| | | if (step < size) { |
| | | //更新redis数据 |
| | | //步序增加 |
| | | step++; |
| | | map.put("step", step); |
| | | //任务数据保存到redis |
| | | redisUtil.set("wrk_no_" + map.get("wrk_no").toString(), JSON.toJSONString(map)); |
| | | }else { |
| | | //已执行完成 |
| | | //保存数据到数据库做流水 |
| | | //删除redis |
| | | redisUtil.del("wrk_no_" + map.get("wrk_no").toString()); |
| | | |
| | | //。。。 |
| | | //1、命令下方需要判断小车空闲状态 |
| | | //2、 |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 入出库 ===>> 堆垛机入出库作业下发 |
| | | */ |
| | | public synchronized void crnIoExecute(){ |
| | |
| | | continue; |
| | | } |
| | | |
| | | List<LocMast> locMasts = null; |
| | | boolean sign=false; |
| | | if (locMast.getRow1()>=5){ |
| | | locMasts=locMastService.selectList(new EntityWrapper<LocMast>().ge("row1", 5) |
| | | .eq("bay1",locMast.getBay1()).eq("lev1",locMast.getLev1())); |
| | | for (LocMast locMast1:locMasts){ |
| | | if (locMast1.getRow1()>locMast.getRow1()){ |
| | | if (!locMast1.getLocSts().equals("F") && !locMast1.getLocSts().equals("D")){ |
| | | if (!locMast1.getLocSts().equals("X")){ |
| | | sign=true; |
| | | break; |
| | | } |
| | | } |
| | | }else if (locMast1.getRow1()<locMast.getRow1()){ |
| | | if (locMast1.getLocSts().equals("F") || locMast1.getLocSts().equals("D")){ |
| | | News.error("当前工作档目标库位所在排前边存在货物!", wrkMast.getWrkNo()); |
| | | sign=true; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | }else { |
| | | locMasts=locMastService.selectList(new EntityWrapper<LocMast>().le("row1", 4) |
| | | .eq("bay1",locMast.getBay1()).eq("lev1",locMast.getLev1())); |
| | | for (LocMast locMast1:locMasts){ |
| | | if (locMast1.getRow1()>locMast.getRow1()){ |
| | | if (locMast1.getLocSts().equals("F") || locMast1.getLocSts().equals("D")){ |
| | | News.error("当前工作档目标库位所在排前边存在货物!", wrkMast.getWrkNo()); |
| | | sign=true; |
| | | break; |
| | | } |
| | | }else if (locMast1.getRow1()<locMast.getRow1()){ |
| | | if (!locMast1.getLocSts().equals("F") && !locMast1.getLocSts().equals("D")){ |
| | | if (!locMast1.getLocSts().equals("X")){ |
| | | sign=true; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (sign){ |
| | | continue; |
| | | } |
| | | |
| | | // 检测是否存在出库任务 |
| | | if (null != wrkMastMapper.selectPakout(slave.getId(), null)) { |
| | | News.error("{}入库任务无法作业,因存在出库中任务!", wrkMast.getWrkNo()); |
| | |
| | | } |
| | | |
| | | // 置顶任务 |
| | | wrkMast.setIoPri((double) 9999); |
| | | if (wrkMast.getIoPri()<8000){ |
| | | wrkMast.setIoPri(wrkMast.getIoPri()+9000d); |
| | | } |
| | | wrkMastMapper.updateById(wrkMast); |
| | | |
| | | // 目标库位 ===>> 最外层库位 |
| | |
| | | News.error("出库操作库位状态不符合--状态, 库位号={},库位状态={}", wrkMast.getLocNo(), sourceSta.getLocSts()); |
| | | continue; |
| | | } |
| | | List<LocMast> locMasts = null; |
| | | boolean sign=false; |
| | | if (sourceSta.getRow1()>=5){ |
| | | locMasts=locMastService.selectList(new EntityWrapper<LocMast>().ge("row1", 5) |
| | | .eq("bay1",sourceSta.getBay1()).eq("lev1",sourceSta.getLev1())); |
| | | for (LocMast locMast1:locMasts){ |
| | | if (locMast1.getRow1()<sourceSta.getRow1()){ |
| | | if (!locMast1.getLocSts().equals("O")){ |
| | | News.error("当前工作档源库位所在排前边存在货物!", wrkMast.getWrkNo()); |
| | | sign=true; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | }else { |
| | | locMasts=locMastService.selectList(new EntityWrapper<LocMast>().le("row1", 4) |
| | | .eq("bay1",sourceSta.getBay1()).eq("lev1",sourceSta.getLev1())); |
| | | for (LocMast locMast1:locMasts){ |
| | | if (locMast1.getRow1()>sourceSta.getRow1()){ |
| | | if (!locMast1.getLocSts().equals("O")){ |
| | | News.error("当前工作档目标库位所在排前边存在货物!", wrkMast.getWrkNo()); |
| | | sign=true; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (sign){ |
| | | continue; |
| | | } |
| | | |
| | | // 同库位组进行校验 |
| | | List<String> groupLocNo = Utils.getGroupLocNo(wrkMast.getSourceLocNo()); |
| | |
| | | } |
| | | |
| | | // 置顶任务 |
| | | wrkMast.setIoPri((double) 9998); |
| | | if (wrkMast.getIoPri()<8000){ |
| | | wrkMast.setIoPri(wrkMast.getIoPri()+8999d); |
| | | } |
| | | wrkMastMapper.updateById(wrkMast); |
| | | |
| | | // 最外层库位,直接堆垛机出库 |
| | |
| | | WrkCharge wrkCharge = wrkChargeService.selectById(crnProtocol.getTaskNo()); |
| | | if (wrkCharge == null) { |
| | | News.error("堆垛机处于等待确认且任务完成状态,但未找到工作档。堆垛机号={},工作号={}", crn.getId(), crnProtocol.getTaskNo()); |
| | | wrkMast = wrkMastMapper.selectCrnWaiting2(crnProtocol.getTaskNo().intValue()); |
| | | if (wrkMast.getIoType() != 11) { |
| | | // 修改成功后复位堆垛机 |
| | | if (wrkMastMapper.updateById(wrkMast) > 0) { |
| | | // 堆垛机复位 |
| | | crnThread.setResetFlag(true); |
| | | News.error("堆垛机处于等待确认且任务完成状态,复位,但未找到工作档。堆垛机号={},工作号={}", crn.getId(), crnProtocol.getTaskNo()); |
| | | } else { |
| | | News.error("堆垛机处于等待确认且任务完成状态,复位失败,但未找到工作档。堆垛机号={},工作号={}", crn.getId(), crnProtocol.getTaskNo()); |
| | | } |
| | | } |
| | | continue; |
| | | } else { |
| | | // 小车搬至指定库位完成 |
| | |
| | | break; |
| | | } |
| | | ledCommand.setSourceLocNo(wrkMast.getSourceLocNo()); |
| | | ledCommand.setLocNo(wrkMast.getLocNo()); |
| | | ledCommand.setStaNo(wrkMast.getStaNo()); |
| | | if (wrkMast.getIoType() != 110) { |
| | | if (wrkMast.getIoType() != 110 && wrkMast.getIoType() != 10) { |
| | | List<WrkDetl> wrkDetls = wrkDetlService.findByWorkNo(wrkMast.getWrkNo()); |
| | | try { |
| | | WrkDetl wrkDetl = wrkDetls.get(0); |
| | | if (!Cools.isEmpty(wrkDetl.getOrderNo())) { |
| | | OrderDetl orderDetl = orderDetlMapper.selectItemNoneOfBatch(wrkDetl.getOrderNo(), wrkDetl.getMatnr()); |
| | | ledCommand.getMatDtos().add(new MatDto(orderDetl)); |
| | | } |
| | | } catch (Exception e) { |
| | | News.error("led execute fail", e); |
| | | } |
| | | wrkDetls.forEach(wrkDetl -> ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getAnfme(),wrkDetl.getSpecs()))); |
| | | } |
| | | commands.add(ledCommand); |
| | | } |
| | |
| | | } |
| | | // 命令下发 ------------------------------------------------------------------------------- |
| | | if (!commands.isEmpty()) { |
| | | if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(1, commands))) { |
| | | News.error("{}号LED命令下发失败!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort()); |
| | | continue; |
| | | if (led.getId()>3){ |
| | | if (!MessageQueue.offer(SlaveType.Led, led.getId()-3, new Task(1, commands))) { |
| | | log.error("{}号LED命令下发失败!!![ip:{}] [port:{}]", led.getId()-3, led.getIp(), led.getPort()); |
| | | continue; |
| | | }else { |
| | | ledThread.setLedMk(false); |
| | | } |
| | | }else { |
| | | if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(1, commands))) { |
| | | log.error("{}号LED命令下发失败!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort()); |
| | | continue; |
| | | }else { |
| | | ledThread.setLedMk(false); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | public void ledReset() { |
| | | for (LedSlave led : slaveProperties.getLed()) { |
| | | |
| | | // 获取输送线plc线程 |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, led.getDevpPlcId()); |
| | | // 命令集合 |
| | | boolean reset = true; |
| | | for (Integer staNo : led.getStaArr()) { |
| | | // 获取叉车站点 |
| | | StaProtocol staProtocol = devpThread.getStation().get(staNo); |
| | | if (staProtocol == null) { |
| | | continue; |
| | | } |
| | | if (staProtocol.getWorkNo() != 0 && staProtocol.isLoading()) { |
| | | reset = false; |
| | | break; |
| | | } |
| | | } |
| | | // 获取led线程 |
| | | LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, led.getId()); |
| | | // led显示默认内容 |
| | | if (reset && !ledThread.isLedMk()) { |
| | | ledThread.setLedMk(true); |
| | | if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(4, new ArrayList<>()))) { |
| | | News.error(" - {}号LED命令下发失败!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort()); |
| | | } else { |
| | | |
| | | } |
| | | } |
| | | } |
| | | for (LedSlave led : slaveProperties.getLed()) { |
| | | // 获取输送线plc线程 |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, led.getDevpPlcId()); |
| | | // 命令集合 |
| | |
| | | } |
| | | } |
| | | // 获取led线程 |
| | | LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, led.getDevpPlcId()); |
| | | LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, led.getId()); |
| | | // led显示默认内容 |
| | | if (reset) { |
| | | if (reset && !ledThread.isLedMk()) { |
| | | ledThread.setLedMk(true); |
| | | if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(2, new ArrayList<>()))) { |
| | | News.error("{}号LED命令下发失败!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort()); |
| | | } |
| | |
| | | */ |
| | | @SuppressWarnings("serial") |
| | | public synchronized void loopSteCharge() { |
| | | if (!Cools.isEmpty(wrkMastMapper.selectAllC())){ |
| | | return; |
| | | } |
| | | if (null != wrkChargeService.selectWorking(null, WrkChargeType.reset)) { |
| | | return; |
| | | } |
| | |
| | | SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, 1); |
| | | SteProtocol steProtocol = steThread.getSteProtocol(); |
| | | if (null == wrkCharge) { |
| | | if (steProtocol.getChargeStatus()==(short)0 && steProtocol.isBrushConnect()){ |
| | | SteCommand steCommand = new SteCommand(); |
| | | steCommand.setSteNo(1); // 穿梭车编号 |
| | | steCommand.setTaskNo(10060); // 工作号 |
| | | steCommand.setTaskMode(SteTaskModeType.CLOSE_CHARGE); // 任务模式: 断开充电 |
| | | if (!MessageQueue.offer(SlaveType.Ste, 1, new Task(2, steCommand))) { |
| | | News.error("穿梭车命令下发失败,穿梭车号={},任务数据={}", wrkCharge.getSteNo(), JSON.toJSON(steCommand)); |
| | | try{ |
| | | if (steProtocol.getChargeStatus()==(short)0 && steProtocol.isBrushConnect()){ |
| | | SteCommand steCommand = new SteCommand(); |
| | | steCommand.setSteNo(1); // 穿梭车编号 |
| | | steCommand.setTaskNo(10060); // 工作号 |
| | | steCommand.setTaskMode(SteTaskModeType.CLOSE_CHARGE); // 任务模式: 断开充电 |
| | | if (!MessageQueue.offer(SlaveType.Ste, 1, new Task(2, steCommand))) { |
| | | News.error("穿梭车命令下发失败,穿梭车号={},任务数据={}", wrkCharge.getSteNo(), JSON.toJSON(steCommand)); |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | return; |
| | | } |
| | | return; |
| | | } |