This commit is contained in:
2024-07-30 16:22:51 +08:00
parent b4750a9ee0
commit e363d5f7e3
3 changed files with 166 additions and 330 deletions

View File

@@ -0,0 +1,82 @@
<template>
<div class="bottom-filter-tip">
<div class="filter-label txtjustify">{{label}}</div>
<div class="fxcol mgl20 relative">
<input
type="text"
class="filter-input filter-scan-input search_input"
ref="input"
:placeholder="placeholder"
:value="value"
@focus="handleFocus"
@blur="handleBlur"
@submit="handleSend">
<div class="button_box">
<button class="search_box_icon" @click="focusState = true">
<span class="iconfont scan_icon" :class="{'scan_icon_checked': focusState}"></span>
</button>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'SearchBox',
model: {
prop: 'value',
event: 'input'
},
props: {
value: String,
label: String,
placeholder: {
type: String,
default: ''
}
},
data () {
return {
focusState: false,
readOnly: false
}
},
methods: {
handleFocus () {
this.$refs.input.focus()
this.focusState = true
},
handleBlur (e) {
this.$emit('input', e.target.value)
if (e.target.value.length) {
this.$emit('handleChange', e.target.value)
}
this.focusState = false
},
handleSend (e) {
this.$emit('input', e.target.value)
if (e.target.value.length) {
this.$emit('handleChange', e.target.value)
}
}
}
}
</script>
<style lang="stylus" scoped>
@import '~@style/mixin'
.search_input
padding-right .7rem
.button_box
_fj()
position absolute
top 50%
transform translateY(-50%)
right 0.02rem
// height .9rem
.search_box_icon
_wh(.7rem, 100%)
background-color #fff
.bor_r
border-right 0.02rem solid #dcdfe6
</style>

View File

@@ -66,10 +66,18 @@ export const confirmGroupBucket = (mst, dtl) => post('api/pda/set/bucket/confirm
mst: mst,
dtl: dtl
})
// 软废无袋组桶标签打印-确定组桶(点击确定组桶按钮)
export const confirmGroupBucketNo = (mst) => post('api/pda/set/bucket/confirmGroupBucket2', {
mst: mst
})
// 1.4 确定组桶打印(点击确定组桶按钮)
export const bucketPrint = (code) => post('api/pda/set/bucket/print', {
bucketunique: code
})
// 软废无袋组桶标签打印-确定组桶打印(点击确定组桶按钮)
export const bucketPrintNo = (code) => post('api/pda/set/bucket/print2', {
bucketunique: code
})
// 1.5等级下拉框
export const bucketGetLevel = () => post('api/pda/set/bucket/getLevel', {})

View File

@@ -1,26 +1,25 @@
<template>
<section>
<nav-bar title="软废无袋组桶标签打印"></nav-bar>
<section ref="content" class="content mgb70" :style="'margin-top: '+(0.96+2 * 0.92)+ 'rem'">
<section ref="content" class="content mgb70" :style="'margin-top: '+(0.96+ 0.92 + 0.76)+ 'rem'">
<div class="filter-wraper">
<search-box
ref="scanChild"
label="桶码"
placeholder="请按扫码键输入"
v-model="val1"
@handleChange="handleChange1"
@handleChange="handleChange"
></search-box>
<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 class="mgl20">
<button class="btn" :disabled="disabled4" :class="{'btn-disabled': this.val1 !== ''}" @click="searchList">查询</button>
</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">
<input type="text" class="filter-input filter-scan-input" v-model="val3" disabled>
</div>
</div>
<div class="bottom-filter-tip">
@@ -30,11 +29,16 @@
:option="option"
:active="active"
:open="open"
@toggleItem="toggleItem"
@dropdownMenu="dropdownMenu">
:disabled="true">
</dropdown-menu>
</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="val5" disabled>
</div>
</div>
<div class="bottom-filter-tip">
<div class="filter-label txtjustify">等级</div>
<div class="fxcol mgl20 visible" >
@@ -42,64 +46,24 @@
:option="option1"
:active="active1"
:open="open1"
@toggleItem="toggleItem1"
@dropdownMenu="dropdownMenu1">
:disabled="true">
</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 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="val4" disabled>
</div>
<div class="mgl20">KG</div>
</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="disabled5" :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>
<button class="btn submit-button" :disabled="disabled1" :class="{'btn-disabled': val1 === ''}" @click="toSure">组桶</button>
<button class="btn submit-button" :disabled="disabled2" :class="{'btn-disabled': val1 === ''}" @click="toSurePrint">组桶并打印</button>
<button class="btn submit-button" :disabled="disabled3" :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>
@@ -111,10 +75,10 @@
<script>
import NavBar from '@components/NavBar.vue'
import SearchBox from '@components/SearchBox.vue'
import SearchBox from '@components/SearchBox3.vue'
import DropdownMenu from '@components/DropdownMenu.vue'
import { queryInfoBybucket, queryInfoByBag, confirmGroupBucket, bucketPrint, bucketDelete, getpcsn, bucketGetLevel } from '@config/getData2.js'
import {accAdd, submitPackUp} from '@config/mUtils.js'
import { bucketGetLevel, confirmGroupBucketNo, bucketPrintNo } from '@config/getData2.js'
import {submitPackUp} from '@config/mUtils.js'
import {toPrint} from '@config/print.js'
export default {
name: 'SoftWasteBarrelPrint',
@@ -129,6 +93,7 @@ export default {
val2: '',
val3: '',
val4: '',
val5: '',
result: {},
dataList: [],
dataList2: [],
@@ -137,276 +102,94 @@ export default {
disabled1: false,
disabled2: false,
disabled3: false,
disabled4: false,
disabled5: false,
printWeight: true,
option: [{value: '0', label: '不可用'}, {value: '1', label: '可用'}],
active: '1',
active: '',
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
}
},
beforeRouteLeave (to, from, next) {
if (to.path === '/home' || to.path === '/login') {
this.$store.dispatch('setKeepAlive', [])
}
next()
},
activated () {
if (this.val2 !== '' && this.$store.getters.materObj !== '' && this.val2 !== this.$store.getters.materObj.material_code) {
this.dataList = []
this.val4 = ''
}
if (this.$store.getters.materObj !== '') {
this.val2 = this.$store.getters.materObj.material_code
this.val4 = ''
}
},
created () {
this._getpcsn()
this._bucketGetLevel()
},
mounted () {
this.$nextTick(() => {
this.$refs.scanChild.handleFocus()
})
},
methods: {
handleChange1 (e, type) {
if (type) {
this._queryInfoBybucket(e)
}
},
handleChange4 (e, type) {
if (this.val2 === '') {
this.toast('物料编码不能为空')
return
}
if (type) {
this._queryInfoByBag(e)
}
},
toCheck (e) {
this.pkId = this.pkId === e.bag_id ? '' : e.bag_id
this.pkObj = this.pkId === e.bag_id ? e : {}
handleChange (e) {
let arr = e.split('##')
this.val1 = arr[0]
this.val2 = arr[1]
this.val3 = arr[2]
this.val4 = arr[3]
this.val5 = arr[4]
this.active = arr[5] + ''
this.option1.map((el, i) => {
if (el.value === arr[5]) {
this.active1 = i + ''
}
})
},
toAdd () {
this.printWeight = !this.printWeight
},
/** 物料查询 */
async searchList () {
this.$router.push({
path: '/MaterInfoSearchRadio'
})
},
/** 批次查询 */
async _getpcsn () {
let res = await getpcsn()
if (res.code === '1') {
this.val3 = res.result
} else {
this.Dialog(res.desc)
}
},
/** 等级 */
async _bucketGetLevel () {
let res = await bucketGetLevel()
if (res.code === '1') {
this.option1 = [...res.result]
this.active1 = '0'
} else {
this.Dialog(res.desc)
}
},
/** 桶码查询信息 */
async _queryInfoBybucket (e) {
let res = await queryInfoBybucket(e)
if (res.code === '1') {
this.$store.dispatch('materObj', '')
this.result = res.result.result
this.val1 = res.result.result.bucketunique
this.disabled4 = true
this.val2 = res.result.result.material_code
this.val3 = res.result.result.pcsn
this.dataList = []
this.val4 = ''
this.dataList = res.result.results
} else {
this.Dialog(res.desc)
}
},
/** 袋码查询信息 */
async _queryInfoByBag (e) {
let res = await queryInfoByBag(e)
if (res.code === '1') {
let pai = this.getPai(this.val2)
if (pai === res.result.material_code) {
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)
} else {
this.toast('袋码已存在')
this.val4 = ''
}
} else {
if (JSON.stringify(res.result) !== '{}') {
this.dataList.push(res.result)
}
}
} else {
this.toast('袋物料PG粉与所选软废PG粉物料不一致')
this.val4 = ''
}
// if (this.dataList.length) {
// let arr1 = this.dataList.filter(el => {
// return el.material_code.split('-')[0] === res.result.material_code.split('-')[0]
// })
// let arr2 = this.dataList.filter(el => {
// return el.bag_id === res.result.bag_id
// })
// if (arr1.length === this.dataList.length) {
// if (arr2.length === 0) {
// this.dataList.push(res.result)
// } else {
// this.toast('袋码已存在')
// }
// } else {
// this.toast('返回信息牌号与列表中的所有牌号不一致')
// }
// } else {
// if (JSON.stringify(res.result) !== '{}') {
// this.dataList.push(res.result)
// }
// }
} else {
this.Dialog(res.desc)
}
},
/** 获取牌号 */
getPai (a) {
let arr1 = a.split('-')
arr1.pop()
let arr3 = arr1.join('-')
return arr3
},
/** 删除行 */
deleteList () {
this.disabled3 = true
if (this.pkId === '') {
this.toast('袋码不能为空')
this.disabled3 = false
return
}
if (this.pkId !== '' && (this.pkObj.bucketunique !== this.result.bucketunique)) {
this.dataList.map((el, i) => {
if (el.bag_id === this.pkId) {
this.dataList.splice(i, 1)
}
})
this.pkId = ''
this.pkObj = {}
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.disabled5 = true
if (this.dataList.length === 0) {
this.disabled5 = false
this.disabled1 = true
if (this.val1 === '') {
this.toast('桶码不能为空')
this.disabled1 = false
return
}
if (this.val2 === '' || this.val2 === undefined) {
this.toast('物料编码不能为空')
this.disabled5 = false
return
}
this._confirmGroupBucket()
this._confirmGroupBucketNo()
},
async _confirmGroupBucket () {
async _confirmGroupBucketNo () {
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({}, this.result, this.$store.getters.materObj, {pcsn: this.val3, 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)
let newObj = {'accountId': accountId, 'user': user, 'bucketunique': this.val1, 'material_code': this.val2, 'pcsn': this.val3, 'storage_qty': this.val4, 'date': this.val5, 'is_active': this.option[this.active].value, 'ivt_level': this.option1[this.active1].value}
let res = await confirmGroupBucketNo(newObj)
if (res.code === '1') {
this.toast(res.desc)
this.val1 = ''
this.val4 = ''
this.result = {}
this.dataList = []
this.dataList2 = []
this.pkId = ''
this.pkObj = {}
this.disabled5 = false
this.active = '1'
this.active1 = '0'
this.cancle()
} else {
this.Dialog(res.desc)
this.disabled5 = false
this.disabled1 = false
}
} catch (e) {
this.disabled5 = false
this.disabled1 = false
}
},
/** 组桶并打印 */
toSurePrint () {
this.disabled1 = true
if (this.dataList.length === 0) {
this.disabled1 = false
this.disabled2 = true
if (this.val1 === '') {
this.toast('桶码不能为空')
this.disabled2 = false
return
}
if (this.val2 === '' || this.val2 === undefined) {
this.toast('物料编码不能为空')
this.disabled1 = false
return
}
// if (this.$store.getters.materObj !== '' && Number(this.val5) > Number(this.$store.getters.materObj.standard_weight)) {
// this.toast('总重量不能超过该软废产品标准桶重量')
// 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({}, this.result, this.$store.getters.materObj, {pcsn: this.val3, 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)
let newObj = {'accountId': accountId, 'user': user, 'bucketunique': this.val1, 'material_code': this.val2, 'pcsn': this.val3, 'storage_qty': this.val4, 'date': this.val5, 'is_active': this.option[this.active].value, 'ivt_level': this.option1[this.active1].value}
let res = await confirmGroupBucketNo(newObj)
if (res.code === '1') {
this.toast(res.desc)
if (JSON.stringify(res.result) !== '{}') {
@@ -417,32 +200,23 @@ export default {
let data = Object.assign({}, res.result, {printWeight: this.printWeight})
setTimeout(toPrint(data), 800)
}
this.val1 = ''
this.val4 = ''
this.result = {}
this.dataList = []
this.dataList2 = []
this.pkId = ''
this.pkObj = {}
this.disabled1 = false
this.active = '1'
this.active1 = '0'
this.cancle()
} else {
this.Dialog(res.desc)
this.disabled1 = false
this.disabled2 = false
}
} catch (e) {
this.disabled1 = false
this.disabled2 = false
}
},
async toPrint () {
this.disabled2 = true
this.disabled3 = true
if (this.val1 === '') {
this.disabled2 = false
this.disabled3 = false
return
}
try {
let res = await bucketPrint(this.val1)
let res = await bucketPrintNo(this.val1)
if (res.code === '1') {
this.toast(res.desc)
if (JSON.stringify(res.result) !== '{}') {
@@ -453,56 +227,28 @@ export default {
} else {
this.Dialog(res.desc)
}
this.disabled2 = false
this.disabled3 = false
} catch (e) {
this.disabled2 = false
this.disabled3 = false
}
},
/** 清空 */
cancle () {
// Object.assign(this.$data, this.$options.data())
this.val1 = ''
this.val2 = ''
this.val3 = ''
this.val4 = ''
this.val5 = ''
this.result = {}
this.dataList = []
this.dataList2 = []
this.pkId = ''
this.pkObj = {}
this.active = ''
this.active1 = ''
this.disabled1 = false
this.disabled2 = false
this.disabled3 = false
this.disabled4 = false
this.disabled5 = false
this.active = '1'
this.active1 = '0'
this.$store.dispatch('materObj', '')
this._getpcsn()
this.$refs.scanChild.handleFocus()
},
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
}
}
}
@@ -512,7 +258,7 @@ export default {
@import '~@style/mixin'
.bottom-filter-tip_1
width 35%
margin-right 5%
margin .2rem 5% .2rem 0
.bottom-filter-tip_2
width 65%
.width1