From 5531c35f924004e843254c63d8a50f5fe08ad59f Mon Sep 17 00:00:00 2001
From: wu <731351411@qq.com>
Date: 星期六, 14 九月 2024 11:27:46 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10105/r/JiuMuMES
---
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/job/MarkingTask.java | 60 +++++++++++++++++++++++++++++-------------------------------
1 files changed, 29 insertions(+), 31 deletions(-)
diff --git a/JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/job/MarkingTask.java b/JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/job/MarkingTask.java
index eefccdb..d17fa08 100644
--- a/JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/job/MarkingTask.java
+++ b/JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/job/MarkingTask.java
@@ -1,15 +1,19 @@
package com.mes.job;
import cn.hutool.json.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.mes.common.S7object;
import com.mes.device.PlcParameterObject;
import com.mes.md.entity.GlassInfo;
+import com.mes.md.entity.Machine;
import com.mes.md.entity.Tasking;
import com.mes.md.entity.WorkTaskDetail;
import com.mes.md.mapper.GlassInfoMapper;
+import com.mes.md.mapper.MachineMapper;
import com.mes.md.mapper.TaskingMapper;
import com.mes.md.mapper.WorkTaskDetailMapper;
+import com.mes.md.service.TaskingService;
import com.mes.tools.WebSocketServer;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
@@ -34,9 +38,14 @@
public static String engineerId = "";
@Autowired
TaskingMapper taskingMapper;
+ @Autowired
+ MachineMapper machineMapper;
+ @Autowired
+ TaskingService taskingService;
// @Scheduled(fixedDelay = 1000)
- public void plcMarkingTask() {
+ public void plcMarkingTask(Long machineId) {
+ Machine machine=machineMapper.selectById(machineId);
PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject;
String taskRequestTypeValue = plcParameterObject.getPlcParameter("A06_request_word").getValue();
String glassIdeValue = plcParameterObject.getPlcParameter("A05_scanning_ID").getValue();
@@ -58,51 +67,40 @@
}
if ("1".equals(taskRequestTypeValue)) {
log.info("2銆佽繘鐗囪姹傦紝涓斿彂閫佸瓧涓�0锛屾墽琛屾墦鏍囦换鍔�");
- plcRequest(glassIdeValue, confirmationWrodAddress, currentSlot);
+ plcRequest(glassIdeValue, confirmationWrodAddress, currentSlot,machine);
}else if ("3".equals(taskRequestTypeValue)) {
log.info("2銆佸畬鎴愯姹傦紝鎵ц瀹屾垚浠诲姟");
- plcReport(glassIdeValue, confirmationWrodAddress, currentSlot);
+ plcReport(glassIdeValue, confirmationWrodAddress, currentSlot,machine);
}
}
- public void plcRequest(String glassIdeValue, String confirmationWrodAddress, String currentSlot) {
+ public void plcRequest(String glassIdeValue, String confirmationWrodAddress, String currentSlot, Machine machine) {
//鏌ユ壘鎵撴爣鏈轰换鍔�
- List<Tasking> taskings=taskingMapper.selectList(new MPJLambdaWrapper<Tasking>()
- .eq(Tasking::getState,"绾夸笂")
- .eq(Tasking::getCurrentCraft,"鎵撴爣"));
- if(!taskings.isEmpty()){//鏈変换鍔�
- Tasking tasking=taskings.get(0);
- if("绛夊緟".equals(tasking.getWorkState())){
- //鍙戦�佷换鍔�
- }else{
- log.info("褰撳墠浠诲姟鐘舵�侊細{}",tasking.getWorkState());
- }
+ Tasking tasking=taskingService.startMachineTask(machine);
+ if(tasking!=null&&"寮�宸�".equals(machine.getState())){//鏈変换鍔�
+ log.info("鍙戦�佷换鍔★細{}",tasking);
+ }else{
+ log.info("涓嶆弧瓒冲彂閫佹潯浠讹細{}",tasking);
}
}
- public void plcReport(String glassIdeValue, String confirmationWrodAddress, String currentSlot) {
+ public void plcReport(String glassIdeValue, String confirmationWrodAddress, String currentSlot, Machine machine) {
//鏌ユ壘鎵撴爣鏈哄伐浣滅殑浠诲姟
//鏌ユ壘鎵撴爣鏈轰换鍔�
- List<Tasking> taskings=taskingMapper.selectList(new MPJLambdaWrapper<Tasking>()
- .eq(Tasking::getState,"绾夸笂")
- .eq(Tasking::getCurrentCraft,"鎵撴爣"));
- if(!taskings.isEmpty()){//鏈変换鍔�
- Tasking tasking=taskings.get(0);
- if("宸ヤ綔".equals(tasking.getWorkState())){
- //鍙戦�佸畬鎴�
+ int finishCount=taskingService.finishMachineTask(machine);
+ if(finishCount>0){//鏁版嵁宸叉爣璁板畬鎴�
+ log.info("姝e父姹囨姤锛�");
- }else{
- log.info("褰撳墠鏃犲叡宸ヤ綔鐨勪换鍔★紝鏃犳晥姹囨姤瀹屾垚锛�");
- }
+ }else{
+ log.info("褰撳墠鏃犲叡宸ヤ綔鐨勪换鍔★紝鏃犳晥姹囨姤瀹屾垚锛�");
}
}
- //@Scheduled(fixedDelay = 1000)
+ @Scheduled(fixedDelay = 1000)
public void markingTasks() {
JSONObject jsonObject = new JSONObject();
- List<Tasking> taskings=taskingMapper.selectList(new MPJLambdaWrapper<Tasking>()
- .eq(Tasking::getState,"绾夸笂")
- .eq(Tasking::getCurrentCraft,"鎵撴爣"));
- jsonObject.append("taskings", taskings);
-
+ Machine machine=machineMapper.selectById(11L);
+ List<Tasking> taskingList=taskingService.findMachineTask(machine);
+ jsonObject.append("taskingList", taskingList);
+ jsonObject.append("machine", machine);
ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("marking");
if (sendwServer != null) {
for (WebSocketServer webserver : sendwServer) {
--
Gitblit v1.8.0