no message
parent
d1a01af4ca
commit
0318c2e568
|
|
@ -23,6 +23,7 @@ import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
@ -129,6 +130,7 @@ public class BatchProcessor {
|
||||||
batchUtil.updateBatchInventory(updateToInventory);
|
batchUtil.updateBatchInventory(updateToInventory);
|
||||||
}
|
}
|
||||||
if (CollectionUtils.isNotEmpty(updateToPickDetail)) {
|
if (CollectionUtils.isNotEmpty(updateToPickDetail)) {
|
||||||
|
updateToPickDetail.sort(Comparator.comparing(PickDetail::getId));
|
||||||
batchUtil.updateBatchPickDetail(updateToPickDetail);
|
batchUtil.updateBatchPickDetail(updateToPickDetail);
|
||||||
}
|
}
|
||||||
if (CollectionUtils.isNotEmpty(createToTask)) {
|
if (CollectionUtils.isNotEmpty(createToTask)) {
|
||||||
|
|
@ -149,6 +151,7 @@ public class BatchProcessor {
|
||||||
batchUtil.updateBatchInventory(updateToInventory);
|
batchUtil.updateBatchInventory(updateToInventory);
|
||||||
}
|
}
|
||||||
if (CollectionUtils.isNotEmpty(updateToPickDetail)) {
|
if (CollectionUtils.isNotEmpty(updateToPickDetail)) {
|
||||||
|
updateToPickDetail.sort(Comparator.comparing(PickDetail::getId));
|
||||||
batchUtil.updateBatchPickDetail(updateToPickDetail);
|
batchUtil.updateBatchPickDetail(updateToPickDetail);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -167,6 +170,7 @@ public class BatchProcessor {
|
||||||
inventoryMapper.deleteByIds(deleteToInventoryIds);
|
inventoryMapper.deleteByIds(deleteToInventoryIds);
|
||||||
}
|
}
|
||||||
if (CollectionUtils.isNotEmpty(updateToPickDetail)) {
|
if (CollectionUtils.isNotEmpty(updateToPickDetail)) {
|
||||||
|
updateToPickDetail.sort(Comparator.comparing(PickDetail::getId));
|
||||||
batchUtil.updateBatchPickDetail(updateToPickDetail);
|
batchUtil.updateBatchPickDetail(updateToPickDetail);
|
||||||
}
|
}
|
||||||
if (CollectionUtils.isNotEmpty(updateToTask)) {
|
if (CollectionUtils.isNotEmpty(updateToTask)) {
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ public interface InventoryMapper extends BaseMapper<Inventory> {
|
||||||
*
|
*
|
||||||
* @return Long
|
* @return Long
|
||||||
*/
|
*/
|
||||||
@Select("select count(stock_id) from data_inventory")
|
@Select("select count(DISTINCT stock_id) from data_inventory ")
|
||||||
Long queryStockCount();
|
Long queryStockCount();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -125,4 +125,11 @@ public interface InventoryMapper extends BaseMapper<Inventory> {
|
||||||
* @return List<OutAndInData>
|
* @return List<OutAndInData>
|
||||||
*/
|
*/
|
||||||
List<OutAndInData> queryOutAndInData();
|
List<OutAndInData> queryOutAndInData();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询库内托盘-点位
|
||||||
|
*
|
||||||
|
* @return List<String>
|
||||||
|
*/
|
||||||
|
List<String> queryStockPoint();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -139,4 +139,12 @@
|
||||||
</where>
|
</where>
|
||||||
order by s.stock_code
|
order by s.stock_code
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="queryStockPoint" resultType="java.lang.String">
|
||||||
|
select CONCAT(s.stock_code,"-",p.point_code) from data_inventory inv
|
||||||
|
join base_point p on p.id=inv.point_id
|
||||||
|
join base_stock s on s.id=inv.stock_id
|
||||||
|
GROUP BY s.stock_code
|
||||||
|
order by s.stock_code
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -49,7 +49,7 @@
|
||||||
<groupId>jakarta.servlet</groupId>
|
<groupId>jakarta.servlet</groupId>
|
||||||
<artifactId>jakarta.servlet-api</artifactId>
|
<artifactId>jakarta.servlet-api</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 分库分表示例 -->
|
<!-- 分库分表示例 -->
|
||||||
<!-- <dependency>
|
<!-- <dependency>
|
||||||
<groupId>org.jeecgframework.boot3</groupId>
|
<groupId>org.jeecgframework.boot3</groupId>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,83 @@
|
||||||
|
package org.jeecg.modules.system.test;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.cpte.modules.inventory.mapper.InventoryMapper;
|
||||||
|
import org.jeecg.CpteSystemApplication;
|
||||||
|
import org.jeecg.common.util.RestUtil;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
|
||||||
|
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = CpteSystemApplication.class)
|
||||||
|
public class TesStockTest {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private InventoryMapper inventoryMapper;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSelect() {
|
||||||
|
List<String> list = inventoryMapper.queryStockPoint();
|
||||||
|
List<String> stocks = getStockInfo();
|
||||||
|
|
||||||
|
Set<String> set1 = new HashSet<>(list);
|
||||||
|
Set<String> set2 = null;
|
||||||
|
if (stocks != null) {
|
||||||
|
set2 = new HashSet<>(stocks);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取对称差集(所有不同的元素)
|
||||||
|
Set<String> allDifferent = new HashSet<>(set1);
|
||||||
|
if (set2 != null) {
|
||||||
|
allDifferent.addAll(set2); // 先合并
|
||||||
|
}
|
||||||
|
|
||||||
|
Set<String> intersection = new HashSet<>(set1);
|
||||||
|
if (set2 != null) {
|
||||||
|
intersection.retainAll(set2); // 获取交集
|
||||||
|
}
|
||||||
|
|
||||||
|
allDifferent.removeAll(intersection); // 移除交集,得到对称差集
|
||||||
|
|
||||||
|
System.out.println("有差异的容器: " + allDifferent);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> getStockInfo() {
|
||||||
|
|
||||||
|
JSONObject params = new JSONObject();
|
||||||
|
params.put("warehouseID", "HETU");
|
||||||
|
params.put("clientCode", "WMS");
|
||||||
|
params.put("regionCode", 3);
|
||||||
|
params.put("pageNum", 1);
|
||||||
|
params.put("pageSize", 10000);
|
||||||
|
|
||||||
|
String url = "http://10.254.27.191/tes/apiv2/getPodList";
|
||||||
|
JSONObject stockInfo = RestUtil.post(url, params);
|
||||||
|
//JSONObject stockInfo = stockInfo();
|
||||||
|
JSONObject data = stockInfo.getJSONObject("data");
|
||||||
|
if (data == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
JSONArray podList = data.getJSONArray("podList");
|
||||||
|
List<String> stocks = new ArrayList<>();
|
||||||
|
for (int i = 0; i < podList.size(); i++) {
|
||||||
|
JSONObject podObject = podList.getJSONObject(i);
|
||||||
|
String podID = podObject.getString("podID");
|
||||||
|
String storageID = podObject.getString("storageID");
|
||||||
|
if (StringUtils.isNotBlank(storageID)) {
|
||||||
|
/* if ("P002000".equals(podID)) {
|
||||||
|
continue;
|
||||||
|
}*/
|
||||||
|
stocks.add(podID + "-" + storageID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return stocks;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue