| | |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.manager.controller.params.PakinItem; |
| | | import com.vincent.rsf.server.manager.controller.params.WaitPakinParam; |
| | | import com.vincent.rsf.server.manager.entity.AsnOrder; |
| | | import com.vincent.rsf.server.manager.entity.AsnOrderItem; |
| | | import com.vincent.rsf.server.manager.entity.WaitPakinItem; |
| | | import com.vincent.rsf.server.manager.entity.*; |
| | | import com.vincent.rsf.server.manager.enums.PakinIOStatus; |
| | | import com.vincent.rsf.server.manager.mapper.WaitPakinMapper; |
| | | import com.vincent.rsf.server.manager.entity.WaitPakin; |
| | | import com.vincent.rsf.server.manager.service.AsnOrderItemService; |
| | | import com.vincent.rsf.server.manager.service.AsnOrderService; |
| | | import com.vincent.rsf.server.manager.service.WaitPakinItemService; |
| | | import com.vincent.rsf.server.manager.service.WaitPakinService; |
| | | import com.vincent.rsf.server.manager.service.*; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.vincent.rsf.server.system.constant.SerialRuleCode; |
| | | import com.vincent.rsf.server.system.utils.SerialRuleUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.core.parameters.P; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | private WaitPakinService waitPakinService; |
| | | @Autowired |
| | | private WaitPakinItemService waitPakinItemService; |
| | | @Autowired |
| | | private LocService locService; |
| | | |
| | | /** |
| | | * @author Ryan |
| | |
| | | throw new CoolException("参数错误:托盘码为空!!"); |
| | | } |
| | | |
| | | List<WaitPakin> list = waitPakinService.list(new LambdaQueryWrapper<WaitPakin>().eq(WaitPakin::getBarcode, waitPakin.getBarcode())); |
| | | if (!list.isEmpty()) { |
| | | List<String> stringList = list.stream().map(WaitPakin::getCode).collect(Collectors.toList()); |
| | | String join = StringUtils.join(stringList, ","); |
| | | throw new CoolException("拖盘码:" + waitPakin.getBarcode() + "已被组拖单:" + join + "使用!!"); |
| | | } |
| | | |
| | | 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 + "使用!!"); |
| | | } |
| | | |
| | | double sum = waitPakin.getItems().stream().mapToDouble(PakinItem::getReceiptQty).sum(); |
| | | |
| | | WaitPakin pakin = new WaitPakin(); |
| | |
| | | } |
| | | pakin.setCode(ruleCode) |
| | | //状态修改为入库中 |
| | | .setIoStatus(Short.parseShort("1")) |
| | | .setIoStatus(Short.parseShort(PakinIOStatus.PAKIN_IO_STATUS_DONE.val)) |
| | | .setAnfme(sum) |
| | | .setBarcode(waitPakin.getBarcode()); |
| | | if (!this.save(pakin)) { |
| | |
| | | .setAsnId(item.getAsnId()) |
| | | .setAsnCode(item.getAsnCode()) |
| | | .setAsnItemId(item.getId()) |
| | | .setMatnrCode(item.getMatnrCode()) |
| | | .setBatch(item.getSplrBatch()) |
| | | .setUnit(item.getStockUnit()) |
| | | .setFieldsIndex(item.getFieldsIndex()) |
| | | .setUnit(item.getStockUnit()) |
| | | .setMatnrId(StringUtils.isNotBlank(item.getMatnrId()) ? Long.parseLong(item.getMatnrId()) : null) |
| | | .setMatnrId(item.getMatnrId()) |
| | | .setMaktx(item.getMaktx()) |
| | | .setMatnrCode(item.getMatnrCode()); |
| | | for (PakinItem waitPakinItem : waitPakin.getItems()) { |
| | | if (waitPakinItem.getTrackCode().equals(item.getTrackCode())) { |
| | | Double v = item.getWorkQty() + waitPakinItem.getReceiptQty(); |
| | | pakinItem.setWorkQty(v) |
| | | // Double v = item.getWorkQty() + waitPakinItem.getReceiptQty(); |
| | | pakinItem |
| | | .setWorkQty(waitPakinItem.getReceiptQty()) |
| | | .setAnfme(waitPakinItem.getReceiptQty()) |
| | | .setTrackCode(waitPakinItem.getTrackCode()); |
| | | /**更新单据执行中库存*/ |
| | | if (v.compareTo(item.getAnfme()) > 0) {throw new CoolException("执行中数量大于收货数量!!");} |
| | | if (!asnOrderItemService.update(new LambdaUpdateWrapper<AsnOrderItem>() |
| | | .eq(AsnOrderItem::getTrackCode, waitPakinItem.getTrackCode()).set(AsnOrderItem::getWorkQty, v))) { |
| | | throw new CoolException("执行中库存更新失败!!"); |
| | | } |
| | | // if (v.compareTo(item.getAnfme()) > 0) {throw new CoolException("执行中数量大于收货数量!!");} |
| | | // if (!asnOrderItemService.update(new LambdaUpdateWrapper<AsnOrderItem>() |
| | | // .eq(AsnOrderItem::getTrackCode, waitPakinItem.getTrackCode()).set(AsnOrderItem::getWorkQty, v))) { |
| | | // throw new CoolException("执行中库存更新失败!!"); |
| | | // } |
| | | } |
| | | } |
| | | items.add(pakinItem); |