| | |
| | | import com.vincent.rsf.server.manager.controller.params.WaitPakinParam; |
| | | import com.vincent.rsf.server.manager.entity.*; |
| | | import com.vincent.rsf.server.manager.enums.PakinIOStatus; |
| | | import com.vincent.rsf.server.manager.mapper.AsnOrderMapper; |
| | | import com.vincent.rsf.server.manager.mapper.WaitPakinMapper; |
| | | import com.vincent.rsf.server.manager.service.*; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | import com.vincent.rsf.server.system.utils.SerialRuleUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | |
| | | |
| | | @Autowired |
| | | private AsnOrderService asnOrderService; |
| | | private AsnOrderMapper asnOrderMapper; |
| | | @Autowired |
| | | private AsnOrderItemService asnOrderItemService; |
| | | @Autowired |
| | | private WaitPakinService waitPakinService; |
| | | @Autowired |
| | | private WaitPakinItemService waitPakinItemService; |
| | | @Autowired |
| | |
| | | @Autowired |
| | | private LocService locService; |
| | | @Autowired |
| | | private TaskService taskService; |
| | | @Autowired |
| | | private TaskItemService taskItemService; |
| | | @Autowired |
| | | @Lazy |
| | | private AgvService agvService; |
| | | |
| | | |
| | |
| | | throw new CoolException("参数错误:托盘码为空!!"); |
| | | } |
| | | // List<Short> asList = Arrays.asList(Short.valueOf(PakinIOStatus.PAKIN_IO_STATUS_DONE.val), Short.valueOf(PakinIOStatus.PAKIN_IO_STATUS_DONE.val)); |
| | | WaitPakin pakin = waitPakinService.getOne(new LambdaQueryWrapper<WaitPakin>() |
| | | WaitPakin pakin = this.getOne(new LambdaQueryWrapper<WaitPakin>() |
| | | .eq(WaitPakin::getBarcode, waitPakin.getBarcode())); |
| | | if (!Objects.isNull(pakin)) { |
| | | throw new CoolException("托盘码:" + waitPakin.getBarcode() + "已被组托单:" + pakin.getCode() + "使用!!"); |
| | |
| | | .setUpdateBy(userId) |
| | | .setCreateBy(userId) |
| | | .setMatnrCode(warehouseAreasItems.getMatnrCode()); |
| | | WkOrder order = asnOrderService.getById(warehouseAreasItems.getAsnId()); |
| | | WkOrder order = asnOrderMapper.selectById(warehouseAreasItems.getAsnId()); |
| | | if (!Objects.isNull(order)) { |
| | | pakinItem.setType(null == order.getType() ? null : order.getType()) |
| | | .setWkType(null == order.getWkType() ? null : Short.parseShort(order.getWkType())); |
| | |
| | | return pakin; |
| | | } |
| | | |
| | | /** |
| | | * @author Munch D. Luffy |
| | | * @date 2026/01/23 |
| | | * @description: PDA组拖前置检查 |
| | | * @version 1.0 |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public synchronized boolean mergeItemsCheck(WaitPakinParam waitPakin, Long userId) { |
| | | if (StringUtils.isBlank(waitPakin.getBarcode())) { |
| | | throw new CoolException("参数错误:托盘码为空!!"); |
| | | } |
| | | WaitPakin pakin = this.getOne(new LambdaQueryWrapper<WaitPakin>() |
| | | .eq(WaitPakin::getBarcode, waitPakin.getBarcode())); |
| | | if (!Objects.isNull(pakin)) { |
| | | throw new CoolException("托盘码:" + waitPakin.getBarcode() + "已被组托单:" + pakin.getCode() + "使用!!"); |
| | | } |
| | | List<Loc> locs = locService.list(new LambdaQueryWrapper<Loc>().eq(Loc::getBarcode, waitPakin.getBarcode())); |
| | | if (!locs.isEmpty()) { |
| | | List<String> locCodes = locs.stream().map(Loc::getCode).collect(Collectors.toList()); |
| | | String join = StringUtils.join(locCodes, ","); |
| | | throw new CoolException("托盘码:" + waitPakin.getBarcode() + "已被库位:" + join + "使用!!"); |
| | | } |
| | | |
| | | String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_WAIT_PAKIN_CODE, null); |
| | | if (StringUtils.isBlank(ruleCode)) { |
| | | throw new CoolException("编码规则错误: 编码规则「SYS_WAIT_PAKIN_CODE」规则是不存在"); |
| | | } |
| | | |
| | | return agvService.AGVBindAndInTaskStart(waitPakin.getBarcode(),waitPakin.getStaNo()); |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | |
| | | throw new CoolException("参数错误:托盘码为空!!"); |
| | | } |
| | | // List<Short> asList = Arrays.asList(Short.valueOf(PakinIOStatus.PAKIN_IO_STATUS_DONE.val), Short.valueOf(PakinIOStatus.PAKIN_IO_STATUS_DONE.val)); |
| | | WaitPakin pakin = waitPakinService.getOne(new LambdaQueryWrapper<WaitPakin>() |
| | | WaitPakin pakin = this.getOne(new LambdaQueryWrapper<WaitPakin>() |
| | | .eq(WaitPakin::getBarcode, waitPakin.getBarcode())); |
| | | if (!Objects.isNull(pakin)) { |
| | | throw new CoolException("托盘码:" + waitPakin.getBarcode() + "已被组托单:" + pakin.getCode() + "使用!!"); |
| | |
| | | .setUpdateBy(userId) |
| | | .setCreateBy(userId) |
| | | .setMatnrCode(warehouseAreasItems.getMatnrCode()); |
| | | WkOrder order = asnOrderService.getById(warehouseAreasItems.getAsnId()); |
| | | WkOrder order = asnOrderMapper.selectById(warehouseAreasItems.getAsnId()); |
| | | if (!Objects.isNull(order)) { |
| | | pakinItem.setType(null == order.getType() ? null : order.getType()) |
| | | .setWkType(null == order.getWkType() ? null : Short.parseShort(order.getWkType())); |
| | |
| | | public synchronized WaitPakin unBind(WaitPakinParam param) { |
| | | String barcode = param.getBarcode(); |
| | | if (StringUtils.isNotBlank(barcode)) { |
| | | WaitPakin waitPakins = waitPakinService.getOne(new LambdaQueryWrapper<WaitPakin>().eq(WaitPakin::getBarcode, barcode)); |
| | | WaitPakin waitPakins = this.getOne(new LambdaQueryWrapper<WaitPakin>().eq(WaitPakin::getBarcode, barcode)); |
| | | if (Objects.isNull(waitPakins)) { |
| | | throw new CoolException("组托不存在!!"); |
| | | } |
| | |
| | | double anfmes = paramItems.stream().mapToDouble(PakinItem::getReceiptQty).sum(); |
| | | // double anfmes = warehouseAreasItems.stream().mapToDouble(WarehouseAreasItem::getAnfme).sum(); |
| | | if (waitPakins.getAnfme().compareTo(anfmes) <= 0) { |
| | | if (!waitPakinService.removeById(waitPakins.getId())) { |
| | | if (!this.removeById(waitPakins.getId())) { |
| | | throw new CoolException("组托删除失败!!"); |
| | | } |
| | | } else { |
| | | Double anfme = Math.round((waitPakins.getAnfme() - anfmes) * 10000) / 10000.0; |
| | | waitPakins.setAnfme(anfme); |
| | | if (!waitPakinService.updateById(waitPakins)) { |
| | | if (!this.updateById(waitPakins)) { |
| | | throw new CoolException("组托数据修改失败!!"); |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | if (!waitPakinService.removeByIds(pakinIds)) { |
| | | if (!this.removeByIds(pakinIds)) { |
| | | return R.error("Delete Fail"); |
| | | } |
| | | |