From 75b4aeda7ad7011a6239dc1bfa8362695f6c451a Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期一, 12 八月 2024 11:29:00 +0800
Subject: [PATCH] 添加下片自动打印流程卡开关
---
UI-Project/src/views/UnLoadGlass/loadmachinerack.vue | 54 +++++++++++++----
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/service/DownWorkstationService.java | 2
UI-Project/src/views/Caching/cachingun.vue | 6 +-
UI-Project/src/views/StockBasicData/stockBasicData.vue | 8 +-
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/service/impl/DownWorkstationServiceImpl.java | 14 ++--
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/controller/DownWorkstationController.java | 11 +++
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/Downpush.java | 10 +++
UI-Project/src/views/PurchaseReturn/purchaseReturn.vue | 27 ++------
8 files changed, 87 insertions(+), 45 deletions(-)
diff --git a/UI-Project/src/views/Caching/cachingun.vue b/UI-Project/src/views/Caching/cachingun.vue
index 737c1de..d7676bf 100644
--- a/UI-Project/src/views/Caching/cachingun.vue
+++ b/UI-Project/src/views/Caching/cachingun.vue
@@ -69,7 +69,7 @@
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
// import i18n from '@/i18n';
-const tableData = ref([])
+const tableData = reactive([]);
const slot = ref('')
const adjustedRects = ref([]);
@@ -210,10 +210,10 @@
// 瀹氫箟娑堟伅澶勭悊鍑芥暟锛屾洿鏂� receivedData 鍙橀噺
const handleMessage = (data) => {
// 鏇存柊 tableData 鐨勬暟鎹�
- tableData.splice(0, tableData.length, ...data.params[0]);
+ tableData.splice(0, tableData.length, ...data.params2[0]);
// tableData.value = data.params[0]
// adjustedRects.value = data.EdgStorageCageinfos[0]
- adjustedRects.value = data.params[0].map(rect => ({
+ adjustedRects.value = data.params2[0].map(rect => ({
...rect, // 澶嶅埗鍘熷瀵硅薄鐨勫叾浠栧睘鎬�
width: rect.width * 0.5 ,
id: rect.id * 10,
diff --git a/UI-Project/src/views/PurchaseReturn/purchaseReturn.vue b/UI-Project/src/views/PurchaseReturn/purchaseReturn.vue
index 5a991d4..3ab4e62 100644
--- a/UI-Project/src/views/PurchaseReturn/purchaseReturn.vue
+++ b/UI-Project/src/views/PurchaseReturn/purchaseReturn.vue
@@ -3,7 +3,7 @@
import {reactive} from "vue";
import {useRouter} from "vue-router"
import request from "@/utils/request"
-import { ref, onMounted, onBeforeUnmount,onUnmounted } from 'vue';
+import { ref, onMounted, onBeforeUnmount } from 'vue';
import { WebSocketHost ,host} from '@/utils/constants'
import { ElMessage, ElMessageBox } from 'element-plus'
import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService';
@@ -22,7 +22,6 @@
const adjustedRectsb = ref([]);
const currentGlassId = ref(null);
const currenttemperingFeedSequence = ref(null);
-let socket = null;
const socketUrl = `ws://${WebSocketHost}:${host}/api/temperingGlass/api/talk/temperingGlass`;
const handleMessage = (data) => {
// 杩涚倝涓�
@@ -206,24 +205,14 @@
}
};
onMounted(() => {
- socket = initializeWebSocket(socketUrl, handleMessage);
+ initializeWebSocket(socketUrl, handleMessage);
});
- onUnmounted(() => {
- if (socket) {
- closeWebSocket(socket);
- }
- });
function updateRectColors() {
adjustedRectsa.value.forEach(rect => {
if (rect.glassId === glassId) {
- rect.state = 8;
+ rect.state = 5;
}
});
- adjustedRectsb.value.forEach(rect => {
- if (rect.glassId === glassId) {
- rect.state = 8;
- }
- });
}
function getRectColora(state) {
switch (state) {
@@ -233,7 +222,7 @@
return '#95d475';
case -1:
return '#CDAF95';
- case 8:
+ case 5:
return '#911005';
}
}
@@ -243,7 +232,7 @@
return '#eebe77';
case 4:
return '#CD6090';
- case 8:
+ case 5:
return '#911005';
}
}
@@ -271,7 +260,7 @@
glassId: currentGlassId.value,
// temperingFeedSequence: currenttemperingFeedSequence.value,
line: 4001,
- status: 8,
+ status: 2,
workingProcedure: '閽㈠寲',
})
if (response.code == 200) {
@@ -316,7 +305,7 @@
left: `${rect.xcoordinate}px`,
width: `${rect.width}px`,
height: `${rect.height}px`,
- backgroundColor: rect.state === 8 ? '#911005' : 'lightblue' }"
+ backgroundColor: rect.state === 5 ? '#911005' : 'lightblue' }"
>
<div class="centered-text">
<div >{{ rect.glassId }}</div>
@@ -344,7 +333,7 @@
left: `${rect.xcoordinate}px`,
width: `${rect.width}px`,
height: `${rect.height}px`,
- backgroundColor: rect.state === 8 ? '#911005' : 'lightblue' }"
+ backgroundColor: rect.state === 5 ? '#911005' : 'lightblue' }"
>
<div class="centered-text">
<div >{{ rect.glassId }}</div>
diff --git a/UI-Project/src/views/StockBasicData/stockBasicData.vue b/UI-Project/src/views/StockBasicData/stockBasicData.vue
index 591e943..9e9f6a1 100644
--- a/UI-Project/src/views/StockBasicData/stockBasicData.vue
+++ b/UI-Project/src/views/StockBasicData/stockBasicData.vue
@@ -96,9 +96,9 @@
// alert('鍒犻櫎澶辫触锛�' + deleteResponse.message);
}
}
- } catch (error) {
- // 澶勭悊鍙兘鍑虹幇鐨勯敊璇紝姣斿 ElMessageBox 鎶涘嚭鐨勫紓甯哥瓑
- console.error('鍙戠敓閿欒:', error);
+ } catch (error) {
+ // 澶勭悊鍙兘鍑虹幇鐨勯敊璇紝姣斿 ElMessageBox 鎶涘嚭鐨勫紓甯哥瓑
+ console.error('鍙戠敓閿欒:', error);
}
};
// 鎷胯蛋
@@ -176,7 +176,7 @@
}}</el-button>
<div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;">
- <el-table height="240" ref="table"
+ <el-table height="750" ref="table"
@selection-change="handleSelectionChange"
:data="tableData" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}">
<el-table-column prop="glassId" align="center" :label="$t('workOrder.glassID')" min-width="180" />
diff --git a/UI-Project/src/views/UnLoadGlass/loadmachinerack.vue b/UI-Project/src/views/UnLoadGlass/loadmachinerack.vue
index 7f796a3..ea71644 100644
--- a/UI-Project/src/views/UnLoadGlass/loadmachinerack.vue
+++ b/UI-Project/src/views/UnLoadGlass/loadmachinerack.vue
@@ -16,7 +16,8 @@
import PrintFlow from './PrintFlow.vue'
import print from 'vue3-print-nb';
const printLoading = ref(true)
-const fullFlowCard =ref('')
+const fullFlowCard = ref('')
+const autoPrint = ref(false)
const dialogFormVisiblea = ref(false)
const dialogFormVisiblea2 = ref(false)
@@ -41,12 +42,28 @@
const now = new Date();
const timeRange = ref([new Date(now.setHours(0, 0, 0, 0)), new Date(now.setHours(23, 59, 59, 999))])
-const printWithoutPreview = () => {
- const printElement = document.getElementById('printMe');
+const handleChange = async () => {
+ console.log("瑙﹀彂寮�鍏�")
+ try {
+ const body = {
+ flag: autoPrint.value, // 浣跨敤 ganghua.value 鑾峰彇褰撳墠寮�鍏崇殑鐘舵��
+ };
- // 璋冪敤鎵撳嵃鍑芥暟锛屼紶閫掓墦鍗板尯鍩熺殑 DOM 鍏冪礌鍜岃烦杩囬瑙堢殑鍙傛暟
- print(printElement, { preview: false });
-};
+ var url = "/unLoadGlass/downWorkStation/autoPrint?flag=" + autoPrint.value;
+ const response = await request.post(url)
+ if (response.code == 200) {
+ // 缁戝畾鎴愬姛锛屽鐞嗛�昏緫
+ ElMessage.success(response.message);
+ autoPrint.value = response.data
+ } else {
+ ElMessage.error(response.message);
+ }
+ }
+ catch (error) {
+ // 澶勭悊閿欒
+ console.error(error);
+ }
+}
const handleInputChangea = (value, rowId) => {
@@ -169,6 +186,7 @@
const socketUrl = `ws://${WebSocketHost}:${host}/api/unLoadGlass/api/talk/unloadglass`;
// 瀹氫箟娑堟伅澶勭悊鍑芥暟锛屾洿鏂� receivedData 鍙橀噺
const handleMessage = (data) => {
+
// 鏇存柊 tableData 鐨勬暟鎹�
if (data.downGlassInfos != null) {
downGlass.value = data.downGlassInfos[0][1];
@@ -176,15 +194,23 @@
if (data.engineerIdList != null) {
selectOptionsa.value = data.engineerIdList[0]
}
+ if (data.autoPrint != null) {
+ autoPrint.value = data.autoPrint;
+ }
+ console.log(autoPrint.value)
- // tableData.splice(0, tableData.length, ...data.params[0]);
+ tableData.splice(0, tableData.length, ...data.params[0]);
if (fullFlowCard.value == "") {
for (let i = 0; i < tableData.length; i++) {
- if (tableData[i].totalQuantity == tableData[i].racksNumber + tableData[i].otherNumber&&fullFlowCard.value!=tableData[i].flowCardId) {
- // printFlowCardId.value = tableData[i].flowCardId;
- fullFlowCard.value=tableData[i].flowCardId;
- open(tableData[i]);
- break;
+ if (tableData[i].totalQuantity != 0) {
+ if (tableData[i].totalQuantity == tableData[i].racksNumber + tableData[i].otherNumber && fullFlowCard.value != tableData[i].flowCardId) {
+ // printFlowCardId.value = tableData[i].flowCardId;
+ fullFlowCard.value = tableData[i].flowCardId;
+ open(tableData[i]);
+ break;
+ }
+ } else {
+ console.log("娌℃湁flowCardId")
}
}
}
@@ -268,7 +294,7 @@
dialogTableVisible.value = false;
}, 1000);
;
-
+
}
const printFlowCard = () => {
@@ -321,6 +347,8 @@
<div>
<el-button style="margin-top: 5px;margin-left: 10px;" id="searchButton" type="primary"
@click="dialogFormVisibleaDownGlass = true">钀芥灦璇︽儏</el-button>
+ <el-switch style="margin-top: 5px;margin-left: 10px;" v-model="autoPrint" class="mb-2" :inactive-text="$t('鑷姩鎵撳嵃')"
+ @change="handleChange" />
<el-card style="flex: 1;" v-loading="loading">
<el-card style="flex: 1;margin-left: 4px;margin-top: 1px;" v-loading="loading">
<div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;">
diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/controller/DownWorkstationController.java b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/controller/DownWorkstationController.java
index 2f2a7aa..c966ac5 100644
--- a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/controller/DownWorkstationController.java
+++ b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/controller/DownWorkstationController.java
@@ -1,6 +1,7 @@
package com.mes.downworkstation.controller;
+import com.mes.common.utils.RedisUtil;
import com.mes.downworkstation.entity.DownWorkstation;
import com.mes.downworkstation.entity.request.DownWorkRequest;
import com.mes.downworkstation.service.DownWorkstationService;
@@ -11,6 +12,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
+import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
@@ -32,6 +34,8 @@
private DownWorkstationService downWorkstationService;
@Autowired
private GlassInfoService glassInfoService;
+ @Resource
+ private RedisUtil redisUtil;
@ApiOperation("鑾峰彇宸ヤ綅淇℃伅")
@GetMapping("/getone")
@@ -127,6 +131,13 @@
return Result.build(200, "鏇存崲鎴愬姛", downWorkstationService.closeAlarmSignal());
}
+ @ApiOperation("鏄惁鑷姩鎵撳嵃")
+ @PostMapping("/autoPrint")
+ public Result autoPrint(Boolean flag) {
+ downWorkstationService.autoPrint(flag);
+ return Result.build(200, "淇敼鎴愬姛", redisUtil.getCacheObject("autoPrint"));
+ }
+
}
diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/service/DownWorkstationService.java b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/service/DownWorkstationService.java
index 51c1f71..461935d 100644
--- a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/service/DownWorkstationService.java
+++ b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/service/DownWorkstationService.java
@@ -79,4 +79,6 @@
boolean updateDownWorkstationstate(DownWorkstation downWorkstation);
String closeAlarmSignal();
+
+ void autoPrint(Boolean flag);
}
diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/service/impl/DownWorkstationServiceImpl.java b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/service/impl/DownWorkstationServiceImpl.java
index 2307334..fffa235 100644
--- a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/service/impl/DownWorkstationServiceImpl.java
+++ b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/service/impl/DownWorkstationServiceImpl.java
@@ -5,13 +5,12 @@
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.yulichang.query.MPJQueryWrapper;
import com.mes.common.S7object;
+import com.mes.common.utils.RedisUtil;
import com.mes.damage.entity.Damage;
import com.mes.damage.service.DamageService;
import com.mes.device.PlcParameterObject;
import com.mes.downglassinfo.entity.DownGlassInfo;
import com.mes.downglassinfo.mapper.DownGlassInfoMapper;
-import com.mes.downglassinfo.service.DownGlassInfoService;
-import com.mes.downglassinfo.service.DownGlassTaskService;
import com.mes.downworkstation.entity.DownWorkstation;
import com.mes.downworkstation.entity.DownWorkstationTask;
import com.mes.downworkstation.entity.DownWorkstionAndDownGlassinfo;
@@ -25,6 +24,7 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -39,11 +39,7 @@
@Autowired(required = false)
private DownWorkstationTaskMapper downWorkstationTaskMapper;
@Autowired
- private DownGlassInfoService downGlassInfoService;
- @Autowired
private DownGlassInfoMapper downGlassInfoMapper;
- @Autowired
- private DownGlassTaskService downGlassTaskService;
@Autowired
private GlassInfoService glassInfoService;
@Autowired
@@ -51,6 +47,8 @@
@Autowired
private DownWorkstationTaskService downWorkstationTaskService;
+ @Resource
+ private RedisUtil redisUtil;
// @Override
// public List<DownWorkstation> gettwoDownWorkstations() {
@@ -223,5 +221,9 @@
return "success";
}
+ @Override
+ public void autoPrint(Boolean flag){
+ redisUtil.setCacheObject("autoPrint", flag);
+ }
}
diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/Downpush.java b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/Downpush.java
index eeecbbd..1d5a150 100644
--- a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/Downpush.java
+++ b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/Downpush.java
@@ -129,6 +129,16 @@
JSONObject jsonObject4 = new JSONObject();
jsonObject4.append("downGlassInfos", listMap);
jsonObject4.append("engineerIdList", engineerIdList);
+
+ //閽㈠寲寮�鍏�
+ boolean autoPrint=false;
+ if(redisUtil.getCacheObject("autoPrint")==null){
+ redisUtil.setCacheObject("autoPrint", false);
+ }else{
+ autoPrint=redisUtil.getCacheObject("autoPrint");
+ }
+ jsonObject4.append("autoPrint", autoPrint);
+
ArrayList<WebSocketServer> sendwServer4 = WebSocketServer.sessionMap.get("unloadglass");
if (sendwServer4 != null) {
for (WebSocketServer webserver : sendwServer4) {
--
Gitblit v1.8.0