仓库管理修改

liweidong
wusiyu 2 weeks ago
parent 4bd538f1cc
commit eecb115944
  1. 10
      blade-service-api/blade-wms-api/src/main/java/org/springblade/wms/pojo/vo/StStorehouseVO.java
  2. 46
      blade-service/blade-wms/src/main/java/org/springblade/wms/controller/StComboxController.java
  3. 29
      blade-service/blade-wms/src/main/java/org/springblade/wms/mapper/StStorehouseMapper.xml

@ -27,6 +27,16 @@ public class StStorehouseVO extends StStorehouse {
*/
@Schema(description = "保管员姓名")
private String saveUserName;
/**
* 物料编码
*/
@Schema(description = "物料编码")
private String goodsCode;
/**
* 物料名称
*/
@Schema(description = "物料名称")
private String goodsName;
}

@ -15,6 +15,7 @@ import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.wms.mapper.StGoodsMapper;
import org.springblade.wms.pojo.entity.StGoods;
import org.springblade.wms.pojo.entity.StRealtimeStock;
import org.springblade.wms.pojo.entity.StUserRight;
@ -31,6 +32,8 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* @version 1.0
@ -57,6 +60,8 @@ public class StComboxController {
IStGoodsExtService stGoodsExtService;
@Resource
IStClassRequestService stClassRequestService;
@Resource
StGoodsMapper stGoodsMapper;
/*@Resource
ISysClient sysClient;*/
@ -207,6 +212,47 @@ public class StComboxController {
return R.data(pages);
}
@GetMapping("/getStockByStorehouseAndGoods")
@ApiOperationSupport(order = 8)
@ApiLog("查询所有库存信息")
@Operation(summary = "库房组件", description = "传入coStorehouse")
public R<List<StRealtimeStockVO>> getStockByStorehouseAndGoods(StStorehouseVO stStorehouse, Query query) {
// 1. 获取当前登录用户信息
// BladeUser user = AuthUtil.getUser();
// stStorehouse.setDeptId(userInfo.getDeptId());
// 2. 强制不分页
query.setSize(-1);
query.setCurrent(1);
String urTypeStorehouse = StUserRight.UR_TYPE_STOREHOUSE;
// 3. 调用分页查询
IPage<StStorehouseVO> storehousePages = stStorehouseService.selectStorehousePage(Condition.getPage(query), stStorehouse, AuthUtil.getUserId(), urTypeStorehouse);
// 3. 取出 库房ID(shId)
List<Long> shIdList = storehousePages.getRecords().stream()
.map(StStorehouseVO::getId)
.filter(Objects::nonNull)
.collect(Collectors.toList());
// 如果没有库房,直接返回空
if (CollUtil.isEmpty(shIdList)) {
return R.data(new ArrayList<>());
}
// 4. 取出 物料ID(从传入的 stStorehouse 里拿)
StGoods goods = stGoodsMapper.queryByCode(stStorehouse.getGoodsCode());
// 5. 调用 实时库存查询(传入 物料ID + 库房ID)
List<StRealtimeStockVO> allStockList = new ArrayList<>();
for (Long shId : shIdList) {
IPage<StRealtimeStockVO> stockPage = stRealtimeStockService.selectByGoodsIdShId(Condition.getPage(query), goods.getId(), shId, null, null);
allStockList.addAll(stockPage.getRecords());
}
return R.data(allStockList);
}
@GetMapping("/outboundGoods")
@ApiOperationSupport(order = 6)
@ApiLog("班组提请可选物料")

@ -28,7 +28,7 @@
select * from ST_STOREHOUSE where is_deleted = 0
</select>
<select id="selectStorehousePage" resultMap="stStorehouseResultMap">
<select id="selectStorehousePage" resultType="org.springblade.wms.pojo.vo.StStorehouseVO">
SELECT
t.id,
t.sh_name
@ -38,6 +38,33 @@
<if test="stStorehouse.shName != null and stStorehouse.shName != ''">
AND t.sh_name LIKE '%' || #{stStorehouse.shName} || '%'
</if>
<!-- 【新增】根据物料编号过滤库房 -->
<if test="stStorehouse.goodsCode != null and stStorehouse.goodsCode != ''">
AND EXISTS (
SELECT 1
FROM st_realtime_stock r
JOIN st_goods g ON r.goods_id = g.id
WHERE r.sh_id = t.id -- 关联当前库房
AND r.is_deleted = 0
AND g.is_deleted = 0
AND g.goods_code = #{stStorehouse.goodsCode}
)
</if>
<!-- 2. 物料名称 模糊查询 -->
<if test="stStorehouse.goodsName != null and stStorehouse.goodsName != ''">
AND EXISTS (
SELECT 1
FROM st_realtime_stock r
JOIN st_goods g ON r.goods_id = g.id
WHERE r.sh_id = t.id
AND r.is_deleted = 0
AND g.is_deleted = 0
AND g.goods_name LIKE '%' || #{stStorehouse.goodsName} || '%'
)
</if>
AND t.id IN (
SELECT
sur.the_id

Loading…
Cancel
Save