| | |
| | | } else { |
| | | wrapper.orderBy("CREATE_TIME", false); |
| | | } |
| | | return R.ok(basErrLogService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | |
| | | List<BasErrLog> basErrLogList = basErrLogService.selectList(wrapper); |
| | | Page<BasErrLog> page = new Page<BasErrLog>(0, 10).setRecords(basErrLogList); |
| | | page.setTotal(basErrLogList.size()); |
| | | return R.ok(page); |
| | | } |
| | | |
| | | private void convert(Map<String, Object> map, EntityWrapper wrapper){ |
| | |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import com.core.common.Cools; |
| | | import com.core.common.SpringUtils; |
| | | import com.zy.asrs.service.BasWrkIotypeService; |
| | | import com.zy.asrs.service.BasWrkStatusService; |
| | | import com.zy.system.entity.User; |
| | | import com.zy.system.service.UserService; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | |
| | | public BasErrLog() {} |
| | | |
| | | public BasErrLog(String uuid,Integer wrkNo,Date startTime,Date endTime,Long wrkSts,Integer ioType,Integer crnNo,Integer plcNo,String locNo,Integer staNo,Integer sourceStaNo,String sourceLocNo,String barcode,Integer errCode,String error,Integer status,Date createTime,Long createBy,Date updateTime,Long updateBy,String memo) { |
| | | public BasErrLog(String uuid,Integer wrkNo,Date startTime,Date endTime,Long wrkSts,Integer ioType,Integer crnNo,Integer plcNo, |
| | | String locNo,Integer staNo,Integer sourceStaNo,String sourceLocNo,String barcode,Integer errCode,String error,Integer status,Date createTime,Long createBy,Date updateTime,Long updateBy,String memo) { |
| | | this.uuid = uuid; |
| | | this.wrkNo = wrkNo; |
| | | this.startTime = startTime; |
| | |
| | | this.wrkSts = wrkSts; |
| | | } |
| | | |
| | | public String getWrkSts$(){ |
| | | BasWrkStatusService service = SpringUtils.getBean(BasWrkStatusService.class); |
| | | BasWrkStatus basWrkStatus = service.selectById(this.wrkSts); |
| | | if (!Cools.isEmpty(basWrkStatus)){ |
| | | return String.valueOf(basWrkStatus.getWrkDesc()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public Integer getIoType() { |
| | | return ioType; |
| | | } |
| | |
| | | this.ioType = ioType; |
| | | } |
| | | |
| | | public String getIoType$(){ |
| | | BasWrkIotypeService service = SpringUtils.getBean(BasWrkIotypeService.class); |
| | | BasWrkIotype basWrkIotype = service.selectById(this.ioType); |
| | | if (!Cools.isEmpty(basWrkIotype)){ |
| | | return String.valueOf(basWrkIotype.getIoDesc()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public Integer getCrnNo() { |
| | | return crnNo; |
| | | } |
| | |
| | | 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; |
| | |
| | | |
| | | @Autowired |
| | | private SlaveProperties slaveProperties; |
| | | @Autowired |
| | | private WrkMastMapper wrkMastMapper; |
| | | @Autowired |
| | | private LocMastService locMastService; |
| | | @Autowired |
| | |
| | | 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, // 异常情况 |
| | |
| | | // 命令集合 |
| | | 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); |
| | |
| | | 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()); |
| | | // 相同工作号集合则过滤 |
| | |
| | | |
| | | 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("更新工作档失败"); |
| | | } |