商品调拨代码

This commit is contained in:
mayang
2025-03-31 10:24:42 +08:00
parent b1e560be64
commit 6e1204fbea
19 changed files with 1334 additions and 4 deletions

View File

@@ -1,9 +1,11 @@
package com.openhis.workflow.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.core.common.core.domain.model.LoginUser;
import com.openhis.workflow.domain.InventoryItem;
import com.openhis.workflow.domain.SupplyRequest;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
@@ -20,4 +22,27 @@ public interface IInventoryItemService extends IService<InventoryItem> {
* @param InventoryItemList 入库项目
*/
void stockIn(List<InventoryItem> InventoryItemList);
/**
* 更新库房数量
*
* @param id 主键
* @param baseQuantity 常规单位库存数量
* @param minQuantity 最小单位库存数量
* @param loginUser 登录用户信息
* @param now 当前时间
* @return 更新件数
*/
Boolean updateInventoryQuantity(Long id, BigDecimal baseQuantity, BigDecimal minQuantity, LoginUser loginUser, Date now);
/**
* 查询
*
* @param lotNumber 产品批号
* @param locationId 仓库
* @param locationStoreId 库位
* @return 单据详情
*/
InventoryItem selectInventoryByLotNumber(String lotNumber, Long locationId, Long locationStoreId);
}

View File

@@ -1,7 +1,8 @@
package com.openhis.workflow.service.impl;
import com.openhis.administration.domain.ChargeItem;
import com.openhis.workflow.domain.SupplyRequest;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.core.common.core.domain.model.LoginUser;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -9,6 +10,8 @@ import com.openhis.workflow.domain.InventoryItem;
import com.openhis.workflow.mapper.InventoryItemMapper;
import com.openhis.workflow.service.IInventoryItemService;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
@@ -34,4 +37,53 @@ public class InventoryItemServiceImpl extends ServiceImpl<InventoryItemMapper, I
}
}
}
/**
* 更新库房数量
*
* @param id 主键
* @param baseQuantity 常规单位库存数量
* @param minQuantity 最小单位库存数量
* @param loginUser 登录用户信息
* @param now 当前时间
* @return 更新件数
*/
@Override
public Boolean updateInventoryQuantity(Long id, BigDecimal baseQuantity,BigDecimal minQuantity, LoginUser loginUser, Date now) {
int updateCount = baseMapper.update(null,
new LambdaUpdateWrapper<InventoryItem>().eq(InventoryItem::getId, id)
.set(InventoryItem::getUpdateTime, now)
.set(InventoryItem::getUpdateBy, loginUser.getUserId())
.set(InventoryItem::getBaseQuantity, baseQuantity)
.set(InventoryItem::getMinQuantity, minQuantity));
return updateCount > 0;
}
/**
* 查询库房信息
*
* @param lotNumber 产品批号
* @param locationId 仓库
* @param locationStoreId 库位
*/
@Override
public InventoryItem selectInventoryByLotNumber(String lotNumber, Long locationId, Long locationStoreId) {
// 查询取库房信息
InventoryItem inventoryItem =
baseMapper.selectOne(new LambdaQueryWrapper<InventoryItem>()
.eq(InventoryItem::getLotNumber, lotNumber)
.eq(InventoryItem::getLocationId, locationId)
.eq(InventoryItem::getLocationStoreId, locationStoreId));
if (inventoryItem == null) {
return null;
}
return inventoryItem;
}
}