修复bug
This commit is contained in:
@@ -116,7 +116,7 @@ public interface IIndustryMaterialService
|
|||||||
|
|
||||||
void deleteIndustryMaterialByState(Long state);
|
void deleteIndustryMaterialByState(Long state);
|
||||||
|
|
||||||
String insertIndustryMaterialToSlaveDataSource(List<IndustryMaterialVo> industryMaterialVos);
|
String insertIndustryMaterialToSlaveDataSource(List<IndustryMaterialVo> industryMaterialVos, Long aLong);
|
||||||
|
|
||||||
/**3
|
/**3
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ public class IndustryMaterialServiceImpl implements IIndustryMaterialService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@DataSource(value = DataSourceType.SLAVE)
|
@DataSource(value = DataSourceType.SLAVE)
|
||||||
public String insertIndustryMaterialToSlaveDataSource(List<IndustryMaterialVo> industryMaterialVos) {
|
public String insertIndustryMaterialToSlaveDataSource(List<IndustryMaterialVo> industryMaterialVos,Long insertBatchId) {
|
||||||
|
|
||||||
|
|
||||||
// TODO 这里需要查一下数据库查看是否有正在轧或者说是未轧的情况 state=1,3,4
|
// TODO 这里需要查一下数据库查看是否有正在轧或者说是未轧的情况 state=1,3,4
|
||||||
@@ -128,13 +128,22 @@ public class IndustryMaterialServiceImpl implements IIndustryMaterialService {
|
|||||||
System.out.println("触发四辊数据写入");
|
System.out.println("触发四辊数据写入");
|
||||||
// 这个大小等于0 表示四辊没有东西再轧制了可以进行放行
|
// 这个大小等于0 表示四辊没有东西再轧制了可以进行放行
|
||||||
if (industryMaterialVos1.isEmpty()) {
|
if (industryMaterialVos1.isEmpty()) {
|
||||||
|
|
||||||
|
if (Objects.nonNull(insertBatchId)) {
|
||||||
|
IndustryBatchVo industryBatchVo = industryBatchService.selectIndustryBatchById(insertBatchId);
|
||||||
|
industryBatchVo.setBatchSize(industryBatchVo.getBatchSize() + 1);
|
||||||
|
industryBatchService.updateIndustryBatch(industryBatchVo);
|
||||||
|
}else{
|
||||||
IndustryBatch industryBatch = new IndustryBatch();
|
IndustryBatch industryBatch = new IndustryBatch();
|
||||||
industryBatch.setBatchSize((long) industryMaterialVos.size());
|
industryBatch.setBatchSize((long) industryMaterialVos.size());
|
||||||
industryBatchService.insertIndustryBatch(industryBatch);
|
industryBatchService.insertIndustryBatch(industryBatch);
|
||||||
|
insertBatchId = industryBatch.getId();
|
||||||
|
redis2Cache.setCacheObject("insertBatchId", insertBatchId,3000,TimeUnit.HOURS);
|
||||||
|
}
|
||||||
for (IndustryMaterialVo industryMaterialVo : industryMaterialVos) {
|
for (IndustryMaterialVo industryMaterialVo : industryMaterialVos) {
|
||||||
industryMaterialVo.setState(0L);
|
industryMaterialVo.setState(0L);
|
||||||
industryMaterialVo.setStepSize(null);
|
industryMaterialVo.setStepSize(null);
|
||||||
industryMaterialVo.setBatchId(industryBatch.getId());
|
industryMaterialVo.setBatchId(insertBatchId);
|
||||||
industryMaterialVo.setDelFlag(0L);
|
industryMaterialVo.setDelFlag(0L);
|
||||||
industryMaterialVo.setFinalDiameter(null);
|
industryMaterialVo.setFinalDiameter(null);
|
||||||
industryMaterialVo.setOperation(0L);
|
industryMaterialVo.setOperation(0L);
|
||||||
|
|||||||
@@ -398,6 +398,8 @@ public class IndustryStepServiceImpl implements IIndustryStepService {
|
|||||||
// 如果当前模式是4辊
|
// 如果当前模式是4辊
|
||||||
if ("1".equals(mode)) {
|
if ("1".equals(mode)) {
|
||||||
redisCache.deleteObject("materialLock");
|
redisCache.deleteObject("materialLock");
|
||||||
|
redis2Cache.deleteObject("insertBatchId");
|
||||||
|
redis2Cache.deleteObject("originBatchId");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果当前模式是2辊
|
// 如果当前模式是2辊
|
||||||
@@ -416,7 +418,9 @@ public class IndustryStepServiceImpl implements IIndustryStepService {
|
|||||||
industryMaterialVo.setBatchId(industryStep.getBatchId());
|
industryMaterialVo.setBatchId(industryStep.getBatchId());
|
||||||
industryMaterialVo.setState(6L);
|
industryMaterialVo.setState(6L);
|
||||||
List<IndustryMaterialVo> industryMaterialVos1 = industryMaterialMapper.selectIndustryMaterialList1(industryMaterialVo);
|
List<IndustryMaterialVo> industryMaterialVos1 = industryMaterialMapper.selectIndustryMaterialList1(industryMaterialVo);
|
||||||
String result = industryMaterialService.insertIndustryMaterialToSlaveDataSource(industryMaterialVos1);
|
Long insertBatchId = redis2Cache.getCacheObject("insertBatchId");
|
||||||
|
|
||||||
|
String result = industryMaterialService.insertIndustryMaterialToSlaveDataSource(industryMaterialVos1,Objects.nonNull(insertBatchId)?insertBatchId:null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -554,6 +558,8 @@ public class IndustryStepServiceImpl implements IIndustryStepService {
|
|||||||
// 如果当前模式是4辊
|
// 如果当前模式是4辊
|
||||||
if ("1".equals(mode)) {
|
if ("1".equals(mode)) {
|
||||||
redisCache.deleteObject("materialLock");
|
redisCache.deleteObject("materialLock");
|
||||||
|
redis2Cache.deleteObject("insertBatchId");
|
||||||
|
redis2Cache.deleteObject("originBatchId");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果当前模式是2辊
|
// 如果当前模式是2辊
|
||||||
@@ -593,7 +599,7 @@ public class IndustryStepServiceImpl implements IIndustryStepService {
|
|||||||
industryMaterialVo.setBatchId(industryStep.getBatchId());
|
industryMaterialVo.setBatchId(industryStep.getBatchId());
|
||||||
industryMaterialVo.setState(2L);
|
industryMaterialVo.setState(2L);
|
||||||
List<IndustryMaterialVo> industryMaterialVos = industryMaterialMapper.selectIndustryMaterialList1(industryMaterialVo);
|
List<IndustryMaterialVo> industryMaterialVos = industryMaterialMapper.selectIndustryMaterialList1(industryMaterialVo);
|
||||||
String result = industryMaterialService.insertIndustryMaterialToSlaveDataSource(industryMaterialVos);
|
String result = industryMaterialService.insertIndustryMaterialToSlaveDataSource(industryMaterialVos, null);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user