设备操控3页面

This commit is contained in:
2024-08-16 09:29:20 +08:00
parent 7bc555c0dd
commit bc29ddb26f
9 changed files with 425 additions and 204 deletions

View File

@@ -1,140 +0,0 @@
<template>
<view class="zd_container">
<!-- 设备操控 -->
<nav-bar :title="title"></nav-bar>
<view class="zd_content">
<view class="zd_wrapper">
<view class="zd-row border-bottom">
<view class="zd-col-7">
<span class="filter_label">扫码点位</span>
</view>
<view class="zd-col-24">
<search-box
v-model="val1"
/>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-7">
<span class="filter_label">操作命令</span>
</view>
<view class="zd-col-24 filter_select">
<uni-data-select v-model="index" :localdata="options" @change="selectChange"></uni-data-select>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-7">
<span class="filter_label">载具编码</span>
</view>
<view class="zd-col-24">
<search-box
v-model="val2"
/>
</view>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-3 button-default" @tap="toEmpty">清空</button>
<button class="zd-col-6 button-primary" :class="{'button-info': !val1 || !index}" :disabled="disabled" @tap="_switchInOut">切换<br/>出入库模式</button>
<button class="zd-col-6 button-primary" :class="{'button-info': !val1 || !index}" :disabled="disabled" @tap="_pinkStartStop">拣选工位<br/>启停模式</button>
<button class="zd-col-7 button-primary" :class="{'button-info': !val1 || !index || !val2}" :disabled="disabled" @tap="_toCommandTP">下发输送线<br/>运动命令</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {switchInOut, pinkStartStop, toCommandTP} from '@/utils/getData2.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
title: '',
val1: '',
options: [{value: '0', text: '是'}, {value: '1', text: '否'}],
index: '',
val2: '',
disabled: false
};
},
onLoad (options) {
this.title = options.title
},
methods: {
selectChange (e) {
this.index = e
},
async _switchInOut () {
this.disabled = true
if (!this.val1 || !this.index) {
this.disabled = false
return
}
try {
let res = await switchInOut(this.val1, this.index)
this.disabled = false
uni.showToast({
title: res.msg,
icon: 'none'
})
} catch (e) {
this.disabled = false
}
},
async _pinkStartStop () {
this.disabled = true
if (!this.val1 || !this.index) {
this.disabled = false
return
}
try {
let res = await pinkStartStop(this.val1, this.index)
this.disabled = false
uni.showToast({
title: res.msg,
icon: 'none'
})
} catch (e) {
this.disabled = false
}
},
async _toCommandTP () {
this.disabled = true
if (!this.val1 || !this.index || !this.val2) {
this.disabled = false
return
}
try {
let res = await toCommandTP(this.val1, this.index, this.val2)
this.disabled = false
uni.showToast({
title: res.msg,
icon: 'none'
})
} catch (e) {
this.disabled = false
}
},
toEmpty () {
this.val1 = ''
this.index = ''
this.val2 = ''
this.disabled = false
}
}
}
</script>
<style lang="stylus" scoped>
@import '../../common/style/mixin.styl';
.button-primary, .button-default
_fj(center)
font-size 26rpx
height 88rpx
line-height 30rpx
</style>

View File

@@ -6,113 +6,89 @@
<view class="zd_wrapper">
<view class="zd-row border-bottom">
<view class="zd-col-7">
<span class="filter_label">物料</span>
<span class="filter_label">物料编码</span>
</view>
<view class="zd-col-24">
<input type="text" class="filter_input" v-model="val1">
<input type="text" class="filter_input" v-model="currentData.material_code" @tap="toJump">
</view>
</view>
</view>
<view class="zd_wrapper grid-wraper">
<view class="slide_new">
<table>
<thead>
<tr>
<th>物料编码</th>
<th>物料名称</th>
<th>物料规格</th>
<th>单位</th>
<th>物料单重</th>
<th>物料批次</th>
<th>物料数量</th>
<th>载具编码</th>
<th>仓库编码</th>
</tr>
</thead>
<tbody>
<tr v-for="(e, i) in dataList" :key="i" :class="{'checked': e.material_id === pkId}" @tap="toCheck(e)">
<td>{{e.material_code}}</td>
<td>{{e.material_name}}</td>
<td>{{e.material_spec}}</td>
<td>{{e.unit_id}}</td>
<td>{{e.single_weight}}</td>
<td>{{e.pcsn}}</td>
<td>{{e.qty}}</td>
<td>{{e.vehicle_code}}</td>
<td>{{e.stor_code}}</td>
</tr>
</tbody>
</table>
</view>
</view>
<uni-load-more color="#007AFF" iconType="circle" :status="status" :icon-size="14" :content-text="contentText" v-if="dataList.length > 0"/>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-5 button-default" @tap="toEmpty">清空</button>
<button class="zd-col-8 button-primary" @tap="searchList">查询</button>
<button class="zd-col-8 button-primary" :class="{'button-info': !pkId}" :disabled="disabled" @tap="_groupMaterIn">组盘确认</button>
</view>
<view class="zd_content msg_wrapper" :class="show ? 'popshow' : 'pophide'">
<view class="msg_content">
<view class="zd-row border-bottom">
<view class="zd-col-6">
<view class="zd-col-7">
<span class="filter_label filter_input_disabled">物料名称</span>
</view>
<view class="zd-col-24">
<input type="text" class="filter_input filter_input_disabled" v-model="currentData.material_name" disabled>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-7">
<span class="filter_label filter_input_disabled">物料规格</span>
</view>
<view class="zd-col-24">
<input type="text" class="filter_input filter_input_disabled" v-model="currentData.material_spec" disabled>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-7">
<span class="filter_label filter_input_disabled">单位</span>
</view>
<view class="zd-col-24">
<input type="text" class="filter_input filter_input_disabled" v-model="currentData.unit_id" disabled>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-7">
<span class="filter_label">物料单重</span>
</view>
<view class="zd-col-17">
<input type="number" class="filter_input" v-model="single_weight">
<view class="zd-col-24">
<input type="number" class="filter_input" v-model="currentData.single_weight">
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-6">
<view class="zd-col-7">
<span class="filter_label">物料批次</span>
</view>
<view class="zd-col-17">
<input type="number" class="filter_input" v-model="pcsn">
<view class="zd-col-24">
<input type="text" class="filter_input" v-model="currentData.pcsn">
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-6">
<view class="zd-col-7">
<span class="filter_label">物料数量</span>
</view>
<view class="zd-col-17">
<input type="number" class="filter_input" v-model="qty">
<view class="zd-col-24">
<input type="number" class="filter_input" v-model="currentData.qty">
</view>
</view>
<view class="zd-row">
<view class="zd-col-6">
<view class="zd-row border-bottom">
<view class="zd-col-7">
<span class="filter_label">载具编码</span>
</view>
<view class="zd-col-17">
<search-box
v-model="vehicle_code"
/>
<view class="zd-col-24">
<search-box v-model="currentData.vehicle_code"/>
</view>
</view>
<view class="zd-row">
<view class="zd-col-6">
<view class="zd-row border-bottom">
<view class="zd-col-7">
<span class="filter_label">仓库编码</span>
</view>
<view class="zd-col-17">
<search-box
v-model="stor_code"
/>
<view class="zd-col-24">
<search-box v-model="currentData.stor_code"/>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-7 button-default" @tap="show = false">关闭</button>
<button class="zd-col-7 button-default" @tap="clearUp">清空</button>
<button class="zd-col-7 button-primary" @tap="toSave">保存</button>
</view>
</view>
<view v-if="show" class="msg_mask"></view>
<view class="zd-row submit-bar">
<button class="zd-col-6 button-default" @tap="toEmpty">清空</button>
<button class="zd-col-15 button-primary" :class="{'button-info': JSON.stringify(currentData) === '{}'}" :disabled="disabled" @tap="_groupMaterIn">组盘确认</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {groupMaterList, groupMaterIn} from '@/utils/getData2.js'
import {groupMaterIn} from '@/utils/getData2.js'
export default {
components: {
NavBar,
@@ -121,109 +97,37 @@
data() {
return {
title: '',
val1: '',
dataList: [],
pkId: '',
reload: false,
status: 'more',
contentText: {
contentdown: '查看更多',
contentrefresh: '加载中',
contentnomore: '没有更多'
},
totalCount: 0,
pageNum: 1,
pageSize: 10,
show: false,
single_weight: null,
pcsn: null,
qty: null,
vehicle_code: '',
stor_code:'',
currentData: {},
disabled: false
};
},
onLoad (options) {
this.title = options.title
},
onShow () {
if (this.$store.getters.publicObj !== '') {
this.currentData = this.$store.getters.publicObj
this.$store.dispatch('setPublicObj', '')
}
},
methods: {
searchList () {
this.dataList = []
this.pageNum = 1
this._groupMaterList()
},
async _groupMaterList () {
let res = await groupMaterList(this.pageNum + '', this.pageSize + '', this.val1)
if (res.code === '200') {
this.totalCount = res.totalElements
if (res.totalElements > 0) {
const dataMap = res.content
this.dataList = this.reload ? dataMap : this.dataList.concat(dataMap)
this.reload = false
} else {
this.dataList = []
}
if (this.totalCount == this.dataList.length) {
this.reload = false
this.status = 'noMore'
}
}
},
onReachBottom () {
if (this.totalCount > this.dataList.length) {
this.status = 'loading'
setTimeout(() => {
this.pageNum++
this._groupMaterList()
}, 1000)
} else { //停止加载
this.status = 'noMore'
}
},
toCheck (e) {
this.pkId = e.material_id
this.show = true
},
clearUp () {
this.single_weight = null
this.pcsn = null
this.qty = null
this.vehicle_code = ''
this.stor_code = ''
},
toSave () {
this.dataList.map(e => {
if (e.material_id === this.pkId) {
e.single_weight = this.single_weight
e.pcsn = this.pcsn
e.qty = this.qty
e.vehicle_code = this.vehicle_code
e.stor_code = this.stor_code
}
toJump () {
uni.navigateTo({
url: '/pages/common/mater-list?title=查询物料'
})
this.show = false
},
toEmpty () {
this.val1 = ''
this.dataList = []
this.pageNum = 1
this.currentData = {}
this.disabled = false
this.pkId = ''
},
async _groupMaterIn () {
this.disabled = true
if (!this.pkId) {
if (JSON.stringify(this.currentData) === '{}') {
this.disabled = false
return
}
let obj = []
this.dataList.map(e => {
if (e.material_id === this.pkId) {
obj = e
}
})
try {
let res = await groupMaterIn(this.stor_code, obj)
let res = await groupMaterIn(this.currentData.stor_code, this.currentData)
if (res.code === '200') {
uni.showToast({
title: res.msg,
@@ -246,8 +150,4 @@
</script>
<style lang="stylus">
@import '../../common/style/mixin.styl';
.msg_wrapper
height auto
min-height 30%
</style>