Browse Source

打印数据bug 2024/6/18 13:48:02

hella_vue3
zhang_li 3 months ago
parent
commit
3aa0d74ab5
  1. 4
      src/api/request2.js
  2. 15
      src/mycomponents/recommend/recommend.vue
  3. 5
      src/mycomponents/scan/winComScanFg.vue
  4. 12
      src/mycomponents/scan/winScanFgLabel.vue
  5. 4
      src/pages/deliver/job/deliverDetail.vue
  6. 2
      src/pages/package/record/overPackageRecord.vue
  7. 514
      src/pages/pointPutawayJob/index.vue
  8. 6
      src/pages/productReceipt/job/fgProductReceiptDetail.vue
  9. 24
      src/pages/purchaseReceipt/job/receiptDetail.vue

4
src/api/request2.js

@ -2584,6 +2584,6 @@ export function isCheckMesCode(code) {
* 获取上架任务打印明细
* @param {*}
*/
export function getJimuPutawayJobDetail(ids) {
return http.get("/wms/jimu-report/getPutawayJobDetailForPDA?masterIds="+ids)
export function getJimuPutawayJobDetail(data) {
return http.post("/wms/jimu-report/getPutawayJobDetailForPDA",data)
}

15
src/mycomponents/recommend/recommend.vue

@ -69,6 +69,21 @@ const props = defineProps({
default: '库位'
}
})
watch(
() => props.detail,
(newVal, oldVal) => {
if (newVal.scaned) {
newVal.copyContent = `HPQ;V1.0;I${newVal.itemCode};P${newVal.packingNumber};B${newVal.batch};Q${newVal.qty}`
} else {
newVal.copyContent = ''
}
console.log('newVal.copyContent', newVal.copyContent)
},
{
immediate: true,
deep: true
}
)
const copy = () => {
// HPQ;V1.0;ICE115F11161AG;PP20230427000026;B20230427002;Q100
const content = `HPQ;V1.0;I${props.detail.itemCode};P${props.detail.packingNumber};B${props.detail.batch};Q${props.detail.qty}`

5
src/mycomponents/scan/winComScanFg.vue

@ -119,6 +119,11 @@ const hide = () => {
// #endif
}
const setItemCodeSimulate = (itemCode, scanMsg) => {
itemCode.value = itemCode
scanMsg.value = scanMsg
}
const setItemCode = (itemCodeParams) => {
itemCode.value = itemCodeParams
}

12
src/mycomponents/scan/winScanFgLabel.vue

@ -16,6 +16,9 @@
</view>
</view>
</u-popup>
<!-- 模拟扫描功能 -->
<win-com-scan-fg v-show="false" ref="comscansimulate" @getResult="getScanResult" :isShowHistory="false" :clearResult="true"></win-com-scan-fg>
<com-message ref="comMessageRef" @afterClose="getfocus" />
</view>
</template>
@ -36,6 +39,12 @@ const props = defineProps({
})
const show = ref(false)
const comscan = ref()
const comscansimulate = ref()
//
const simulateScan = (item) => {
comscansimulate.value.setItemCodeSimulate(item.itemCode, item.copyContent)
comscansimulate.value.clickScanMsg()
}
const openScanPopup = (itemCode) => {
setTimeout((res) => {
show.value = true
@ -84,7 +93,8 @@ defineExpose({
openScanPopup,
closeScanPopup,
losefocus,
getfocus
getfocus,
simulateScan
})
</script>

4
src/pages/deliver/job/deliverDetail.vue

@ -202,7 +202,9 @@ const submit = () => {
const submitJob = () => {
const params = setParams()
if (params.subList.length == 0) {
comMessageRef.value.showSuccessMessage('请扫描箱码')
uni.hideLoading()
comMessageRef.value.showConfirmMessageModal('请扫描箱码')
return
}
deliverJobSubmit(params)
.then((res) => {

2
src/pages/package/record/overPackageRecord.vue

@ -253,7 +253,7 @@ const scanPopupGetFocus = () => {
}
const commit = () => {
if (detailSource.value.length > 0 && detailSource.value[0].subList.length > 0) {
if (toPackUnit.value == '包装规格') {
if (toPackUnit.value || toPackUnit.value == '包装规格') {
showErrorMessage('请选择目标包装规格')
return
}

514
src/pages/pointPutawayJob/index.vue

@ -1,178 +1,185 @@
<template>
<view class="content" style="padding:30rpx 20rpx 100rpx;min-height: calc(100vh - 120rpx);">
<com-empty-view v-if="data.length==0"></com-empty-view>
<!-- 只用于展示页面 -->
<view class="box" style="margin-bottom: 20rpx;">
<view class="top">
<view class="mb-kw">
目标库位<text>{{data.toLocationCode}}</text>
</view>
<view class="mb-text">
任务编号<text>{{data.number}}</text>
</view>
<view class="mb-text">
创建人<text>{{data.creator||''}}</text>
</view>
<view class="mb-text">
创建时间<text>{{data.createTime}}</text>
</view>
</view>
<u-table style="margin-top: 20rpx;">
<u-tr>
<u-th>物品代码</u-th>
<u-th>物品描述</u-th>
<u-th>批次</u-th>
<u-th>包装号</u-th>
<u-th>包装规格</u-th>
<u-th>数量</u-th>
<u-th>计量单位</u-th>
</u-tr>
<u-tr v-for="(cur,key) in data.sublist" :key='key'>
<u-td>{{cur.itemCode}}</u-td>
<u-td>{{cur.itemDesc1}}</u-td>
<u-td>{{cur.batch}}</u-td>
<u-td>{{cur.packingNumber}}</u-td>
<u-td>{{cur.packUnit}}</u-td>
<u-td>{{cur.packQty}}</u-td>
<u-td>{{cur.uom}}</u-td>
</u-tr>
</u-table>
</view>
<view class="" style="position: fixed;width: 100%;bottom: 0rpx;left: 0px;">
<button @click="printImage"
style='background:rgb(60, 156, 255) !important ;color: white;margin-top: 80rpx;'> 打印</button>
</view>
</view>
<view class="content" style="padding: 30rpx 20rpx 100rpx; min-height: calc(100vh - 120rpx)">
<com-empty-view v-if="data.length == 0"></com-empty-view>
<!-- 只用于展示页面 -->
<view class="box" style="margin-bottom: 20rpx">
<view class="top">
<view class="mb-kw">
目标库位<text>{{ data.toLocationCode }}</text>
</view>
<view class="mb-text">
任务编号<text>{{ data.number }}</text>
</view>
<view class="mb-text">
创建人<text>{{ data.creator || '' }}</text>
</view>
<view class="mb-text">
创建时间<text>{{ formatDate(data.createTime) }}</text>
</view>
</view>
<u-table style="margin-top: 20rpx">
<u-tr>
<u-th>物品代码</u-th>
<u-th>物品描述</u-th>
<u-th>批次</u-th>
<u-th>包装号</u-th>
<u-th>包装规格</u-th>
<u-th>数量</u-th>
<u-th>计量单位</u-th>
</u-tr>
<u-tr v-for="(cur, key) in data.sublist" :key="key">
<u-td>{{ cur.itemCode }}</u-td>
<u-td>{{ cur.itemDesc1 }}</u-td>
<u-td>{{ cur.batch }}</u-td>
<u-td>{{ cur.packingNumber }}</u-td>
<u-td>{{ cur.packUnit }}</u-td>
<u-td>{{ cur.packQty }}</u-td>
<u-td>{{ cur.uom }}</u-td>
</u-tr>
</u-table>
</view>
<view class="" style="position: fixed; width: 100%; bottom: 0rpx; left: 0px">
<button @click="printImage" style="background: rgb(60, 156, 255) !important ; color: white; margin-top: 80rpx">打印</button>
</view>
</view>
</template>
<script>
import {
getJimuPutawayJobDetail
} from '@/api/request2.js';
//
const htmlFileUrl = '/hybrid/html/pointPutawayJob.html';
// #ifdef APP
var testModule = uni.requireNativePlugin("TestModule")
// #endif
export default {
name: 'pointPutawayJob',
data() {
return {
data: {
sublist:[]
},
newHtmlContent: '', //html
isLoadFinish: false,
ids:''
}
},
methods: {
// #ifdef APP
//
printImage() {
testModule.doHTMLPrint(this.newHtmlContent)
},
// html
readFile(path, callback) {
plus.io.resolveLocalFileSystemURL(path, function(entry) {
entry.file(function(file) {
var reader = new plus.io.FileReader();
reader.onloadend = function(e) {
callback(e.target.result);
};
reader.readAsText(file);
}, function(e) {
console.log("读取文件失败:" + e.message);
});
}, function(e) {
console.log("获取图片资源失败:" + e.message);
});
}
// #endif
},
watch: {
isLoadFinish: {
handler(newVal, oldVal) {
if (newVal == true) {
// html
import { getJimuPutawayJobDetail } from '@/api/request2.js'
import { dateFormat } from '@/common/basic.js'
//
const htmlFileUrl = '/hybrid/html/pointPutawayJob.html'
// #ifdef APP
const testModule = uni.requireNativePlugin('TestModule')
// #endif
}
},
immediate: true
export default {
name: 'pointPutawayJob',
data() {
return {
data: {
sublist: []
},
newHtmlContent: '', // html
isLoadFinish: false,
ids: ''
}
},
}
},
methods: {
// #ifdef APP
//
printImage() {
testModule.doHTMLPrint(this.newHtmlContent)
},
// html
readFile(path, callback) {
plus.io.resolveLocalFileSystemURL(
path,
function (entry) {
entry.file(
function (file) {
const reader = new plus.io.FileReader()
reader.onloadend = function (e) {
callback(e.target.result)
}
reader.readAsText(file)
},
function (e) {
console.log(`读取文件失败:${e.message}`)
}
)
},
function (e) {
console.log(`获取图片资源失败:${e.message}`)
}
)
},
// #endif
formatDate(val) {
return dateFormat(val)
}
},
watch: {
isLoadFinish: {
handler(newVal, oldVal) {
if (newVal == true) {
// html
}
},
immediate: true
}
},
onLoad(option) {
if (option.data) {
this.data = JSON.parse(decodeURIComponent(option.data));
}
},
async onShow() {
await getJimuPutawayJobDetail(this.data.ids).then(res=>{
this.data.sublist = res.data
})
//
// this.data = [{
// toLocationCode: 'C13-12-11',
// jobNumber: '555555',
// creator: '',
// createTime: '2019-12-12 05:00:00',
// sublist: [{
// itemNumber: '66',
// itemDes: 'hahah',
// batch: '201450513',
// packingNumber: '201450513',
// packUnit: '201450513',
// packQty: '40',
// uom: ''
// },{
// itemNumber: '77',
// itemDes: '8888',
// batch: '201450513',
// packingNumber: '201450513',
// packUnit: '201450513',
// packQty: '40',
// uom: ''
// }]
// }, {
// toLocationCode: 'C13-12-11',
// jobNumber: '555555',
// creator: '',
// createTime: '2019-12-12 05:00:00',
// sublist: [{
// itemNumber: '66',
// itemDes: 'hahah',
// batch: '201450513',
// packingNumber: '',
// packUnit: '',
// packQty: '',
// uom: ''
// }]
// }, {
// toLocationCode: 'C13-12-11',
// jobNumber: '555555',
// creator: '',
// createTime: '2019-12-12 05:00:00',
// sublist: [{
// itemNumber: '66',
// itemDes: 'hahah',
// batch: '201450513',
// packingNumber: '',
// packUnit: '',
// packQty: '',
// uom: ''
// }]
// }]
this.$nextTick(async () => {
let str = ''
this.readFile(htmlFileUrl, (htmlContent) => {
this.newHtmlContent = htmlContent
// this.data.forEach(item => {
str += `<div class="box" style="page-break-before:always;"><br />
onLoad(option) {
if (option.data) {
this.data = JSON.parse(decodeURIComponent(option.data))
}
},
async onShow() {
await getJimuPutawayJobDetail({
masterIds: this.data.ids
}).then((res) => {
this.data.sublist = res.data
})
//
// this.data = [{
// toLocationCode: 'C13-12-11',
// jobNumber: '555555',
// creator: '',
// createTime: '2019-12-12 05:00:00',
// sublist: [{
// itemNumber: '66',
// itemDes: 'hahah',
// batch: '201450513',
// packingNumber: '201450513',
// packUnit: '201450513',
// packQty: '40',
// uom: ''
// },{
// itemNumber: '77',
// itemDes: '8888',
// batch: '201450513',
// packingNumber: '201450513',
// packUnit: '201450513',
// packQty: '40',
// uom: ''
// }]
// }, {
// toLocationCode: 'C13-12-11',
// jobNumber: '555555',
// creator: '',
// createTime: '2019-12-12 05:00:00',
// sublist: [{
// itemNumber: '66',
// itemDes: 'hahah',
// batch: '201450513',
// packingNumber: '',
// packUnit: '',
// packQty: '',
// uom: ''
// }]
// }, {
// toLocationCode: 'C13-12-11',
// jobNumber: '555555',
// creator: '',
// createTime: '2019-12-12 05:00:00',
// sublist: [{
// itemNumber: '66',
// itemDes: 'hahah',
// batch: '201450513',
// packingNumber: '',
// packUnit: '',
// packQty: '',
// uom: ''
// }]
// }]
this.$nextTick(async () => {
let str = ''
this.readFile(htmlFileUrl, (htmlContent) => {
this.newHtmlContent = htmlContent
// this.data.forEach(item => {
str += `<div class="box" style="page-break-before:always;"><br />
<div class="top">
<div class="mb-kw">
目标库位<span>${this.data.toLocationCode}</span>
@ -184,8 +191,8 @@
创建人<span>${this.data.creator}</span>
</div>
<div class="mb-text">
创建时间<span>${this.data.createTime}</span>
</div>
创建时间<span>${this.formatDate(this.data.createTime)}</span>
</div>
</div>
<table style="margin-top: 20rpx;" style='border-collapse: collapse;'>
<tr>
@ -201,9 +208,9 @@
</table>
<div>
`
let str1 = ''
this.data.sublist.forEach((cur, key) => {
str1 += `
let str1 = ''
this.data.sublist.forEach((cur, key) => {
str1 += `
<tr>
<td>${cur.itemCode}</td>
<td>${cur.itemDesc1}</td>
@ -214,103 +221,96 @@
<td>${cur.uom}</td>
</tr>
`
})
str = str.replace(
"tableTrTd", str1)
// })
this.newHtmlContent = this.newHtmlContent.replace(
"mainBody", str); //
});
})
},
}
})
str = str.replace('tableTrTd', str1)
// })
this.newHtmlContent = this.newHtmlContent.replace('mainBody', str) //
})
})
}
}
</script>
<style>
.box {
font-size: 26rpx;
/* display: flex; */
padding: 20rpx;
border: 1px solid #dedede;
}
.left {
border-top: 1px solid #b1b1b1;
border-left: 1px solid #b1b1b1;
flex: 1;
}
.left-item {
display: flex;
}
.box {
font-size: 26rpx;
/* display: flex; */
padding: 20rpx;
border: 1px solid #dedede;
}
.label {
border-bottom: 1px solid #b1b1b1;
border-right: 1px solid #b1b1b1;
width: 140rpx;
padding: 0px 10rpx;
height: 60rpx;
line-height: 60rpx;
}
.left {
border-top: 1px solid #b1b1b1;
border-left: 1px solid #b1b1b1;
flex: 1;
}
.value {
border-bottom: 1px solid #b1b1b1;
border-right: 1px solid #b1b1b1;
padding: 0px 5px;
height: 60rpx;
flex: 1;
width: 0px;
display: flex;
align-items: center;
word-wrap: break-word;
}
.left-item {
display: flex;
}
.right {
width: 50%;
.label {
border-bottom: 1px solid #b1b1b1;
border-right: 1px solid #b1b1b1;
width: 140rpx;
padding: 0px 10rpx;
height: 60rpx;
line-height: 60rpx;
}
border-top: 1px solid #b1b1b1;
}
.value {
border-bottom: 1px solid #b1b1b1;
border-right: 1px solid #b1b1b1;
padding: 0px 5px;
height: 60rpx;
flex: 1;
width: 0px;
display: flex;
align-items: center;
word-wrap: break-word;
}
.image {
width: 100%;
height: 301rpx;
border-bottom: 1px solid #b1b1b1;
border-top: 1px solid #b1b1b1;
border-right: 1px solid #b1b1b1;
}
.right {
width: 50%;
.image img {
width: calc(100% - 4px);
height: calc(100% - 4px);
margin: 4rpx;
}
border-top: 1px solid #b1b1b1;
}
.mb-kw {
border-bottom: 1px solid #dedede;
padding-bottom: 20rpx;
.image {
width: 100%;
height: 301rpx;
border-bottom: 1px solid #b1b1b1;
border-top: 1px solid #b1b1b1;
border-right: 1px solid #b1b1b1;
}
}
.image img {
width: calc(100% - 4px);
height: calc(100% - 4px);
margin: 4rpx;
}
.mb-kw text {
font-weight: bold;
font-size: 32rpx;
}
.mb-kw {
border-bottom: 1px solid #dedede;
padding-bottom: 20rpx;
}
.mb-text {
margin-top: 10rpx;
}
.mb-kw text {
font-weight: bold;
font-size: 32rpx;
}
::v-deep .u-th {
font-size: 24rpx !important;
}
.mb-text {
margin-top: 10rpx;
}
::v-deep .u-td {
height: auto !important;
font-size: 24rpx !important;
word-break: break-all;
::v-deep .u-th {
font-size: 24rpx !important;
}
}
</style>
::v-deep .u-td {
height: auto !important;
font-size: 24rpx !important;
word-break: break-all;
}
</style>

6
src/pages/productReceipt/job/fgProductReceiptDetail.vue

@ -183,7 +183,11 @@ const getDetail = () => {
detailSource.value = getDataSource(subList.value)
detailSource.value.forEach((r) => {
r.subList.forEach((s) => {
if (scanedPackingNumber.value && scanedPackingNumber.value == s.packingNumber) s.scaned = true
if (scanedPackingNumber.value && scanedPackingNumber.value == s.packingNumber) {
s.scaned = true
//
scanPopup.value.simulateScan(s)
}
})
})
} else {

24
src/pages/purchaseReceipt/job/receiptDetail.vue

@ -386,11 +386,11 @@ const submitJob = () => {
//
let timerCount = 0
const timer1 = setInterval(async () => {
if (timerCount == 10) {
if (timerCount == 15) {
clearInterval(timer1)
uni.showLoading({
uni.showToast({
title: '跳转打印页面失败',
mask: true
icon: 'none'
})
return
}
@ -399,23 +399,23 @@ const submitJob = () => {
{
column: 'purchaseReceiptRecordNumber',
action: 'in',
value: res.data
value: res.data.number
}
],
pageNo: 1,
pageSize: 1000
}).then((res) => {
}).then((res1) => {
timerCount += 1
console.log(11111)
if (res.data && res.data.list && res.data.list.length) {
if (res1.data && res1.data.list && res1.data.list.length && res1.data.total >= res.data.detailCount) {
uni.hideLoading()
clearInterval(timer1)
const dataParams = {
toLocationCode: res.data.list[0].toLocationCode,
number: res.data.list[0].number,
creator: res.data.list[0].creator,
createTime: res.data.list[0].createTime,
ids: res.data.list.map((item) => item.masterId).join(',')
toLocationCode: res1.data.list[0].toLocationCode,
number: res1.data.list[0].number,
creator: res1.data.list[0].creator,
createTime: res1.data.list[0].createTime,
ids: res1.data.list.map((item) => item.masterId).join(',')
}
console.log(dataParams)
uni.navigateTo({
@ -423,7 +423,7 @@ const submitJob = () => {
})
}
})
}, 1000)
}, 2000)
} else {
showErrorMessage(`提交失败[${res.msg}]`)
}

Loading…
Cancel
Save