<template>
|
<view class="content">
|
<view class="form">
|
<view class="form-item">
|
<view class="title">物料编码:</view>
|
<view class="righton">
|
<input v-model="baseInfo.HMaterNumber" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">物料名称:</view>
|
<view class="righton">
|
<input v-model="baseInfo.HMaterName" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">规格型号:</view>
|
<view class="righton">
|
<input v-model="baseInfo.HMaterModel" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">批次:</view>
|
<view class="righton">
|
<input v-model="baseInfo.HBatchNo" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">收料数量:</view>
|
<view class="righton">
|
<input v-model="baseInfo.HQty" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">MTO号:</view>
|
<view class="righton">
|
<input v-model="baseInfo.HMTONo" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">每箱数量:</view>
|
<view class="right">
|
<input v-model="baseInfo.HMinQty" type="number" placeholder="请输入数量" @confirm="getNum()"
|
@blur="getNum()" />
|
</view>
|
</view>
|
<view class="buttons">
|
<button class="btn-b" size="mini" type="default" @tap="getList()">条码生成</button>
|
<button class="btn-c" :disabled="codeGenComplete == false" size="mini" type="default"
|
@tap="search">打印</button>
|
<!-- <button class="btn-c" size="mini" type="default"
|
@tap="exit">退出</button> -->
|
</view>
|
</view>
|
|
<view style="width: 100%;height: 16rpx;background-color: #e5e5e5;"></view>
|
|
<view class="list" v-for="(item,index) in listData" :key="index">
|
<uni-card :title="item.物料代码" :extra="'No. ' + Number(index+1)" style="margin: 10px;">
|
<view class="card-detail">
|
<view class="detail">
|
<text>物料名称:</text>{{item.物料名称}}
|
</view>
|
<view class="detail">
|
<text>规格型号:</text>{{item.规格型号}}
|
</view>
|
<view class="detail">
|
<text>数量:</text>{{item.数量}}
|
</view>
|
<view class="detail" style="width: 100%;">
|
<text>条码编号:</text>{{item.条码编号}}
|
</view>
|
</view>
|
|
</uni-card>
|
|
</view>
|
<view class="over" v-if="listData.length == 0">暂无数据</view>
|
<view class="over" v-if="listData.length != 0">已到底</view>
|
<view>
|
<labelPrinterComponentVue ref="labelPrinter" :printInfo="printInfo" :printMode="'cpcl'">
|
</labelPrinterComponentVue>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
import {
|
getUserInfo
|
} from "@/utils/auth.js";
|
import {
|
CommonUtils
|
} from "../../utils/common";
|
import {
|
nextTick
|
} from "vue";
|
import labelPrinterComponentVue from "@/components/labelPrinterComponent/labelPrinterComponent.vue"
|
export default {
|
data() {
|
return {
|
printInfo: "",
|
userInfo: getUserInfo(),
|
serverUrl: uni.getStorageSync('serverUrl') || 'http://47.96.97.237/API',
|
OperationType: 1, //数据类型 1添加 保存 2复制 3 编辑
|
linterid: '',
|
HEntryID: '',
|
hmaterid: '',
|
codeGenComplete: false,
|
baseInfo: {
|
HBillNo: '',
|
HMainID: '',
|
HSubID: '',
|
HOrderBillNo: '',
|
HMaterID: '',
|
HMaterNumber: '',
|
HMaterName: '',
|
HMaterModel: '',
|
HQty: '',
|
HMTONo: '',
|
HQty: '',
|
HMinQty: '',
|
HBQty: '',
|
HSupID: '',
|
},
|
sWhere: '',
|
listData: [],
|
|
}
|
},
|
components: {
|
labelPrinterComponentVue
|
},
|
onLoad(e) {
|
console.log(e)
|
this.OperationType = e.OperationType
|
this.linterid = e.linterid
|
this.hmaterid = e.hmaterid
|
this.getData()
|
},
|
methods: {
|
getData() {
|
CommonUtils.doRequest(
|
"/Cg_POOrderBill/list", {
|
sWhere: ` and hmainid = ${this.linterid} and HMaterID = ${this.hmaterid}`,
|
user: this.userInfo.Czymc
|
},
|
(res) => {
|
console.log('采购订单: ', res)
|
let {
|
data,
|
count
|
} = res.data
|
if (count > 0) {
|
this.baseInfo = {
|
HMainID: data[0]['hmainid'],
|
HSubID: data[0]['HEntryID'],
|
HBillNo: data[0]['单据号'],
|
HMaterID: data[0]['HMaterID'],
|
HMaterNumber: data[0]['物料代码'],
|
HMaterName: data[0]['物料名称'],
|
HMaterModel: data[0]['规格型号'],
|
HQty: data[0]['数量'],
|
HMTONo: data[0]['计划跟踪号'],
|
HSupID: data[0]['HSupID']
|
}
|
this.listData = data
|
} else {
|
uni.showToast({
|
title: res.data.Message,
|
icon: 'none'
|
})
|
}
|
}
|
)
|
},
|
getNum(e) {
|
if (this.baseInfo.HMinQty && this.baseInfo.HMinQty > 0) {
|
var a = Number(this.baseInfo.HQty) / Number(this.baseInfo.HMinQty)
|
this.baseInfo.HBQty = Math.ceil(Number(this.baseInfo.HQty) / Number(this.baseInfo.HMinQty))
|
this.$forceUpdate()
|
} else {
|
uni.showToast({
|
title: '请输入大于0的合理数量',
|
icon: "none"
|
})
|
}
|
},
|
async search() {
|
// #ifndef APP-PLUS
|
uni.showModal({
|
content: "不支持蓝牙打印功能,请切换手机...",
|
})
|
return
|
// #endif
|
if (this.$printer.isConnected() === false) {
|
this.$refs.labelPrinter.openPopup()
|
} else {
|
let printContent = []
|
let printInfoBuffer = []
|
let count = 0
|
for (let listOne of this.listData) {
|
printContent.push(`! 0 200 200 400 1
|
PAGE-WIDTH 608
|
SETQRVER 3
|
B QR 500 30 M 2 U 3
|
LA,${listOne['条码编号']}
|
ENDQR
|
T 24 0 30 30 供应商: ${listOne['供应商']}
|
T 24 0 30 80 供应商料号:
|
T 24 0 30 130 物料编码: ${listOne['物料代码']}
|
T 24 0 30 180 物料分组: ${listOne['托号']}
|
T 24 0 300 180 规格型号: ${listOne['规格型号']}
|
T 24 0 30 230 数量: ${listOne['数量']}
|
T 24 0 300 230 日期: ${listOne['日期'].split(" ")[0]}
|
T 24 0 30 280 检验员:
|
T 24 0 300 280 计划跟踪号: ${listOne['计划跟踪号']}
|
T 24 0 30 330 检验结果:
|
BOX 260 330 280 350 4
|
T 24 0 290 330 合格
|
BOX 360 330 380 350 4
|
T 24 0 390 330 不合格
|
BOX 480 330 500 350 4
|
T 24 0 510 330 特采
|
FORM
|
PRINT`)
|
count++;
|
if (count == 10) {
|
printInfoBuffer.push(printContent.join("\r\n"))
|
count = 0
|
printContent = []
|
}
|
}
|
printInfoBuffer.push(printContent.join("\r\n"))
|
this.printInfo = JSON.stringify(printInfoBuffer)
|
|
printInfoBuffer = []
|
|
await this.$nextTick(() => {
|
this.$refs.labelPrinter.execPrint()
|
})
|
}
|
},
|
getList() {
|
var sMain = []
|
sMain[0] = this.baseInfo
|
var sMainStr = JSON.stringify(sMain);
|
//获取选择的组织
|
var HOrgType = uni.getStorageSync('Organization');
|
//获取选择的工厂代码
|
var CampanyName = "xxx";
|
//获取选择的源单类型
|
var HSourceBillType = "收料通知单";
|
//获取选择的条码类型
|
var HSelectBarCodeType = "唯一条码";
|
//获取当前登录人员
|
var UserName = uni.getStorageSync('HUserName');
|
var sMainSub = sMainStr + ';' + HOrgType + ';' + HSourceBillType + ';' + HSelectBarCodeType + ';' +
|
CampanyName + ';' + UserName;
|
uni.request({
|
url: this.serverUrl + '/Sc_BarCode/Sub_SaveBill',
|
method: 'POST',
|
data: {
|
msg: sMainSub,
|
CampanyName: CampanyName
|
},
|
success: (res) => {
|
if (res.data.count == 1) {
|
this.listData = res.data.data
|
this.codeGenComplete = true
|
} else {
|
this.codeGenComplete = false
|
uni.showToast({
|
title: res.data.Message,
|
icon: 'none'
|
})
|
}
|
},
|
fail: (res) => {
|
console.log(res);
|
uni.showToast({
|
title: '接口请求失败',
|
icon: 'none'
|
})
|
},
|
});
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.form {
|
width: 640rpx;
|
margin: 20rpx auto;
|
}
|
|
.form-item {
|
display: flex;
|
align-items: center;
|
font-size: 28rpx;
|
padding: 6rpx 0;
|
|
.title {
|
width: 180rpx;
|
|
text {
|
color: red;
|
font-weight: bold;
|
}
|
}
|
|
.right {
|
width: 450rpx;
|
border-radius: 22rpx;
|
border: 1px solid #acacac;
|
}
|
|
.righton {
|
width: 450rpx;
|
border-radius: 22rpx;
|
border: 1px solid #e4e4e4;
|
background-color: #e4e4e4;
|
}
|
|
input {
|
width: 100%;
|
padding: 8rpx 20rpx;
|
font-size: 30rpx;
|
}
|
}
|
|
.buttons {
|
width: 100%;
|
display: flex;
|
justify-content: center;
|
margin-top: 20rpx;
|
|
button {
|
border-radius: 50rpx;
|
width: 220rpx;
|
height: 66rpx;
|
line-height: 66rpx;
|
font-size: 28rpx;
|
}
|
|
button[disabled] {
|
background-color: #acacac;
|
color: #fff;
|
}
|
|
.btn-a {
|
background-color: #acacac;
|
color: #fff;
|
}
|
|
.btn-b {
|
background-color: #41a863;
|
color: #fff;
|
}
|
|
.btn-c {
|
background-color: #3a78ff;
|
color: #fff;
|
}
|
}
|
|
.list {
|
width: 100%;
|
|
.card-detail {
|
width: 100%;
|
display: flex;
|
flex-wrap: wrap;
|
justify-content: space-between;
|
line-height: 120%;
|
|
.detail {
|
// width: 50%;
|
font-size: 26rpx;
|
margin-bottom: 12rpx;
|
color: #555;
|
margin-right: 20rpx;
|
|
text {
|
color: #999;
|
font-size: 26rpx;
|
}
|
}
|
}
|
|
.more {
|
color: #888;
|
font-size: 24rpx;
|
display: flex;
|
border-top: 1px solid #eee;
|
padding-top: 20rpx;
|
|
.part {
|
width: 50%;
|
text-align: center;
|
}
|
}
|
}
|
</style>
|