| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | |
| | | // 入出库模式判断 |
| | | // if ( inSta.getStaNo()==203 && devpThread.ioModeOf2F != IoModeType.PAKIN_MODE) { continue; } |
| | | if ( inSta.getStaNo()==203 && devpThread.ioModeOf2F == IoModeType.PAKOUT_MODE) { continue; } |
| | | if ( inSta.getStaNo()==402 && devpThread.ioModeOf4F == IoModeType.PAKOUT_MODE) { continue; } |
| | | |
| | | // 判断是否满足入库条件 |
| | | if (staProtocol.isAutoing() && staProtocol.isLoading() |
| | |
| | | |
| | | // 判断是否满足入库条件 |
| | | if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable() |
| | | && !staProtocol.isEmptyMk() && (staProtocol.getWorkNo() == 0 || staProtocol.getWorkNo() == 9999) |
| | | && !staProtocol.isEmptyMk() && (staProtocol.getWorkNo() == 0 || staProtocol.getWorkNo() > 9990) |
| | | && staProtocol.isPakMk()) { |
| | | // 判断重复工作档 |
| | | WrkMast wrkMast = wrkMastMapper.selectPakInStep11(inSta.getStaNo()); |
| | |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | | // 遍历拣料入库口 |
| | | for (DevpSlave.Sta pickSta : devp.getPickSta()) { |
| | | // // 获取条码扫描仪信息 |
| | | // BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, pickSta.getBarcode()); |
| | | // if (barcodeThread == null) { |
| | | // continue; |
| | | // } |
| | | // String barcode = barcodeThread.getBarcode(); |
| | | // if(!Cools.isEmpty(barcode)) { |
| | | // log.info("{}号条码扫描器检测条码信息:{}", pickSta.getBarcode(), barcode); |
| | | // if("NG".endsWith(barcode) || "NoRead".equals(barcode)) { |
| | | // continue; |
| | | // } |
| | | // } else { |
| | | // continue; |
| | | // } |
| | | // 获取条码扫描仪信息 |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, pickSta.getBarcode()); |
| | | if (barcodeThread == null) { |
| | | continue; |
| | | } |
| | | String barcode = barcodeThread.getBarcode(); |
| | | if(!Cools.isEmpty(barcode)) { |
| | | log.info("{}号条码扫描器检测条码信息:{}", pickSta.getBarcode(), barcode); |
| | | if("NG".endsWith(barcode) || "NoRead".equals(barcode)) { |
| | | continue; |
| | | } |
| | | } else { |
| | | continue; |
| | | } |
| | | |
| | | // 获取拣料入库站信息 |
| | | SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); |
| | |
| | | // if (devpThread.ioMode != IoModeType.PAKIN_MODE) { continue; } |
| | | |
| | | if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable() && staProtocol.isPakMk()){ |
| | | // WrkMast wrkMast = wrkMastMapper.selectPickStep(barcode); |
| | | WrkMast wrkMast = wrkMastMapper.selectPakInStep3(staProtocol.getWorkNo().intValue()); |
| | | WrkMast wrkMast = wrkMastMapper.selectPakInStep3(staProtocol.getWorkNo().intValue()); |
| | | // WrkMast wrkMast = wrkMastMapper.selectPakInStep3(staProtocol.getWorkNo().intValue()); |
| | | if(wrkMast == null){ |
| | | wrkMast = wrkMastMapper.selectPakInStep3(staProtocol.getWorkNo().intValue()); |
| | | } |
| | | if (wrkMast == null) { |
| | | // 无拣料数据 |
| | | continue; |
| | | } |
| | | if ((wrkMast.getIoType() != 103 && wrkMast.getIoType() != 104 && wrkMast.getIoType() != 107) |
| | | || Cools.isEmpty(wrkMast.getStaNo()) || Cools.isEmpty(wrkMast.getSourceStaNo()) ) { |
| | | || Cools.isEmpty(wrkMast.getStaNo()) || Cools.isEmpty(wrkMast.getSourceStaNo()) ) { |
| | | continue; |
| | | } |
| | | |
| | |
| | | /** |
| | | * 堆垛机站出库到出库站 |
| | | */ |
| | | @Async |
| | | public void crnStnToOutStn() { |
| | | public synchronized void crnStnToOutStn() { |
| | | for (CrnSlave crnSlave : slaveProperties.getCrn()) { |
| | | // 遍历堆垛机出库站 |
| | | for (CrnSlave.CrnStn crnStn : crnSlave.getCrnOutStn()) { |
| | |
| | | staProtocol = staProtocol.clone(); |
| | | } |
| | | |
| | | // // 入出库模式判断 |
| | | // if (devpThread.ioMode != IoModeType.PAKOUT_MODE) { continue; } |
| | | if (wrkMast.getStaNo() == 204 && devpThread.ioModeOf2F != IoModeType.PAKOUT_MODE) { |
| | | continue; |
| | | } |
| | | // 入出库模式判断 |
| | | //if (devpThread.ioMode != IoModeType.PAKOUT_MODE) { continue; } |
| | | if (wrkMast.getStaNo() == 204 && devpThread.ioModeOf2F != IoModeType.PAKOUT_MODE) {continue;} |
| | | if (wrkMast.getStaNo() == 402 && devpThread.ioModeOf4F != IoModeType.PAKOUT_MODE) {continue;} |
| | | |
| | | // 查询站点详细信息 |
| | | BasDevp staDetl = basDevpService.selectById(crnStn.getStaNo()); |
| | |
| | | /** |
| | | * 执行对工作档的完成操作 |
| | | */ |
| | | @Async |
| | | public void storeFinished() { |
| | | public synchronized void storeFinished() { |
| | | for (CrnSlave crn : slaveProperties.getCrn()) { |
| | | // 获取堆垛机信息 |
| | | CrnThread crnThread = (CrnThread) SlaveConnection.get(SlaveType.Crn, crn.getId()); |
| | |
| | | /** |
| | | * 堆垛机异常信息记录 |
| | | */ |
| | | @Async |
| | | public void recCrnErr(){ |
| | | public synchronized void recCrnErr(){ |
| | | Date now = new Date(); |
| | | for (CrnSlave crn : slaveProperties.getCrn()) { |
| | | // 获取堆垛机信息 |
| | |
| | | /** |
| | | * 空栈板初始化入库,叉车入库站放货 |
| | | */ |
| | | @Async |
| | | public void storeEmptyPlt(){ |
| | | public synchronized void storeEmptyPlt(){ |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | | // 遍历空板入库口 |
| | | for (DevpSlave.Sta emptyInSta : devp.getEmptyInSta()) { |
| | |
| | | // // 入出库模式判断 |
| | | // if ( emptyInSta.getStaNo()==203 && devpThread.ioModeOf2F != IoModeType.PAKIN_MODE) { continue; } |
| | | if ( emptyInSta.getStaNo()==203 && devpThread.ioModeOf2F == IoModeType.PAKOUT_MODE) { continue; } |
| | | if ( emptyInSta.getStaNo()==402 && devpThread.ioModeOf4F == IoModeType.PAKOUT_MODE) { continue; } |
| | | |
| | | // 站点条件判断 |
| | | if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable() |
| | |
| | | /** |
| | | * 出库 ===>> 工作档信息写入led显示器 |
| | | */ |
| | | @Async |
| | | public void ledExecute() { |
| | | public synchronized void ledExecute() { |
| | | for (LedSlave led : slaveProperties.getLed()) { |
| | | // 获取输送线plc线程 |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, led.getDevpPlcId()); |
| | |
| | | /** |
| | | * 其他 ===>> LED显示器复位,显示默认信息 |
| | | */ |
| | | @Async |
| | | public void ledReset() { |
| | | public synchronized void ledReset() { |
| | | // for (LedSlave led : slaveProperties.getLed()) { |
| | | // // 获取输送线plc线程 |
| | | // DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, led.getDevpPlcId()); |
| | |
| | | devpThread.ioModeOf2F = IoModeType.PAKIN_MODE; |
| | | } |
| | | break; |
| | | case 401://1F |
| | | case 402://1F |
| | | if (pakout != null) { |
| | | if (devpThread.ioModeOf4F != IoModeType.PAKOUT_MODE) { |
| | | // 出库切换中 |
| | | devpThread.ioModeOf4F = IoModeType.PAKOUT_BOOTING; |
| | | WrkMast pakin = wrkMastMapper.selectWorkingPakin(inSta.getStaNo()); |
| | | if (pakin == null && !devpThread.getStation().get(inSta.getStaNo()).isLoading() |
| | | && !devpThread.getStation().get(inSta.getStaNo()+1).isLoading() |
| | | && devpThread.getStation().get(inSta.getStaNo()+1).getWorkNo()==0) { |
| | | && !devpThread.getStation().get(inSta.getStaNo()-1).isLoading() |
| | | && devpThread.getStation().get(inSta.getStaNo()-1).getWorkNo()==0) { |
| | | // 出库模式 |
| | | devpThread.ioModeOf4F = IoModeType.PAKOUT_MODE; |
| | | } |