bug尝试修复

This commit is contained in:
2025-07-14 17:59:01 +08:00
parent c25bb6135f
commit 68c4320a58
3 changed files with 11 additions and 10 deletions

View File

@@ -233,7 +233,7 @@ public class IndustryMaterialServiceImpl implements IIndustryMaterialService {
redisCache.setCacheObject("materialFlag", 1L, 100, TimeUnit.HOURS);
redisCache.setCacheObject("nextStepFlag", 0L, 100, TimeUnit.HOURS);
// TODO PLC
// TODO MOM
// for (IndustryMaterialVo industryMaterialVo : industryMaterialVos) {
// MomResource momResource = getMomResource(industryMaterialVo);
// momService.processPowerOn(momResource);
@@ -411,7 +411,7 @@ public class IndustryMaterialServiceImpl implements IIndustryMaterialService {
Long flag = checkFirstOrLast(firstMaterial);
// 记录materialFlagError为升序
// 记录 materialFlagError 为升序
redisCache.setCacheObject("materialFlagError", flag, 100, TimeUnit.HOURS);
redisCache.setCacheObject("nextStepFlagError", 0L, 100, TimeUnit.HOURS);
@@ -527,9 +527,9 @@ public class IndustryMaterialServiceImpl implements IIndustryMaterialService {
}
}
Long materialFlag = redisCache.getCacheObject("materialFlagError");
Long materialFlagError = redisCache.getCacheObject("materialFlagError");
// 处理是向上走还是向下走
if (materialFlag == 0L) {
if (materialFlagError == 0L) {
// 降序
// 表示走到了最后一个了
if (start == pos) {
@@ -588,10 +588,10 @@ public class IndustryMaterialServiceImpl implements IIndustryMaterialService {
industryMaterialDto.setOperation(0L);
updateIndustryMaterial(industryMaterialDto);
IndustryMaterialVo industryMaterialVo;
Long materialFlag = redisCache.getCacheObject("materialFlagError");
Long materialFlagError = redisCache.getCacheObject("materialFlagError");
// 处理是向上走还是向下走
int next = -1;
if (materialFlag == 0L) {
if (materialFlagError == 0L) {
// 找到上一个正常的
for (int i = pos - 1; i >= 0; i--) {
if (industryMaterialVos.get(i).getState() == 5L && industryMaterialVos.get(i).getIndustryStepVo().getState() == 0L) {
@@ -850,6 +850,7 @@ public class IndustryMaterialServiceImpl implements IIndustryMaterialService {
private Long checkFirstOrLast(IndustryMaterialVo firstMaterial) {
IndustryMaterialVo industryMaterialVo = new IndustryMaterialVo();
industryMaterialVo.setState(firstMaterial.getState());
industryMaterialVo.setBatchId(firstMaterial.getBatchId());
List<IndustryMaterialVo> industryMaterialVos = selectAbnormalList(industryMaterialVo);
int pos = -1;

View File

@@ -301,8 +301,9 @@ public class IndustryStepServiceImpl implements IIndustryStepService {
s7PLC.writeInt32("M854", Math.toIntExact(num - newStep));
Long materialFlagError = redisCache.getCacheObject("materialFlagError");
long safeFlag = (materialFlagError != null && materialFlagError == 1L) ? 0L : 1L;
redisCache.setCacheObject("nextStepFlagError", 0L, 100, TimeUnit.HOURS);
redisCache.setCacheObject("materialFlagError", materialFlagError == 1L ? 0L : 1L, 100, TimeUnit.HOURS);
redisCache.setCacheObject("materialFlagError", safeFlag, 100, TimeUnit.HOURS);
s7PLC.writeBoolean("DB15.1.2", false);

View File

@@ -70,8 +70,8 @@
<if test="angle != null ">and angle = #{angle}</if>
<if test="operation != null ">and operation = #{operation}</if>
<if test="state != null ">and state = #{state}</if>
<if test="materialId != null and materialId != ''">and material_id = #{materialId}</if>
<if test="batchId != null and batchId != ''">and batch_id = #{batchId}</if>
<if test="materialId != null">and material_id = #{materialId}</if>
<if test="batchId != null">and batch_id = #{batchId}</if>
</where>
order by step
</select>
@@ -224,7 +224,6 @@
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
</trim>
<where>