|  |  | 
 |  |  |      */ | 
 |  |  |     public synchronized void loopSteCharge() { | 
 |  |  |         SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 1); | 
 |  |  |         SteChargeType steChargeType = SteChargeType.get(wrkCharge.getLocNo()); | 
 |  |  |  | 
 |  |  |         for (SteSlave ste : slaveProperties.getSte()) { | 
 |  |  |             SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, ste.getId()); | 
 |  |  |             SteProtocol steProtocol = steThread.getSteProtocol(); | 
 |  |  | 
 |  |  |                 if (steProtocol.getCharge() > Float.parseFloat(basSte.getChargeLine())) { | 
 |  |  |                     continue; | 
 |  |  |                 } | 
 |  |  |                 WrkCharge wrkCharge = wrkChargeService.selectWorking(steProtocol.getSteNo().intValue()); | 
 |  |  | //                WrkCharge wrkCharge = wrkChargeService.selectWorking(steProtocol.getSteNo().intValue()); | 
 |  |  |                 WrkCharge wrkCharge = wrkChargeService.selectWorking(null); | 
 |  |  |  | 
 |  |  |                 if (wrkCharge == null && steProtocol.getChargeStatus() == 0) { | 
 |  |  |                     String idleLoc = basSte.getIdleLoc(); | 
 |  |  | //                    String idleLoc = basSte.getIdleLoc(); | 
 |  |  |                     // 寻找空闲充电桩 | 
 |  |  |                     SteChargeType steCharge = devpThread.getIdleChargeLocNo(); | 
 |  |  |                     if (steCharge == null) { | 
 |  |  |                         log.warn("{}号小车【电量:{}】充电失败,原因:没有空闲充电桩。", ste.getId(), steProtocol.getCharge()); | 
 |  |  |                         continue; | 
 |  |  |                     } | 
 |  |  |                     String chargeLocNo = steCharge.locNo; | 
 |  |  |                     wrkCharge = new WrkCharge(); | 
 |  |  |                     wrkCharge.setSteNo(ste.getId()); | 
 |  |  |                     wrkCharge.setWrkNo(commonService.getChargeWorkNo(4)); | 
 |  |  |                     wrkCharge.setWrkSts(21L);   // 21.准备充电 | 
 |  |  |                     wrkCharge.setCrnNo(basSte.getCrnNo()); | 
 |  |  | //                    wrkCharge.setCrnNo(basSte.getCrnNo()); | 
 |  |  |                     wrkCharge.setIoPri((double) 10); | 
 |  |  |                     wrkCharge.setLocNo(idleLoc); | 
 |  |  |                     wrkCharge.setLocNo(chargeLocNo); | 
 |  |  |                     wrkCharge.setMemo("charge"); | 
 |  |  |                     if (!wrkChargeService.insert(wrkCharge)) { | 
 |  |  |                         log.error("保存{}号穿梭车充电任务失败!!!", ste.getId()); | 
 |  |  | 
 |  |  |                     } | 
 |  |  |  | 
 |  |  |                     // 处于充电库位组 | 
 |  |  |                     if (Utils.getGroupRow(idleLoc).equals(Utils.getGroupRow(steProtocol.getRow().intValue())) && steProtocol.getBay() == Utils.getBay(idleLoc) && steProtocol.getLev() == Utils.getLev(idleLoc)) { | 
 |  |  |                     if (steProtocol.getRow().intValue() == Utils.getRow(chargeLocNo) | 
 |  |  |                             && steProtocol.getBay().intValue() == Utils.getBay(chargeLocNo) | 
 |  |  |                             && steProtocol.getLev().intValue() == Utils.getLev(chargeLocNo)) { | 
 |  |  |                         // 修改工作档状态 21.准备充电 => 24.小车到达 | 
 |  |  |                         wrkCharge.setWrkSts(24L); | 
 |  |  |                         wrkCharge.setModiTime(new Date()); |