Browse Source

6-12 16:30采购收货打印

hella_vue3
zhang_li 3 months ago
parent
commit
4c26aa814c
  1. 11
      .env.development
  2. 77
      src/hybrid/html/pointPutawayJob.html
  3. 37
      src/pages.json
  4. 316
      src/pages/pointPutawayJob/index.vue
  5. 51
      src/pages/purchaseReceipt/job/receiptDetail.vue

11
.env.development

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

77
src/hybrid/html/pointPutawayJob.html

@ -0,0 +1,77 @@
<!-- 采购收货指引单 -->
<!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>
.box {
font-size: 14px;
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: 60px;
padding: 0px 5px;
height: 67px;
line-height: 67px;
}
.value {
border-bottom: 1px solid #b1b1b1;
border-right: 1px solid #b1b1b1;
padding: 0px 5px;
height: 67px;
flex: 1;
width: 0px;
display: flex;
align-items: center;
word-wrap: break-word;
}
.right {
width: 200px;
}
.image {
width: 100%;
height: 202px;
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: 2px;
}
</style>
</head>
<body>
mainBody
</body>
</html>

37
src/pages.json

@ -223,15 +223,15 @@
"buttons": [
//
{
"float": "right",
"fontSize": "58rpx", //
"text": "\ue696",
"fontSrc": "/static/ali_icon/iconfont.ttf"
},
{
"float": "right",
"fontSize": "52rpx", //
"text": "\ue6e2",
@ -653,15 +653,15 @@
}
},
{
"path": "pages/repleinsh/record/directRepleinshRecord",
"style": {
"navigationBarTitleText": "直接补料",
"enablePullDownRefresh": true,
"titleNView": {
"autoBackButton": "true"
}
}
},
"path": "pages/repleinsh/record/directRepleinshRecord",
"style": {
"navigationBarTitleText": "直接补料",
"enablePullDownRefresh": true,
"titleNView": {
"autoBackButton": "true"
}
}
},
{
"path": "pages/productionReturn/request/returnRequestCreate",
"style": {
@ -2047,25 +2047,32 @@
"navigationBarTitleText": "翻包任务详情",
"enablePullDownRefresh": false
}
},{
}, {
"path": "pages/point/index",
"style": {
"navigationBarTitleText": "打印",
"enablePullDownRefresh": false
}
},{
}, {
"path": "pages/pointProductReceipt/index",
"style": {
"navigationBarTitleText": "打印",
"enablePullDownRefresh": false
}
},{
}, {
"path": "pages/pointProductReceipt/webview",
"style": {
"navigationBarTitleText": "打印",
"enablePullDownRefresh": false
}
},
{
"path": "pages/pointPutawayJob/index",
"style": {
"navigationBarTitleText": "打印",
"enablePullDownRefresh": false
}
},
{
"path": "pages/check/checkFgLabel",
"style": {

316
src/pages/pointPutawayJob/index.vue

@ -0,0 +1,316 @@
<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>
</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
}
},
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 />
<div class="top">
<div class="mb-kw">
目标库位<span>${this.data.toLocationCode}</span>
</div>
<div class="mb-text">
任务编号<span>${this.data.number}</span>
</div>
<div class="mb-text">
创建人<span>${this.data.creator}</span>
</div>
<div class="mb-text">
创建时间<span>${this.data.createTime}</span>
</div>
</div>
<table style="margin-top: 20rpx;" style='border-collapse: collapse;'>
<tr>
<th>物品代码</th>
<th>物品描述</th>
<th>批次</th>
<th>包装号</th>
<th>包装规格</th>
<th>数量</th>
<th>计量单位</th>
<tr>
tableTrTd
</table>
<div>
`
let str1 = ''
this.data.sublist.forEach((cur, key) => {
str1 += `
<tr>
<td>${cur.itemCode}</td>
<td>${cur.itemDesc1}</td>
<td>${cur.batch}</td>
<td>${cur.packingNumber}</td>
<td>${cur.packUnit}</td>
<td>${cur.packQty}</td>
<td>${cur.uom}</td>
</tr>
`
})
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;
}
.label {
border-bottom: 1px solid #b1b1b1;
border-right: 1px solid #b1b1b1;
width: 140rpx;
padding: 0px 10rpx;
height: 60rpx;
line-height: 60rpx;
}
.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;
}
.right {
width: 50%;
border-top: 1px solid #b1b1b1;
}
.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 {
border-bottom: 1px solid #dedede;
padding-bottom: 20rpx;
}
.mb-kw text {
font-weight: bold;
font-size: 32rpx;
}
.mb-text {
margin-top: 10rpx;
}
::v-deep .u-th {
font-size: 24rpx !important;
}
::v-deep .u-td {
height: auto !important;
font-size: 24rpx !important;
word-break: break-all;
}
</style>

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

@ -53,7 +53,7 @@
<script setup lang="ts">
import { ref, getCurrentInstance, nextTick } from 'vue'
import { onLoad, onShow, onNavigationBarButtonTap, onReady, onBackPress, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app'
import { purchaseReceiptJobSubmit, getPurchaseReceiptJobDetail, takePurchaseReceiptJob, cancleTakePurchaseReceiptJob, productDismantleJobClose } from '@/api/request2.js'
import { purchaseReceiptJobSubmit, getPurchaseReceiptJobDetail, takePurchaseReceiptJob, cancleTakePurchaseReceiptJob, productDismantleJobClose, getPutawayJobList } from '@/api/request2.js'
import { goHome, getCurrDateTime, getPackingNumberAndBatch, compareAsc, navigateBack } from '@/common/basic.js'
@ -378,7 +378,52 @@ const submitJob = () => {
.then((res) => {
uni.hideLoading()
if (res.data) {
showCommitSuccessMessage(`提交成功<br>生成采购收货记录<br>${res.data}`)
// showCommitSuccessMessage(`<br><br>${res.data}`)
uni.showLoading({
title: '提交成功,将跳转到打印页面',
mask: true
})
//
let timerCount = 0
const timer1 = setInterval(async () => {
if (timerCount == 10) {
clearInterval(timer1)
uni.showLoading({
title: '跳转打印页面失败',
mask: true
})
return
}
await getPutawayJobList({
filters: [
{
column: 'purchaseReceiptRecordNumber',
action: 'in',
value: res.data
}
],
pageNo: 1,
pageSize: 1000
}).then((res) => {
timerCount += 1
console.log(11111)
if (res.data && res.data.list && res.data.list.length) {
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(',')
}
console.log(dataParams)
uni.navigateTo({
url: `/pages/pointPutawayJob/index?data=${encodeURIComponent(JSON.stringify(dataParams))}`
})
}
})
}, 1000)
} else {
showErrorMessage(`提交失败[${res.msg}]`)
}
@ -509,7 +554,7 @@ const scanPopupLoseFocus = () => {
const showCommitSuccessMessage = (hint) => {
comMessageRef.value.showSuccessMessage(hint, (res) => {
navigateBack(1)
// navigateBack(1)
})
}
</script>

Loading…
Cancel
Save