|
|
@ -1,32 +1,17 @@ |
|
|
|
package com.win.module.wms.service.balance; |
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
import cn.hutool.core.exceptions.UtilException; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.google.common.annotations.VisibleForTesting; |
|
|
|
import com.win.framework.common.exception.ErrorCode; |
|
|
|
import com.win.framework.common.exception.ServiceException; |
|
|
|
import com.win.framework.common.pojo.CustomConditions; |
|
|
|
import com.win.module.wms.controller.balance.vo.*; |
|
|
|
import com.win.module.wms.dal.dataobject.itembasic.ItembasicDO; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
|
|
|
import org.springframework.transaction.interceptor.TransactionAspectSupport; |
|
|
|
import org.springframework.validation.annotation.Validated; |
|
|
|
|
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
import com.win.module.wms.dal.dataobject.balance.BalanceDO; |
|
|
|
import com.win.framework.common.pojo.PageResult; |
|
|
|
|
|
|
|
import com.win.module.wms.convert.balance.BalanceConvert; |
|
|
|
import com.win.module.wms.controller.balance.vo.BalanceExportReqVO; |
|
|
|
import com.win.module.wms.controller.balance.vo.BalancePageReqVO; |
|
|
|
import com.win.module.wms.dal.dataobject.balance.BalanceDO; |
|
|
|
import com.win.module.wms.dal.mysql.balance.BalanceMapper; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.validation.annotation.Validated; |
|
|
|
|
|
|
|
import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception; |
|
|
|
import static com.win.module.wms.enums.ErrorCodeConstants.*; |
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
/** |
|
|
|
* 库存余额 Service 实现类 |
|
|
@ -40,51 +25,6 @@ public class BalanceServiceImpl implements BalanceService { |
|
|
|
@Resource |
|
|
|
private BalanceMapper balanceMapper; |
|
|
|
|
|
|
|
@Override |
|
|
|
public String createBalance(BalanceCreateReqVO createReqVO) { |
|
|
|
// 插入
|
|
|
|
BalanceDO balance = BalanceConvert.INSTANCE.convert(createReqVO); |
|
|
|
balanceMapper.insert(balance); |
|
|
|
// 返回
|
|
|
|
return balance.getId(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void updateBalance(BalanceUpdateReqVO updateReqVO) { |
|
|
|
// 校验存在
|
|
|
|
validateBalanceExists(updateReqVO.getId()); |
|
|
|
// 更新
|
|
|
|
BalanceDO updateObj = BalanceConvert.INSTANCE.convert(updateReqVO); |
|
|
|
balanceMapper.updateById(updateObj); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void deleteBalance(Long id) { |
|
|
|
// 校验存在
|
|
|
|
validateBalanceExists(id); |
|
|
|
// 删除
|
|
|
|
balanceMapper.deleteById(id); |
|
|
|
} |
|
|
|
|
|
|
|
private void validateBalanceExists(Long id) { |
|
|
|
if (id == null) { |
|
|
|
return; |
|
|
|
} |
|
|
|
if (balanceMapper.selectById(id) == null) { |
|
|
|
throw exception(BALANCE_NOT_EXISTS); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public BalanceDO getBalance(String id) { |
|
|
|
return balanceMapper.selectById(id); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<BalanceDO> getBalanceList(Collection<String> ids) { |
|
|
|
return balanceMapper.selectBatchIds(ids); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageResult<BalanceDO> getBalancePage(BalancePageReqVO pageReqVO) { |
|
|
|
return balanceMapper.selectPage(pageReqVO); |
|
|
@ -104,17 +44,17 @@ public class BalanceServiceImpl implements BalanceService { |
|
|
|
* TB----TB2----BY_QUANTITY |
|
|
|
* 跟据管理模式查询数量 |
|
|
|
* @author lianhongxi |
|
|
|
* @param itemcode 物品code |
|
|
|
* @param itemCode 物品code |
|
|
|
* @param inventoryStatus 库存状态 |
|
|
|
* @param locationcode 库位code |
|
|
|
* @param locationCode 库位code |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<BalanceDO> selectNumber(String itemcode, List<String> inventoryStatus, String locationcode) { |
|
|
|
QueryWrapper queryWrapper = new QueryWrapper(); |
|
|
|
queryWrapper.eq("item_code", itemcode); |
|
|
|
public List<BalanceDO> selectNumber(String itemCode, List<String> inventoryStatus, String locationCode) { |
|
|
|
QueryWrapper<BalanceDO> queryWrapper = new QueryWrapper<>(); |
|
|
|
queryWrapper.eq("item_code", itemCode); |
|
|
|
queryWrapper.eq("inventory_status", inventoryStatus); |
|
|
|
queryWrapper.eq("location_code", locationcode); |
|
|
|
queryWrapper.eq("location_code", locationCode); |
|
|
|
List<BalanceDO> balanceDO = balanceMapper.selectList(queryWrapper); |
|
|
|
if (!balanceDO.isEmpty()) { |
|
|
|
return balanceDO; |
|
|
@ -127,19 +67,19 @@ public class BalanceServiceImpl implements BalanceService { |
|
|
|
* 按批次查找 |
|
|
|
* TB----TB2-----BY_BATCH |
|
|
|
* @author lianhongxi |
|
|
|
* @param itemcode 物品code |
|
|
|
* @param itemCode 物品code |
|
|
|
* @param batch 批次 |
|
|
|
* @param inventoryStatus 库存状态 |
|
|
|
* @param locationcode 库位code |
|
|
|
* @param locationCode 库位code |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<BalanceDO> selectBatch(String itemcode, String batch, List<String> inventoryStatus, String locationcode) { |
|
|
|
QueryWrapper queryWrapper = new QueryWrapper(); |
|
|
|
queryWrapper.eq("item_code", itemcode); |
|
|
|
public List<BalanceDO> selectBatch(String itemCode, String batch, List<String> inventoryStatus, String locationCode) { |
|
|
|
QueryWrapper<BalanceDO> queryWrapper = new QueryWrapper<>(); |
|
|
|
queryWrapper.eq("item_code", itemCode); |
|
|
|
queryWrapper.eq("batch", batch); |
|
|
|
queryWrapper.eq("inventory_status", inventoryStatus); |
|
|
|
queryWrapper.eq("location_code", locationcode); |
|
|
|
queryWrapper.eq("location_code", locationCode); |
|
|
|
List<BalanceDO> balanceDO = balanceMapper.selectList(queryWrapper); |
|
|
|
if (!balanceDO.isEmpty()) { |
|
|
|
return balanceDO; |
|
|
@ -154,21 +94,21 @@ public class BalanceServiceImpl implements BalanceService { |
|
|
|
* TB----TB2-----BY_PACKGING |
|
|
|
* 按包装查找 |
|
|
|
* @author lianhongxi |
|
|
|
* @param itemcode 物品code |
|
|
|
* @param packingnumber 包装号 |
|
|
|
* @param itemCode 物品code |
|
|
|
* @param packingNumber 包装号 |
|
|
|
* @param batch 批次 |
|
|
|
* @param inventoryStatus 库存状态 |
|
|
|
* @param locationcode 库位code |
|
|
|
* @param locationCode 库位code |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<BalanceDO> selectPackaging(String itemcode, String packingnumber, String batch, List<String> inventoryStatus, String locationcode) { |
|
|
|
QueryWrapper queryWrapper = new QueryWrapper(); |
|
|
|
queryWrapper.eq("item_code", itemcode); |
|
|
|
queryWrapper.eq("packing_number", packingnumber); |
|
|
|
public List<BalanceDO> selectPackaging(String itemCode, String packingNumber, String batch, List<String> inventoryStatus, String locationCode) { |
|
|
|
QueryWrapper<BalanceDO> queryWrapper = new QueryWrapper<>(); |
|
|
|
queryWrapper.eq("item_code", itemCode); |
|
|
|
queryWrapper.eq("packing_number", packingNumber); |
|
|
|
queryWrapper.eq("batch", batch); |
|
|
|
queryWrapper.eq("inventory_status", inventoryStatus); |
|
|
|
queryWrapper.eq("location_code", locationcode); |
|
|
|
queryWrapper.eq("location_code", locationCode); |
|
|
|
List<BalanceDO> balanceDO = balanceMapper.selectList(queryWrapper); |
|
|
|
if (!balanceDO.isEmpty()) { |
|
|
|
return balanceDO; |
|
|
@ -188,7 +128,7 @@ public class BalanceServiceImpl implements BalanceService { |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<BalanceDO> selectUniqueId(String packingnumber, String locationcode, List<String> inventoryStatus) { |
|
|
|
QueryWrapper queryWrapper = new QueryWrapper(); |
|
|
|
QueryWrapper<BalanceDO> queryWrapper = new QueryWrapper<>(); |
|
|
|
queryWrapper.eq("packing_number", packingnumber); |
|
|
|
queryWrapper.in("inventory_status", inventoryStatus); |
|
|
|
queryWrapper.eq("location_code", locationcode); |
|
|
|