skyouc
7 天以前 b9d414bc2d61b4824ce6a019b1c10f526f71ced1
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/WaitPakinServiceImpl.java
@@ -49,7 +49,7 @@
    @Override
    @Transactional(rollbackFor = Exception.class)
    public WaitPakin mergeItems(WaitPakinParam waitPakin, Long userId) {
        if (waitPakin.getItems().isEmpty()) {
        if (Objects.isNull(waitPakin.getItems()) || waitPakin.getItems().isEmpty()) {
            throw new CoolException("参数错误:物料跟踪码为空!");
        }
        if (StringUtils.isBlank(waitPakin.getBarcode())) {
@@ -83,6 +83,8 @@
                    //状态修改为入库中
                    .setIoStatus(Short.parseShort(PakinIOStatus.PAKIN_IO_STATUS_DONE.val))
                    .setAnfme(sum)
                    .setUpdateBy(userId)
                    .setCreateBy(userId)
                    .setBarcode(waitPakin.getBarcode());
            if (!this.save(waitPakin1)) {
                throw new CoolException("主单保存失败!!");
@@ -127,9 +129,14 @@
                        .setUpdateBy(userId)
                        .setCreateBy(userId)
                        .setMatnrCode(item.getMatnrCode());
                AsnOrder order = asnOrderService.getById(item.getAsnId());
                if (!Objects.isNull(order)) {
                    pakinItem.setType(null == order.getType() ?  null :order.getType())
                            .setWkType(null == order.getWkType() ? null : Short.parseShort(order.getWkType()) );
                }
                for (PakinItem waitPakinItem : waitPakin.getItems()) {
                    if (waitPakinItem.getTrackCode().equals(item.getTrackCode())) {
                        if (waitPakinItem.getReceiptQty() > item.getAnfme()) {
                        if (waitPakinItem.getReceiptQty() > item.getAnfme() || waitPakinItem.getReceiptQty().compareTo(0.0) >= 0) {
                            throw new CoolException("组拖数量不能大于收货数量!!");
                        }
                        pakinItem.setAnfme(waitPakinItem.getReceiptQty()).setTrackCode(waitPakinItem.getTrackCode());
@@ -163,10 +170,16 @@
                        .setUpdateBy(userId)
                        .setCreateBy(userId)
                        .setMatnrCode(item.getMatnrCode());
                AsnOrder order = asnOrderService.getById(item.getAsnId());
                if (!Objects.isNull(order)) {
                    pakinItem.setType(null == order.getType() ?  null :order.getType())
                            .setWkType(null == order.getWkType() ? null : Short.parseShort(order.getWkType()) );
                }
                for (PakinItem waitPakinItem : waitPakin.getItems()) {
                    if (waitPakinItem.getTrackCode().equals(item.getTrackCode())) {
                        if (waitPakinItem.getReceiptQty() > item.getAnfme()) {
                            throw new CoolException("组拖数量不能大于收货数量!!");
                        if (waitPakinItem.getReceiptQty() > item.getAnfme() || waitPakinItem.getReceiptQty().compareTo(0.0) <= 0) {
                            throw new CoolException("组拖数量不能大于收货数量且不能小于零!!");
                        }
                        pakinItem.setAnfme(waitPakinItem.getReceiptQty()).setTrackCode(waitPakinItem.getTrackCode());
                    }
@@ -182,6 +195,9 @@
        if (!this.updateById(waitPakin1)) {
            throw new CoolException("组拖数量修改失败!!");
        }
        //TODO 组拖完成后,扣减收货区库存
        return pakin;
    }