| | |
| | | import com.zy.asrs.enums.LocStsType; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.service.impl.LocCacheServiceImpl; |
| | | import com.zy.asrs.service.impl.OrderPakinServiceImpl; |
| | | import com.zy.asrs.task.AbstractHandler; |
| | | import com.zy.asrs.task.core.ReturnT; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * Created by vincent on 2020/7/4 |
| | |
| | | @Autowired |
| | | private OrderDetlPakoutService orderDetlPakoutService; |
| | | @Autowired |
| | | private LocCacheServiceImpl locCacheService; |
| | | private LocCacheService locCacheService; |
| | | @Autowired |
| | | private OrderPakinService orderPakinService; |
| | | |
| | | public ReturnT<String> start(WrkMast wrkMast) { |
| | | // 4.入库完成 |
| | |
| | | return SUCCESS; |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public ReturnT<String> doIn(WrkMast wrkMast) { |
| | | if (wrkMast.getTaskType().equals("agv")) { |
| | | Date now = new Date(); |
| | |
| | | if (Objects.isNull(locCache)) { |
| | | throw new CoolException("数据错误,库位不存在!!"); |
| | | } |
| | | List<WaitPakin> apallet = waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("apallet", wrkMast.getBarcode())); |
| | | List<WaitPakin> apallet = waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", wrkMast.getBarcode())); |
| | | if (Objects.isNull(apallet)) { |
| | | throw new CoolException("数据错误:组托数据不存在!!"); |
| | | } |
| | | |
| | | List<LocDetl> detls = new ArrayList<>(); |
| | | apallet.forEach(pakin -> { |
| | | LocDetl detl = new LocDetl(); |
| | | BeanUtils.copyProperties(pakin, detl); |
| | |
| | | .setAreaName(locCache.getAreaName()) |
| | | .setUnit(pakin.getUnit()) |
| | | .setBatch(pakin.getBatch()); |
| | | detls.add(detl); |
| | | }); |
| | | |
| | | if (!locDetlService.insertBatch(detls)) { |
| | | throw new CoolException("库位明细保存失败!!"); |
| | | } |
| | | if (!locDetlService.insert(detl)) { |
| | | throw new CoolException("库位明细保存失败!!"); |
| | | } |
| | | }); |
| | | |
| | | locCache.setLocSts(LocStsType.LOC_STS_TYPE_F.type); |
| | | locCache.setModiTime(new Date()); |
| | | |
| | | locCache.setBarcode(""); |
| | | locCache.setModiTime(new Date()); |
| | | locCache.setIoTime(new Date()); |
| | | if (!locCacheService.updateById(locCache)) { |
| | | throw new CoolException("库位状态修改失败!"); |
| | | } |
| | | wrkMast.setWrkSts(5L); |
| | | wrkMast.setModiTime(new Date()); |
| | | if (!wrkMastService.updateById(wrkMast)) { |
| | | throw new CoolException("任务状态修改失败!!"); |
| | | } |
| | | |
| | | Set<Long> list = apallet.stream().map(WaitPakin::getOrderId).collect(Collectors.toSet()); |
| | | List<OrderPakin> pakins = orderPakinService.selectList(new EntityWrapper<OrderPakin>().in("order_id", list)); |
| | | if (Objects.isNull(pakins) || pakins.isEmpty()) { |
| | | throw new CoolException("单据不存在!!"); |
| | | } |
| | | pakins.forEach(orderPakin -> { |
| | | orderPakin.setSettle(4L); |
| | | if (!orderPakinService.updateById(orderPakin)) { |
| | | throw new CoolException("单据修改失败!!"); |
| | | } |
| | | }); |
| | | } else { |
| | | Date now = new Date(); |
| | | LocMast locMast = locMastService.selectById(wrkMast.getLocNo()); |