解决商品库存选择多个仓库之后看流水的查询bug

This commit is contained in:
jishenghua
2025-04-17 10:44:56 +08:00
parent b1c0912e78
commit 870a9dc9c0
2 changed files with 35 additions and 6 deletions

View File

@@ -268,6 +268,12 @@ public class DepotService {
return id;
}
/**
* 根据单个仓库查询
* @param depotId
* @return
* @throws Exception
*/
public List<Long> parseDepotList(Long depotId) throws Exception {
List<Long> depotList = new ArrayList<>();
if(depotId !=null) {
@@ -283,6 +289,29 @@ public class DepotService {
return depotList;
}
/**
* 根据多个仓库查询
* @param depotIdArr
* @return
* @throws Exception
*/
public List<Long> parseDepotListByArr(String[] depotIdArr) throws Exception {
List<Long> depotList = new ArrayList<>();
if(depotIdArr !=null) {
for (int i = 0; i < depotIdArr.length; i++) {
depotList.add(Long.parseLong(depotIdArr[i]));
}
} else {
//未选择仓库时默认为当前用户有权限的仓库
JSONArray depotArr = findDepotByCurrentUser();
for(Object obj: depotArr) {
JSONObject object = JSONObject.parseObject(obj.toString());
depotList.add(object.getLong("id"));
}
}
return depotList;
}
public JSONArray findDepotByCurrentUser() throws Exception {
JSONArray arr = new JSONArray();
String type = "UserDepot";