|
|
|
@ -842,63 +842,14 @@ public class MaterialController { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 获取扫描结果并跳转到库存转移
|
|
|
|
@PostMapping("/qywxApplicationTransferScanQrCode") |
|
|
|
public RestResponse qywxApplicationTransferScanQrCode(@RequestBody Map<String, Object> map, HttpServletRequest request) { |
|
|
|
UserByPort userByPort = (UserByPort) request.getAttribute("userToken"); |
|
|
|
// 获取当前用户所在部门拥有的仓库
|
|
|
|
List<Depository> depositoryByAdminorg = depositoryService.findDepositoryByAdminorg(userByPort.getMaindeparment().toString()); |
|
|
|
// 获取当前扫描的二维码
|
|
|
|
String qrCode = (String) map.get("qrCode"); |
|
|
|
// 根据扫描的二维码获取对应的物料编码
|
|
|
|
String mcode = materialService.findMaterialCodeByQrCode(qrCode); |
|
|
|
InventoryP mp = null; |
|
|
|
if (mcode == null) { |
|
|
|
return new RestResponse(mp); |
|
|
|
} |
|
|
|
// 根据物料编码获取物料
|
|
|
|
Material material = materialService.findMaterialByCode(mcode); |
|
|
|
Map<String, Object> param = new HashMap<>(); |
|
|
|
List<PlaceP> placePList = new ArrayList<>(); |
|
|
|
param.put("mcode", mcode); |
|
|
|
param.put("codeFlag", 1); |
|
|
|
|
|
|
|
// 获取物料与条形码的对应关系
|
|
|
|
List<MaterialAndBarCode> materialByBarCodeByCondition = materialService.findMaterialByBarCodeByCondition(param); |
|
|
|
Boolean flag = false; |
|
|
|
for (int j = 0; j < depositoryByAdminorg.size(); j++) { |
|
|
|
Depository depository = depositoryByAdminorg.get(j); |
|
|
|
param.put("mcode", material.getCode()); |
|
|
|
param.put("depositoryId", depository.getId()); |
|
|
|
// 获取当前仓库下是否有当前物料的库存
|
|
|
|
List<InventoryP> inventory = materialService.findInventory(param); |
|
|
|
if (inventory.size() > 0) { |
|
|
|
mp = inventory.get(0); |
|
|
|
List<PlaceP> place = placeService.findPlaceByMidAndDid(mp.getId(), depository.getId()); |
|
|
|
placePList.addAll(place); |
|
|
|
flag = true; |
|
|
|
} |
|
|
|
} |
|
|
|
if (flag) { |
|
|
|
// 设置当前物料在相关仓库下的所有库位
|
|
|
|
mp.setPlacePList(placePList); |
|
|
|
// 设置物料与条形码的对应关系
|
|
|
|
mp.setMaterialAndBarCodeList(materialByBarCodeByCondition); |
|
|
|
// 获取拆单信息
|
|
|
|
List<SplitInfo> splitInfoByMid = splitUnitService.findSplitInfoByMid(mp.getMid()); |
|
|
|
mp.setSplitInfoList(splitInfoByMid); |
|
|
|
} |
|
|
|
return new RestResponse(mp); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 获取扫描结果并跳转到出库
|
|
|
|
@PostMapping("/qywxApplicationOutScanQrCode") |
|
|
|
public RestResponse qywxApplicationOutScanQrCode(@RequestBody Map<String, Object> map, HttpServletRequest request) { |
|
|
|
UserByPort userByPort = (UserByPort) request.getAttribute("userToken"); |
|
|
|
// 获取当前用户所在部门拥有的仓库
|
|
|
|
List<Depository> depositoryByAdminorg = depositoryService.findDepositoryByAdminorg(userByPort.getMaindeparment().toString()); |
|
|
|
// 查询当前用户管理的仓库
|
|
|
|
List<RoleAndDepository> depositoryAndRole = roleService.findDepositoryAndRole(userByPort.getId()); |
|
|
|
// 获取当前扫描的二维码
|
|
|
|
String qrCode = (String) map.get("qrCode"); |
|
|
|
// 根据扫描的二维码获取对应的物料编码
|
|
|
|
@ -910,7 +861,6 @@ public class MaterialController { |
|
|
|
return new RestResponse(mp); |
|
|
|
} |
|
|
|
// 根据物料编码获取物料
|
|
|
|
Material material = materialService.findMaterialByCode(mcode); |
|
|
|
Map<String, Object> param = new HashMap<>(); |
|
|
|
List<PlaceP> placePList = new ArrayList<>(); |
|
|
|
param.put("mcode", mcode); |
|
|
|
@ -919,14 +869,24 @@ public class MaterialController { |
|
|
|
// 获取物料与条形码的对应关系
|
|
|
|
List<MaterialAndBarCode> materialByBarCodeByCondition = materialService.findMaterialByBarCodeByCondition(param); |
|
|
|
boolean flag = false; |
|
|
|
List<Integer> depositoryIdList = new ArrayList<>(); |
|
|
|
for (Depository depository : depositoryByAdminorg) { |
|
|
|
param.put("mcode", material.getCode()); |
|
|
|
param.put("depositoryId", depository.getId()); |
|
|
|
depositoryIdList.add(depository.getId()); |
|
|
|
} |
|
|
|
for (RoleAndDepository depository : depositoryAndRole) { |
|
|
|
if(!depositoryIdList.contains(depository.getDepositoryId())){ |
|
|
|
depositoryIdList.add(depository.getDepositoryId()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
for (Integer depositoryId:depositoryIdList){ |
|
|
|
param.put("mcode", mcode); |
|
|
|
param.put("depositoryId", depositoryId); |
|
|
|
// 获取当前仓库下是否有当前物料的库存
|
|
|
|
List<InventoryP> inventory = materialService.findInventory(param); |
|
|
|
if (inventory.size() > 0) { |
|
|
|
mp = inventory.get(0); |
|
|
|
List<PlaceP> place = placeService.findPlaceByMidAndDid(mp.getMid(), depository.getId()); |
|
|
|
List<PlaceP> place = placeService.findPlaceByMidAndDid(mp.getMid(), depositoryId); |
|
|
|
placePList.addAll(place); |
|
|
|
flag = true; |
|
|
|
} |
|
|
|
@ -1213,65 +1173,40 @@ public class MaterialController { |
|
|
|
return new RestResponse(result); |
|
|
|
} |
|
|
|
|
|
|
|
@PostMapping("/qywxApplicationTransferScanBarCode") |
|
|
|
public RestResponse qywxApplicationTransferScanBarCode(@RequestBody Map<String, Object> map, HttpServletRequest request) { |
|
|
|
UserByPort userByPort = (UserByPort) request.getAttribute("userToken"); |
|
|
|
// 获取当前用户部门所拥有仓库
|
|
|
|
List<Depository> depositoryByAdminorg = depositoryService.findDepositoryByAdminorg(userByPort.getMaindeparment().toString()); |
|
|
|
// 获取扫描的条形码
|
|
|
|
String qrCode = (String) map.get("qrCode"); |
|
|
|
// 获取条形码与物料的映射
|
|
|
|
MaterialAndBarCode materialByBarCode = materialService.findMaterialByBarCode(qrCode); |
|
|
|
if (materialByBarCode != null) { |
|
|
|
for (Depository depository : depositoryByAdminorg) { |
|
|
|
List<PlaceP> placePList = new ArrayList<>(); |
|
|
|
Boolean isExist = false; |
|
|
|
Map<String, Object> param = new HashMap<>(); |
|
|
|
param.put("depositoryId", depository.getId()); |
|
|
|
param.put("mcode", materialByBarCode.getMcode()); |
|
|
|
List<InventoryP> inventory = materialService.findInventory(param); |
|
|
|
if (inventory.size() > 0) { |
|
|
|
// 如果存在该物料
|
|
|
|
InventoryP materialP = inventory.get(0); |
|
|
|
materialByBarCode.setMid(materialP.getId()); |
|
|
|
List<PlaceP> placeByMidAndDid = placeService.findPlaceByMidAndDid(materialP.getId(), depository.getId()); |
|
|
|
placePList.addAll(placeByMidAndDid); |
|
|
|
isExist = true; |
|
|
|
} |
|
|
|
if (isExist) { |
|
|
|
materialByBarCode.setPlacePList(placePList); |
|
|
|
Inventory inventoryById = materialService.findInventoryById(materialByBarCode.getMid()); |
|
|
|
List<SplitInfo> splitInfoByMid = splitUnitService.findSplitInfoByMid(inventoryById.getMid()); |
|
|
|
materialByBarCode.setSplitInfoList(splitInfoByMid); |
|
|
|
return new RestResponse(materialByBarCode); |
|
|
|
} |
|
|
|
} |
|
|
|
return new RestResponse(null); |
|
|
|
} |
|
|
|
return new RestResponse(null); |
|
|
|
} |
|
|
|
|
|
|
|
// 获取条形码扫描结果
|
|
|
|
@PostMapping("/qywxApplicationOutScanBarCode") |
|
|
|
public RestResponse qywxApplicationOutScanBarCode(@RequestBody Map<String, Object> map, HttpServletRequest request) { |
|
|
|
UserByPort userByPort = (UserByPort) request.getAttribute("userToken"); |
|
|
|
// 获取当前用户部门所拥有仓库
|
|
|
|
List<Depository> depositoryByAdminorg = depositoryService.findDepositoryByAdminorg(userByPort.getMaindeparment().toString()); |
|
|
|
String barCode = (String) map.get("qrCode"); |
|
|
|
// 获取条形码与物料的映射
|
|
|
|
MaterialAndBarCode materialByBarCode = materialService.findMaterialByBarCode(barCode); |
|
|
|
if (materialByBarCode != null) { |
|
|
|
List<PlaceP> placePList = new ArrayList<>(); |
|
|
|
// 获取当前用户部门所拥有仓库
|
|
|
|
List<Depository> depositoryByAdminorg = depositoryService.findDepositoryByAdminorg(userByPort.getMaindeparment().toString()); |
|
|
|
// 查询当前用户管理的仓库
|
|
|
|
List<RoleAndDepository> depositoryAndRole = roleService.findDepositoryAndRole(userByPort.getId()); |
|
|
|
List<Integer> depositoryIdList = new ArrayList<>(); |
|
|
|
for (Depository depository : depositoryByAdminorg) { |
|
|
|
depositoryIdList.add(depository.getId()); |
|
|
|
} |
|
|
|
for (RoleAndDepository depository : depositoryAndRole) { |
|
|
|
if(!depositoryIdList.contains(depository.getDepositoryId())){ |
|
|
|
depositoryIdList.add(depository.getDepositoryId()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
List<PlaceP> placePList = new ArrayList<>(); |
|
|
|
for (Integer depositoryId:depositoryIdList) { |
|
|
|
Boolean isExist = false; |
|
|
|
Map<String, Object> param = new HashMap<>(); |
|
|
|
param.put("depositoryId", depository.getId()); |
|
|
|
param.put("depositoryId", depositoryId); |
|
|
|
param.put("mid", materialByBarCode.getMid()); |
|
|
|
List<InventoryP> inventory = materialService.findInventory(param); |
|
|
|
if (inventory.size() > 0) { |
|
|
|
// 如果存在该物料
|
|
|
|
InventoryP inventoryP = inventory.get(0); |
|
|
|
List<PlaceP> placeByMidAndDid = placeService.findPlaceByMidAndDid(inventoryP.getId(), depository.getId()); |
|
|
|
List<PlaceP> placeByMidAndDid = placeService.findPlaceByMidAndDid(inventoryP.getId(), depositoryId); |
|
|
|
materialByBarCode.setIid(inventoryP.getId()); |
|
|
|
placePList.addAll(placeByMidAndDid); |
|
|
|
isExist = true; |
|
|
|
|