| | |
| | | @TableField("out_enable") |
| | | private String outEnable; |
| | | |
| | | /** |
| | | * 回原点 |
| | | */ |
| | | @ApiModelProperty(value= "回原点") |
| | | @TableField("move_origin") |
| | | private String moveOrigin; |
| | | // /** |
| | | // * 回原点 |
| | | // */ |
| | | // @ApiModelProperty(value= "回原点") |
| | | // @TableField("move_origin") |
| | | // private String moveOrigin; |
| | | |
| | | /** |
| | | * 状态 |
| | |
| | | public BasCrnp(String inEnable,String outEnable,String moveOrigin,Integer crnSts,Integer wrkNo,Long crnErr,String frmLocno,Integer frmSta,Integer toSta,String toLocno,Long appeUser,Date appeTime,Long modiUser,Date modiTime,String hpMk,String retrieveMk,String ctlHp,String ctlRest,String empIn,Integer tankQty,Integer tankQty1) { |
| | | this.inEnable = inEnable; |
| | | this.outEnable = outEnable; |
| | | this.moveOrigin = moveOrigin; |
| | | // this.moveOrigin = moveOrigin; |
| | | this.crnSts = crnSts; |
| | | this.wrkNo = wrkNo; |
| | | this.crnErr = crnErr; |
| | |
| | | this.outEnable = outEnable; |
| | | } |
| | | |
| | | public String getMoveOrigin() { return moveOrigin; } |
| | | |
| | | public void setMoveOrigin(String moveOrigin) { |
| | | this.moveOrigin = moveOrigin; |
| | | } |
| | | // public String getMoveOrigin() { return moveOrigin; } |
| | | // |
| | | // public void setMoveOrigin(String moveOrigin) { |
| | | // this.moveOrigin = moveOrigin; |
| | | // } |
| | | |
| | | public Integer getCrnSts() { |
| | | return crnSts; |
| | |
| | | package com.zy.asrs.service.impl; |
| | | |
| | | import HslCommunication.Core.Types.OperateResultExOne; |
| | | import HslCommunication.Profinet.Siemens.SiemensS7Net; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | |
| | | private WrkMastService wrkMastService; |
| | | @Value("${wms.url}") |
| | | private String wmsUrl; |
| | | |
| | | public short wrkNo = 9999; |
| | | /** |
| | | * 组托 |
| | | * 入库站,根据条码扫描生成入库工作档,工作状态 2 |
| | |
| | | // 获取入库站信息 |
| | | SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); |
| | | StaProtocol staProtocol = devpThread.getStation().get(inSta.getStaNo()); |
| | | LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed()); |
| | | if (staProtocol == null) { |
| | | continue; |
| | | } else { |
| | | staProtocol = staProtocol.clone(); |
| | | } |
| | | |
| | | //LED |
| | | LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed()); |
| | | // 入出库模式判断 |
| | | // if ( inSta.getStaNo()==203 && devpThread.ioModeOf2F != IoModeType.PAKIN_MODE) { continue; } |
| | | // if (inSta.getStaNo() == 203 && devpThread.ioModeOf2F == IoModeType.PAKOUT_MODE) { |
| | | // continue; |
| | | // } |
| | | |
| | | // 判断是否满足入库条件 |
| | | if (!staProtocol.isLoading()){ |
| | | String barcode = barcodeThread.getBarcode(); |
| | | if (Cools.isEmpty(barcode)) { |
| | | continue; |
| | | } |
| | | |
| | | if(!staProtocol.isInEnable()) { |
| | | continue; |
| | | } |
| | | |
| | | // 尺寸检测异常 |
| | | 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 && devp.getId() == 2) { |
| | | if(staProtocol.getWorkNo() == 9907 && '5' != barcode.charAt(0)){ |
| | | errMsg = "条码5只能入7排"; |
| | | back = true; |
| | | } |
| | | if(staProtocol.getWorkNo() == 9906 && '5' == barcode.charAt(0)){ |
| | | errMsg = "条码5不能入6排"; |
| | | back = true; |
| | | } |
| | | } |
| | | |
| | | //拣料、盘点任务,不进入新板入库方法,直接跳出 |
| | | if(staProtocol.getWorkNo() == 9995){ |
| | | continue; |
| | | } |
| | | |
| | | // 退回 |
| | | if (back) { |
| | | // News.warn("扫码入库失败,{}入库站因{}异常,托盘已被退回", inSta.getStaNo(), errMsg); |
| | | // if(!staProtocol.isOutEnable()){ |
| | | // continue; |
| | | // } |
| | | |
| | | if (!staProtocol.isLoading()){ |
| | | continue; |
| | | } |
| | | if (!staProtocol.isPakMk()) { |
| | | continue; |
| | | } |
| | | staProtocol.setWorkNo(wrkNo); |
| | | News.warn("{}入库回退:{},任务号:{}", inSta.getStaNo(), errMsg,wrkNo); |
| | | staProtocol.setStaNo(inSta.getBackSta().shortValue()); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errMsg)); |
| | | } |
| | | |
| | | // String barcode11 = barcodeThread.getBarcode(); |
| | | // if (Cools.isEmpty(barcode11)){ |
| | | // if (staProtocol.isAutoing()&& !staProtocol.isEmptyMk() && staProtocol.getWorkNo() == 9999 && staProtocol.isPakMk() && staProtocol.getStamp()>=2){ |
| | | // if (Cools.isEmpty(barcode)){ |
| | | // if (staProtocol.isAutoing()&& !staProtocol.isEmptyMk() && staProtocol.isPakMk() && staProtocol.getStamp()>=2){ |
| | | // staProtocol.setStamp(0); |
| | | // News.info(""+mark+" - 7"+" - 扫码失败2 ===>> {}号条码扫描器检测条码信息:{},站点:{}", inSta.getBarcode(), barcode11, inSta.getStaNo()); |
| | | // staProtocol.setWorkNo((short) 9989); |
| | |
| | | // continue; |
| | | // } |
| | | // } |
| | | //超宽超高没扫到条码报警 |
| | | // boolean fig=false; |
| | | // for(int i=0;i<8;i++){ |
| | | // switch (i){ |
| | | // case 0: if(devpThread.startSignal[i]){ |
| | | // log.error("前超报警"); |
| | | // fig=true; |
| | | // }; |
| | | // case 1: if(devpThread.startSignal[i]){ |
| | | // log.error("后超报警"); |
| | | // fig=true; |
| | | // }; |
| | | // case 2: if(devpThread.startSignal[i]){ |
| | | // log.error("高超报警"); |
| | | // fig=true; |
| | | // }; |
| | | // case 3: if(devpThread.startSignal[i]){ |
| | | // log.error("左超报警"); |
| | | // fig=true; |
| | | // }; |
| | | // case 4: if(devpThread.startSignal[i]){ |
| | | // log.error("右超报警"); |
| | | // fig=true; |
| | | // }; |
| | | // case 5: if(devpThread.startSignal[i]){ |
| | | // log.error("超重报警"); |
| | | // fig=true; |
| | | // }; |
| | | // case 6: if(devpThread.startSignal[i]){ |
| | | // log.error("未扫到码报警"); |
| | | // fig=true; |
| | | // }; |
| | | // |
| | | // } |
| | | // } |
| | | if (staProtocol.isAutoing() && staProtocol.isInEnable() |
| | | && !staProtocol.isEmptyMk() && (staProtocol.getWorkNo() == 0 || staProtocol.getWorkNo() > 9990) |
| | | && staProtocol.isPakMk()) { //&& staProtocol.getStamp()>=2) {// && !Cools.isEmpty(barcode)) { |
| | | && !staProtocol.isEmptyMk() && staProtocol.getWorkNo() > 9000 |
| | | && staProtocol.isPakMk() && !back) { //&& staProtocol.getStamp()>=2) {// && !Cools.isEmpty(barcode)) { |
| | | News.warnNoLog(""+mark+" - 0"+" - 开始执行"); |
| | | // try { |
| | | // Thread.sleep(300); |
| | | // }catch (Exception e){} |
| | | |
| | | String barcode = barcodeThread.getBarcode(); |
| | | if(!Cools.isEmpty(barcode)) { |
| | | News.info(""+mark+" - 1"+" - {}号条码扫描器检测条码信息:{}", inSta.getBarcode(), barcode); |
| | | |
| | | if("NG".endsWith(barcode) || "NoRead".equals(barcode) || "empty".equals(barcode)) { |
| | | staProtocol.setWorkNo((short) 9999); |
| | | staProtocol.setStaNo(inSta.getBackSta().shortValue()); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | |
| | | News.info(""+mark+" - 2"+" - 扫码失败1 ===>> {}号条码扫描器检测条码信息:{},站点:{}", inSta.getBarcode(), barcode, inSta.getStaNo()); |
| | | // led 异常显示 |
| | | if (ledThread != null) { |
| | | String errorMsg = "扫码失败,请重试"; |
| | | MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errorMsg)); |
| | | } |
| | | continue; |
| | | } |
| | | } else { |
| | | staProtocol.setWorkNo((short) 9999); |
| | | staProtocol.setStaNo(inSta.getBackSta().shortValue()); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | |
| | | News.info(""+mark+" - 3"+" - 扫码失败2 ===>> {}号条码扫描器检测条码信息:{},站点:{}", inSta.getBarcode(), barcode, inSta.getStaNo()); |
| | | // led 异常显示 |
| | | if (ledThread != null) { |
| | | String errorMsg = "扫码失败,请重试"; |
| | | MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errorMsg)); |
| | | } |
| | | continue; |
| | | } |
| | | // if(!Cools.isEmpty(barcode) ) { |
| | | //// News.info(""+mark+" - 1"+" - {}号条码扫描器检测条码信息:{}", inSta.getBarcode(), barcode); |
| | | // |
| | | // if("NG".endsWith(barcode) || "NoRead".equals(barcode) || "empty".equals(barcode)) { |
| | | // staProtocol.setWorkNo((short) 9999); |
| | | // staProtocol.setStaNo(inSta.getBackSta().shortValue()); |
| | | // devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | // MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | // |
| | | // News.info(""+mark+" - 2"+" - 扫码失败1 ===>> {}号条码扫描器检测条码信息:{},站点:{}", inSta.getBarcode(), barcode, inSta.getStaNo()); |
| | | // // led 异常显示 |
| | | // if (ledThread != null) { |
| | | // String errorMsg = "扫码失败,请重试"; |
| | | // MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errorMsg)); |
| | | // } |
| | | // continue; |
| | | // } |
| | | // } else { |
| | | // staProtocol.setWorkNo((short) 9999); |
| | | // staProtocol.setStaNo(inSta.getBackSta().shortValue()); |
| | | // devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | // MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | // |
| | | // News.info(""+mark+" - 3"+" - 扫码失败2 ===>> {}号条码扫描器检测条码信息:{},站点:{}", inSta.getBarcode(), barcode, inSta.getStaNo()); |
| | | // // led 异常显示 |
| | | // if (ledThread != null) { |
| | | // String errorMsg = "扫码失败,请重试"; |
| | | // MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errorMsg)); |
| | | // } |
| | | // continue; |
| | | // } |
| | | |
| | | // 判断重复工作档 |
| | | WrkMast wrkMast = wrkMastMapper.selectPakInStep1(inSta.getStaNo(), barcode); |
| | |
| | | } |
| | | } |
| | | if (wrkMast != null) { |
| | | News.error(""+mark+" - 4"+" - 工作档中已存在该站状态为( 2.设备上走 )的数据,工作号={}", wrkMast.getWrkNo()); |
| | | News.warn(""+mark+" - 4"+" - 工作档中已存在该站状态为( 2.设备上走 )的数据,工作号={}", wrkMast.getWrkNo()); |
| | | staProtocol.setWorkNo((short)9999); |
| | | staProtocol.setStaNo(inSta.getBackSta().shortValue()); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | |
| | | } |
| | | String barcode = barcodeThread.getBarcode(); |
| | | if(!Cools.isEmpty(barcode)) { |
| | | News.info(""+mark+" - 1"+" - {}号条码扫描器检测条码信息:{}", pickSta.getBarcode(), barcode); |
| | | // News.info(""+mark+" - 1"+" - {}号条码扫描器检测条码信息:{}", pickSta.getBarcode(), barcode); |
| | | if("NG".endsWith(barcode) || "NoRead".equals(barcode)) { |
| | | continue; |
| | | } |
| | |
| | | } |
| | | |
| | | // 拣、盘、并 作业站转换 |
| | | // int stnNo = 0; |
| | | // if (wrkMast.getStaNo() == 109) { |
| | | // stnNo = 127; |
| | | // } else if (wrkMast.getStaNo() == 113) { |
| | | // stnNo = 128; |
| | | // } else { |
| | | // log.error("{}号任务数据异常!", wrkMast.getWrkNo()); |
| | | // } |
| | | int stnNo = 0; |
| | | if (wrkMast.getIoType() == 103) { // 拣料出库 |
| | | if(wrkMast.getCrnNo() == 1) { |
| | | stnNo = 104; |
| | | }else if(wrkMast.getCrnNo() == 2) { |
| | | stnNo =204; |
| | | }else if(wrkMast.getCrnNo() == 3) { |
| | | stnNo = 304; |
| | | } |
| | | } else if(wrkMast.getIoType() == 107){ //盘点出库 |
| | | if(wrkMast.getCrnNo() == 1) { |
| | | stnNo = 101; |
| | | }else if(wrkMast.getCrnNo() == 2) { |
| | | stnNo =201; |
| | | }else if(wrkMast.getCrnNo() == 3) { |
| | | stnNo = 301; |
| | | } |
| | | } |
| | | if (stnNo == 0) { |
| | | log.error("{}号任务数据异常!", wrkMast.getWrkNo()); |
| | | continue; |
| | | } |
| | | // 获取目标站 |
| | | Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>() |
| | | .eq("type_no", wrkMast.getIoType() - 50) |
| | | .eq("stn_no", pickSta.getStaNo()) // 作业站点 = 拣料出库的目标站 |
| | | .eq("stn_no", stnNo) // 作业站点 = 拣料出库的目标站 |
| | | .eq("crn_no", wrkMast.getCrnNo()); // 堆垛机号 |
| | | StaDesc staDesc = staDescService.selectOne(wrapper); |
| | | if (Cools.isEmpty(staDesc)) { |
| | |
| | | wrkMast.setIoTime(now); |
| | | wrkMast.setIoType(wrkMast.getIoType() - 50); // 入出库类型: 103->53,104->54,107->57 |
| | | wrkMast.setWrkSts(2L); // 工作状态: 2.设备上走 |
| | | wrkMast.setSourceStaNo(100); // 源站 |
| | | wrkMast.setSourceStaNo(wrkMast.getStaNo()); // 源站 |
| | | wrkMast.setStaNo(staNo); // 目标站 |
| | | wrkMast.setLocNo(wrkMast.getSourceLocNo()); // 目标库位 = 出库时的源库位 |
| | | wrkMast.setSourceLocNo(""); // 源库位清空 |
| | |
| | | //mark - 3 - .... |
| | | this.locToLoc(crn, crnProtocol,mark); |
| | | |
| | | if (!Cools.isEmpty(basCrnp.getMoveOrigin()) && basCrnp.getMoveOrigin().equals("Y")){ |
| | | if (crnProtocol.getStatusType() == CrnStatusType.IDLE && crnProtocol.getTaskNo() == 0 && crnProtocol.getModeType() == CrnModeType.AUTO |
| | | && crnThread.isCmdFlag()) { |
| | | this.crnMoveIntXY(crn, crnProtocol, crnThread); |
| | | this.crnMoveOutXY(crn, crnProtocol, crnThread); |
| | | } |
| | | } |
| | | // if (!Cools.isEmpty(basCrnp.getMoveOrigin()) && basCrnp.getMoveOrigin().equals("Y")){ |
| | | // if (crnProtocol.getStatusType() == CrnStatusType.IDLE && crnProtocol.getTaskNo() == 0 && crnProtocol.getModeType() == CrnModeType.AUTO |
| | | // && crnThread.isCmdFlag()) { |
| | | // this.crnMoveIntXY(crn, crnProtocol, crnThread); |
| | | // this.crnMoveOutXY(crn, crnProtocol, crnThread); |
| | | // } |
| | | // } |
| | | // this.crnRebackHp(crnProtocol, crnThread); |
| | | |
| | | } |
| | |
| | | crnCommand.setDestinationPosX(locMast.getRow1().shortValue()); // 目标库位排 |
| | | crnCommand.setDestinationPosY(locMast.getBay1().shortValue()); // 目标库位列 |
| | | crnCommand.setDestinationPosZ(locMast.getLev1().shortValue()); // 目标库位层 |
| | | crnCommand.setCommand((short) 1); |
| | | if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(2, crnCommand))) { |
| | | News.error(""+mark+" - 1"+" - 16"+" - 堆垛机命令下发失败,堆垛机号={},任务数据={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand)); |
| | | } else { |
| | |
| | | crnCommand.setDestinationPosX(crnStn.getRow().shortValue()); // 目标库位排 |
| | | crnCommand.setDestinationPosY(crnStn.getBay().shortValue()); // 目标库位列 |
| | | crnCommand.setDestinationPosZ(crnStn.getLev().shortValue()); // 目标库位层 |
| | | crnCommand.setCommand((short) 1); |
| | | if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(2, crnCommand))) { |
| | | News.error(""+mark+" - 2"+" - 13"+" - 堆垛机命令下发失败,堆垛机号={},任务数据={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand)); |
| | | } else { |
| | |
| | | crnThread.setResetFlag(true); |
| | | } else { |
| | | // 获取入库待确认工作档 |
| | | WrkMast wrkMast = wrkMastMapper.selectPakInStep3(crnProtocol.getTaskNo().intValue()); |
| | | System.out.println("任务号"+crnProtocol.getTaskNo()); |
| | | WrkMast wrkMast = wrkMastMapper.selectPakInStep3(Integer.valueOf(crnProtocol.getTaskNo())); |
| | | if (wrkMast == null) { |
| | | News.error(""+mark+" - 1"+" - 堆垛机处于等待确认且任务完成状态,但未找到工作档。堆垛机号={},工作号={}", crn.getId(), crnProtocol.getTaskNo()); |
| | | continue; |
| | |
| | | if (staProtocol.isAutoing() |
| | | && staProtocol.isInEnable() |
| | | && staProtocol.isEmptyMk() |
| | | && (staProtocol.getWorkNo() > 9990 && staProtocol.getWorkNo() <= 9999) |
| | | && staProtocol.isPakMk() ) { |
| | | && (staProtocol.getWorkNo() >= 9990 && staProtocol.getWorkNo() <= 9999) |
| | | && staProtocol.isPakMk() |
| | | ) { |
| | | News.warnNoLog(""+mark+" - 0"+" - 开始执行:空栈板初始化入库,叉车入库站放货"); |
| | | |
| | | try { |
| | |
| | | import lombok.Data; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.PreDestroy; |
| | | import java.util.ArrayList; |
| | | |
| | | /** |
| | | * WCS主流程 |
| | |
| | | } |
| | | |
| | | // 演示 |
| | | mainService.crnDemoOfLocMove1(); |
| | | // mainService.crnDemoOfLocMove1(); |
| | | // 入出库模式切换函数 |
| | | // mainService.ioConvert(); |
| | | // 入库 ===>> 入库站到堆垛机站,根据条码扫描生成入库工作档 |
| | | mainService.generateStoreWrkFile(1); // 组托 |
| | | mainService.generateStoreWrkFile0(2); // WMS入库 |
| | | // mainService.generateStoreWrkFile0(2); // WMS入库 |
| | | Thread.sleep(500); |
| | | // 拣料、并板、盘点再入库 |
| | | mainService.stnToCrnStnPick(3); |
| | |
| | | // 锁定标记 |
| | | private boolean pakMk = true; |
| | | |
| | | // 外形检测 ------------------------------------------------------------------------ |
| | | |
| | | // 前超限 |
| | | private boolean frontErr = false; |
| | | |
| | | // 后超限 |
| | | private boolean backErr = false; |
| | | |
| | | // 高超限 |
| | | private boolean highErr = false; |
| | | |
| | | // 左超限 |
| | | private boolean leftErr = false; |
| | | |
| | | // 右超限 |
| | | private boolean rightErr = false; |
| | | |
| | | // 超重 |
| | | private boolean weightErr = false; |
| | | |
| | | // 扫码失败 |
| | | private boolean barcodeErr = false; |
| | | |
| | | // 入库暂存数 |
| | | private Short inQty; |
| | | |
| | |
| | | import HslCommunication.Profinet.Siemens.SiemensPLCS; |
| | | import HslCommunication.Profinet.Siemens.SiemensS7Net; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.SpringUtils; |
| | | import com.zy.asrs.entity.BasCrnOpt; |
| | |
| | | import com.zy.core.CrnThread; |
| | | import com.zy.core.cache.MessageQueue; |
| | | import com.zy.core.cache.OutputQueue; |
| | | import com.zy.core.enums.*; |
| | | import com.zy.core.enums.CrnStatusType; |
| | | import com.zy.core.enums.CrnTaskModeType; |
| | | import com.zy.core.enums.SlaveType; |
| | | import com.zy.core.model.CrnSlave; |
| | | import com.zy.core.model.Task; |
| | | import com.zy.core.model.command.CrnCommand; |
| | |
| | | */ |
| | | private void readStatus(){ |
| | | try { |
| | | OperateResultExOne<byte[]> result = siemensNet.Read("DB91.0", (short) 52); |
| | | OperateResultExOne<byte[]> result = siemensNet.Read("DB101.0", (short) 54); |
| | | if (result.IsSuccess) { |
| | | if (null == crnProtocol) { |
| | | crnProtocol = new CrnProtocol(); |
| | |
| | | crnProtocol.setLoaded(siemensNet.getByteTransform().TransInt16(result.Content, 16)); |
| | | crnProtocol.setAlarm(siemensNet.getByteTransform().TransInt16(result.Content, 18)); |
| | | |
| | | // crnProtocol.setxSpeed(siemensNet.getByteTransform().TransInt16(result.Content, 28)); |
| | | // crnProtocol.setySpeed(siemensNet.getByteTransform().TransInt16(result.Content, 32)); |
| | | // crnProtocol.setzSpeed(siemensNet.getByteTransform().TransInt16(result.Content, 36)); |
| | | crnProtocol.setxSpeed(siemensNet.getByteTransform().TransInt16(result.Content, 34)); |
| | | crnProtocol.setySpeed(siemensNet.getByteTransform().TransInt16(result.Content, 36)); |
| | | crnProtocol.setzSpeed(siemensNet.getByteTransform().TransInt16(result.Content, 38)); |
| | | crnProtocol.setxSpeed(siemensNet.getByteTransform().TransInt16(result.Content, 28)); |
| | | crnProtocol.setySpeed(siemensNet.getByteTransform().TransInt16(result.Content, 32)); |
| | | crnProtocol.setzSpeed(siemensNet.getByteTransform().TransInt16(result.Content, 36)); |
| | | // crnProtocol.setxSpeed(siemensNet.getByteTransform().TransInt16(result.Content, 34)); |
| | | // crnProtocol.setySpeed(siemensNet.getByteTransform().TransInt16(result.Content, 36)); |
| | | // crnProtocol.setzSpeed(siemensNet.getByteTransform().TransInt16(result.Content, 38)); |
| | | |
| | | // crnProtocol.setxDistance(siemensNet.getByteTransform().TransInt16(result.Content, 40)); |
| | | // crnProtocol.setyDistance(siemensNet.getByteTransform().TransInt16(result.Content, 44)); |
| | | // crnProtocol.setxDuration(siemensNet.getByteTransform().TransInt16(result.Content, 48)); |
| | | crnProtocol.setxDistance(siemensNet.getByteTransform().TransInt16(result.Content, 40)); |
| | | crnProtocol.setyDistance(siemensNet.getByteTransform().TransInt16(result.Content, 42)); |
| | | crnProtocol.setxDuration(siemensNet.getByteTransform().TransInt16(result.Content, 44)); |
| | | crnProtocol.setyDuration(siemensNet.getByteTransform().TransInt16(result.Content, 46)); |
| | | crnProtocol.setyDistance(siemensNet.getByteTransform().TransInt16(result.Content, 44)); |
| | | crnProtocol.setxDuration(siemensNet.getByteTransform().TransInt16(result.Content, 48)); |
| | | // crnProtocol.setxDistance(siemensNet.getByteTransform().TransInt16(result.Content, 40)); |
| | | // crnProtocol.setyDistance(siemensNet.getByteTransform().TransInt16(result.Content, 42)); |
| | | // crnProtocol.setxDuration(siemensNet.getByteTransform().TransInt16(result.Content, 44)); |
| | | crnProtocol.setyDuration(siemensNet.getByteTransform().TransInt16(result.Content, 52)); |
| | | |
| | | |
| | | // crnProtocol.setTemp1(siemensNet.getByteTransform().TransInt16(result.Content, 20)); |
| | |
| | | OutputQueue.CRN.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功",DateUtils.convert(new Date()), slave.getId())); |
| | | |
| | | // 复位信号 |
| | | if (!Cools.isEmpty(crnProtocol.getStatusType()) && crnProtocol.getStatusType().equals(CrnStatusType.WAITING)) { |
| | | // if (!Cools.isEmpty(crnProtocol.getStatusType()) && crnProtocol.getStatusType().equals(CrnStatusType.WAITING)) { |
| | | // if (resetFlag) { |
| | | // if(crnProtocol.getTaskNo()==9999){ |
| | | // backHpFlag = false; |
| | | // } |
| | | // CrnCommand crnCommand = new CrnCommand(); |
| | | // crnCommand.setAckFinish((short)1); |
| | | // if (write(crnCommand)) { |
| | | // resetFlag = false; |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | if (crnProtocol.getStatusType().equals(CrnStatusType.WAITING)) { |
| | | // News.error("-------------------------------------------第一步、[堆垛机号:{}, 工作号:{}, 载货台信号:{}]==>> 状态为10,等待确认!!", |
| | | // slave.getId(),crnProtocol.getTaskNo(), crnProtocol.getLoaded()==1 ? "有物" : "无物"); |
| | | if (resetFlag) { |
| | | if(crnProtocol.getTaskNo()==9999){ |
| | | backHpFlag = false; |
| | | } |
| | | CrnCommand crnCommand = new CrnCommand(); |
| | | crnCommand.setAckFinish((short)1); |
| | | if (write(crnCommand)) { |
| | | resetFlag = false; |
| | | // cmdFlag = true; |
| | | } |
| | | } |
| | | } |
| | |
| | | News.error("SiemensCrn"+" - 6"+" - 堆垛机写入命令为空"); |
| | | return false; |
| | | } |
| | | OperateResult result; |
| | | // convertRow(command); |
| | | command.setCrnNo(slave.getId()); |
| | | short[] array = new short[10]; |
| | | array[0] = command.getAckFinish(); |
| | | array[1] = command.getTaskNo(); |
| | | array[2] = command.getTaskMode(); |
| | | array[3] = command.getSourcePosX(); |
| | | array[4] = command.getSourcePosY(); |
| | | array[5] = command.getSourcePosZ(); |
| | | array[6] = command.getDestinationPosX(); |
| | | array[7] = command.getDestinationPosY(); |
| | | array[8] = command.getDestinationPosZ(); |
| | | if (command.getAckFinish() == 1) { |
| | | result = siemensNet.Write("DB100.0", (short) 1); |
| | | // result = siemensNet.Write("DB100.18", 0); |
| | | } else { |
| | | command.setCrnNo(slave.getId()); |
| | | short[] array = new short[10]; |
| | | array[0] = command.getAckFinish(); |
| | | array[1] = command.getTaskNo(); |
| | | array[2] = command.getTaskMode(); |
| | | array[3] = command.getSourcePosX(); |
| | | array[4] = command.getSourcePosY(); |
| | | array[5] = command.getSourcePosZ(); |
| | | array[6] = command.getDestinationPosX(); |
| | | array[7] = command.getDestinationPosY(); |
| | | array[8] = command.getDestinationPosZ(); |
| | | // array[9] = command.getSourceStaNo(); |
| | | // array[10] = command.getDestinationStaNo(); |
| | | array[9] = command.getCommand(); |
| | | OperateResult result = siemensNet.Write("DB90.0", array); |
| | | array[9] = command.getCommand(); |
| | | result = siemensNet.Write("DB100.0", array); |
| | | |
| | | if (command.getAckFinish() == 0) { |
| | | short commandFinish = 1; |
| | | Thread.sleep(100L); |
| | | result = siemensNet.Write("DB90.18", commandFinish); |
| | | // if (command.getAckFinish() == 0) { |
| | | // short commandFinish = 1; |
| | | // Thread.sleep(100L); |
| | | // result = siemensNet.Write("DB100.18", commandFinish); |
| | | // } |
| | | } |
| | | |
| | | try { |
| | |
| | | public static void main(String[] args) throws InterruptedException { |
| | | CrnSlave slave = new CrnSlave(); |
| | | slave.setId(1); |
| | | slave.setIp("192.168.6.9"); |
| | | slave.setIp("10.10.10.10"); |
| | | slave.setPort(0); |
| | | slave.setRack(0); |
| | | slave.setSlot(0); |
| | | SiemensCrnThread crnThread = new SiemensCrnThread(slave); |
| | |
| | | |
| | | // 1.入库 源和目标都发 |
| | | // CrnCommand command = new CrnCommand(); |
| | | // command.setCrnNo(1); // 堆垛机编号 |
| | | // command.setTaskNo((short) 0); // 工作号 |
| | | //// command.setCrnNo(3); // 堆垛机编号 |
| | | // command.setTaskNo((short) 2); // 工作号 |
| | | // command.setAckFinish((short) 0); // 任务完成确认位 |
| | | // command.setTaskMode(CrnTaskModeType.PAKIN); // 任务模式 |
| | | // command.setSourcePosX((short) 1); // 源库位排 |
| | | // command.setSourcePosY((short) 0); // 源库位列 |
| | | // command.setSourcePosZ((short) 1); // 源库位层 |
| | | // command.setDestinationPosX((short) 2); // 目标库位排 |
| | | // command.setDestinationPosY((short) 3); // 目标库位列 |
| | | // command.setSourcePosX((short) 6); // 源库位排 |
| | | // command.setSourcePosY((short) 2); // 源库位列 |
| | | // command.setSourcePosZ((short) 2); // 源库位层 |
| | | // command.setDestinationPosX((short) 6); // 目标库位排 |
| | | // command.setDestinationPosY((short) 0); // 目标库位列 |
| | | // command.setDestinationPosZ((short) 1); // 目标库位层 |
| | | // command.setCommand((short)1); |
| | | // crnThread.write(command); |
| | | |
| | | // 2.出库 源和目标都发 |
| | |
| | | add(300);add(301);add(302);add(303);add(304); |
| | | }}; |
| | | |
| | | public static final ArrayList<Integer> barcode1 = new ArrayList<Integer>() {{ |
| | | add(1); add(2); |
| | | }}; |
| | | |
| | | |
| | | public static final ArrayList<Integer> barcode2 = new ArrayList<Integer>() {{ |
| | | add(3); |
| | | }}; |
| | | |
| | | private Integer count=0; |
| | | |
| | | /** |
| | | * 条码数量 |
| | | */ |
| | | private int barcodeSize = 2; |
| | | |
| | | /** |
| | | * 入出库模式 |
| | |
| | | } |
| | | } |
| | | |
| | | private ArrayList<Integer> getBarcodeList() { |
| | | switch (slave.getId()) { |
| | | case 1: |
| | | return barcode1; |
| | | case 2: |
| | | return barcode2; |
| | | default: |
| | | throw new CoolException("获取条码扫描器失败!"); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public boolean connect() { |
| | | boolean result = false; |
| | |
| | | private void read() throws InterruptedException { |
| | | // // 更新入出库模式 |
| | | // updateIoMode(); |
| | | String methodName = Thread.currentThread().getStackTrace()[1].getMethodName(); |
| | | ArrayList<Integer> staNos = getStaNo(); |
| | | int staNoSize = staNos.size(); |
| | | OperateResultExOne<byte[]> result = siemensS7Net.Read("DB100.0", (short) (staNoSize*4)); |
| | | // OperateResultExOne<byte[]> result4 = siemensS7Net.Read("DB101.0", (short) (staNoSize*2)); |
| | | if (result.IsSuccess) { |
| | | for (int i = 0; i < staNoSize; i++) { |
| | | Integer siteId = staNos.get(i); // 站点编号 |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | if (null == staProtocol) { |
| | | staProtocol = new StaProtocol(); |
| | | staProtocol.setSiteId(siteId); |
| | | station.put(siteId, staProtocol); |
| | | } |
| | | staProtocol.setWorkNo(siemensS7Net.getByteTransform().TransInt16(result.Content, i*4)); // 工作号 |
| | | if (slave.getId() == 1) { |
| | | |
| | | staProtocol.setStaNo(siemensS7Net.getByteTransform().TransInt16(result.Content, i*4+2)); // 目标站 |
| | | } else if (slave.getId() == 2) { |
| | | OperateResultExOne<byte[]> result = siemensS7Net.Read("DB101.0", (short) (staNoSize*8)); |
| | | if (result.IsSuccess) { |
| | | for (int i = 0; i < staNoSize; i++) { |
| | | Integer siteId = staNos.get(i); // 站点编号 |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | if (null == staProtocol) { |
| | | staProtocol = new StaProtocol(); |
| | | staProtocol.setSiteId(siteId); |
| | | station.put(siteId, staProtocol); |
| | | } |
| | | staProtocol.setWorkNo((short) siemensS7Net.getByteTransform().TransInt32(result.Content, i * 8)); // 工作号 |
| | | staProtocol.setStaNo( siemensS7Net.getByteTransform().TransInt16(result.Content, i*8 + 4 )); // 目标站 |
| | | boolean[] status = siemensS7Net.getByteTransform().TransBool(result.Content, i*8+6, 1); |
| | | staProtocol.setAutoing(status[0]); // 自动 |
| | | staProtocol.setLoading(status[1]); // 有物 |
| | | staProtocol.setInEnable(status[2]); // 可入 |
| | | staProtocol.setOutEnable(status[3]);// 可出 |
| | | staProtocol.setEmptyMk(status[4]); // 空板信号 |
| | | staProtocol.setFullPlt(status[5]); // 满托盘 |
| | | staProtocol.setHigh(status[6]); // 高库位 |
| | | staProtocol.setLow(status[7]); // 低库位 |
| | | // staProtocol.setWeight(status[8]); //是否为重货 |
| | | if (!staProtocol.isPakMk() && staProtocol.isLoading()) { |
| | | staProtocol.setPakMk(true); |
| | | } |
| | | } |
| | | |
| | | // 根据实时信息更新数据库 |
| | | try { |
| | | List<BasDevp> basDevps = new ArrayList<>(); |
| | | for (Integer siteId : staNos) { |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | basDevps.add(staProtocol.toSqlModel()); |
| | | } |
| | | |
| | | BasDevpService basDevpService = SpringUtils.getBean(BasDevpService.class); |
| | | if (null != basDevpService && !basDevpService.updateBatchById(basDevps)) { |
| | | throw new Exception("更新数据库数据失败"); |
| | | } |
| | | } catch (Exception e) { |
| | | 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(methodName + ":更新数据库数据失败 ===>> [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}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort())); |
| | | log.error("读取输送线plc状态信息失败 ===>> [id:{}] [ip:{}] [port:{}] ", slave.getId(), slave.getIp(), slave.getPort()); |
| | | } |
| | | } |
| | | |
| | | Thread.sleep(200); |
| | | OperateResultExOne<byte[]> result1 = siemensS7Net.Read("DB100.60", (short) (staNoSize * 2)); |
| | | if (result1.IsSuccess) { |
| | | for (int i = 0; i < staNoSize; i++) { |
| | | Integer siteId = staNos.get(i); // 站点编号 |
| | | boolean[] status = siemensS7Net.getByteTransform().TransBool(result1.Content, i*2, 1); |
| | | boolean[] status2 = siemensS7Net.getByteTransform().TransBool(result1.Content, i*2+1, 1); |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | staProtocol.setAutoing(status[0]); // 自动 |
| | | staProtocol.setLoading(status[1]); // 有物 |
| | | staProtocol.setInEnable(status[2]); // 可入 |
| | | staProtocol.setOutEnable(status[3]);// 可出 |
| | | staProtocol.setEmptyMk(status[4]); // 空板信号 |
| | | staProtocol.setFullPlt(status[5]); // 满托盘 |
| | | staProtocol.setLow(status[6]); // 低库位 |
| | | staProtocol.setMedium(status[7]); // 中库位 |
| | | staProtocol.setMedium_high(status2[0]); //中高库位 |
| | | staProtocol.setHigh(status2[1]); // 高库位 |
| | | if (!staProtocol.isPakMk() && !staProtocol.isLoading()) { |
| | | staProtocol.setPakMk(true); |
| | | } |
| | | //外形检测 |
| | | OperateResultExOne<byte[]> resultErr = siemensS7Net.Read("DB101.42", (short) 8); |
| | | if (resultErr.IsSuccess){ |
| | | boolean[] status = siemensS7Net.getByteTransform().TransBool(resultErr.Content, 0, 1); |
| | | StaProtocol staProtocol = station.get(303); |
| | | 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]); |
| | | } |
| | | |
| | | if (!staProtocol.isLoading()){ |
| | | staProtocol.setStamp(0); |
| | | //条码扫描器 |
| | | Thread.sleep(200); |
| | | ArrayList<Integer> barcodeList = getBarcodeList(); |
| | | OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB101.60", (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); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // //条码扫描器 |
| | | // Thread.sleep(200); |
| | | // OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB101.60",(short)8); |
| | | // if (result2.IsSuccess) { |
| | | // String barcode = siemensS7Net.getByteTransform().TransString(result2.Content,0,8, "UTF-8"); |
| | | // BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, 3); |
| | | // if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { |
| | | // barcodeThread.setBarcode(barcode); |
| | | // } |
| | | // } |
| | | } |
| | | |
| | | // |
| | | // if (result.IsSuccess) { |
| | | // for (int i = 0; i < staNoSize; i++) { |
| | | // Integer siteId = staNos.get(i); // 站点编号 |
| | | // StaProtocol staProtocol = station.get(siteId); |
| | | // if (null == staProtocol) { |
| | | // staProtocol = new StaProtocol(); |
| | | // staProtocol.setSiteId(siteId); |
| | | // station.put(siteId, staProtocol); |
| | | // } |
| | | // staProtocol.setWorkNo(siemensS7Net.getByteTransform().TransInt16(result.Content, i*4)); // 工作号 |
| | | // |
| | | // staProtocol.setStaNo(siemensS7Net.getByteTransform().TransInt16(result.Content, i*4+2)); // 目标站 |
| | | // } |
| | | // } |
| | | |
| | | // Thread.sleep(200); |
| | | // OperateResultExOne<byte[]> result1 = siemensS7Net.Read("DB100.60", (short) (staNoSize * 2)); |
| | | // if (result1.IsSuccess) { |
| | | // for (int i = 0; i < staNoSize; i++) { |
| | | // Integer siteId = staNos.get(i); // 站点编号 |
| | | // boolean[] status = siemensS7Net.getByteTransform().TransBool(result1.Content, i*2, 1); |
| | | // boolean[] status2 = siemensS7Net.getByteTransform().TransBool(result1.Content, i*2+1, 1); |
| | | // StaProtocol staProtocol = station.get(siteId); |
| | | // staProtocol.setAutoing(status[0]); // 自动 |
| | | // staProtocol.setLoading(status[1]); // 有物 |
| | | // staProtocol.setInEnable(status[2]); // 可入 |
| | | // staProtocol.setOutEnable(status[3]);// 可出 |
| | | // staProtocol.setEmptyMk(status[4]); // 空板信号 |
| | | // staProtocol.setFullPlt(status[5]); // 满托盘 |
| | | // staProtocol.setLow(status[6]); // 低库位 |
| | | // staProtocol.setMedium(status[7]); // 中库位 |
| | | // staProtocol.setMedium_high(status2[0]); //中高库位 |
| | | // staProtocol.setHigh(status2[1]); // 高库位 |
| | | // if (!staProtocol.isPakMk() && !staProtocol.isLoading()) { |
| | | // staProtocol.setPakMk(true); |
| | | // } |
| | | // |
| | | // if (!staProtocol.isLoading()){ |
| | | // staProtocol.setStamp(0); |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | //接收超宽超高没扫到条码报警 |
| | | Thread.sleep(200); |
| | | OperateResultExOne<byte[]> result4 = siemensS7Net.Read("DB101.34",(short)(1)); |
| | | if (result4.IsSuccess) { |
| | | startSignal = siemensS7Net.getByteTransform().TransBool(result4.Content, 0, 1); |
| | | } |
| | | // Thread.sleep(200); |
| | | // OperateResultExOne<byte[]> result4 = siemensS7Net.Read("DB101.34",(short)(1)); |
| | | // if (result4.IsSuccess) { |
| | | // startSignal = siemensS7Net.getByteTransform().TransBool(result4.Content, 0, 1); |
| | | // } |
| | | |
| | | |
| | | //条码扫描器 |
| | | Thread.sleep(200); |
| | | OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB100.90",(short)(barcodeSize*8)); |
| | | if (result2.IsSuccess) { |
| | | for (int i = 0; i < barcodeSize; i++) { |
| | | String barcode = siemensS7Net.getByteTransform().TransString(result2.Content,i*8,8, "UTF-8"); |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, i + 1); |
| | | if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { |
| | | barcodeThread.setBarcode(barcode); |
| | | } |
| | | } |
| | | } |
| | | // Thread.sleep(200); |
| | | // OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB101.60",(short)(barcodeSize*8)); |
| | | // if (result2.IsSuccess) { |
| | | // for (int i = 0; i < barcodeSize; i++) { |
| | | // String barcode = siemensS7Net.getByteTransform().TransString(result2.Content,i*8,8, "UTF-8"); |
| | | // BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, i + 1); |
| | | // if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { |
| | | // barcodeThread.setBarcode(barcode); |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | if (result.IsSuccess && result1.IsSuccess) { |
| | | |
| | | 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 = 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()); |
| | | } |
| | | // if (result.IsSuccess && result1.IsSuccess) { |
| | | // |
| | | // 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 = 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()); |
| | | // } |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | OperateResult write = null; |
| | | OperateResult write1 = null; |
| | | //任务下发次数 |
| | | int writeCount = 0; |
| | | do { |
| | | write = siemensS7Net.Write("DB100." + index*4, staProtocol.getWorkNo()); // 工作号 |
| | | // //任务下发次数 |
| | | // int writeCount = 0; |
| | | // do { |
| | | write1 = siemensS7Net.Write("DB100." + (index*6+4), staProtocol.getStaNo()); // 目标站 |
| | | Thread.sleep(500); |
| | | write1 = siemensS7Net.Write("DB100." + (index*4+2), staProtocol.getStaNo()); // 目标站 |
| | | if(write.IsSuccess || write1.IsSuccess){ |
| | | Thread.sleep(200); |
| | | OperateResultExOne<byte[]> readResult = siemensS7Net.Read("DB100." + index*4, (short) 2); |
| | | OperateResultExOne<byte[]> readResult1 = siemensS7Net.Read("DB100." + (index*4+2), (short) 2); |
| | | if(readResult.IsSuccess && readResult1.IsSuccess){ |
| | | short workNo = siemensS7Net.getByteTransform().TransInt16(readResult.Content, 0); |
| | | short staNo = siemensS7Net.getByteTransform().TransInt16(readResult1.Content, 0); |
| | | if(staProtocol.getWorkNo().equals(workNo) && staProtocol.getStaNo().equals(staNo)){ |
| | | //任务命令写入成功 |
| | | log.info("写入堆垛机命令后返回成功,并且回读成功。堆垛机plc编号={},{},写入次数={}", slave.getId(), JSON.toJSON(staProtocol), writeCount); |
| | | break; |
| | | } else {//返回结果是成功了,但是真实值不相同 |
| | | writeCount++; |
| | | log.error("写入堆垛机命令后返回成功,但是读取任务值不一致。堆垛机plc编号={},{},写入次数={}", slave.getId(), JSON.toJSON(staProtocol), writeCount); |
| | | } |
| | | } else { |
| | | writeCount++; |
| | | log.error("写入堆垛机命令后读取失败。堆垛机plc编号={},站点数据={},写入次数={}", slave.getId(), JSON.toJSON(staProtocol), writeCount); |
| | | } |
| | | } |
| | | else { |
| | | writeCount++; |
| | | log.error("写入堆垛机命令后读取失败。堆垛机plc编号={},站点数据={},写入次数={}", slave.getId(), JSON.toJSON(staProtocol), writeCount); |
| | | } |
| | | }while (writeCount<5); |
| | | write = siemensS7Net.Write("DB100." + index*6, staProtocol.getWorkNo().intValue()); // 工作号 |
| | | |
| | | // if(write.IsSuccess || write1.IsSuccess){ |
| | | // Thread.sleep(200); |
| | | // OperateResultExOne<byte[]> readResult = siemensS7Net.Read("DB100." + index*4, (short) 2); |
| | | // OperateResultExOne<byte[]> readResult1 = siemensS7Net.Read("DB100." + (index*4+2), (short) 2); |
| | | // if(readResult.IsSuccess && readResult1.IsSuccess){ |
| | | // short workNo = siemensS7Net.getByteTransform().TransInt16(readResult.Content, 0); |
| | | // short staNo = siemensS7Net.getByteTransform().TransInt16(readResult1.Content, 0); |
| | | // if(staProtocol.getWorkNo().equals(workNo) && staProtocol.getStaNo().equals(staNo)){ |
| | | // //任务命令写入成功 |
| | | // log.info("写入堆垛机命令后返回成功,并且回读成功。堆垛机plc编号={},{},写入次数={}", slave.getId(), JSON.toJSON(staProtocol), writeCount); |
| | | // break; |
| | | // } else {//返回结果是成功了,但是真实值不相同 |
| | | // writeCount++; |
| | | // log.error("写入堆垛机命令后返回成功,但是读取任务值不一致。堆垛机plc编号={},{},写入次数={}", slave.getId(), JSON.toJSON(staProtocol), writeCount); |
| | | // } |
| | | // } else { |
| | | // writeCount++; |
| | | // log.error("写入堆垛机命令后读取失败。堆垛机plc编号={},站点数据={},写入次数={}", slave.getId(), JSON.toJSON(staProtocol), writeCount); |
| | | // } |
| | | // } |
| | | // else { |
| | | // writeCount++; |
| | | // log.error("写入堆垛机命令后读取失败。堆垛机plc编号={},站点数据={},写入次数={}", slave.getId(), JSON.toJSON(staProtocol), writeCount); |
| | | // } |
| | | // }while (writeCount<5); |
| | | |
| | | if (!write.IsSuccess || !write1.IsSuccess) { |
| | | staProtocol = station.get(staProtocol.getSiteId()); |
| | |
| | | siemensS7Net.ConnectClose(); |
| | | } |
| | | |
| | | 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++) { |
| | | // 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); |
| | | } |
| | | // 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++) { |
| | | //// 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); |
| | | // } |
| | | |
| | | // public static void main(String[] args) throws Exception { |
| | | // DevpSlave slave = new DevpSlave(); |
| | | // slave.setIp("192.168.2.125"); |
| | | // SiemensDevpThread devpThread = new SiemensDevpThread(slave); |
| | | // devpThread.connect(); |
| | | // devpThread.read(); |
| | | // // 写 |
| | | // StaProtocol staProtocol = devpThread.getStation().get(1); |
| | | // staProtocol.setWorkNo((short) 232); |
| | | // staProtocol.setStaNo((short) 6); |
| | | public static void main(String[] args) throws Exception { |
| | | DevpSlave slave = new DevpSlave(); |
| | | slave.setId(1); |
| | | slave.setIp("10.10.10.100"); |
| | | slave.setPort(0); |
| | | slave.setRack(0); |
| | | slave.setSlot(0); |
| | | // slave.setIp("10.10.10.130"); |
| | | SiemensDevpThread devpThread = new SiemensDevpThread(slave); |
| | | devpThread.connect(); |
| | | devpThread.read(); |
| | | // 写 |
| | | // StaProtocol staProtocol = devpThread.getStation().get(300); |
| | | // staProtocol.setWorkNo((short) 3002); |
| | | // staProtocol.setStaNo((short) 301); |
| | | // staProtocol.setAutoing(true); |
| | | // staProtocol.setEmptyMk(true); |
| | | // staProtocol.setInEnable(true); |
| | | // staProtocol.setOutEnable(true); |
| | | // devpThread.write(staProtocol); |
| | | // System.out.println("----------------------------------------"); |
| | | // // 读 |
| | | // 读 |
| | | // devpThread.read(); |
| | | // System.out.println(JSON.toJSONString(devpThread.station)); |
| | | // |
| | | // } |
| | | System.out.println(JSON.toJSONString(devpThread.station)); |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | name: @pom.build.finalName@ |
| | | datasource: |
| | | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver |
| | | url: jdbc:sqlserver://192.168.4.15:1433;databasename=sxjzasrs |
| | | url: jdbc:sqlserver://127.0.0.1:1433;databasename=sxjzasrs |
| | | username: sa |
| | | password: sa@123 |
| | | mvc: |
| | |
| | | enable: false |
| | | |
| | | wms: |
| | | url: 127.0.0.1:8080/sxjzwms |
| | | url: 127.0.0.1:8080/jzwms |
| | | |
| | | # 下位机配置 |
| | | wcs-slave: |
| | | # 双深 |
| | | doubleDeep: true |
| | | # 双深库位排号 |
| | | doubleLocs: 1,4,5,8,9,12 |
| | | doubleLocs: 1 |
| | | # 一个堆垛机负责的货架排数 |
| | | groupCount: 4 |
| | | # 堆垛机1 |
| | | crn[0]: |
| | | id: 1 |
| | | ip: 10.10.10.10 |
| | | port: 102 |
| | | rack: 0 |
| | | slot: 0 |
| | | # 偏移量,当堆垛机站点列号=1时,偏移量=2 |
| | | offset: 2 |
| | | demo: false |
| | | # 堆垛机入库站点 |
| | | crnInStn[0]: |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | staNo: 104 |
| | | row: 1 |
| | | bay: 1 |
| | | lev: 1 |
| | | # 堆垛机出库站点 |
| | | crnOutStn[0]: |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | staNo: 100 |
| | | row: 2 |
| | | bay: 1 |
| | | lev: 1 |
| | | # 堆垛机2 |
| | | crn[1]: |
| | | id: 2 |
| | | ip: 10.10.10.18 |
| | | port: 102 |
| | | rack: 0 |
| | | slot: 0 |
| | | # 偏移量,当堆垛机站点列号=1时,偏移量=2 |
| | | offset: 2 |
| | | demo: false |
| | | # 堆垛机入库站点 |
| | | crnInStn[0]: |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | staNo: 204 |
| | | row: 4 |
| | | bay: 1 |
| | | lev: 1 |
| | | # 堆垛机出库站点 |
| | | crnOutStn[0]: |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | staNo: 200 |
| | | row: 5 |
| | | bay: 2 |
| | | lev: 1 |
| | | groupCount: 3 |
| | | # # 堆垛机1 |
| | | # crn[0]: |
| | | # id: 1 |
| | | # ip: 10.10.10.10 |
| | | # port: 102 |
| | | # rack: 0 |
| | | # slot: 0 |
| | | # # 偏移量,当堆垛机站点列号=1时,偏移量=2 |
| | | # offset: 2 |
| | | # demo: false |
| | | # # 堆垛机入库站点 |
| | | # crnInStn[0]: |
| | | # devpPlcId: ${wcs-slave.devp[0].id} |
| | | # staNo: 104 |
| | | # row: 3 |
| | | # bay: 39 |
| | | # lev: 1 |
| | | # # 堆垛机出库站点 |
| | | # crnOutStn[0]: |
| | | # devpPlcId: ${wcs-slave.devp[0].id} |
| | | # staNo: 100 |
| | | # row: 2 |
| | | # bay: 39 |
| | | # lev: 1 |
| | | # # 堆垛机2 |
| | | # crn[1]: |
| | | # id: 2 |
| | | # ip: 10.10.10.18 |
| | | # port: 102 |
| | | # rack: 0 |
| | | # slot: 0 |
| | | # # 偏移量,当堆垛机站点列号=1时,偏移量=2 |
| | | # offset: 2 |
| | | # demo: false |
| | | # # 堆垛机入库站点 |
| | | # crnInStn[0]: |
| | | # devpPlcId: ${wcs-slave.devp[0].id} |
| | | # staNo: 204 |
| | | # row: 5 |
| | | # bay: 39 |
| | | # lev: 1 |
| | | # # 堆垛机出库站点 |
| | | # crnOutStn[0]: |
| | | # devpPlcId: ${wcs-slave.devp[0].id} |
| | | # staNo: 200 |
| | | # row: 4 |
| | | # bay: 39 |
| | | # lev: 1 |
| | | # 堆垛机3 |
| | | crn[2]: |
| | | crn[0]: |
| | | id: 3 |
| | | ip: 10.10.10.110 |
| | | port: 102 |
| | | ip: 10.10.10.30 |
| | | port: 0 |
| | | rack: 0 |
| | | slot: 0 |
| | | # 偏移量,当堆垛机站点列号=1时,偏移量=2 |
| | |
| | | crnInStn[0]: |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | staNo: 304 |
| | | row: 4 |
| | | bay: 1 |
| | | row: 7 |
| | | bay: 0 |
| | | lev: 1 |
| | | # 堆垛机出库站点 |
| | | crnOutStn[0]: |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | staNo: 300 |
| | | row: 5 |
| | | bay: 2 |
| | | row: 6 |
| | | bay: 0 |
| | | lev: 1 |
| | | # 输送线1 |
| | | devp[0]: |
| | | id: 1 |
| | | ip: 10.10.10.100 |
| | | port: 102 |
| | | rack: 0 |
| | | slot: 0 |
| | | # 入库口1 |
| | | inSta[0]: |
| | | staNo: 104 |
| | | barcode: ${wcs-slave.barcode[0].id} |
| | | backSta: 1 |
| | | led: ${wcs-slave.led[0].id} |
| | | # 入库口2 |
| | | inSta[1]: |
| | | staNo: 204 |
| | | barcode: ${wcs-slave.barcode[0].id} |
| | | backSta: 1 |
| | | led: ${wcs-slave.led[0].id} |
| | | # 空板入库口1 |
| | | emptyInSta[0]: |
| | | staNo: 104 |
| | | barcode: ${wcs-slave.barcode[0].id} |
| | | backSta: 1 |
| | | led: ${wcs-slave.led[0].id} |
| | | # 空板入库口2 |
| | | emptyInSta[1]: |
| | | staNo: 101 |
| | | barcode: ${wcs-slave.barcode[0].id} |
| | | backSta: 1 |
| | | led: ${wcs-slave.led[0].id} |
| | | # 拣料入库口1 |
| | | pickSta[0]: |
| | | staNo: 204 |
| | | barcode: ${wcs-slave.barcode[0].id} |
| | | led: ${wcs-slave.led[0].id} |
| | | # 拣料入库口2 |
| | | pickSta[1]: |
| | | staNo: 104 |
| | | barcode: ${wcs-slave.barcode[0].id} |
| | | led: ${wcs-slave.led[0].id} |
| | | # 出库口1 |
| | | outSta[0]: |
| | | staNo: 101 |
| | | led: ${wcs-slave.led[1].id} |
| | | # 出库口2 |
| | | outSta[1]: |
| | | staNo: 201 |
| | | led: ${wcs-slave.led[1].id} |
| | | # # 输送线1 |
| | | # devp[0]: |
| | | # id: 1 |
| | | # ip: 10.10.10.100 |
| | | # port: 102 |
| | | # rack: 0 |
| | | # slot: 0 |
| | | # # 入库口1 |
| | | # inSta[0]: |
| | | # staNo: 104 |
| | | # barcode: ${wcs-slave.barcode[0].id} |
| | | # backSta: 103 |
| | | # led: ${wcs-slave.led[0].id} |
| | | # # 入库口2 |
| | | # inSta[1]: |
| | | # staNo: 204 |
| | | # barcode: ${wcs-slave.barcode[1].id} |
| | | # backSta: 203 |
| | | # led: ${wcs-slave.led[1].id} |
| | | # # 空板入库口1 |
| | | # emptyInSta[0]: |
| | | # staNo: 104 |
| | | # barcode: ${wcs-slave.barcode[0].id} |
| | | # led: ${wcs-slave.led[0].id} |
| | | # # 空板入库口2 |
| | | # emptyInSta[1]: |
| | | # staNo: 204 |
| | | # barcode: ${wcs-slave.barcode[1].id} |
| | | # led: ${wcs-slave.led[1].id} |
| | | # # 拣料入库口1 |
| | | # pickSta[0]: |
| | | # staNo: 204 |
| | | # barcode: ${wcs-slave.barcode[1].id} |
| | | # led: ${wcs-slave.led[1].id} |
| | | # # 拣料入库口2 |
| | | # pickSta[1]: |
| | | # staNo: 104 |
| | | # barcode: ${wcs-slave.barcode[0].id} |
| | | # led: ${wcs-slave.led[0].id} |
| | | # # 出库口1 |
| | | # outSta[0]: |
| | | # staNo: 101 |
| | | # led: ${wcs-slave.led[0].id} |
| | | # # 出库口2 |
| | | # outSta[1]: |
| | | # staNo: 201 |
| | | # led: ${wcs-slave.led[1].id} |
| | | # 输送线2 |
| | | devp[1]: |
| | | devp[0]: |
| | | id: 2 |
| | | ip: 10.10.10.120 |
| | | port: 102 |
| | | ip: 10.10.10.130 |
| | | port: 0 |
| | | rack: 0 |
| | | slot: 0 |
| | | # 入库口1 |
| | | inSta[0]: |
| | | staNo: 104 |
| | | barcode: ${wcs-slave.barcode[2].id} |
| | | backSta: 1 |
| | | led: ${wcs-slave.led[2].id} |
| | | # 入库口2 |
| | | inSta[1]: |
| | | staNo: 204 |
| | | barcode: ${wcs-slave.barcode[2].id} |
| | | backSta: 1 |
| | | led: ${wcs-slave.led[2].id} |
| | | staNo: 304 |
| | | barcode: ${wcs-slave.barcode[0].id} |
| | | backSta: 303 |
| | | led: ${wcs-slave.led[0].id} |
| | | # 空板入库口1 |
| | | emptyInSta[0]: |
| | | staNo: 104 |
| | | barcode: ${wcs-slave.barcode[2].id} |
| | | backSta: 1 |
| | | led: ${wcs-slave.led[2].id} |
| | | # 空板入库口2 |
| | | emptyInSta[1]: |
| | | staNo: 101 |
| | | barcode: ${wcs-slave.barcode[2].id} |
| | | backSta: 1 |
| | | led: ${wcs-slave.led[2].id} |
| | | staNo: 304 |
| | | barcode: ${wcs-slave.barcode[0].id} |
| | | led: ${wcs-slave.led[0].id} |
| | | # 拣料入库口1 |
| | | pickSta[0]: |
| | | staNo: 204 |
| | | barcode: ${wcs-slave.barcode[2].id} |
| | | led: ${wcs-slave.led[2].id} |
| | | # 拣料入库口2 |
| | | pickSta[1]: |
| | | staNo: 104 |
| | | barcode: ${wcs-slave.barcode[2].id} |
| | | led: ${wcs-slave.led[2].id} |
| | | staNo: 304 |
| | | barcode: ${wcs-slave.barcode[0].id} |
| | | led: ${wcs-slave.led[0].id} |
| | | # 出库口1 |
| | | outSta[0]: |
| | | staNo: 101 |
| | | led: ${wcs-slave.led[2].id} |
| | | # 出库口2 |
| | | outSta[1]: |
| | | staNo: 201 |
| | | led: ${wcs-slave.led[2].id} |
| | | staNo: 301 |
| | | led: ${wcs-slave.led[0].id} |
| | | # 条码扫描仪1 |
| | | barcode[0]: |
| | | id: 1 |
| | | ip: 10.10.10.102 |
| | | port: 51236 |
| | | # 条码扫描仪2 |
| | | barcode[1]: |
| | | id: 2 |
| | | ip: 10.10.10.104 |
| | | port: 51236 |
| | | # barcode[0]: |
| | | # id: 1 |
| | | # ip: 10.10.10.102 |
| | | # port: 51236 |
| | | # # 条码扫描仪2 |
| | | # barcode[1]: |
| | | # id: 2 |
| | | # ip: 10.10.10.104 |
| | | # port: 51236 |
| | | # 条码扫描仪3 |
| | | barcode[2]: |
| | | barcode[0]: |
| | | id: 3 |
| | | ip: 10.10.10.121 |
| | | port: 51236 |
| | | # LED1 |
| | | led[0]: |
| | | id: 1 |
| | | ip: 10.10.10.107 |
| | | port: 5005 |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | staArr: 2 |
| | | # LED2 |
| | | led[1]: |
| | | id: 2 |
| | | ip: 10.10.10.105 |
| | | port: 5005 |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | staArr: 11 |
| | | # led[0]: |
| | | # id: 1 |
| | | # ip: 10.10.10.107 |
| | | # port: 5005 |
| | | # devpPlcId: ${wcs-slave.devp[0].id} |
| | | # staArr: 101 |
| | | # # LED2 |
| | | # led[1]: |
| | | # id: 2 |
| | | # ip: 10.10.10.105 |
| | | # port: 5005 |
| | | # devpPlcId: ${wcs-slave.devp[0].id} |
| | | # staArr: 201 |
| | | # LED3 |
| | | led[2]: |
| | | led[0]: |
| | | id: 3 |
| | | ip: 10.10.10.105 |
| | | port: 5005 |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | staArr: 11 |
| | | staArr: 301 |
| | | # # LED4 |
| | | # led[3]: |
| | | # id: 4 |
| | | # ip: 10.10.10.105 |
| | | # port: 5005 |
| | | # devpPlcId: ${wcs-slave.devp[1].id} |
| | | # staArr: 304 |
| | |
| | | </resultMap> |
| | | |
| | | <select id="findByWorkNo" resultMap="BaseResultMap"> |
| | | select wrk_no, matnr, maktx, anfme ,specs from asr_wrk_detl where 1=1 and wrk_no = #{workNo} |
| | | select wrk_no, mat_no as matnr, mat_name as maktx, qty as anfme ,specs from asr_wrk_detl where 1=1 and wrk_no = #{workNo} |
| | | </select> |
| | | |
| | | <update id="updateIoTime"> |
| | |
| | | "rackCount": 16, |
| | | "crnCount": 4, |
| | | "stbCount": 16, |
| | | "hpPosition": 0, |
| | | "hpPosition": 1, |
| | | "minBayNo": 2, |
| | | "floors": 1, |
| | | "racks": [{ |
| | | "type": "rack", |
| | | "id": "rack1", |
| | | "top": 45, |
| | | "left": 650, |
| | | "width": 917, |
| | | "top": 225, |
| | | "left": 300, |
| | | "width": 1171, |
| | | "height": 22, |
| | | "minBayNo": 2, |
| | | "maxBayNo": 29 |
| | | "minBayNo": 1, |
| | | "maxBayNo": 34 |
| | | }, { |
| | | "type": "rack", |
| | | "id": "rack2", |
| | | "top": 67, |
| | | "left": 650, |
| | | "width": 917, |
| | | "top": 278, |
| | | "left": 300, |
| | | "width": 1171, |
| | | "height": 22, |
| | | "minBayNo": 2, |
| | | "maxBayNo": 29 |
| | | "minBayNo": 1, |
| | | "maxBayNo": 34 |
| | | |
| | | }, { |
| | | "type": "rack", |
| | | "id": "rack3", |
| | | "top": 115, |
| | | "left": 650, |
| | | "width": 917, |
| | | "top": 308, |
| | | "left": 300, |
| | | "width": 1200, |
| | | "height": 22, |
| | | "minBayNo": 2, |
| | | "maxBayNo": 29 |
| | | "minBayNo": 1, |
| | | "maxBayNo": 39 |
| | | }, { |
| | | "type": "rack", |
| | | "id": "rack4", |
| | | "top": 137, |
| | | "left": 650, |
| | | "width": 917, |
| | | "top": 365, |
| | | "left": 300, |
| | | "width": 1200, |
| | | "height": 22, |
| | | "minBayNo": 2, |
| | | "maxBayNo": 29 |
| | | "minBayNo": 1, |
| | | "maxBayNo": 39 |
| | | }, { |
| | | "type": "rack", |
| | | "id": "rack5", |
| | | "top": 159, |
| | | "left": 650, |
| | | "width": 917, |
| | | "top": 393, |
| | | "left": 300, |
| | | "width": 1200, |
| | | "height": 22, |
| | | "minBayNo": 2, |
| | | "maxBayNo": 29 |
| | | "minBayNo": 1, |
| | | "maxBayNo": 39 |
| | | }, { |
| | | "type": "rack", |
| | | "id": "rack6", |
| | | "top": 181, |
| | | "left": 650, |
| | | "width": 917, |
| | | "top": 448, |
| | | "left": 300, |
| | | "width": 1200, |
| | | "height": 22, |
| | | "minBayNo": 2, |
| | | "maxBayNo": 29 |
| | | "minBayNo": 1, |
| | | "maxBayNo": 39 |
| | | }, { |
| | | "type": "rack", |
| | | "id": "rack7", |
| | | "top": 229, |
| | | "left": 650, |
| | | "width": 917, |
| | | "top": 475, |
| | | "left": 300, |
| | | "width": 1200, |
| | | "height": 22, |
| | | "minBayNo": 2, |
| | | "maxBayNo": 29 |
| | | }, { |
| | | "type": "rack", |
| | | "id": "rack8", |
| | | "top": 251, |
| | | "left": 650, |
| | | "width": 917, |
| | | "height": 22, |
| | | "minBayNo": 2, |
| | | "maxBayNo": 29 |
| | | }, { |
| | | "type": "rack", |
| | | "id": "rack9", |
| | | "top": 273, |
| | | "left": 650, |
| | | "width": 917, |
| | | "height": 22, |
| | | "minBayNo": 2, |
| | | "maxBayNo": 29 |
| | | }, { |
| | | "type": "rack", |
| | | "id": "rack10", |
| | | "top": 295, |
| | | "left": 650, |
| | | "width": 917, |
| | | "height": 22, |
| | | "minBayNo": 2, |
| | | "maxBayNo": 29 |
| | | }, { |
| | | "type": "rack", |
| | | "id": "rack11", |
| | | "top": 343, |
| | | "left": 650, |
| | | "width": 917, |
| | | "height": 22, |
| | | "minBayNo": 2, |
| | | "maxBayNo": 29 |
| | | }, { |
| | | "type": "rack", |
| | | "id": "rack12", |
| | | "top": 365, |
| | | "left": 650, |
| | | "width": 917, |
| | | "height": 22, |
| | | "minBayNo": 2, |
| | | "maxBayNo": 29 |
| | | "minBayNo": 1, |
| | | "maxBayNo": 39 |
| | | }], |
| | | "rackDescs": [{ |
| | | "type": "rackDescs", |
| | | "id": "lb_desc16", |
| | | "text": "#1", |
| | | "top": 45, |
| | | "left": 1570, |
| | | "width": 30, |
| | | "height": 23 |
| | | "type": "rackDescs", "id": "lb_desc16", "text": "#7", "top": 227, "left": 240, "width": 30, "height": 23 |
| | | }, { |
| | | "type": "rackDescs", |
| | | "id": "lb_desc1", |
| | | "text": "#12", |
| | | "top": 365, |
| | | "left": 1570, |
| | | "width": 41, |
| | | "height": 23 |
| | | "type": "rackDescs", "id": "lb_desc1", "text": "#1", "top": 475, "left": 240, "width": 30, "height": 23 |
| | | }, { |
| | | "type": "rackDescs", |
| | | "id": "lb_desc100", |
| | | "text": "<=出库<=", |
| | | "top": 48, |
| | | "left": 550, |
| | | "width": 100, |
| | | "height": 23 |
| | | }, { |
| | | "type": "rackDescs", |
| | | "id": "lb_desc103", |
| | | "text": "=>入库=>", |
| | | "top": 138, |
| | | "left": 550, |
| | | "width": 100, |
| | | "height": 23 |
| | | }, { |
| | | "type": "rackDescs", |
| | | "id": "lb_desc103", |
| | | "text": "<=出库<=", |
| | | "top": 162, |
| | | "left": 550, |
| | | "width": 100, |
| | | "height": 23 |
| | | "type": "rackDescs", "id": "lb_desc100", "text": "=>出库=>=>", "top": 475, "left": 1470, "width": 120, "height": 23 |
| | | }], |
| | | "crns": [{ |
| | | "type": "crane", |
| | | "id": "crn-1", |
| | | "text": "1", |
| | | "top": 96, |
| | | "left": 739, |
| | | "width": 93, |
| | | "height": 22 |
| | | "type": "crane", "id": "crn-1", "text": "1", "top": 423, "left": 300, "width": 93, "height": 22 |
| | | }, { |
| | | "type": "track", |
| | | "id": "lb_track1", |
| | | "text": "", |
| | | "top": 106, |
| | | "left": 573, |
| | | "width": 1042, |
| | | "height": 2 |
| | | "type": "track", "id": "lb_track1", "text": "", "top": 430, "left": 300, "width": 1170, "height": 2 |
| | | }, { |
| | | "type": "crane", |
| | | "id": "crn-2", |
| | | "text": "2", |
| | | "top": 210, |
| | | "left": 739, |
| | | "width": 93, |
| | | "height": 22 |
| | | "type": "crane", "id": "crn-2", "text": "2", "top": 340, "left": 300, "width": 93, "height": 22 |
| | | }, { |
| | | "type": "track", |
| | | "id": "lb_track2", |
| | | "text": "", |
| | | "top": 220, |
| | | "left": 573, |
| | | "width": 1042, |
| | | "height": 2 |
| | | "type": "track", "id": "lb_track2", "text": "", "top": 350, "left": 300, "width": 1170, "height": 2 |
| | | }, { |
| | | "type": "crane", |
| | | "id": "crn-3", |
| | | "text": "3", |
| | | "top": 324, |
| | | "left": 739, |
| | | "width": 93, |
| | | "height": 22 |
| | | "type": "crane", "id": "crn-3", "text": "3", "top": 256, "left": 300, "width": 93, "height": 22 |
| | | }, { |
| | | "type": "track", |
| | | "id": "lb_track3", |
| | | "text": "", |
| | | "top": 334, |
| | | "left": 573, |
| | | "width": 1042, |
| | | "height": 2 |
| | | "type": "track", "id": "lb_track3", "text": "", "top": 263, "left": 300, "width": 1170, "height": 2 |
| | | }], |
| | | "areas": [{ |
| | | "type": "Control_floor", |
| | |
| | | "width": 1374, |
| | | "height": 672, |
| | | "stns": [{ |
| | | "type": "stn", |
| | | "id": "site-100", |
| | | "text": "100", |
| | | "top": 69, |
| | | "left": 601, |
| | | "width": 49, |
| | | "height": 20 |
| | | "type": "stn", "id": "site-100", "text": "100", "top": 450, "left": 1470, "width": 70, "height": 20 |
| | | }, { |
| | | "type": "stn", |
| | | "id": "site-101", |
| | | "text": "101", |
| | | "top": 69, |
| | | "left": 550, |
| | | "width": 49, |
| | | "height": 20 |
| | | "type": "stn", "id": "site-101", "text": "101", "top": 450, "left": 1550, "width": 70, "height": 20 |
| | | }, { |
| | | "type": "stn", |
| | | "id": "site-102", |
| | | "text": "102", |
| | | "top": 90, |
| | | "left": 550, |
| | | "width": 49, |
| | | "height": 24 |
| | | "type": "stn", "id": "site-102", "text": "102", "top": 420, "left": 1550, "width": 70, "height": 24 |
| | | }, { |
| | | "type": "stn", |
| | | "id": "site-103", |
| | | "text": "103", |
| | | "top": 115, |
| | | "left": 550, |
| | | "width": 49, |
| | | "height": 20 |
| | | "type": "stn", "id": "site-103", "text": "103", "top": 395, "left": 1550, "width": 70, "height": 20 |
| | | }, { |
| | | "type": "stn", |
| | | "id": "site-104", |
| | | "text": "104", |
| | | "top": 115, |
| | | "left": 601, |
| | | "width": 49, |
| | | "height": 20 |
| | | "type": "stn", "id": "site-104", "text": "104", "top": 395, "left": 1470, "width": 70, "height": 20 |
| | | }, { |
| | | "type": "stn", |
| | | "id": "site-200", |
| | | "text": "200", |
| | | "top": 183, |
| | | "left": 601, |
| | | "width": 49, |
| | | "height": 20 |
| | | "type": "stn", "id": "site-200", "text": "200", "top": 367, "left": 1470, "width": 70, "height": 20 |
| | | }, { |
| | | "type": "stn", |
| | | "id": "site-201", |
| | | "text": "201", |
| | | "top": 183, |
| | | "left": 550, |
| | | "width": 49, |
| | | "height": 20 |
| | | "type": "stn", "id": "site-201", "text": "201", "top": 367, "left": 1550, "width": 70, "height": 20 |
| | | }, { |
| | | "type": "stn", |
| | | "id": "site-202", |
| | | "text": "202", |
| | | "top": 204, |
| | | "left": 550, |
| | | "width": 49, |
| | | "height": 26 |
| | | "type": "stn", "id": "site-202", "text": "202", "top": 335, "left": 1550, "width": 70, "height": 26 |
| | | }, { |
| | | "type": "stn", |
| | | "id": "site-203", |
| | | "text": "203", |
| | | "top": 231, |
| | | "left": 550, |
| | | "width": 49, |
| | | "height": 20 |
| | | "type": "stn", "id": "site-203", "text": "203", "top": 310, "left": 1550, "width": 70, "height": 20 |
| | | }, { |
| | | "type": "stn", |
| | | "id": "site-204", |
| | | "text": "204", |
| | | "top": 231, |
| | | "left": 601, |
| | | "width": 49, |
| | | "height": 20 |
| | | "type": "stn", "id": "site-204", "text": "204", "top": 310, "left": 1470, "width": 70, "height": 20 |
| | | }, { |
| | | "type": "stn", |
| | | "id": "site-300", |
| | | "text": "300", |
| | | "top": 297, |
| | | "left": 601, |
| | | "width": 49, |
| | | "height": 20 |
| | | "type": "stn", "id": "site-300", "text": "300", "top": 280, "left": 1470, "width": 70, "height": 20 |
| | | }, { |
| | | "type": "stn", |
| | | "id": "site-301", |
| | | "text": "301", |
| | | "top": 297, |
| | | "left": 550, |
| | | "width": 49, |
| | | "height": 20 |
| | | "type": "stn", "id": "site-301", "text": "301", "top": 280, "left": 1550, "width": 70, "height": 20 |
| | | }, { |
| | | "type": "stn", |
| | | "id": "site-302", |
| | | "text": "302", |
| | | "top": 318, |
| | | "left": 550, |
| | | "width": 49, |
| | | "height": 26 |
| | | "type": "stn", "id": "site-302", "text": "302", "top": 252, "left": 1550, "width": 70, "height": 26 |
| | | }, { |
| | | "type": "stn", |
| | | "id": "site-303", |
| | | "text": "303", |
| | | "top": 345, |
| | | "left": 550, |
| | | "width": 49, |
| | | "height": 20 |
| | | "type": "stn", "id": "site-303", "text": "303", "top": 227, "left": 1550, "width": 70, "height": 20 |
| | | }, { |
| | | "type": "stn", |
| | | "id": "site-304", |
| | | "text": "304", |
| | | "top": 345, |
| | | "left": 601, |
| | | "width": 49, |
| | | "height": 20 |
| | | "type": "stn", "id": "site-304", "text": "304", "top": 227, "left": 1470, "width": 70, "height": 20 |
| | | }] |
| | | }] |
| | | }] |
| | |
| | | <!-- <span> </span>--> |
| | | <input id="crn2" disabled="disabled"> |
| | | </div> |
| | | <div class="crn-command-item"> |
| | | <label>3#</label> |
| | | <button id="demoBtn-3" class="demoBtn" onclick="demoSwitch(this.id)"> - </button> |
| | | <!-- <span> </span>--> |
| | | <input id="crn3" disabled="disabled"> |
| | | </div> |
| | | </div> |
| | | <!-- 堆垛机状态位信息 --> |
| | | <div class="crn-state"> |
| | |
| | | <!-- 设备任务选择 --> |
| | | <div class="task-select"> |
| | | <!-- 堆垛机选择 --> |
| | | <div id="crn-select" class="operator-item" style="width: 55%"> |
| | | <div id="crn-select" class="operator-item" style="width: 38%"> |
| | | <span class="select-title">堆垛机号</span> |
| | | <div class="select-container" style="padding: 20px 0;"> |
| | | <label><input type="radio" name="crnSelect" value="1" checked> 1号堆垛机</label> |
| | | <label><input type="radio" name="crnSelect" value="2"> 2号堆垛机</label> |
| | | <label><input type="radio" name="crnSelect" value="3"> 3号堆垛机</label> |
| | | </div> |
| | | </div> |
| | | <!-- 源站/源库位 选择 --> |
| | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <!-- 目标站/目标库位 选择 --> |
| | | <div id="end-select" class="operator-item"> |
| | | <span class="select-title">目标站/目标库位</span> |
| | | <div class="select-container"> |
| | | <div class="select-container-item"> |
| | | <span>站</span> |
| | | <label><input id="endStaNo" type="number" name="points" min="0" /></label> |
| | | </div> |
| | | <div class="select-container-item"> |
| | | <span>排</span> |
| | | <label><input id="endRow" type="number" name="points" min="1" style="background-color: #a9eeff" value="1" /></label> |
| | | </div> |
| | | <div class="select-container-item"> |
| | | <span>列</span> |
| | | <label><input id="endBay" type="number" name="points" min="0" style="background-color: #a9eeff" value="0" /></label> |
| | | </div> |
| | | <div class="select-container-item"> |
| | | <span>层</span> |
| | | <label><input id="endLev" type="number" name="points" min="1" style="background-color: #a9eeff" value="1" /></label> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- 设备任务操作 --> |