feat: 添加储位功能

This commit is contained in:
曹鹏飞 2025-07-03 11:47:06 +08:00
parent c8655a7a8c
commit 373c650e0a
1 changed files with 7 additions and 1 deletions

View File

@ -9,9 +9,11 @@ import com.nflg.wms.common.pojo.vo.BinVO;
import com.nflg.wms.common.util.UserUtil;
import com.nflg.wms.common.util.VUtil;
import com.nflg.wms.repository.entity.WmsBin;
import com.nflg.wms.repository.entity.WmsStorageBin;
import com.nflg.wms.repository.mapper.WmsBinMapper;
import com.nflg.wms.repository.service.IAuditLogService;
import com.nflg.wms.repository.service.IWmsBinService;
import com.nflg.wms.repository.service.IWmsStorageBinService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -34,6 +36,9 @@ public class WmsBinServiceImpl extends ServiceImpl<WmsBinMapper, WmsBin> impleme
@Resource
private IAuditLogService auditLogService;
@Resource
private IWmsStorageBinService storageBinService;
@Transactional
@Override
public void add(WmsBin bin) {
@ -64,7 +69,8 @@ public class WmsBinServiceImpl extends ServiceImpl<WmsBinMapper, WmsBin> impleme
@Transactional
@Override
public void delete(Long id) {
// TODO 删除储位判断是否存储了物料
VUtil.trueThrowBusinessError(storageBinService.lambdaQuery().eq(WmsStorageBin::getBinId, id).exists())
.throwMessage("删除失败,储位下有物料");
WmsBin old = getById(id);
VUtil.trueThrowBusinessError(Objects.isNull(old)).throwMessage("储位不存在");
removeById(id);