<template>
|
<view class="overflow">
|
<!-- 顶部 -->
|
<cu-custom bgColor="bg-white" :isBack="true">
|
<block slot="backText"></block>
|
<block slot="content">物料补打</block>
|
</cu-custom>
|
<!-- 遮挡层 -->
|
<modal-code ref="resmodal" :rescode='rescode' :resmessage='resmessage' />
|
<!-- 物料 -->
|
<view>
|
<u-form labelPosition="top" :model="warehouse" ref="warehouseRef">
|
<u-row class="border_bottom margin_top10rpx padding10" style="background-color: #fff;">
|
<u-col span="12">
|
<u-form-item label="库位编号:" prop="wareLocationCode" required style="font-size: 16px;font-weight: bold;padding: 0 0 10rpx;">
|
<u-input v-model.trim="warehouse.wareLocationCode" @confirm="materialBlur" placeholder="请录入或扫码"
|
:focus="true"
|
class="width padding_left25rpx"
|
style="margin-left: 30rpx;font-size: 36rpx;">
|
</u-input>
|
</u-form-item>
|
</u-col>
|
<!-- <u-col span="2">
|
<u-icon class="iconfont icon-saoma fontSize60rpx" ></u-icon>
|
</u-col> -->
|
</u-row>
|
<u-row class="border_bottom margin_top10rpx padding10" style="background-color: #fff;">
|
<u-col span="12">
|
<u-form-item label="物料编号:" prop="WarematerialCode" style="font-size: 16px;font-weight: bold;padding: 0 0 10rpx;">
|
<u-input v-model.trim="warehouse.WarematerialCode" @confirm="materialBlur" placeholder="请录入或扫码"
|
class="width padding_left25rpx"
|
style="margin-left: 30rpx;font-size: 36rpx;">
|
</u-input>
|
</u-form-item>
|
</u-col>
|
<!-- <u-col span="2">
|
<u-icon class="iconfont icon-saoma fontSize60rpx" ></u-icon>
|
</u-col> -->
|
</u-row>
|
</u-form>
|
<view style="margin-bottom: 180rpx;" v-show="singlist.length > 0">
|
<view v-for="(item, eindex) in singlist" :key="eindex">
|
<u-swipe-action :show="item.show" :index="eindex" @click="longpredel" @open="open" @close="close" :options="options">
|
<view class="title-wrap fontSize32rpx background_fff" :class="Number(item.uncollectedQuantity) > 0 ? 'bg_item' : '' " style="width: 100vw;">
|
<u-row>
|
<u-col span="12" class="flex" style="align-items: flex-start;">
|
<view style="background-color: #f18202;color: #fff;border-radius: 50%;width: 20px;height: 20px;line-height: 20px;text-align: center;">
|
{{eindex+1}}
|
</view>
|
<view class="color_f18202 padding_left10rpx" style="flex: 1;word-break: break-all;">
|
{{item.wareMaterialCode}}--{{item.wareMaterialName}}
|
</view>
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="7">
|
<view class="" style="padding: 10rpx 0 10rpx 45rpx;color: #808080;">
|
批次:{{item.itemBatchNo}}
|
</view>
|
</u-col>
|
<u-col span="5">
|
<view class="" style="padding: 10rpx 0 10rpx 45rpx;color: #808080;">
|
库位编号:{{item.wareContainerCode}}
|
</view>
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="7">
|
<view class="" style="padding: 10rpx 0 10rpx 45rpx;color: #808080;">
|
SAP位置:{{item.sap_Location}}
|
</view>
|
</u-col>
|
<u-col span="5">
|
<view class="" style="padding: 10rpx 0 10rpx 45rpx;color: #808080;">
|
数量:{{item.quantity}}
|
</view>
|
</u-col>
|
</u-row>
|
</view>
|
</u-swipe-action>
|
</view>
|
</view>
|
|
<u-popup v-model="detailshow" border-radius="14" @close="detailshow=false" mode="bottom" v-if="!printflag">
|
<!-- <view class="pop "> -->
|
<h2 class="text_align_center padding_bottom18 padding15">物料信息</h2>
|
<view class="line flex justify-between">
|
<text class="text-gray">打印张数</text>
|
<text>
|
<u-input v-model.trim="contLabel" placeholder="请输入打印张数"
|
class="width"
|
@focus="contLabel=''"
|
style="font-size: 36rpx;text-align: right;">
|
</u-input>
|
</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">打印物料数量</text>
|
<text>
|
<u-input v-model.trim="ermNum" placeholder="请输入打印物料数量"
|
class="width"
|
@focus="ermNum=''"
|
style="font-size: 36rpx;text-align: right;">
|
</u-input>
|
</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">本次物料总数</text>
|
<text>{{materlist.quantity}}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">PO/行号</text>
|
<text>{{materlist.purchaseNo}}/{{materlist.lineNumber}}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">供应商</text>
|
<text>{{materlist.supplierNo}}{{materlist.supplierName}}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">物料编号</text>
|
<text>{{materlist.wareMaterialCode}}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">物料名称</text>
|
<text>{{materlist.wareMaterialName}}</text>
|
</view>
|
<!-- </view> -->
|
<view class="margin_top140rpx">
|
<!-- <button-modal :subShow='true' garmenTitle='打印' @submit='init' /> -->
|
<button-modal :cleaningShow='true' allTitle='蓝牙打印' cleaningTitle='斑马打印' @allsubmit="init(1)" @submit='init(2)'/>
|
</view>
|
</u-popup>
|
|
</view>
|
</view>
|
</template>
|
|
<script>
|
import ButtonModal from '@/components/buttonModal.vue'
|
import ModalCode from '@/components/ModalCode.vue'
|
import BluePrint from '@/pages/print/bluePrint.js'
|
import {addPrintRecord,getMerterialBaseKuwei} from '@/api/print.js'
|
import printComp from '@/mixins/printPoLabel.js'
|
import printBanma from '@/mixins/printBanma.js'
|
|
export default {
|
mixins: [printComp,printBanma],
|
|
data() {
|
return {
|
rescode: 0,
|
resmessage: "",
|
singlist: [], //物料详情
|
warehouse: {
|
wareLocationCode: '',
|
WarematerialCode:'',
|
PageSize: 1000,
|
PageNo: 1,
|
PurchaseNo:''
|
},
|
warehouseRules: {
|
wareLocationCode: [{required: true,message: '单号不能为空',trigger: 'blur'}],
|
// WarematerialCode: [{required: true,message: '物料编号不能为空',trigger: 'blur'}]
|
},
|
options: [{
|
text: '打印',
|
style: {
|
backgroundColor: '#fc9f35'
|
}
|
}
|
],
|
addForm: { //打印记录
|
code: '',
|
name: '',
|
batchNo: '',
|
specificationModel: ''
|
},
|
contLabel:1, //打印张数
|
ermNum:'',
|
detailshow: false,
|
timer:null,
|
materlist:{},
|
printflag:false
|
};
|
},
|
components: {
|
ButtonModal,
|
ModalCode
|
},
|
onReady() {
|
this.$refs.warehouseRef.setRules(this.warehouseRules)
|
},
|
methods: {
|
//获取print date print time
|
getCurrentDate() {
|
let date = new Date();
|
let year = date.getFullYear(); //年
|
let month = date.getMonth() + 1; //月
|
month = month >= 10 ? month : '0' + month;
|
let day = date.getDate(); //日
|
day = day >= 10 ? day : '0' + day;
|
let hour = date.getHours() //时
|
hour = hour >= 10 ? hour : '0' + hour;
|
let min = date.getMinutes(); //分
|
min = min >= 10 ? min : '0' + min;
|
let second = date.getSeconds(); //秒
|
second = second >= 10 ? second : '0' + second;
|
return {
|
date: `${day}.${month}.${year}`,
|
time: `${hour}:${min}:${second}`,
|
formate:`${year}/${month}/${day}`
|
}
|
},
|
//打印
|
init(param) {
|
const arr = ['warematerialCode','batchNo','uncollectedQuantity','supplier'];
|
Object.keys(this.materlist).forEach(item => {
|
if(arr.includes(item)) {
|
if(!this.materlist[item]) {
|
this.rescode = 400
|
this.resmessage = `${item}为空,不能继续打印`
|
this.$refs.resmodal.show = true
|
return
|
}
|
}
|
})
|
// if(this.materlist.uncollectedQuantity<=0){
|
// this.detailshow = false
|
// this.rescode = 400
|
// this.resmessage = `数量需大于0`
|
// this.$refs.resmodal.show = true
|
// return
|
// }
|
if(!this.contLabel || !this.ermNum){
|
uni.showToast({
|
title: '数量不能为空且大于0',
|
icon: 'none'
|
})
|
return
|
}
|
// if(this.ermNum > this.materlist.uncollectedQuantity){
|
// uni.showToast({
|
// title: '打印数量大于本次数量',
|
// icon: 'none'
|
// })
|
// return
|
// }
|
// 没有供应商字段 supplier
|
if(param==1){
|
this.printComp('REPRINT')
|
}else{
|
this.printBanma('REPRINT')
|
}
|
},
|
//获取物料记录
|
materialBlur() {
|
this.$refs.warehouseRef.validate(valid => {
|
if (valid) {
|
// this.warehouse
|
getMerterialBaseKuwei({
|
'wareLocationCode':this.warehouse.wareLocationCode,
|
'wareMaterialCode':this.warehouse.WarematerialCode,
|
|
}).then(res => {
|
const result = res.data.rows;
|
if(result.length == 0) {
|
this.rescode = 400;
|
this.resmessage = "此物料无物料记录"
|
this.$refs.resmodal.show = true
|
}
|
this.singlist = result;
|
})
|
}
|
})
|
},
|
//删除详情
|
longpredel(index, eindex) {
|
this.singlist[index].cardNum = true
|
this.printflag = false
|
if (eindex == 1) {
|
this.singlist.splice(index, 1)
|
} else {
|
this.materlist = this.singlist[index]
|
this.detailshow = true
|
}
|
},
|
// 如果打开一个的时候,不需要关闭其他,则无需实现本方法
|
open(index) {
|
this.singlist[index].show = true;
|
this.singlist.map((val, idx) => {
|
if (index != idx) this.singlist[idx].show = false;
|
})
|
},
|
close(index) {
|
// this.singlist[index].show = false;
|
// this.singlist[index].cardNum = false;
|
// this.$forceUpdate()
|
},
|
beforeDestroy() {
|
// 销毁定时器
|
if(this.timer){
|
clearTimeout(this.timer)
|
this.timer = null
|
}
|
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss">
|
.bg_item {
|
background: #FFEBCD !important;
|
}
|
</style>
|