Browse Source

打印采购收货

hella_online_20240829
zhang_li 4 months ago
parent
commit
ce637b31fe
  1. 13
      src/api/request2.js
  2. 57
      src/hybrid/html/purchaseReceiptJob.html
  3. 416
      src/pages/pointPutawayJob/index.vue
  4. 7
      src/pages/purchaseReceipt/job/receiptDetail.vue

13
src/api/request2.js

@ -859,6 +859,19 @@ export function purchaseReceiptJobSubmit(params) {
}
/**
* 采购收货 指引单列表
* @param {*} 任务id
*
*/
export function queryInspectionFreeFlag(params) {
return request({
url: baseApi + "/wms/purchasereceipt-job-main/queryInspectionFreeFlag",
method: "get",
data: params,
});
}
/**
* 采购退货

57
src/hybrid/html/purchaseReceiptJob.html

@ -0,0 +1,57 @@
<!-- 采购收货打印指引单 -->
<!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: 13px;
/* padding: 10px; */
}
.mb-kw {
border-top: 1px solid #dedede;
border-left: 1px solid #dedede;
border-right: 1px solid #dedede;
font-size: 15px;
display: flex;
align-items: center
}
.top th {
font-weight: bold;
font-size: 16px;
padding: 10px;
}
table {
border-collapse: collapse;
border: 1px solid #dedede;
/* 设置表格的边框 */
width: 100%
}
th{
text-align:left;
padding: 10px;
}
td{
padding: 10px;
}
</style>
</head>
<body>
mainBody
</body>
</html>

416
src/pages/pointPutawayJob/index.vue

@ -1,53 +1,66 @@
<template>
<!-- 采购上架对应的采购收货打印页面-->
<view class="content" style="padding:30rpx 20rpx 100rpx;min-height: calc(100vh - 120rpx);">
<view class="content" style="padding:0rpx 20rpx 100rpx;min-height: calc(100vh - 120rpx);">
<view class="tabs-box">
<view @click="tabIndex = 1" :class="tabIndex == 1?'active1' :''" style="padding: 10rpx 0px;">检验指引单</view>
<view @click="tabIndex = 2" :class="tabIndex == 2?'active1' :''" style="padding: 10rpx 0px;">上架指引单</view>
</view>
<view class="" style="padding-top: 100rpx;">
<view class="box" style="page-break-before:always;" v-if="tabIndex == 1">
<view class="">
<table border='1'>
<thead>
<tr class='top1'>
<th>发货单号:</th>
<th colspan='2'>{{data1.asnNumber}}</th>
</tr>
<tr>
<th>物料代码</th>
<th>供应商批次</th>
<th>检验数量</th>
</tr>
</thead>
<tbody>
<tr v-for="(item,index) in showTableInspectDTOList" :key='index'>
<td>{{item.itemCode}}</td>
<td>{{item.supplierBatch}}</td>
<td>{{item.sampleQty}}</td>
</tr>
</tbody>
</table>
</view>
</view>
</view>
<com-empty-view v-if="data.length==0"></com-empty-view>
<!-- 只用于展示页面 -->
<view class="box" style="margin-bottom: 20rpx;" v-for='(item,index) in data.sublist' :key='index'>
<view class="top">
<view class="mb-kw">
目标库位<view>{{item.toLocationCode}}</view>
</view>
<view class="mb-bo">
<view class="mb-left">
<view class="mb-text">
物料号<view>{{item.itemCode}}</view>
<view class="" v-if="tabIndex == 2">
<view class="box" style="margin-bottom: 20rpx;" v-for='(item,index) in showTableSubList' :key='index'>
<view class="top">
<view class="mb-kw">
目标库位<view>{{item.toLocationCode}}</view>
</view>
<view class="mb-text">
托包装号<view>{{item.packingNumber}}</view>
<view class="mb-bo">
<view class="mb-left">
<view class="mb-text">
物料号<view>{{item.itemCode}}</view>
</view>
<view class="mb-text">
托包装号<view>{{item.packingNumber}}</view>
</view>
</view>
<view class="mb-right">
<view class="mb-text">
数量<view>{{item.qty}}{{item.uom}}</view>
</view>
</view>
</view>
</view>
<view class="mb-right">
<view class="mb-text">
数量<view>{{item.qty}}{{item.uom}}</view>
</view>
</view>
</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 item.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.qty}}</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>
style='background:rgb(60, 156, 255) !important ;color: white;margin-top: 80rpx;'> 打印<text v-if="tabIndex == 1">检验指引单</text><text v-if="tabIndex == 2">上架指引单</text></button>
</view>
</view>
@ -55,13 +68,16 @@
<script>
import {
getJimuPutawayJobDetail
getJimuPutawayJobDetail,
queryInspectionFreeFlag
} from '@/api/request2.js';
import {
dateFormat
} from '@/common/basic.js';
//
const htmlFileUrl = '/hybrid/html/pointPutawayJob.html';
//
const htmlFileUrl1 = '/hybrid/html/purchaseReceiptJob.html';
import {
pathToBase64
} from "../../api/img-to-base64.js" //js
@ -74,11 +90,22 @@
data() {
return {
data: {
sublist:[]
sublist: []
},
newHtmlContent: '', //html
newHtmlContent1: '', //html
isLoadFinish: false,
ids:''
ids: '',
tabIndex: 1,
data1: '',
currentPage: 1,
pageSize: 3,
showTableSubList: [],
showTableInspectDTOList:[],
currentPage1: 1,
pageSize1: 20,
number:''
}
},
@ -86,7 +113,11 @@
// #ifdef APP
//
printImage() {
testModule.doHTMLPrint(this.newHtmlContent)
if (this.tabIndex == 1) {
testModule.doHTMLPrint(this.newHtmlContent1)
} else {
testModule.doHTMLPrint(this.newHtmlContent)
}
},
// html
readFile(path, callback) {
@ -107,6 +138,117 @@
// #endif
formatDate(val) {
return dateFormat(val)
},
// html
getPointPutawayJobHtml() {
this.$nextTick(async () => {
let str = ''
this.readFile(htmlFileUrl, (htmlContent) => {
this.newHtmlContent = htmlContent
this.data.sublist.forEach(item => {
str += `<div class="box" style="page-break-before:always;" ><br />
<div class="top">
<div class="mb-kw">
目标库位<div>${item.toLocationCode}</div>
</div>
<div class="mb-bo">
<div class="mb-left">
<div class="mb-text">
物料号<div>${item.itemCode}</div>
</div>
<div class="mb-text">
托包装号<div>${item.packingNumber}</div>
</div>
</div>
<div class="mb-right">
<div class="mb-text">
数量<div>${item.qty}${item.uom}</div>
</div>
</div>
</div>
</div>
`
})
this.newHtmlContent = this.newHtmlContent.replace(
"mainBody", str); //
});
})
},
// html
getPurchaseReceiptJobHtml() {
this.$nextTick(async () => {
let str2 = ''
this.readFile(htmlFileUrl1, (htmlContent) => {
this.newHtmlContent1 = htmlContent
str2 = `<div class="box" style="page-break-before:always;" ><br />
<div class="">
<table border='1'>
<thead>
<tr class='top'>
<th>发货单号:</th>
<th colspan='2'>${this.data1.asnNumber}</th>
</tr>
<tr>
<th>物料代码</th>
<th>供应商批次</th>
<th>检验数量</th>
</tr>
</thead>
<tbody>
strBody
</tbody>
</table>
</div>
</div>
`
let str1 = ''
this.data1.inspectDTOList.forEach(item => {
str1 += `
<tr>
<td>${item.itemCode}</td>
<td>${item.supplierBatch}</td>
<td>${item.sampleQty}</td>
</tr>
`
})
str2 = str2.replace("strBody", str1)
console.log(335, str1)
this.newHtmlContent1 = this.newHtmlContent1.replace(
"mainBody", str2); //
});
})
},
getTableSubList() {
if (this.data.sublist.length > this.pageSize) {
const array = this.data.sublist.slice(
(this.currentPage - 1) * this.pageSize,
this.currentPage * this.pageSize
)
if(array.length>0){
this.showTableSubList = [...this.showTableSubList, ...array]
this.currentPage += 1
}
} else {
this.showTableSubList = this.data.sublist
}
// console.log(233,this.showTableSubList)
},
getTableInspectDTOList() {
if (this.data1.inspectDTOList.length > this.pageSize1) {
const array = this.data1.inspectDTOList.slice(
(this.currentPage1 - 1) * this.pageSize1,
this.currentPage1 * this.pageSize1
)
if(array.length>0){
this.showTableInspectDTOList = [...this.showTableInspectDTOList, ...array]
this.currentPage1 += 1
}
} else {
this.showTableInspectDTOList = this.data1.inspectDTOList
}
console.log(233,this.showTableInspectDTOList)
}
},
watch: {
@ -114,7 +256,6 @@
handler(newVal, oldVal) {
if (newVal == true) {
// html
}
},
immediate: true
@ -126,94 +267,44 @@
if (option.data) {
this.data = JSON.parse(decodeURIComponent(option.data));
}
if (option.number) {
this.number = option.number;
}
},
async onShow() {
await getJimuPutawayJobDetail({
masterIds:this.data.ids
}).then(res=>{
masterIds: this.data.ids
}).then(res => {
this.data.sublist = res.data
this.getTableSubList()
})
//
// this.data = [{
// toLocationCode: 'C13-12-11',
// jobNumber: '555555',
// creator: '',
// createTime: '2019-12-12 05:00:00',
// itemNumber: '66',
// itemDes: 'hahah',
// 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.sublist.forEach(item => {
str += `<div class="box" style="page-break-before:always;" ><br />
<div class="top">
<div class="mb-kw">
目标库位<div>${item.toLocationCode}</div>
</div>
<div class="mb-bo">
<div class="mb-left">
<div class="mb-text">
物料号<div>${item.itemCode}</div>
</div>
<div class="mb-text">
托包装号<div>${item.packingNumber}</div>
</div>
</div>
<div class="mb-right">
<div class="mb-text">
数量<div>${item.qty}${item.uom}</div>
</div>
</div>
</div>
</div>
`
})
this.newHtmlContent = this.newHtmlContent.replace(
"mainBody", str); //
});
//
await queryInspectionFreeFlag({
number: this.number
}).then(async res1 => {
this.data1 = res1.data
this.getTableInspectDTOList()
})
this.getPointPutawayJobHtml()
this.getPurchaseReceiptJobHtml()
},
onReachBottom() {
if(this.tabIndex == 1){
if(this.showTableInspectDTOList.length!=this.data1.inspectDTOList.length){
this.getTableInspectDTOList()
}
}else{
if(this.showTableSubList.length!=this.data.sublist.length){
this.getTableSubList()
}
}
}
}
</script>
<style>
<style lang="scss">
.box {
font-size: 26rpx;
/* display: flex; */
@ -285,53 +376,94 @@
font-size: 46rpx;
text-align: center;
}
.mb-bo{
display:flex;
.mb-bo {
display: flex;
}
.mb-bo .mb-left{
flex:1
.mb-bo .mb-left {
flex: 1
}
.mb-bo .mb-left .mb-text{
.mb-bo .mb-left .mb-text {
padding: 20rpx;
}
.mb-bo .mb-left .mb-text:nth-child(1){
border-bottom: 1px solid #dedede;
.mb-bo .mb-left .mb-text:nth-child(1) {
border-bottom: 1px solid #dedede;
}
.mb-bo .mb-left .mb-text view{
.mb-bo .mb-left .mb-text view {
font-weight: bold;
font-size: 32rpx;
text-align: center;
}
.mb-bo .mb-right{
.mb-bo .mb-right {
padding: 20rpx;
width: 260rpx;
border-left: 1px solid #dedede;
display: flex;
align-items: center;
}
.mb-bo .mb-right .mb-text{
.mb-bo .mb-right .mb-text {
width: 100%;
}
.mb-bo .mb-right .mb-text view{
.mb-bo .mb-right .mb-text view {
font-weight: bold;
font-size: 40rpx;
text-align: center;
width: 100%;
}
/* .mb-text {
margin-top: 10rpx;
.top1 th {
font-weight: bold;
font-size: 16px;
padding: 10px;
}
table {
border-collapse: collapse;
border: 1px solid #dedede;
/* 设置表格的边框 */
width: 100%
}
::v-deep .u-th {
font-size: 24rpx !important;
th {
text-align: left;
padding: 10px;
}
::v-deep .u-td {
height: auto !important;
font-size: 24rpx !important;
word-break: break-all;
td {
padding: 10px;
} */
}
.tabs-box {
display: flex;
align-items: center;
margin-bottom: 20rpx;
border-bottom: 2rpx solid rgb(188, 188, 188);
position: fixed;
background: white;
width: 100%;
left: 0px;
view {
flex: 1;
text-align: center;
line-height: 60rpx;
font-size: 30rpx;
}
.active1 {
color: rgb(60, 156, 255) !important;
font-weight: bold;
border-bottom: 4rpx solid rgb(60, 156, 255);
}
}
</style>

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

@ -518,6 +518,7 @@
if (res.success) {
this.managementList = res.list;
var params = this.setParams();
let that =this
purchaseReceiptJobSubmit(params).then(res => {
if (res.data) {
let isCheckPrint = getSwitchInfoByCode(this.switchCode)
@ -581,10 +582,8 @@
}
console.log(dataParams)
uni.redirectTo({
url: '/pages/pointPutawayJob/index?data=' +
encodeURIComponent(JSON
.stringify(
dataParams))
url: '/pages/pointPutawayJob/index?number='+that.jobContent.number+'&data=' +
encodeURIComponent(JSON.stringify(dataParams))
})
}
})

Loading…
Cancel
Save