no message
parent
4cd7e36c60
commit
9a9ba6ba7f
|
|
@ -18,6 +18,8 @@ import org.jeecg.config.shiro.IgnoreAuth;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Tag(name = "TES")
|
||||
@RestController
|
||||
@RequestMapping("/tes")
|
||||
|
|
@ -98,5 +100,20 @@ public class TesAgvController {
|
|||
}
|
||||
}
|
||||
|
||||
@Operation(summary = "TES-容器差异信息")
|
||||
@PostMapping(value = "/containerDifference")
|
||||
@IgnoreAuth
|
||||
public TesResult containerDifference() {
|
||||
try {
|
||||
String list = iTesAgvService.containerDifference();
|
||||
TesResult tesResult = new TesResult();
|
||||
tesResult.setReturnCode(0);
|
||||
tesResult.setReturnMsg(list);
|
||||
return tesResult;
|
||||
} catch (Exception e) {
|
||||
return TesResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ import org.cpte.modules.tesAgv.request.CancelTaskRequest;
|
|||
import org.cpte.modules.tesAgv.request.ContainerUpRequest;
|
||||
import org.cpte.modules.tesAgv.request.TesCallbackRequest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ITesAgvService {
|
||||
/**
|
||||
* 生成任务下发JSON
|
||||
|
|
@ -49,4 +51,10 @@ public interface ITesAgvService {
|
|||
* @param containerUpRequest 顶升参数
|
||||
*/
|
||||
void containerUp(ContainerUpRequest containerUpRequest);
|
||||
|
||||
/**
|
||||
* Tes容器与立库容器的差异
|
||||
*
|
||||
*/
|
||||
String containerDifference();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package org.cpte.modules.tesAgv.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
|
|
@ -15,6 +16,7 @@ import org.cpte.modules.constant.enums.AgvStatusEnum;
|
|||
import org.cpte.modules.constant.enums.AgvVendorEnum;
|
||||
import org.cpte.modules.constant.enums.BusinessTypeEnum;
|
||||
import org.cpte.modules.constant.enums.CommonStatusEnum;
|
||||
import org.cpte.modules.inventory.mapper.InventoryMapper;
|
||||
import org.cpte.modules.inventory.service.IInventoryService;
|
||||
import org.cpte.modules.receive.entity.AsnDetail;
|
||||
import org.cpte.modules.receive.mapper.AsnDetailMapper;
|
||||
|
|
@ -28,6 +30,7 @@ import org.cpte.modules.tesAgv.request.NewMovePodTaskRequest;
|
|||
import org.cpte.modules.tesAgv.request.TesCallbackRequest;
|
||||
import org.cpte.modules.tesAgv.service.ITesAgvService;
|
||||
import org.cpte.modules.utils.HttpPostUtil;
|
||||
import org.jeecg.common.util.RestUtil;
|
||||
import org.jeecg.common.util.UUIDGenerator;
|
||||
import org.jeecg.modules.openapi.mapper.OpenApiMapper;
|
||||
import org.jeecg.modules.system.mapper.SysDictMapper;
|
||||
|
|
@ -56,6 +59,9 @@ public class ITesAgvServiceImpl implements ITesAgvService {
|
|||
@Autowired
|
||||
private AgvTaskMapper agvTaskMapper;
|
||||
|
||||
@Autowired
|
||||
private InventoryMapper inventoryMapper;
|
||||
|
||||
@Autowired
|
||||
private OpenApiMapper openApiMapper;
|
||||
|
||||
|
|
@ -247,6 +253,76 @@ public class ITesAgvServiceImpl implements ITesAgvService {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String containerDifference() {
|
||||
|
||||
List<String> list = inventoryMapper.queryStockPoint();
|
||||
List<String> stocks = getTesStockInfo();
|
||||
|
||||
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); // 移除交集,得到对称差集
|
||||
//根据,换行打印
|
||||
String result = allDifferent.isEmpty() ? "" : String.join("|", allDifferent);
|
||||
result= "有差异的容器(" + allDifferent.size() + "个" + "):"+ result;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取Tes容器信息
|
||||
*/
|
||||
private List<String> getTesStockInfo() {
|
||||
|
||||
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");
|
||||
//1.4230、1.14560、1.14554
|
||||
if ("P002000".equals(podID)) {
|
||||
continue;
|
||||
}
|
||||
if ("1.14554".equals(storageID)||"1.14560".equals(storageID)||"1.4230".equals(storageID)) {
|
||||
continue;
|
||||
}
|
||||
if (StringUtils.isNotBlank(storageID)) {
|
||||
stocks.add(podID + "-" + storageID);
|
||||
}
|
||||
}
|
||||
return stocks;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 任务完成
|
||||
|
|
|
|||
|
|
@ -76,6 +76,9 @@ public class TesStockTest {
|
|||
if ("P002000".equals(podID)) {
|
||||
continue;
|
||||
}
|
||||
if ("1.14554".equals(storageID)||"1.14560".equals(storageID)||"1.4230".equals(storageID)) {
|
||||
continue;
|
||||
}
|
||||
if (StringUtils.isNotBlank(storageID)) {
|
||||
stocks.add(podID + "-" + storageID);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue