Browse Source

打印采购收货 2024/8/3

pull/1/head
test 4 months ago
parent
commit
5b5637ce20
  1. 13
      src/api/request2.js
  2. 401
      src/pages/pointPutawayJob/index.vue
  3. 3
      src/pages/purchaseReceipt/job/receiptDetail.vue

13
src/api/request2.js

@ -568,7 +568,18 @@ export function getPurchaseReceiptJobDetail(id) {
export function purchaseReceiptJobSubmit(params) {
return http.put("/wms/purchasereceipt-job-main/execute" ,params)
}
/**
* 采购收货 指引单列表
* @param {*} 任务id
*
*/
export function queryInspectionFreeFlag(params) {
return request({
url: baseApi + "/wms/purchasereceipt-job-main/queryInspectionFreeFlag",
method: "get",
data: params,
});
}
/**
* 采购退货
* status 任务状态

401
src/pages/pointPutawayJob/index.vue

@ -1,9 +1,40 @@
<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="" 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>
@ -24,40 +55,34 @@
</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 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.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>
</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;'> 打印<text v-if="tabIndex == 1">检验指引单</text><text v-if="tabIndex == 2">上架指引单</text></button>
</view>
</view>
</template>
<script>
import { getJimuPutawayJobDetail } from '@/api/request2.js'
import { dateFormat } from '@/common/basic.js'
import {
getJimuPutawayJobDetail,
queryInspectionFreeFlag
} from '@/api/request2.js';
import {
dateFormat
} from '@/common/basic.js';
//
const htmlFileUrl = '/hybrid/html/pointPutawayJob.html';
//
const htmlFileUrl = '/hybrid/html/pointPutawayJob.html'
const htmlFileUrl1 = '/hybrid/html/purchaseReceiptJob.html';
import {
pathToBase64
} from "../../api/img-to-base64.js" //js
// #ifdef APP
const testModule = uni.requireNativePlugin('TestModule')
var testModule = uni.requireNativePlugin("TestModule")
// #endif
export default {
@ -68,8 +93,19 @@ export default {
sublist: []
},
newHtmlContent: '', //html
newHtmlContent1: '', //html
isLoadFinish: false,
ids: ''
ids: '',
tabIndex: 1,
data1: '',
currentPage: 1,
pageSize: 3,
showTableSubList: [],
showTableInspectDTOList:[],
currentPage1: 1,
pageSize1: 20,
number:''
}
},
@ -77,115 +113,39 @@ export default {
// #ifdef APP
//
printImage() {
if (this.tabIndex == 1) {
testModule.doHTMLPrint(this.newHtmlContent1)
} else {
testModule.doHTMLPrint(this.newHtmlContent)
}
},
// html
readFile(path, callback) {
plus.io.resolveLocalFileSystemURL(
path,
function (entry) {
entry.file(
function (file) {
const reader = new plus.io.FileReader()
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}`)
}
)
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({
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: ''
// }]
// }]
// html
getPointPutawayJobHtml() {
this.$nextTick(async () => {
let str = ''
this.readFile(htmlFileUrl, (htmlContent) => {
this.newHtmlContent = htmlContent
this.data.sublist.forEach((item) => {
this.data.sublist.forEach(item => {
str += `<div class="box" style="page-break-before:always;" ><br />
<div class="top">
<div class="mb-kw">
@ -209,19 +169,148 @@ export default {
</div>
`
})
this.newHtmlContent = this.newHtmlContent.replace('mainBody', str) //
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: {
isLoadFinish: {
handler(newVal, oldVal) {
if (newVal == true) {
// html
}
},
immediate: true
}
},
onLoad(option) {
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 => {
this.data.sublist = res.data
this.getTableSubList()
})
//
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; */
/* padding: 20rpx; */
border: 1px solid #dedede;
}
.left {
@ -279,6 +368,7 @@ export default {
border-bottom: 1px solid #dedede;
padding: 20rpx;
font-size: 30rpx;
}
.mb-kw view {
@ -286,23 +376,29 @@ export default {
font-size: 46rpx;
text-align: center;
}
.mb-bo {
display: flex;
}
.mb-bo .mb-left {
flex: 1;
flex: 1
}
.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 view {
font-weight: bold;
font-size: 32rpx;
text-align: center;
}
.mb-bo .mb-right {
padding: 20rpx;
width: 260rpx;
@ -310,13 +406,64 @@ export default {
display: flex;
align-items: center;
}
.mb-bo .mb-right .mb-text {
width: 100%;
}
.mb-bo .mb-right .mb-text view {
font-weight: bold;
font-size: 40rpx;
text-align: center;
width: 100%;
}
.top1 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;
}
.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>

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

@ -445,7 +445,8 @@ const submitJob = () => {
}
console.log(dataParams)
uni.redirectTo({
url: `/pages/pointPutawayJob/index?data=${encodeURIComponent(JSON.stringify(dataParams))}`
uurl: '/pages/pointPutawayJob/index?number='+jobContent.value.number+'&data=' +
encodeURIComponent(JSON.stringify(dataParams))
})
}
})

Loading…
Cancel
Save