| | |
| | | |
| | | <build> |
| | | <!-- <finalName>rqdzwcs</finalName>--> |
| | | <finalName>czkhwcs</finalName> |
| | | <finalName>wcs</finalName> |
| | | <plugins> |
| | | <plugin> |
| | | <groupId>org.springframework.boot</groupId> |
| | |
| | | import com.zy.asrs.service.LocMastService; |
| | | import com.zy.asrs.service.WrkMastService; |
| | | import com.zy.asrs.service.impl.MainServiceImpl; |
| | | import com.zy.asrs.utils.VersionUtils; |
| | | import com.zy.core.CrnThread; |
| | | import com.zy.core.cache.MessageQueue; |
| | | import com.zy.core.cache.OutputQueue; |
| | |
| | | import com.zy.core.model.protocol.CrnProtocol; |
| | | import com.zy.core.properties.SlaveProperties; |
| | | import com.zy.core.properties.SystemProperties; |
| | | import com.zy.core.thread.RgvThread; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | |
| | | |
| | | @ManagerAuth(memo = "进行中的命令") |
| | | @PostMapping("/command/ongoing") |
| | | public R ongoingCommand(){ |
| | | public R ongoingCommand() { |
| | | List<CommandLogVo> list = new ArrayList<>(); |
| | | for (CrnSlave crn : slaveProperties.getCrn()) { |
| | | CommandLogVo vo = new CommandLogVo(); |
| | |
| | | vo.setStatus(1); // 状态 |
| | | Task task = MessageQueue.peek(SlaveType.Crn, crn.getId()); |
| | | if (task != null) { |
| | | vo.setCommand(JSON.toJSONString((CrnCommand)task.getData())); |
| | | vo.setCommand(JSON.toJSONString((CrnCommand) task.getData())); |
| | | } |
| | | } |
| | | return R.ok().add(list); |
| | |
| | | |
| | | @PostMapping("/table/crn/state") |
| | | @ManagerAuth(memo = "堆垛机信息表") |
| | | public R crnStateTable(){ |
| | | public R crnStateTable() { |
| | | List<CrnStateTableVo> list = new ArrayList<>(); |
| | | List<BasCrnp> crnps = basCrnpService.selectList(new EntityWrapper<BasCrnp>().orderBy("crn_no")); |
| | | for (BasCrnp basCrnp : crnps) { |
| | |
| | | vo.setWorkNo(crnProtocol.getTaskNo()); // 任务号 |
| | | vo.setStatusType(crnProtocol.modeType.desc); // 模式状态 |
| | | vo.setStatus(crnProtocol.getStatusType().desc); // 状态 |
| | | vo.setLoading(crnProtocol.getLoaded()==1?"有物":"无物"); // 有物 |
| | | vo.setLoading(crnProtocol.getLoaded() == 1 ? "有物" : "无物"); // 有物 |
| | | vo.setLoadTwoing(crnProtocol.getLoadedTwo() == 1 ? "有物" : "无物"); // 有物 |
| | | |
| | | vo.setBay(crnProtocol.getBay()); // 列 |
| | | vo.setLev(crnProtocol.getLevel()); // 层 |
| | | |
| | | vo.setForkOffset(crnProtocol.getForkPosType().desc); // 货叉位置 |
| | | vo.setLiftPos(crnProtocol.getLiftPosType().desc); |
| | | vo.setWalkPos(crnProtocol.getWalkPos()==1?"不在定位":"在定位"); |
| | | if(crnProtocol.getAlarm() == 10){ |
| | | vo.setWalkPos(crnProtocol.getWalkPos() == 1 ? "不在定位" : "在定位"); |
| | | if (crnProtocol.getAlarm() == 10) { |
| | | crnProtocol.setAlarm((short) 0); |
| | | } |
| | | vo.setWarnCode(String.valueOf(crnProtocol.getAlarm())); |
| | | if (crnProtocol.getAlarm() > 0) { |
| | | BasCrnError crnError = basCrnErrorMapper.selectById(crnProtocol.getAlarm()); |
| | | vo.setAlarm(crnError==null?"未知异常":crnError.getErrName()); |
| | | vo.setAlarm(crnError == null ? "未知异常" : crnError.getErrName()); |
| | | } |
| | | } |
| | | return R.ok().add(list); |
| | |
| | | |
| | | @PostMapping("/table/crn/msg") |
| | | @ManagerAuth(memo = "堆垛机数据表") |
| | | public R crnMsgTable(){ |
| | | public R crnMsgTable() { |
| | | List<CrnMsgTableVo> list = new ArrayList<>(); |
| | | List<BasCrnp> crnps = basCrnpService.selectList(new EntityWrapper<BasCrnp>().orderBy("crn_no")); |
| | | for (BasCrnp basCrnp : crnps) { |
| | |
| | | } |
| | | |
| | | vo.setWorkNo(crnProtocol.getTaskNo()); // 任务号 |
| | | if (crnProtocol.getTaskNo()>0) { |
| | | if (crnProtocol.getTaskNo() > 0) { |
| | | WrkMast wrkMast = wrkMastService.selectById(crnProtocol.getTaskNo()); |
| | | if (wrkMast != null) { |
| | | vo.setStatus(CrnStatusType.process(wrkMast.getIoType()).getDesc()); // 模式状态 |
| | |
| | | vo.setLocNo(wrkMast.getLocNo()); // 目标库位 |
| | | } |
| | | } else { |
| | | vo.setStatus(crnProtocol.modeType.equals(CrnModeType.AUTO)? CrnStatusType.MACHINE_AUTO.getDesc(): CrnStatusType.MACHINE_UN_AUTO.getDesc()); // 模式状态 |
| | | vo.setStatus(crnProtocol.modeType.equals(CrnModeType.AUTO) ? CrnStatusType.MACHINE_AUTO.getDesc() : CrnStatusType.MACHINE_UN_AUTO.getDesc()); // 模式状态 |
| | | } |
| | | |
| | | if (crnProtocol.getTaskNoTwo() > 0) { |
| | | WrkMast wrkMast = wrkMastService.selectById(crnProtocol.getTaskNoTwo()); |
| | | if (wrkMast != null) { |
| | | vo.setSourceStaNo2(wrkMast.getSourceStaNo$()); // 源站 |
| | | vo.setStaNo2(wrkMast.getStaNo$()); // 目标站 |
| | | vo.setSourceLocNo2(wrkMast.getSourceLocNo()); // 源库位 |
| | | vo.setLocNo2(wrkMast.getLocNo()); // 目标库位 |
| | | } |
| | | } else { |
| | | vo.setStatus(crnProtocol.modeType.equals(CrnModeType.AUTO) ? CrnStatusType.MACHINE_AUTO.getDesc() : CrnStatusType.MACHINE_UN_AUTO.getDesc()); // 模式状态 |
| | | } |
| | | |
| | | vo.setXspeed(crnProtocol.getXSpeed()); // 走行速度(m/min) |
| | | vo.setYspeed(crnProtocol.getYSpeed()); // 升降速度(m/min) |
| | | vo.setZspeed(crnProtocol.getZSpeed()); // 叉牙速度(m/min) |
| | |
| | | |
| | | @PostMapping("/output/site") |
| | | @ManagerAuth(memo = "堆垛机报文日志输出") |
| | | public R crnOutput(){ |
| | | public R crnOutput() { |
| | | StringBuilder str = new StringBuilder(); |
| | | String s; |
| | | int i = 0; |
| | | while((s = OutputQueue.CRN.poll()) != null && i <=10) { |
| | | while ((s = OutputQueue.CRN.poll()) != null && i <= 10) { |
| | | str.append("\n").append(s); |
| | | i++; |
| | | } |
| | |
| | | |
| | | |
| | | @GetMapping("/demo/status") |
| | | public R demoStatus(){ |
| | | public R demoStatus() { |
| | | List<Map<String, Object>> res = new ArrayList<>(); |
| | | for (CrnSlave crnSlave : slaveProperties.getCrn()) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | |
| | | @PostMapping("/demo/switch") |
| | | @ManagerAuth(memo = "堆垛机演示") |
| | | public R crnDemo(CrnDemoParam param) throws InterruptedException { |
| | | if (Cools.isEmpty(param.getCrnId())){ |
| | | if (Cools.isEmpty(param.getCrnId())) { |
| | | return R.error(); |
| | | } |
| | | if (Cools.isEmpty(param.getPassword())){ |
| | | if (Cools.isEmpty(param.getPassword())) { |
| | | return R.error("请输入口令"); |
| | | } |
| | | if (!param.getPassword().equals(SystemProperties.WCS_PASSWORD)){ |
| | | if (!param.getPassword().equals(SystemProperties.WCS_PASSWORD)) { |
| | | return R.error("口令错误"); |
| | | } |
| | | Thread.sleep(200L); |
| | |
| | | // mainService.crnDemoOfLocMove(param.getCrnId()); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | /****************************************************************/ |
| | |
| | | // command.setTraySize(locSts); |
| | | // return crnControl(command)?R.ok():R.error(); |
| | | // } |
| | | |
| | | @ManagerAuth(memo = "库位转移") |
| | | @PostMapping("/operator/stockMove") |
| | | public R crnStockMove(CrnOperatorParam param){ |
| | | public R crnStockMove(CrnOperatorParam param) { |
| | | CrnCommand command = new CrnCommand(); |
| | | command.setCrnNo(param.getCrnNo()); // 堆垛机编号 |
| | | command.setTaskNo((short) 0); // 工作号 |
| | |
| | | .eq("bay1", command.getSourcePosY()).eq("lev1", command.getSourcePosZ())); |
| | | LocMast loc = locMastService.selectOne(new EntityWrapper<LocMast>().eq("row1", command.getDestinationPosX()) |
| | | .eq("bay1", command.getDestinationPosY()).eq("lev1", command.getDestinationPosZ())); |
| | | if (sourceLoc.getLocType1() != loc.getLocType1()){ |
| | | if (sourceLoc.getLocType1() != loc.getLocType1()) { |
| | | return R.error("库位类型不一致"); |
| | | } |
| | | command.setTraySize(loc.getLocType1() == 2); |
| | | // VersionUtils.locMoveCheckLocType(sourceLoc, loc); |
| | | return crnControl(command)?R.ok():R.error(); |
| | | return crnControl(command) ? R.ok() : R.error(); |
| | | } |
| | | |
| | | @ManagerAuth(memo = "站到站") |
| | | @PostMapping("/operator/siteMove") |
| | | public R crnSiteMove(CrnOperatorParam param){ |
| | | public R crnSiteMove(CrnOperatorParam param) { |
| | | CrnCommand command = new CrnCommand(); |
| | | command.setCrnNo(param.getCrnNo()); // 堆垛机编号 |
| | | command.setTaskNo((short) 0); // 工作号 |
| | |
| | | command.setDestinationPosX(param.getStaNo()); // 目标库位排 |
| | | command.setDestinationPosY((short) 0); // 目标库位列 |
| | | command.setDestinationPosZ((short) 1); // 目标库位层 |
| | | return crnControl(command)?R.ok():R.error(); |
| | | return crnControl(command) ? R.ok() : R.error(); |
| | | } |
| | | |
| | | @ManagerAuth(memo = "回原点") |
| | | @PostMapping("/operator/bacOrigin") |
| | | public R crnBacOrigin(CrnOperatorParam param){ |
| | | public R crnBacOrigin(CrnOperatorParam param) { |
| | | CrnCommand command = new CrnCommand(); |
| | | command.setCrnNo(param.getCrnNo()); // 堆垛机编号 |
| | | command.setTaskNo((short) 0); // 工作号 |
| | |
| | | command.setDestinationPosX((short) 0); // 目标库位排 |
| | | command.setDestinationPosY((short) 0); // 目标库位列 |
| | | command.setDestinationPosZ((short) 0); // 目标库位层 |
| | | return crnControl(command)?R.ok():R.error(); |
| | | return crnControl(command) ? R.ok() : R.error(); |
| | | } |
| | | |
| | | @ManagerAuth(memo = "反原点") |
| | | @PostMapping("/operator/reverseOrigin") |
| | | public R reverseOrigin(CrnOperatorParam param){ |
| | | public R reverseOrigin(CrnOperatorParam param) { |
| | | CrnCommand command = new CrnCommand(); |
| | | command.setCrnNo(param.getCrnNo()); // 堆垛机编号 |
| | | command.setTaskNo((short) 0); // 工作号 |
| | |
| | | command.setDestinationPosX((short) 0); // 目标库位排 |
| | | command.setDestinationPosY((short) 34); // 目标库位列 |
| | | command.setDestinationPosZ((short) 5); // 目标库位层 |
| | | return crnControl(command)?R.ok():R.error(); |
| | | return crnControl(command) ? R.ok() : R.error(); |
| | | } |
| | | |
| | | // @ManagerAuth(memo = "坐标移动") |
| | |
| | | |
| | | @ManagerAuth(memo = "任务完成") |
| | | @PostMapping("/operator/taskComplete") |
| | | public R crnTaskComplete(CrnOperatorParam param){ |
| | | public R crnTaskComplete(CrnOperatorParam param) { |
| | | CrnCommand command = new CrnCommand(); |
| | | command.setPltType(param.getC()); |
| | | command.setCrnNo(param.getCrnNo()); // 堆垛机编号 |
| | | command.setTaskNo((short) 0); // 工作号 |
| | | command.setAckFinish((short) 1); // 任务完成确认位 |
| | |
| | | command.setDestinationPosX((short) 0); // 目标库位排 |
| | | command.setDestinationPosY((short) 0); // 目标库位列 |
| | | command.setDestinationPosZ((short) 0); // 目标库位层 |
| | | return crnControl(command)?R.ok():R.error(); |
| | | return crnControl(command) ? R.ok() : R.error(); |
| | | } |
| | | |
| | | |
| | | |
| | | // @ManagerAuth(memo = "暂停") |
| | |
| | | |
| | | @ManagerAuth(memo = "清除命令") |
| | | @PostMapping("/operator/clearCommand") |
| | | public R crnClearCommand(CrnOperatorParam param){ |
| | | public R crnClearCommand(CrnOperatorParam param) { |
| | | if (param.getCrnNo() == null) { |
| | | throw new CoolException("请选择堆垛机"); |
| | | } |
| | |
| | | command.setDestinationPosX((short) 0); // 目标库位排 |
| | | command.setDestinationPosY((short) 0); // 目标库位列 |
| | | command.setDestinationPosZ((short) 0); // 目标库位层 |
| | | return crnControl(command)?R.ok():R.error(); |
| | | return crnControl(command) ? R.ok() : R.error(); |
| | | } |
| | | |
| | | @ManagerAuth(memo = "手动复位") |
| | |
| | | return R.error(); |
| | | } |
| | | |
| | | private boolean crnControl(CrnCommand command){ |
| | | private boolean crnControl(CrnCommand command) { |
| | | if (command.getCrnNo() == null) { |
| | | throw new CoolException("请选择堆垛机"); |
| | | } |
| | |
| | | throw new CoolException("堆垛机不在线"); |
| | | } |
| | | // 空闲判断 |
| | | // if (crnProtocol.getStatusType().equals(com.zy.core.enums.CrnStatusType.IDLE) && crnProtocol.getTaskNo() == 0) { |
| | | if (MessageQueue.offer(SlaveType.Crn, crn.getId(), new Task(2, command))) { |
| | | return true; |
| | | } else { |
| | | throw new CoolException("命令下发失败"); |
| | | } |
| | | // } else { |
| | | // throw new CoolException("堆垛机不在空闲状态"); |
| | | // } |
| | | if (MessageQueue.offer(SlaveType.Crn, crn.getId(), new Task(2, command))) { |
| | | return true; |
| | | } else { |
| | | throw new CoolException("命令下发失败"); |
| | | } |
| | | |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | private void staNoProcess(CrnOperatorParam param, CrnCommand command){ |
| | | if (param.getSourceStaNo()!=null) { |
| | | private void staNoProcess(CrnOperatorParam param, CrnCommand command) { |
| | | if (param.getSourceStaNo() != null) { |
| | | if (param.getSourceStaNo() == 5) { |
| | | command.setSourcePosX((short) 2); // 源库位排 |
| | | command.setSourcePosY((short) 0); // 源库位列 |
| | |
| | | command.setSourcePosZ((short) 1); // 源库位层 |
| | | } |
| | | } |
| | | if (param.getStaNo()!=null) { |
| | | if (param.getStaNo() != null) { |
| | | if (param.getStaNo() == 5) { |
| | | command.setDestinationPosX((short) 2); // 目标库位排 |
| | | command.setDestinationPosY((short) 0); // 目标库位列 |
| | |
| | | } |
| | | } |
| | | |
| | | private boolean isLocSts(String row,String bay,String lev){ |
| | | private boolean isLocSts(String row, String bay, String lev) { |
| | | int rowInt = Integer.parseInt(row); |
| | | int bayInt = Integer.parseInt(bay); |
| | | int levInt = Integer.parseInt(lev); |
| | | String loc = String.format("%2d",rowInt)+String.format("%3d",bayInt)+String.format("%2d",levInt); |
| | | String loc = String.format("%2d", rowInt) + String.format("%3d", bayInt) + String.format("%2d", levInt); |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", loc)); |
| | | if (Cools.isEmpty(locMast)){ |
| | | if (Cools.isEmpty(locMast)) { |
| | | return false; |
| | | } |
| | | if (locMast.getLocType1() == 2){ |
| | | if (locMast.getLocType1() == 2) { |
| | | return true; |
| | | } |
| | | return false; |
| | |
| | | |
| | | private Integer rgvNo; |
| | | |
| | | |
| | | private Integer c; |
| | | |
| | | } |
| | |
| | | // 目标库位 |
| | | private String locNo = "-"; |
| | | |
| | | // 源站 |
| | | private String sourceStaNo2 = "-"; |
| | | |
| | | // 目标站 |
| | | private String staNo2 = "-"; |
| | | |
| | | // 源库位 |
| | | private String sourceLocNo2 = "-"; |
| | | |
| | | // 目标库位 |
| | | private String locNo2 = "-"; |
| | | |
| | | // 异常 |
| | | private String error = ""; |
| | | |
| | |
| | | // 有物 |
| | | private String loading = "-"; |
| | | |
| | | // 有物 |
| | | private String loadTwoing = "-"; |
| | | |
| | | // 列 |
| | | private Short bay; |
| | | |
| | |
| | | |
| | | LocMast queryFreeLocMast(@Param("row") Integer row, @Param("locType1") Short locType1); |
| | | |
| | | LocMast queryFreeLocMast2(@Param("row") Integer row, @Param("locType1") Short locType1); |
| | | |
| | | |
| | | @Select("select loc_no from asr_loc_mast where 1=1 and loc_sts = 'O' and crn_no = #{crnNo}") |
| | | List<String> queryGroupEmptyStock(Integer crnNo); |
| | | |
| | |
| | | */ |
| | | LocMast queryFreeLocMast(Integer row, Short locType1); |
| | | |
| | | LocMast queryFreeLocMast2(Integer row, Short locType1); |
| | | /** |
| | | * 获取同组货架的空库位 |
| | | * @param sourceLocNo 源库位 |
| | |
| | | public LocMast queryFreeLocMast(Integer row, Short locType1) { |
| | | return this.baseMapper.queryFreeLocMast(row, locType1); |
| | | } |
| | | @Override |
| | | public LocMast queryFreeLocMast2(Integer row, Short locType1) { |
| | | return this.baseMapper.queryFreeLocMast2(row, locType1); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<String> queryGroupEmptyStock(String sourceLocNo) { |
| | |
| | | |
| | | // 命令下发区 -------------------------------------------------------------------------- |
| | | CrnCommand crnCommand = new CrnCommand(); |
| | | crnCommand.setPltType(getCrnStation(wrkMast.getSourceLocNo())); |
| | | crnCommand.setCrnNo(slave.getId()); // 堆垛机编号 |
| | | crnCommand.setTaskNo(wrkMast.getWrkNo().shortValue()); // 工作号 |
| | | crnCommand.setAckFinish((short) 0); // 任务完成确认位 |
| | |
| | | LocMast loc = null; |
| | | for (Integer row : rows) { |
| | | if (Utils.isDeepLoc(slaveProperties, row)) { |
| | | loc = locMastService.queryFreeLocMast(row, shallowLoc.getLocType1()); |
| | | if (shallowLoc.getRow1() == 1 && row == 1) { |
| | | loc = locMastService.queryFreeLocMast2(row, shallowLoc.getLocType1()); |
| | | } else if (shallowLoc.getRow1() == 29 && row == 29) { |
| | | loc = locMastService.queryFreeLocMast2(row, shallowLoc.getLocType1()); |
| | | } else { |
| | | loc = locMastService.queryFreeLocMast(row, shallowLoc.getLocType1()); |
| | | } |
| | | |
| | | if (loc != null) { |
| | | if (Utils.isDeepLoc(slaveProperties, loc.getLocNo())) { |
| | |
| | | if (null == loc) { |
| | | for (Integer row : rows) { |
| | | if (Utils.isShallowLoc(slaveProperties, row)) { |
| | | loc = locMastService.queryFreeLocMast(row, shallowLoc.getLocType1()); |
| | | if (shallowLoc.getRow1() == 1 && row == 1) { |
| | | loc = locMastService.queryFreeLocMast2(row, shallowLoc.getLocType1()); |
| | | } else if (shallowLoc.getRow1() == 29 && row == 29) { |
| | | loc = locMastService.queryFreeLocMast2(row, shallowLoc.getLocType1()); |
| | | } else { |
| | | loc = locMastService.queryFreeLocMast(row, shallowLoc.getLocType1()); |
| | | } |
| | | |
| | | |
| | | if (null != loc) {//对应深库位非在库状态,不能移库 |
| | | String deepLoc = Utils.getDeepLoc(slaveProperties, loc.getLocNo()); |
| | |
| | | break; |
| | | // 写入数据 1号工位 |
| | | case 2: |
| | | write((CrnCommand) task.getData()); |
| | | CrnCommand data = (CrnCommand) task.getData(); |
| | | if (data.getPltType() == null || data.getPltType() == 1) { |
| | | write(data); |
| | | } else if (data.getPltType() == 2) { |
| | | write2(data); |
| | | } |
| | | break; |
| | | // 复位 1号工位 |
| | | case 3: |
| | |
| | | command.setDestinationPosY((short) 0); // 目标库位列 |
| | | command.setDestinationPosZ((short) 0); // 目标库位层 |
| | | write(command); |
| | | break; |
| | | // 写入数据 2号工位 |
| | | case 4: |
| | | write2((CrnCommand) task.getData()); |
| | | break; |
| | | // 复位 2号工位 |
| | | case 6: |
| | |
| | | return false; |
| | | } |
| | | // 向堆垛机发任务前的堆垛机状态 |
| | | try{ |
| | | try { |
| | | OperateResultExOne<byte[]> resultRead = siemensNet.Read("DB100.0", (short) 18); |
| | | if (resultRead.IsSuccess) { |
| | | CrnCommand one = new CrnCommand(); |
| | |
| | | || !command.getSourcePosX().equals(one.getSourcePosX()) || !command.getSourcePosY().equals(one.getSourcePosY()) |
| | | || !command.getSourcePosZ().equals(one.getSourcePosZ()) || !command.getDestinationPosX().equals(one.getDestinationPosX()) |
| | | || !command.getDestinationPosY().equals(one.getDestinationPosY()) || !command.getDestinationPosZ().equals(one.getDestinationPosZ()) |
| | | ){ |
| | | ) { |
| | | // News.error("下发前:[id:{}] >>>>> 写入[{}],===>>回读[{}]", slave.getId(), JSON.toJSON(command),JSON.toJSON(one)); |
| | | } else { |
| | | // News.info("下发前:[id:{}] >>>>> 写入[{}],===>>回读[{}]", slave.getId(), JSON.toJSON(command),JSON.toJSON(one)); |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | } catch (Exception e) { |
| | | News.error("堆垛机命令地址写入后回读出错"); |
| | | } |
| | | // convertRow(command); |
| | |
| | | // array[10] = 0; //备用1 |
| | | |
| | | short[] array2 = new short[1]; |
| | | array2[0] = command.getAckFinish(); |
| | | array2[0] = command.getAckFinish(); |
| | | OperateResult result = siemensNet.Write("DB100.20", array); |
| | | OperateResult result2 = siemensNet.Write("DB100.0", array2); |
| | | News.info("堆垛机命令下发[id:{}] >>>>> {}", slave.getId(), array); |
| | |
| | | int writeCount1 = 1; |
| | | do { |
| | | try { |
| | | if (!result.IsSuccess||!result2.IsSuccess) { |
| | | if (!result.IsSuccess || !result2.IsSuccess) { |
| | | // if (!resetFlag){ |
| | | News.error("写入堆垛机plc数据失败,重新下发任务 写入直接失败 ===>> [id:{}],{},[写入次数:{}]", slave.getId(), JSON.toJSON(command), writeCount1); |
| | | result = siemensNet.Write("DB100.0", array); |
| | |
| | | writeCount2++; |
| | | short commandFinish = (short) 1; |
| | | result = siemensNet.Write("DB100.38", commandFinish); |
| | | if(result.IsSuccess){ |
| | | if (result.IsSuccess) { |
| | | //堆垛机任务写入后,回读一次,看是否成功 |
| | | Thread.sleep(200); |
| | | OperateResultExOne<byte[]> resultRead = siemensNet.Read("DB100.38", (short) 2); |
| | | if (resultRead.IsSuccess) { |
| | | commandFinish=siemensNet.getByteTransform().TransInt16(resultRead.Content, 0); |
| | | if (commandFinish != 1){ |
| | | News.error("堆垛机任务确认位"+commandFinish+"写入数据与回读数据不一致!"+"循环执行次数:"+writeCount2+"次"); |
| | | }else{ |
| | | commandFinish = siemensNet.getByteTransform().TransInt16(resultRead.Content, 0); |
| | | if (commandFinish != 1) { |
| | | News.error("堆垛机任务确认位" + commandFinish + "写入数据与回读数据不一致!" + "循环执行次数:" + writeCount2 + "次"); |
| | | } else { |
| | | //任务命令写入成功 |
| | | // News.info("堆垛机任务确认位"+commandFinish+"回读成功!"+"循环执行次数:"+writeCount2+"次"); |
| | | break; |
| | | } |
| | | }else { |
| | | News.error("堆垛机任务确认位"+commandFinish+"回读失败!"+"循环执行次数:"+writeCount2+"次"); |
| | | } else { |
| | | News.error("堆垛机任务确认位" + commandFinish + "回读失败!" + "循环执行次数:" + writeCount2 + "次"); |
| | | } |
| | | } else { |
| | | News.error("堆垛机任务确认位"+commandFinish+"写入失败!"+"循环执行次数:"+writeCount2+"次"); |
| | | News.error("堆垛机任务确认位" + commandFinish + "写入失败!" + "循环执行次数:" + writeCount2 + "次"); |
| | | } |
| | | }while (writeCount2<5); |
| | | } while (writeCount2 < 5); |
| | | } |
| | | } |
| | | |
| | |
| | | null // 修改人员 |
| | | ); |
| | | bean.insert(basCrnOpt); |
| | | } catch (Exception ignore) {} |
| | | } catch (Exception ignore) { |
| | | } |
| | | |
| | | if (result != null && result.IsSuccess) { |
| | | Thread.sleep(200); |
| | |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | public void requestStop() { |
| | | isRunning = false; |
| | | } |
| | |
| | | private Map<Integer, StaProtocol> station = new ConcurrentHashMap<>(); |
| | | private short heartBeatVal = 1; |
| | | private StaError1 staError1; |
| | | // public static final ArrayList<Integer> staNos = new ArrayList<Integer>() {{ |
| | | // |
| | | // }}; |
| | | public static final ArrayList<Integer> staNos1 = new ArrayList<Integer>() {{ |
| | | add(101);add(102);add(103); |
| | | add(104);add(105); |
| | | }}; |
| | | |
| | | public static final ArrayList<Integer> staNos1 = new ArrayList<Integer>() {{ |
| | | add(1101); |
| | | add(1102); |
| | | add(1103); |
| | | add(1104); |
| | | add(1105); |
| | | add(1106); |
| | | add(1107); |
| | | }}; |
| | | |
| | | |
| | | public static final ArrayList<Integer> BarcodeList1 = new ArrayList<Integer>() {{ |
| | | add(1); add(2);add(3);add(4);add(5); |
| | | add(1); |
| | | }}; |
| | | |
| | | |
| | | |
| | | public static final ArrayList<Integer> staNosErrList1 = new ArrayList<Integer>() {{ |
| | | |
| | | add(102); |
| | | }}; |
| | | |
| | | public static final ArrayList<Integer> staNoWeight1 = new ArrayList<Integer>() {{ |
| | | add(101);add(102);add(103);add(104);add(105); |
| | | add(101); |
| | | add(102); |
| | | add(103); |
| | | add(104); |
| | | add(105); |
| | | }}; |
| | | |
| | | |
| | | |
| | | private Integer count=0; |
| | | private Integer count = 0; |
| | | |
| | | /** |
| | | * 条码数量 |
| | |
| | | * 4.出库模式 |
| | | */ |
| | | public IoModeType ioModeOf2F = IoModeType.NONE; |
| | | // public IoModeType ioMode = IoModeType.NONE; |
| | | public IoModeType ioModeOf4F = IoModeType.NONE; |
| | | // public IoModeType ioMode = IoModeType.NONE; |
| | | |
| | | public SiemensDevpThread(DevpSlave slave) { |
| | | this.slave = slave; |
| | |
| | | throw new CoolException("服务器异常"); |
| | | } |
| | | } |
| | | |
| | | private ArrayList<Integer> getBarcodeList() { |
| | | switch (slave.getId()) { |
| | | case 1: |
| | |
| | | break; |
| | | // 写数据 ID+目标站 |
| | | case 2: |
| | | write((StaProtocol)task.getData()); |
| | | log.error("输送线下发命令:"+((StaProtocol) task.getData()).getWorkNo()+","+((StaProtocol) task.getData()).getStaNo()); |
| | | write((StaProtocol) task.getData()); |
| | | log.error("输送线下发命令:" + ((StaProtocol) task.getData()).getWorkNo() + "," + ((StaProtocol) task.getData()).getStaNo()); |
| | | break; |
| | | default: |
| | | break; |
| | |
| | | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 初始化站点状态 |
| | | */ |
| | | private void initSite() { |
| | | count ++; |
| | | count++; |
| | | ArrayList<Integer> staNos = getStaNo(); |
| | | if(count > 48) { |
| | | if (count > 48) { |
| | | // 站点编号 |
| | | for (Integer siteId : staNos) { |
| | | StaProtocol staProtocol = station.get(siteId); |
| | |
| | | siemensS7Net.setRack(slave.getRack().byteValue()); |
| | | siemensS7Net.setSlot(slave.getSlot().byteValue()); |
| | | OperateResult connect = siemensS7Net.ConnectServer(); |
| | | if(connect.IsSuccess){ |
| | | if (connect.IsSuccess) { |
| | | result = true; |
| | | OutputQueue.DEVP.offer(MessageFormat.format( "【{0}】输送线plc连接成功 ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot())); |
| | | News.info("SiemensDevp"+" - 1"+" - 输送线plc连接成功 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】输送线plc连接成功 ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot())); |
| | | News.info("SiemensDevp" + " - 1" + " - 输送线plc连接成功 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | } else { |
| | | OutputQueue.DEVP.offer(MessageFormat.format( "【{0}】输送线plc连接失败!!! ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot())); |
| | | News.error("SiemensDevp"+" - 2"+" - 输送线plc连接失败!!! ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】输送线plc连接失败!!! ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot())); |
| | | News.error("SiemensDevp" + " - 2" + " - 输送线plc连接失败!!! ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | } |
| | | // siemensS7Net.ConnectClose(); |
| | | initSite(); |
| | | return result; |
| | | } |
| | | |
| | | public static int getOffsetFromSiteId(int siteId) { |
| | | if (siteId < 100 || siteId > 450) { |
| | | throw new IllegalArgumentException("siteId 超出有效范围: " + siteId); |
| | | } |
| | | return (siteId - 100) * 8; |
| | | } |
| | | |
| | | public static int getOffsetFromSiteId2(int siteId) { |
| | | if (siteId < 100 || siteId > 450) { |
| | | throw new IllegalArgumentException("siteId 超出有效范围: " + siteId); |
| | | } |
| | | return (siteId - 100) * 6; |
| | | } |
| | | |
| | | /** |
| | | * 读取状态 ====> 整块plc |
| | |
| | | // // 更新入出库模式 |
| | | // updateIoMode(); |
| | | |
| | | // if (slave.getId()==1) return; |
| | | ArrayList<Integer> staNos = staNos1; |
| | | int staNoSize = staNos1.size(); |
| | | //ArrayList<Integer> staNos = getStaNo(); |
| | | ArrayList<Integer> staNosErrList = getStaNoErr(); |
| | | ArrayList<Integer> staNoWeight = getStaNoWeight(); |
| | | //int staNoSize = staNos.size(); |
| | | OperateResultExOne<byte[]> result = siemensS7Net.Read("DB101.0", (short) (staNoSize * 8)); |
| | | OperateResultExOne<byte[]> resultWeight = null; |
| | | /*if(staNoWeight.size()>4){ |
| | | resultWeight = siemensS7Net.Read("DB102.0", (short) (8 * 4)); |
| | | }else{ |
| | | resultWeight = siemensS7Net.Read("DB102.0", (short) (4 * 4)); |
| | | } |
| | | OperateResultExOne<byte[]> resultWeight2 = siemensS7Net.Read("DB102.0", (short) (4 * 4));*/ |
| | | |
| | | //if (result.IsSuccess && resultWeight.IsSuccess) { |
| | | if (result.IsSuccess) { |
| | | int j = 0; |
| | | for(int i = 0 ; i<staNoSize;i++){ |
| | | if (result.IsSuccess) { |
| | | for (int i = 0; i < staNoSize; i++) { |
| | | Integer siteId = staNos.get(i); // 站点编号 |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | if (null == staProtocol) { |
| | |
| | | station.put(siteId, staProtocol); |
| | | } |
| | | boolean[] status = null; |
| | | int offset = getOffsetFromSiteId(siteId);//取余获得对应db块数据 |
| | | |
| | | staProtocol.setWorkNo(siemensS7Net.getByteTransform().TransInt32(result.Content, i * 8)); // 工作号 |
| | | /*if (staNoWeight.contains(siteId)) { |
| | | if(staNoWeight.size() == 4){ |
| | | staProtocol.setWeight(siemensS7Net.getByteTransform().TransInt32(resultWeight2.Content, j)); |
| | | j = j + 4; |
| | | }else{ |
| | | staProtocol.setWeight(siemensS7Net.getByteTransform().TransInt32(resultWeight.Content, j)); |
| | | j = j + 4; |
| | | |
| | | } |
| | | }*/ |
| | | staProtocol.setStaNo(siemensS7Net.getByteTransform().TransInt16(result.Content, i * 8 + 4)); // 目标站 |
| | | status = siemensS7Net.getByteTransform().TransBool(result.Content, i * 8 + 6, 1); |
| | | |
| | | status = siemensS7Net.getByteTransform().TransBool(result.Content, i * 8 + 6, 1); |
| | | staProtocol.setAutoing(status[0]); // 自动 |
| | | staProtocol.setLoading(status[1]); // 有物 |
| | | staProtocol.setInEnable(status[2]); // 可入 |
| | |
| | | } |
| | | } |
| | | |
| | | //条码扫描器 |
| | | ArrayList<Integer> barcodeList = getBarcodeList(); |
| | | OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB101.602", (short) (barcodeList.size() * 8)); |
| | | if (result2.IsSuccess) { |
| | | for (int i = 0; i < barcodeList.size(); i++) { |
| | | Integer barcodeId = barcodeList.get(i); |
| | | String barcode = siemensS7Net.getByteTransform().TransString(result2.Content, i * 8, 8, "UTF-8"); |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, barcodeId); |
| | | if (!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { |
| | | barcodeThread.setBarcode(barcode); |
| | | } |
| | | //条码扫描器 |
| | | ArrayList<Integer> barcodeList = getBarcodeList(); |
| | | OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB101.602", (short) (barcodeList.size() * 8)); |
| | | if (result2.IsSuccess) { |
| | | for (int i = 0; i < barcodeList.size(); i++) { |
| | | Integer barcodeId = barcodeList.get(i); |
| | | String barcode = siemensS7Net.getByteTransform().TransString(result2.Content, i * 8, 8, "UTF-8"); |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, barcodeId); |
| | | if (!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { |
| | | barcodeThread.setBarcode(barcode); |
| | | } |
| | | } |
| | | //外形检测 |
| | | ArrayList<Integer> staNoErrs = staNosErrList; |
| | | int staNoErrsSize = staNoErrs.size(); |
| | | OperateResultExOne<byte[]> resultErr = siemensS7Net.Read("DB101.702", (short) (staNoErrsSize * 7)); |
| | | if (resultErr.IsSuccess) { |
| | | for (int i = 0; i < staNoErrsSize; i++) { |
| | | Integer siteId = staNoErrs.get(i); // 站点编号 |
| | | } |
| | | //外形检测 |
| | | ArrayList<Integer> staNoErrs = staNosErrList; |
| | | int staNoErrsSize = staNoErrs.size(); |
| | | OperateResultExOne<byte[]> resultErr = siemensS7Net.Read("DB101.702", (short) (staNoErrsSize * 7)); |
| | | if (resultErr.IsSuccess) { |
| | | for (int i = 0; i < staNoErrsSize; i++) { |
| | | Integer siteId = staNoErrs.get(i); // 站点编号 |
| | | // boolean[] status = siemensS7Net.getByteTransform().TransBool(resultErr.Content, i * 4 + 2, 1); |
| | | boolean[] status = siemensS7Net.getByteTransform().TransBool(resultErr.Content, i * 7, 1); |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | staProtocol.setFrontErr(status[0]); |
| | | staProtocol.setBackErr(status[1]); |
| | | staProtocol.setHighErr(status[2]); |
| | | staProtocol.setLeftErr(status[3]); |
| | | staProtocol.setRightErr(status[4]); |
| | | staProtocol.setWeightErr(status[5]); |
| | | staProtocol.setBarcodeErr(status[6]); |
| | | } |
| | | boolean[] status = siemensS7Net.getByteTransform().TransBool(resultErr.Content, i * 7, 1); |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | staProtocol.setFrontErr(status[0]); |
| | | staProtocol.setBackErr(status[1]); |
| | | staProtocol.setHighErr(status[2]); |
| | | staProtocol.setLeftErr(status[3]); |
| | | staProtocol.setRightErr(status[4]); |
| | | staProtocol.setWeightErr(status[5]); |
| | | staProtocol.setBarcodeErr(status[6]); |
| | | } |
| | | } |
| | | |
| | | // //plc故障 |
| | | // OperateResultExOne<byte[]> resultErr2 = siemensS7Net.Read("DB101.1728", (short) (staNoSize*4)); |
| | |
| | | // } |
| | | |
| | | |
| | | if (result.IsSuccess) { |
| | | if (result.IsSuccess) { |
| | | |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功", DateUtils.convert(new Date()), slave.getId())); |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功", DateUtils.convert(new Date()), slave.getId())); |
| | | |
| | | // 根据实时信息更新数据库 |
| | | try { |
| | | List<BasDevp> basDevps = new ArrayList<>(); |
| | | for (Integer siteId : staNos) { |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | basDevps.add(staProtocol.toSqlModel()); |
| | | } |
| | | BasDevpService basDevpService = SpringContextUtil.getBean(BasDevpService.class); |
| | | //BasDevpService basDevpService = SpringUtils.getBean(BasDevpService.class); |
| | | if (null != basDevpService && !basDevpService.updateBatchById(basDevps)) { |
| | | throw new Exception("更新数据库数据失败"); |
| | | } |
| | | } catch (Exception e) { |
| | | initSite(); |
| | | e.printStackTrace(); |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】更新数据库数据失败 ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot())); |
| | | News.error("SiemensDevp" + " - 3" + " - 更新数据库数据失败 ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()); |
| | | // 根据实时信息更新数据库 |
| | | try { |
| | | List<BasDevp> basDevps = new ArrayList<>(); |
| | | for (Integer siteId : staNos) { |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | basDevps.add(staProtocol.toSqlModel()); |
| | | } |
| | | |
| | | } else { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】读取输送线plc状态信息失败 ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot())); |
| | | // log.error("读取输送线plc状态信息失败 ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()); |
| | | BasDevpService basDevpService = SpringContextUtil.getBean(BasDevpService.class); |
| | | //BasDevpService basDevpService = SpringUtils.getBean(BasDevpService.class); |
| | | if (null != basDevpService && !basDevpService.updateBatchById(basDevps)) { |
| | | throw new Exception("更新数据库数据失败"); |
| | | } |
| | | } catch (Exception e) { |
| | | initSite(); |
| | | e.printStackTrace(); |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】更新数据库数据失败 ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot())); |
| | | News.error("SiemensDevp" + " - 3" + " - 更新数据库数据失败 ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()); |
| | | } |
| | | |
| | | } else { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】读取输送线plc状态信息失败 ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot())); |
| | | // log.error("读取输送线plc状态信息失败 ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | |
| | | write = siemensS7Net.Write("DB100." + index * 6, staProtocol.getWorkNo()); // 工作号 |
| | | Thread.sleep(200); |
| | | write1 = siemensS7Net.Write("DB100." + (index * 6 + 4), staProtocol.getStaNo().shortValue()); // 目标站 |
| | | if(write.IsSuccess && write1.IsSuccess){ |
| | | if (write.IsSuccess && write1.IsSuccess) { |
| | | log.error("写入输送线命令成功。输送线plc编号={},站点数据={},写入次数={}", slave.getId(), JSON.toJSON(staProtocol), writeCount); |
| | | break; |
| | | } |
| | | else { |
| | | } else { |
| | | writeCount++; |
| | | log.error("写入输送线命令失败。输送线plc编号={},站点数据={},写入次数={}", slave.getId(), JSON.toJSON(staProtocol), writeCount); |
| | | } |
| | | }while (writeCount<5); |
| | | } while (writeCount < 5); |
| | | |
| | | if (!write.IsSuccess) { |
| | | staProtocol = station.get(staProtocol.getSiteId()); |
| | | if (staProtocol.getWorkNo() == 0 && staProtocol.getStaNo() ==0) { |
| | | if (staProtocol.getWorkNo() == 0 && staProtocol.getStaNo() == 0) { |
| | | staProtocol.setPakMk(true); |
| | | } |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线站点数据失败。输送线plc编号={1},站点数据={2}", slave.getId(), JSON.toJSON(staProtocol))); |
| | | News.error("SiemensDevp"+" - 4"+" - 写入输送线站点数据失败。输送线plc编号={},站点数据={}", slave.getId(), JSON.toJSON(staProtocol)); |
| | | News.error("SiemensDevp" + " - 4" + " - 写入输送线站点数据失败。输送线plc编号={},站点数据={}", slave.getId(), JSON.toJSON(staProtocol)); |
| | | } |
| | | // else { |
| | | // //dang 101,201zhan xaifazhiling qingchu tiaoxingsaomaolide shuju shanchu |
| | |
| | | if (this.ioModeOf2F != IoModeType.NONE) { |
| | | if (!siemensS7Net.Write("DB100.180", this.ioModeOf2F.id).IsSuccess) { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线2F入出库模式失败。输送线plc编号={1}", slave.getId())); |
| | | News.error("SiemensDevp"+" - 6"+" - 写入输送线2F入出库模式失败。输送线plc编号={}", slave.getId()); |
| | | News.error("SiemensDevp" + " - 6" + " - 写入输送线2F入出库模式失败。输送线plc编号={}", slave.getId()); |
| | | } |
| | | } |
| | | } |
| | |
| | | /** |
| | | * 心跳 |
| | | */ |
| | | private void heartbeat(){ |
| | | private void heartbeat() { |
| | | if (heartBeatVal == 1) { |
| | | heartBeatVal = 2; |
| | | } else { |
| | |
| | | } |
| | | OperateResult write = siemensS7Net.Write("DB100.50", heartBeatVal); |
| | | if (!write.IsSuccess) { |
| | | News.error("SiemensDevp"+" - 7"+" - 输送线plc编号={} 心跳失败", slave.getId()); |
| | | News.error("SiemensDevp" + " - 7" + " - 输送线plc编号={} 心跳失败", slave.getId()); |
| | | } |
| | | } |
| | | |
| | |
| | | public static void main(String[] args) { |
| | | System.out.println(staNos1.indexOf(129)); |
| | | System.out.println(staNos1.size()); |
| | | for (int i = 0; i<staNos1.size(); i++) { |
| | | for (int i = 0; i < staNos1.size(); i++) { |
| | | // System.out.println(i*2); |
| | | // System.out.println(i*2 + 200); |
| | | // System.out.println(i); |
| | | } |
| | | int index = staNos1.indexOf(128); |
| | | System.out.println(index*2); |
| | | System.out.println(index*2 + 200); |
| | | System.out.println(index * 2); |
| | | System.out.println(index * 2 + 200); |
| | | } |
| | | |
| | | // public static void main(String[] args) throws Exception { |
| | |
| | | name: @pom.build.finalName@ |
| | | datasource: |
| | | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver |
| | | url: jdbc:sqlserver://192.168.0.2:1433;databasename=rqdzasrs |
| | | url: jdbc:sqlserver://127.0.0.1:1433;databasename=rqdzasrs |
| | | username: sa |
| | | password: sa@123 |
| | | # driver-class-name: com.oscar.Driver |
| | |
| | | enable: false |
| | | |
| | | wms: |
| | | url: 127.0.0.1:8080/rqdzasrs |
| | | url: 127.0.0.1:8080/wcs |
| | | |
| | | # 下位机配置 |
| | | wcs-slave: |
| | |
| | | # 堆垛机入库站点 |
| | | crnInStn[0]: |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | staNo: 101 |
| | | staNo: 1105 |
| | | row: 2 |
| | | bay: 1 |
| | | lev: 1 |
| | | # 堆垛机入库站点 |
| | | crnInStn[1]: |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | staNo: 105 |
| | | row: 3 |
| | | bay: 1 |
| | | lev: 1 |
| | | bay: 11 |
| | | lev: 2 |
| | | |
| | | # 堆垛机出库站点 |
| | | crnOutStn[0]: |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | staNo: 101 |
| | | staNo: 1101 |
| | | row: 2 |
| | | bay: 1 |
| | | lev: 1 |
| | | # 堆垛机出库站点 |
| | | crnOutStn[1]: |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | staNo: 105 |
| | | row: 3 |
| | | bay: 1 |
| | | lev: 1 |
| | | bay: 14 |
| | | lev: 2 |
| | | |
| | | # plc |
| | | devp[0]: |
| | | id: 1 |
| | |
| | | slot: 0 |
| | | # 入库口1 |
| | | inSta[0]: |
| | | staNo: 102 |
| | | staNo: 1106 |
| | | barcode: ${wcs-slave.barcode[0].id} |
| | | backSta: 103 |
| | | backSta: 1105 |
| | | led: ${wcs-slave.led[0].id} |
| | | # # 入库口2 |
| | | # inSta[1]: |
| | |
| | | # led: ${wcs-slave.led[1].id} |
| | | # 拣料入库口1 |
| | | pickSta[0]: |
| | | staNo: 104 |
| | | staNo: 1106 |
| | | barcode: ${wcs-slave.barcode[0].id} |
| | | led: ${wcs-slave.led[1].id} |
| | | backSta: 104 |
| | | led: ${wcs-slave.led[0].id} |
| | | backSta: 1105 |
| | | # # 拣料入库口2 |
| | | # pickSta[1]: |
| | | # staNo: 225 |
| | |
| | | # backSta: 224 |
| | | # 空板入库口1 |
| | | emptyInSta[0]: |
| | | staNo: 102 |
| | | staNo: 1106 |
| | | barcode: ${wcs-slave.barcode[0].id} |
| | | backSta: 103 |
| | | backSta: 1105 |
| | | led: ${wcs-slave.led[0].id} |
| | | # 空板入库口2 |
| | | #emptyInSta[1]: |
| | |
| | | #led: ${wcs-slave.led[1].id} |
| | | # 出库口1 |
| | | outSta[0]: |
| | | staNo: 104 |
| | | staNo: 1101 |
| | | # 条码扫描仪1 |
| | | barcode[0]: |
| | | id: 1 |
| | |
| | | ip: 10.10.10.51 |
| | | port: 5005 |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | staArr: 102 |
| | | # LED2 |
| | | led[1]: |
| | | id: 123 |
| | | ip: 10.10.10.52 |
| | | port: 5005 |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | staArr: 104 |
| | | staArr: 1104 |
| | | # # LED2 |
| | | # led[1]: |
| | | # id: 123 |
| | | # ip: 10.10.10.52 |
| | | # port: 5005 |
| | | # devpPlcId: ${wcs-slave.devp[0].id} |
| | | # staArr: 104 |
| | | |
| | |
| | | order by NEWID(),lev1 asc,bay1 asc |
| | | </select> |
| | | |
| | | <select id="queryFreeLocMast2" resultMap="BaseResultMap"> |
| | | select top 1 * |
| | | from asr_loc_mast |
| | | where row1=#{row} |
| | | and loc_sts='O' |
| | | and row1 != #{row} |
| | | <if test="locType1 != null"> |
| | | and loc_type1 = #{locType1} |
| | | </if> |
| | | order by NEWID(),lev1 asc,bay1 asc |
| | | </select> |
| | | |
| | | <select id="queryDemoSourceLoc" resultMap="BaseResultMap"> |
| | | select top 1 * from asr_loc_mast where crn_no = #{crnNo} |
| | | and loc_sts='D' |
| | |
| | | // var baseUrl = "/rqdzwcs"; |
| | | var baseUrl = "/czkhwcs"; |
| | | var baseUrl = "/wcs"; |
| | | |
| | | // 赋值 |
| | | function setVal(el, val) { |
| | |
| | | mapInfo ={ |
| | | // "mapName": "rqdzwcs", |
| | | "mapName": "czkhwcs", |
| | | "mapName": "wcs", |
| | | "rackCount": 8, |
| | | "crnCount": 4, |
| | | "stbCount": 120, |
| | |
| | | "stns": [ |
| | | // { "type": "stn", "id": "site-100", "text": "100", "top": 80, "left": 94, "width": 40, "height": 23 }, |
| | | //{ "type": "stn", "id": "site-103", "text": "103", "top": 160, "left": 1430, "width": 120, "height": 23 }, |
| | | {"type": "stn", "id": "site-313", "text": "313", "top": 200, "left": 990, "width": 170, "height": 25}, |
| | | { "type": "stn", "id": "site-102", "text": "102", "top": 280, "left": 990, "width": 30, "height": 40 }, |
| | | { "type": "stn", "id": "site-101", "text": "101", "top": 230, "left": 990, "width": 30, "height": 40 }, |
| | | {"type": "stn", "id": "site-1103", "text": "1103", "top": 180, "left": 1000, "width": 45, "height": 45}, |
| | | {"type": "stn", "id": "site-1104", "text": "1104", "top": 180, "left": 945, "width": 45, "height": 45}, |
| | | {"type": "stn", "id": "site-1105", "text": "1105", "top": 180, "left": 890, "width": 45, "height": 45}, |
| | | { "type": "stn", "id": "site-1102", "text": "1102", "top": 280, "left": 890, "width": 45, "height": 45 }, |
| | | { "type": "stn", "id": "site-1101", "text": "1101", "top": 230, "left": 890, "width": 45, "height": 45 }, |
| | | // { "type": "stn", "id": "site-110", "text": "110", "top": 130, "left": 1784, "width": 40, "height": 23 }, |
| | | // { "type": "stn", "id": "site-111", "text": "111", "top": 130, "left": 1826, "width": 40, "height": 23 }, |
| | | // |
| | |
| | | // { "type": "stn", "id": "site-118", "text": "118", "top": 240, "left": 94, "width": 40, "height": 23 }, |
| | | // { "type": "stn", "id": "site-119", "text": "119", "top": 240, "left": 52, "width": 40, "height": 23 }, |
| | | // { "type": "stn", "id": "site-120", "text": "120", "top": 240, "left": 10, "width": 40, "height": 23 }, |
| | | { "type": "stn", "id": "site-104", "text": "104", "top": 280, "left": 1130, "width": 30, "height": 40 }, |
| | | { "type": "stn", "id": "site-105", "text": "105", "top": 230, "left": 1130, "width": 30, "height": 40 }, |
| | | { "type": "stn", "id": "site-1107", "text": "1107", "top": 280, "left": 1000, "width": 45, "height": 45 }, |
| | | { "type": "stn", "id": "site-1106", "text": "1106", "top": 230, "left": 1000, "width": 45, "height": 45 }, |
| | | // { "type": "stn", "id": "site-123", "text": "123", "top": 210, "left": 1301, "width": 60, "height": 23 }, |
| | | |
| | | // { "type": "stn", "id": "site-124", "text": "124", "top": 160, "left": 1742, "width": 120, "height": 23 }, |
| | |
| | | <th>堆垛机</th> |
| | | <th>模式</th> |
| | | <th>状态</th> |
| | | <th>有物</th> |
| | | <th>工位1有物</th> |
| | | <th>工位2有物</th> |
| | | <th>列</th> |
| | | <th>层</th> |
| | | <th>货叉定位</th> |
| | |
| | | <th>工作号</th> |
| | | <th>状态</th> |
| | | <th>源站</th> |
| | | <th>目标站</th> |
| | | <th>源库位</th> |
| | | <th>目标库位</th> |
| | | <th>目标站1</th> |
| | | <th>源库位1</th> |
| | | <th>目标库位1</th> |
| | | <th>目标站2</th> |
| | | <th>源库位2</th> |
| | | <th>目标库位2</th> |
| | | <!-- <th>走行速度(m/min)</th>--> |
| | | <!-- <th>升降速度(m/min)</th>--> |
| | | <!-- <th>叉牙速度(m/min)</th>--> |
| | |
| | | <!-- <button class="item" onclick="bacOrigin()">回原点</button>--> |
| | | <!-- <button class="item" onclick="reverseOrigin()">反原点</button>--> |
| | | <!-- <button class="item" onclick="coorMove()">坐标移行</button>--> |
| | | <button class="item" onclick="taskComplete()">任务完成</button> |
| | | <button class="item" onclick="taskComplete(1)">任务完成1</button> |
| | | <button class="item" onclick="taskComplete(2)">任务完成2</button> |
| | | |
| | | <!-- <button class="item" onclick="pause()">暂停</button>--> |
| | | <!-- <button class="item" onclick="boot()">启动</button>--> |
| | | <button class="item" onclick="clearCommand()">清除命令</button> |
| | |
| | | setVal(tr.children("td").eq(1), table[i-1].statusType); |
| | | setVal(tr.children("td").eq(2), table[i-1].status); |
| | | setVal(tr.children("td").eq(3), table[i-1].loading); |
| | | setVal(tr.children("td").eq(4), table[i-1].bay); |
| | | setVal(tr.children("td").eq(5), table[i-1].lev); |
| | | setVal(tr.children("td").eq(6), table[i-1].forkOffset); |
| | | setVal(tr.children("td").eq(7), table[i-1].liftPos); |
| | | setVal(tr.children("td").eq(8), table[i-1].walkPos); |
| | | setVal(tr.children("td").eq(9), table[i-1].warnCode); |
| | | setVal(tr.children("td").eq(10), table[i-1].alarm); |
| | | setVal(tr.children("td").eq(4), table[i-1].loadTwoing); |
| | | |
| | | setVal(tr.children("td").eq(5), table[i-1].bay); |
| | | setVal(tr.children("td").eq(6), table[i-1].lev); |
| | | setVal(tr.children("td").eq(7), table[i-1].forkOffset); |
| | | setVal(tr.children("td").eq(8), table[i-1].liftPos); |
| | | setVal(tr.children("td").eq(9), table[i-1].walkPos); |
| | | setVal(tr.children("td").eq(10), table[i-1].warnCode); |
| | | setVal(tr.children("td").eq(11), table[i-1].alarm); |
| | | } |
| | | } else if (res.code === 403){ |
| | | window.location.href = baseUrl+"/login"; |
| | |
| | | setVal(tr.children("td").eq(4), table[i-1].staNo); |
| | | setVal(tr.children("td").eq(5), table[i-1].sourceLocNo); |
| | | setVal(tr.children("td").eq(6), table[i-1].locNo); |
| | | |
| | | setVal(tr.children("td").eq(7), table[i-1].staNo2); |
| | | setVal(tr.children("td").eq(8), table[i-1].sourceLocNo2); |
| | | setVal(tr.children("td").eq(9), table[i-1].locNo2); |
| | | // setVal(tr.children("td").eq(7), table[i-1].xspeed); |
| | | // setVal(tr.children("td").eq(8), table[i-1].yspeed); |
| | | // setVal(tr.children("td").eq(9), table[i-1].zspeed); |
| | |
| | | } |
| | | |
| | | // 任务完成 |
| | | function taskComplete() { |
| | | http.post(baseUrl+"/crn/operator/taskComplete", getReqParam(), function (res) { |
| | | function taskComplete(c) { |
| | | http.post(baseUrl+"/crn/operator/taskComplete?c="+c, getReqParam(), function (res) { |
| | | layer.msg(res.msg); |
| | | }); |
| | | } |