|
|
@ -12,6 +12,7 @@ import com.dreamchaser.depository_manage.service.*; |
|
|
import com.dreamchaser.depository_manage.utils.CrudUtil; |
|
|
import com.dreamchaser.depository_manage.utils.CrudUtil; |
|
|
import com.dreamchaser.depository_manage.utils.DateUtil; |
|
|
import com.dreamchaser.depository_manage.utils.DateUtil; |
|
|
import com.dreamchaser.depository_manage.utils.ObjectFormatUtil; |
|
|
import com.dreamchaser.depository_manage.utils.ObjectFormatUtil; |
|
|
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.data.redis.core.RedisTemplate; |
|
|
import org.springframework.data.redis.core.RedisTemplate; |
|
|
import org.springframework.web.bind.annotation.*; |
|
|
import org.springframework.web.bind.annotation.*; |
|
|
@ -317,16 +318,25 @@ public class MaterialController { |
|
|
} |
|
|
} |
|
|
Map<String, Object> param = new HashMap<>(); |
|
|
Map<String, Object> param = new HashMap<>(); |
|
|
param.put("mcode", mcode); |
|
|
param.put("mcode", mcode); |
|
|
List<InventoryP> inventory = materialService.findInventory(param); |
|
|
List<InventoryP> inventoryPS = materialService.findInventory(param); |
|
|
Map<String, Object> paramByBarcode = new HashMap<>(); |
|
|
Map<String, Object> paramByBarcode = new HashMap<>(); |
|
|
paramByBarcode.put("mcode", mcode); |
|
|
paramByBarcode.put("mcode", mcode); |
|
|
paramByBarcode.put("codeFlag", 1); |
|
|
paramByBarcode.put("codeFlag", 1); |
|
|
List<MaterialAndBarCode> materialByBarCodeByCondition = materialService.findMaterialByBarCodeByCondition(paramByBarcode); |
|
|
List<MaterialAndBarCode> materialByBarCodeByCondition = materialService.findMaterialByBarCodeByCondition(paramByBarcode); |
|
|
if (inventory.size() > 0) { |
|
|
if (inventoryPS.size() > 0) { |
|
|
InventoryP materialP = inventory.get(0); |
|
|
List<Integer> depositoryIdList = roleService.findDepositoryIdForWareHouseVisiblePermissionByUser(userToken); |
|
|
|
|
|
List<Integer> tempDepositoryID = new ArrayList<>(); |
|
|
|
|
|
for (InventoryP inventory:inventoryPS |
|
|
|
|
|
) { |
|
|
|
|
|
tempDepositoryID.add(inventory.getDepositoryId()); |
|
|
|
|
|
} |
|
|
|
|
|
tempDepositoryID = (List<Integer>) CollectionUtils.union(depositoryIdList,tempDepositoryID); |
|
|
|
|
|
List<Depository> depositoryByIds = depositoryService.findDepositoryByIds(tempDepositoryID); |
|
|
|
|
|
InventoryP materialP = inventoryPS.get(0); |
|
|
materialP.setMaterialAndBarCodeList(materialByBarCodeByCondition); |
|
|
materialP.setMaterialAndBarCodeList(materialByBarCodeByCondition); |
|
|
List<SplitInfo> splitInfoByMid = splitUnitService.findSplitInfoByMid(materialP.getMid()); |
|
|
List<SplitInfo> splitInfoByMid = splitUnitService.findSplitInfoByMid(materialP.getMid()); |
|
|
materialP.setSplitInfoList(splitInfoByMid); |
|
|
materialP.setSplitInfoList(splitInfoByMid); |
|
|
|
|
|
materialP.setDepositoryList(depositoryByIds); |
|
|
map.put("materialById", materialP); |
|
|
map.put("materialById", materialP); |
|
|
} else { |
|
|
} else { |
|
|
materialById.setPrice(0.0); |
|
|
materialById.setPrice(0.0); |
|
|
@ -440,15 +450,24 @@ public class MaterialController { |
|
|
depositoryIdList.add(rad.getDepositoryId()); |
|
|
depositoryIdList.add(rad.getDepositoryId()); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
// 获取该用户额外可见的仓库
|
|
|
|
|
|
List<Integer> tempDepositoryIdlist = roleService.findDepositoryIdForWareHouseVisiblePermissionByUser(userToken); |
|
|
|
|
|
depositoryIdList= (List<Integer>) CollectionUtils.union(tempDepositoryIdlist,depositoryIdList); |
|
|
|
|
|
// 用于存储存在库存的仓库id
|
|
|
|
|
|
List<Integer> showDepository = new ArrayList<>(); |
|
|
for (Integer depositoryId : depositoryIdList |
|
|
for (Integer depositoryId : depositoryIdList |
|
|
) { |
|
|
) { |
|
|
param.put("depositoryId", depositoryId); |
|
|
param.put("depositoryId", depositoryId); |
|
|
List<InventoryP> inventoryPS = materialService.findInventory(param); |
|
|
List<InventoryP> inventoryPS = materialService.findInventory(param); |
|
|
|
|
|
if(inventoryPS.size() > 0){ |
|
|
|
|
|
showDepository.add(depositoryId); |
|
|
|
|
|
} |
|
|
inventoryPByCondition.addAll(inventoryPS); |
|
|
inventoryPByCondition.addAll(inventoryPS); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
MaterialP mp = null; |
|
|
MaterialP mp = null; |
|
|
InventoryP ip = null; |
|
|
InventoryP ip = null; |
|
|
|
|
|
// 用于获取单价
|
|
|
Map<String, Object> paramByPrice = new HashMap<>(); |
|
|
Map<String, Object> paramByPrice = new HashMap<>(); |
|
|
if (inventoryPByCondition.size() > 0) { |
|
|
if (inventoryPByCondition.size() > 0) { |
|
|
ip = inventoryPByCondition.get(0); |
|
|
ip = inventoryPByCondition.get(0); |
|
|
@ -467,8 +486,11 @@ public class MaterialController { |
|
|
ip.setMaterialAndBarCodeList(materialByBarCodeByCondition); |
|
|
ip.setMaterialAndBarCodeList(materialByBarCodeByCondition); |
|
|
List<SplitInfo> splitInfoByMid = splitUnitService.findSplitInfoByMid(ip.getMid()); |
|
|
List<SplitInfo> splitInfoByMid = splitUnitService.findSplitInfoByMid(ip.getMid()); |
|
|
ip.setSplitInfoList(splitInfoByMid); |
|
|
ip.setSplitInfoList(splitInfoByMid); |
|
|
|
|
|
List<Depository> depositoryByIds = depositoryService.findDepositoryByIds(showDepository); |
|
|
|
|
|
ip.setDepositoryList(depositoryByIds); |
|
|
return new RestResponse(ip, 1, 200); |
|
|
return new RestResponse(ip, 1, 200); |
|
|
} else if ("in".equals(type)) { |
|
|
} |
|
|
|
|
|
else if ("in".equals(type)) { |
|
|
param.put("code", code); |
|
|
param.put("code", code); |
|
|
materialPByCondition = materialService.findMaterialPByCondition(param); |
|
|
materialPByCondition = materialService.findMaterialPByCondition(param); |
|
|
if (materialPByCondition.size() > 0) { |
|
|
if (materialPByCondition.size() > 0) { |
|
|
@ -526,12 +548,16 @@ public class MaterialController { |
|
|
depositoryIdList.add(rad.getDepositoryId()); |
|
|
depositoryIdList.add(rad.getDepositoryId()); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
List<Integer> tempDepositoryIDList = roleService.findDepositoryIdForWareHouseVisiblePermissionByUser(userToken); |
|
|
|
|
|
depositoryIdList = (List<Integer>) CollectionUtils.union(tempDepositoryIDList,depositoryIdList); |
|
|
for (Integer depositoryId : depositoryIdList |
|
|
for (Integer depositoryId : depositoryIdList |
|
|
) { |
|
|
) { |
|
|
map.put("depositoryId", depositoryId); |
|
|
map.put("depositoryId", depositoryId); |
|
|
List<InventoryP> inventoryPS = materialService.findInventory(map); |
|
|
List<InventoryP> inventoryPS = materialService.findInventory(map); |
|
|
inventoryPList.addAll(inventoryPS); |
|
|
inventoryPList.addAll(inventoryPS); |
|
|
} |
|
|
} |
|
|
|
|
|
List<Depository> depositoryByIds = depositoryService.findDepositoryByIds(depositoryIdList); |
|
|
Map<String, Object> paramByBarcode = new HashMap<>(); |
|
|
Map<String, Object> paramByBarcode = new HashMap<>(); |
|
|
for (InventoryP inventoryP : inventoryPList) { |
|
|
for (InventoryP inventoryP : inventoryPList) { |
|
|
List<SplitInfo> splitInfoByMid = splitUnitService.findSplitInfoByMid(inventoryP.getMid()); |
|
|
List<SplitInfo> splitInfoByMid = splitUnitService.findSplitInfoByMid(inventoryP.getMid()); |
|
|
@ -550,6 +576,7 @@ public class MaterialController { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
inventoryP.setDepositoryList(depositoryByIds); |
|
|
inventoryP.setPlacePList(placeList); |
|
|
inventoryP.setPlacePList(placeList); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -706,6 +733,11 @@ public class MaterialController { |
|
|
if (Integer.compare(placeId, -1) == 0) { |
|
|
if (Integer.compare(placeId, -1) == 0) { |
|
|
// 如果是查询所有库存
|
|
|
// 如果是查询所有库存
|
|
|
List<Depository> depositoryByAdminorg = depositoryService.findDepositoryByAdminorg(userByPort.getMaindeparment().toString()); |
|
|
List<Depository> depositoryByAdminorg = depositoryService.findDepositoryByAdminorg(userByPort.getMaindeparment().toString()); |
|
|
|
|
|
if(map.containsKey("depositoryId")){ |
|
|
|
|
|
Depository depositoryById = depositoryService.findDepositoryById(ObjectFormatUtil.toInteger(map.get("depositoryId"))); |
|
|
|
|
|
depositoryByAdminorg = new ArrayList<>(); |
|
|
|
|
|
depositoryByAdminorg.add(depositoryById); |
|
|
|
|
|
} |
|
|
for (Depository depository : depositoryByAdminorg) { |
|
|
for (Depository depository : depositoryByAdminorg) { |
|
|
map.put("depositoryId", depository.getId()); |
|
|
map.put("depositoryId", depository.getId()); |
|
|
List<InventoryP> inventoryPList = materialService.findInventory(map); |
|
|
List<InventoryP> inventoryPList = materialService.findInventory(map); |
|
|
@ -752,7 +784,8 @@ public class MaterialController { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} |
|
|
|
|
|
else { |
|
|
// 获取当前要转移的库位
|
|
|
// 获取当前要转移的库位
|
|
|
Place place = placeService.findPlaceById(placeId); |
|
|
Place place = placeService.findPlaceById(placeId); |
|
|
if (Integer.compare(place.getId(), 0) != 0) { |
|
|
if (Integer.compare(place.getId(), 0) != 0) { |
|
|
@ -907,6 +940,9 @@ public class MaterialController { |
|
|
depositoryIdList.add(depository.getDepositoryId()); |
|
|
depositoryIdList.add(depository.getDepositoryId()); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
List<Integer> tempDepositoryIdList = roleService.findDepositoryIdForWareHouseVisiblePermissionByUser(userByPort); |
|
|
|
|
|
depositoryIdList = (List<Integer>) CollectionUtils.union(depositoryIdList,tempDepositoryIdList); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (Integer depositoryId : depositoryIdList) { |
|
|
for (Integer depositoryId : depositoryIdList) { |
|
|
param.put("mcode", mcode); |
|
|
param.put("mcode", mcode); |
|
|
@ -921,6 +957,7 @@ public class MaterialController { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if (flag) { |
|
|
if (flag) { |
|
|
|
|
|
List<Depository> depositoryByIds = depositoryService.findDepositoryByIds(depositoryIdList); |
|
|
// 设置当前物料在相关仓库下的所有库位
|
|
|
// 设置当前物料在相关仓库下的所有库位
|
|
|
mp.setPlacePList(placePList); |
|
|
mp.setPlacePList(placePList); |
|
|
// 设置物料与条形码的对应关系
|
|
|
// 设置物料与条形码的对应关系
|
|
|
@ -928,6 +965,8 @@ public class MaterialController { |
|
|
// 获取拆单信息
|
|
|
// 获取拆单信息
|
|
|
List<SplitInfo> splitInfoByMid = splitUnitService.findSplitInfoByMid(mp.getMid()); |
|
|
List<SplitInfo> splitInfoByMid = splitUnitService.findSplitInfoByMid(mp.getMid()); |
|
|
mp.setSplitInfoList(splitInfoByMid); |
|
|
mp.setSplitInfoList(splitInfoByMid); |
|
|
|
|
|
mp.setDepositoryList(depositoryByIds); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
return new RestResponse(mp); |
|
|
return new RestResponse(mp); |
|
|
|
|
|
|
|
|
@ -1075,10 +1114,11 @@ public class MaterialController { |
|
|
depositoryIdList.add(depository.getDepositoryId()); |
|
|
depositoryIdList.add(depository.getDepositoryId()); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
List<Integer> tempDepositoryIdList = roleService.findDepositoryIdForWareHouseVisiblePermissionByUser(userByPort); |
|
|
|
|
|
depositoryIdList = (List<Integer>) CollectionUtils.union(depositoryIdList,tempDepositoryIdList); |
|
|
List<PlaceP> placePList = new ArrayList<>(); |
|
|
List<PlaceP> placePList = new ArrayList<>(); |
|
|
for (Integer depositoryId : depositoryIdList) { |
|
|
for (Integer depositoryId : depositoryIdList) { |
|
|
Boolean isExist = false; |
|
|
boolean isExist = false; |
|
|
Map<String, Object> param = new HashMap<>(); |
|
|
Map<String, Object> param = new HashMap<>(); |
|
|
param.put("depositoryId", depositoryId); |
|
|
param.put("depositoryId", depositoryId); |
|
|
param.put("mid", materialByBarCode.getMid()); |
|
|
param.put("mid", materialByBarCode.getMid()); |
|
|
@ -1095,6 +1135,8 @@ public class MaterialController { |
|
|
if (isExist) { |
|
|
if (isExist) { |
|
|
List<SplitInfo> splitInfoByMid = splitUnitService.findSplitInfoByMid(materialByBarCode.getMid()); |
|
|
List<SplitInfo> splitInfoByMid = splitUnitService.findSplitInfoByMid(materialByBarCode.getMid()); |
|
|
materialByBarCode.setSplitInfoList(splitInfoByMid); |
|
|
materialByBarCode.setSplitInfoList(splitInfoByMid); |
|
|
|
|
|
List<Depository> depositoryByIds = depositoryService.findDepositoryByIds(depositoryIdList); |
|
|
|
|
|
materialByBarCode.setDepositoryList(depositoryByIds); |
|
|
return new RestResponse(materialByBarCode); |
|
|
return new RestResponse(materialByBarCode); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|