#
luxiaotao1123
2022-10-27 9f989bddecd1261b54c26b853a2528d661bdeb5e
#
3个文件已修改
43 ■■■■ 已修改文件
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/thread/SiemensDevpThread.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/WrkChargeMapper.xml 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -2463,8 +2463,6 @@
     */
    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();
@@ -2485,17 +2483,25 @@
                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());
@@ -2503,7 +2509,9 @@
                    }
                    // 处于充电库位组
                    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());
src/main/java/com/zy/core/thread/SiemensDevpThread.java
@@ -15,6 +15,7 @@
import com.zy.core.cache.OutputQueue;
import com.zy.core.cache.SlaveConnection;
import com.zy.core.enums.SlaveType;
import com.zy.core.enums.SteChargeType;
import com.zy.core.model.DevpSlave;
import com.zy.core.model.Task;
import com.zy.core.model.protocol.StaProtocol;
@@ -279,6 +280,22 @@
        return true;
    }
    /**
     * 获取空闲充电桩
     */
    public SteChargeType getIdleChargeLocNo() {
        if (!this.charge0) {
            return SteChargeType.FIRST;
        }
        if (!this.charge1) {
            return SteChargeType.SECOND;
        }
        if (!this.charge2) {
            return SteChargeType.THIRD;
        }
        return null;
    }
    @Override
    public void close() {
        siemensS7Net.ConnectClose();
src/main/resources/mapper/WrkChargeMapper.xml
@@ -33,7 +33,9 @@
        select top 1 *
        from asr_wrk_charge
        where 1=1
        and ste_no = #{steNo}
        <if test="steNo != null">
            and ste_no = #{steNo}
        </if>
        and wrk_sts &lt; 28
    </select>