cpT
2025-06-26 780012a4b70c87c81c5c9222db82196303eeebdb
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -31,7 +31,6 @@
import com.zy.core.thread.RgvThread;
import com.zy.core.thread.SiemensDevpThread;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@@ -55,8 +54,6 @@
    @Autowired
    private SlaveProperties slaveProperties;
    @Autowired
    private WrkMastMapper wrkMastMapper;
    @Autowired
    private LocMastService locMastService;
    @Autowired
@@ -1085,6 +1082,8 @@
                            if (staProtocol.isOutEnable()){
                                CrnErrCache.updateCrnErr(crnProtocol.getCrnNo(), "没有可出");
                            }
                        } else {
                            CrnErrCache.updateCrnErr(crnProtocol.getCrnNo(), "出库站点:非自动");
                        }
                    }
                }
@@ -1338,34 +1337,33 @@
            if (crnProtocol == null) {
                continue;
            }
            if (false) {
//            if (crnProtocol.getModeType() != CrnModeType.STOP) {
            if (crnProtocol.getModeType() != CrnModeType.STOP) {
                // 有任务
                if (crnProtocol.getTaskNo() != 0) {
                    BasErrLog latest = basErrLogService.findLatestByTaskNo(crn.getId(), crnProtocol.getTaskNo().intValue());
                    // 有异常
                    if (latest == null) {
                        if (crnProtocol.getAlarm() != null && crnProtocol.getAlarm() > 0) {
                            WrkMast wrkMast = wrkMastMapper.selectById(crnProtocol.getTaskNo());
                            if (wrkMast == null) {
                            TaskWrk taskWrk = taskWrkMapper.selectByWrkNo(Integer.valueOf(crnProtocol.getTaskNo()));
                            if (taskWrk == null) {
                                continue;
                            }
                            BasCrnError crnError = basCrnErrorMapper.selectById(crnProtocol.getAlarm());
                            BasCrnError crnError = basCrnErrorMapper.selectById(crnProtocol.getAlarm().intValue());
                            String errName = crnError == null ? String.valueOf(crnProtocol.getAlarm()) : crnError.getErrName();
                            BasErrLog basErrLog = new BasErrLog(
                                    null,    // 编号
                                    wrkMast.getWrkNo(),    // 工作号
                                    taskWrk.getWrkNo(),    // 工作号
                                    now,    // 发生时间
                                    null,    // 结束时间
                                    wrkMast.getWrkSts(),    // 工作状态
                                    wrkMast.getIoType(),    // 入出库类型
                                    taskWrk.getWrkSts().longValue(),    // 工作状态
                                    taskWrk.getIoType(),    // 入出库类型
                                    crn.getId(),    // 堆垛机
                                    null,    // plc
                                    wrkMast.getLocNo(),    // 目标库位
                                    wrkMast.getStaNo(),    // 目标站
                                    wrkMast.getSourceStaNo(),    // 源站
                                    wrkMast.getSourceLocNo(),    // 源库位
                                    wrkMast.getBarcode(),    // 条码
                                    taskWrk.getTargetPoint(),    // 目标库位
                                    0,    // 目标站
                                    0,    // 源站
                                    taskWrk.getStartPoint(),    // 源库位
                                    taskWrk.getBarcode(),    // 条码
                                    (int) crnProtocol.getAlarm(),    // 异常码
                                    errName,    // 异常
                                    1,    // 异常情况
@@ -2173,7 +2171,7 @@
            // 命令集合
            List<LedCommand> commands = new ArrayList<>();
            // 工作档集合
            List<WrkMast> wrkMasts = new ArrayList<>();
            List<TaskWrk> taskWrks = new ArrayList<>();
            for (Integer staNo : led.getStaArr()) {
                // 获取叉车站点
                StaProtocol staProtocol = devpThread.getStation().get(staNo);
@@ -2197,7 +2195,7 @@
                ledCommand.getMatDtos().add(matDto);
                commands.add(ledCommand);
            }
            Set<Integer> workNos = wrkMasts.stream().map(WrkMast::getWrkNo).collect(Collectors.toSet());
            Set<Integer> workNos = taskWrks.stream().map(TaskWrk::getWrkNo).collect(Collectors.toSet());
            // 获取LED线程
            LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, led.getId());
            // 相同工作号集合则过滤
@@ -2216,10 +2214,10 @@
            try {
                // 修改主档led标记
                for (WrkMast wrkMast : wrkMasts) {
                    wrkMast.setOveMk("Y");
                    wrkMast.setModiTime(new Date());
                    if (wrkMastMapper.updateById(wrkMast) == 0) {
                for (TaskWrk taskWrk : taskWrks) {
//                    taskWrk.setOveMk("Y");
                    taskWrk.setModiTime(new Date());
                    if (taskWrkMapper.updateById(taskWrk) == 0) {
//                        News.errorNoLog(""+mark+" - 4"+" - 更新工作档失败");
                        throw new CoolException("更新工作档失败");
                    }