解决商品库存选择多个仓库之后看流水的查询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

@@ -169,11 +169,11 @@ public class DepotItemService {
public List<DepotItemVo4DetailByTypeAndMId> findDetailByDepotIdsAndMaterialIdList(String depotIds, Boolean forceFlag, Boolean inOutManageFlag, String sku, String batchNumber,
String number, String beginTime, String endTime, Long mId, Integer offset, Integer rows)throws Exception {
Long depotId = null;
String[] depotIdArrOld = null;
if(StringUtil.isNotEmpty(depotIds)) {
depotId = Long.parseLong(depotIds);
depotIdArrOld = depotIds.split(",");
}
List<Long> depotList = depotService.parseDepotList(depotId);
List<Long> depotList = depotService.parseDepotListByArr(depotIdArrOld);
Long[] depotIdArray = StringUtil.listToLongArray(depotList);
List<DepotItemVo4DetailByTypeAndMId> list =null;
try{
@@ -186,11 +186,11 @@ public class DepotItemService {
public Long findDetailByDepotIdsAndMaterialIdCount(String depotIds, Boolean forceFlag, Boolean inOutManageFlag, String sku, String batchNumber,
String number, String beginTime, String endTime, Long mId)throws Exception {
Long depotId = null;
String[] depotIdArrOld = null;
if(StringUtil.isNotEmpty(depotIds)) {
depotId = Long.parseLong(depotIds);
depotIdArrOld = depotIds.split(",");
}
List<Long> depotList = depotService.parseDepotList(depotId);
List<Long> depotList = depotService.parseDepotListByArr(depotIdArrOld);
Long[] depotIdArray = StringUtil.listToLongArray(depotList);
Long result =null;
try{

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";