Browse Source

天合修复bug

master
songguoqiang 6 months ago
parent
commit
c1f6aa9793
  1. 2
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/dal/mysql/itemaccounts/ItemAccountsMapper.java
  2. 13
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/item/ItemServiceImpl.java

2
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<ItemAccountsDO> {
transactionDO5.setType(inLocation.getType()); transactionDO5.setType(inLocation.getType());
list.add(transactionDO5); list.add(transactionDO5);
BigDecimal subtractInQty = qtyNew.subtract(inQty);//减去之后的数量 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);//减去之后的数量 BigDecimal subtractNewQty = newQty.subtract(subtractInQty);//减去之后的数量
newLocation.setQty(subtractNewQty); newLocation.setQty(subtractNewQty);
result = this.updateById(newLocation); result = this.updateById(newLocation);

13
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 @Override
public Long createItem(ItemCreateReqVO createReqVO) { 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); ItemDO item = ItemConvert.INSTANCE.convert(createReqVO);
//String number = serialNumberApi.generateCode(RuleCodeEnum.Item.getCode()); //String number = serialNumberApi.generateCode(RuleCodeEnum.Item.getCode());
//item.setNumber(number); //item.setNumber(number);
@ -88,6 +94,7 @@ public class ItemServiceImpl implements ItemService {
public Integer updateItem(ItemUpdateReqVO updateReqVO) { public Integer updateItem(ItemUpdateReqVO updateReqVO) {
// 校验存在 // 校验存在
validateItemExists(updateReqVO.getId()); validateItemExists(updateReqVO.getId());
QueryWrapper<ItemDO> objectQueryWrapper = new QueryWrapper<>(); QueryWrapper<ItemDO> objectQueryWrapper = new QueryWrapper<>();
objectQueryWrapper.eq("number", updateReqVO.getNumber().trim()); objectQueryWrapper.eq("number", updateReqVO.getNumber().trim());
objectQueryWrapper.eq("deleted", 0); objectQueryWrapper.eq("deleted", 0);
@ -96,6 +103,12 @@ public class ItemServiceImpl implements ItemService {
if (itemDOS.size() > 0) { if (itemDOS.size() > 0) {
throw exception(ITEM_REPLACE); 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); ItemDO updateObj = ItemConvert.INSTANCE.convert(updateReqVO);
return itemMapper.updateById(updateObj); return itemMapper.updateById(updateObj);

Loading…
Cancel
Save