394 lines
13 KiB
Vue
Raw Normal View History

2025-03-11 17:57:17 +08:00
<template>
<view>
<u-navbar back-text="返回" title="立库空托盘出库" :background="background"></u-navbar>
<u-form ref="testForm">
<u-form-item :border-bottom="false">
<p>选单据:</p>
<u-select v-model="dlistShow" mode="single-column" value-name="id" :list="dlist" @confirm="selConfirm" confirm-text="确认选择" />
<u-input :border="true" v-model="ReceiveRequestName" placeholder="请选择单据" :focus="focusReceiveRequest"
@confirm="checkReceiveRequest" style="background: #ffffff; margin-right: 10rpx" />
<u-button @click="selectReceiveRequest" type="primary" size = "mini">选择单号</u-button>
</u-form-item>
<u-form-item :border-bottom="false">
<p>选托盘:</p>
<u-select v-model="dlistShow" mode="single-column" value-name="id" :list="dlist" @confirm="selConfirm" confirm-text="确认选择" />
<u-input :border="true" v-model="ReceiveRequestName" placeholder="请选择托盘" :focus="focusReceiveRequest"
@confirm="checkReceiveRequest" style="background: #ffffff; margin-right: 10rpx" />
<u-button @click="selectReceiveRequest" type="primary" size = "mini">选择托盘</u-button>
</u-form-item>
<!--<u-form-item :border-bottom="false">
<picker @change="bindPickerChange" :range="array">
<label>选择行</label>
<label class="">{{array[index]}}</label>
<br/>
<label>物料属性</label>
<label class="">XXXX </label>
<label> 物料规格</label>
<label class="">XXXX</label>
<!-- <u-row>
<u-col span="4"><label>选择行</label> </u-col >
<u-col span="8"><label class="">{{array[index]}}</label> </u-col >
</u-row> -->
<!--</picker>
</u-form-item>-->
<!--<u-form-item :border-bottom="false">
<u-row>
<u-col span="6"><label>制造日期</label> </u-col >
<u-col span="13">
<picker mode="date" :end="endDate"@change="bindDateChange">
<label class="">{{date}}</label>
</picker>
</u-col >
</u-row>
</u-form-item>-->
<!--<u-form-item :border-bottom="false">
<p>目的地:</p>
<u-select v-model="dlistShow" mode="single-column" value-name="id" :list="dlist" @confirm="selConfirm" confirm-text="确认选择" />
<u-input :border="true" v-model="ReceiveRequestName" placeholder="请选目的地" :focus="focusReceiveRequest"
@confirm="checkReceiveRequest" style="background: #ffffff; margin-right: 10rpx" />
<u-button @click="selectReceiveRequest" type="primary" size = "mini">选目的地</u-button>
</u-form-item>-->
<!--<u-form-item :border-bottom="false">
<label>库位选择</label>
<u-input :border="true" v-model="ReceiveRequestName" placeholder="请选择库位" :focus="focusReceiveRequest"
@confirm="checkReceiveRequest" style="background: #ffffff; margin-right: 10rpx" />
<!--<label>{{description}}</label>-->
<!-- <u-row>
<u-col span="3"><label>物料描述</label></u-col >
<u-col span="9"><label>{{description}}</label></u-col >
</u-row> -->
<!--</u-form-item>-->
<!--<u-form-item :border-bottom="false">
<u-row>
<u-col >
<p>条码:</p>
<u-input :border="true" v-model="ReceiveRequestName" placeholder="请选择单据" :focus="focusReceiveRequest"
@confirm="checkReceiveRequest" style="background: #ffffff; margin-right: 10rpx" />
</u-col>
<u-col >
<u-input
:border="true" v-model="palletName" placeholder="请扫描供应商条码" :focus="focusPalletName"
style="background: #ffffff;width: 100%;"/>
</u-col>
</u-row>
</u-form-item>-->
<!--<u-card style="border: 1rpx solid #0081ff" :show-head="false" :full="true" :body-style="{ height: '100rpx' }">
<view slot="body">
<u-row>
<u-col span="6">
<view>应扫数量{{ PLAN_QTY || '0' }}</view>
</u-col>
<u-col span="6">
<view>扫码数量{{ PRTBARCODEQTY || '0' }}</view>
</u-col>
</u-row>
</view>
</u-card>-->
<!--<u-form-item :border-bottom="false">
<u-row>
<u-col span="4">
<p>包装数量:</p>
</u-col>
<u-col span="8">
<u-input
:border="true" v-model="BOX_QTY" placeholder="请填写数量" @confirm="CreateBarCodeInfo" :focus = "focusBoxQty"
style="background: #ffffff; "/>
</u-col>
</u-row>
</u-form-item>-->
</u-form>
<uni-table ref="BoxList" :loading="loading" border stripe type="false">
<uni-tr>
<uni-th align="center">栈板号</uni-th>
<uni-th align="center">供应商条码</uni-th>
<uni-th align="center">物料号</uni-th>
<uni-th align="center">物料描述</uni-th>
<uni-th align="center">批号</uni-th>
<uni-th align="center">数量</uni-th>
<uni-th align="center">是否质检</uni-th>
</uni-tr>
<uni-tr v-for="(item, index) in BoxListInfo" :key="index" ><!-- :style="getStyle(index)"--><!--:style="{ backgroundColor: item.color === 0 ? 'white' : 'blue' }" -->
<uni-td align="center">{{ item.MATERIALPACKING}}</uni-td>
<uni-td align="center">{{ item.SOURCESN}}</uni-td>
<uni-td align="center">{{ item.MATERIALSPECNAME }}</uni-td>
<uni-td align="center">{{ item.DESCRIPTION }}</uni-td>
<uni-td align="center">{{ item.CHARGE }}</uni-td>
<uni-td align="center">{{ item.QTY }}</uni-td>
<uni-td align="center">{{ item.IQCFLAG }}</uni-td>
</uni-tr>
</uni-table>
<u-button @click="GenerateBox" style="background: #0081ff; color: #ffffff">确认出库</u-button>
</view>
</template>
<script>
import {
print
} from '../../../../common/BluetoothPrint.js';
export default {
data() {
return {
array : ['请选择物料行号'],
background: {
backgroundImage: 'linear-gradient(45deg, rgb(28, 187, 180), rgb(141, 198, 63))'
},
date: this.getDate(),
index : 0,
PLAN_QTY : 0,
PRTBARCODEQTY : 0,
BOX_QTY : "",
palletName : "",
focusPalletName : false,
ReceiveRequestName : "",
focusReceiveRequest : "",
dlist: [], //选择内容
dlistShow: false, //是否显示选择框
description : "描述",
loading : false,
BoxListInfo : [],
jg : "",
zpl : "",
focusBoxQty : false,
rangedata: [],
}
},
created() {
//挂载页面的时候就查询下拉框的数据,这是无参请求所以没参数
this.$MyRequest('/split/getbluetoothprinter', {}, 'GET').then(res => {
if (res.data.success) {
this.rangedata = res.data.resultObj //接数据,是一个对象数组
this.show = true //设置为true展示picker组件
} else {
console.log(this.data.message)
}
}).catch(err => {
this.$showMessage(err)
});
let that = this
uni.getStorage({
key: "sitename",
success(res) {
that.siteName = res.data
}
})
uni.getStorage({
key: "userid",
success(res) {
that.userId = res.data
}
})
},
computed:{
endDate(){
return this.getDate();
}
},
methods: {
selConfirm(e) {
this.ReceiveRequestName = e[0].value;
this.checkReceiveRequest();
},
bindPickerChange: function(e) {//改变的事件名
console.log('picker发送选择改变携带值为', e.target.value) // 用于输出改变索引值
this.index = e.target.value//将数组改变索引赋给定义的index变量
this.jg=this.array[this.index]//将array【改变索引】的值赋给定义的jg变量
this.$MyRequest('/barCode/getSLInfo', {
ReceiveRequestName: this.jg
}).then(res => {
if (res.data.success) {
var _Arr = res.data.resultObj;
for (let i = 0; i < _Arr.length; ++ i) {
this.description = _Arr[i]['DESCRIPTION'];
this.PLAN_QTY = _Arr[i]['PLAN_QTY'];
this.PRTBARCODEQTY = _Arr[i]['PRTBARCODEQTY'];
}
}
}).catch(err => {
this.$showMessage(err)
})
},
getDate() {
const date = new Date();
let year = date.getFullYear();
let month = date.getMonth() + 1;
let day = date.getDate();
month = month > 9 ? month : '0' + month;
day = day > 9 ? day : '0' + day;
return `${year}-${month}-${day}`;
},
bindDateChange: function(e) {
this.date = e.detail.value;
},
//查找代打条码的领料单集合
selectReceiveRequest () {
this.dlist = [];
this.BoxListInfo = [];
this.$MyRequest('/barCode/getSLList', {
ReceiveRequestName: this.ReceiveRequestName
}).then(res => {
console.log(res.data)
if (res.data.success) {
console.log(res.data.resultObj.length)
for (var i = 0; i <= res.data.resultObj.length; i++) {
console.log(res.data.resultObj[i].RECEIVEREQUESTNAME)
this.dlist.push({
id: res.data.resultObj[i].RECEIVEREQUESTNAME,
label: res.data.resultObj[i].RECEIVEREQUESTNAME
});
console.log(this.dlist);
this.dlistShow = true;
this.checkReceiveRequest();
}
}
}).catch(err => {
this.$showMessage(err)
})
},
checkReceiveRequest () {
this.resetValue();
this.$MyRequest('/barCode/getSLCBM', {
ReceiveRequestName: this.ReceiveRequestName
}).then(res => {
if (res.data.success) {
var _Arr = res.data.resultObj;
for (let i = 0; i < _Arr.length; ++ i) {
console.log(_Arr[i])
this.array [i] = _Arr[i]['WL'];
}
}
this.focusBarCode = true
this.focusReceiveRequest = false
}).catch(err => {
this.$showMessage(err)
})
},
//创建条码信息
CreateBarCodeInfo () {
if (Number(this.PRTBARCODEQTY) + Number(this.BOX_QTY) > Number(this.PLAN_QTY)) {
this.$showMessage("可打码数量不足")
return;
}
this.PRTBARCODEQTY = Number(this.PRTBARCODEQTY) + Number(this.BOX_QTY);
this.$MyRequest('/barCode/CreateBarCodeInfo', {
ReceiveRequestName: this.jg,//单号
palletName: this.palletName,
makeDate: this.date,
qty: this.BOX_QTY
}).then(res => {
console.log(res.data.success)
if (res.data.success) {
var _Arr = res.data.resultObj;
console.log(_Arr)
this.BoxListInfo.push(_Arr[0]);
console.log("***********************")
console.log(this.BoxListInfo)
}
this.focusBarCode = true
this.focusReceiveRequest = false
}).catch(err => {
this.$showMessage(err)
})
this.BOX_QTY = "";
this.focusBoxQty = true;
},
GenerateBox () {
let macaddress = this.rangedata[0].ENUMVALUE
this.$MyRequest('/barCode/getZICOXCPCL', {
info : this.BoxListInfo
}).then(res => {
if (res.data.success) {
this.zpl = res.data.resultObj[0]['LABELSTRING'].toString();
console.log(this.zpl)
}
}).catch(err => {
this.$showMessage(err)
})
for (let i = 0; i < this.BoxListInfo.length; ++ i) {
let _zpl = '! 0 200 200 400 1\n' +
'PAGE-WIDTH 560\n' +
/* 'PW 848\n' + */
'TONE 0\n' +
'SPEED 0\n' +
'GAP-SENSE\n' +
'NO-PACE\n' +
'POSTFEED 0\n' +
'LEFT\n' +
'T 65 1 20 20 物料编码:\n' +
'SETBOLD 2\n' +
'T 65 1 135 20 ' + this.BoxListInfo[i]['MATERIALSPECNAME'] + '\n' +
'SETBOLD 0\n' +
'T 65 1 20 50 客供料号:\n' +
'T 65 1 135 50 ' + this.BoxListInfo[i]['FK_TWH_NUMBER'] + '\n' +
'T 65 0 20 80 物料名称:\n' +
'T 65 1 135 80 ' + this.BoxListInfo[i]['DESCRIPTION'] + '\n' +
'T 65 0 20 110 SN\n' +
'T 65 1 135 110 ' + this.BoxListInfo[i]['MATERIALPACKING'] + '\n' +
'T 65 0 20 140 客户S/N\n' +
'T 65 1 135 140 ' + this.BoxListInfo[i]["SOURCESN"] + '\n' +
'T 65 0 20 170 供应商:\n' +
'T 65 1 135 170 ' + this.BoxListInfo[i]["SUPPLIERNAME"] + '\n' +
'T 65 0 20 200 批次:\n' +
'T 65 1 135 200 ' + this.BoxListInfo[i]["CHARGE"] + '\n' +
'T 65 0 20 230 收料日期:\n' +
'T 65 1 135 230 ' + this.BoxListInfo[i]['SLDATE'] + '\n' +
'T 65 0 20 260 数量:\n' +
'T 65 1 135 260 ' + this.BoxListInfo[i]['QTY'] + '\n' +
'SETBOLD 2\n' +
'SETBOLD 0\n' +
'B QR 400 230 M 6 U 3\n' +
'MA,' + this.BoxListInfo[i]['MATERIALPACKING'] + '\n' +
'ENDQR\n' +
/* 'B 128 2 1 50 50 560 ' + this.barCode + '\n' +
'T 65 1 200 620 ' + this.barCode + '\n' + */
'FORM\n' +
'PRINT\n';
console.log(_zpl);
print(macaddress, _zpl);
}
this.BoxListInfo = []
},
resetValue () {
this.palletName = "";
this.BOX_QTY = "";
this.BoxListInfo = [];
this.PLAN_QTY = 0;
this.PRTBARCODEQTY = 0;
this.description = "";
this.array = [];
}
}
}
</script>
<style>
</style>