This commit is contained in:
2023-05-05 14:20:13 +08:00
commit 68ddc1f80c
129 changed files with 16637 additions and 0 deletions

36
src/config/getData.js Normal file
View File

@@ -0,0 +1,36 @@
import {post} from '@config/http.js'
// import store from '../vuex/store'
// 首页
// 1.1 查询首页
export const queryHomePage = () => post('api/home/queryHomePage', {})
// 1.2 按钮点击确认
export const clickSave = (code) => post('api/home/clickSave', {
button_code: code
})
// 任务管理
// 1.1 查询站点
export const queryPoint = () => post('api/task/queryPoint', {})
// 1.2 选择站点确认
export const confirmPoint = (code) => post('api/task/confirmPoint', {
point_code: code
})
// 1.3查询任务列表
export const queryTaskList = () => post('api/task/queryTaskList', {})
// 1.4删除任务列表
export const deleteTask = (taskNum) => post('api/task/deleteTask', {
task_num: taskNum
})
// 1.5调整任务顺序
export const updateTask = (arr) => post('api/task/updateTask', {
param: arr
})
// 1.7校验密码
export const checkPassword = (pwd) => post('api/task/check', {
password: pwd
})
// 故障管理
// 1.1查询故障信息
export const querryError = () => post('api/error/querryError', {})

278
src/config/getData1.js Normal file
View File

@@ -0,0 +1,278 @@
import {post} from '@config/http.js'
import store from '../vuex/store'
// 初始化
/** 1.2工序下拉框查询: */
export const workprocedureQuery = () => post({
'_SRVNAME': 'service.cacheLine.handle',
'_SRVMETHOD': 'workprocedureQuery',
'_DATA': JSON.stringify({
accountId: store.getters.accountId,
form: {}
})
})
/** 1.3缓存线设备下拉框查询: */
export const deviceQuery = () => post({
'_SRVNAME': 'service.cacheLine.handle',
'_SRVMETHOD': 'deviceQuery',
'_DATA': JSON.stringify({
accountId: store.getters.accountId,
form: {}
})
})
/** 1.4缓存线指令状态下拉框查询: */
export const instStatusQuery = () => post({
'_SRVNAME': 'service.cacheLine.handle',
'_SRVMETHOD': 'instStatusQuery',
'_DATA': JSON.stringify({
accountId: store.getters.accountId,
form: {}
})
})
// 公共页面
// 1.1缓存线出箱异常-查询:
export const materialQuery = (val) => post({
'_SRVNAME': 'service.cacheLine.handle',
'_SRVMETHOD': 'materialQuery',
'_DATA': JSON.stringify({
accountId: store.getters.accountId,
form: {
search_bar: val
}
})
})
// 空箱初始化
/** 1.1空箱初始化--出入空箱: */
export const inOutEmptyBox = (type, pickerId, val) => post({
'_SRVNAME': 'service.cacheLine.handle',
'_SRVMETHOD': 'inOutEmptyBox',
'_DATA': JSON.stringify({
accountId: store.getters.accountId,
form: {
inOut_type: type,
wcsdevice_code: pickerId,
vehicle_code: val
}
})
})
// 扫码异常
/** 1.1指令查询: */
export const inOutExceptionInstQuery = (type, pickerId, val) => post({
'_SRVNAME': 'service.cacheLine.handle',
'_SRVMETHOD': 'inOutExceptionInstQuery',
'_DATA': JSON.stringify({
accountId: store.getters.accountId,
form: {
inOut_type: type,
wcsdevice_code: pickerId,
vehicle_code: val
}
})
})
/** 1.2确认: */
export const inOutExceptionInstConfirm = (type, pickerId, val, pkId) => post({
'_SRVNAME': 'service.cacheLine.handle',
'_SRVMETHOD': 'inOutExceptionInstConfirm',
'_DATA': JSON.stringify({
accountId: store.getters.accountId,
form: {
inOut_type: type,
wcsdevice_code: pickerId,
vehicle_code: val,
instruct_uuid: pkId
}
})
})
// 缓存线出箱异常
// 1.1缓存线出箱异常-查询:
export const cacheLineOutBoxExceptionQuery = (pickerId, val) => post({
'_SRVNAME': 'service.cacheLine.handle',
'_SRVMETHOD': 'cacheLineOutBoxExceptionQuery',
'_DATA': JSON.stringify({
accountId: store.getters.accountId,
form: {
wcsdevice_code: pickerId,
agv_no: val
}
})
})
// 1.2缓存线出箱异常-确认:
export const cacheLineOutBoxExceptionConfirm = (pickerId, pkId) => post({
'_SRVNAME': 'service.cacheLine.handle',
'_SRVMETHOD': 'cacheLineOutBoxExceptionConfirm',
'_DATA': JSON.stringify({
accountId: store.getters.accountId,
form: {
wcsdevice_code: pickerId,
instruct_uuid: pkId
}
})
})
// agv出箱异常
// 1.1agv出箱异常-查询:
export const agvOutBoxExceptionQuery = (pickerId, val) => post({
'_SRVNAME': 'service.cacheLine.handle',
'_SRVMETHOD': 'agvOutBoxExceptionQuery',
'_DATA': JSON.stringify({
accountId: store.getters.accountId,
form: {
wcsdevice_code: pickerId,
vehicle_code: val
}
})
})
// 1.2agv出箱异常-确认:
export const agvOutBoxExceptionConfirm = (pickerId, val, pkId) => post({
'_SRVNAME': 'service.cacheLine.handle',
'_SRVMETHOD': 'agvOutBoxExceptionConfirm',
'_DATA': JSON.stringify({
accountId: store.getters.accountId,
form: {
wcsdevice_code: pickerId,
vehicle_code: val,
instruct_uuid: pkId
}
})
})
// 1.3agv出箱异常-倒料:
export const pourMaterial = (pickerId, val, pkId) => post({
'_SRVNAME': 'service.cacheLine.handle',
'_SRVMETHOD': 'pourMaterial',
'_DATA': JSON.stringify({
accountId: store.getters.accountId,
form: {
wcsdevice_code: pickerId,
vehicle_code: val,
instruct_uuid: pkId
}
})
})
// agv入箱异常
// 1.1agv入箱异常-查询:
export const agvInBoxExceptionQuery = (pickerId, val1) => post({
'_SRVNAME': 'service.cacheLine.handle',
'_SRVMETHOD': 'agvInBoxExceptionQuery',
'_DATA': JSON.stringify({
accountId: store.getters.accountId,
form: {
wcsdevice_code: pickerId,
vehicle_code: val1
}
})
})
// 1.2agv入箱异常-确认:
export const agvInBoxExceptionConfirm = (pickerId, val1, val2, pkId) => post({
'_SRVNAME': 'service.cacheLine.handle',
'_SRVMETHOD': 'agvInBoxExceptionConfirm',
'_DATA': JSON.stringify({
accountId: store.getters.accountId,
form: {
wcsdevice_code: pickerId,
full_vehicle_code: val1,
empty_vehicle_code: val2,
instruct_uuid: pkId
}
})
})
// 缓存线盘点(满箱初始化盘点)
// 1.1缓存线料箱条码查询料箱信息:
export const cachelineMaterInfoQuery = (type, pickerId, vehicleCode) => post({
'_SRVNAME': 'service.cacheLine.handle',
'_SRVMETHOD': 'cachelineMaterInfoQuery',
'_DATA': JSON.stringify({
accountId: store.getters.accountId,
form: {
type: type,
wcsdevice_code: pickerId,
vehicle_code: vehicleCode
}
})
})
// 1.2设为满框:
export const setfullBox = (wcsdeviceCode, vehicleCode, workprocedureUuid, materialUuid, qty, weight, layer, seat) => post({
'_SRVNAME': 'service.cacheLine.handle',
'_SRVMETHOD': 'setfullBox',
'_DATA': JSON.stringify({
accountId: store.getters.accountId,
form: {
wcsdevice_code: wcsdeviceCode,
vehicle_code: vehicleCode,
workprocedure_uuid: workprocedureUuid,
material_uuid: materialUuid,
quantity: qty,
weight: weight,
layer_num: layer,
seat_order_num: seat
}
})
})
// 1.3设为空框:
export const setEmptyBox = (wcsdeviceCode, vehicleCode, layer, seat) => post({
'_SRVNAME': 'service.cacheLine.handle',
'_SRVMETHOD': 'setEmptyBox',
'_DATA': JSON.stringify({
accountId: store.getters.accountId,
form: {
wcsdevice_code: wcsdeviceCode,
vehicle_code: vehicleCode,
layer_num: layer,
seat_order_num: seat
}
})
})
// 1.4设为空位:
export const setBlankPos = (wcsdeviceCode, vehicleCode, layer, seat) => post({
'_SRVNAME': 'service.cacheLine.handle',
'_SRVMETHOD': 'setBlankPos',
'_DATA': JSON.stringify({
accountId: store.getters.accountId,
form: {
wcsdevice_code: wcsdeviceCode,
vehicle_code: vehicleCode,
layer_num: layer,
seat_order_num: seat
}
})
})
// 指令操作
// 1.1指令分页查询:
export const instPageQuery = (form) => post({
'_SRVNAME': 'service.cacheLine.handle',
'_SRVMETHOD': 'instPageQuery',
'_DATA': JSON.stringify({
accountId: store.getters.accountId,
form: form
})
})
// 1.2指令操作:
export const instOperation = (uuid, type) => post({
'_SRVNAME': 'service.cacheLine.handle',
'_SRVMETHOD': 'instOperation',
'_DATA': JSON.stringify({
accountId: store.getters.accountId,
form: {
instruct_uuid: uuid,
opt_type: type
}
})
})
// 缓存线异常处理
// 1.1缓存线异常处理:
export const cacheLineExcepOpt = (wcsdeviceCode, type) => post({
'_SRVNAME': 'service.cacheLine.handle',
'_SRVMETHOD': 'cacheLineExcepOpt',
'_DATA': JSON.stringify({
accountId: store.getters.accountId,
form: {
wcsdevice_code: wcsdeviceCode,
opt_type: type
}
})
})

30
src/config/getData2.js Normal file
View File

@@ -0,0 +1,30 @@
import {post} from '@config/http.js'
// import store from '../vuex/store'
export const getIP = () => post('api/developer/getIP', {})
export const getLogList = () => post('api/developer/getLogList', {})
export const getROSNodeList = () => post('api/developer/getROSNodeList', {})
export const temperature = () => post('api/developer/temperature', {})
export const debugInfo = () => post('api/developer/debugInfo', {})
export const softwareVersion = () => post('api/developer/softwareVersion', {})
export const parameterSetting = (num, word) => post('api/developer/parameterSetting', {
maxTaskNun: num,
password: word
})
export const queryVehicleStatus = () => post('api/vehicle/queryVehicleStatus', {})
export const querrySensor = () => post('api/vehicle/querrySensor', {})
export const softStart = () => post('api/vehicle/softStart', {})
export const skipStartPoint = () => post('api/vehicle/skipStartPoint', {})
export const ShutDown = () => post('api/vehicle/Shut_down', {})
export const queryRestPoint = () => post('api/vehicle/queryRestPoint', {})
export const restCoordinate = (code, name, x, y, t) => post('api/vehicle/restCoordinate', {
point_code: code,
point_name: name,
x: x,
y: y,
t: t
})
export const queryAgvStatus = () => post('api/vehicle/queryAgv_Status', {})
export const quitNow = () => post('api/vehicle/quitNow', {})

93
src/config/http.js Normal file
View File

@@ -0,0 +1,93 @@
import axios from 'axios'
// import qs from 'qs'
import { Dialog } from './utils.js'
// import { Dialog, toast } from './utils.js'
import store from '../vuex/store'
// import router from './../router'
axios.defaults.timeout = 50000
// axios.defaults.retry = 5
// axios.defaults.retryDelay = 10000
axios.defaults.headers.post['Content-Type'] = 'application/json;charset=UTF-8'
axios.interceptors.request.use(
config => {
if (config.method === 'post') {
if (!config.data.flag) {
config.data = config.data
} else {
config.data = config.data.formData
}
}
return config
},
error => {
Dialog('错误的传参')
return Promise.reject(error)
}
)
axios.interceptors.response.use(
response => {
return Promise.resolve(response)
},
error => {
// let condata = error.config.data.split('&')
// console.log('condata', condata)
// if (condata[1] === '_SRVMETHOD=queryProduceOrderReprot' || condata[1] === '_SRVMETHOD=queryQCRecord' || condata[1] === '_SRVMETHOD=queryEquipWorkTeam') {
// toast(error.message)
// setTimeout(() => {
// router.replace({
// path: '/login'
// })
// }, 10000)
// } else {
// if (condata[1] === '_SRVMETHOD=queryEquip') {
// toast(error.message)
// } else {
// Dialog(error.message)
// }
// // Dialog(error.message)
// }
// toast(error.message)
// - 20201215-x
// router.push({
// path: '/500',
// query: {redirect: router.currentRoute.fullPath}
// })
// - 20201215-x
return Promise.reject(error)
// let config = error.config
// if (!config || !config.retry) return Promise.reject(error)
// config.__retryCount = config.__retryCount || 0
// if (config.__retryCount >= config.retry) {
// return Promise.reject(error)
// }
// config.__retryCount += 1
// let backoff = new Promise(resolve => {
// setTimeout(() => {
// resolve()
// }, config.retryDelay || 1)
// })
// return backoff.then(() => {
// return axios(config)
// })
}
)
export const post = (sevmethod, params) => {
return new Promise((resolve, reject) => {
axios.post(`${store.getters.baseUrl}/` + sevmethod, params)
.then(response => {
// if (response.data.code === '0') {
// Dialog(response.data.desc)
// }
resolve(response.data)
}, error => {
reject(error.message)
})
.catch((error) => {
reject(error)
})
})
}

112
src/config/isOperate.js Normal file
View File

@@ -0,0 +1,112 @@
// 用户长时间未操作 退出登录
import store from '../vuex/store'
import router from '@/router'
var timer = null
clearInterval(timer)
export function isOperateFun () {
var lastTime = new Date().getTime() // 最后一次点击时间
var currentTime = new Date().getTime() // 当前时间
var timeOut = 3 * 60 * 1000 // 允许最长未操作时间
// var i = 1 // 辅助作用
function handleReset () { // 重新赋值最后一次点击时间,清除定时器,重新开始定时器
// console.log('又点击了!!!!!!')
// i = 1
lastTime = new Date().getTime()
if (timer) {
clearInterval(timer)
timer = null
}
if (!timer) {
// console.log('真好!重新开始')
handleInterval()
}
}
// document.onclick = () => { // 单击事件
// handleReset()
// }
// document.ondblclick = () => { // 双击事件
// handleReset()
// }
// document.onmousedown = () => { // 按下鼠标键时触发
// handleReset()
// }
// document.onmouseup = () => { // 释放按下的鼠标键时触发
// handleReset()
// }
// document.onmousemove = () => { // 鼠标移动事件
// handleReset()
// }
// document.onmouseover = () => { // 移入事件
// handleReset()
// }
// document.onmouseout = () => { // 移出事件
// handleReset()
// }
// document.onmouseenter = () => { // 移入事件
// handleReset()
// }
// document.onmouseleave = () => { // 移出事件
// handleReset()
// }
// document.touchstart = () => {
// alert('touchstart')
// handleReset()
// }
// document.touchend = () => {
// alert('touchend')
// handleReset()
// }
// document.touchmove = () => {
// alert('touchend')
// handleReset()
// }
window.onload = function startup () {
document.addEventListener('touchstart', handleReset, false)
document.addEventListener('touchend', handleReset, false)
document.addEventListener('touchmove', handleReset, false)
}
function handleInterval () { // 定时器
timer = setInterval(() => {
currentTime = new Date().getTime() // 当前时间
// console.log(`${i++}-currentTime`, currentTime)
// console.log('最后一次点击时间', lastTime)
if (currentTime - lastTime > timeOut) {
// console.log('长时间未操作')
clearInterval(timer) // 清除定时器
store.dispatch('setSignOut').then(() => { // 执行退出并跳转到首页
const path = window.location.href.split('#')[1]
if (path !== '/home') { // 判断当前路由不是首页 则跳转至首页
router.push('/home')
}
})
}
}, 1000)
}
handleInterval() // 一开始程序 默认执行定制器
}

13
src/config/rem.js Normal file
View File

@@ -0,0 +1,13 @@
/** 10.4寸屏4:3的1366*768 */
(function (doc, win) {
var docEl = doc.documentElement
var resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize'
var recalc = function () {
var clientWidth = docEl.clientWidth
if (!clientWidth) return
docEl.style.fontSize = 100 * (clientWidth / 1366) + 'px'
}
if (!doc.addEventListener) return
win.addEventListener(resizeEvt, recalc, false)
doc.addEventListener('DOMContentLoaded', recalc, false)
})(document, window)

81
src/config/utils.js Normal file
View File

@@ -0,0 +1,81 @@
import store from '../vuex/store'
/**
* 弹出框
*/
export const Dialog = (str) => {
store.dispatch('showAlert', true)
store.dispatch('alertMsg', str)
setTimeout(() => {
store.dispatch('showAlert', false)
}, 500000)
}
/**
* 提示框
*/
export const toast = (str) => {
store.dispatch('showToast', true)
store.dispatch('toastMsg', str)
setTimeout(() => {
store.dispatch('showToast', false)
}, 3000)
}
/**
* 存储localStorage
*/
export const setStore = (name, content) => {
if (!name) return
if (typeof content !== 'string') {
content = JSON.stringify(content)
}
window.localStorage.setItem(name, content)
}
/**
* 获取localStorage
*/
export const getStore = name => {
if (!name) return
return window.localStorage.getItem(name)
}
/**
* yy-mm-dd
*/
export const dateFtt = date => {
if (date == null) {
return ''
}
let year = date.getFullYear()
let month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1
let day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
return `${year}-${month}-${day}`
}
/**
* yy-mm-dd hh:mm:ss
*/
export const dateTimeFtt = date => {
if (date == null) {
return ''
}
let year = date.getFullYear()
let month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1
let day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
let hh = date.getHours() < 10 ? '0' + date.getHours() : date.getHours()
let mm = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()
let ss = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
return `${year}-${month}-${day} ${hh}:${mm}:${ss}`
}
/**
* 将字符串形式的日期转换成日期对象
*/
export const dateNew = date => {
if (date === undefined || date === 'undefined') {
return new Date()
}
return new Date(Date.parse(date))
}

109
src/config/websocket.js Normal file
View File

@@ -0,0 +1,109 @@
import { Message } from 'element-ui'
// import { getToken } from '@/utils/authToken' // 与后端的协商websocket请求需要带上token参数
let websock = null
let messageCallback = null
let errorCallback = null
let wsUrl = ''
// let tryTime = 0
// 接收ws后端返回的数据
function websocketonmessage (e) {
messageCallback(JSON.parse(e.data))
}
/**
* 发起websocket连接
* @param {Object} agentData 需要向后台传递的参数数据
*/
function websocketSend (agentData) {
// 加延迟是为了尽量让ws连接状态变为OPEN
setTimeout(() => {
// 添加状态判断当为OPEN时发送消息
if (websock.readyState === websock.OPEN) { // websock.OPEN = 1
// 发给后端的数据需要字符串化
websock.send(JSON.stringify(agentData))
}
if (websock.readyState === websock.CLOSED) { // websock.CLOSED = 3
console.log('websock.readyState=3')
Message.error('ws连接异常请稍候重试')
errorCallback()
}
}, 500)
}
// 关闭ws连接
function websocketclose (e) {
// e.code === 1000 表示正常关闭。 无论为何目的而创建, 该链接都已成功完成任务。
// e.code !== 1000 表示非正常关闭。
if (e && e.code !== 1000) {
Message.error('ws连接异常请稍候重试')
errorCallback()
// // 如果需要设置异常重连则可替换为下面的代码,自行进行测试
// if (tryTime < 10) {
// setTimeout(function() {
// websock = null
// tryTime++
// initWebSocket()
// console.log(`第${tryTime}次重连`)
// }, 3 * 1000)
// } else {
// Message.error('重连失败!请稍后重试')
// }
}
}
// 建立ws连接
function websocketOpen (e) {
// console.log('ws连接成功')
}
// 初始化weosocket
function initWebSocket () {
if (typeof (WebSocket) === 'undefined') {
Message.error('您的浏览器不支持WebSocket无法获取数据')
return false
}
// ws请求完整地址
// const token = 'JWT=' + getToken()
// const requstWsUrl = wsUrl + '?' + token
const requstWsUrl = wsUrl
websock = new WebSocket(requstWsUrl)
websock.onmessage = function (e) {
websocketonmessage(e)
}
websock.onopen = function () {
websocketOpen()
}
websock.onerror = function () {
Message.error('ws连接异常请稍候重试')
errorCallback()
}
websock.onclose = function (e) {
websocketclose(e)
}
}
/**
* 发起websocket请求函数
* @param {string} url ws连接地址
* @param {Object} agentData 传给后台的参数
* @param {function} successCallback 接收到ws数据对数据进行处理的回调函数
* @param {function} errCallback ws连接错误的回调函数
*/
export function sendWebsocket (url, agentData, successCallback, errCallback) {
wsUrl = url
initWebSocket()
messageCallback = successCallback
errorCallback = errCallback
websocketSend(agentData)
}
/**
* 关闭websocket函数
*/
export function closeWebsocket () {
if (websock) {
websock.close() // 关闭websocket
websock.onclose() // 关闭websocket
}
}