| | |
| | | package com.zy.asrs.task; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.Order; |
| | | import com.zy.asrs.entity.OrderDetl; |
| | | import com.zy.asrs.entity.WrkDetl; |
| | | import com.zy.asrs.entity.WrkMast; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.mapper.OrderDetlMapper; |
| | | import com.zy.asrs.service.OrderService; |
| | | import com.zy.asrs.service.WrkDetlService; |
| | | import com.zy.asrs.service.WrkMastService; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.task.core.ReturnT; |
| | | import com.zy.asrs.task.handler.WorkLogHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | private WrkDetlService wrkDetlService; |
| | | @Autowired |
| | | private OrderDetlMapper orderDetlMapper; |
| | | @Autowired |
| | | private WrkDetlLogService wrkDetlLogService; |
| | | @Autowired |
| | | private MatService matService; |
| | | |
| | | |
| | | |
| | | @Scheduled(cron = "0/3 * * * * ? ") |
| | | // @Transactional(rollbackFor = Exception.class) |
| | | private void replenishColor() { |
| | | List<WrkDetlLog> wrkDetlLogs = wrkDetlLogService.selectList(new EntityWrapper<WrkDetlLog>().isNull("color")); |
| | | for (WrkDetlLog wrkDetlLog : wrkDetlLogs) { |
| | | Mat mat = matService.selectByMatnr(wrkDetlLog.getMatnr()); |
| | | if(null==mat){ |
| | | wrkDetlLog.setColor("未知"); |
| | | }else { |
| | | wrkDetlLog.setColor(mat.getColor()); |
| | | } |
| | | boolean update = wrkDetlLogService.update(wrkDetlLog, new EntityWrapper<WrkDetlLog>() |
| | | .eq("wrk_no", wrkDetlLog.getWrkNo()) |
| | | .eq("matnr", wrkDetlLog.getMatnr()) |
| | | .eq(!Cools.isEmpty(wrkDetlLog.getIoTime()),"io_time", wrkDetlLog.getIoTime())); |
| | | if (!update) { |
| | | throw new CoolException("状态为空,更新历史档失败"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Scheduled(cron = "0/3 * * * * ? ") |
| | | private void execute() { |