From 78e5175a05eeb3776d3f21f603fb6fb7a18b3d54 Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期四, 08 八月 2024 10:14:59 +0800
Subject: [PATCH] 1、任务表中新增是否删除字段 0:未删除  1:已删除 2、磨边队列方法改造:增加设置参数接口,websocket推送数据时可按照设置的参数推送对应的数据 3、任务新增破损、拿走状态处理 4、破损数据新增批量新增 5、工位流程卡玻璃是否到齐方法完善

---
 UI-Project/src/views/Slicecage/slicecage.vue |  254 ++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 233 insertions(+), 21 deletions(-)

diff --git a/UI-Project/src/views/Slicecage/slicecage.vue b/UI-Project/src/views/Slicecage/slicecage.vue
index 749d012..e15909d 100644
--- a/UI-Project/src/views/Slicecage/slicecage.vue
+++ b/UI-Project/src/views/Slicecage/slicecage.vue
@@ -7,20 +7,25 @@
 const router = useRouter()
 import request from "@/utils/request"
 import { WebSocketHost ,host} from '@/utils/constants'
-import { ref, onMounted , onBeforeUnmount, reactive, computed } from "vue";
+import { ref, onMounted , onBeforeUnmount, reactive, computed,onUnmounted } from "vue";
 import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService';
 import { ElMessage, ElMessageBox } from 'element-plus'
 import { tr } from "element-plus/es/locale";
 const dialogFormVisible = ref(false)
+const dialoglea = ref(false)
 const dialogFormVisiblea = ref(false)
 const dialogFormVisibleb = ref(false)
+const dialogFormVisiblec = ref(false)
 const tableData = ref([])
+const tableDatagh = ref([])
 const tableDatab = ref([])
 const tableDatac = ref([])
 const tableDatad = ref([])
 const tableDataf = ref([])
 const tableDatae = ref([])
+const tableDatax = ref([])
 const carPosition = ref([])
+const ganghua = ref('')
 const adjustedRects = ref([]);
 const project = ref([]);
 const adjust = ref([]);
@@ -34,6 +39,7 @@
 const adjustedRectsg = ref([]);
 const adjustedRectsh = ref([]);
 const currentRow = reactive({}); // 褰撳墠琛岀殑鏁版嵁 
+const inputValuesa = reactive({});
 const add = ref(false)
 const flowCardId = ref('');
 const gap = ref('');
@@ -69,8 +75,8 @@
 const cell8=ref(true);
 const cell9=ref(true);
 const selectedRow = ref(null); // 瀛樺偍閫変腑鐨勮鏁版嵁  
- 
- 
+const temperingtotal = ref(0);
+const glasstotal = ref(0);
     // 褰撳墠椤电爜鍜屾瘡椤垫樉绀虹殑鏉℃暟
     const currentPage = ref(1);
     const itemsPerPage = computed(() => {
@@ -162,8 +168,13 @@
       // }
       return 9;
     });
- 
- 
+    setInterval(() => {  
+    localStorage.clear(); // 娓呴櫎鎵�鏈塴ocalStorage鏁版嵁  
+}, 60000);
+//  function cleanUp() {
+// }
+// // 鍋囪鎴戜滑姣�2鍒嗛挓鎵ц涓�娆℃竻鐞�  
+// setInterval(cleanUp, 1 * 60 * 1000);
  
 const getTableRow = (row,type) =>{
   switch (type) {
@@ -209,10 +220,7 @@
 // 鏄惁绂佺敤
 const toggleEnableState = async (row) => {
   const newState = row.enableState === 1 ? 0 : 1;  
-  console.log(row.slot);
-  console.log(row.enableState);
   var url="/cacheVerticalGlass/bigStorageCage/updateStorageCageDisabled?slot="+row.slot + "&enableState=" + newState;
-      console.log(url);
       const response = await request.get(url) 
   if (response.code === 200) {
       ElMessage.success(response.message);
@@ -349,6 +357,33 @@
     console.error('鍙戠敓閿欒:', error);  
   }  
 }; 
+ // 鎸囧畾閽㈠寲
+ const brokee = async(row) => {  
+  try {
+    const confirmResult = await ElMessageBox.confirm(  
+      t('searchOrder.specifytemperinga'), 
+      t('searchOrder.prompt'),  
+      {  
+        confirmButtonText: t('searchOrder.yes'), 
+        cancelButtonText: t('searchOrder.cancel'),
+        type: 'warning',  
+      } 
+    ); 
+    if (confirmResult === 'confirm') {  
+      const response = await request.post("/cacheVerticalGlass/bigStorageCageDetails/TemperingGlass",{
+        engineerId: row.engineer_id,
+        temperingLayoutId: row.tempering_layout_id,
+    });
+    if (response.code === 200) {
+      ElMessage.success(response.message);
+      } else {  
+      ElMessage.error(response.message);
+      }  
+    }  
+  } catch (error) {  
+    console.error('鍙戠敓閿欒:', error);  
+  }  
+}; 
 // 鍑虹墖闃熷垪鎷胯蛋
 const brokeb = async(row) => {  
   try {
@@ -462,9 +497,103 @@
     console.error('鍙戠敓閿欒:', error);  
   }  
 }; 
+const handlezhiban = () => {
+  dialoglea.value = true; // 鎵撳紑缁戝畾鏋跺瓙瀵硅瘽妗�
+  fetchFlowCardId(); 
+};
+const handleganghua = () => {
+  dialogFormVisiblec.value = true; // 鎵撳紑缁戝畾鏋跺瓙瀵硅瘽妗�
+  fetchFlow(); 
+};
+// 閽㈠寲鏌ヨ
+ 
+onMounted(async () => {  
+  try {  
+    const response = await request.post('/cacheVerticalGlass/bigStorageCageDetails/selectTemperingGlass');
+    if (response.code === 200) {  
+      tableDatagh.value = response.data
+    } else {  
+      ElMessage.warning(response.msg)
+    }  
+  } catch (error) {  
+    // console.error('Error fetching rects :', error);  
+  }  
+}); 
+const fetchFlow = async () => {
+  try  {
+    const response = await request.post('/cacheVerticalGlass/bigStorageCageDetails/selectTemperingGlass')
+    if (response.code == 200) {
+      ElMessage.success(response.message);
+      tableDatagh.value = response.data
+      temperingtotal.value = response.data.length
+      let totalCount = 0;  
+      response.data.forEach(item => { 
+        totalCount += item.count || 0;
+      });
+      glasstotal.value = totalCount;
+    } else {
+      ElMessage.error(response.message);
+    }
+}
+catch (error) {
+    // 澶勭悊閿欒
+    console.error(error);
+  }
+}
+// 鍊肩彮淇℃伅
+const fetchFlowCardId = async () => {
+  try  {
+    const response = await request.post('/cacheVerticalGlass/work_assignment/selectWorkAssignment',{
+      line: 2001,
+      workingProcedure : '鍐峰姞宸�'
+    })
+    if (response.code == 200) {
+      ElMessage.success(response.message);
+      tableDatax.value = response.data;
+      console.log(tableDatax.value);
+    } else {
+      ElMessage.error(response.message);
+    }
+}
+catch (error) {
+    // 澶勭悊閿欒
+    console.error(error);
+  }
+}
+const handleConfirm = async () => {
+  const response = await request.post("/cacheVerticalGlass/work_assignment/updateWorkAssignment", tableDatax.value)
+  if (response.code === 200) {
+    ElMessage.success(response.message);
+    dialoglea.value = false;
+  } else {
+    ElMessage.error(response.message);
+  }
+};
 function handleRowClick(row) {  
   selectedRow.value = row; // 鏇存柊閫変腑鐨勮鏁版嵁  
 }  
+  const handleChange = async () => {
+  try  {
+    const body = {  
+      flag: ganghua.value, // 浣跨敤 ganghua.value 鑾峰彇褰撳墠寮�鍏崇殑鐘舵��  
+    }; 
+    
+    var url="/cacheVerticalGlass/bigStorageCageDetails/temperingSwitch?flag="+ganghua.value;
+  const response = await request.post(url)
+    if (response.code == 200) {
+      // 缁戝畾鎴愬姛锛屽鐞嗛�昏緫
+      ElMessage.success(response.message);
+      ganghua.value = response.data
+    }else {  
+      ElMessage.error(response.message);
+      }  
+}
+catch (error) {
+    // 澶勭悊閿欒
+    console.error(error);
+  }
+}
+let socket = null;
 const socketUrl = `ws://${WebSocketHost}:${host}/api/cacheVerticalGlass/api/talk/slicecage`;
 // 瀹氫箟娑堟伅澶勭悊鍑芥暟锛屾洿鏂� receivedData 鍙橀噺
 const handleMessage = (data) => {
@@ -472,11 +601,16 @@
   if(data.bigStorageCageDetailsOutTask!=null){
     tableDatac.value = data.bigStorageCageDetailsOutTask[0]
     adjusta.value = data.bigStorageCageDetailsOutTask[0].filter(rect => rect.slot !== null && rect.slot !== undefined);
+  } else {
+    tableDatac.value = '',
+    adjusta.value = ''
   }
   if(data.bigStorageCageDetailsFeedTask!=null){
     tableDatad.value = data.bigStorageCageDetailsFeedTask[0]
     adjust.value = data.bigStorageCageDetailsFeedTask[0].filter(rect => rect.slot !== null && rect.slot !== undefined); 
-  }
+  }else{
+    tableDatad.value = ''
+      }
   
   // adjust.value = data.bigStorageCageDetailsFeedTask[0].map(rect => ({  
   //           ...rect, 
@@ -487,18 +621,29 @@
 // }); 
 if(data.bigStorageCageInfo!=null){
   tableData.value = data.bigStorageCageInfo[0]
-}
+}else{
+    tableData.value = ''
+   }
 if(data.temperingGlassInfoList!=null){
   tableDatab.value = data.temperingGlassInfoList[0]
-}
+}else{
+    tableDatab.value = ''
+      }
 if(data.bigStorageCageUsage!=null){
   tableDatae.value = data.bigStorageCageUsage[0]
-}
+}else{
+    tableDatae.value = ''
+      }
 if(data.carPostion!=null){
   carPosition.value = data.carPostion[0]
-}
-  
-  
+}else{
+  carPosition.value = ''
+  }
+if(data.temperingSwitch!=null){
+  ganghua.value = data.temperingSwitch[0]
+}else{
+  ganghua.value = ''
+  }
   if(data.bigStorageCageInfos!=null){
     window.localStorage.setItem('length', data.bigStorageCageInfos[0][1].length)
   let length = window.localStorage.getItem('length')
@@ -547,6 +692,8 @@
             height: 20/length,
             top: 29/length
           })); 
+  }else{
+    adjustedRects.value = ''
   }
  
   
@@ -554,9 +701,14 @@
 // 鍒濆鍖� WebSocket锛屽苟浼犻�掓秷鎭鐞嗗嚱鏁�
 onMounted(() => {
   // fetchFlowCardId();
-  initializeWebSocket(socketUrl, handleMessage);
- 
+  // initializeWebSocket(socketUrl, handleMessage);
+  socket = initializeWebSocket(socketUrl, handleMessage);
 });
+  onUnmounted(() => {
+    if (socket) {
+    closeWebSocket(socket);
+    }
+    });
 function getStatusType(enableState: number) {  
   switch (enableState) {  
     case 100:
@@ -608,15 +760,18 @@
   }  
 }
 onBeforeUnmount(() => {
-  console.log("鍏抽棴浜�")
+  // console.log("鍏抽棴浜�")
   closeWebSocket();
 });
 </script>
  
 <template>
   <div style="height: 600px;">
-    <el-button style="margin-top: 5px;margin-left: 10px;"   id="searchButton" type="primary" @click="dialogFormVisiblea = true">{{ $t('searchOrder.cageinformation') }}</el-button>
-    <el-button style="margin-top: 5px;margin-left: 10px;"   id="searchButton" type="success" @click="dialogFormVisibleb = true">{{ $t('searchOrder.productionqueue') }}</el-button>
+    <el-button style="margin-top: 5px;margin-left: 10px;" id="searchButton" type="primary" @click="dialogFormVisiblea = true">{{ $t('searchOrder.cageinformation') }}</el-button>
+    <el-button style="margin-top: 5px;margin-left: 10px;" id="searchButton" type="success" @click="dialogFormVisibleb = true">{{ $t('searchOrder.productionqueue') }}</el-button>
+    <el-button style="margin-top: 5px;margin-left: 10px;" id="searchButton" type="warning" @click="handleganghua">{{ $t('searchOrder.temperingqueries') }}</el-button>
+    <el-button style="margin-top: 5px;margin-left: 10px;" id="searchButton" type="info" @click="handlezhiban">{{ $t('searchOrder.dutyinformation') }}</el-button>
+    <el-switch style="margin-top: 5px;margin-left: 10px;" v-model="ganghua" class="mb-2" :inactive-text="$t('searchOrder.temperedswitch')" @change="handleChange" />
     <el-card style="flex: 1;margin-left: 10px;margin-top: 5px;" v-loading="loading">
       <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;max-height: 100px;">
         <el-table height="100px" ref="table" 
@@ -1239,7 +1394,64 @@
         </el-table-column>
         </el-table>
 </el-dialog>
- 
+<el-dialog v-model="dialogFormVisiblec" top="5vh" width="85%" :title="$t('searchOrder.temperingqueries')">
+  <div style="margin-bottom: 20px">
+      <el-form>
+        <el-row style="margin-top: -15px;margin-bottom: -2px;">
+          <el-col :span="4">
+              <div id="dt" style="font-size: 15px;">
+              <el-form-item :label="$t('searchOrder.temperingtotal')"  style="width: 14vw">
+                {{ temperingtotal }}
+              </el-form-item>
+              </div>
+          </el-col>
+          <el-col :span="5">
+            <div id="dta" style="font-size: 15px;">
+          <el-form-item :label="$t('searchOrder.glasstotal')" style="width: 14vw">
+                {{ glasstotal }}
+              </el-form-item>
+              </div>
+          </el-col>
+        </el-row>
+      </el-form>
+    </div>
+    <el-table  ref="table" style="margin-top: 20px;height: 500px;"
+        :data="tableDatagh" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}">
+          <el-table-column prop="engineer_id" fixed align="center" :label="$t('searchOrder.projectnumber')" min-width="150"/>
+          <el-table-column prop="tempering_layout_id" fixed align="center" :label="$t('searchOrder.layoutnumber')" min-width="120" />
+          <el-table-column prop="count" align="center" :label="$t('searchOrder.numberglasses')" min-width="150" />
+          <el-table-column fixed="right" :label="$t('searchOrder.operate')" align="center" width="150">
+            <template #default="scope">
+              <el-button size="mini" type="text" plain @click="brokee(scope.row)">{{ $t('searchOrder.specifytempering') }}</el-button>
+            </template>
+        </el-table-column>
+        </el-table>
+</el-dialog>
+<el-dialog v-model="dialoglea" top="15vh" width="70%" :title="$t('searchOrder.dutyinformation')">
+    <el-table  ref="table" style="margin-top: 20px;height: 300px;"
+        :data="tableDatax" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}">
+          <el-table-column prop="line" fixed align="center" :label="$t('searchOrder.line')"/>
+          <el-table-column prop="workProcesses" fixed align="center" :label="$t('searchOrder.process')" />
+          <el-table-column prop="teamsGroupsName" align="center" :label="$t('searchOrder.team')">
+        <template #default="{ row }">  
+          <el-input v-model="row.teamsGroupsName" autocomplete="off" min-width="150"/>  
+        </template>  
+      </el-table-column>
+          <el-table-column prop="deviceName" align="center" :label="$t('searchOrder.basic')">
+            <template #default="{ row }">  
+          <el-input v-model="row.deviceName" autocomplete="off" min-width="150"/>  
+        </template>
+        </el-table-column>
+        </el-table>
+        <template #footer>
+      <div id="dialog-footer">
+        <el-button type="primary" @click="handleConfirm">
+          {{ $t('searchOrder.add') }}
+        </el-button>
+        <el-button @click="dialoglea = false">{{ $t('searchOrder.cancel') }}</el-button>
+      </div>
+    </template>
+</el-dialog>
 </template>
 <style scoped>
 #dt { display:block; float:left;line-height: 20px;margin-left: 100px;}

--
Gitblit v1.8.0