Files
hht-xzhy-uni/pages/Material/hw-out-store.vue

234 lines
7.8 KiB
Vue
Raw Normal View History

2025-09-10 10:38:03 +08:00
<template>
<view class="zd_container">
<!-- 大料箱出库 - 货位出库 -->
2025-09-18 09:47:48 +08:00
<nav-bar :title="title" :inner="true"></nav-bar>
2025-09-10 10:38:03 +08:00
<view class="zd_content">
<view class="zd_wrapper">
<view class="zd-row border-bottom">
<view class="zd-col-6">
<span class="filter_label filter_input_disabled">单据号</span>
</view>
<view class="zd-col-18">
<input type="text" class="filter_input filter_input_disabled" v-model="materialData.bill_code" 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">
<search-box
v-model="val1"
2025-09-18 09:47:48 +08:00
@handleChange="handleChange"
2025-09-10 10:38:03 +08:00
/>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-6">
<span class="filter_label filter_input_disabled">点位</span>
</view>
<view class="zd-col-18">
<input type="text" class="filter_input filter_input_disabled" v-model="materialData.struct_code" disabled>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-6">
<span class="filter_label filter_input_disabled">出库物料</span>
</view>
<view class="zd-col-18">
<input type="text" class="filter_input filter_input_disabled" v-model="materialData.material_code" disabled>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-6">
<span class="filter_label filter_input_disabled">物料名称</span>
</view>
<view class="zd-col-18">
<input type="text" class="filter_input filter_input_disabled" v-model="materialData.material_name" disabled>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-6">
<span class="filter_label">库存数量</span>
</view>
<view class="zd-col-16">
2025-09-18 10:19:10 +08:00
<input type="number" v-model="kcqty" class="filter_input" disabled>
2025-09-10 10:38:03 +08:00
</view>
<view class="zd-col-2"><span class="filter_unit">KG</span></view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-6">
<span class="filter_label">出库数量</span>
</view>
<view class="zd-col-16">
<input type="number" v-model="materialData.plan_qty" class="filter_input" disabled>
</view>
<view class="zd-col-2"><span class="filter_unit">KG</span></view>
</view>
<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="val2"
/>
</view>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-5 button-default" @tap="clearUp">清空</button>
<button class="zd-col-9 button-primary" :class="{'button-info': !val1}" :disabled="disabled1" @tap="labelPrint">标签打印</button>
2025-09-18 16:49:05 +08:00
<button class="zd-col-9 button-primary" :class="{'button-info': !val1 || kcqty === ''}" :disabled="disabled" @tap="_materialBoxOutConfirm">确认出库</button>
2025-09-10 10:38:03 +08:00
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {getInvInfoQty, materialBoxOutConfirm} from '@/utils/getData1.js'
2025-12-08 15:37:38 +08:00
import {printDelete} from '@/utils/getData2.js'
2025-09-10 10:38:03 +08:00
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
title: '',
val1: '',
val2: '',
2025-09-18 10:19:10 +08:00
kcqty: '',
2025-09-10 10:38:03 +08:00
materialData: {},
// suppData: {},
disabled: false,
disabled1: false
};
},
onLoad (options) {
this.title = options.title
},
onShow () {
if (this.$store.getters.publicObj !== '') {
this.materialData = this.$store.getters.publicObj
this.$store.dispatch('setPublicObj', '')
}
},
methods: {
clearUp () {
this.val1 = ''
this.val2 = ''
2025-09-18 17:41:27 +08:00
this.kcqty = ''
this.materialData = {}
2025-09-10 10:38:03 +08:00
this.disabled = false
},
2025-09-18 09:47:48 +08:00
handleChange (e) {
if (e) {
this._getInvInfoQty()
}
},
2025-09-10 10:38:03 +08:00
async _getInvInfoQty () {
let res = await getInvInfoQty(this.val1)
2025-09-18 10:19:10 +08:00
this.kcqty = res.data.ivt_qty
2025-09-10 10:38:03 +08:00
this.materialData.qty1 = res.data.ivt_qty
},
async _materialBoxOutConfirm () {
this.disabled = true
2025-09-18 16:49:05 +08:00
if (!this.val1 || this.kcqty === '') {
2025-09-10 10:38:03 +08:00
this.disabled = false
return
}
try {
2025-09-18 10:44:25 +08:00
let res = await materialBoxOutConfirm(this.materialData.iostorinvdis_id, this.materialData.storagevehicle_code, this.materialData.struct_code, this.val2, this.materialData.plan_qty)
2025-09-18 17:41:27 +08:00
if (res) {
2025-09-10 10:38:03 +08:00
uni.showToast({
title: res.message,
icon: 'none'
})
this.clearUp()
2025-09-18 10:19:10 +08:00
this.$store.dispatch('setPublicObj', '')
uni.navigateTo({
url: '/pages/Material/dlx-out-store?title=大料箱出库'
})
2025-09-10 10:38:03 +08:00
}
2025-09-18 17:41:27 +08:00
this.disabled = false
2025-09-10 10:38:03 +08:00
} catch (e) {
this.disabled = false
}
},
2025-12-08 15:37:38 +08:00
async _printDelete (data) {
try {
let res = await printDelete(data)
if (res) {
// console.log('success')
}
} catch (e) {
// console.log('error')
}
},
2025-09-10 10:38:03 +08:00
labelPrint () {
this.disabled1 = true
let data = Object.assign({}, this.materialData, this.suppData, {pcsn: this.pcsn, produce_time: this.date, bake_num: this.num})
this.toPrint(data)
},
toPrint (data) {
let iparr = this.$store.getters.printUrl.split(":")
let printUrl = iparr[1].slice(2)
let LODOP = getCLodop();
if (!(LODOP.webskt && LODOP.webskt.readyState === 1)) {
uni.showToast({
title: '当前配置ip' + printUrl + '网络不通,请检查',
icon: 'none',
duration: 5000
})
this.disabled1 = false
return
}
LODOP.SET_SHOW_MODE('HIDE_DISBUTTIN_SETUP', 1)// 隐藏那些无效按钮
LODOP.SET_LICENSES('浙江省烟草专卖局(公司)', 'C0C4A46A3A0D1F526D426018D9F11921', '', '')
// 更换为打印服务器ip 不需要加前缀
LODOP.PRINT_INIT(null, printUrl);
// 打印机序号 规则为打印服务器打印机列表倒数从0开始 -1为默认打印机
LODOP.SET_PRINTER_INDEX(-1);
// 设置打印纸大小
2025-12-08 10:46:38 +08:00
LODOP.SET_PRINT_PAGESIZE(1, '80mm', '60mm', '')
LODOP.ADD_PRINT_RECT('1mm', '3mm', '74mm', '54mm', 0, 1)
LODOP.SET_PRINT_STYLE('FontSize', 8)
LODOP.SET_PRINT_STYLE('Bold', 1)
2025-12-08 14:09:27 +08:00
LODOP.ADD_PRINT_BARCODE('5mm', '7mm', '30mm', '30mm', 'QRCode', data.material_code + '##' + data.material_name + '##' +
data.material_spec + '##' + data.material_model + '##' + data.quality_time + '##' + data.produce_time + '##' +
data.supp_name + '##' + data.bake_num + '##' + data.supp_code + '##' + data.pcsn + '##' + data.execution_stand
2025-12-08 10:46:38 +08:00
)
2025-12-08 14:09:27 +08:00
LODOP.ADD_PRINT_TEXT('5mm', '38mm', '60mm', '10mm', '物料编码:' + data.material_code)
LODOP.ADD_PRINT_TEXT('12mm', '38mm', '60mm', '10mm', '物料名称:' + data.material_name)
LODOP.ADD_PRINT_TEXT('19mm', '38mm', '60mm', '10mm', '规格:' + data.material_spec)
LODOP.ADD_PRINT_TEXT('26mm', '38mm', '60mm', '10mm', '型号:' + data.material_model)
LODOP.ADD_PRINT_TEXT('33mm', '38mm', '60mm', '10mm', '有效期(天)' + data.quality_time)
LODOP.ADD_PRINT_TEXT('40mm', '38mm', '60mm', '10mm', '生产日期:' + data.produce_time)
LODOP.ADD_PRINT_TEXT('47mm', '38mm', '60mm', '10mm', '供应商名称:' + data.supp_name)
2025-12-08 10:46:38 +08:00
2025-12-08 15:37:38 +08:00
LODOP.ADD_PRINT_TEXT('33mm', '7mm', '60mm', '10mm', '烘干次数:' + data.bake_num)
2025-12-08 14:09:27 +08:00
LODOP.ADD_PRINT_TEXT('40mm', '7mm', '60mm', '10mm', '批号:' + data.pcsn)
LODOP.ADD_PRINT_TEXT('47mm', '7mm', '60mm', '10mm', '执行标准:' + data.execution_stand)
2025-12-08 10:46:38 +08:00
LODOP.PRINT();
// LODOP.PREVIEW()
2025-12-08 15:37:38 +08:00
// 调用删除
if (data.out_type === '1004' && data.is_need_delete === '1') {
this.printDelete(data)
}
2025-09-10 10:38:03 +08:00
uni.showToast({
2025-12-08 15:37:38 +08:00
title: '操作成功',
2025-09-10 10:38:03 +08:00
icon: 'none'
})
this.disabled1 = false
}
}
}
</script>
<style lang="stylus">
</style>