|
@@ -26,8 +26,12 @@ import org.jeecg.modules.billetHotsendConfig.entity.BilletHotsendTypeConfig;
|
|
|
import org.jeecg.modules.billetHotsendConfig.service.IBilletHotsendTypeConfigService;
|
|
|
import org.jeecg.modules.billetLiftingBill.entity.BilletLiftingBill;
|
|
|
import org.jeecg.modules.billetLiftingBill.service.IBilletLiftingBillService;
|
|
|
+import org.jeecg.modules.connConfig.configMqtt.mapper.ConfigMqttMapper;
|
|
|
import org.jeecg.modules.operateLog.entity.OperateLog;
|
|
|
import org.jeecg.modules.operateLog.service.IOperateLogService;
|
|
|
+import org.jeecg.modules.push.utils.MqttClientCallback;
|
|
|
+import org.jeecg.modules.push.utils.MqttClientUtil;
|
|
|
+import org.jeecg.modules.push.utils.TopicType;
|
|
|
import org.jeecg.modules.rollClubThree.entity.RollClubThree;
|
|
|
import org.jeecg.modules.rollClubThree.entity.RollClubThreeDetails;
|
|
|
import org.jeecg.modules.rollClubThree.service.IRollClubThreeDetailsService;
|
|
@@ -62,10 +66,13 @@ import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Propagation;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|
|
|
|
|
import java.util.*;
|
|
|
+import java.util.concurrent.CompletableFuture;
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
import java.util.concurrent.atomic.AtomicLong;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -123,6 +130,9 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
private IBilletLiftingBillService billetLiftingBillService;
|
|
|
@Autowired
|
|
|
private IOperateLogService operateLogService;
|
|
|
+ @Autowired
|
|
|
+ private ConfigMqttMapper configMqttMapper;
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@@ -170,7 +180,6 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
}
|
|
|
log.info("C端起跺吊运单信息:" + JSON.toJSON(billetLiftingBillList));
|
|
|
saveBatchBilletLiftingBills(billetLiftingBillList);
|
|
|
-
|
|
|
// 根据billetHotsendTypeConfigId 查询基础垛位信息
|
|
|
BilletHotsendTypeConfig billetHotsendTypeConfig = billetHotsendTypeConfigService.getById(billetHotsendTypeConfigId);
|
|
|
loadingParams.setBelongTable(billetHotsendTypeConfig.getBelongTable());
|
|
@@ -187,90 +196,6 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
stackingAndLoadingVehicles.setAddress(billetNoItem.getString("address"));
|
|
|
return stackingAndLoadingVehicles;
|
|
|
}).collect(Collectors.toList());
|
|
|
-
|
|
|
-//
|
|
|
-// LambdaQueryWrapper<StackingAndLoadingVehicles> queryWrapper3 = new LambdaQueryWrapper<>();
|
|
|
-// queryWrapper3.eq(StackingAndLoadingVehicles::getCcmNo, ccmNo)
|
|
|
-// .eq(StackingAndLoadingVehicles::getTypeConfigId, billetHotsendTypeConfigId);
|
|
|
-// List<StackingAndLoadingVehicles> stackingAndLoadingVehiclesListInfo = stackingAndLoadingVehiclesMapper.selectList(queryWrapper3);
|
|
|
-// // 检查 layer=20, address=9 的数据是否已被占用
|
|
|
-// boolean isTopRightOccupied = stackingAndLoadingVehiclesListInfo.stream()
|
|
|
-// .anyMatch(vehicle -> Integer.parseInt(vehicle.getLayer()) == 20
|
|
|
-// && Integer.parseInt(vehicle.getAddress()) == 9
|
|
|
-// && vehicle.getBilletNos() != null
|
|
|
-// && !vehicle.getBilletNos().isEmpty());
|
|
|
-//
|
|
|
-// if (isTopRightOccupied) {
|
|
|
-// log.info("{}{}", "该垛位容器位置已占满,自动化新增堆垛失败!", jsonObject.toJSONString());
|
|
|
-// return;
|
|
|
-// }
|
|
|
-//
|
|
|
-// // 过滤出 billet_nos 不为空的记录,并按优先级排序(layer 降序,address 降序)
|
|
|
-// List<StackingAndLoadingVehicles> nonEmptyBillets = stackingAndLoadingVehiclesListInfo.stream()
|
|
|
-// .filter(vehicle -> vehicle.getBilletNos() != null && !vehicle.getBilletNos().isEmpty())
|
|
|
-// .sorted(Comparator.comparing((StackingAndLoadingVehicles v) -> Integer.parseInt(v.getLayer())).reversed()
|
|
|
-// .thenComparing(v -> Integer.parseInt(v.getAddress()), Comparator.reverseOrder()))
|
|
|
-// .collect(Collectors.toList());
|
|
|
-//
|
|
|
-// // 获取所有 billet_nos 为空的记录,并按优先级排序(layer 升序,address 升序)
|
|
|
-// List<StackingAndLoadingVehicles> emptySlots = stackingAndLoadingVehiclesListInfo.stream()
|
|
|
-// .filter(vehicle -> vehicle.getBilletNos() == null || vehicle.getBilletNos().isEmpty())
|
|
|
-// .sorted(Comparator.comparing((StackingAndLoadingVehicles v) -> Integer.parseInt(v.getLayer())) // Layer 升序
|
|
|
-// .thenComparing(v -> Integer.parseInt(v.getAddress()))) // Address 也升序
|
|
|
-// .collect(Collectors.toList());
|
|
|
-//
|
|
|
-//
|
|
|
-// if (oConvertUtils.listIsEmpty(emptySlots)){
|
|
|
-// // 如果该垛位所有为空的记录为空,则返回
|
|
|
-// log.info("{}{}", "该垛位容器位置已占满,自动化新增堆垛失败!", jsonObject.toJSONString());
|
|
|
-// return;
|
|
|
-// }
|
|
|
-//
|
|
|
-// // 确定填充起点
|
|
|
-// int startIndex;
|
|
|
-// if (!nonEmptyBillets.isEmpty()) {
|
|
|
-// // 已有数据,从最高优先级位置开始
|
|
|
-// StackingAndLoadingVehicles highestPriorityVehicle = nonEmptyBillets.get(0);
|
|
|
-// int startLayer = Integer.parseInt(highestPriorityVehicle.getLayer());
|
|
|
-// int startAddress = Integer.parseInt(highestPriorityVehicle.getAddress());
|
|
|
-//
|
|
|
-// // 处理 address 进位
|
|
|
-// if (startAddress == 9) {
|
|
|
-// startLayer += 1;
|
|
|
-// startAddress = 1;
|
|
|
-// } else {
|
|
|
-// startAddress += 1;
|
|
|
-// }
|
|
|
-//
|
|
|
-// // 找到第一个符合 startLayer & startAddress 以上的空位
|
|
|
-// int finalStartLayer = startLayer;
|
|
|
-// int finalStartAddress = startAddress;
|
|
|
-// Optional<StackingAndLoadingVehicles> startingPoint = emptySlots.stream()
|
|
|
-// .filter(vehicle -> Integer.parseInt(vehicle.getLayer()) == finalStartLayer && Integer.parseInt(vehicle.getAddress()) == finalStartAddress)
|
|
|
-// .findFirst();
|
|
|
-//
|
|
|
-// startIndex = emptySlots.indexOf(startingPoint.orElse(null));
|
|
|
-// } else {
|
|
|
-// // 没有已有数据,从 layer=1, address=1 开始填充
|
|
|
-// startIndex = 0;
|
|
|
-// }
|
|
|
-//
|
|
|
-// if (startIndex == -1) {
|
|
|
-// log.info("未找到合适的填充起点");
|
|
|
-// return;
|
|
|
-// }
|
|
|
-//
|
|
|
-// List<StackingAndLoadingVehicles> newList = new ArrayList<>();
|
|
|
-// // 按顺序填充数据
|
|
|
-// for (int i = 0; i < stackingAndLoadingVehiclesLists.size() && startIndex + i < emptySlots.size(); i++) {
|
|
|
-// emptySlots.get(startIndex + i).setBilletNos(stackingAndLoadingVehiclesLists.get(i).getBilletNos());
|
|
|
-// emptySlots.get(startIndex + i).setCcmNo(stackingAndLoadingVehiclesLists.get(i).getCcmNo());
|
|
|
-// emptySlots.get(startIndex + i).setTypeConfigId(stackingAndLoadingVehiclesLists.get(i).getTypeConfigId());
|
|
|
-// emptySlots.get(startIndex + i).setStackAddr(stackingAndLoadingVehiclesLists.get(i).getStackAddr());
|
|
|
-// emptySlots.get(startIndex + i).setCreateTime(stackingAndLoadingVehiclesLists.get(i).getCreateTime());
|
|
|
-// newList.add(emptySlots.get(startIndex + i));
|
|
|
-// }
|
|
|
-//
|
|
|
loadingParams.setStackingAndLoadingVehiclesList(stackingAndLoadingVehiclesLists);
|
|
|
|
|
|
List<StackingAndLoadingVehicles> stackingAndLoadingVehiclesList = loadingParams.getStackingAndLoadingVehiclesList();
|
|
@@ -287,6 +212,21 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
.isNull(BilletBasicInfo::getBelongTable)
|
|
|
.isNull(BilletBasicInfo::getBhtcId);
|
|
|
List<BilletBasicInfo> billetBasicInfoLists = billetBasicInfoService.list(queryWrapperBB);
|
|
|
+ if (oConvertUtils.listIsEmpty(billetBasicInfoLists)){
|
|
|
+ // 循环三次处理
|
|
|
+ for (int i = 0; i < 6; i++) {
|
|
|
+ // 延迟10秒
|
|
|
+ try {
|
|
|
+ Thread.sleep(10000);
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ billetBasicInfoLists = billetBasicInfoService.list(queryWrapperBB);
|
|
|
+ if (!oConvertUtils.listIsEmpty(billetBasicInfoLists)){
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
if (oConvertUtils.listIsEmpty(billetBasicInfoLists)){
|
|
|
log.info("{}{}", "钢坯基础信息为空,C端自动化新增堆垛失败!", jsonObject);
|
|
|
BilletAutoException billetAutoException = createBilletAutoException(ccmNo, allBilletNos, shiftGroupHandle(ccmNo), shiftHandle(ccmNo), billetHotsendTypeConfig.getTypeName(), null, null, null, null);
|
|
@@ -424,7 +364,7 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
.eq(StackingAndLoadingVehicles::getTypeConfigId, billetHotsendTypeConfig.getId())
|
|
|
.isNotNull(StackingAndLoadingVehicles::getBilletNos));
|
|
|
if (oConvertUtils.isEmpty(stackingAndLoadingVehiclesInfo)){
|
|
|
- log.info("{}{}", "查询垛位公共容器信息为空,C端自动化垛位装车保存失败:", jsonObject);
|
|
|
+ log.info("{}{}", "该垛位位置上钢坯基础信息为空,C端自动化垛位装车保存失败:", jsonObject);
|
|
|
return;
|
|
|
}
|
|
|
stackingAndLoadingVehiclesLists.add(stackingAndLoadingVehiclesInfo);
|
|
@@ -477,13 +417,12 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
}
|
|
|
loadingParams.setStorageBill(isStorageBill);
|
|
|
|
|
|
- log.info("{}{}", "自动化堆垛装车保存钢坯装运单数据:", JSON.toJSON(isStorageBill));
|
|
|
+ log.info("{}{}", "自动化堆垛装车保存StorageBill数据:", JSON.toJSON(isStorageBill));
|
|
|
|
|
|
StorageBill storageBill = loadingParams.getStorageBill();
|
|
|
|
|
|
// 轧钢外运保存时,先判断装运单中的目的地ID是否为1024,如果为1024、明细暂存临时表billet_auto_tmp
|
|
|
if ("1024".equals(isStorageBill.getTypeConfigId())){
|
|
|
- log.info("{}{}", "C端自动化堆垛外运未知目的地坯号集合:", allBilletNos);
|
|
|
loadingParams.setBelongTable("billet_auto_tmp");
|
|
|
loadingParams.setBilletHotsendTypeConfigId("1024");
|
|
|
loadingParams.setDestinationTable("billet_auto_tmp");
|
|
@@ -502,7 +441,6 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
loadingParams.setBelongTable(billetHotsendTypeConfigInfo.getBelongTable());
|
|
|
loadingParams.setBilletHotsendTypeConfigId(billetHotsendTypeConfigInfo.getId());
|
|
|
}
|
|
|
- log.info("{}{}", "自动化堆垛装车保存公共容器数据:", JSON.toJSON(loadingParams.getStackingAndLoadingVehiclesList()));
|
|
|
|
|
|
log.info("{}{}", "自动化堆垛装车保存热送单数据:", JSON.toJSON(billetHotsend));
|
|
|
|
|
@@ -561,7 +499,7 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
billetBasicInfoService.saveOrUpdateBatch(billetBasicInfoList);
|
|
|
|
|
|
if ("billet_auto_tmp".equals(loadingParams.getBelongTable())){
|
|
|
- log.info("{}{}", "C端自动化堆垛保存去未知目的地装运单信息:", JSON.toJSON(storageBill));
|
|
|
+ log.info("{}{}", "C端自动化堆垛保存临时表成功,坯号集合:", allBilletNos);
|
|
|
return;
|
|
|
}
|
|
|
// 取最新的第一条钢坯信息
|
|
@@ -571,16 +509,43 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
storageBill.setAmountTotal((oConvertUtils.isNotEmpty(storageBill.getAmountTotal()) ? storageBill.getAmountTotal() : 0) + loadingParams.getStackingAndLoadingVehiclesList().size() * 4);
|
|
|
storageBill.setDestination(loadingParams.getDestination());
|
|
|
storageBill.setTypeConfigId(loadingParams.getDestinationId());
|
|
|
- List<String> stringList = billetBasicInfoList.stream().map(BilletBasicInfo::getAssemblyNumber).filter(assemblyNumber -> oConvertUtils.isNotEmpty(assemblyNumber)).collect(Collectors.toList());
|
|
|
- if(oConvertUtils.listIsNotEmpty(stringList)) {
|
|
|
- String distinctAssemblyNumber = billetBasicInfoList.stream()
|
|
|
- .map(BilletBasicInfo::getAssemblyNumber)
|
|
|
- .filter(assemblyNumber -> oConvertUtils.isNotEmpty(assemblyNumber))
|
|
|
- .distinct().collect(Collectors.joining(","));
|
|
|
+
|
|
|
+ // 下垛时,有目的,定尺维护
|
|
|
+ List<Integer> sizeIntList = billetBasicInfoList.stream().map(BilletBasicInfo::getLength).filter(oConvertUtils::isNotEmpty).collect(Collectors.toList());
|
|
|
+ List<String> sizeStrList = sizeIntList.stream().map(String::valueOf).collect(Collectors.toList());
|
|
|
+ if(oConvertUtils.listIsNotEmpty(sizeStrList)) {
|
|
|
+ String distinctSizeStr = sizeIntList.stream()
|
|
|
+ .distinct()
|
|
|
+ .map(String::valueOf)
|
|
|
+ .collect(Collectors.joining(","));
|
|
|
+ String finalSizeStr = Optional.ofNullable(storageBill.getSize())
|
|
|
+ .filter(oConvertUtils::isNotEmpty)
|
|
|
+ .map(s -> s + "," + distinctSizeStr)
|
|
|
+ .orElse(distinctSizeStr);
|
|
|
+ // 对 finalSizeStr 再次去重
|
|
|
+ String[] sizeArray = finalSizeStr.split(",");
|
|
|
+ Set<String> uniqueSizes = Arrays.stream(sizeArray)
|
|
|
+ .filter(s -> s != null && !s.isEmpty())
|
|
|
+ .collect(Collectors.toCollection(HashSet::new));
|
|
|
+ finalSizeStr = String.join(",", uniqueSizes);
|
|
|
+ storageBill.setSize(finalSizeStr);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 下垛时,有目的,组批号维护
|
|
|
+ List<String> assemblyNumberList = billetBasicInfoList.stream().map(BilletBasicInfo::getAssemblyNumber).filter(assemblyNumber -> oConvertUtils.isNotEmpty(assemblyNumber)).collect(Collectors.toList());
|
|
|
+ if(oConvertUtils.listIsNotEmpty(assemblyNumberList)) {
|
|
|
+ String distinctAssemblyNumber = assemblyNumberList.stream().distinct().collect(Collectors.joining(","));
|
|
|
String finalAssemblyNumber = Optional.ofNullable(storageBill.getAssemblyNumber())
|
|
|
.filter(oConvertUtils::isNotEmpty)
|
|
|
.map(s -> s + "," + distinctAssemblyNumber)
|
|
|
.orElse(distinctAssemblyNumber);
|
|
|
+
|
|
|
+ // 对 finalAssemblyNumber 再次去重
|
|
|
+ String[] assemblyNumberArray = finalAssemblyNumber.split(",");
|
|
|
+ Set<String> uniqueAssemblyNumbers = Arrays.stream(assemblyNumberArray)
|
|
|
+ .filter(s -> s != null && !s.isEmpty())
|
|
|
+ .collect(Collectors.toCollection(HashSet::new));
|
|
|
+ finalAssemblyNumber = String.join(",", uniqueAssemblyNumbers);
|
|
|
storageBill.setAssemblyNumber(finalAssemblyNumber);
|
|
|
}
|
|
|
storageBillService.updateById(storageBill);
|
|
@@ -594,228 +559,106 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
log.info("{}{}", "C端自动化堆垛装车保存操作成功!", allBilletNos);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 自动化堆垛装车发车
|
|
|
- * @param jsonObject
|
|
|
- */
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public void autoDepartStackLoading(JSONObject jsonObject) {
|
|
|
-
|
|
|
- String ccmNo = jsonObject.getString("ccmNo");
|
|
|
+ public void stackingClearLocation(JSONObject jsonObject) {
|
|
|
+ String ccmNo = jsonObject.getString("ccmNo");// 铸机号
|
|
|
String billetHotsendTypeConfigId = jsonObject.getString("billetHotsendTypeConfigId");
|
|
|
- String billetNoLists = jsonObject.getString("billetNos");
|
|
|
String layer = jsonObject.getString("layer");
|
|
|
String address = jsonObject.getString("address");
|
|
|
- String licensePlate = jsonObject.getString("licensePlate");
|
|
|
- String destinationId = jsonObject.getString("destinationId");
|
|
|
-
|
|
|
- String classShiftGroup = String.format("class:shift:group:%s", ccmNo); // 班组
|
|
|
- String classShift = String.format("class:shift:%s", ccmNo); // 班别
|
|
|
- String classShiftStr = !oConvertUtils.getString(redisTemplate.opsForValue().get(classShift)).isEmpty() ? oConvertUtils.getString(redisTemplate.opsForValue().get(classShift)) : "";
|
|
|
- String classShiftGroupStr = !oConvertUtils.getString(redisTemplate.opsForValue().get(classShiftGroup)).isEmpty() ? oConvertUtils.getString(redisTemplate.opsForValue().get(classShiftGroup)) : "";
|
|
|
-
|
|
|
- LoadingParams loadingParams = new LoadingParams();
|
|
|
-
|
|
|
- loadingParams.setBelongTable("stacking_and_loading_vehicles");
|
|
|
- loadingParams.setBilletHotsendTypeConfigId(billetHotsendTypeConfigId);
|
|
|
-
|
|
|
- BilletHotsend billetHotsend = new BilletHotsend();
|
|
|
- billetHotsend.setCcmNo(ccmNo);
|
|
|
- billetHotsend.setShiftGroup(classShiftGroupStr);
|
|
|
- billetHotsend.setShift(classShiftStr);
|
|
|
- loadingParams.setBilletHotsend(billetHotsend);
|
|
|
-
|
|
|
- // 根据billetHotsendTypeConfigId 查询基础垛位信息
|
|
|
- BilletHotsendTypeConfig billetHotsendTypeConfig = billetHotsendTypeConfigService.getById(loadingParams.getBilletHotsendTypeConfigId());
|
|
|
- // 根据destinationId 查询目的地配置信息
|
|
|
- BilletHotsendTypeConfig destinationInfo = billetHotsendTypeConfigService.getById(destinationId);
|
|
|
- loadingParams.setDestination(destinationInfo.getTypeName());
|
|
|
- loadingParams.setDestinationId(destinationId);
|
|
|
- loadingParams.setDestinationTable(destinationInfo.getBelongTable());
|
|
|
-
|
|
|
- // 通过铸机号、billetHotsendTypeConfigId、层数、位置查询公共容器
|
|
|
- StackingAndLoadingVehicles stackingAndLoadingVehiclesInfo = baseMapper.selectOne(new LambdaQueryWrapper<StackingAndLoadingVehicles>()
|
|
|
- .eq(StackingAndLoadingVehicles::getTypeConfigId, billetHotsendTypeConfigId)
|
|
|
- .eq(StackingAndLoadingVehicles::getCcmNo, ccmNo)
|
|
|
- .eq(StackingAndLoadingVehicles::getLayer, layer)
|
|
|
- .eq(StackingAndLoadingVehicles::getAddress, address));
|
|
|
- if (stackingAndLoadingVehiclesInfo == null){
|
|
|
- log.info("{}{}", "堆垛容器信息查询失败,自动化堆垛装车发车操作失败!", jsonObject);
|
|
|
- BilletAutoException billetAutoException = createBilletAutoException(ccmNo, billetNoLists, classShiftGroupStr, classShiftStr, billetHotsendTypeConfig.getTypeName(), address, layer, destinationInfo.getBelongTable(), destinationId);
|
|
|
- billetAutoException.setMassage("堆垛容器信息查询为空,自动化堆垛<发车>操作失败!");
|
|
|
- billetAutoException.setRemark(licensePlate);
|
|
|
- billetAutoExceptionService.save(billetAutoException);
|
|
|
+ // 判断layer和address为空时直接返回
|
|
|
+ if (oConvertUtils.isEmpty(layer) || oConvertUtils.isEmpty(address)){
|
|
|
+ log.info("{}{}", "layer和address为空,C端自动化堆垛清空位置失败!", jsonObject);
|
|
|
return;
|
|
|
}
|
|
|
- List<StackingAndLoadingVehicles> stackingAndLoadingVehiclesLists = new ArrayList<>();
|
|
|
- StackingAndLoadingVehicles stackingAndLoadingVehicles = new StackingAndLoadingVehicles();
|
|
|
- stackingAndLoadingVehicles.setId(stackingAndLoadingVehiclesInfo.getId());
|
|
|
- stackingAndLoadingVehicles.setCcmNo(ccmNo);
|
|
|
- stackingAndLoadingVehicles.setBilletNos(billetNoLists);
|
|
|
- stackingAndLoadingVehicles.setAddress(address);
|
|
|
- stackingAndLoadingVehicles.setLayer(layer);
|
|
|
- stackingAndLoadingVehicles.setStackAddr(billetHotsendTypeConfig.getTypeName());
|
|
|
- stackingAndLoadingVehicles.setTypeConfigId(billetHotsendTypeConfig.getId());
|
|
|
- stackingAndLoadingVehicles.setCreateDate(new Date());
|
|
|
- stackingAndLoadingVehiclesLists.add(stackingAndLoadingVehicles);
|
|
|
- loadingParams.setStackingAndLoadingVehiclesList(stackingAndLoadingVehiclesLists);
|
|
|
-
|
|
|
- List<StackingAndLoadingVehicles> stackingAndLoadingVehiclesList = loadingParams.getStackingAndLoadingVehiclesList();
|
|
|
-
|
|
|
- log.info("{}{}", "自动化下垛结果集合:", JSON.toJSON(stackingAndLoadingVehiclesList));
|
|
|
- // 获取所有的坯号集合
|
|
|
- List<String> billetNosList = stackingAndLoadingVehiclesList.stream().map(StackingAndLoadingVehicles::getBilletNos)
|
|
|
- .flatMap(billetNos -> {
|
|
|
- if (billetNos!= null) {
|
|
|
- return java.util.stream.Stream.of(billetNos.split(","));
|
|
|
- } else {
|
|
|
- return java.util.stream.Stream.empty();
|
|
|
- }
|
|
|
- }).collect(Collectors.toList());
|
|
|
-
|
|
|
- LambdaQueryWrapper<BilletBasicInfo> queryWrapperBB = new LambdaQueryWrapper<BilletBasicInfo>()
|
|
|
- .eq(BilletBasicInfo::getCcmNo, Integer.valueOf(billetHotsend.getCcmNo()))
|
|
|
- .in(BilletBasicInfo::getBilletNo, billetNosList);
|
|
|
- List<BilletBasicInfo> billetBasicInfoList = billetBasicInfoService.list(queryWrapperBB);
|
|
|
- List<RollClubCommon> rollClubCommonList= new ArrayList<>();
|
|
|
- billetBasicInfoList.forEach(x ->{
|
|
|
- RollClubCommon rollClubCommon = new RollClubCommon();
|
|
|
- BeanUtils.copyProperties(x, rollClubCommon);
|
|
|
- rollClubCommon.setCcmNo(x.getCcmNo().toString());
|
|
|
- rollClubCommon.setStartNum(Integer.valueOf(address));
|
|
|
- rollClubCommon.setStackStorey(layer);
|
|
|
- rollClubCommonList.add(rollClubCommon);
|
|
|
- });
|
|
|
-
|
|
|
- LambdaQueryWrapper<StorageBill> queryWrapper2 = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper2.eq(StorageBill::getCcmNo, ccmNo)
|
|
|
- .eq(StorageBill::getLicensePlate, licensePlate)
|
|
|
- .eq(StorageBill::getShiftGroup, classShiftGroupStr)
|
|
|
- .eq(StorageBill::getShift, classShiftStr)
|
|
|
- .isNull(StorageBill::getOutTime);
|
|
|
- StorageBill isStorageBill = storageBillService.getOne(queryWrapper2);
|
|
|
- if (oConvertUtils.isNotEmpty(isStorageBill)) {
|
|
|
- log.info("未查询到未发车车辆,车牌号为:{},自动化堆垛发车失败:", licensePlate);
|
|
|
+ // 根据以上信息查询堆垛容器信息
|
|
|
+ LambdaQueryWrapper<StackingAndLoadingVehicles> queryWrapper = new LambdaQueryWrapper();
|
|
|
+ queryWrapper.eq(StackingAndLoadingVehicles::getCcmNo, ccmNo)
|
|
|
+ .eq(StackingAndLoadingVehicles::getLayer, layer)
|
|
|
+ .eq(StackingAndLoadingVehicles::getAddress, address)
|
|
|
+ .eq(StackingAndLoadingVehicles::getTypeConfigId, billetHotsendTypeConfigId);
|
|
|
+ List<StackingAndLoadingVehicles> stackingAndLoadingVehiclesList = baseMapper.selectList(queryWrapper);
|
|
|
+ if (oConvertUtils.listIsEmpty(stackingAndLoadingVehiclesList)){
|
|
|
+ log.info("{}{}", "C端自动化堆垛清空位置失败!", jsonObject);
|
|
|
return;
|
|
|
}
|
|
|
- loadingParams.setStorageBill(isStorageBill);
|
|
|
+ // 释放容器位置
|
|
|
+ batchUpdateStackingAndLoadingVehicles(stackingAndLoadingVehiclesList);
|
|
|
|
|
|
- StorageBill storageBill = loadingParams.getStorageBill();
|
|
|
-
|
|
|
- handleStackDepartCommon(billetHotsend, stackingAndLoadingVehiclesList, loadingParams, billetHotsendTypeConfig, storageBill, rollClubCommonList);
|
|
|
- Map<String, List<RollClubCommon>> rollClubCommonInfoList = groupByShiftAttributes(rollClubCommonList);
|
|
|
- for (Map.Entry<String, List<RollClubCommon>> entry : rollClubCommonInfoList.entrySet()) {
|
|
|
- String[] parts = entry.getKey().split(",");
|
|
|
- billetHotsend.setHeatNo(parts[0]);// 炉号
|
|
|
- billetHotsend.setShiftGroup(parts[1]);// 班组
|
|
|
- billetHotsend.setShift(parts[2]);// 班别
|
|
|
- List<RollClubCommon> groupRollClubCommonList = entry.getValue();
|
|
|
- LambdaQueryWrapper<BilletHotsend> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper.eq(BilletHotsend::getCcmNo, billetHotsend.getCcmNo())
|
|
|
- .eq(BilletHotsend::getHeatNo, billetHotsend.getHeatNo())
|
|
|
- .eq(BilletHotsend::getShift, billetHotsend.getShift())
|
|
|
- .eq(BilletHotsend::getShiftGroup, billetHotsend.getShiftGroup());
|
|
|
- BilletHotsend idExistBh = billetHotsendBaseService.getOne(queryWrapper);
|
|
|
- if (oConvertUtils.isEmpty(idExistBh)){
|
|
|
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
- log.info("{}{}", "钢坯热送单为空,自动化垛位发车失败", storageBill.getLicensePlate());
|
|
|
- return;
|
|
|
- }
|
|
|
- billetHotsend.setId(idExistBh.getId());
|
|
|
- billetHotsend.setStackNum(Math.max(0, idExistBh.getStackNum() - groupRollClubCommonList.size()));
|
|
|
- // 钢坯热送基础信息存在,但是钢坯信息不存在 直接返回
|
|
|
- if ("roll_club_two".equals(loadingParams.getDestinationTable())){
|
|
|
- billetHotsend.setRollclubtwoNum(oConvertUtils.isNotEmpty(idExistBh.getRollclubtwoNum()) ? idExistBh.getRollclubtwoNum() + groupRollClubCommonList.size() : groupRollClubCommonList.size());
|
|
|
- }else if ("roll_club_three".equals(loadingParams.getDestinationTable())){
|
|
|
- billetHotsend.setRollclubthreeNum(oConvertUtils.isNotEmpty(idExistBh.getRollclubthreeNum()) ? idExistBh.getRollclubthreeNum() + groupRollClubCommonList.size() : groupRollClubCommonList.size());
|
|
|
- }else if ("roll_out_shipp".equals(loadingParams.getDestinationTable())){
|
|
|
- billetHotsend.setRolloutshippNum(oConvertUtils.isNotEmpty(idExistBh.getRolloutshippNum()) ? idExistBh.getRolloutshippNum() + groupRollClubCommonList.size() : groupRollClubCommonList.size());
|
|
|
- }
|
|
|
- billetHotsend.setUpdateTime(new Date());
|
|
|
- billetHotsendBaseService.updateById(billetHotsend);
|
|
|
- }
|
|
|
- //5 获取所有的坯号集合 查询并批量更新钢坯基础信息 belongTable
|
|
|
- billetBasicInfoList.forEach(x ->{
|
|
|
- x.setBelongTable(loadingParams.getDestinationTable());
|
|
|
- x.setBhtcId(loadingParams.getDestinationId());
|
|
|
- });
|
|
|
- billetBasicInfoService.saveOrUpdateBatch(billetBasicInfoList);
|
|
|
-
|
|
|
- //根据铸机号、钢坯转运单ID查询定尺信息
|
|
|
- List<String> sizeList = new ArrayList<>();
|
|
|
- List<String> heatNoList = new ArrayList<>();
|
|
|
- long count = 0L;
|
|
|
- if ("roll_club_two".equals(loadingParams.getDestinationTable())){
|
|
|
- LambdaQueryWrapper<RollClubTwoDetails> queryWrapperRC = new LambdaQueryWrapper();
|
|
|
- queryWrapperRC.eq(RollClubTwoDetails::getCcmNo, storageBill.getCcmNo()).eq(RollClubTwoDetails::getStorageBillId, storageBill.getId());
|
|
|
- List<RollClubTwoDetails> rollClubTwoDetailsList = rollClubTwoDetailsService.list(queryWrapperRC);
|
|
|
- sizeList = rollClubTwoDetailsList.stream().map(RollClubTwoDetails::getSize).distinct()
|
|
|
- .collect(Collectors.toList());
|
|
|
- heatNoList = rollClubTwoDetailsList.stream().map(RollClubTwoDetails::getHeatNo).distinct()
|
|
|
- .collect(Collectors.toList());
|
|
|
- if (oConvertUtils.listIsNotEmpty(rollClubTwoDetailsList)){
|
|
|
- count = rollClubTwoDetailsList.stream().count();
|
|
|
- }
|
|
|
+ StackingAndLoadingVehicles stackingAndLoadingVehicles = stackingAndLoadingVehiclesList.stream().findFirst().orElse(null);
|
|
|
+ if (stackingAndLoadingVehicles == null || oConvertUtils.isEmpty(stackingAndLoadingVehicles.getBilletNos())){
|
|
|
+ log.info("{}{}", "该位置坯号集为空,C端自动化堆垛清空位置失败!", jsonObject);
|
|
|
+ return;
|
|
|
}
|
|
|
- if ("roll_club_three".equals(loadingParams.getDestinationTable())){
|
|
|
- LambdaQueryWrapper<RollClubThreeDetails> queryWrapperCT = new LambdaQueryWrapper();
|
|
|
- queryWrapperCT.eq(RollClubThreeDetails::getCcmNo, storageBill.getCcmNo()).eq(RollClubThreeDetails::getStorageBillId, storageBill.getId());
|
|
|
- List<RollClubThreeDetails> rollClubThreeDetailsList = rollClubThreeDetailsService.list(queryWrapperCT);
|
|
|
- sizeList = rollClubThreeDetailsList.stream().map(RollClubThreeDetails::getSize).distinct()
|
|
|
- .collect(Collectors.toList());
|
|
|
- heatNoList = rollClubThreeDetailsList.stream().map(RollClubThreeDetails::getHeatNo).distinct()
|
|
|
- .collect(Collectors.toList());
|
|
|
- if (oConvertUtils.listIsNotEmpty(rollClubThreeDetailsList)){
|
|
|
- count = rollClubThreeDetailsList.stream().count();
|
|
|
- }
|
|
|
+ // 根据逗号隔开的坯号集,查询钢坯基础信息
|
|
|
+ String[] billetNosparts = stackingAndLoadingVehicles.getBilletNos().split(",");
|
|
|
+ LambdaQueryWrapper<BilletBasicInfo> queryWrapper1 = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper1.eq(BilletBasicInfo::getCcmNo, ccmNo);
|
|
|
+ queryWrapper1.in(BilletBasicInfo::getBilletNo, Arrays.asList(billetNosparts));
|
|
|
+ List<BilletBasicInfo> billetBasicInfoList = billetBasicInfoService.list(queryWrapper1);
|
|
|
+ if (oConvertUtils.listIsEmpty(billetBasicInfoList)){
|
|
|
+ log.info("{}{}", "钢坯基础信息为空,C端自动化堆垛清空位置失败!", jsonObject);
|
|
|
+ return;
|
|
|
}
|
|
|
- if ("roll_out_shipp".equals(loadingParams.getDestinationTable())){
|
|
|
- LambdaQueryWrapper<RollOutShippDetails> queryWrapperROS = new LambdaQueryWrapper();
|
|
|
- queryWrapperROS.eq(RollOutShippDetails::getCcmNo, storageBill.getCcmNo()).eq(RollOutShippDetails::getStorageBillId, storageBill.getId());
|
|
|
- List<RollOutShippDetails> rollOutShippDetailsList = rollOutShippDetailsService.list(queryWrapperROS);
|
|
|
- sizeList = rollOutShippDetailsList.stream().map(RollOutShippDetails::getSize).distinct()
|
|
|
- .collect(Collectors.toList());
|
|
|
- heatNoList = rollOutShippDetailsList.stream().map(RollOutShippDetails::getHeatNo).distinct()
|
|
|
- .collect(Collectors.toList());
|
|
|
- if (oConvertUtils.listIsNotEmpty(rollOutShippDetailsList)){
|
|
|
- count = rollOutShippDetailsList.stream().count();
|
|
|
- }
|
|
|
+ // 更新钢坯基础信息 钢坯基础信息所属表、配置ID赋值
|
|
|
+ batchUpdateBilletBasicInfo(billetBasicInfoList);
|
|
|
+
|
|
|
+ BilletBasicInfo billetBasicInfo = billetBasicInfoList.stream().findFirst().orElse(null);
|
|
|
+ // 根据ccmNo、billetBasicInfo中的heatNo、shiftgroup、shift查询热送传递单
|
|
|
+ LambdaQueryWrapper<BilletHotsend> queryWrapper2 = new LambdaQueryWrapper();
|
|
|
+ queryWrapper2.eq(BilletHotsend::getHeatNo, billetBasicInfo.getHeatNo())
|
|
|
+ .eq(BilletHotsend::getShift, billetBasicInfo.getShift())
|
|
|
+ .eq(BilletHotsend::getCcmNo, billetBasicInfo.getCcmNo())
|
|
|
+ .eq(BilletHotsend::getShiftGroup, billetBasicInfo.getShiftGroup());
|
|
|
+ BilletHotsend billetHotsend = billetHotsendBaseService.getOne(queryWrapper2);
|
|
|
+ if (oConvertUtils.isEmpty(billetHotsend)){
|
|
|
+ log.info("{}{}", "钢坯热送传递单为空,C端自动化堆垛清空位置失败", jsonObject);
|
|
|
+ throw new RuntimeException("钢坯热送传递单为空,C端自动化堆垛清空位置事务回滚!");
|
|
|
}
|
|
|
- if ("roll_height".equals(loadingParams.getDestinationTable())){
|
|
|
- log.info("{}{}", "堆垛去高线发车操作成功!", JSON.toJSON(billetNosList));
|
|
|
+ billetHotsend.setStackNum(Math.max(0, billetHotsend.getStackNum() - billetBasicInfoList.size()));
|
|
|
+ billetHotsend.setUpdateTime(new Date());
|
|
|
+ billetHotsendBaseService.updateById(billetHotsend);
|
|
|
+
|
|
|
+ // 发送坯号结果到mqtt,作为独立的事务
|
|
|
+ sendBilletNoToMqtt(ccmNo, billetBasicInfoList);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void stackQueryLocation(JSONObject jsonObject) {
|
|
|
+ String ccmNo = jsonObject.getString("ccmNo");// 铸机号
|
|
|
+ String billetHotsendTypeConfigId = jsonObject.getString("billetHotsendTypeConfigId");// 基础类型堆垛ID
|
|
|
+ String layer = jsonObject.getString("layer");// 层数
|
|
|
+ if (oConvertUtils.isEmpty(layer) || oConvertUtils.isEmpty(billetHotsendTypeConfigId)){
|
|
|
+ log.info("{}{}", "layer和所属堆垛ID为空,C端自动化堆垛层占用获取失败!", jsonObject);
|
|
|
return;
|
|
|
+ }
|
|
|
+ // 根据以上三个参数,坯号不为空,查询堆垛容器信息
|
|
|
+ LambdaQueryWrapper<StackingAndLoadingVehicles> queryWrapper = new LambdaQueryWrapper();
|
|
|
+ queryWrapper.eq(StackingAndLoadingVehicles::getCcmNo, ccmNo)
|
|
|
+ .eq(StackingAndLoadingVehicles::getLayer, layer)
|
|
|
+ .eq(StackingAndLoadingVehicles::getTypeConfigId, billetHotsendTypeConfigId)
|
|
|
+ .isNotNull(StackingAndLoadingVehicles::getBilletNos);
|
|
|
+ List<StackingAndLoadingVehicles> stackingAndLoadingVehiclesList = baseMapper.selectList(queryWrapper);
|
|
|
+ int locationSum = stackingAndLoadingVehiclesList.size();
|
|
|
+ // 发送mqtt消息
|
|
|
+ sendLocationSumToMqtt(ccmNo, layer, billetHotsendTypeConfigId, locationSum);
|
|
|
+ }
|
|
|
|
|
|
+ public void sendLocationSumToMqtt(String ccmNo, String layer, String billetHotsendTypeConfigId, int locationSum) {
|
|
|
+ try {
|
|
|
+ Map<String, Object> mapSendInfo = new HashMap<>();
|
|
|
+ mapSendInfo.put("ccmNo", ccmNo);
|
|
|
+ mapSendInfo.put("layer", layer);
|
|
|
+ mapSendInfo.put("billetHotsendTypeConfigId", billetHotsendTypeConfigId);
|
|
|
+ mapSendInfo.put("locationSum", locationSum);
|
|
|
+ mapSendInfo.put("queryTime", DateUtils.date2Str(new Date(), DateUtils.datetimeFormat.get()));
|
|
|
+ // 执行MQTT推送,设置合理的超时时间
|
|
|
+ MqttClientUtil mqttClientUtilBe = new MqttClientUtil();
|
|
|
+ mqttClientUtilBe.pushCData(configMqttMapper, mapSendInfo, TopicType.SYN_PLACEHOLDER_PASSBACK.getTopicValue());
|
|
|
+ log.info("C端自动化查询堆垛位置被占总数回传,发送MQTT成功: {}", mapSendInfo);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("C端自动化查询堆垛位置被占总数回传,发送MQTT异常!", e);
|
|
|
}
|
|
|
- // 6 更新装运单 storage_bill 取最新的第一条钢坯信息更新钢种和规格
|
|
|
- RollClubCommon rollClubCommon = rollClubCommonList.stream().findFirst().orElse(null);
|
|
|
- storageBill.setSteel(rollClubCommon.getGrade());//钢种
|
|
|
- storageBill.setSpec(rollClubCommon.getSpec());//规格
|
|
|
- storageBill.setSize(String.join(",", sizeList));
|
|
|
- storageBill.setTypeConfigId(loadingParams.getDestinationId()); // 钢坯配置类型ID
|
|
|
- storageBill.setDestination(loadingParams.getDestination());// 目的地
|
|
|
- storageBill.setAmountTotal(storageBill.getAmountTotal() + stackingAndLoadingVehiclesList.size() * 4);
|
|
|
- storageBill.setOutTime(new Date());
|
|
|
- storageBillService.updateById(storageBill);
|
|
|
- // 7 发车后,新增钢坯堆垛储运信息,生成储运单 storage_car_log
|
|
|
- StorageCarLog storageCarLog = new StorageCarLog();
|
|
|
- BeanUtils.copyProperties(storageBill, storageCarLog);
|
|
|
-
|
|
|
- LambdaQueryWrapper<StackingDownLog> queryWrappersd = new LambdaQueryWrapper();
|
|
|
- queryWrappersd.eq(StackingDownLog::getCcmNo, storageBill.getCcmNo()).eq(StackingDownLog::getStorageBillId, storageBill.getId());
|
|
|
- List<StackingDownLog> stackingDownLogs = stackingDownLogService.list(queryWrappersd);
|
|
|
-
|
|
|
- Integer bx =Integer.valueOf((int) count);
|
|
|
- Integer dd = stackingDownLogs.size() * 4 + bx;
|
|
|
- storageCarLog.setDestination(loadingParams.getDestination());// 目的地
|
|
|
- storageCarLog.setCarNm(storageBill.getLicensePlate());// 车牌号
|
|
|
- storageCarLog.setTypeConfigId(billetHotsendTypeConfig.getId()); // 钢坯配置类型ID
|
|
|
- storageCarLog.setHeatNo(String.join(",", heatNoList));
|
|
|
- storageCarLog.setSize(String.join(",", sizeList));// 定尺
|
|
|
- storageCarLog.setAmount(dd);// 支数
|
|
|
- storageCarLog.setDataTime(new Date());
|
|
|
- storageCarLogService.save(storageCarLog);
|
|
|
- log.info("{}{}", "自动化堆垛发车操作成功", billetNoLists);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -864,6 +707,7 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
List<BilletBasicInfo> billetBasicInfoList = billetBasicInfoService.list(queryWrapper);
|
|
|
if (oConvertUtils.listIsEmpty(billetBasicInfoList)){
|
|
|
log.info("{}{}", "自动化堆垛保存失败,钢坯基础信息不存在!", x.getBilletNos());
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
return;
|
|
|
}
|
|
|
List<String> heatNos = billetBasicInfoList.stream().map(BilletBasicInfo::getHeatNo).distinct().collect(Collectors.toList());
|
|
@@ -934,7 +778,6 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
rollClubTwoDetails.setShift(billetBasicInfo.getShift());
|
|
|
|
|
|
rollClubTwoDetails.setLicensePlate(storageBill.getLicensePlate());
|
|
|
- rollClubTwoDetails.setCreateTime(new Date());
|
|
|
rollClubTwoDetails.setId(String.valueOf(IdWorker.getId()));
|
|
|
rollClubTwoDetails.setBlankOutput(billetWeightTotal);//出坯量
|
|
|
rollClubTwoDetails.setSpec(billetBasicInfoList.get(0).getSpec());
|
|
@@ -946,6 +789,8 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
.distinct()
|
|
|
.collect(Collectors.joining(","));
|
|
|
rollClubTwoDetails.setAssemblyNumber(distinctAssemblyNumber);
|
|
|
+ rollClubTwoDetails.setCreateTime(new Date());
|
|
|
+ rollClubTwoDetails.setUpdateTime(new Date());
|
|
|
addRollClubTwoDetailsList.add(rollClubTwoDetails);
|
|
|
}else if ("roll_club_three".equals(loadingParams.getDestinationTable())){
|
|
|
billetBasicInfoList.forEach(y ->{
|
|
@@ -995,6 +840,7 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
rollClubThreeDetails.setStackNum(x.getAddress());
|
|
|
rollClubThreeDetails.setLicensePlate(storageBill.getLicensePlate());
|
|
|
rollClubThreeDetails.setCreateTime(new Date());
|
|
|
+ rollClubThreeDetails.setUpdateTime(new Date());
|
|
|
rollClubThreeDetails.setId(String.valueOf(IdWorker.getId()));
|
|
|
rollClubThreeDetails.setBlankOutput(billetWeightTotal);//出坯量
|
|
|
rollClubThreeDetails.setSpec(billetBasicInfoList.get(0).getSpec());
|
|
@@ -1056,6 +902,7 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
rollOutShippDetails.setLicensePlate(storageBill.getLicensePlate());
|
|
|
rollOutShippDetails.setId(String.valueOf(IdWorker.getId()));
|
|
|
rollOutShippDetails.setCreateTime(new Date());
|
|
|
+ rollOutShippDetails.setUpdateTime(new Date());
|
|
|
rollOutShippDetails.setBlankOutput(billetWeightTotal);//出坯量
|
|
|
rollOutShippDetails.setSpec(billetBasicInfoList.get(0).getSpec());
|
|
|
rollOutShippDetails.setSize(billetBasicInfoList.get(0).getLength().toString());
|
|
@@ -1090,6 +937,7 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
billetAutoTmp.setStorageBillId(storageBill.getId());
|
|
|
billetAutoTmp.setLicensePlate(storageBill.getLicensePlate());
|
|
|
billetAutoTmp.setCreateTime(new Date(System.currentTimeMillis() + timeOffset.get()));
|
|
|
+ billetAutoTmp.setUpdateTime(new Date(System.currentTimeMillis() + timeOffset.get()));
|
|
|
billetAutoTmp.setAssemblyNumber(distinctTmpAssemblyNumber);
|
|
|
// 通过坯号查询钢坯临时表
|
|
|
List<BilletAutoTmp> billetAutoTmpLists = billetAutoTmpService.list(new LambdaQueryWrapper<BilletAutoTmp>()
|
|
@@ -1131,6 +979,21 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
private void handleAddStackInfo(BilletHotsend billetHotsend, List<StackingAndLoadingVehicles> stackingAndLoadingVehiclesList, LoadingParams loadingParams, BilletHotsendTypeConfig billetHotsendTypeConfig){
|
|
|
// 2 发车后,动态更新容器中的垛位信息 初始化
|
|
|
stackingAndLoadingVehiclesList.forEach(x ->{
|
|
|
+
|
|
|
+ LambdaQueryWrapper<StackingAndLoadingVehicles> queryWrapperCheck = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapperCheck.eq(StackingAndLoadingVehicles::getCcmNo, x.getCcmNo())
|
|
|
+ .eq(StackingAndLoadingVehicles::getLayer, x.getLayer())
|
|
|
+ .eq(StackingAndLoadingVehicles::getAddress, x.getAddress())
|
|
|
+ .eq(StackingAndLoadingVehicles::getTypeConfigId, loadingParams.getBilletHotsendTypeConfigId())
|
|
|
+ .isNotNull(StackingAndLoadingVehicles::getBilletNos);
|
|
|
+ // 查询垛位容器信息
|
|
|
+ StackingAndLoadingVehicles stackingAndLoadingVehiclesCheck = stackingAndLoadingVehiclesMapper.selectOne(queryWrapperCheck);
|
|
|
+ if (oConvertUtils.isNotEmpty(stackingAndLoadingVehiclesCheck)) {
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ log.info("{}{}", "C端自动化起垛失败,该垛位容器位置已被占用,事务回滚!", x.getBilletNos());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
LambdaUpdateWrapper<StackingAndLoadingVehicles> queryWrapperSA = new LambdaUpdateWrapper<>();
|
|
|
queryWrapperSA.eq(StackingAndLoadingVehicles::getCcmNo, x.getCcmNo())
|
|
|
.eq(StackingAndLoadingVehicles::getLayer, x.getLayer())
|
|
@@ -1145,7 +1008,8 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
queryWrapper.in(BilletBasicInfo::getBilletNo, Arrays.asList(parts));
|
|
|
List<BilletBasicInfo> billetBasicInfoList = billetBasicInfoService.list(queryWrapper);
|
|
|
if (oConvertUtils.listIsEmpty(billetBasicInfoList)){
|
|
|
- log.info("{}{}", "自动化堆垛起跺保存失败,钢坯基础信息不存在!", x.getBilletNos());
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ log.info("{}{}", "C端自动化起跺失败,钢坯基础信息不存在,事务回滚:", x.getBilletNos());
|
|
|
return;
|
|
|
}
|
|
|
BilletBasicInfo billetBasicInfo = billetBasicInfoList.stream().findFirst().orElse(null);
|
|
@@ -1157,7 +1021,7 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
stackingAndLoadingVehicles.setSpec(billetBasicInfo.getSpec());
|
|
|
stackingAndLoadingVehicles.setSteel(billetBasicInfo.getGrade());
|
|
|
stackingAndLoadingVehicles.setCreateDate(new Date());
|
|
|
- log.info("{}{}", "》》》》》》》自动化起跺容器中的信息:", JSON.toJSON(stackingAndLoadingVehicles));
|
|
|
+ log.info("{}{}", ">>>>>>自动化起跺容器中的信息:", JSON.toJSON(stackingAndLoadingVehicles));
|
|
|
baseMapper.update(stackingAndLoadingVehicles, queryWrapperSA);
|
|
|
});
|
|
|
// 3 保存 起垛日志 stacking_up_log
|
|
@@ -1288,6 +1152,59 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
|
|
|
+ public void sendBilletNoToMqtt(String ccmNo, List<BilletBasicInfo> billetBasicInfoList) {
|
|
|
+ try {
|
|
|
+ String billetNoLists = String.join(",", billetBasicInfoList.stream().map(BilletBasicInfo::getBilletNo).collect(Collectors.toList()));
|
|
|
+ Map<String, Object> mapSendInfo = new HashMap<>();
|
|
|
+ mapSendInfo.put("ccmNo", ccmNo);
|
|
|
+ mapSendInfo.put("billetNos", billetNoLists);
|
|
|
+ mapSendInfo.put("clearLocationTime", DateUtils.date2Str(new Date(), DateUtils.datetimeFormat.get()));
|
|
|
+ // 执行MQTT推送,设置合理的超时时间
|
|
|
+ MqttClientUtil mqttClientUtilBe = new MqttClientUtil();
|
|
|
+ mqttClientUtilBe.pushCData(configMqttMapper, mapSendInfo, TopicType.SYN_STACKING_PASSBACK.getTopicValue());
|
|
|
+ log.info("C端自动化位置清空后坯号回传,发送MQTT成功: {}", mapSendInfo);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("C端自动化位置清空后坯号回传,发送MQTT异常!", e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 初始化堆垛公共容器
|
|
|
+ * @param stackingAndLoadingVehiclesList
|
|
|
+ */
|
|
|
+ private void batchUpdateStackingAndLoadingVehicles(List<StackingAndLoadingVehicles> stackingAndLoadingVehiclesList) {
|
|
|
+ List<String> ids = stackingAndLoadingVehiclesList.stream().map(StackingAndLoadingVehicles::getId).collect(Collectors.toList());
|
|
|
+ // 创建更新包装器
|
|
|
+ LambdaUpdateWrapper<StackingAndLoadingVehicles> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
+ updateWrapper.in(StackingAndLoadingVehicles::getId, ids)
|
|
|
+ .set(StackingAndLoadingVehicles::getBilletNos, null)
|
|
|
+ .set(StackingAndLoadingVehicles::getSpec, null)
|
|
|
+ .set(StackingAndLoadingVehicles::getSteel, null)
|
|
|
+ .set(StackingAndLoadingVehicles::getSize, null)
|
|
|
+ .set(StackingAndLoadingVehicles::getShift, null)
|
|
|
+ .set(StackingAndLoadingVehicles::getHeatNo, null)
|
|
|
+ .set(StackingAndLoadingVehicles::getCreateDate, null)
|
|
|
+ .set(StackingAndLoadingVehicles::getShiftGroup, null)
|
|
|
+ .set(StackingAndLoadingVehicles::getUpdateTime, new Date());
|
|
|
+ // 执行批量更新
|
|
|
+ stackingAndLoadingVehiclesMapper.update(null, updateWrapper);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 钢坯实绩去向置为空
|
|
|
+ * @param billetBasicInfoList
|
|
|
+ */
|
|
|
+ private void batchUpdateBilletBasicInfo(List<BilletBasicInfo> billetBasicInfoList) {
|
|
|
+ List<String> ids = billetBasicInfoList.stream().map(BilletBasicInfo::getId).collect(Collectors.toList());
|
|
|
+ LambdaUpdateWrapper<BilletBasicInfo> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
+ updateWrapper.in(BilletBasicInfo::getId, ids)
|
|
|
+ .set(BilletBasicInfo::getBelongTable, null)
|
|
|
+ .set(BilletBasicInfo::getBhtcId, null)
|
|
|
+ .set(BilletBasicInfo::getUpdateTime, new Date());
|
|
|
+ billetBasicInfoService.update(updateWrapper);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 封装BilletAutoException对象的方法
|
|
|
*
|