优化
This commit is contained in:
@@ -5,7 +5,8 @@ const BASE_URL = '/materialType/materialType'
|
|||||||
export interface MaterialTypeResp {
|
export interface MaterialTypeResp {
|
||||||
id: string
|
id: string
|
||||||
typeName: string
|
typeName: string
|
||||||
floatRatio: string
|
upFloatRatio: string
|
||||||
|
downFloatRatio: string
|
||||||
createTime: string
|
createTime: string
|
||||||
updateTime: string
|
updateTime: string
|
||||||
createUser: string
|
createUser: string
|
||||||
@@ -26,6 +27,11 @@ export function listMaterialType(query: MaterialTypePageQuery) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** @desc 新增物料品类 */
|
/** @desc 新增物料品类 */
|
||||||
|
export function addMaterialType(data: any) {
|
||||||
|
return http.post(`${BASE_URL}`, data)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @desc 查询物料品类 */
|
||||||
export function selectList() {
|
export function selectList() {
|
||||||
return http.get(`${BASE_URL}/selectList`)
|
return http.get(`${BASE_URL}/selectList`)
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
src/assets/wav/tooLess.wav
Normal file
BIN
src/assets/wav/tooLess.wav
Normal file
Binary file not shown.
BIN
src/assets/wav/tooMany.wav
Normal file
BIN
src/assets/wav/tooMany.wav
Normal file
Binary file not shown.
@@ -17,7 +17,6 @@
|
|||||||
import { Message } from '@arco-design/web-vue'
|
import { Message } from '@arco-design/web-vue'
|
||||||
import { useWindowSize } from '@vueuse/core'
|
import { useWindowSize } from '@vueuse/core'
|
||||||
import {
|
import {
|
||||||
getMaterialProcess,
|
|
||||||
addMaterialProcess,
|
addMaterialProcess,
|
||||||
updateMaterialProcess,
|
updateMaterialProcess,
|
||||||
type MaterialProcessResp
|
type MaterialProcessResp
|
||||||
|
|||||||
@@ -75,7 +75,6 @@ const {
|
|||||||
handleDelete
|
handleDelete
|
||||||
} = useTable((page) => listMaterialProcess({ ...queryForm, ...page }), { immediate: true })
|
} = useTable((page) => listMaterialProcess({ ...queryForm, ...page }), { immediate: true })
|
||||||
const columns = ref<TableInstanceColumns[]>([
|
const columns = ref<TableInstanceColumns[]>([
|
||||||
{ title: '主键ID', dataIndex: 'id', slotName: 'id' },
|
|
||||||
{ title: '流程名称', dataIndex: 'processName', slotName: 'processName' },
|
{ title: '流程名称', dataIndex: 'processName', slotName: 'processName' },
|
||||||
{ title: '流程编码', dataIndex: 'processCode', slotName: 'processCode' },
|
{ title: '流程编码', dataIndex: 'processCode', slotName: 'processCode' },
|
||||||
{ title: '创建时间', dataIndex: 'createTime', slotName: 'createTime' },
|
{ title: '创建时间', dataIndex: 'createTime', slotName: 'createTime' },
|
||||||
|
|||||||
@@ -9,14 +9,38 @@
|
|||||||
@before-ok="save"
|
@before-ok="save"
|
||||||
@close="reset"
|
@close="reset"
|
||||||
>
|
>
|
||||||
<GiForm ref="formRef" v-model="form" :columns="columns" />
|
<GiForm ref="formRef" v-model="form" :columns="columns">
|
||||||
|
<template #floatRatio>
|
||||||
|
<div style="display: flex; align-items: center; gap: 12px;">
|
||||||
|
<a-input-number
|
||||||
|
v-model="form.downFloatRatio"
|
||||||
|
style="width: 45%"
|
||||||
|
:min="-100"
|
||||||
|
:max="100"
|
||||||
|
:mode="'button'"
|
||||||
|
placeholder="最小值"
|
||||||
|
required: true,
|
||||||
|
/>
|
||||||
|
<span style="color: #999;">至</span>
|
||||||
|
<a-input-number
|
||||||
|
v-model="form.upFloatRatio"
|
||||||
|
style="width: 45%"
|
||||||
|
:min="0"
|
||||||
|
:max="100"
|
||||||
|
:mode="'button'"
|
||||||
|
placeholder="最大值"
|
||||||
|
required: true,
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</GiForm>
|
||||||
</a-modal>
|
</a-modal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { Message } from '@arco-design/web-vue'
|
import { Message } from '@arco-design/web-vue'
|
||||||
import { useWindowSize } from '@vueuse/core'
|
import { useWindowSize } from '@vueuse/core'
|
||||||
import {addMaterialType, type MaterialTypeResp, updateMaterialType} from '@/apis/materialType/materialType'
|
import { addMaterialType, type MaterialTypeResp, updateMaterialType} from '@/apis/materialType/materialType'
|
||||||
import { type ColumnItem, GiForm } from '@/components/GiForm'
|
import { type ColumnItem, GiForm } from '@/components/GiForm'
|
||||||
import { useResetReactive } from '@/hooks'
|
import { useResetReactive } from '@/hooks'
|
||||||
|
|
||||||
@@ -45,11 +69,10 @@ const columns: ColumnItem[] = reactive([
|
|||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '品类浮动比',
|
label: '浮动范围(%)',
|
||||||
field: 'floatRatio',
|
field: 'floatRatio',
|
||||||
type: 'input-number',
|
type: 'custom',
|
||||||
span: 24,
|
span: 24,
|
||||||
required: true,
|
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -96,4 +119,4 @@ const onUpdate = async (data: MaterialTypeResp) => {
|
|||||||
defineExpose({ onAdd, onUpdate })
|
defineExpose({ onAdd, onUpdate })
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss"></style>
|
<style scoped lang="scss"></style>
|
||||||
@@ -33,6 +33,11 @@
|
|||||||
<template #default>导出</template>
|
<template #default>导出</template>
|
||||||
</a-button>
|
</a-button>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<template #floatRatio="{ record }">
|
||||||
|
{{ record.downFloatRatio + '% ~ ' + record.upFloatRatio + '%' }}
|
||||||
|
</template>
|
||||||
|
|
||||||
<template #action="{ record }">
|
<template #action="{ record }">
|
||||||
<a-space>
|
<a-space>
|
||||||
<a-link v-permission="['materialType:materialType:update']" title="修改" @click="onUpdate(record)">修改</a-link>
|
<a-link v-permission="['materialType:materialType:update']" title="修改" @click="onUpdate(record)">修改</a-link>
|
||||||
@@ -79,13 +84,12 @@ const {
|
|||||||
handleDelete
|
handleDelete
|
||||||
} = useTable((page) => listMaterialType({ ...queryForm, ...page }), { immediate: true })
|
} = useTable((page) => listMaterialType({ ...queryForm, ...page }), { immediate: true })
|
||||||
const columns = ref<TableInstanceColumns[]>([
|
const columns = ref<TableInstanceColumns[]>([
|
||||||
{ title: '主键ID', dataIndex: 'id', slotName: 'id' },
|
|
||||||
{ title: '品类名称', dataIndex: 'typeName', slotName: 'typeName' },
|
{ title: '品类名称', dataIndex: 'typeName', slotName: 'typeName' },
|
||||||
{
|
{
|
||||||
title: h('span', null, [
|
title: h('span', null, [
|
||||||
'品类浮动比',
|
'品类上下浮动范围(%)',
|
||||||
h('a-tooltip', {
|
h('a-tooltip', {
|
||||||
title: '计算公式:电子称称重重量/(物料单位克重*物料数量)- 1'
|
title: '领取物料重量不得超出此百分比范围'
|
||||||
}, [
|
}, [
|
||||||
h('span', {
|
h('span', {
|
||||||
style: {
|
style: {
|
||||||
@@ -95,9 +99,9 @@ const columns = ref<TableInstanceColumns[]>([
|
|||||||
}
|
}
|
||||||
}, '?')
|
}, '?')
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
dataIndex: 'floatRatio',
|
dataIndex: 'upFloatRatio',
|
||||||
slotName: 'floatRatio'
|
slotName: 'floatRatio'
|
||||||
},
|
},
|
||||||
{ title: '创建时间', dataIndex: 'createTime', slotName: 'createTime' },
|
{ title: '创建时间', dataIndex: 'createTime', slotName: 'createTime' },
|
||||||
{ title: '更新时间', dataIndex: 'updateTime', slotName: 'updateTime', show: false },
|
{ title: '更新时间', dataIndex: 'updateTime', slotName: 'updateTime', show: false },
|
||||||
|
|||||||
@@ -131,7 +131,7 @@
|
|||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-item">
|
<div class="form-item">
|
||||||
<label>输入数量:</label>
|
<label>输入数量:</label>
|
||||||
<a-input v-model="inputQuantity" placeholder="请输入数量" @change="calculateWeight" />
|
<a-input-number :min="1" mode="button" v-model="inputQuantity" placeholder="请输入数量" @change="calculateWeight" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
@@ -139,13 +139,17 @@
|
|||||||
<label>计算重量(g):</label>
|
<label>计算重量(g):</label>
|
||||||
<a-input v-model="calculatedWeight" placeholder="-" disabled />
|
<a-input v-model="calculatedWeight" placeholder="-" disabled />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div class="form-row">
|
|
||||||
<div class="form-item">
|
<div class="form-item">
|
||||||
<label>对应重量(g):</label>
|
<label>对应重量(g):</label>
|
||||||
<a-input v-model="ahDeviceWeight" placeholder="-" disabled />
|
<a-input v-model="ahDeviceWeight" placeholder="-" disabled />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="form-item">
|
||||||
|
<label>该物料重量范围:</label>
|
||||||
|
<a-input v-model="formData.materialName" placeholder="该物料重量范围" disabled />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- 这里是摄像头画面 - 替换成FLV播放器 -->
|
<!-- 这里是摄像头画面 - 替换成FLV播放器 -->
|
||||||
<div class="video-container large-image">
|
<div class="video-container large-image">
|
||||||
@@ -463,30 +467,30 @@ const checkCameraStatus = () => {
|
|||||||
let statusCheckTimer: any = null
|
let statusCheckTimer: any = null
|
||||||
|
|
||||||
// 监听步骤变化
|
// 监听步骤变化
|
||||||
watch(activeStep, (newVal) => {
|
// watch(activeStep, (newVal) => {
|
||||||
if (newVal === 2) {
|
// if (newVal === 2) {
|
||||||
// 进入称重登记页面,启动摄像头
|
// // 进入称重登记页面,启动摄像头
|
||||||
reconnectCount.value = 1 // 重置重连计数
|
// reconnectCount.value = 1 // 重置重连计数
|
||||||
nextTick(() => {
|
// nextTick(() => {
|
||||||
initCamera()
|
// initCamera()
|
||||||
})
|
// })
|
||||||
|
//
|
||||||
// 启动状态检查(每30秒检查一次)
|
// // 启动状态检查(每30秒检查一次)
|
||||||
statusCheckTimer = setInterval(checkCameraStatus, 30000)
|
// statusCheckTimer = setInterval(checkCameraStatus, 30000)
|
||||||
} else {
|
// } else {
|
||||||
// 离开称重登记页面,停止摄像头和定时器
|
// // 离开称重登记页面,停止摄像头和定时器
|
||||||
stopCamera()
|
// stopCamera()
|
||||||
if (statusCheckTimer) {
|
// if (statusCheckTimer) {
|
||||||
clearInterval(statusCheckTimer)
|
// clearInterval(statusCheckTimer)
|
||||||
statusCheckTimer = null
|
// statusCheckTimer = null
|
||||||
}
|
// }
|
||||||
if (reconnectTimer.value) {
|
// if (reconnectTimer.value) {
|
||||||
clearTimeout(reconnectTimer.value)
|
// clearTimeout(reconnectTimer.value)
|
||||||
reconnectTimer.value = null
|
// reconnectTimer.value = null
|
||||||
}
|
// }
|
||||||
reconnectCount.value = 1
|
// reconnectCount.value = 1
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
|
|
||||||
// 组件卸载时清理所有定时器
|
// 组件卸载时清理所有定时器
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
@@ -594,9 +598,9 @@ const workOrderResp = ref<WorkOrderResp>({
|
|||||||
})
|
})
|
||||||
|
|
||||||
// 称重登记页面数据
|
// 称重登记页面数据
|
||||||
const inputQuantity = ref('')
|
const inputQuantity = ref()
|
||||||
// todo
|
// todo
|
||||||
const ahDeviceWeight = ref('10.1')
|
const ahDeviceWeight = ref('100')
|
||||||
const calculatedWeight = ref('')
|
const calculatedWeight = ref('')
|
||||||
const weighingCount = ref(1)
|
const weighingCount = ref(1)
|
||||||
|
|
||||||
@@ -871,7 +875,7 @@ const handleBackToFirst = () => {
|
|||||||
// 重置称重登记页面数据
|
// 重置称重登记页面数据
|
||||||
inputQuantity.value = ''
|
inputQuantity.value = ''
|
||||||
// todo
|
// todo
|
||||||
ahDeviceWeight.value = '10.1'
|
ahDeviceWeight.value = '100'
|
||||||
calculatedWeight.value = ''
|
calculatedWeight.value = ''
|
||||||
weighingCount.value = 1
|
weighingCount.value = 1
|
||||||
// 清空称重列表
|
// 清空称重列表
|
||||||
@@ -908,8 +912,8 @@ const calculateWeight = () => {
|
|||||||
//处理确定
|
//处理确定
|
||||||
const handleConfirm = async () => {
|
const handleConfirm = async () => {
|
||||||
// 校验输入数量是否为空
|
// 校验输入数量是否为空
|
||||||
if (!inputQuantity.value || inputQuantity.value.trim() === '') {
|
if (!inputQuantity.value || inputQuantity.value <= 0) {
|
||||||
Message.error('请输入数量')
|
Message.error('数量需大于0!')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!ahDeviceWeight.value || ahDeviceWeight.value.trim() === '') {
|
if (!ahDeviceWeight.value || ahDeviceWeight.value.trim() === '') {
|
||||||
@@ -919,15 +923,27 @@ const handleConfirm = async () => {
|
|||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
calculatedWeight: calculatedWeight.value,
|
calculatedWeight: calculatedWeight.value,
|
||||||
|
materialId: formData.id,
|
||||||
inputQuantity: inputQuantity.value,
|
inputQuantity: inputQuantity.value,
|
||||||
ahDeviceWeight: ahDeviceWeight.value,
|
ahDeviceWeight: ahDeviceWeight.value,
|
||||||
}
|
}
|
||||||
|
|
||||||
const res = await validateWeighing(data);
|
const res = await validateWeighing(data);
|
||||||
if (res.code != '0') {
|
// 然后处理错误信息
|
||||||
Message.error(res.msg || '系统异常!');
|
if (!res || !res.code) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (res.data.code !== '200') {
|
||||||
|
if (res.data.code !== '501') {
|
||||||
|
playAudio('tooMany')
|
||||||
|
}
|
||||||
|
if (res.data.code !== '502') {
|
||||||
|
playAudio('tooLess')
|
||||||
|
}
|
||||||
|
Message.error(res.data.msg || '系统异常!');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 立即创建一个新项的基本数据
|
// 立即创建一个新项的基本数据
|
||||||
const newItem = {
|
const newItem = {
|
||||||
@@ -946,7 +962,7 @@ const handleConfirm = async () => {
|
|||||||
// 重置输入(让用户能继续输入)
|
// 重置输入(让用户能继续输入)
|
||||||
inputQuantity.value = ''
|
inputQuantity.value = ''
|
||||||
// todo
|
// todo
|
||||||
ahDeviceWeight.value = '10.1'
|
ahDeviceWeight.value = '100'
|
||||||
calculatedWeight.value = ''
|
calculatedWeight.value = ''
|
||||||
weighingCount.value = weighingList.value.length + 1
|
weighingCount.value = weighingList.value.length + 1
|
||||||
|
|
||||||
@@ -1098,6 +1114,20 @@ const closeWebSocket = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 播放音频文件
|
||||||
|
const playAudio = (filename: string) => {
|
||||||
|
console.log(filename)
|
||||||
|
try {
|
||||||
|
// 创建音频对象并播放
|
||||||
|
const audio = new Audio(`/src/assets/wav/${filename}.wav`)
|
||||||
|
audio.play().catch(error => {
|
||||||
|
console.error('音频播放失败:', error)
|
||||||
|
})
|
||||||
|
} catch (error) {
|
||||||
|
console.error('播放音频时出错:', error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 组件卸载时关闭WebSocket连接
|
// 组件卸载时关闭WebSocket连接
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
closeWebSocket()
|
closeWebSocket()
|
||||||
|
|||||||
Reference in New Issue
Block a user