bug尝试修复
This commit is contained in:
@@ -236,9 +236,6 @@ public class IndustryMaterialController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 开始异常轧制接口
|
* 开始异常轧制接口
|
||||||
* 首先拿到道次最小的那个材料id
|
* 首先拿到道次最小的那个材料id
|
||||||
@@ -293,4 +290,20 @@ public class IndustryMaterialController extends BaseController
|
|||||||
industryMaterialService.deleteIndustryMaterialByState(0L);
|
industryMaterialService.deleteIndustryMaterialByState(0L);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/clear-system")
|
||||||
|
public void clearSystem(){
|
||||||
|
redisCache.deleteObject("sort");
|
||||||
|
redisCache.deleteObject("batchId");
|
||||||
|
redisCache.deleteObject("leftId");
|
||||||
|
redisCache.deleteObject("rightId");
|
||||||
|
if ("1".equals(mode)){
|
||||||
|
redisCache.deleteObject("materialLock");
|
||||||
|
}
|
||||||
|
s7PLC.writeString("DB4.30","\u0000\u0000\u0000\u0000");
|
||||||
|
s7PLC.writeString("DB44.30","\u0000\u0000\u0000\u0000");
|
||||||
|
industryMaterialService.deleteIndustryMaterialByState(1L);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -411,7 +411,7 @@ public class IndustryMaterialServiceImpl implements IIndustryMaterialService {
|
|||||||
|
|
||||||
Long flag = checkFirstOrLast(firstMaterial);
|
Long flag = checkFirstOrLast(firstMaterial);
|
||||||
|
|
||||||
// 记录materialFlag为升序
|
// 记录materialFlagError为升序
|
||||||
redisCache.setCacheObject("materialFlagError", flag, 100, TimeUnit.HOURS);
|
redisCache.setCacheObject("materialFlagError", flag, 100, TimeUnit.HOURS);
|
||||||
redisCache.setCacheObject("nextStepFlagError", 0L, 100, TimeUnit.HOURS);
|
redisCache.setCacheObject("nextStepFlagError", 0L, 100, TimeUnit.HOURS);
|
||||||
|
|
||||||
@@ -496,9 +496,9 @@ public class IndustryMaterialServiceImpl implements IIndustryMaterialService {
|
|||||||
public int checkFlagError(IndustryMaterialDto material) {
|
public int checkFlagError(IndustryMaterialDto material) {
|
||||||
IndustryMaterial industryMaterial = new IndustryMaterial();
|
IndustryMaterial industryMaterial = new IndustryMaterial();
|
||||||
industryMaterial.setBatchId(material.getBatchId());
|
industryMaterial.setBatchId(material.getBatchId());
|
||||||
Long state = material.getState();
|
//Long state = material.getState();
|
||||||
// 3代表的是该批次中存在道次异常,下面的查询时直接跳过这个批次
|
// 3代表的是该批次中存在道次异常,下面的查询时直接跳过这个批次
|
||||||
state = state == 3 ? 5 : state;
|
Long state = 5L;
|
||||||
// 查询下一个应该将operation改为 1 的批次 并且为同一状态
|
// 查询下一个应该将operation改为 1 的批次 并且为同一状态
|
||||||
industryMaterial.setState(state);
|
industryMaterial.setState(state);
|
||||||
List<IndustryMaterialVo> industryMaterialVos = industryMaterialMapper.selectIndustryMaterialList(industryMaterial);
|
List<IndustryMaterialVo> industryMaterialVos = industryMaterialMapper.selectIndustryMaterialList(industryMaterial);
|
||||||
@@ -532,7 +532,6 @@ public class IndustryMaterialServiceImpl implements IIndustryMaterialService {
|
|||||||
if (materialFlag == 0L) {
|
if (materialFlag == 0L) {
|
||||||
// 降序
|
// 降序
|
||||||
// 表示走到了最后一个了
|
// 表示走到了最后一个了
|
||||||
|
|
||||||
if (start == pos) {
|
if (start == pos) {
|
||||||
redisCache.setCacheObject("nextStepFlagError", 1L, 100, TimeUnit.HOURS);
|
redisCache.setCacheObject("nextStepFlagError", 1L, 100, TimeUnit.HOURS);
|
||||||
// 向上升并且已经升到头了
|
// 向上升并且已经升到头了
|
||||||
|
|||||||
@@ -179,16 +179,16 @@ public class IndustryStepServiceImpl implements IIndustryStepService {
|
|||||||
|
|
||||||
// TODO PLC
|
// TODO PLC
|
||||||
// 将切换道次改为true
|
// 将切换道次改为true
|
||||||
s7PLC.writeBoolean("DB15.1.2",true);
|
s7PLC.writeBoolean("DB15.1.2", true);
|
||||||
|
|
||||||
// 判断当前切换是否转化过来成true 没有则再发
|
// 判断当前切换是否转化过来成true 没有则再发
|
||||||
while (!s7PLC.readBoolean("DB15.1.2")){
|
while (!s7PLC.readBoolean("DB15.1.2")) {
|
||||||
Threads.sleep(500);
|
Threads.sleep(500);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 当当前的到此为true时候将其置 5s延迟 使其切换道次
|
// 当当前的到此为true时候将其置 5s延迟 使其切换道次
|
||||||
if (s7PLC.readBoolean("DB15.1.2")){
|
if (s7PLC.readBoolean("DB15.1.2")) {
|
||||||
|
|
||||||
Threads.sleep(5000);
|
Threads.sleep(5000);
|
||||||
// 更新该批次中的全部道次的 "操作中" 字段为0
|
// 更新该批次中的全部道次的 "操作中" 字段为0
|
||||||
@@ -223,18 +223,18 @@ public class IndustryStepServiceImpl implements IIndustryStepService {
|
|||||||
Long materialFlag = redisCache.getCacheObject("materialFlag");
|
Long materialFlag = redisCache.getCacheObject("materialFlag");
|
||||||
redisCache.setCacheObject("nextStepFlag", 0L, 100, TimeUnit.HOURS);
|
redisCache.setCacheObject("nextStepFlag", 0L, 100, TimeUnit.HOURS);
|
||||||
redisCache.setCacheObject("materialFlag", materialFlag == 1L ? 0L : 1L, 100, TimeUnit.HOURS);
|
redisCache.setCacheObject("materialFlag", materialFlag == 1L ? 0L : 1L, 100, TimeUnit.HOURS);
|
||||||
s7PLC.writeBoolean("DB15.1.2",false);
|
s7PLC.writeBoolean("DB15.1.2", false);
|
||||||
s7PLC.writeFloat32("DB15.118",industryStepVos.get(0).getSetValue().floatValue());
|
s7PLC.writeFloat32("DB15.118", industryStepVos.get(0).getSetValue().floatValue());
|
||||||
|
|
||||||
// 设定值确认
|
// 设定值确认
|
||||||
s7PLC.writeBoolean("DB15.0.3",true);
|
s7PLC.writeBoolean("DB15.0.3", true);
|
||||||
|
|
||||||
while (s7PLC.readBoolean("DB15.0.3")){
|
while (s7PLC.readBoolean("DB15.0.3")) {
|
||||||
s7PLC.writeBoolean("DB15.0.3",false);
|
s7PLC.writeBoolean("DB15.0.3", false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (s7PLC.readBoolean("DB15.1.2")){
|
while (s7PLC.readBoolean("DB15.1.2")) {
|
||||||
Threads.sleep(500);
|
Threads.sleep(500);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -254,16 +254,16 @@ public class IndustryStepServiceImpl implements IIndustryStepService {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 将切换道次改为true
|
s7PLC.writeBoolean("DB15.1.2", true);
|
||||||
s7PLC.writeBoolean("DB15.1.2",true);
|
|
||||||
|
|
||||||
// 判断当前切换是否转化过来成true 没有则再发
|
// 判断当前切换是否转化过来成true 没有则再发
|
||||||
while (!s7PLC.readBoolean("DB15.1.2")){
|
while (!s7PLC.readBoolean("DB15.1.2")) {
|
||||||
Threads.sleep(500);
|
Threads.sleep(500);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 当当前的到此为true时候将其置 5s延迟 使其切换道次
|
// 当当前的到此为true时候将其置 5s延迟 使其切换道次
|
||||||
if (s7PLC.readBoolean("DB15.1.2")){
|
if (s7PLC.readBoolean("DB15.1.2")) {
|
||||||
|
|
||||||
Threads.sleep(5000);
|
Threads.sleep(5000);
|
||||||
// 更新该批次中的全部道次的 "操作中" 字段为0
|
// 更新该批次中的全部道次的 "操作中" 字段为0
|
||||||
IndustryStep step = new IndustryStep();
|
IndustryStep step = new IndustryStep();
|
||||||
@@ -302,7 +302,7 @@ public class IndustryStepServiceImpl implements IIndustryStepService {
|
|||||||
|
|
||||||
Long materialFlagError = redisCache.getCacheObject("materialFlagError");
|
Long materialFlagError = redisCache.getCacheObject("materialFlagError");
|
||||||
redisCache.setCacheObject("nextStepFlagError", 0L, 100, TimeUnit.HOURS);
|
redisCache.setCacheObject("nextStepFlagError", 0L, 100, TimeUnit.HOURS);
|
||||||
redisCache.setCacheObject("materialFlagError", materialFlagError==1L?0L:1L, 100, TimeUnit.HOURS);
|
redisCache.setCacheObject("materialFlagError", materialFlagError == 1L ? 0L : 1L, 100, TimeUnit.HOURS);
|
||||||
|
|
||||||
s7PLC.writeBoolean("DB15.1.2", false);
|
s7PLC.writeBoolean("DB15.1.2", false);
|
||||||
|
|
||||||
@@ -314,10 +314,12 @@ public class IndustryStepServiceImpl implements IIndustryStepService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
while (s7PLC.readBoolean("DB15.1.2")) {
|
while (s7PLC.readBoolean("DB15.1.2")) {
|
||||||
Threads.sleep(500);
|
Threads.sleep(500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -337,10 +339,18 @@ public class IndustryStepServiceImpl implements IIndustryStepService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 将此值写入plc 为辊缝设定和设定输入
|
||||||
|
s7PLC.writeFloat32("DB15.118", smallStep.getSetValue().floatValue());
|
||||||
|
s7PLC.writeBoolean("DB15.0.3", true);
|
||||||
|
while (s7PLC.readBoolean("DB15.0.3")) {
|
||||||
|
s7PLC.writeBoolean("DB15.0.3", false);
|
||||||
|
}
|
||||||
|
|
||||||
industryStep.setStep(smallStep.getStep());
|
industryStep.setStep(smallStep.getStep());
|
||||||
industryStep.setOperation(1L);
|
industryStep.setOperation(1L);
|
||||||
industryStep.setState(null);
|
industryStep.setState(null);
|
||||||
industryStepMapper.updateAllIndustryStepByStep(industryStep);
|
industryStepMapper.updateAllIndustryStepByStep(industryStep);
|
||||||
|
|
||||||
return smallStep.getMaterialId();
|
return smallStep.getMaterialId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -355,7 +365,6 @@ public class IndustryStepServiceImpl implements IIndustryStepService {
|
|||||||
industryMaterialVo.setBatchId(batchId);
|
industryMaterialVo.setBatchId(batchId);
|
||||||
industryMaterialVo.setDelFlag(1L);
|
industryMaterialVo.setDelFlag(1L);
|
||||||
List<IndustryMaterialVo> industryMaterialVos = industryMaterialService.selectAbnormalList(industryMaterialVo);
|
List<IndustryMaterialVo> industryMaterialVos = industryMaterialService.selectAbnormalList(industryMaterialVo);
|
||||||
System.out.println(industryMaterialVos);
|
|
||||||
for (IndustryMaterialVo materialVo : industryMaterialVos) {
|
for (IndustryMaterialVo materialVo : industryMaterialVos) {
|
||||||
materialVo.setState(6L);
|
materialVo.setState(6L);
|
||||||
materialVo.setOperation(0L);
|
materialVo.setOperation(0L);
|
||||||
@@ -572,13 +581,11 @@ public class IndustryStepServiceImpl implements IIndustryStepService {
|
|||||||
@Override
|
@Override
|
||||||
public void start(IndustryStep industryStep) {
|
public void start(IndustryStep industryStep) {
|
||||||
List<IndustryStepVo> industryStepVos = industryStepMapper.selectIndustryStepList(industryStep);
|
List<IndustryStepVo> industryStepVos = industryStepMapper.selectIndustryStepList(industryStep);
|
||||||
|
if (!industryStepVos.isEmpty()) {
|
||||||
// TODO PLC
|
s7PLC.writeFloat32("DB15.118", industryStepVos.get(0).getSetValue().floatValue());
|
||||||
if (!industryStepVos.isEmpty()){
|
s7PLC.writeBoolean("DB15.0.3", true);
|
||||||
s7PLC.writeFloat32("DB15.118",industryStepVos.get(0).getSetValue().floatValue());
|
while (s7PLC.readBoolean("DB15.0.3")) {
|
||||||
s7PLC.writeBoolean("DB15.0.3",true);
|
s7PLC.writeBoolean("DB15.0.3", false);
|
||||||
while (s7PLC.readBoolean("DB15.0.3")){
|
|
||||||
s7PLC.writeBoolean("DB15.0.3",false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
industryStep.setOperation(1L);
|
industryStep.setOperation(1L);
|
||||||
|
|||||||
@@ -109,7 +109,7 @@
|
|||||||
<select id="finishCheck" resultType="java.lang.Long">
|
<select id="finishCheck" resultType="java.lang.Long">
|
||||||
select count(*)
|
select count(*)
|
||||||
from industry_step step
|
from industry_step step
|
||||||
left join industry.industry_material im on step.material_id = im.id
|
left join industry_material im on step.material_id = im.id
|
||||||
where step.state = 0
|
where step.state = 0
|
||||||
and step.del_flag=0
|
and step.del_flag=0
|
||||||
and step.batch_id = #{batchId}
|
and step.batch_id = #{batchId}
|
||||||
@@ -120,7 +120,7 @@
|
|||||||
<select id="finishCheckAbnormal" resultType="java.lang.Long">
|
<select id="finishCheckAbnormal" resultType="java.lang.Long">
|
||||||
select count(*)
|
select count(*)
|
||||||
from industry_step step
|
from industry_step step
|
||||||
left join industry.industry_material im on step.material_id = im.id
|
left join industry_material im on step.material_id = im.id
|
||||||
where step.state = 0
|
where step.state = 0
|
||||||
and step.del_flag=1
|
and step.del_flag=1
|
||||||
and step.batch_id = #{batchId}
|
and step.batch_id = #{batchId}
|
||||||
|
|||||||
Reference in New Issue
Block a user