|
@@ -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;
|
|
@@ -123,6 +127,9 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
private IBilletLiftingBillService billetLiftingBillService;
|
|
|
@Autowired
|
|
|
private IOperateLogService operateLogService;
|
|
|
+ @Autowired
|
|
|
+ private ConfigMqttMapper configMqttMapper;
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@@ -773,6 +780,83 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
log.info("{}{}", "自动化堆垛发车操作成功", billetNoLists);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void stackingClearLocation(JSONObject jsonObject) {
|
|
|
+ String ccmNo = jsonObject.getString("ccmNo");// 铸机号
|
|
|
+ String billetHotsendTypeConfigId = jsonObject.getString("billetHotsendTypeConfigId");
|
|
|
+ String layer = jsonObject.getString("layer");
|
|
|
+ String address = jsonObject.getString("address");
|
|
|
+ // 判断layer和address为空时直接返回
|
|
|
+ if (oConvertUtils.isEmpty(layer) || oConvertUtils.isEmpty(address)){
|
|
|
+ log.info("{}{}", "layer和address为空,自动化堆垛清空位置失败!", jsonObject);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 根据以上信息查询堆垛容器信息
|
|
|
+ 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("{}{}", "自动化堆垛清空位置失败!", jsonObject);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ StackingAndLoadingVehicles stackingAndLoadingVehicles = stackingAndLoadingVehiclesList.stream().findFirst().orElse(null);
|
|
|
+ if (stackingAndLoadingVehicles == null || oConvertUtils.isEmpty(stackingAndLoadingVehicles.getBilletNos())){
|
|
|
+ log.info("{}{}", "该位置坯号集为空,自动化堆垛清空位置失败!", jsonObject);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 根据逗号隔开的坯号集,查询钢坯基础信息
|
|
|
+ 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("{}{}", "钢坯基础信息为空,自动化堆垛清空位置失败!", jsonObject);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 更新钢坯基础信息 钢坯基础信息所属表、配置ID赋值
|
|
|
+ billetBasicInfoList.forEach(x ->{
|
|
|
+ x.setBelongTable(null);
|
|
|
+ x.setBhtcId(null);
|
|
|
+ });
|
|
|
+ // 使用 updateBatchById 方法进行批量更新
|
|
|
+ billetBasicInfoService.updateBatchById(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端自动化堆垛清空位置事务回滚!");
|
|
|
+ }
|
|
|
+ billetHotsend.setStackNum(Math.max(0, billetHotsend.getStackNum() - billetBasicInfoList.size()));
|
|
|
+ billetHotsend.setUpdateTime(new Date());
|
|
|
+ billetHotsendBaseService.updateById(billetHotsend);
|
|
|
+
|
|
|
+ // 发送坯号结果到mqtt
|
|
|
+ String billetNoLists = String.join(",", billetBasicInfoList.stream().map(BilletBasicInfo::getBilletNo).collect(Collectors.toList()));
|
|
|
+ try {
|
|
|
+ Map<String, Object> mapSendInfo = new HashMap<>();
|
|
|
+ mapSendInfo.put("ccmNo", ccmNo);// 铸机号
|
|
|
+ mapSendInfo.put("billetNos", billetNoLists);// 铸机号
|
|
|
+ mapSendInfo.put("clearLocationTime", DateUtils.date2Str(new Date(), DateUtils.datetimeFormat.get()));
|
|
|
+ MqttClientUtil mqttClientUtilBe = new MqttClientUtil();
|
|
|
+ mqttClientUtilBe.pushCData(configMqttMapper, mapSendInfo, TopicType.SYN_STACKING_PASSBACK.getTopicValue());
|
|
|
+ log.info("自动化位置清空后坯号回传,发送MQTT成功: {}", mapSendInfo);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("自动化位置清空后坯号回传,发送MQTT异常!", e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 堆垛保存、堆垛发车公共处理
|
|
@@ -1264,6 +1348,28 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 初始化堆垛公共容器
|
|
|
+ * @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);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 封装BilletAutoException对象的方法
|
|
|
*
|