| | |
| | | import com.zy.common.properties.SlaveProperties; |
| | | import com.zy.common.service.CommonService; |
| | | import com.zy.common.web.WcsController; |
| | | import com.zy.asrs.task.core.ReturnT; |
| | | import com.zy.asrs.task.handler.WorkMastHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | private WaitPakinService waitPakinService; |
| | | @Autowired |
| | | private MonitorLocMapCacheService monitorLocMapCacheService; |
| | | @Autowired |
| | | private WorkMastHandler workMastHandler; |
| | | |
| | | @Override |
| | | @Transactional |
| | |
| | | if (Cools.isEmpty(wrkMast)){ |
| | | throw new CoolException(workNo+"工作档不存在"); |
| | | } |
| | | if (wrkMast.getWrkSts() == 4 || wrkMast.getWrkSts() == 14) { |
| | | long sts = wrkMast.getWrkSts(); |
| | | if (sts == 4 || sts == 5 || sts == 14 || sts == 15 || sts == 20) { |
| | | throw new CoolException("当前工作档已完成"); |
| | | } |
| | | // 入库 + 库位转移 |
| | | if (wrkMast.getWrkSts() < 4 || (wrkMast.getWrkSts() > 10 && wrkMast.getIoType()==11)) { |
| | | boolean inboundFinish = wrkMast.getWrkSts() < 4 || (wrkMast.getWrkSts() > 10 && wrkMast.getIoType() != null && wrkMast.getIoType() == 11); |
| | | boolean outboundFinish = wrkMast.getWrkSts() > 10 && (wrkMast.getIoType() == null || wrkMast.getIoType() != 11); |
| | | if (!inboundFinish && !outboundFinish) { |
| | | throw new CoolException("当前工作状态无法手动完成"); |
| | | } |
| | | if (inboundFinish) { |
| | | wrkMast.setWrkSts(4L); |
| | | // 出库 |
| | | } else if (wrkMast.getWrkSts() > 10) { |
| | | } else { |
| | | wrkMast.setWrkSts(14L); |
| | | } |
| | | Date now = new Date(); |
| | |
| | | wrkMast.setCrnEndTime(now); |
| | | wrkMast.setModiTime(now); |
| | | wrkMast.setModiUser(userId); |
| | | // 完成操作人员记录 |
| | | wrkMast.setManuType("手动完成"); |
| | | ReturnT<String> rt = workMastHandler.start(wrkMast); |
| | | if (!rt.isSuccess()) { |
| | | throw new CoolException(Cools.isEmpty(rt.getMsg()) ? "完成处理失败" : rt.getMsg()); |
| | | } |
| | | // doOut 对 103/107 不落 15 时,手动补齐 15;源库位 O 与定时任务 doOut 一致 |
| | | if (wrkMast.getWrkSts() == 14) { |
| | | wrkMast.setWrkSts(15L); |
| | | wrkMast.setModiTime(now); |
| | | wrkMast.setModiUser(userId); |
| | | if (!Cools.isEmpty(wrkMast.getSourceLocNo())) { |
| | | LocMast src = locMastService.selectById(wrkMast.getSourceLocNo()); |
| | | if (!Cools.isEmpty(src) && !"O".equals(src.getLocSts())) { |
| | | Integer io = wrkMast.getIoType(); |
| | | if (io != null && (io == 101 || io == 110)) { |
| | | src.setLocSts("O"); |
| | | src.setModiTime(now); |
| | | src.setIoTime(now); |
| | | src.setModiUser(userId); |
| | | if (!locMastService.updateById(src)) { |
| | | throw new CoolException("更新源库位状态失败"); |
| | | } |
| | | } else if ("R".equals(src.getLocSts())) { |
| | | src.setLocSts("O"); |
| | | src.setModiTime(now); |
| | | src.setIoTime(now); |
| | | src.setModiUser(userId); |
| | | if (!locMastService.updateById(src)) { |
| | | throw new CoolException("更新源库位状态失败"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | wrkMast.setManuType("手动完成"); |
| | | wrkMast.setModiUser(userId); |
| | | wrkMast.setCrnStrTime(DateUtils.calculate(now, 1L, TimeUnit.SECONDS, true)); |
| | | wrkMast.setCrnEndTime(now); |
| | | wrkMast.setModiTime(now); |
| | | if (!wrkMastService.updateById(wrkMast)) { |
| | | throw new CoolException("修改工作档失败"); |
| | | } |