<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="righton">
|
<input disabled 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="item['行号']">
|
<uni-card :title="item.物料代码" :extra="'行号. ' + item['行号']" 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 {
|
billNo: '',
|
lineNo: 0,
|
printInfo: "",
|
userInfo: getUserInfo(),
|
serverUrl: uni.getStorageSync('serverUrl') || 'http://47.96.97.237/API',
|
OperationType: 1, //数据类型 1添加 保存 2复制 3 编辑
|
linterid: '',
|
HEntryID: '',
|
hmaterid: '',
|
codeGenComplete: false,
|
baseInfo: {
|
HMainID: '',
|
HSubID: '',
|
HInnerBillNo: '',
|
HMaterID: '',
|
// barCodeNo: '',
|
HBillNo: '',
|
HBillLineNo: '',
|
HMaterNumber: '',
|
HMaterName: '',
|
HMaterModel: '',
|
HPcsName: '',
|
HBatchNo: '',
|
HQty: 0,
|
HMTONo: '',
|
HSupName: '',
|
HSupNameShort: '',
|
HMinQty: 0,
|
HBQty: 0,
|
HSupID: '',
|
HUnitID: '',
|
HDate: '',
|
HSourceBillNo: '',
|
HMaker: getUserInfo()["Czymc"],
|
HSupNumber: '',
|
HCoilNO: '',
|
HFurnaceNO: '',
|
HFactory: '',
|
},
|
sWhere: '',
|
listData: [],
|
|
}
|
},
|
components: {
|
labelPrinterComponentVue
|
},
|
onLoad(e) {
|
console.log("页面传递参数: ", e)
|
this.OperationType = e.OperationType
|
this.billNo = e.billNo
|
this.baseInfo.HBillNo = e.billNo
|
this.baseInfo.HBillLineNo = e.lineNo
|
this.lineNo = e.lineNo
|
this.baseInfo.HSourceBillNo = e.billNo
|
this.baseInfo.HInnerBillNo = e.billNo
|
this.getData()
|
},
|
methods: {
|
getData() {
|
CommonUtils.doRequest(
|
"/Cg_POOrderBill/list", {
|
sWhere: ` and 单据号 = '${this.billNo}' and 行号 = ${this.lineNo}`,
|
user: this.userInfo.Czymc,
|
},
|
(res) => {
|
console.log('采购订单: ', res)
|
let {
|
data,
|
count
|
} = res.data
|
if (count > 0) {
|
let d = data[0]
|
this.baseInfo = Object.assign(this.baseInfo, {
|
HMaterNumber: d['物料编码'],
|
HMaterName: d['物料名称'],
|
HMaterModel: d['规格型号'],
|
HBatchNo: d['批号'],
|
HQty: d['数量'],
|
HMinQty: d['数量'],
|
HBQty: d['数量'],
|
HSupID: d['HSupID'],
|
HSupNumber: d['供应商代码'],
|
HSupName: d['供应商'],
|
HUnitID: d['HUnitID'],
|
HPcsName: d['计量单位'],
|
HSupNameShort: d['供应商'],
|
HMTONo: d['计划跟踪号'].trim(),
|
HMainID: d['hmainid'],
|
HSubID: d['HEntryID'],
|
HMaterID: d['HMaterID'],
|
HDate: d['日期'],
|
HCoilNO: d['款号'],
|
HFurnaceNO: d['分组'],
|
HFactory: d['客户编号']
|
})
|
console.log(this.baseInfo)
|
// CommonUtils.playSound(1)
|
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) {
|
let HBarCodeNoStr =
|
`${this.baseInfo.HBillNo}@${this.baseInfo.HBillLineNo}@${this.baseInfo.HMaterNumber || ''}@${this.baseInfo.HMTONo || ''}@${this.baseInfo.HQty || 0}@${this.baseInfo.HSupNumber || ''}`
|
let pcsInfo = this.baseInfo.HPcsName ? '(' + this.baseInfo.HPcsName + ')' : ''
|
|
printContent.push(`! 0 200 200 400 1
|
PAGE-WIDTH 608
|
SETQRVER 3
|
B QR 475 15 Q 0 U 3
|
LA,${HBarCodeNoStr}
|
ENDQR
|
T 24 0 0 30 供应商: ${this.baseInfo.HSupName}
|
T 55 0 0 55 (Supplier)
|
T 24 0 0 75 供应商料号: ${this.baseInfo.HMaterNumber}
|
T 55 0 0 100 (Supplier Sku No.)
|
T 24 0 0 120 物料名称: ${this.baseInfo.HMaterName}
|
T 55 0 0 145 (Material Code)
|
T 24 0 0 165 款号: ${this.baseInfo.HCoilNO}
|
T 55 0 0 190 (Style No.)
|
T 24 0 300 165 客户编号: ${this.baseInfo.HFactory}
|
T 55 0 300 190 (Consumer No.)
|
T 24 0 0 210 分组: ${this.baseInfo.HFurnaceNO || ''}
|
T 55 0 0 235 (Group)
|
T 24 0 300 210 规格: ${this.baseInfo.HMaterModel}
|
T 55 0 300 235 (SKU NO.)
|
T 24 0 0 255 数量: ${ parseFloat(this.baseInfo.HQty || 0).toFixed(0) } ${pcsInfo}
|
T 55 0 0 280 (Quantity)
|
T 24 0 300 255 日期: ${this.baseInfo.HDate || ''}
|
T 55 0 300 280 (Date)
|
T 24 0 0 300 检验员:
|
T 55 0 0 325 (QC)
|
T 24 0 300 300 采购单号: ${this.baseInfo.HBillNo || ''}
|
T 55 0 300 325 (Purchase Order No.)
|
T 24 0 0 345 检验结果:
|
T 55 0 0 370 (Inspection status)
|
BOX 240 345 260 365 4
|
T 24 0 270 345 合格
|
T 55 0 250 370 (Pass)
|
BOX 340 345 360 365 4
|
T 24 0 370 345 不合格
|
T 55 0 370 370 (Fail)
|
BOX 460 345 480 365 4
|
T 24 0 490 345 特采
|
T 55 0 440 370 (Spec. accepted)
|
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() {
|
let HBarCodeNoStr =
|
`${this.baseInfo.HBillNo}@${this.baseInfo.HBillLineNo}@${this.baseInfo.HMaterNumber || ''}@${this.baseInfo.HMTONo || ''}@${this.baseInfo.HQty || 0}@${this.baseInfo.HSupNumber || ''}`
|
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');
|
let sMainSub = sMainStr + ';' + HOrgType + ';' + HSourceBillType + ';' + HSelectBarCodeType + ';' +
|
CampanyName + ';' + UserName + ';' + HBarCodeNoStr +
|
';' + this.baseInfo.HFactory + ';' + this.baseInfo.HCoilNO +
|
';' + this.baseInfo.HFurnaceNO + '';
|
|
CommonUtils.doRequest(
|
"/Sc_BarCode/SaveBarCode_NoGenerate", {
|
msg: sMainSub,
|
CampanyName: CampanyName
|
},
|
(res) => {
|
console.log(res)
|
let {
|
data,
|
count,
|
Message
|
} = res.data
|
if (count > 0) {
|
// this.generatedBarCode = data[0]['条码编号']/
|
// console.log(this.generatedBarCode)
|
uni.showToast({
|
icon: 'none',
|
title: Message
|
})
|
this.codeGenComplete = true
|
this.buttonStatus = {
|
btn1: true,
|
btn2: false
|
}
|
for (let listOne of this.listData) {
|
listOne['条码编号'] = HBarCodeNoStr
|
}
|
} else {
|
this.buttonStatus = {
|
btn1: false,
|
btn2: false
|
}
|
uni.showToast({
|
icon: 'none',
|
title: Message
|
})
|
}
|
},
|
(err) => {
|
this.buttonStatus = {
|
btn1: false,
|
btn2: false
|
}
|
uni.showToast({
|
icon: 'none',
|
title: err
|
})
|
},
|
"POST"
|
)
|
}
|
}
|
}
|
</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 {
|
flex: 1;
|
border-radius: 22rpx;
|
border: 1px solid #acacac;
|
}
|
|
.righton {
|
flex: 1;
|
border-radius: 22rpx;
|
border: 1px solid #e4e4e4;
|
background-color: #e4e4e4;
|
}
|
|
input {
|
width: inherit;
|
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%;
|
word-break: break-all;
|
|
.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>
|