|
|
|
@ -404,27 +404,28 @@ public class DepositoryServiceImpl implements DepositoryService { |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取当前仓库下的所有可见的子仓库 |
|
|
|
* |
|
|
|
* @param id 当前仓库id |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<Integer> findAllChildDepositoryById(Integer id,UserByPort userByPort) { |
|
|
|
public List<Integer> findAllChildDepositoryById(Integer id, UserByPort userByPort) { |
|
|
|
// 获取所有仓库
|
|
|
|
List<Depository> depositoryAll = depositoryMapper.findDepositoryAll(); |
|
|
|
// 定义待返回仓库id
|
|
|
|
List<Integer> depositoryIdList = new ArrayList<>(); |
|
|
|
// 添加仓库id
|
|
|
|
depositoryIdList.add(id); |
|
|
|
for (Depository depository:depositoryAll |
|
|
|
) { |
|
|
|
for (Depository depository : depositoryAll |
|
|
|
) { |
|
|
|
Integer did = depository.getParentId(); |
|
|
|
if(depositoryIdList.contains(did)){ |
|
|
|
if (depositoryIdList.contains(did)) { |
|
|
|
depositoryIdList.add(depository.getId()); |
|
|
|
} |
|
|
|
} |
|
|
|
//用于查询当前用户所拥有及所管理的仓库
|
|
|
|
List<Integer> depositoryIdForUserHas = roleService.findDepositoryIdForUserHas(userByPort); |
|
|
|
depositoryIdList = (List<Integer>) CollectionUtils.intersection(depositoryIdList,depositoryIdForUserHas); |
|
|
|
depositoryIdList = (List<Integer>) CollectionUtils.intersection(depositoryIdList, depositoryIdForUserHas); |
|
|
|
return depositoryIdList; |
|
|
|
} |
|
|
|
|
|
|
|
@ -795,46 +796,75 @@ public class DepositoryServiceImpl implements DepositoryService { |
|
|
|
return toDayInventoryByDNameTest; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取当前仓库该类型下的库存数量 |
|
|
|
* |
|
|
|
* @param did 待查询仓库 |
|
|
|
* @param mtId 待查询类型 |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public InventoryByMTAndDepository getTodayInventoryByDidAndMt(Integer did, Long mtId) { |
|
|
|
Map<String,Object> map = new HashMap<>(); |
|
|
|
map.put("depositoryId",did); |
|
|
|
List<Long> childForMaterialTypeByParent = findChildForMaterialTypeByParent(mtId); |
|
|
|
map.put("mtIdList",childForMaterialTypeByParent); |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
map.put("depositoryId", did); |
|
|
|
// 获取所有子类
|
|
|
|
List<Long> list = findChildForMaterialTypeByParent(mtId); |
|
|
|
map.put("mtIdList", list); |
|
|
|
return depositoryMapper.getTodayInventoryByDidAndMt(map); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取当前仓库下各类型目前的库存数量 |
|
|
|
* |
|
|
|
* @param did 待查询仓库 |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<InventoryByMTAndDepository> getTodayInventoryInfoByDidAndMt(Integer did) { |
|
|
|
Map<String,Object> map = new HashMap<>(); |
|
|
|
map.put("depositoryId",did); |
|
|
|
return depositoryMapper.getTodayInventoryByDid(map); |
|
|
|
List<InventoryByMTAndDepository> result = new ArrayList<>(); |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
map.put("depositoryId", did); |
|
|
|
// 获取所有子类
|
|
|
|
List<MaterialType> materialTypeNoParent = materialTypeMapper.findMaterialTypeNoParent(); |
|
|
|
for (MaterialType materialType : materialTypeNoParent |
|
|
|
) { |
|
|
|
Long oldId = materialType.getOldId(); |
|
|
|
List<Long> list = findChildForMaterialTypeByParent(oldId); |
|
|
|
map.put("mtIdList", list); |
|
|
|
InventoryByMTAndDepository todayInventoryByDidAndMt = depositoryMapper.getTodayInventoryByDidAndMt(map); |
|
|
|
todayInventoryByDidAndMt.setMtId(oldId); |
|
|
|
todayInventoryByDidAndMt.setInventory(todayInventoryByDidAndMt.getInventory() / 100.0); |
|
|
|
result.add(todayInventoryByDidAndMt); |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 根据id获取子类
|
|
|
|
public List<Long> findChildForMaterialTypeByParent(Long mtId) { |
|
|
|
List<Long> result = new ArrayList<>(); |
|
|
|
result.add(mtId); |
|
|
|
List<Long> parentIdList = new ArrayList<>(); |
|
|
|
parentIdList.add(mtId); |
|
|
|
List<Long> parentId = new ArrayList<>(); |
|
|
|
parentId.add(mtId); |
|
|
|
List<MaterialType> materialTypeAll = materialTypeMapper.findMaterialTypeAll(); |
|
|
|
for (MaterialType materialType : materialTypeAll) { |
|
|
|
if (parentIdList.contains(materialType.getParentId())) { |
|
|
|
parentIdList.add(materialType.getOldId()); |
|
|
|
if (parentId.contains(materialType.getParentId())) { |
|
|
|
parentId.add(materialType.getOldId()); |
|
|
|
result.add(materialType.getOldId()); |
|
|
|
} |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 用于获取当前仓库所属部门领导的企业微信id |
|
|
|
* |
|
|
|
* @param depositoryId 待查询仓库id |
|
|
|
* @param userAgent userAgent |
|
|
|
* @param userAgent userAgent |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<String> getDepositoryAdminorgLeaders(String depositoryId,String userAgent) { |
|
|
|
public List<String> getDepositoryAdminorgLeaders(String depositoryId, String userAgent) { |
|
|
|
|
|
|
|
// 获取当前选中的仓库
|
|
|
|
Depository depositoryById = depositoryMapper.findDepositoryById(Integer.parseInt(depositoryId)); |
|
|
|
@ -958,22 +988,22 @@ public class DepositoryServiceImpl implements DepositoryService { |
|
|
|
// 获取当前用户管理的仓库
|
|
|
|
List<RoleAndDepository> depositoryAndRole = roleMapper.findDepositoryAndRole(userByPort.getId()); |
|
|
|
|
|
|
|
Map<String,Object> paramForFindDepositoryId = new HashMap<>(); |
|
|
|
paramForFindDepositoryId.put("type",1); |
|
|
|
paramForFindDepositoryId.put("uid",userByPort.getId()); |
|
|
|
Map<String, Object> paramForFindDepositoryId = new HashMap<>(); |
|
|
|
paramForFindDepositoryId.put("type", 1); |
|
|
|
paramForFindDepositoryId.put("uid", userByPort.getId()); |
|
|
|
// 查询该用户是否存在单独设置的仓库
|
|
|
|
List<Integer> depositoryIdListForPerson = roleMapper.findDepositoryIdForWarehouseVisiblePermissionByCondition(paramForFindDepositoryId); |
|
|
|
paramForFindDepositoryId.put("type",2); |
|
|
|
paramForFindDepositoryId.put("uid",userByPort.getPosition()); |
|
|
|
paramForFindDepositoryId.put("type", 2); |
|
|
|
paramForFindDepositoryId.put("uid", userByPort.getPosition()); |
|
|
|
// 查询该用户职位是否存在设计的仓库
|
|
|
|
List<Integer> depositoryIdListForPost = roleMapper.findDepositoryIdForWarehouseVisiblePermissionByCondition(paramForFindDepositoryId); |
|
|
|
// 取并集
|
|
|
|
List<Integer> integerList = (List<Integer>) CollectionUtils.union(depositoryIdListForPerson, depositoryIdListForPost); |
|
|
|
|
|
|
|
for (RoleAndDepository role:depositoryAndRole |
|
|
|
) { |
|
|
|
for (RoleAndDepository role : depositoryAndRole |
|
|
|
) { |
|
|
|
Integer depositoryId = role.getDepositoryId(); |
|
|
|
if(!integerList.contains(depositoryId)){ |
|
|
|
if (!integerList.contains(depositoryId)) { |
|
|
|
integerList.add(depositoryId); |
|
|
|
} |
|
|
|
} |
|
|
|
|