Browse Source

库存预警修复bug

master
songguoqiang 7 months ago
parent
commit
8cb5f30fee
  1. 65
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/dal/mysql/item/ItemMapper.java
  2. 3
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/item/ItemServiceImpl.java

65
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/dal/mysql/item/ItemMapper.java

@ -1,5 +1,6 @@
package com.win.module.eam.dal.mysql.item;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.win.framework.common.pojo.CustomConditions;
@ -32,6 +33,36 @@ public interface ItemMapper extends BaseMapperX<ItemDO> {
if("1".equals(reqVO.getFlag())){//查询排除有台账的备件
wrapperX.notInSql(ItemDO::getNumber,"select DISTINCT a.item_number from basic_item_accounts a where a.available = 'TRUE' and a.deleted = 0");
}
if("2".equals(reqVO.getFlag())){//查询备件预警库存总数小于备件最低库存
wrapperX.inSql(ItemDO::getNumber,"SELECT\n" +
"\td.item_number\n" +
"FROM\n" +
"\t(\n" +
"\tSELECT\n" +
"\t\tSUM( qty ) AS qty,\n" +
"\t\tt.item_number,\n" +
"\t\tt.location_number \n" +
"\tFROM\n" +
"\t\tbasic_item_accounts t \n" +
"\tWHERE\n" +
"\t\tdeleted = 0 \n" +
"\t\tAND available = 'TRUE' \n" +
"\tGROUP BY\n" +
"\t\tt.item_number,\n" +
"\t\tt.location_number \n" +
"\t) d \n" +
"WHERE\n" +
"d.qty < (\n" +
"\tSELECT\n" +
"\t\ti.min_inventory \n" +
"\tFROM\n" +
"\t\tbasic_item i \n" +
"\tWHERE\n" +
"\t\ti.deleted = 0 \n" +
"\t\tAND i.available = 'TRUE' \n" +
"and \n" +
"\ti.number = d.item_number)");
}
wrapperX.orderByDesc(ItemDO::getId);
return selectPage(reqVO,wrapperX);
}
@ -73,9 +104,43 @@ public interface ItemMapper extends BaseMapperX<ItemDO> {
List<ItemDO> scanCodeByNumber(@Param("number") String number);
default PageResult<ItemDO> getItemSenior(CustomConditions conditions) {
QueryWrapper<ItemDO> structure = QueryWrapperUtils.structure(conditions);
return selectPage(conditions, QueryWrapperUtils.structure(conditions));
}
default PageResult<ItemDO> getItemWarningSenior(CustomConditions conditions) {
QueryWrapper<ItemDO> wrapperX = QueryWrapperUtils.structure(conditions);
wrapperX.inSql("number","SELECT\n" +
"\td.item_number\n" +
"FROM\n" +
"\t(\n" +
"\tSELECT\n" +
"\t\tSUM( qty ) AS qty,\n" +
"\t\tt.item_number,\n" +
"\t\tt.location_number \n" +
"\tFROM\n" +
"\t\tbasic_item_accounts t \n" +
"\tWHERE\n" +
"\t\tdeleted = 0 \n" +
"\t\tAND available = 'TRUE' \n" +
"\tGROUP BY\n" +
"\t\tt.item_number,\n" +
"\t\tt.location_number \n" +
"\t) d \n" +
"WHERE\n" +
"d.qty < (\n" +
"\tSELECT\n" +
"\t\ti.min_inventory \n" +
"\tFROM\n" +
"\t\tbasic_item i \n" +
"\tWHERE\n" +
"\t\ti.deleted = 0 \n" +
"\t\tAND i.available = 'TRUE' \n" +
"and \n" +
"\ti.number = d.item_number)");
return selectPage(conditions,wrapperX);
}
default List<ItemDO> selectNoPage(ItemPageReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<ItemDO>()
.eqIfPresent(ItemDO::getNumber, reqVO.getNumber())

3
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/item/ItemServiceImpl.java

@ -346,6 +346,7 @@ public class ItemServiceImpl implements ItemService {
@Override
public PageResult<ItemDO> getWarningPage(ItemPageReqVO pageReqVO) {
pageReqVO.setFlag("2");
PageResult<ItemDO> pageResult = itemMapper.selectPage(pageReqVO);
List<ItemDO> itemNewList=new ArrayList();
for (ItemDO itemDO : pageResult.getList()) {
@ -370,7 +371,7 @@ public class ItemServiceImpl implements ItemService {
@Override
public PageResult<ItemDO> getItemWarningSenior(CustomConditions conditions) {
PageResult<ItemDO> pageResult = itemMapper.getItemSenior(conditions);
PageResult<ItemDO> pageResult = itemMapper.getItemWarningSenior(conditions);
for (ItemDO itemDO : pageResult.getList()) {
QueryWrapper<ItemAccountsDO> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("item_number",itemDO.getNumber());

Loading…
Cancel
Save