修复bug
This commit is contained in:
@@ -136,4 +136,7 @@ public interface IIndustryMaterialService
|
||||
int toCheckErrorMaterial(List<IndustryMaterialVo> successList);
|
||||
|
||||
int delIndustryMaterialById(String id);
|
||||
|
||||
void clearSystem();
|
||||
|
||||
}
|
||||
|
||||
@@ -121,8 +121,7 @@ public class IndustryMaterialServiceImpl implements IIndustryMaterialService {
|
||||
@DataSource(value = DataSourceType.SLAVE)
|
||||
public String insertIndustryMaterialToSlaveDataSource(List<IndustryMaterialVo> industryMaterialVos) {
|
||||
|
||||
// 直接删掉扫入并且未轧制的,写入二辊数据到四辊机器里面
|
||||
clearSystem();
|
||||
|
||||
// TODO 这里需要查一下数据库查看是否有正在轧或者说是未轧的情况 state=1,3,4
|
||||
List<IndustryMaterialVo> industryMaterialVos1 = industryMaterialMapper.selectIndustryMaterialListAndNotFinish();
|
||||
|
||||
@@ -309,7 +308,6 @@ public class IndustryMaterialServiceImpl implements IIndustryMaterialService {
|
||||
for (IndustryMaterialVo industryMaterialVo : industryMaterialVos) {
|
||||
if (Objects.nonNull(industryMaterialVo.getId())) {
|
||||
industryMaterialMapper.submitMaterial(industryMaterialVo);
|
||||
|
||||
// 将异常的道次恢复成初始料
|
||||
IndustryStep industryStep = new IndustryStep();
|
||||
industryStep.setBatchId(industryMaterialVo.getBatchId());
|
||||
@@ -988,7 +986,7 @@ public class IndustryMaterialServiceImpl implements IIndustryMaterialService {
|
||||
|
||||
|
||||
@DataSource(value = DataSourceType.SLAVE)
|
||||
private void clearSystem() {
|
||||
public void clearSystem() {
|
||||
redis2Cache.deleteObject("sort");
|
||||
redis2Cache.deleteObject("batchId");
|
||||
redis2Cache.deleteObject("leftId");
|
||||
|
||||
@@ -407,14 +407,16 @@ public class IndustryStepServiceImpl implements IIndustryStepService {
|
||||
if (Objects.isNull(materialLock) || materialLock != 0L) {
|
||||
// 如果是空就写一个1进去占住锁
|
||||
redis2Cache.setCacheObject("materialLock", 1L);
|
||||
Long originBatchId = redis2Cache.getCacheObject("originBatchId");
|
||||
if (Objects.isNull(originBatchId) || !originBatchId.equals(industryStep.getBatchId())) {
|
||||
industryMaterialService.clearSystem();
|
||||
}
|
||||
// 然后把非异常的东西都赛里面
|
||||
industryMaterialVo = new IndustryMaterialVo();
|
||||
industryMaterialVo.setBatchId(industryStep.getBatchId());
|
||||
industryMaterialVo.setState(6L);
|
||||
List<IndustryMaterialVo> industryMaterialVos1 = industryMaterialMapper.selectIndustryMaterialList1(industryMaterialVo);
|
||||
String result = industryMaterialService.insertIndustryMaterialToSlaveDataSource(industryMaterialVos1);
|
||||
|
||||
System.out.println(result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -580,14 +582,19 @@ public class IndustryStepServiceImpl implements IIndustryStepService {
|
||||
}
|
||||
if (Objects.isNull(materialLock) || materialLock != 0L) {
|
||||
|
||||
|
||||
// 如果是空就写一个1进去占住锁
|
||||
redis2Cache.setCacheObject("materialLock", 1L, 3000, TimeUnit.HOURS);
|
||||
redis2Cache.setCacheObject("originBatchId", industryStep.getBatchId(), 3000, TimeUnit.HOURS);
|
||||
// 然后把非异常的东西都赛里面
|
||||
// 直接删掉扫入并且未轧制的,写入二辊数据到四辊机器里面
|
||||
industryMaterialService.clearSystem();
|
||||
IndustryMaterialVo industryMaterialVo = new IndustryMaterialVo();
|
||||
industryMaterialVo.setBatchId(industryStep.getBatchId());
|
||||
industryMaterialVo.setState(2L);
|
||||
List<IndustryMaterialVo> industryMaterialVos = industryMaterialMapper.selectIndustryMaterialList1(industryMaterialVo);
|
||||
String result = industryMaterialService.insertIndustryMaterialToSlaveDataSource(industryMaterialVos);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user