剩余模块:生产退料
This commit is contained in:
@@ -34,7 +34,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { reactive, nextTick, onMounted, ref, computed, watch } from 'vue';
|
||||
import { onLoad, onShow, onReachBottom, } from '@dcloudio/uni-app'
|
||||
import { onLoad, onShow, onReachBottom, onBackPress } from '@dcloudio/uni-app'
|
||||
import tkiQrcode from '@/components/tki-qrcode/tki-qrcode.vue'
|
||||
import { PRD_MOEnterIntoPro, UHIK_BD_BarCodeMainFileSave, getPrintData } from '../../common/request/api/api';
|
||||
import { timeFormat } from '@/uni_modules/uview-plus';
|
||||
@@ -58,12 +58,20 @@
|
||||
},
|
||||
bluetoothList: [],
|
||||
sendData: '',
|
||||
printDataList:[]
|
||||
printDataList: []
|
||||
})
|
||||
onLoad((pageData : any) => {
|
||||
state.pageData = pageData
|
||||
console.log(pageData);
|
||||
getPrintDataFun()
|
||||
if(pageData.type === 'Arr'){
|
||||
state.pageData.FBillNo = JSON.parse(pageData.list)[0].Number
|
||||
console.log('========================================',state.pageData);
|
||||
console.log('========================================',JSON.parse(pageData.list));
|
||||
getPrintDataFun()
|
||||
} else {
|
||||
state.pageData = pageData
|
||||
console.log(pageData);
|
||||
getPrintDataFun()
|
||||
}
|
||||
|
||||
})
|
||||
onShow(() => {
|
||||
uni.getLocation({
|
||||
@@ -71,24 +79,40 @@
|
||||
success(res) {
|
||||
console.log('开启定位权限', res)
|
||||
},
|
||||
fail: (err) => {
|
||||
// uni.showToast({
|
||||
// title: '请先打开定位功能:' + err,
|
||||
// duration: 1500
|
||||
// });
|
||||
}
|
||||
});
|
||||
// #ifdef APP-PLUS
|
||||
hasPermission()
|
||||
// #endif
|
||||
})
|
||||
const getPrintDataFun = () => {
|
||||
getPrintData({queryString:state.pageData.FBillNo}).then((res:any) => {
|
||||
getPrintData({ queryString: state.pageData.FBillNo }).then((res : any) => {
|
||||
state.printDataList = res.data
|
||||
})
|
||||
}
|
||||
//获取蓝牙权限并打开蓝牙
|
||||
const hasPermission = () => {
|
||||
console.log(uni.getStorageSync('printInfo'));
|
||||
blueModule.checkConnect({
|
||||
mac: uni.getStorageSync('printInfo').address,
|
||||
uuid: '00001101-0000-1000-8000-00805f9b34fb'
|
||||
}, (ret : any) => {
|
||||
console.log(ret);
|
||||
if (!ret.success) {
|
||||
uni.setStorageSync('printInfo', {})
|
||||
state.printingMachine = {
|
||||
name: '',
|
||||
address: ''
|
||||
}
|
||||
setTimeout(() => {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
mask: true,
|
||||
title: t('index.ljydk'),
|
||||
})
|
||||
}, 500)
|
||||
}
|
||||
|
||||
});
|
||||
blueModule.hasPermission((res : any) => {
|
||||
if (res.success) {
|
||||
blueModule.isOpen((isOpenRes : any) => {
|
||||
@@ -97,7 +121,7 @@
|
||||
state.printingMachine.name = uni.getStorageSync('printInfo').name
|
||||
state.printingMachine.address = uni.getStorageSync('printInfo').address
|
||||
} else {
|
||||
uni.setStorageSync('printInfo',{})
|
||||
uni.setStorageSync('printInfo', {})
|
||||
state.printingMachine.name = ''
|
||||
state.printingMachine.address = ''
|
||||
blueModule.openBT((openBTRes : any) => {
|
||||
@@ -129,6 +153,9 @@
|
||||
}
|
||||
|
||||
const getAddressFun = (row : any) => {
|
||||
blueModule.disconnectAll((ret) => {
|
||||
console.log(ret);
|
||||
});
|
||||
blueModule.connect({
|
||||
MACAddress: row.address,
|
||||
uuid: '00001101-0000-1000-8000-00805f9b34fb',
|
||||
@@ -141,16 +168,14 @@
|
||||
state.printingMachine.name = row.name
|
||||
state.printingMachine.address = row.address
|
||||
bluetoothListRef.value.close()
|
||||
uni.setStorageSync('printInfo',{name:row.name,address:row.address})
|
||||
uni.setStorageSync('printInfo', { name: row.name, address: row.address })
|
||||
} else {
|
||||
uni.$u.toast(t('index.ljsb'))
|
||||
}
|
||||
}, (data : any) => {
|
||||
//接收的数据回调
|
||||
console.log(data)
|
||||
})
|
||||
}
|
||||
|
||||
const createLabel = () => {
|
||||
var command = tsc.default.createNew()
|
||||
command.setSize(100, 50)
|
||||
@@ -158,7 +183,7 @@
|
||||
command.setCls()
|
||||
command.setText(50, 30, "TSS24.BF2", 1, 1, state.printDataList[0].fBillNo)
|
||||
command.setQR(50, 65, "L", 8, "A", state.printDataList[0].fBillNo)
|
||||
state.printDataList.forEach((item,index) => {
|
||||
state.printDataList.forEach((item, index) => {
|
||||
command.setText(260, 64 + index * 40, "TSS24.BF2", 1, 1, `${item.fMaterialId} / ${item.fQty} / ${item.fSalOrderNo}`)
|
||||
})
|
||||
command.setPagePrint()
|
||||
@@ -166,25 +191,31 @@
|
||||
}
|
||||
const UHIK_BD_BarCodeMainFileSaveFun = () => {
|
||||
let arr = []
|
||||
state.printDataList.forEach((item:any) => {
|
||||
state.printDataList.forEach((item : any) => {
|
||||
arr.push({
|
||||
FBarCodeRule:'03',
|
||||
FBarCode:item.fBillNo,
|
||||
FBillCode:item.fBillNo
|
||||
FBarCodeRule: '03',
|
||||
FBarCode: item.fBillNo,
|
||||
FBillCode: item.fBillNo
|
||||
})
|
||||
})
|
||||
UHIK_BD_BarCodeMainFileSave({
|
||||
Key:'qwe123!@#',
|
||||
Items:arr
|
||||
}).then((res:any) => {
|
||||
console.log('=====================================',res);
|
||||
Key: 'qwe123!@#',
|
||||
Items: arr
|
||||
}, true).then((res : any) => {
|
||||
console.log('=====================================', res);
|
||||
let str = JSON.stringify(res)
|
||||
if (str.indexOf('违反字段唯一性要求') !== -1 || str.indexOf('is already been used') !== -1) {
|
||||
|
||||
} else {
|
||||
uni.$u.toast(t('index.cjbqsb'))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const sendHexStr = () => {
|
||||
createLabel()
|
||||
UHIK_BD_BarCodeMainFileSaveFun()
|
||||
if (state.sendData == null) {
|
||||
// uni.$u.toast('请先生成指令')
|
||||
return
|
||||
}
|
||||
let hexStr = ''
|
||||
@@ -216,6 +247,15 @@
|
||||
//结果
|
||||
console.log('发送结果')
|
||||
console.log(result)
|
||||
if (!result.success) {
|
||||
uni.$u.toast(t('index.ljydk'))
|
||||
uni.setStorageSync('printInfo', {})
|
||||
state.printingMachine = {
|
||||
name: '',
|
||||
address: ''
|
||||
}
|
||||
return
|
||||
}
|
||||
if (result.success) {
|
||||
realWriteData(sendloop, i + 1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user