|
|
@ -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()) |
|
|
|