|
|
|
@ -208,11 +208,34 @@ public class PlaceController { |
|
|
|
@PostMapping("/findPlaceByMid") |
|
|
|
public RestResponse findPlaceByMid(@RequestBody Map<String,Object> map, HttpServletRequest request){ |
|
|
|
UserByPort userToken= (UserByPort) request.getAttribute("userToken"); |
|
|
|
// 查询当前用户部门所拥有的仓库
|
|
|
|
List<Depository> depositoryByAdminorg = depositoryService.findDepositoryByAdminorg(userToken.getMaindeparment().toString()); |
|
|
|
// 查询当前用户管理的仓库
|
|
|
|
List<RoleAndDepository> depositoryAndRole = roleService.findDepositoryAndRole(userToken.getId()); |
|
|
|
Integer mid = ObjectFormatUtil.toInteger(map.get("mid")); |
|
|
|
Inventory inventoryById = materialService.findInventoryById(mid); |
|
|
|
List<PlaceP> placeList = new ArrayList<>(); |
|
|
|
Map<String, Object> param = new HashMap<>(); |
|
|
|
param.put("mcode", inventoryById.getCode()); |
|
|
|
List<Integer> depositoryIdList = new ArrayList<>(); |
|
|
|
for (Depository depository : depositoryByAdminorg) { |
|
|
|
List<PlaceP> placeByMidAndDid = placeService.findPlaceByMidAndDid(mid, depository.getId()); |
|
|
|
depositoryIdList.add(depository.getId()); |
|
|
|
} |
|
|
|
for (RoleAndDepository depository : depositoryAndRole) { |
|
|
|
if(!depositoryIdList.contains(depository.getDepositoryId())){ |
|
|
|
depositoryIdList.add(depository.getDepositoryId()); |
|
|
|
} |
|
|
|
} |
|
|
|
List<InventoryP> inventoryPList = new ArrayList<>(); |
|
|
|
for (Integer depositoryId:depositoryIdList |
|
|
|
) { |
|
|
|
param.put("depositoryId", depositoryId); |
|
|
|
// 查找当前用户部门仓库中是否存在该物料
|
|
|
|
inventoryPList.addAll(materialService.findInventory(param)); |
|
|
|
} |
|
|
|
for (Integer depositoryId:depositoryIdList){ |
|
|
|
for (InventoryP inventory : inventoryPList) { |
|
|
|
List<PlaceP> placeByMidAndDid = placeService.findPlaceByMidAndDid(inventory.getId(), depositoryId); |
|
|
|
for (PlaceP placeP : placeByMidAndDid) { |
|
|
|
int index = placeList.indexOf(placeP); |
|
|
|
if (index == -1) { |
|
|
|
@ -220,6 +243,8 @@ public class PlaceController { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
return new RestResponse(placeList); |
|
|
|
} |
|
|
|
// 根据物料编码以及仓库编号获取具体库位
|
|
|
|
|