变更
This commit is contained in:
@@ -18,6 +18,7 @@ import com.industry.work.domain.dto.IndustryMaterialDto;
|
|||||||
import com.industry.work.domain.vo.IndustryMaterialVo;
|
import com.industry.work.domain.vo.IndustryMaterialVo;
|
||||||
import com.industry.work.service.IIndustryMaterialService;
|
import com.industry.work.service.IIndustryMaterialService;
|
||||||
import com.industry.work.service.IIndustryStepService;
|
import com.industry.work.service.IIndustryStepService;
|
||||||
|
import com.industry.work.service.IMomService;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -53,6 +54,9 @@ public class IndustryMaterialController extends BaseController
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IIndustryStepService industryStepService;
|
private IIndustryStepService industryStepService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IMomService momService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -216,7 +220,7 @@ public class IndustryMaterialController extends BaseController
|
|||||||
}
|
}
|
||||||
industryMaterialService.updateIndustryMaterial(industryMaterial);
|
industryMaterialService.updateIndustryMaterial(industryMaterial);
|
||||||
// TODO 加入ip地址请求
|
// TODO 加入ip地址请求
|
||||||
// HttpUtils.dataPost()
|
momService.processPowerDown(industryMaterial);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -178,7 +178,8 @@ public class IndustryStepController extends BaseController
|
|||||||
@GetMapping("/check/{batchId}")
|
@GetMapping("/check/{batchId}")
|
||||||
public AjaxResult check(@PathVariable Long batchId)
|
public AjaxResult check(@PathVariable Long batchId)
|
||||||
{
|
{
|
||||||
return AjaxResult.success(industryStepService.finishCheck(batchId));
|
Long result = industryStepService.finishCheck(batchId);
|
||||||
|
return AjaxResult.success(result);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 结束检查
|
* 结束检查
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ spring:
|
|||||||
enabled: false
|
enabled: false
|
||||||
url: jdbc:mysql://localhost:3306/industry2?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
url: jdbc:mysql://localhost:3306/industry2?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
username: root
|
username: root
|
||||||
password: WANGyu11!
|
password: root
|
||||||
# 初始连接数
|
# 初始连接数
|
||||||
initialSize: 5
|
initialSize: 5
|
||||||
# 最小连接池数量
|
# 最小连接池数量
|
||||||
|
|||||||
@@ -145,3 +145,5 @@ xss:
|
|||||||
|
|
||||||
ipAddress: 10.20.10.29
|
ipAddress: 10.20.10.29
|
||||||
|
|
||||||
|
httpIp: http://10.20.10.158
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
package com.industry.work.domain;
|
package com.industry.work.domain;
|
||||||
|
|
||||||
import com.industry.common.core.domain.BaseEntity;
|
import com.industry.common.core.domain.BaseEntity;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import com.industry.common.annotation.Excel;
|
import com.industry.common.annotation.Excel;
|
||||||
@@ -10,58 +11,95 @@ import com.industry.common.annotation.Excel;
|
|||||||
* @date 2024-06-07
|
* @date 2024-06-07
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class IndustryMaterial extends BaseEntity
|
public class IndustryMaterial extends BaseEntity {
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/** 主键id批号 */
|
/**
|
||||||
|
* 主键id批号
|
||||||
|
*/
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
/** 规格 */
|
/**
|
||||||
|
* 规格
|
||||||
|
*/
|
||||||
@Excel(name = "规格")
|
@Excel(name = "规格")
|
||||||
private String specification;
|
private String specification;
|
||||||
|
|
||||||
/** 工艺 */
|
/**
|
||||||
|
* 工艺
|
||||||
|
*/
|
||||||
@Excel(name = "工艺")
|
@Excel(name = "工艺")
|
||||||
private String technology;
|
private String technology;
|
||||||
|
|
||||||
/** 是否正在操作 */
|
/**
|
||||||
|
* 是否正在操作
|
||||||
|
*/
|
||||||
@Excel(name = "是否正在操作")
|
@Excel(name = "是否正在操作")
|
||||||
private Long operation;
|
private Long operation;
|
||||||
|
|
||||||
/** 直径 */
|
/**
|
||||||
|
* 直径
|
||||||
|
*/
|
||||||
@Excel(name = "直径")
|
@Excel(name = "直径")
|
||||||
private Double diameter;
|
private Double diameter;
|
||||||
|
|
||||||
/** 该批次的道次数量 */
|
/**
|
||||||
|
* 该批次的道次数量
|
||||||
|
*/
|
||||||
@Excel(name = "该批次的道次数量")
|
@Excel(name = "该批次的道次数量")
|
||||||
private Long stepSize;
|
private Long stepSize;
|
||||||
|
|
||||||
/** 批次号 */
|
/**
|
||||||
|
* 批次号
|
||||||
|
*/
|
||||||
@Excel(name = "批次号")
|
@Excel(name = "批次号")
|
||||||
private Long batchId;
|
private Long batchId;
|
||||||
|
|
||||||
/** 序号 */
|
/**
|
||||||
|
* 序号
|
||||||
|
*/
|
||||||
@Excel(name = "序号")
|
@Excel(name = "序号")
|
||||||
private Long sort;
|
private Long sort;
|
||||||
|
|
||||||
/** 最大轧制力 */
|
/**
|
||||||
|
* 最大轧制力
|
||||||
|
*/
|
||||||
private Double width;
|
private Double width;
|
||||||
|
|
||||||
|
|
||||||
/** 删除标志 */
|
/**
|
||||||
|
* 删除标志
|
||||||
|
*/
|
||||||
private Long delFlag;
|
private Long delFlag;
|
||||||
|
|
||||||
/** 0未提交1提交2完成3此批次中存在道次异常 */
|
/**
|
||||||
|
* 0未提交1提交2完成3此批次中存在道次异常
|
||||||
|
*/
|
||||||
private Long state;
|
private Long state;
|
||||||
|
|
||||||
/** 最终厚度 */
|
/**
|
||||||
|
* 最终厚度
|
||||||
|
*/
|
||||||
private Double finalWidth;
|
private Double finalWidth;
|
||||||
|
|
||||||
/** 最终直径 */
|
/**
|
||||||
|
* 最终直径
|
||||||
|
*/
|
||||||
private Double finalDiameter;
|
private Double finalDiameter;
|
||||||
|
|
||||||
/** 最大轧制力 */
|
/**
|
||||||
|
* 最终厚度2
|
||||||
|
*/
|
||||||
|
private Double finalWidth2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最终直径2
|
||||||
|
*/
|
||||||
|
private Double finalDiameter2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最大轧制力
|
||||||
|
*/
|
||||||
private Double weight;
|
private Double weight;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package com.industry.work.domain;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class MomResource {
|
||||||
|
|
||||||
|
// 物料id
|
||||||
|
private String ticketNo;
|
||||||
|
|
||||||
|
// 设备编号
|
||||||
|
private String devicesCode;
|
||||||
|
|
||||||
|
// 接收时间
|
||||||
|
private Date receiveTime;
|
||||||
|
|
||||||
|
// 上机时间
|
||||||
|
private Date powerOnTime;
|
||||||
|
|
||||||
|
// 接收人
|
||||||
|
private String receiveUser;
|
||||||
|
|
||||||
|
// 上机人
|
||||||
|
private String powerOnUser;
|
||||||
|
|
||||||
|
// 工艺
|
||||||
|
private String processSide;
|
||||||
|
|
||||||
|
// 接口调用方
|
||||||
|
private String caller;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -74,9 +74,9 @@ public interface IndustryStepMapper
|
|||||||
/**
|
/**
|
||||||
* 检擦是否有道次未处理
|
* 检擦是否有道次未处理
|
||||||
* @return
|
* @return
|
||||||
* @param industryStep
|
* @param batchId
|
||||||
*/
|
*/
|
||||||
int finishCheck(IndustryStep industryStep);
|
Long finishCheck(@Param("batchId") Long batchId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询异常
|
* 查询异常
|
||||||
@@ -86,7 +86,7 @@ public interface IndustryStepMapper
|
|||||||
|
|
||||||
int delAbnormalData(String id);
|
int delAbnormalData(String id);
|
||||||
|
|
||||||
int finishCheckAbnormal(String id);
|
Long finishCheckAbnormal(@Param("batchId") Long batchId);
|
||||||
|
|
||||||
int delAbnormalDataByMaterialId(String materialId);
|
int delAbnormalDataByMaterialId(String materialId);
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import java.util.List;
|
|||||||
import com.industry.common.plc.PLCSystemData;
|
import com.industry.common.plc.PLCSystemData;
|
||||||
import com.industry.work.domain.IndustryMaterial;
|
import com.industry.work.domain.IndustryMaterial;
|
||||||
import com.industry.work.domain.IndustryStep;
|
import com.industry.work.domain.IndustryStep;
|
||||||
import com.industry.work.domain.PLCData;
|
|
||||||
import com.industry.work.domain.vo.IndustryStepVo;
|
import com.industry.work.domain.vo.IndustryStepVo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -71,11 +70,6 @@ public interface IIndustryStepService
|
|||||||
*/
|
*/
|
||||||
List<IndustryStepVo> selectIndustryStepListByProcess(IndustryStep industryStep);
|
List<IndustryStepVo> selectIndustryStepListByProcess(IndustryStep industryStep);
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取plc中实时出现的数据将其存入redis中
|
|
||||||
*/
|
|
||||||
public void getProcessingPLCData();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 下道次
|
* 下道次
|
||||||
* @param industryStep
|
* @param industryStep
|
||||||
@@ -83,7 +77,7 @@ public interface IIndustryStepService
|
|||||||
*/
|
*/
|
||||||
String nextStep(IndustryStep industryStep);
|
String nextStep(IndustryStep industryStep);
|
||||||
|
|
||||||
String finish(Long batchId);
|
int finish(Long batchId);
|
||||||
|
|
||||||
List<IndustryStepVo> getAbnormalData();
|
List<IndustryStepVo> getAbnormalData();
|
||||||
|
|
||||||
@@ -91,9 +85,9 @@ public interface IIndustryStepService
|
|||||||
|
|
||||||
PLCSystemData getPLCData(IndustryStep industryStep);
|
PLCSystemData getPLCData(IndustryStep industryStep);
|
||||||
|
|
||||||
String finishCheck(Long batchId);
|
Long finishCheck(Long batchId);
|
||||||
|
|
||||||
String finishCheckAbnormal(Long batchId);
|
Long finishCheckAbnormal(Long batchId);
|
||||||
|
|
||||||
|
|
||||||
int createStep(IndustryMaterial industryMaterial);
|
int createStep(IndustryMaterial industryMaterial);
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.industry.work.service;
|
||||||
|
|
||||||
|
import com.industry.work.domain.IndustryMaterial;
|
||||||
|
import com.industry.work.domain.MomResource;
|
||||||
|
|
||||||
|
public interface IMomService {
|
||||||
|
|
||||||
|
public void processPowerOn(MomResource momResource);
|
||||||
|
|
||||||
|
void processPowerDown(IndustryMaterial industryMaterial);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package com.industry.work.service.impl;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
@@ -17,12 +18,14 @@ import com.industry.common.utils.DateUtils;
|
|||||||
import com.industry.common.utils.MathUtils;
|
import com.industry.common.utils.MathUtils;
|
||||||
import com.industry.work.domain.IndustryBatch;
|
import com.industry.work.domain.IndustryBatch;
|
||||||
import com.industry.work.domain.IndustryMaterial;
|
import com.industry.work.domain.IndustryMaterial;
|
||||||
|
import com.industry.work.domain.MomResource;
|
||||||
import com.industry.work.domain.dto.IndustryMaterialDto;
|
import com.industry.work.domain.dto.IndustryMaterialDto;
|
||||||
import com.industry.work.domain.vo.IndustryBatchVo;
|
import com.industry.work.domain.vo.IndustryBatchVo;
|
||||||
import com.industry.work.domain.vo.IndustryMaterialVo;
|
import com.industry.work.domain.vo.IndustryMaterialVo;
|
||||||
import com.industry.work.mapper.IndustryMaterialMapper;
|
import com.industry.work.mapper.IndustryMaterialMapper;
|
||||||
import com.industry.work.service.IIndustryBatchService;
|
import com.industry.work.service.IIndustryBatchService;
|
||||||
import com.industry.work.service.IIndustryMaterialService;
|
import com.industry.work.service.IIndustryMaterialService;
|
||||||
|
import com.industry.work.service.IMomService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -46,6 +49,9 @@ public class IndustryMaterialServiceImpl implements IIndustryMaterialService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private RedisCache redisCache;
|
private RedisCache redisCache;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IMomService momService;
|
||||||
|
|
||||||
@Value("${ipAddress}")
|
@Value("${ipAddress}")
|
||||||
private String ipAddress;
|
private String ipAddress;
|
||||||
|
|
||||||
@@ -220,20 +226,43 @@ public class IndustryMaterialServiceImpl implements IIndustryMaterialService {
|
|||||||
// 提醒前端已经开始了,无需重新开始
|
// 提醒前端已经开始了,无需重新开始
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 到这里没有return出去 表示该批次未开始
|
// 到这里没有return出去 表示该批次未开始
|
||||||
// 拿到序号为第一的将其操作中设置成1
|
// 拿到序号为第一的将其操作中设置成1
|
||||||
firstMaterial.setOperation(1L);
|
firstMaterial.setOperation(1L);
|
||||||
updateIndustryMaterial(firstMaterial);
|
updateIndustryMaterial(firstMaterial);
|
||||||
|
|
||||||
// 记录materialFlag为升序
|
// 记录materialFlag为升序
|
||||||
redisCache.setCacheObject("materialFlag", 1L, 100, TimeUnit.HOURS);
|
redisCache.setCacheObject("materialFlag", 1L, 100, TimeUnit.HOURS);
|
||||||
redisCache.setCacheObject("nextStepFlag", 0L, 100, TimeUnit.HOURS);
|
redisCache.setCacheObject("nextStepFlag", 0L, 100, TimeUnit.HOURS);
|
||||||
|
|
||||||
|
for (IndustryMaterialVo industryMaterialVo : industryMaterialVos) {
|
||||||
|
MomResource momResource = getMomResource(industryMaterialVo);
|
||||||
|
momService.processPowerOn(momResource);
|
||||||
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private MomResource getMomResource(IndustryMaterialVo industryMaterialVo) {
|
||||||
|
MomResource momResource = new MomResource();
|
||||||
|
|
||||||
|
momResource.setTicketNo(industryMaterialVo.getId());
|
||||||
|
momResource.setReceiveTime(new Date());
|
||||||
|
momResource.setPowerOnTime(new Date());
|
||||||
|
momResource.setCaller("ZJ");
|
||||||
|
momResource.setReceiveUser("wang");
|
||||||
|
momResource.setPowerOnUser("wang");
|
||||||
|
|
||||||
|
if ("1".equals(mode)) {
|
||||||
|
// 精轧
|
||||||
|
momResource.setDevicesCode("00401020934");
|
||||||
|
}else{
|
||||||
|
// 粗轧
|
||||||
|
momResource.setDevicesCode("00401020935");
|
||||||
|
}
|
||||||
|
momResource.setProcessSide(mode);
|
||||||
|
return momResource;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public String nextMaterial(IndustryMaterialDto industryMaterialDto) {
|
public String nextMaterial(IndustryMaterialDto industryMaterialDto) {
|
||||||
@@ -426,13 +455,11 @@ public class IndustryMaterialServiceImpl implements IIndustryMaterialService {
|
|||||||
pos = i;
|
pos = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Long materialFlag = redisCache.getCacheObject("materialFlag");
|
Long materialFlag = redisCache.getCacheObject("materialFlag");
|
||||||
// 处理是向上走还是向下走
|
// 处理是向上走还是向下走
|
||||||
if (materialFlag == 0L) {
|
if (materialFlag == 0L) {
|
||||||
// 降序
|
// 降序
|
||||||
// 表示走到了最后一个了
|
// 表示走到了最后一个了
|
||||||
|
|
||||||
if (start == pos) {
|
if (start == pos) {
|
||||||
// 向上升并且已经升到头了
|
// 向上升并且已经升到头了
|
||||||
redisCache.setCacheObject("nextStepFlag", 1L, 100, TimeUnit.HOURS);
|
redisCache.setCacheObject("nextStepFlag", 1L, 100, TimeUnit.HOURS);
|
||||||
@@ -444,7 +471,6 @@ public class IndustryMaterialServiceImpl implements IIndustryMaterialService {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
redisCache.setCacheObject("nextStepFlag", 0L, 100, TimeUnit.HOURS);
|
redisCache.setCacheObject("nextStepFlag", 0L, 100, TimeUnit.HOURS);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.industry.work.service.impl;
|
package com.industry.work.service.impl;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
@@ -18,7 +17,6 @@ import com.industry.work.domain.IndustryMaterial;
|
|||||||
import com.industry.work.domain.IndustryStep;
|
import com.industry.work.domain.IndustryStep;
|
||||||
import com.industry.work.domain.IndustryTechnology;
|
import com.industry.work.domain.IndustryTechnology;
|
||||||
|
|
||||||
import com.industry.work.domain.vo.IndustryBatchVo;
|
|
||||||
import com.industry.work.domain.vo.IndustryMaterialVo;
|
import com.industry.work.domain.vo.IndustryMaterialVo;
|
||||||
import com.industry.work.domain.vo.IndustryStepVo;
|
import com.industry.work.domain.vo.IndustryStepVo;
|
||||||
import com.industry.work.domain.vo.IndustryTechnologyVo;
|
import com.industry.work.domain.vo.IndustryTechnologyVo;
|
||||||
@@ -220,24 +218,19 @@ public class IndustryStepServiceImpl implements IIndustryStepService {
|
|||||||
return "2";
|
return "2";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 如果不为0 说明该批次依然有道次未处理
|
// 如果不为0 说明该批次依然有道次未处理
|
||||||
// 获取第一个 将其operation改为1
|
// 获取第一个 将其operation改为1
|
||||||
industryStep1.setOperation(1L);
|
industryStep1.setOperation(1L);
|
||||||
// 更新一下下一步的状态
|
// 更新一下下一步的状态
|
||||||
industryStepMapper.updateIndustryStepByBatchId(industryStep1);
|
industryStepMapper.updateIndustryStepByBatchId(industryStep1);
|
||||||
|
|
||||||
|
|
||||||
// TODO 向plc发送当前道次
|
// TODO 向plc发送当前道次
|
||||||
s7PLC2.writeInt32("DB16.0", Math.toIntExact(newStep));
|
s7PLC2.writeInt32("DB16.0", Math.toIntExact(newStep));
|
||||||
// 当前厚度
|
// 当前厚度
|
||||||
// s7PLC2.writeFloat32("DB16.6", industryStepVos.get(0).get);
|
// s7PLC2.writeFloat32("DB16.6", industryStepVos.get(0).get);
|
||||||
//以及剩余道次
|
//以及剩余道次
|
||||||
Long num = industryStepMapper.selectMaxStepNum(industryStep.getBatchId());
|
Long num = industryStepMapper.selectMaxStepNum(industryStep.getBatchId());
|
||||||
s7PLC2.writeInt32("M854", Math.toIntExact(num - newStep));
|
s7PLC2.writeInt32("M854", Math.toIntExact(num - newStep));
|
||||||
|
|
||||||
redisCache.setCacheObject("nextStepFlag", 0L, 100, TimeUnit.HOURS);
|
redisCache.setCacheObject("nextStepFlag", 0L, 100, TimeUnit.HOURS);
|
||||||
|
|
||||||
s7PLC2.writeBoolean("DB15.1.2",false);
|
s7PLC2.writeBoolean("DB15.1.2",false);
|
||||||
s7PLC2.writeFloat32("DB15.118",industryStepVos.get(0).getSetValue().floatValue());
|
s7PLC2.writeFloat32("DB15.118",industryStepVos.get(0).getSetValue().floatValue());
|
||||||
s7PLC2.writeBoolean("DB15.0.3",true);
|
s7PLC2.writeBoolean("DB15.0.3",true);
|
||||||
@@ -245,21 +238,14 @@ public class IndustryStepServiceImpl implements IIndustryStepService {
|
|||||||
while (s7PLC2.readBoolean("DB15.0.3")){
|
while (s7PLC2.readBoolean("DB15.0.3")){
|
||||||
s7PLC2.writeBoolean("DB15.0.3",false);
|
s7PLC2.writeBoolean("DB15.0.3",false);
|
||||||
}
|
}
|
||||||
// if (Objects.equals(mode, "0")){
|
|
||||||
// s7PLC.writeInt32("M200",5*200);
|
|
||||||
// }else{
|
|
||||||
// s7PLC.writeInt32("M200",5*333);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while (s7PLC2.readBoolean("DB15.1.2")){
|
while (s7PLC2.readBoolean("DB15.1.2")){
|
||||||
Threads.sleep(500);
|
Threads.sleep(500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
s7PLC2.close();
|
s7PLC2.close();
|
||||||
|
|
||||||
|
|
||||||
return "1";
|
return "1";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,7 +276,7 @@ public class IndustryStepServiceImpl implements IIndustryStepService {
|
|||||||
industryStep1.setDelFlag(1L);
|
industryStep1.setDelFlag(1L);
|
||||||
// 查询下一步还有没有
|
// 查询下一步还有没有
|
||||||
List<IndustryStepVo> industryStepVos = industryStepMapper.selectErrorIndustryStepList(industryStep1);
|
List<IndustryStepVo> industryStepVos = industryStepMapper.selectErrorIndustryStepList(industryStep1);
|
||||||
if (industryStepVos.size() == 0) {
|
if (industryStepVos.isEmpty()) {
|
||||||
// 等于0说明没有下一步了 通知前端处理下一批
|
// 等于0说明没有下一步了 通知前端处理下一批
|
||||||
return "2";
|
return "2";
|
||||||
}
|
}
|
||||||
@@ -323,12 +309,6 @@ public class IndustryStepServiceImpl implements IIndustryStepService {
|
|||||||
while (s7PLC.readBoolean("DB15.0.3")){
|
while (s7PLC.readBoolean("DB15.0.3")){
|
||||||
s7PLC.writeBoolean("DB15.0.3",false);
|
s7PLC.writeBoolean("DB15.0.3",false);
|
||||||
}
|
}
|
||||||
//
|
|
||||||
// if (Objects.equals(mode, "0")){
|
|
||||||
// s7PLC.writeInt32("M200",5*200);
|
|
||||||
// }else{
|
|
||||||
// s7PLC.writeInt32("M200",5*333);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -378,7 +358,6 @@ public class IndustryStepServiceImpl implements IIndustryStepService {
|
|||||||
industryMaterialService.updateIndustryMaterial(materialVo);
|
industryMaterialService.updateIndustryMaterial(materialVo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 将该批次所有的道次的进行中置零
|
// 将该批次所有的道次的进行中置零
|
||||||
IndustryStep industryStep = new IndustryStep();
|
IndustryStep industryStep = new IndustryStep();
|
||||||
industryStep.setOperation(0L);
|
industryStep.setOperation(0L);
|
||||||
@@ -411,44 +390,24 @@ public class IndustryStepServiceImpl implements IIndustryStepService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数量
|
||||||
|
* @param batchId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String finishCheck(Long batchId) {
|
public Long finishCheck(Long batchId) {
|
||||||
|
return industryStepMapper.finishCheck(batchId);
|
||||||
// 返回非异常列表
|
|
||||||
List<IndustryMaterialVo> industryMaterialVos = industryMaterialService.selectIndustryMaterialByBatchId(batchId);
|
|
||||||
int count = 0;
|
|
||||||
for (IndustryMaterialVo industryMaterialVo : industryMaterialVos) {
|
|
||||||
IndustryStep industryStep = new IndustryStep();
|
|
||||||
industryStep.setMaterialId(industryMaterialVo.getId());
|
|
||||||
industryStep.setBatchId(batchId);
|
|
||||||
int i = industryStepMapper.finishCheck(industryStep);
|
|
||||||
|
|
||||||
count += i;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// -1 表示全部结束
|
|
||||||
return count > 0 ? "1" : "-1";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String finishCheckAbnormal(Long batchId) {
|
public Long finishCheckAbnormal(Long batchId) {
|
||||||
// 返回异常列表
|
return industryStepMapper.finishCheckAbnormal(batchId);
|
||||||
List<IndustryMaterialVo> industryMaterialVos = industryMaterialService.selectIndustryAbnormalMaterialByBatchId(batchId);
|
|
||||||
int count = 0;
|
|
||||||
for (IndustryMaterialVo industryMaterialVo : industryMaterialVos) {
|
|
||||||
|
|
||||||
int i = industryStepMapper.finishCheckAbnormal(industryMaterialVo.getId());
|
|
||||||
count += i;
|
|
||||||
}
|
|
||||||
// -1 表示全部结束
|
|
||||||
return count > 0 ? "1" : "-1";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int createStep(IndustryMaterial industryMaterial) {
|
public int createStep(IndustryMaterial industryMaterial) {
|
||||||
String success = industryMaterialService.resourceToWorkAndCreateStep(industryMaterial);
|
String success = industryMaterialService.resourceToWorkAndCreateStep(industryMaterial);
|
||||||
|
|
||||||
if (!Objects.equals(success, "0")) {
|
if (!Objects.equals(success, "0")) {
|
||||||
// 进入这里说明工艺没问题接下里根据工艺表创建道次
|
// 进入这里说明工艺没问题接下里根据工艺表创建道次
|
||||||
// 判断当前是粗轧还是精轧
|
// 判断当前是粗轧还是精轧
|
||||||
@@ -464,7 +423,6 @@ public class IndustryStepServiceImpl implements IIndustryStepService {
|
|||||||
List<IndustryMaterialVo> industryMaterialVos = industryMaterialService.selectIndustryMaterialByBatchId(industryMaterial.getBatchId());
|
List<IndustryMaterialVo> industryMaterialVos = industryMaterialService.selectIndustryMaterialByBatchId(industryMaterial.getBatchId());
|
||||||
for (IndustryMaterialVo industryMaterialVo : industryMaterialVos) {
|
for (IndustryMaterialVo industryMaterialVo : industryMaterialVos) {
|
||||||
for (IndustryTechnologyVo industryTechnologyVo : industryTechnologyVos) {
|
for (IndustryTechnologyVo industryTechnologyVo : industryTechnologyVos) {
|
||||||
|
|
||||||
IndustryStep industryStep = new IndustryStep();
|
IndustryStep industryStep = new IndustryStep();
|
||||||
industryStep.setStep(industryTechnologyVo.getStep());
|
industryStep.setStep(industryTechnologyVo.getStep());
|
||||||
industryStep.setSetValue(industryTechnologyVo.getSetValue());
|
industryStep.setSetValue(industryTechnologyVo.getSetValue());
|
||||||
@@ -485,7 +443,7 @@ public class IndustryStepServiceImpl implements IIndustryStepService {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String finish(Long batchId) {
|
public int finish(Long batchId) {
|
||||||
// 表示该批次全部处理完毕
|
// 表示该批次全部处理完毕
|
||||||
industryMaterialService.updateIndustryMaterialStateByBatchId(batchId);
|
industryMaterialService.updateIndustryMaterialStateByBatchId(batchId);
|
||||||
|
|
||||||
@@ -519,8 +477,7 @@ public class IndustryStepServiceImpl implements IIndustryStepService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
s7PLC.writeBoolean("DB15.1.2",false);
|
s7PLC.writeBoolean("DB15.1.2",false);
|
||||||
// -1 表示全部结束
|
return 1;
|
||||||
return "-1";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -556,62 +513,9 @@ public class IndustryStepServiceImpl implements IIndustryStepService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PLCSystemData getPLCData(IndustryStep industryStep) {
|
public PLCSystemData getPLCData(IndustryStep industryStep) {
|
||||||
|
|
||||||
// // TODO 等待正式环境打开
|
|
||||||
// plcData.setCircleContainerAddress((Double) redisCache.getCacheObject("circleContainerAddress"));
|
|
||||||
// plcData.setOperationContainerAddress((Double) redisCache.getCacheObject("operationContainerAddress"));
|
|
||||||
// plcData.setConvey((Double) redisCache.getCacheObject("convey"));
|
|
||||||
// plcData.setOperation((Double) redisCache.getCacheObject("operation"));
|
|
||||||
// plcData.setHighElectric((Double) redisCache.getCacheObject("highElectric"));
|
|
||||||
// plcData.setLowElectric((Double) redisCache.getCacheObject("lowElectric"));
|
|
||||||
// plcData.setMachineBackSpeed((Double) redisCache.getCacheObject("machineBackSpeed"));
|
|
||||||
// plcData.setAGC((Double) redisCache.getCacheObject("AGC"));
|
|
||||||
// plcData.setOrdinary((Double) redisCache.getCacheObject("ordinary"));
|
|
||||||
|
|
||||||
|
|
||||||
// Random random = new Random();
|
|
||||||
//
|
|
||||||
// plcData.setCircleContainerAddress( random.nextDouble());
|
|
||||||
// plcData.setOperationContainerAddress( random.nextDouble());
|
|
||||||
// plcData.setConvey(random.nextDouble());
|
|
||||||
// plcData.setOperation(random.nextDouble());
|
|
||||||
// plcData.setHighElectric(random.nextDouble());
|
|
||||||
// plcData.setLowElectric(random.nextDouble());
|
|
||||||
// plcData.setMachineBackSpeed(random.nextDouble());
|
|
||||||
// plcData.setAGC(random.nextDouble());
|
|
||||||
// plcData.setOrdinary(random.nextDouble());
|
|
||||||
|
|
||||||
return s7Serializer.read(PLCSystemData.class);
|
return s7Serializer.read(PLCSystemData.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void getProcessingPLCData() {
|
|
||||||
|
|
||||||
// S7ConnectorPLC s7ConnectorPLC = new S7ConnectorPLC();
|
|
||||||
// //创建读取plc数据对象
|
|
||||||
// //初始化
|
|
||||||
// S7Connector connector = s7ConnectorPLC.initConnect(ipAddress);
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// getProcessingData(connector,15, 182, false, "circleContainerAddress");
|
|
||||||
// getProcessingData(connector,15, 186, false, "operationContainerAddress");
|
|
||||||
// getProcessingData(connector,15, 198, false, "convey");
|
|
||||||
// getProcessingData(connector,15, 202, false, "operation");
|
|
||||||
// getProcessingData(connector,0, 238, true, "highElectric");
|
|
||||||
// getProcessingData(connector,0, 230, true, "lowElectric");
|
|
||||||
// getProcessingData(connector,0, 234, true, "machineBackSpeed");
|
|
||||||
// getProcessingData(connector,33, 404, false, "AGC");
|
|
||||||
// getProcessingData(connector,34, 404, false, "ordinary");
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// try {
|
|
||||||
// //关闭链接
|
|
||||||
// connector.close();
|
|
||||||
// } catch (IOException e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 定时任务 纠正莫名其妙改成1的问题
|
* 定时任务 纠正莫名其妙改成1的问题
|
||||||
*/
|
*/
|
||||||
@@ -640,32 +544,14 @@ 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.size()>0){
|
if (!industryStepVos.isEmpty()){
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
industryStep.setOperation(1L);
|
industryStep.setOperation(1L);
|
||||||
industryStepMapper.start(industryStep);
|
industryStepMapper.start(industryStep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// private void getProcessingData(S7Connector connector,int dbCode, int offset, Boolean mbFlag, String key) {
|
|
||||||
// Double data;
|
|
||||||
// if (mbFlag) {
|
|
||||||
// data = (Double) PLCUtils.getPLCData(connector,ipAddress, 0, offset, "double", 0, 0, true);
|
|
||||||
// } else {
|
|
||||||
// data = (Double) PLCUtils.getPLCData(connector,ipAddress, dbCode, offset, "double", 0, 0, false);
|
|
||||||
// }
|
|
||||||
// redisCache.setCacheObject(key, data);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,101 @@
|
|||||||
|
package com.industry.work.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.industry.common.utils.http.HttpUtils;
|
||||||
|
import com.industry.work.domain.IndustryMaterial;
|
||||||
|
import com.industry.work.domain.MomResource;
|
||||||
|
import com.industry.work.service.IMomService;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class MomServiceImpl implements IMomService {
|
||||||
|
|
||||||
|
@Value("${httpIp}")
|
||||||
|
private String httpIp;
|
||||||
|
|
||||||
|
@Value("${mode}")
|
||||||
|
private String mode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 来料与mom通信
|
||||||
|
*
|
||||||
|
* @param momResource
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void processPowerOn(MomResource momResource) {
|
||||||
|
String url = "/api/ticket/processPowerOn";
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
jsonObject.put("ticketNo", momResource.getTicketNo());
|
||||||
|
jsonObject.put("devicesCode", momResource.getDevicesCode());
|
||||||
|
jsonObject.put("receiveTime", momResource.getReceiveTime());
|
||||||
|
jsonObject.put("powerOnTime", momResource.getPowerOnTime());
|
||||||
|
jsonObject.put("receiveUser", momResource.getReceiveUser());
|
||||||
|
jsonObject.put("powerOnUser", momResource.getPowerOnUser());
|
||||||
|
jsonObject.put("processSide", momResource.getProcessSide());
|
||||||
|
jsonObject.put("caller", momResource.getCaller());
|
||||||
|
String res = HttpUtils.dataPost(httpIp + url, jsonObject);
|
||||||
|
System.out.println(res);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void processPowerDown(IndustryMaterial industryMaterial) {
|
||||||
|
String url = "/api/ticket/processPowerDown";
|
||||||
|
ArrayList<Map<String, Object>> list = new ArrayList<>();
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
|
||||||
|
if ("0".equals(mode)) {
|
||||||
|
map.put("code", "CZ_COLLECT_1");
|
||||||
|
map.put("value", industryMaterial.getFinalDiameter());
|
||||||
|
list.add(map);
|
||||||
|
map.put("code", "CZ_COLLECT_2");
|
||||||
|
map.put("value", industryMaterial.getFinalWidth());
|
||||||
|
list.add(map);
|
||||||
|
map.put("code", "CZ_COLLECT_3");
|
||||||
|
map.put("value", industryMaterial.getWidth());
|
||||||
|
list.add(map);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
map.put("code", "JZ_COLLECT_1");
|
||||||
|
map.put("value", industryMaterial.getFinalDiameter());
|
||||||
|
list.add(map);
|
||||||
|
map.put("code", "JZ_COLLECT_2");
|
||||||
|
map.put("value", industryMaterial.getFinalDiameter2());
|
||||||
|
list.add(map);
|
||||||
|
map.put("code", "JZ_COLLECT_3");
|
||||||
|
map.put("value", industryMaterial.getWidth());
|
||||||
|
list.add(map);
|
||||||
|
map.put("code", "JZ_COLLECT_4");
|
||||||
|
map.put("value", industryMaterial.getFinalWidth());
|
||||||
|
list.add(map);
|
||||||
|
map.put("code", "JZ_COLLECT_5");
|
||||||
|
map.put("value", industryMaterial.getFinalWidth2());
|
||||||
|
list.add(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
jsonObject.put("ticketNo", industryMaterial.getId());
|
||||||
|
jsonObject.put("productCode", industryMaterial.getId());
|
||||||
|
jsonObject.put("devicesCode", industryMaterial.getId());
|
||||||
|
jsonObject.put("collectTime", new Date());
|
||||||
|
jsonObject.put("powerDownTime", new Date());
|
||||||
|
jsonObject.put("transmitTime", new Date());
|
||||||
|
jsonObject.put("collectUser", "wang");
|
||||||
|
jsonObject.put("powerDownUser", "wang");
|
||||||
|
jsonObject.put("transmitUser", "wang");
|
||||||
|
jsonObject.put("processSide", mode);
|
||||||
|
jsonObject.put("caller", "ZJ");
|
||||||
|
jsonObject.put("dataCollect", list);
|
||||||
|
String res = HttpUtils.dataPost(httpIp + url, jsonObject);
|
||||||
|
System.out.println(res);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -106,23 +106,28 @@
|
|||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="finishCheck" resultType="java.lang.Integer" parameterType="IndustryStep" >
|
<select id="finishCheck" resultType="java.lang.Long">
|
||||||
select count(*)
|
select count(*)
|
||||||
from industry_step
|
from industry_step step
|
||||||
where state = 0
|
left join industry.industry_material im on step.material_id = im.id
|
||||||
and material_id = #{materialId}
|
where step.state = 0
|
||||||
and del_flag=0
|
and step.del_flag=0
|
||||||
and batch_id = #{batchId}
|
and step.batch_id = #{batchId}
|
||||||
|
and im.state =1
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<select id="finishCheckAbnormal" resultType="java.lang.Integer" parameterType="String">
|
<select id="finishCheckAbnormal" resultType="java.lang.Long">
|
||||||
select count(*)
|
select count(*)
|
||||||
from industry_step
|
from industry_step step
|
||||||
where state = 0
|
left join industry.industry_material im on step.material_id = im.id
|
||||||
and material_id = #{materialId}
|
where step.state = 0
|
||||||
and del_flag=1
|
and step.del_flag=1
|
||||||
|
and step.batch_id = #{batchId}
|
||||||
|
and im.state =5
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectMaxStepNum" resultType="java.lang.Long" parameterType="Long">
|
<select id="selectMaxStepNum" resultType="java.lang.Long" parameterType="Long">
|
||||||
select max(step) from industry_step where batch_id = #{batchId}
|
select max(step) from industry_step where batch_id = #{batchId}
|
||||||
</select>
|
</select>
|
||||||
@@ -231,14 +236,13 @@
|
|||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="updateAllIndustryStepByBatchId" parameterType="IndustryStep">
|
<update id="updateAllIndustryStepByBatchId" parameterType="IndustryStep">
|
||||||
|
|
||||||
update industry_step
|
update industry_step
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
<if test="reduction != null">reduction = #{reduction},</if>
|
<if test="reduction != null">reduction = #{reduction},</if>
|
||||||
<if test="setValue != null">set_value = #{setValue},</if>
|
<if test="setValue != null">set_value = #{setValue},</if>
|
||||||
<if test="angle != null">angle = #{angle},</if>
|
<if test="angle != null">angle = #{angle},</if>
|
||||||
<if test="operation != null">operation = #{operation},</if>
|
<if test="operation != null">operation = #{operation},</if>
|
||||||
<if test="state != null and state !=1 ">state = #{state},</if>
|
<if test="state != null">state = #{state},</if>
|
||||||
<if test="materialId != null">material_id = #{materialId},</if>
|
<if test="materialId != null">material_id = #{materialId},</if>
|
||||||
<if test="createTime != null">create_time = #{createTime},</if>
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
<if test="createBy != null">create_by = #{createBy},</if>
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
|
|||||||
Reference in New Issue
Block a user