Browse Source

FWHL-17713环境PDA端按计划完工&无计划完工打印模板调整

hella_online_20250123
wangyufei 1 week ago
parent
commit
7d9819fd3d
  1. 7
      .env.development
  2. 132
      src/hybrid/html/pointReceipt.html
  3. 6
      src/pages.json
  4. 14
      src/pages/fg/receiptByPlan.vue
  5. 10
      src/pages/fg/receiptNoPlan.vue
  6. 331
      src/pages/pointReceipt/index.vue

7
.env.development

@ -1,10 +1,11 @@
VITE_BASE_URL=http://172.22.32.9:81/api/admin-api
VITE_BASE_URL_IMAGE=http://172.22.32.9:81/admin-api
VITE_BASE_URL=https://wmscdtest.faway-hella.com/api/admin-api
VITE_BASE_URL_IMAGE=https://wmscdtest.faway-hella.com/api/admin-api
# 租户配置
VITE_TENANT='[{"text":"成都1397","value":2},{"text":"长春2379","value":3}]'
# 是否是测试环境
# 是否是测试环境
VITE_isDevelopment=true
# 积木报表请求路径

132
src/hybrid/html/pointReceipt.html

@ -0,0 +1,132 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title></title>
<script src="../../api/img-to-base64.js"></script>
<script type="text/javascript">
document.addEventListener('plusready', function() {
//console.log("所有plus api都应该在此事件发生后调用,否则会出现plus is undefined。")
});
</script>
<style>
@media print {
@page {
size: A5 landscape;
/* 设置打印页面尺寸为A5 */
margin-bottom: 0;
padding: 0cm;
}
table {
page-break-after: always;
border-collapse: collapse;
border-top: none;
}
thead {
display: none;
border: none;
}
thead tr {
border: none;
}
thead td {
border: none;
}
}
.jm-title {
/* border: 1.5px solid #000; */
font: 24px Helvetica;
color: #0a0a0a;
text-align: center;
vertical-align: middle;
word-break: break-all;
}
/* 物品代码 物品名称 包装名称 */
.jm-print-30 {
font-weight: bold;
white-space: nowrap;
overflow: hidden;
}
.jm-content {
/* border: 1.5px solid #000; */
color: #0a0a0a;
text-align: center;
vertical-align: middle;
word-break: break-all;
}
.font29 {
font: 29px Helvetica;
}
.font-bold-48 {
font: bold 48px Helvetica;
}
.font-bold-56 {
font: bold 56px Helvetica;
}
.jm-print-17 {
/* border */
: 1.5px solid #000;
}
.left-width {
/* 111 */
width: 111px;
/* border:1px solid red; */
}
.width-148 {
width: 138px;
/* border:1px solid red; */
}
thead {
display: none;
border: none;
}
thead tr {
border: none;
}
thead td {
border: none;
}
table {
margin-top: 20px;
border-top: none;
}
.hide-tr tr {
border: none;
}
.hide-tr td {
border: none;
}
.top-tr {
border-top-width: 1.5px !important;
border-top-color: #000 !important;
}
</style>
</head>
<body>
mainBody
</body>
</html>

6
src/pages.json

@ -2596,6 +2596,12 @@
"navigationBarTitleText": "打印",
"enablePullDownRefresh": false
}
}, {
"path": "pages/pointReceipt/index",
"style": {
"navigationBarTitleText": "打印",
"enablePullDownRefresh": false
}
}, {
"path": "pages/pointProductReceipt/index",
"style": {

14
src/pages/fg/receiptByPlan.vue

@ -165,7 +165,12 @@
},
onShow() {},
onLoad() {
onLoad() {
// let pointData = [{"itemCode":"015.584-017","itemName":"SagitarPA","packName":"","packageCode":"PN20250117-0000000003","batch":"20250117","parentNumber":null,"itemType":"","asnNumber":null,"supplierCode":null,"qty":1,"printTimes":"2025-01-17 11:21:14","productionLineCode":"PRASL003","barcodeString":"HMQ;V1.0;DPRASL003;F;R;B20250117;PPN20250117-0000000003;I015.584-017;Q1.000000;UPC;C;","barcodeBase64":"","requestNumber":"REC1220250117-0003"},{"itemCode":"015.584-017","itemName":"SagitarPA","packName":"","packageCode":"PN20250117-0000000003","batch":"20250117","parentNumber":null,"itemType":"","asnNumber":null,"supplierCode":null,"qty":1,"printTimes":"2025-01-17 11:21:14","productionLineCode":"PRASL003","barcodeString":"HMQ;V1.0;DPRASL003;F;R;B20250117;PPN20250117-0000000003;I015.584-017;Q1.000000;UPC;C;","barcodeBase64":"","requestNumber":"REC1220250117-0003"}]
// uni.navigateTo({
// url: `/pages/pointReceipt/index?points=${JSON.stringify(pointData)}`
// });
this.options = getRemoveOption()
this.openFg();
},
@ -498,8 +503,11 @@
// #ifdef APP
if (pointData.length > 0) {
uni.navigateTo({
url: `/pages/point/index?points=${JSON.stringify(pointData)}`
// uni.navigateTo({
// url: `/pages/point/index?points=${JSON.stringify(pointData)}`
// });
uni.navigateTo({
url: `/pages/pointReceipt/index?points=${JSON.stringify(pointData)}`
});
}
// #endif

10
src/pages/fg/receiptNoPlan.vue

@ -467,12 +467,18 @@
// #ifdef APP
if (pointData.length > 0) {
if ( this.scanedQty + this.showList.length == this.dataContent.planQty) {
// uni.redirectTo({
// url: `/pages/point/index?points=${JSON.stringify(pointData)}`
// });
uni.redirectTo({
url: `/pages/point/index?points=${JSON.stringify(pointData)}`
url: `/pages/pointReceipt/index?points=${JSON.stringify(pointData)}`
});
} else {
// uni.navigateTo({
// url: `/pages/point/index?points=${JSON.stringify(pointData)}`
// });
uni.navigateTo({
url: `/pages/point/index?points=${JSON.stringify(pointData)}`
url: `/pages/pointReceipt/index?points=${JSON.stringify(pointData)}`
});
}
}

331
src/pages/pointReceipt/index.vue

@ -0,0 +1,331 @@
<template>
<view class="content" style="padding:30rpx 20rpx 100rpx;min-height: calc(100vh - 120rpx);">
<!-- 只用于展示页面 -->
<view class="box" v-for="(item,index) in data" :key='index' style="margin-bottom: 20rpx;">
<view class="left">
<view class="left-item">
<view class="label bold-label">物品代码</view>
<view class="value bold-font font-20" id="name1">{{item.itemCode}}</view>
</view>
<view class="left-item">
<view class="label">物品名称</view>
<view class="value" id="name2">{{item.itemName}}</view>
</view>
<view class="left-item">
<view class="label">包装名称</view>
<view class="value">{{item.packName}}</view>
</view>
<view class="left-item">
<view class="label">包装号</view>
<view class="value">{{item.packageCode}}</view>
</view>
<view class="left-item" v-if="item.productionLineCode&&item.productionLineCode.length>0">
<view class="label">生产线</view>
<view class="value">{{item.productionLineCode}}</view>
</view>
<view class="left-item" v-if="!(item.productionLineCode&&item.productionLineCode.length>0)">
<view class="label bold-label">父包装号</view>
<view class="value bold-font font-20">{{item.parentNumber}}</view>
</view>
<view class="left-item" v-if="!(item.productionLineCode&&item.productionLineCode.length>0)">
<view class="label">ASN</view>
<view class="value">{{item.asnNumber}}</view>
</view>
<view class="left-item">
<view class="label bold-label">数量</view>
<view class="value bold-font font-20">{{item.qty}}</view>
</view>
<view class="left-item" v-if="item.fromLocationCode">
<view class="label ">来源库位</view>
<view class="value ">{{item.fromLocationCode}}</view>
</view>
</view>
<view class="right">
<view class="image">
<l-qrcode ref="qrcodeRef" useCanvasToTempFilePath @success="success($event,item)" :value="item.barcodeString"
size="300rpx"></l-qrcode>
</view>
<view class="left-item">
<view class="label">批次</view>
<view class="value">{{item.batch}}</view>
</view>
<view class="left-item">
<view class="label">物料类型</view>
<view class="value">{{item.itemType}}</view>
</view>
<view class="left-item" v-if="!(item.productionLineCode&&item.productionLineCode.length>0)">
<view class="label">供应商</view>
<view class="value">{{item.supplierCode}}</view>
</view>
<view class="left-item">
<view class="label">打印时间</view>
<view class="value">{{item.printTimes}}</view>
</view>
<view class="left-item" v-if="item.fromLocationCode">
<view class="label bold-label"></view>
<view class="value bold-font font-20"></view>
</view>
</view>
</view>
<view class="" style="position: fixed;width: 100%;bottom: 0rpx;left: 0px;" v-show="isLoadFinish">
<button @click="printImage"
style='background:rgb(60, 156, 255) !important ;color: white;margin-top: 80rpx;'> 打印</button>
</view>
</view>
</template>
<script>
//
const htmlFileUrl = '/hybrid/html/pointReceipt.html';
import {
pathToBase64
} from "../../api/img-to-base64.js" //js
// #ifdef APP
var testModule = uni.requireNativePlugin("TestModule")
// #endif
export default {
name: 'point',
data() {
return {
timer: null,
originData: [],
data: [],
newHtmlContent: '', //html
isLoadFinish: false,
picIndex: 0,
picUrl: []
}
},
methods: {
success(img,item) {
item.barcodeBase641 = img
uni.hideLoading()
this.isLoadFinish = true
// #ifdef APP
plus.io.resolveLocalFileSystemURL(item.barcodeBase641, (entry) => {
// entrytest.html
entry.file((file) => {
let fileReader = new plus.io.FileReader();
fileReader.onloadend = (evt) => {
console.log("文件路径" + evt.target.result)
item.barcodeBase64 = evt.target.result
}
fileReader.readAsDataURL(file);
});
}, (e) => {
console.log("失败" + e)
});
// #endif
},
setHtmlData() {
let str = ''
this.readFile(htmlFileUrl, (htmlContent) => {
this.newHtmlContent = htmlContent
this.data.forEach(item => {
str += `
<table border="1.5" cellpadding="0" cellspacing="0"
style="border-collapse: collapse; table-layout: fixed; width: 1015px;">
<thead>
<tr>
<td>哈哈哈哈哈</td>
</tr>
</thead>
<tbody>
<tr class="hide-tr">
<td class="jm-print-30 jm-title left-width" style="height:0">
</td>
<td class="jm-content font-bold-48" style="height: 0; width: 485px; ">
</td>
<td class="jm-title width-148" style="height: 0; width:148px;">
</td>
<td class="jm-title" style="height: 0; width: 238px; ">
</td>
</tr>
<tr class="top-tr">
<td class="jm-print-30 jm-title left-width" style="height: 130px; ">物品代码</td>
<td class="jm-content font-bold-48" style="height: 130px; width: 485px; line-height: 50px;">
${item.itemCode}</td>
<td class="jm-print-17" rowspan="3" colspan="2" style="height: 386px; width: 391px; padding: 2px;">
<img width="391px" height="386px" alt="Scan me!"
src="${item.barcodeBase64}"
style="display: block; margin: 0 auto;">
</td>
</tr>
<tr>
<td class="jm-print-30 jm-title left-width" style="height: 130px; ">物品名称</td>
<td class="jm-content font-bold-56" style="height: 130px; width: 485px; line-height: 58px;">
${item.itemName}</td>
</tr>
<tr>
<td class="jm-print-30 jm-title left-width" style="height: 130px;">包装名称</td>
<td class="jm-content font-bold-48" style="height: 130px; width: 485px; line-height: 50px;">
${item.packName}</td>
</tr>
<tr>
<td class="jm-title left-width" style="height: 90px; line-height: 26px;">
包装号</td>
<td class="jm-content font29" style="height: 90px; width: 485px; line-height: 31px;">
${item.packageCode}</td>
<td class="jm-title width-148" style="height: 90px; line-height: 26px;">
批次</td>
<td class="jm-content font29" style="height: 90px; width: 238px; line-height: 31px;">
${item.batch}</td>
</tr>
<tr>
<td class="jm-title left-width" style="height: 85px; line-height: 50px;">
生产线</td>
<td class="jm-content font29" style="height: 85px; width: 485px; line-height: 50px;">
${item.productionLineCode}</td>
<td class="jm-title width-148" style="height: 85px; line-height: 50px;">
物品类型</td>
<td class="jm-content font29" style="height: 85px; width: 238px; line-height: 50px;">
${item.itemType}</td>
</tr>
<tr>
<td class="jm-title jm-print-30 left-width" style="height: 85px; line-height: 35px;">
数量</td>
<td class="jm-content font-bold-56" style="height: 85px; width: 485px; line-height: 35px;">
${item.qty}</td>
<td class="jm-title width-148" style="height: 85px; line-height: 35px;width:148px !important;">
打印时间</td>
<td class="jm-title" style="height: 85px; width: 238px; line-height: 35px;">
${item.printTimes}</td>
</tr>
</tbody>
</table>
`
})
console.log('str',str)
this.newHtmlContent = this.newHtmlContent.replace(
"mainBody", str); //
});
},
printImage() {
uni.showLoading({
title: "加载中",
mask: true
})
this.setHtmlData()
let clearInt = setInterval(() => {
if (!this.newHtmlContent.mainBody) {
// #ifdef APP
testModule.doHTMLPrint(this.newHtmlContent)
// #endif
clearInterval(clearInt)
uni.hideLoading()
}
}, 1000)
},
// #ifdef APP
// 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
},
onLoad(option) {
uni.showLoading({
title: '加载中...',
mask: true
});
if (option.points) {
this.originData = JSON.parse(option.points);
}
// this.originData =[{"itemCode":"015.584-017","itemName":"111SagitarPA","packName":"","packageCode":"PN20250117-0000000003","batch":"20250117","parentNumber":null,"itemType":"","asnNumber":null,"supplierCode":null,"qty":1,"printTimes":"2025-01-17 11:21:14","productionLineCode":"PRASL003","barcodeString":"HMQ;V1.0;DPRASL003;F;R;B20250117;PPN20250117-0000000003;I015.584-017;Q1.000000;UPC;C;","barcodeBase64":"","requestNumber":"REC1220250117-0003"},{"itemCode":"015.584-017","itemName":"22SagitarPA","packName":"","packageCode":"PN20250117-0000000003","batch":"20250117","parentNumber":null,"itemType":"","asnNumber":null,"supplierCode":null,"qty":1,"printTimes":"2025-01-17 11:21:14","productionLineCode":"PRASL003","barcodeString":"HMQ;V1.0;DPRASL003;F;R;B20250117;PPN20250117-0000000003;I015.584-017;Q1.000000;UPC;C;","barcodeBase64":"","requestNumber":"REC1220250117-0003"}]
this.data = this.originData
},
}
</script>
<style>
.box {
font-size: 24rpx;
display: flex;
}
.left {
border-top: 1px solid #b1b1b1;
border-left: 1px solid #b1b1b1;
flex: 1;
}
.left-item {
display: flex;
}
.label {
border-bottom: 1px solid #b1b1b1;
border-right: 1px solid #b1b1b1;
width: 140rpx;
padding: 0px 10rpx;
height: 100rpx;
line-height: 100rpx;
}
.bold-font {
font-weight: bold;
}
.font-30 {
font-size: 30px;
}
.font-20 {
font-size: 20px;
}
.bold-label {
font-weight: bold;
/* font-size: 15px; */
}
.value {
border-bottom: 1px solid #b1b1b1;
border-right: 1px solid #b1b1b1;
padding: 0px 5px;
height: 100rpx;
flex: 1;
width: 0px;
display: flex;
align-items: center;
word-break: break-all;
}
.right {
width: 300rpx;
}
.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;
}
</style>
Loading…
Cancel
Save