|
@@ -1,29 +1,21 @@
|
|
|
package org.jeecg.modules.billet.stackingAndLoadingVehicles.service.impl;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
-import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.jeecg.common.util.oConvertUtils;
|
|
|
import org.jeecg.modules.actualControl.billetActual.billetActual.entity.BilletBasicInfo;
|
|
|
import org.jeecg.modules.actualControl.billetActual.billetActual.service.IBilletBasicInfoService;
|
|
|
import org.jeecg.modules.billet.billetHotsend.entity.BilletHotsend;
|
|
|
+import org.jeecg.modules.billet.billetHotsend.entity.RollClubCommon;
|
|
|
import org.jeecg.modules.billet.billetHotsend.entity.RulerDefaultConfig;
|
|
|
-import org.jeecg.modules.billet.billetHotsend.mapper.RulerDefaultConfigMapper;
|
|
|
import org.jeecg.modules.billet.billetHotsend.service.IBilletHotsendBaseService;
|
|
|
import org.jeecg.modules.billet.billetHotsend.service.IRulerDefaultConfigService;
|
|
|
import org.jeecg.modules.billet.billetHotsendConfig.entity.BilletHotsendTypeConfig;
|
|
|
import org.jeecg.modules.billet.billetHotsendConfig.service.IBilletHotsendTypeConfigService;
|
|
|
-import org.jeecg.modules.billet.rollClubOne.service.IRollClubOneService;
|
|
|
-import org.jeecg.modules.billet.rollClubThree.service.IRollClubThreeDetailsService;
|
|
|
-import org.jeecg.modules.billet.rollClubThree.service.IRollClubThreeService;
|
|
|
-import org.jeecg.modules.billet.rollClubTwo.service.IRollClubTwoDetailsService;
|
|
|
-import org.jeecg.modules.billet.rollClubTwo.service.IRollClubTwoService;
|
|
|
-import org.jeecg.modules.billet.rollHeight.service.IRollHeightDetailsService;
|
|
|
-import org.jeecg.modules.billet.rollHeight.service.IRollHeightService;
|
|
|
-import org.jeecg.modules.billet.rollOutShipp.service.IRollOutShippDetailsService;
|
|
|
-import org.jeecg.modules.billet.rollOutShipp.service.IRollOutShippService;
|
|
|
+import org.jeecg.modules.billet.operateLog.service.IOperateLogService;
|
|
|
import org.jeecg.modules.billet.stackingAndLoadingVehicles.entity.StackingAndLoadingVehicles;
|
|
|
import org.jeecg.modules.billet.stackingAndLoadingVehicles.entity.StackingDownLog;
|
|
|
import org.jeecg.modules.billet.stackingAndLoadingVehicles.entity.StackingUpLog;
|
|
@@ -61,41 +53,23 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
@Autowired
|
|
|
private IRulerDefaultConfigService rulerDefaultConfigService;
|
|
|
@Autowired
|
|
|
- private RulerDefaultConfigMapper rulerDefaultConfigMapper;
|
|
|
- @Autowired
|
|
|
private IBilletHotsendBaseService billetHotsendBaseService;
|
|
|
@Autowired
|
|
|
private IStorageBillService storageBillService;
|
|
|
@Autowired
|
|
|
private IStorageBillModelService storageBillModelService;
|
|
|
@Autowired
|
|
|
- private IRollClubOneService rollClubOneService;
|
|
|
- @Autowired
|
|
|
- private IRollClubTwoService rollClubTwoService;
|
|
|
- @Autowired
|
|
|
- private IRollClubThreeService rollClubThreeService;
|
|
|
- @Autowired
|
|
|
- private IRollHeightService rollHeightService;
|
|
|
- @Autowired
|
|
|
- private IRollOutShippService rollOutShippService;
|
|
|
- @Autowired
|
|
|
private IBilletHotsendTypeConfigService billetHotsendTypeConfigService;
|
|
|
@Autowired
|
|
|
private IStackingUpLogService stackingUpLogService;
|
|
|
@Autowired
|
|
|
private IStackingDownLogService stackingDownLogService;
|
|
|
@Autowired
|
|
|
- private IRollClubTwoDetailsService rollClubTwoDetailsService;
|
|
|
- @Autowired
|
|
|
- private IRollClubThreeDetailsService rollClubThreeDetailsService;
|
|
|
- @Autowired
|
|
|
- private IRollHeightDetailsService rollHeightDetailsService;
|
|
|
- @Autowired
|
|
|
- private IRollOutShippDetailsService rollOutShippDetailsService;
|
|
|
- @Autowired
|
|
|
private IBilletBasicInfoService billetBasicInfoService;
|
|
|
@Autowired
|
|
|
private IStorageCarLogService storageCarLogService;
|
|
|
+ @Autowired
|
|
|
+ private IOperateLogService operateLogService;
|
|
|
|
|
|
@Override
|
|
|
public List<List<StackingAndLoadingVehicles>> getListBySatck(String typeConfigId) {
|
|
@@ -132,41 +106,41 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
|
|
|
@Override
|
|
|
public void addBatch(SavVo savVo) {
|
|
|
- if(oConvertUtils.listIsNotEmpty(savVo.getSavs())){
|
|
|
- RulerDefaultConfig last = rulerDefaultConfigService.getLast(savVo.getCastMachine());
|
|
|
- String furnace = null;
|
|
|
- if(last!=null){
|
|
|
- furnace = last.getPourHeats();
|
|
|
- last.setShiftProduct((last.getShiftProduct()==null?0:last.getShiftProduct())+4*savVo.getSavs().size());
|
|
|
- rulerDefaultConfigMapper.updateById(last);
|
|
|
- }
|
|
|
-
|
|
|
- String finalFurnace = furnace;
|
|
|
- savVo.getSavs().forEach(item->{
|
|
|
- if(oConvertUtils.isEmpty(item.getHeatNo()))item.setHeatNo(finalFurnace);
|
|
|
- });
|
|
|
- this.addBilletHotsend(savVo.getSavs(),"1",null,savVo.getCastMachine(),"5");
|
|
|
- String destination = "";
|
|
|
- switch (savVo.getSavs().get(0).getStackAddr()){
|
|
|
- case "601":
|
|
|
- destination = "601堆垛";
|
|
|
- break;
|
|
|
- case "602":
|
|
|
- destination = "602堆垛";
|
|
|
- break;
|
|
|
- case "604":
|
|
|
- destination = "604堆垛";
|
|
|
- break;
|
|
|
- case "6":
|
|
|
- destination = "步进冷床";
|
|
|
- break;
|
|
|
- case "501":
|
|
|
- destination = "501堆垛";
|
|
|
- break;
|
|
|
- }
|
|
|
- addStorageBill(savVo.getSavs(),savVo.getCastMachine(),"默认",destination);
|
|
|
-
|
|
|
- }
|
|
|
+// if(oConvertUtils.listIsNotEmpty(savVo.getSavs())){
|
|
|
+// RulerDefaultConfig last = rulerDefaultConfigService.getLast(savVo.getCastMachine());
|
|
|
+// String furnace = null;
|
|
|
+// if(last!=null){
|
|
|
+// furnace = last.getPourHeats();
|
|
|
+// last.setShiftProduct((last.getShiftProduct()==null?0:last.getShiftProduct())+4*savVo.getSavs().size());
|
|
|
+// rulerDefaultConfigMapper.updateById(last);
|
|
|
+// }
|
|
|
+//
|
|
|
+// String finalFurnace = furnace;
|
|
|
+// savVo.getSavs().forEach(item->{
|
|
|
+// if(oConvertUtils.isEmpty(item.getHeatNo()))item.setHeatNo(finalFurnace);
|
|
|
+// });
|
|
|
+// this.addBilletHotsend(savVo.getSavs(),"1",null,savVo.getCastMachine(),"5");
|
|
|
+// String destination = "";
|
|
|
+// switch (savVo.getSavs().get(0).getStackAddr()){
|
|
|
+// case "601":
|
|
|
+// destination = "601堆垛";
|
|
|
+// break;
|
|
|
+// case "602":
|
|
|
+// destination = "602堆垛";
|
|
|
+// break;
|
|
|
+// case "604":
|
|
|
+// destination = "604堆垛";
|
|
|
+// break;
|
|
|
+// case "6":
|
|
|
+// destination = "步进冷床";
|
|
|
+// break;
|
|
|
+// case "501":
|
|
|
+// destination = "501堆垛";
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// addStorageBill(savVo.getSavs(),savVo.getCastMachine(),"默认",destination);
|
|
|
+//
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -480,7 +454,6 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
BilletHotsend billetHotsend = new BilletHotsend();
|
|
|
//1 新保存 钢坯热送基础信息
|
|
|
BeanUtils.copyProperties(loadingParams.getBilletHotsend(), billetHotsend);
|
|
|
- billetHotsend.setCreateDate(new Date());
|
|
|
LambdaQueryWrapper<BilletHotsend> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
queryWrapper.eq(BilletHotsend::getCcmNo, billetHotsend.getCcmNo())
|
|
|
.eq(BilletHotsend::getHeatNo, billetHotsend.getHeatNo())
|
|
@@ -496,10 +469,8 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
billetHotsendBaseService.save(billetHotsend);
|
|
|
return;
|
|
|
}else {
|
|
|
- if ("stacking_and_loading_vehicles".equals(loadingParams.getBelongTable()) && "1".equals(billetHotsendTypeConfig.getBelongType().toString())){
|
|
|
- billetHotsend.setStackNum(idExistBh.getStackNum() + stackingAndLoadingVehiclesList.size() * 4); // 堆垛总支数
|
|
|
- }
|
|
|
-// billetHotsend.setAmountTotal(billetHotsend.getAmountTotal() + stackingAndLoadingVehiclesList.size()); //总支数
|
|
|
+ billetHotsend.setStackNum(idExistBh.getStackNum() + stackingAndLoadingVehiclesList.size()); // 堆垛总支数
|
|
|
+ billetHotsend.setAmountTotal(idExistBh.getAmountTotal() + stackingAndLoadingVehiclesList.size() * 4); //总支数
|
|
|
LambdaUpdateWrapper<BilletHotsend> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
updateWrapper.eq(BilletHotsend::getCcmNo, billetHotsend.getCcmNo())
|
|
|
.eq(BilletHotsend::getHeatNo, billetHotsend.getHeatNo())
|
|
@@ -507,6 +478,18 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
.eq(BilletHotsend::getShiftGroup, billetHotsend.getShiftGroup());;
|
|
|
billetHotsendBaseService.update(billetHotsend, updateWrapper);
|
|
|
}
|
|
|
+ // 根据铸机号、位置、层数、类型配置ID更新 容器中的垛位信息
|
|
|
+ stackingAndLoadingVehiclesList.forEach(x ->{
|
|
|
+ LambdaUpdateWrapper<StackingAndLoadingVehicles> queryWrapperSA = new LambdaUpdateWrapper<>();
|
|
|
+ queryWrapperSA.eq(StackingAndLoadingVehicles::getCcmNo, x.getCcmNo())
|
|
|
+ .eq(StackingAndLoadingVehicles::getLayer, x.getLayer())
|
|
|
+ .eq(StackingAndLoadingVehicles::getAddress, x.getAddress())
|
|
|
+ .eq(StackingAndLoadingVehicles::getTypeConfigId, loadingParams.getBilletHotsendTypeConfigId());;
|
|
|
+ StackingAndLoadingVehicles stackingAndLoadingVehicles = new StackingAndLoadingVehicles();
|
|
|
+ BeanUtils.copyProperties(x, stackingAndLoadingVehicles);
|
|
|
+ baseMapper.update(stackingAndLoadingVehicles, queryWrapperSA);
|
|
|
+ });
|
|
|
+
|
|
|
// 获取所有的坯号集合
|
|
|
List<String> billetNosList = stackingAndLoadingVehiclesList.stream().map(StackingAndLoadingVehicles::getBilletNos)
|
|
|
.flatMap(billetNos -> {
|
|
@@ -516,47 +499,21 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
return java.util.stream.Stream.empty();
|
|
|
}
|
|
|
}).collect(Collectors.toList());
|
|
|
- StackingAndLoadingVehicles stackingAndLoadingVehicles = new StackingAndLoadingVehicles();
|
|
|
- LambdaQueryWrapper<StackingAndLoadingVehicles> queryWrapperSA = new LambdaQueryWrapper<>();
|
|
|
- queryWrapperSA.eq(StackingAndLoadingVehicles::getCcmNo, billetHotsend.getCcmNo())
|
|
|
- .eq(StackingAndLoadingVehicles::getHeatNo, billetHotsend.getHeatNo())
|
|
|
- .eq(StackingAndLoadingVehicles::getShift, billetHotsend.getShift())
|
|
|
- .eq(StackingAndLoadingVehicles::getShiftGroup, billetHotsend.getShiftGroup());;
|
|
|
- StackingAndLoadingVehicles isExistSLV = baseMapper.selectOne(queryWrapperSA);
|
|
|
- if (oConvertUtils.isEmpty(isExistSLV)){
|
|
|
- stackingAndLoadingVehicles.setId(String.valueOf(IdWorker.getId()));
|
|
|
- BeanUtils.copyProperties(billetHotsend, stackingAndLoadingVehicles);
|
|
|
- stackingAndLoadingVehicles.setTypeConfigId(billetHotsendTypeConfig.getId());
|
|
|
- stackingAndLoadingVehicles.setStackAddr(billetHotsendTypeConfig.getTypeName()); // 垛位
|
|
|
- stackingAndLoadingVehicles.setBilletNos(String.join(",", billetNosList)); // 坯号集
|
|
|
-// stackingAndLoadingVehicles.setAddress(); // 所在位置(1-9)
|
|
|
-// stackingAndLoadingVehicles.setLayer();// 所在层数(1-20)
|
|
|
- baseMapper.insert(stackingAndLoadingVehicles);
|
|
|
- }else {
|
|
|
- // 垛位二次装车
|
|
|
- BeanUtils.copyProperties(isExistSLV, stackingAndLoadingVehicles);
|
|
|
- stackingAndLoadingVehicles.setBilletNos(String.join(",", billetNosList)); // 坯号集
|
|
|
-// stackingAndLoadingVehicles.setLayer();// 所在层数(1-20)
|
|
|
-// stackingAndLoadingVehicles.setAddress(); // 所在位置(1-9)
|
|
|
- stackingAndLoadingVehicles.setUpdateTime(new Date());
|
|
|
- baseMapper.updateById(stackingAndLoadingVehicles);
|
|
|
- }
|
|
|
- StorageBill storageBill = loadingParams.getStorageBill();
|
|
|
- // 3 保存 起垛日志 stacking_up_log
|
|
|
- List<StackingUpLog> stackingUpLogList = new ArrayList<>();
|
|
|
+
|
|
|
+ // 3 保存 下垛日志 stacking_up_log
|
|
|
+ List<StackingDownLog> stackingDownLogList = new ArrayList<>();
|
|
|
stackingAndLoadingVehiclesList.forEach(x ->{
|
|
|
- StackingUpLog stackingUpLog = new StackingUpLog();
|
|
|
- BeanUtils.copyProperties(x, stackingUpLog);
|
|
|
- stackingUpLog.setBilletNo(x.getBilletNos());
|
|
|
- stackingUpLog.setAmount(stackingAndLoadingVehiclesList.size() * 4); // 支数
|
|
|
- stackingUpLog.setLayer(x.getLayer());// 堆垛层号(1-20)
|
|
|
- stackingUpLog.setAddress(x.getAddress());// 堆垛编号(1-9)
|
|
|
- stackingUpLog.setStackAddr(billetHotsendTypeConfig.getTypeName());
|
|
|
- stackingUpLog.setFromStackingId(stackingAndLoadingVehicles.getId());
|
|
|
- stackingUpLog.setCreateDate(new Date());
|
|
|
- stackingUpLogList.add(stackingUpLog);
|
|
|
+ StackingDownLog stackingDownLog = new StackingDownLog();
|
|
|
+ BeanUtils.copyProperties(x, stackingDownLog);
|
|
|
+ stackingDownLog.setBilletNo(x.getBilletNos());
|
|
|
+ stackingDownLog.setStorageBillId(loadingParams.getStorageBill().getId());
|
|
|
+ stackingDownLog.setStackStorey(x.getLayer());// 堆垛层号(1-20)
|
|
|
+ stackingDownLog.setStackNum(x.getAddress());// 堆垛编号(1-9)
|
|
|
+ stackingDownLog.setStackAddr(billetHotsendTypeConfig.getTypeName());
|
|
|
+// stackingUpLog.setFromStackingId(stackingAndLoadingVehicles.getId());
|
|
|
+ stackingDownLogList.add(stackingDownLog);
|
|
|
});
|
|
|
- stackingUpLogService.saveBatch(stackingUpLogList);
|
|
|
+ stackingDownLogService.saveBatch(stackingDownLogList);
|
|
|
//5 查询并批量更新钢坯基础信息 belongTable
|
|
|
LambdaQueryWrapper<BilletBasicInfo> queryWrapperBB = new LambdaQueryWrapper<BilletBasicInfo>()
|
|
|
.eq(BilletBasicInfo::getCcmNo, Integer.valueOf(billetHotsend.getCcmNo()))
|
|
@@ -564,9 +521,7 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
.in(BilletBasicInfo::getBilletNo, billetNosList);
|
|
|
List<BilletBasicInfo> billetBasicInfoList = billetBasicInfoService.list(queryWrapperBB);
|
|
|
billetBasicInfoList.forEach(x ->{
|
|
|
- if ("stacking_and_loading_vehicles".equals(loadingParams.getBelongTable())){
|
|
|
- x.setBelongTable("stacking_and_loading_vehicles");
|
|
|
- }
|
|
|
+ x.setBelongTable("stacking_and_loading_vehicles");
|
|
|
x.setUpdateTime(new Date());
|
|
|
x.setBhtcId(loadingParams.getBilletHotsendTypeConfigId());
|
|
|
});
|
|
@@ -581,31 +536,61 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
BilletHotsend billetHotsend = new BilletHotsend();
|
|
|
//1 新保存 钢坯热送基础信息
|
|
|
BeanUtils.copyProperties(loadingParams.getBilletHotsend(), billetHotsend);
|
|
|
-// billetHotsend.setAmountTotal(rollClubCommonList.size()); //总支数
|
|
|
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.isNotEmpty(idExistBh) && oConvertUtils.listIsEmpty(stackingAndLoadingVehiclesList)){
|
|
|
- return;
|
|
|
- }
|
|
|
- if (oConvertUtils.isEmpty(idExistBh) && oConvertUtils.listIsEmpty(stackingAndLoadingVehiclesList)){
|
|
|
- billetHotsend.setStackNum(0);
|
|
|
- billetHotsendBaseService.save(billetHotsend);
|
|
|
- return;
|
|
|
- }else {
|
|
|
- if ("stacking_and_loading_vehicles".equals(loadingParams.getBelongTable()) && "1".equals(billetHotsendTypeConfig.getBelongType().toString())){
|
|
|
- billetHotsend.setStackNum(idExistBh.getStackNum() + stackingAndLoadingVehiclesList.size() * 4); // 堆垛总支数
|
|
|
+ if ((oConvertUtils.isNotEmpty(idExistBh) && oConvertUtils.listIsEmpty(stackingAndLoadingVehiclesList)) || (oConvertUtils.isEmpty(idExistBh) && oConvertUtils.listIsEmpty(stackingAndLoadingVehiclesList))) {
|
|
|
+ if (oConvertUtils.isEmpty(idExistBh)) {
|
|
|
+ billetHotsend.setStackNum(0);
|
|
|
+ billetHotsendBaseService.save(billetHotsend);
|
|
|
+ log.info("{}{}", "stackingAndLoadingVehiclesList为空,新增钢坯热送基础信息", JSON.toJSON(loadingParams));
|
|
|
}
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ billetHotsend.setStackNum(idExistBh.getStackNum() + stackingAndLoadingVehiclesList.size()); // 堆垛总支数
|
|
|
+ billetHotsend.setAmountTotal(idExistBh.getAmountTotal() + stackingAndLoadingVehiclesList.size() * 4); //总支数
|
|
|
LambdaUpdateWrapper<BilletHotsend> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
updateWrapper.eq(BilletHotsend::getCcmNo, billetHotsend.getCcmNo())
|
|
|
.eq(BilletHotsend::getHeatNo, billetHotsend.getHeatNo())
|
|
|
.eq(BilletHotsend::getShift, billetHotsend.getShift())
|
|
|
.eq(BilletHotsend::getShiftGroup, billetHotsend.getShiftGroup());;
|
|
|
- billetHotsendBaseService.update(billetHotsend, updateWrapper);
|
|
|
+ billetHotsendBaseService.update(billetHotsend, updateWrapper);
|
|
|
}
|
|
|
+
|
|
|
+ // 3 发车后,动态更新容器中的垛位信息 初始化
|
|
|
+ stackingAndLoadingVehiclesList.forEach(x ->{
|
|
|
+ LambdaUpdateWrapper<StackingAndLoadingVehicles> queryWrapperSA = new LambdaUpdateWrapper<>();
|
|
|
+ queryWrapperSA.eq(StackingAndLoadingVehicles::getCcmNo, x.getCcmNo())
|
|
|
+ .eq(StackingAndLoadingVehicles::getLayer, x.getLayer())
|
|
|
+ .eq(StackingAndLoadingVehicles::getAddress, x.getAddress())
|
|
|
+ .eq(StackingAndLoadingVehicles::getTypeConfigId, loadingParams.getBilletHotsendTypeConfigId());;
|
|
|
+ StackingAndLoadingVehicles stackingAndLoadingVehicles = createInitializedVehicle();
|
|
|
+ BeanUtils.copyProperties(x, stackingAndLoadingVehicles);
|
|
|
+ stackingAndLoadingVehicles.setBilletNos(null);
|
|
|
+ stackingAndLoadingVehicles.setSpec(null);
|
|
|
+ stackingAndLoadingVehicles.setSteel(null);
|
|
|
+ stackingAndLoadingVehicles.setSize(null);
|
|
|
+ stackingAndLoadingVehicles.setShift(null);
|
|
|
+ stackingAndLoadingVehicles.setHeatNo(null);
|
|
|
+ stackingAndLoadingVehicles.setShiftGroup(null);
|
|
|
+ stackingAndLoadingVehicles.setCreateDate(null);
|
|
|
+ baseMapper.update(stackingAndLoadingVehicles, queryWrapperSA);
|
|
|
+ });
|
|
|
+
|
|
|
+ // 4 保存 下垛日志 stacking_down_log
|
|
|
+ List<StackingDownLog> stackingDownLogList = new ArrayList<>();
|
|
|
+ stackingAndLoadingVehiclesList.forEach(x ->{
|
|
|
+ StackingDownLog stackingDownLog = new StackingDownLog();
|
|
|
+ BeanUtils.copyProperties(x, stackingDownLog);
|
|
|
+ stackingDownLog.setBilletNo(x.getBilletNos());
|
|
|
+ stackingDownLog.setStorageBillId(loadingParams.getStorageBill().getId());// 装运单ID
|
|
|
+ stackingDownLogList.add(stackingDownLog);
|
|
|
+ });
|
|
|
+ stackingDownLogService.saveBatch(stackingDownLogList);
|
|
|
+
|
|
|
// 获取所有的坯号集合
|
|
|
List<String> billetNosList = stackingAndLoadingVehiclesList.stream().map(StackingAndLoadingVehicles::getBilletNos)
|
|
|
.flatMap(billetNos -> {
|
|
@@ -615,90 +600,136 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
return java.util.stream.Stream.empty();
|
|
|
}
|
|
|
}).collect(Collectors.toList());
|
|
|
+ //5 查询并批量更新钢坯基础信息 belongTable
|
|
|
+ LambdaQueryWrapper<BilletBasicInfo> queryWrapperBB = new LambdaQueryWrapper<BilletBasicInfo>()
|
|
|
+ .eq(BilletBasicInfo::getCcmNo, Integer.valueOf(billetHotsend.getCcmNo()))
|
|
|
+ .eq(BilletBasicInfo::getHeatNo, billetHotsend.getHeatNo())
|
|
|
+ .in(BilletBasicInfo::getBilletNo, billetNosList);
|
|
|
+ List<BilletBasicInfo> billetBasicInfoList = billetBasicInfoService.list(queryWrapperBB);
|
|
|
+ billetBasicInfoList.forEach(x ->{
|
|
|
+ x.setBelongTable("stacking_and_loading_vehicles");
|
|
|
+ x.setBhtcId(loadingParams.getBilletHotsendTypeConfigId());
|
|
|
+ });
|
|
|
+ billetBasicInfoService.saveOrUpdateBatch(billetBasicInfoList);
|
|
|
+ // 6 更新装运单 storage_bill 新增储运信息
|
|
|
+ StorageBill storageBill = loadingParams.getStorageBill();
|
|
|
+ storageBill.setCarAllNum(oConvertUtils.isEmpty(storageBill.getCarAllNum()) ? "1" : String.valueOf(Integer.valueOf(storageBill.getCarAllNum())+1));// 车次总序号
|
|
|
+ storageBill.setCarNum(storageBill.getCarNum() == 0 ? 0 : storageBill.getCarNum() + 1);// 本车车次
|
|
|
+ storageBillService.updateById(storageBill);
|
|
|
+ // 7 发车后,新增钢坯堆垛储运信息,生成储运单 storage_car_log
|
|
|
+ StorageCarLog storageCarLog = new StorageCarLog();
|
|
|
+ BeanUtils.copyProperties(storageBill, storageCarLog);
|
|
|
+ storageCarLog.setDestination(billetHotsendTypeConfig.getTypeName());// 目的地
|
|
|
+ storageCarLog.setCarNm(String.valueOf(storageBill.getCarNum()));// 车号
|
|
|
+ storageCarLog.setOutCarNum(storageBill.getLicensePlate()); // 出车号
|
|
|
+ storageCarLog.setTypeConfigId(billetHotsendTypeConfig.getId()); // 钢坯配置类型ID
|
|
|
+ storageCarLog.setHeatNo(billetHotsend.getHeatNo());
|
|
|
+// storageCarLog.setFixedWeight();// 定重
|
|
|
+// storageCarLog.setSize();// 定尺
|
|
|
+ // 查询上垛记录,计算出总支数
|
|
|
+ LambdaQueryWrapper<StackingUpLog> queryWrapperSU = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapperSU.eq(StackingUpLog::getCcmNo, billetHotsend.getCcmNo())
|
|
|
+ .eq(StackingUpLog::getHeatNo, billetHotsend.getHeatNo())
|
|
|
+ .eq(StackingUpLog::getShift, billetHotsend.getShift())
|
|
|
+ .eq(StackingUpLog::getShiftGroup, billetHotsend.getShiftGroup());
|
|
|
+ List<StackingUpLog> stackingUpLogList = stackingUpLogService.list(queryWrapperSU);
|
|
|
+ storageCarLog.setAmount(oConvertUtils.listIsNotEmpty(stackingUpLogList) ? stackingUpLogList.size() : 0);// 支数
|
|
|
+ storageCarLogService.save(storageCarLog);
|
|
|
+ }
|
|
|
|
|
|
- StackingAndLoadingVehicles stackingAndLoadingVehicles = new StackingAndLoadingVehicles();
|
|
|
- LambdaQueryWrapper<StackingAndLoadingVehicles> queryWrapperSA = new LambdaQueryWrapper<>();
|
|
|
- queryWrapperSA.eq(StackingAndLoadingVehicles::getCcmNo, billetHotsend.getCcmNo())
|
|
|
- .eq(StackingAndLoadingVehicles::getHeatNo, billetHotsend.getHeatNo())
|
|
|
- .eq(StackingAndLoadingVehicles::getShift, billetHotsend.getShift())
|
|
|
- .eq(StackingAndLoadingVehicles::getShiftGroup, billetHotsend.getShiftGroup());;
|
|
|
- StackingAndLoadingVehicles isExistSLV = baseMapper.selectOne(queryWrapperSA);
|
|
|
- if (oConvertUtils.isEmpty(isExistSLV)){
|
|
|
- stackingAndLoadingVehicles.setId(String.valueOf(IdWorker.getId()));
|
|
|
- BeanUtils.copyProperties(billetHotsend, stackingAndLoadingVehicles);
|
|
|
- stackingAndLoadingVehicles.setTypeConfigId(billetHotsendTypeConfig.getId());
|
|
|
- stackingAndLoadingVehicles.setStackAddr(billetHotsendTypeConfig.getTypeName()); // 垛位
|
|
|
- stackingAndLoadingVehicles.setBilletNos(String.join(",", billetNosList)); // 坯号集
|
|
|
-// stackingAndLoadingVehicles.setAddress(); // 所在位置(1-9)
|
|
|
-// stackingAndLoadingVehicles.setLayer();// 所在层数(1-20)
|
|
|
- baseMapper.insert(stackingAndLoadingVehicles);
|
|
|
+ @Override
|
|
|
+ public void addStackInfo(LoadingParams loadingParams) {
|
|
|
+ // 根据billetHotsendTypeConfigId 查询基础垛位信息
|
|
|
+ BilletHotsendTypeConfig billetHotsendTypeConfig = billetHotsendTypeConfigService.getById(loadingParams.getBilletHotsendTypeConfigId());
|
|
|
+ List<StackingAndLoadingVehicles> stackingAndLoadingVehiclesList = loadingParams.getStackingAndLoadingVehiclesList();
|
|
|
+ List<RollClubCommon> rollClubCommonList = loadingParams.getRollClubCommonList();
|
|
|
+ BilletHotsend billetHotsend = new BilletHotsend();
|
|
|
+ //1 新保存 钢坯热送基础信息
|
|
|
+ BeanUtils.copyProperties(loadingParams.getBilletHotsend(), billetHotsend);
|
|
|
+ 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.isNotEmpty(idExistBh) && oConvertUtils.listIsEmpty(rollClubCommonList)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (oConvertUtils.isEmpty(idExistBh) && oConvertUtils.listIsEmpty(rollClubCommonList)){
|
|
|
+ billetHotsend.setStackNum(0);
|
|
|
+ billetHotsend.setAmountTotal(0);
|
|
|
+ billetHotsendBaseService.save(billetHotsend);
|
|
|
+ return;
|
|
|
}else {
|
|
|
- // 垛位二次装车
|
|
|
- BeanUtils.copyProperties(isExistSLV, stackingAndLoadingVehicles);
|
|
|
- stackingAndLoadingVehicles.setBilletNos(String.join(",", billetNosList)); // 坯号集
|
|
|
-// stackingAndLoadingVehicles.setLayer();// 所在层数(1-20)
|
|
|
-// stackingAndLoadingVehicles.setAddress(); // 所在位置(1-9)
|
|
|
- stackingAndLoadingVehicles.setUpdateTime(new Date());
|
|
|
- baseMapper.updateById(stackingAndLoadingVehicles);
|
|
|
+ billetHotsend.setStackNum(idExistBh.getStackNum() + stackingAndLoadingVehiclesList.size()); // 堆垛总支数
|
|
|
+ billetHotsend.setAmountTotal(idExistBh.getAmountTotal() + stackingAndLoadingVehiclesList.size() * 4); //总支数
|
|
|
+ LambdaUpdateWrapper<BilletHotsend> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
+ updateWrapper.eq(BilletHotsend::getCcmNo, billetHotsend.getCcmNo())
|
|
|
+ .eq(BilletHotsend::getHeatNo, billetHotsend.getHeatNo())
|
|
|
+ .eq(BilletHotsend::getShift, billetHotsend.getShift())
|
|
|
+ .eq(BilletHotsend::getShiftGroup, billetHotsend.getShiftGroup());;
|
|
|
+ billetHotsendBaseService.update(billetHotsend, updateWrapper);
|
|
|
}
|
|
|
- StorageBill storageBill = loadingParams.getStorageBill();
|
|
|
- // 3 保存 下垛日志 stacking_down_log
|
|
|
- List<StackingDownLog> stackingDownLogList = new ArrayList<>();
|
|
|
+
|
|
|
+ // 2 发车后,动态更新容器中的垛位信息 初始化
|
|
|
stackingAndLoadingVehiclesList.forEach(x ->{
|
|
|
- StackingDownLog stackingDownLog = new StackingDownLog();
|
|
|
- BeanUtils.copyProperties(x, stackingDownLog);
|
|
|
- stackingDownLog.setBilletNo(x.getBilletNos());
|
|
|
- if (storageBill != null){
|
|
|
- stackingDownLog.setStorageBillId(storageBill.getId());// 装运单ID
|
|
|
- }
|
|
|
- stackingDownLog.setStackStorey(x.getLayer());// 堆垛层号(1-20)
|
|
|
- stackingDownLog.setStackNum(x.getAddress());// 堆垛编号(1-9)
|
|
|
- stackingDownLogList.add(stackingDownLog);
|
|
|
+ LambdaUpdateWrapper<StackingAndLoadingVehicles> queryWrapperSA = new LambdaUpdateWrapper<>();
|
|
|
+ queryWrapperSA.eq(StackingAndLoadingVehicles::getCcmNo, x.getCcmNo())
|
|
|
+ .eq(StackingAndLoadingVehicles::getLayer, x.getLayer())
|
|
|
+ .eq(StackingAndLoadingVehicles::getAddress, x.getAddress())
|
|
|
+ .eq(StackingAndLoadingVehicles::getTypeConfigId, loadingParams.getBilletHotsendTypeConfigId());;
|
|
|
+ StackingAndLoadingVehicles stackingAndLoadingVehicles = createInitializedVehicle();
|
|
|
+ BeanUtils.copyProperties(x, stackingAndLoadingVehicles);
|
|
|
+ stackingAndLoadingVehicles.setCreateDate(new Date());
|
|
|
+ baseMapper.update(stackingAndLoadingVehicles, queryWrapperSA);
|
|
|
});
|
|
|
- stackingDownLogService.saveBatch(stackingDownLogList);
|
|
|
|
|
|
- // 4 删除垛位容器中的信息
|
|
|
- baseMapper.deleteById(stackingAndLoadingVehicles);
|
|
|
+ // 3 保存 起垛日志 stacking_up_log
|
|
|
+ List<StackingUpLog> stackingUpLogList = new ArrayList<>();
|
|
|
+ stackingAndLoadingVehiclesList.forEach(x ->{
|
|
|
+ StackingUpLog stackingUpLog = new StackingUpLog();
|
|
|
+ BeanUtils.copyProperties(x, stackingUpLog);
|
|
|
+ stackingUpLog.setBilletNo(x.getBilletNos());
|
|
|
+ stackingUpLog.setAmount(4); // 支数
|
|
|
+ stackingUpLog.setLayer(x.getLayer());// 堆垛层号(1-20)
|
|
|
+ stackingUpLog.setAddress(x.getAddress());// 堆垛编号(1-9)
|
|
|
+ stackingUpLog.setStackAddr(billetHotsendTypeConfig.getTypeName());
|
|
|
+ stackingUpLogList.add(stackingUpLog);
|
|
|
+ });
|
|
|
+ stackingUpLogService.saveBatch(stackingUpLogList);
|
|
|
+ //4 获取所有的坯号集合
|
|
|
+ List<String> billetNos = rollClubCommonList.stream().map(RollClubCommon::getBilletNo).collect(Collectors.toList());
|
|
|
|
|
|
//5 查询并批量更新钢坯基础信息 belongTable
|
|
|
LambdaQueryWrapper<BilletBasicInfo> queryWrapperBB = new LambdaQueryWrapper<BilletBasicInfo>()
|
|
|
.eq(BilletBasicInfo::getCcmNo, Integer.valueOf(billetHotsend.getCcmNo()))
|
|
|
.eq(BilletBasicInfo::getHeatNo, billetHotsend.getHeatNo())
|
|
|
- .in(BilletBasicInfo::getBilletNo, billetNosList);
|
|
|
+ .in(BilletBasicInfo::getBilletNo, billetNos);
|
|
|
List<BilletBasicInfo> billetBasicInfoList = billetBasicInfoService.list(queryWrapperBB);
|
|
|
billetBasicInfoList.forEach(x ->{
|
|
|
- if ("stacking_and_loading_vehicles".equals(loadingParams.getBelongTable())){
|
|
|
- x.setBelongTable("stacking_and_loading_vehicles");
|
|
|
- }
|
|
|
- x.setUpdateTime(new Date());
|
|
|
+ x.setBelongTable("stacking_and_loading_vehicles");
|
|
|
x.setBhtcId(loadingParams.getBilletHotsendTypeConfigId());
|
|
|
});
|
|
|
billetBasicInfoService.saveOrUpdateBatch(billetBasicInfoList);
|
|
|
- // 6 更新装运单 storage_bill 新增储运信息
|
|
|
- if (oConvertUtils.isNotEmpty(stackingAndLoadingVehiclesList) && oConvertUtils.isNotEmpty(storageBill)){
|
|
|
- storageBill.setCarAllNum(oConvertUtils.isEmpty(storageBill.getCarAllNum()) ? "1" : String.valueOf(Integer.valueOf(storageBill.getCarAllNum())+1));// 车次总序号
|
|
|
- storageBill.setCarNum(storageBill.getCarNum() == 0 ? 0 : storageBill.getCarNum() + 1);// 本车车次
|
|
|
- storageBillService.updateById(storageBill);
|
|
|
- // 7 发车后,新增钢坯堆垛储运信息,生成储运单 storage_car_log
|
|
|
- StorageCarLog storageCarLog = new StorageCarLog();
|
|
|
- BeanUtils.copyProperties(storageBill, storageCarLog);
|
|
|
- storageCarLog.setDestination(billetHotsendTypeConfig.getTypeName());// 目的地
|
|
|
- storageCarLog.setCarNm(String.valueOf(storageBill.getCarNum()));// 车号
|
|
|
- storageCarLog.setOutCarNum(storageBill.getLicensePlate()); // 出车号
|
|
|
- storageCarLog.setTypeConfigId(billetHotsendTypeConfig.getId()); // 钢坯配置类型ID
|
|
|
- storageCarLog.setHeatNo(billetHotsend.getHeatNo());
|
|
|
-// storageCarLog.setFixedWeight();// 定重
|
|
|
-// storageCarLog.setSize();// 定尺
|
|
|
- // 查询上垛记录,计算出总支数
|
|
|
- LambdaQueryWrapper<StackingUpLog> queryWrapperSU = new LambdaQueryWrapper<>();
|
|
|
- queryWrapperSU.eq(StackingUpLog::getCcmNo, billetHotsend.getCcmNo())
|
|
|
- .eq(StackingUpLog::getHeatNo, billetHotsend.getHeatNo())
|
|
|
- .eq(StackingUpLog::getShift, billetHotsend.getShift())
|
|
|
- .eq(StackingUpLog::getShiftGroup, billetHotsend.getShiftGroup());
|
|
|
- List<StackingUpLog> stackingUpLogList = stackingUpLogService.list(queryWrapperSU);
|
|
|
- storageCarLog.setAmount(oConvertUtils.listIsNotEmpty(stackingUpLogList) ? stackingUpLogList.size() : 0);// 支数
|
|
|
- storageCarLogService.save(storageCarLog);
|
|
|
- }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 初始化StackingAndLoadingVehicles对象
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private StackingAndLoadingVehicles createInitializedVehicle() {
|
|
|
+ StackingAndLoadingVehicles vehicle = new StackingAndLoadingVehicles();
|
|
|
+ vehicle.setBilletNos(null);
|
|
|
+ vehicle.setSpec(null);
|
|
|
+ vehicle.setSteel(null);
|
|
|
+ vehicle.setSize(null);
|
|
|
+ vehicle.setShift(null);
|
|
|
+ vehicle.setHeatNo(null);
|
|
|
+ vehicle.setShiftGroup(null);
|
|
|
+ vehicle.setCreateDate(null);
|
|
|
+ return vehicle;
|
|
|
}
|
|
|
|
|
|
public void addStorageBill(List<StackingAndLoadingVehicles> savs,String castMachine,String carNum,String destination){
|