add:分切下料送轴问题处理

This commit is contained in:
ls
2025-03-23 16:14:15 +08:00
parent e38fcb7b88
commit a4e78afa1a

View File

@@ -31,9 +31,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
@@ -64,6 +62,10 @@ public class SlitterDownAGVTask extends AbstractTask {
@Autowired @Autowired
private WmsToAcsService wmsToAcsService; private WmsToAcsService wmsToAcsService;
@Autowired
private IstIvtCutpointivtService cutpointivtService;
@Override @Override
public void create() throws BadRequestException { public void create() throws BadRequestException {
@@ -106,11 +108,15 @@ public class SlitterDownAGVTask extends AbstractTask {
BstIvtCutpointivt endPoint = null; BstIvtCutpointivt endPoint = null;
JSONArray acsArray = new JSONArray(); JSONArray acsArray = new JSONArray();
JSONObject acs = new JSONObject(); JSONObject acs = new JSONObject();
acs.put("device_code", requestObj.getString("device_code")); String deviceCode = requestObj.getString("device_code");
acs.put("device_code", deviceCode);
acs.put("product_area", URLEnum.ACS_URL_A1.getProduct_area()); acs.put("product_area", URLEnum.ACS_URL_A1.getProduct_area());
acsArray.add(acs); acsArray.add(acs);
StIvtCutpointivt cutPoint = cutpointivtService.getOneByCode(deviceCode);
//校验acs与lms气涨轴类型 //校验acs与lms气涨轴类型
endPoint = checkType(acsArray, areaEmptyNotTaskPoint, endPoint); endPoint = checkType(acsArray, areaEmptyNotTaskPoint, endPoint, cutPoint);
// endPoint = areaEmptyNotTaskPoint.get(0); // endPoint = areaEmptyNotTaskPoint.get(0);
task.setPoint_code2(endPoint.getPoint_code()); task.setPoint_code2(endPoint.getPoint_code());
// 设置气胀轴 // 设置气胀轴
@@ -131,28 +137,34 @@ public class SlitterDownAGVTask extends AbstractTask {
}); });
} }
private BstIvtCutpointivt checkType(JSONArray acsArray, List<BstIvtCutpointivt> areaEmptyNotTaskPoint, BstIvtCutpointivt endPoint) { private BstIvtCutpointivt checkType(JSONArray acsArray, List<BstIvtCutpointivt> areaEmptyNotTaskPoint, BstIvtCutpointivt endPoint, StIvtCutpointivt stIvtCutpointivt) {
log.info("分切下料,获取缓存架类型 - {}", acsArray); log.info("分切下料,获取缓存架类型 - {}", acsArray);
JSONObject jsonObject = wmsToAcsService.getCutpointivtType(acsArray); JSONObject jsonObject = wmsToAcsService.getCutpointivtType(acsArray);
log.info("分切下料,获取缓存架类型返回 - {}", jsonObject); log.info("分切下料,获取缓存架类型返回 - {}", jsonObject);
JSONObject message = (JSONObject)jsonObject.get("message"); JSONObject message = (JSONObject) jsonObject.get("message");
if (message == null){ if (message == null) {
throw new BadRequestException("获取缓存架类型失败!"); throw new BadRequestException("获取缓存架类型失败!");
} }
for (BstIvtCutpointivt bstIvtCutpointivt : areaEmptyNotTaskPoint) {
if (message.containsKey(bstIvtCutpointivt.getPoint_code())){
if ( bstIvtCutpointivt.getPlan().equals(message.get(bstIvtCutpointivt.getPoint_code()))) {
endPoint = bstIvtCutpointivt; for (BstIvtCutpointivt bstIvtCutpointivt : areaEmptyNotTaskPoint) {
if (endPoint.getPlan().equals("1")){ if (message.containsKey(bstIvtCutpointivt.getPoint_code())) {
endPoint.setPoint_code(endPoint.getPoint_code()+"_C"); //起点和终点轴类型不相等,或者终点轴类型与实际光电不相等都不满足条件
} if (!bstIvtCutpointivt.getPlan().equals(message.get(bstIvtCutpointivt.getPoint_code()))){
if (endPoint.getPlan().equals("2")){ throw new BadRequestException("请求搬运失败,缓存架气涨轴类型与实际光电检测类型不匹配!");
endPoint.setPoint_code(endPoint.getPoint_code()+"_D");
}
} else {
throw new BadRequestException("请求搬运失败,缓存架气涨轴类型与分切机不匹配!");
} }
if (!stIvtCutpointivt.getPlan().equals(bstIvtCutpointivt.getPlan())) {
break;
}
endPoint = bstIvtCutpointivt;
if (endPoint.getPlan().equals("1")) {
endPoint.setPoint_code(endPoint.getPoint_code() + "_C");
}
if (endPoint.getPlan().equals("2")) {
endPoint.setPoint_code(endPoint.getPoint_code() + "_D");
}
} else { } else {
endPoint = bstIvtCutpointivt; endPoint = bstIvtCutpointivt;
} }
@@ -174,8 +186,8 @@ public class SlitterDownAGVTask extends AbstractTask {
// 终点设置数据 // 终点设置数据
String endPointCode = taskObj.getPoint_code2(); String endPointCode = taskObj.getPoint_code2();
//长短轴需要截取 //长短轴需要截取
if (endPointCode.contains("_C") || endPointCode.contains("_D")){ if (endPointCode.contains("_C") || endPointCode.contains("_D")) {
endPointCode = endPointCode.substring(0,9); endPointCode = endPointCode.substring(0, 9);
} }
BstIvtCutpointivt endPoint = bstIvtCutpointivtService.getPintByAgvCode(endPointCode, false); BstIvtCutpointivt endPoint = bstIvtCutpointivtService.getPintByAgvCode(endPointCode, false);
endPoint.setQzz_no1(taskObj.getVehicle_code()); endPoint.setQzz_no1(taskObj.getVehicle_code());