From c1f6aa979361bbb726243c1bb01fc1680cb4465a Mon Sep 17 00:00:00 2001 From: songguoqiang <765017469@qq.com> Date: Tue, 14 May 2024 15:35:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A9=E5=90=88=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dal/mysql/itemaccounts/ItemAccountsMapper.java | 2 +- .../module/eam/service/item/ItemServiceImpl.java | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/dal/mysql/itemaccounts/ItemAccountsMapper.java b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/dal/mysql/itemaccounts/ItemAccountsMapper.java index e899a63..5eb8a01 100644 --- a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/dal/mysql/itemaccounts/ItemAccountsMapper.java +++ b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/dal/mysql/itemaccounts/ItemAccountsMapper.java @@ -148,7 +148,7 @@ public interface ItemAccountsMapper extends BaseMapperX { transactionDO5.setType(inLocation.getType()); list.add(transactionDO5); BigDecimal subtractInQty = qtyNew.subtract(inQty);//减去之后的数量 - if (inQty.compareTo(BigDecimal.ZERO) > 0 && inQty.compareTo(subtractInQty) >= 0) {//新到货存在且足够差额 + if (newQty.compareTo(BigDecimal.ZERO) > 0 && newQty.compareTo(subtractInQty) >= 0) {//新到货存在且足够差额 BigDecimal subtractNewQty = newQty.subtract(subtractInQty);//减去之后的数量 newLocation.setQty(subtractNewQty); result = this.updateById(newLocation); diff --git a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/item/ItemServiceImpl.java b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/item/ItemServiceImpl.java index 9e3a1ba..5e4d775 100644 --- a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/item/ItemServiceImpl.java +++ b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/item/ItemServiceImpl.java @@ -67,6 +67,12 @@ public class ItemServiceImpl implements ItemService { @Override public Long createItem(ItemCreateReqVO createReqVO) { // 插入 + if(createReqVO.getMinInventory()==null){ + createReqVO.setMinInventory(BigDecimal.ZERO); + } + if(createReqVO.getMaxInventory()==null){ + createReqVO.setMaxInventory(BigDecimal.ZERO); + } ItemDO item = ItemConvert.INSTANCE.convert(createReqVO); //String number = serialNumberApi.generateCode(RuleCodeEnum.Item.getCode()); //item.setNumber(number); @@ -88,6 +94,7 @@ public class ItemServiceImpl implements ItemService { public Integer updateItem(ItemUpdateReqVO updateReqVO) { // 校验存在 validateItemExists(updateReqVO.getId()); + QueryWrapper objectQueryWrapper = new QueryWrapper<>(); objectQueryWrapper.eq("number", updateReqVO.getNumber().trim()); objectQueryWrapper.eq("deleted", 0); @@ -96,6 +103,12 @@ public class ItemServiceImpl implements ItemService { if (itemDOS.size() > 0) { throw exception(ITEM_REPLACE); } + if(updateReqVO.getMinInventory()==null){ + updateReqVO.setMinInventory(BigDecimal.ZERO); + } + if(updateReqVO.getMaxInventory()==null){ + updateReqVO.setMaxInventory(BigDecimal.ZERO); + } // 更新 ItemDO updateObj = ItemConvert.INSTANCE.convert(updateReqVO); return itemMapper.updateById(updateObj);