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. 512
      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 {*} * @param {*}
*/ */
export function getJimuPutawayJobDetail(ids) { export function getJimuPutawayJobDetail(data) {
return http.get("/wms/jimu-report/getPutawayJobDetailForPDA?masterIds="+ids) return http.post("/wms/jimu-report/getPutawayJobDetailForPDA",data)
} }

15
src/mycomponents/recommend/recommend.vue

@ -69,6 +69,21 @@ const props = defineProps({
default: '库位' 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 = () => { const copy = () => {
// HPQ;V1.0;ICE115F11161AG;PP20230427000026;B20230427002;Q100 // 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}` 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 // #endif
} }
const setItemCodeSimulate = (itemCode, scanMsg) => {
itemCode.value = itemCode
scanMsg.value = scanMsg
}
const setItemCode = (itemCodeParams) => { const setItemCode = (itemCodeParams) => {
itemCode.value = itemCodeParams itemCode.value = itemCodeParams
} }

12
src/mycomponents/scan/winScanFgLabel.vue

@ -16,6 +16,9 @@
</view> </view>
</view> </view>
</u-popup> </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" /> <com-message ref="comMessageRef" @afterClose="getfocus" />
</view> </view>
</template> </template>
@ -36,6 +39,12 @@ const props = defineProps({
}) })
const show = ref(false) const show = ref(false)
const comscan = ref() const comscan = ref()
const comscansimulate = ref()
//
const simulateScan = (item) => {
comscansimulate.value.setItemCodeSimulate(item.itemCode, item.copyContent)
comscansimulate.value.clickScanMsg()
}
const openScanPopup = (itemCode) => { const openScanPopup = (itemCode) => {
setTimeout((res) => { setTimeout((res) => {
show.value = true show.value = true
@ -84,7 +93,8 @@ defineExpose({
openScanPopup, openScanPopup,
closeScanPopup, closeScanPopup,
losefocus, losefocus,
getfocus getfocus,
simulateScan
}) })
</script> </script>

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

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

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

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

512
src/pages/pointPutawayJob/index.vue

@ -1,178 +1,185 @@
<template> <template>
<view class="content" style="padding:30rpx 20rpx 100rpx;min-height: calc(100vh - 120rpx);"> <view class="content" style="padding: 30rpx 20rpx 100rpx; min-height: calc(100vh - 120rpx)">
<com-empty-view v-if="data.length==0"></com-empty-view> <com-empty-view v-if="data.length == 0"></com-empty-view>
<!-- 只用于展示页面 --> <!-- 只用于展示页面 -->
<view class="box" style="margin-bottom: 20rpx;"> <view class="box" style="margin-bottom: 20rpx">
<view class="top"> <view class="top">
<view class="mb-kw"> <view class="mb-kw">
目标库位<text>{{data.toLocationCode}}</text> 目标库位<text>{{ data.toLocationCode }}</text>
</view> </view>
<view class="mb-text"> <view class="mb-text">
任务编号<text>{{data.number}}</text> 任务编号<text>{{ data.number }}</text>
</view> </view>
<view class="mb-text"> <view class="mb-text">
创建人<text>{{data.creator||''}}</text> 创建人<text>{{ data.creator || '' }}</text>
</view> </view>
<view class="mb-text"> <view class="mb-text">
创建时间<text>{{data.createTime}}</text> 创建时间<text>{{ formatDate(data.createTime) }}</text>
</view> </view>
</view> </view>
<u-table style="margin-top: 20rpx;"> <u-table style="margin-top: 20rpx">
<u-tr> <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-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>
<u-tr v-for="(cur,key) in data.sublist" :key='key'> <u-tr v-for="(cur, key) in data.sublist" :key="key">
<u-td>{{cur.itemCode}}</u-td> <u-td>{{ cur.itemCode }}</u-td>
<u-td>{{cur.itemDesc1}}</u-td> <u-td>{{ cur.itemDesc1 }}</u-td>
<u-td>{{cur.batch}}</u-td> <u-td>{{ cur.batch }}</u-td>
<u-td>{{cur.packingNumber}}</u-td> <u-td>{{ cur.packingNumber }}</u-td>
<u-td>{{cur.packUnit}}</u-td> <u-td>{{ cur.packUnit }}</u-td>
<u-td>{{cur.packQty}}</u-td> <u-td>{{ cur.packQty }}</u-td>
<u-td>{{cur.uom}}</u-td> <u-td>{{ cur.uom }}</u-td>
</u-tr> </u-tr>
</u-table> </u-table>
</view> </view>
<view class="" style="position: fixed;width: 100%;bottom: 0rpx;left: 0px;"> <view class="" style="position: fixed; width: 100%; bottom: 0rpx; left: 0px">
<button @click="printImage" <button @click="printImage" style="background: rgb(60, 156, 255) !important ; color: white; margin-top: 80rpx">打印</button>
style='background:rgb(60, 156, 255) !important ;color: white;margin-top: 80rpx;'> 打印</button> </view>
</view> </view>
</view>
</template> </template>
<script> <script>
import { import { getJimuPutawayJobDetail } from '@/api/request2.js'
getJimuPutawayJobDetail import { dateFormat } from '@/common/basic.js'
} from '@/api/request2.js'; //
// const htmlFileUrl = '/hybrid/html/pointPutawayJob.html'
const htmlFileUrl = '/hybrid/html/pointPutawayJob.html'; // #ifdef APP
// #ifdef APP const testModule = uni.requireNativePlugin('TestModule')
var testModule = uni.requireNativePlugin("TestModule") // #endif
// #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
} export default {
}, name: 'pointPutawayJob',
immediate: true 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) { onLoad(option) {
if (option.data) { if (option.data) {
this.data = JSON.parse(decodeURIComponent(option.data)); this.data = JSON.parse(decodeURIComponent(option.data))
} }
}, },
async onShow() { async onShow() {
await getJimuPutawayJobDetail(this.data.ids).then(res=>{ await getJimuPutawayJobDetail({
this.data.sublist = res.data masterIds: this.data.ids
}) }).then((res) => {
// this.data.sublist = res.data
// this.data = [{ })
// toLocationCode: 'C13-12-11', //
// jobNumber: '555555', // this.data = [{
// creator: '', // toLocationCode: 'C13-12-11',
// createTime: '2019-12-12 05:00:00', // jobNumber: '555555',
// sublist: [{ // creator: '',
// itemNumber: '66', // createTime: '2019-12-12 05:00:00',
// itemDes: 'hahah', // sublist: [{
// batch: '201450513', // itemNumber: '66',
// packingNumber: '201450513', // itemDes: 'hahah',
// packUnit: '201450513', // batch: '201450513',
// packQty: '40', // packingNumber: '201450513',
// uom: '' // packUnit: '201450513',
// },{ // packQty: '40',
// itemNumber: '77', // uom: ''
// itemDes: '8888', // },{
// batch: '201450513', // itemNumber: '77',
// packingNumber: '201450513', // itemDes: '8888',
// packUnit: '201450513', // batch: '201450513',
// packQty: '40', // packingNumber: '201450513',
// uom: '' // packUnit: '201450513',
// }] // packQty: '40',
// }, { // uom: ''
// toLocationCode: 'C13-12-11', // }]
// jobNumber: '555555', // }, {
// creator: '', // toLocationCode: 'C13-12-11',
// createTime: '2019-12-12 05:00:00', // jobNumber: '555555',
// sublist: [{ // creator: '',
// itemNumber: '66', // createTime: '2019-12-12 05:00:00',
// itemDes: 'hahah', // sublist: [{
// batch: '201450513', // itemNumber: '66',
// packingNumber: '', // itemDes: 'hahah',
// packUnit: '', // batch: '201450513',
// packQty: '', // packingNumber: '',
// uom: '' // packUnit: '',
// }] // packQty: '',
// }, { // uom: ''
// toLocationCode: 'C13-12-11', // }]
// jobNumber: '555555', // }, {
// creator: '', // toLocationCode: 'C13-12-11',
// createTime: '2019-12-12 05:00:00', // jobNumber: '555555',
// sublist: [{ // creator: '',
// itemNumber: '66', // createTime: '2019-12-12 05:00:00',
// itemDes: 'hahah', // sublist: [{
// batch: '201450513', // itemNumber: '66',
// packingNumber: '', // itemDes: 'hahah',
// packUnit: '', // batch: '201450513',
// packQty: '', // packingNumber: '',
// uom: '' // packUnit: '',
// }] // packQty: '',
// }] // uom: ''
this.$nextTick(async () => { // }]
let str = '' // }]
this.readFile(htmlFileUrl, (htmlContent) => { this.$nextTick(async () => {
this.newHtmlContent = htmlContent let str = ''
// this.data.forEach(item => { this.readFile(htmlFileUrl, (htmlContent) => {
str += `<div class="box" style="page-break-before:always;"><br /> this.newHtmlContent = htmlContent
// this.data.forEach(item => {
str += `<div class="box" style="page-break-before:always;"><br />
<div class="top"> <div class="top">
<div class="mb-kw"> <div class="mb-kw">
目标库位<span>${this.data.toLocationCode}</span> 目标库位<span>${this.data.toLocationCode}</span>
@ -184,8 +191,8 @@
创建人<span>${this.data.creator}</span> 创建人<span>${this.data.creator}</span>
</div> </div>
<div class="mb-text"> <div class="mb-text">
创建时间<span>${this.data.createTime}</span> 创建时间<span>${this.formatDate(this.data.createTime)}</span>
</div> </div>
</div> </div>
<table style="margin-top: 20rpx;" style='border-collapse: collapse;'> <table style="margin-top: 20rpx;" style='border-collapse: collapse;'>
<tr> <tr>
@ -201,9 +208,9 @@
</table> </table>
<div> <div>
` `
let str1 = '' let str1 = ''
this.data.sublist.forEach((cur, key) => { this.data.sublist.forEach((cur, key) => {
str1 += ` str1 += `
<tr> <tr>
<td>${cur.itemCode}</td> <td>${cur.itemCode}</td>
<td>${cur.itemDesc1}</td> <td>${cur.itemDesc1}</td>
@ -214,103 +221,96 @@
<td>${cur.uom}</td> <td>${cur.uom}</td>
</tr> </tr>
` `
}) })
str = str.replace( str = str.replace('tableTrTd', str1)
"tableTrTd", str1) // })
// }) this.newHtmlContent = this.newHtmlContent.replace('mainBody', str) //
this.newHtmlContent = this.newHtmlContent.replace( })
"mainBody", str); // })
}); }
}
})
},
}
</script> </script>
<style> <style>
.box { .box {
font-size: 26rpx; font-size: 26rpx;
/* display: flex; */ /* display: flex; */
padding: 20rpx; padding: 20rpx;
border: 1px solid #dedede; border: 1px solid #dedede;
}
}
.left {
border-top: 1px solid #b1b1b1;
border-left: 1px solid #b1b1b1;
flex: 1;
}
.left-item {
display: flex;
}
.label { .left {
border-bottom: 1px solid #b1b1b1; border-top: 1px solid #b1b1b1;
border-right: 1px solid #b1b1b1; border-left: 1px solid #b1b1b1;
width: 140rpx; flex: 1;
padding: 0px 10rpx; }
height: 60rpx;
line-height: 60rpx;
}
.value { .left-item {
border-bottom: 1px solid #b1b1b1; display: flex;
border-right: 1px solid #b1b1b1; }
padding: 0px 5px;
height: 60rpx;
flex: 1;
width: 0px;
display: flex;
align-items: center;
word-wrap: break-word;
}
.right { .label {
width: 50%; 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 { .right {
width: 100%; width: 50%;
height: 301rpx;
border-bottom: 1px solid #b1b1b1;
border-top: 1px solid #b1b1b1;
border-right: 1px solid #b1b1b1;
}
.image img { border-top: 1px solid #b1b1b1;
width: calc(100% - 4px); }
height: calc(100% - 4px);
margin: 4rpx;
}
.mb-kw { .image {
border-bottom: 1px solid #dedede; width: 100%;
padding-bottom: 20rpx; 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 { .mb-kw {
font-weight: bold; border-bottom: 1px solid #dedede;
font-size: 32rpx; padding-bottom: 20rpx;
} }
.mb-text { .mb-kw text {
margin-top: 10rpx; font-weight: bold;
} font-size: 32rpx;
}
::v-deep .u-th { .mb-text {
font-size: 24rpx !important; margin-top: 10rpx;
} }
::v-deep .u-td { ::v-deep .u-th {
height: auto !important; font-size: 24rpx !important;
font-size: 24rpx !important; }
word-break: break-all;
} ::v-deep .u-td {
height: auto !important;
font-size: 24rpx !important;
word-break: break-all;
}
</style> </style>

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

@ -183,7 +183,11 @@ const getDetail = () => {
detailSource.value = getDataSource(subList.value) detailSource.value = getDataSource(subList.value)
detailSource.value.forEach((r) => { detailSource.value.forEach((r) => {
r.subList.forEach((s) => { 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 { } else {

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

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

Loading…
Cancel
Save