ZengTao
2024-08-12 75b4aeda7ad7011a6239dc1bfa8362695f6c451a
添加下片自动打印流程卡开关
8个文件已修改
132 ■■■■■ 已修改文件
UI-Project/src/views/Caching/cachingun.vue 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/PurchaseReturn/purchaseReturn.vue 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/StockBasicData/stockBasicData.vue 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/UnLoadGlass/loadmachinerack.vue 54 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/controller/DownWorkstationController.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/service/DownWorkstationService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/service/impl/DownWorkstationServiceImpl.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/Downpush.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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,
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>  
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" />
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;">
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"));
    }
}
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);
}
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);
    }
}
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) {