矿用软废组桶

This commit is contained in:
蔡玲
2024-10-31 18:11:24 +08:00
parent 5afd1bc1db
commit ab748b7771
3 changed files with 420 additions and 1 deletions

View File

@@ -1,6 +1,6 @@
import {post} from '@config/http.js'
/** 软废组桶标签打印-新-2024/10/17 */
/** 软废无袋组桶标签打印-新-2024/10/17 */
// 根据ERP编码查询MES编码
export const queryErpId = (code) => post('api/pda/set/bucketNotbag/queryErpId', {
material_code: code
@@ -13,3 +13,11 @@ export const confirmGroupBucketNo = (mst) => post('api/pda/set/bucketNotbag/conf
export const bucketPrintNo = (code) => post('api/pda/set/bucketNotbag/print', {
bucketunique: code
})
/** 矿用软废组桶-2024/10/31 */
// 1.3根据袋码码查询信息(扫描袋码触发的后台查询请求)--->变更为扫二维码掉后台
export const bucketCheckCode = (code, bk, pcsn) => post('api/pda/set/bucket/checkCode', {
code_info: code,
bucketunique: bk,
pcsn: pcsn
})

View File

@@ -0,0 +1,406 @@
<template>
<section>
<nav-bar title="矿用软废组桶"></nav-bar>
<section ref="content" class="content mgb70" :style="'margin-top: '+(0.96+2 * 0.92)+ 'rem'">
<div class="filter-wraper">
<div class="bottom-filter-tip">
<div class="filter-label txtjustify">桶码</div>
<div class="fxcol mgl20">
<input type="text" class="filter-input filter-scan-input" v-model="val1" disabled>
</div>
</div>
<div class="bottom-filter-tip">
<div class="filter-label txtjustify">物料编码</div>
<div class="fxcol mgl20">
<input type="text" class="filter-input filter-scan-input" v-model="val2" disabled>
</div>
</div>
<div class="bottom-filter-tip">
<div class="filter-label txtjustify">批次</div>
<div class="fxcol mgl20">
<input type="text" class="filter-input filter-scan-input" v-model="val3" disabled>
</div>
</div>
<div class="bottom-filter-tip">
<div class="filter-label txtjustify">是否可用</div>
<div class="fxcol mgl20 visible" >
<dropdown-menu
:option="option"
:active="active"
:open="open"
@toggleItem="toggleItem"
@dropdownMenu="dropdownMenu">
</dropdown-menu>
</div>
</div>
<div class="bottom-filter-tip">
<div class="filter-label txtjustify">等级</div>
<div class="fxcol mgl20 visible" >
<dropdown-menu
:option="option1"
:active="active1"
:open="open1"
@toggleItem="toggleItem1"
@dropdownMenu="dropdownMenu1">
</dropdown-menu>
</div>
</div>
<search-box
label="袋码"
v-model="val4"
:focused='true'
@handleChange="handleChange4"
></search-box>
</div>
<div class="grid-wraper">
<div class="left_fixed">
<table class="layout-t left_layout_t">
<tr>
<th>桶码</th>
</tr>
<tr v-for="e in dataList" :key="e.bag_id" @click="toCheck(e)" :class="{'checked': e.bag_id === pkId}">
<td>{{e.bucketunique}}</td>
</tr>
</table>
</div>
<div class="slide">
<table class="layout-t">
<tr>
<th>袋码</th>
<th>物料编码</th>
<th>批次</th>
<th>重量kg</th>
<th>是否新加</th>
</tr>
<tr v-for="e in dataList" :key="e.bag_id" @click="toCheck(e)" :class="{'checked': e.bag_id === pkId}">
<td>{{e.bag_id}}</td>
<td>{{e.material_code}}</td>
<td>{{e.pcsn}}</td>
<td>{{e.storage_qty | numeric(3)}}</td>
<td>{{e.is_new_name}}</td>
</tr>
</table>
</div>
</div>
</section>
<section class="calc_value_wraper">
<div class="bottom-filter-tip">
<div class="filter-label txtjustify">总重量</div>
<div class="fxcol mgl20">
<input type="text" class="filter-input filter-scan-input" disabled v-model="val5">
</div>
<div class="mgl20">KG</div>
</div>
</section>
<section ref="submit" class="submit-bar submit-bar1">
<button class="btn submit-button" @click="cancle">清空</button>
<button class="btn submit-button" :disabled="disabled3" :class="{'btn-disabled': pkId === ''}" @click="deleteList">删除行</button>
<button class="btn submit-button" :disabled="disabled4" :class="{'btn-disabled': dataList.length === 0 || val2 === '' || val2 === undefined}" @click="toSure">组桶</button>
<button class="btn submit-button" :disabled="disabled1" :class="{'btn-disabled': dataList.length === 0 || val2 === '' || val2 === undefined}" @click="toSurePrint">组桶并打印</button>
<button class="btn submit-button" :disabled="disabled2" :class="{'btn-disabled': val1 === ''}" @click="toPrint">打印</button>
<div class="fxrow bottom-filter-tip_1">
<div class="iconfont check_icon check_icon--squa" :class="{'check_icon--checked': printWeight === true}" @click="toAdd"></div>
<div class="check_icon_txt">是否打印重量</div>
</div>
<i ref="arrow" class="iconfont open_icon" @click="packUp"></i>
</section>
</section>
</template>
<script>
import NavBar from '@components/NavBar.vue'
import SearchBox from '@components/SearchBox.vue'
import DropdownMenu from '@components/DropdownMenu.vue'
import { confirmGroupBucket, bucketPrint, bucketDelete, bucketGetLevel } from '@config/getData2.js'
import { bucketCheckCode } from '@config/getData3.js'
import {accAdd, submitPackUp} from '@config/mUtils.js'
import {toPrint} from '@config/print.js'
export default {
name: 'MiningSoftWasteBarrel',
components: {
NavBar,
SearchBox,
DropdownMenu
},
data () {
return {
val1: '',
val2: '',
val3: '',
val4: '',
dataList: [],
pkId: '',
pkObj: {},
disabled1: false,
disabled2: false,
disabled3: false,
disabled4: false,
printWeight: true,
option: [{value: '0', label: '不可用'}, {value: '1', label: '可用'}],
active: '1',
open: false,
option1: [],
active1: '',
open1: false
}
},
computed: {
val5 () {
let cur = '0.000'
if (this.dataList.length) {
this.dataList.map(el => {
cur = accAdd(cur, el.storage_qty)
})
cur = Number(cur).toFixed(3) + ''
}
return cur
}
},
created () {
this._bucketGetLevel()
},
methods: {
handleChange4 (e, type) {
if (this.val2 === '') {
this.toast('物料编码不能为空')
return
}
if (type) {
this._bucketCheckCode(e)
}
},
toCheck (e) {
this.pkId = this.pkId === e.bag_id ? '' : e.bag_id
this.pkObj = this.pkId === e.bag_id ? e : {}
},
toAdd () {
this.printWeight = !this.printWeight
},
/** 等级 */
async _bucketGetLevel () {
let res = await bucketGetLevel()
if (res.code === '1') {
this.option1 = [...res.result]
this.active1 = '0'
} else {
this.Dialog(res.desc)
}
},
/** 袋码查询信息 */
async _bucketCheckCode (e) {
let res = await bucketCheckCode(e, this.val1, this.val3)
if (res.code === '1') {
if (this.dataList.length) {
let arr1 = this.dataList.filter(el => {
return el.bag_id === res.result.bag_id
})
if (arr1.length === 0) {
this.dataList.push(res.result)
this.val1 = res.resultTwo.bucketunique
this.val2 = res.resultTwo.material_code
this.val3 = res.resultTwo.pcsn
} else {
this.toast('袋码已存在')
this.val4 = ''
}
} else {
if (JSON.stringify(res.result) !== '{}') {
this.dataList.push(res.result)
this.val1 = res.resultTwo.bucketunique
this.val2 = res.resultTwo.material_code
this.val3 = res.resultTwo.pcsn
}
}
} else {
this.toast(res.desc)
}
},
/** 删除行 */
deleteList () {
this.disabled3 = true
if (this.pkId === '') {
this.toast('袋码不能为空')
this.disabled3 = false
return
}
this._bucketDelete()
},
async _bucketDelete () {
try {
let res = await bucketDelete(this.pkObj.bucketunique, this.pkId)
if (res.code === '1') {
this.toast(res.desc)
this.dataList.map((el, i) => {
if (el.bag_id === this.pkId) {
this.dataList.splice(i, 1)
}
})
this.pkId = ''
this.pkObj = {}
} else {
this.Dialog(res.desc)
}
this.disabled3 = false
} catch (e) {
this.disabled3 = false
}
},
/** 组桶 */
toSure () {
this.disabled4 = true
if (this.dataList.length === 0) {
this.disabled4 = false
return
}
this._confirmGroupBucket()
},
async _confirmGroupBucket () {
try {
let accountId = this.$store.getters.userInfo !== '' ? JSON.parse(this.$store.getters.userInfo).account_id : ''
let user = this.$store.getters.userInfo !== '' ? JSON.parse(this.$store.getters.userInfo).user_name : ''
let newObj = Object.assign({}, {storage_qty: this.val5, accountId: accountId, user: user, is_active: this.option[this.active].value, ivt_level: this.option1[this.active1].value})
let res = await confirmGroupBucket(newObj, this.dataList)
if (res.code === '1') {
this.toast(res.desc)
this.val1 = ''
this.val2 = ''
this.val3 = ''
this.val4 = ''
this.dataList = []
this.pkId = ''
this.pkObj = {}
this.disabled4 = false
this.active = '1'
this.active1 = '0'
} else {
this.Dialog(res.desc)
this.disabled4 = false
}
} catch (e) {
this.disabled4 = false
}
},
/** 组桶并打印 */
toSurePrint () {
this.disabled1 = true
if (this.dataList.length === 0) {
this.disabled1 = false
return
}
this._confirmGroupBucketPrint()
},
async _confirmGroupBucketPrint () {
try {
let accountId = this.$store.getters.userInfo !== '' ? JSON.parse(this.$store.getters.userInfo).account_id : ''
let user = this.$store.getters.userInfo !== '' ? JSON.parse(this.$store.getters.userInfo).user_name : ''
let newObj = Object.assign({}, {storage_qty: this.val5, accountId: accountId, user: user, is_active: this.option[this.active].value, ivt_level: this.option1[this.active1].value})
let res = await confirmGroupBucket(newObj, this.dataList)
if (res.code === '1') {
this.toast(res.desc)
if (JSON.stringify(res.result) !== '{}') {
let data = Object.assign({}, res.result, {printWeight: this.printWeight})
setTimeout(toPrint(data), 800)
}
this.val1 = ''
this.val2 = ''
this.val3 = ''
this.val4 = ''
this.dataList = []
this.pkId = ''
this.pkObj = {}
this.disabled1 = false
this.active = '1'
this.active1 = '0'
} else {
this.Dialog(res.desc)
this.disabled1 = false
}
} catch (e) {
this.disabled1 = false
}
},
async toPrint () {
this.disabled2 = true
if (this.val1 === '') {
this.disabled2 = false
return
}
try {
let res = await bucketPrint(this.val1)
if (res.code === '1') {
this.toast(res.desc)
if (JSON.stringify(res.result) !== '{}') {
let data = Object.assign({}, res.result, {printWeight: this.printWeight})
setTimeout(toPrint(data), 800)
}
Object.assign(this.$data, this.$options.data())
} else {
this.Dialog(res.desc)
}
this.disabled2 = false
} catch (e) {
this.disabled2 = false
}
},
/** 清空 */
cancle () {
this.val1 = ''
this.val2 = ''
this.val3 = ''
this.val4 = ''
this.dataList = []
this.pkId = ''
this.pkObj = {}
this.disabled1 = false
this.disabled2 = false
this.disabled3 = false
this.disabled4 = false
this.active = '1'
this.active1 = '0'
},
packUp () {
this.up = submitPackUp(this.$refs.submit, this.$refs.arrow, this.$refs.content, 2, this.up)
},
toggleItem () {
if (!this.open) {
this.open = true
} else {
this.open = false
}
},
dropdownMenu (i) {
this.active = i + ''
this.open = false
},
toggleItem1 () {
if (!this.open1) {
this.open1 = true
} else {
this.open1 = false
}
},
dropdownMenu1 (i) {
this.active1 = i + ''
this.open1 = false
}
}
}
</script>
<style lang="stylus" scoped>
@import '~@style/mixin'
.bottom-filter-tip_1
width 35%
margin-right 5%
.bottom-filter-tip_2
width 65%
.width1
width .9rem
.width2
width calc(100% - 1.5rem)
.width3
width .5rem
_font(.3rem,1,#323232,,right)
.check_icon_txt
_font(.3rem,1,#323232,,left)
</style>

View File

@@ -10,6 +10,7 @@ const Setup = r => require.ensure([], () => r(require('../pages/login/Setup')),
const PwdManage = r => require.ensure([], () => r(require('../pages/login/PwdManage')), 'PwdManage')
// xinrui
const SoftWasteBarrelPrint = r => require.ensure([], () => r(require('../pages/xinrui/storage/settings/SoftWasteBarrelPrint')), 'settings')
const MiningSoftWasteBarrel = r => require.ensure([], () => r(require('../pages/xinrui/storage/settings/MiningSoftWasteBarrel')), 'settings')
const SoftWasteBarrelPrintNobag = r => require.ensure([], () => r(require('../pages/xinrui/storage/settings/SoftWasteBarrelPrintNobag')), 'settings')
const SoftWasteBagPrint = r => require.ensure([], () => r(require('../pages/xinrui/storage/settings/SoftWasteBagPrint')), 'settings')
const ReworkBarrelPrint = r => require.ensure([], () => r(require('../pages/xinrui/storage/settings/ReworkBarrelPrint')), 'settings')
@@ -164,6 +165,10 @@ export default new Router({
path: '/SoftWasteBarrelPrint', // 软废组桶标签打印
component: SoftWasteBarrelPrint
},
{
path: '/MiningSoftWasteBarrel', // 矿用软废组桶
component: MiningSoftWasteBarrel
},
{
path: '/SoftWasteBarrelPrintNobag', // 软废无袋组桶标签打印
component: SoftWasteBarrelPrintNobag