Browse Source

装配收货H5端打印功能

hella_online_20240829
yufei0306 4 months ago
parent
commit
3eb6e4ff0f
  1. 17
      src/api/request2.js
  2. 3
      src/pages/pointProductReceipt/webview.vue
  3. 150
      src/pages/productReceipt/job/fgProductReceiptDetail.vue

17
src/api/request2.js

@ -3897,7 +3897,24 @@ export function getPrintProductReceiptList(params) {
});
}
// 根据库存余额获取包装信息进行打印标签 H5
export function getBalanceToPackage(params) {
return request({
url: baseApi + "/wms/package/getBalanceToPackage",
method: "get",
data: params,
});
}
// 批量打印标签 H5
export function batchPrintingLable(params) {
return request({
url: baseApi + "/wms/package/batchPrintingLable",
method: "post",
data: params,
});
}
/**
* 查询库存通过多种条件 高级筛选

3
src/pages/pointProductReceipt/webview.vue

@ -23,7 +23,8 @@
}
},
onLoad(event) {
this.webUrl = event.url
let webData = JSON.parse(event.webData)
this.webUrl = event.url+'?token='+webData.token+'&asn_number='+webData.asn_number
}
}
</script>

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

@ -49,10 +49,10 @@
<view class="page-footer">
<view class="uni-flex u-col-center space-between padding_10"
style="background-color:ghostwhite; width: 100%; ">
<view class="">
<locationCompare title="收货库位" :isShowEdit="jobContent.allowModifyLocation=='TRUE'" :recommendLocationCode="jobToLocationCode"
:locationCode="toLocationCode" @getLocation='scanLocationCode'
:locationTypeList="toLocationTypeList"></locationCompare>
<view class="">
<locationCompare title="收货库位" :isShowEdit="jobContent.allowModifyLocation=='TRUE'"
:recommendLocationCode="jobToLocationCode" :locationCode="toLocationCode"
@getLocation='scanLocationCode' :locationTypeList="toLocationTypeList"></locationCompare>
</view>
<view class=" uni-flex uni-row">
<button class="btn_single_commit" hover-class="btn_commit_after" @click="commit">提交</button>
@ -75,8 +75,10 @@
getProductReceiptJobDetail,
takeProductReceiptJob,
cancleTakeProductReceiptJob,
productReceiptJobsubmit,
getPrintProductReceiptList
productReceiptJobsubmit,
getPrintProductReceiptList,
getBalanceToPackage,
batchPrintingLable
} from '@/api/request2.js';
import {
goHome,
@ -288,10 +290,10 @@
pack.handleQty = calc.add(pack.handleQty, fg.qty);
// item.qty = calc.add(item.qty, detail.qty);
}
})
//
if(pack.scaned&&pack.qty==pack.fgList.length){
this.commit()
})
//
if (pack.scaned && pack.qty == pack.fgList.length) {
this.commit()
}
})
})
@ -339,61 +341,81 @@
callback()
}
});
},
//
print() {
let packingNumber = []
this.detailSource.forEach(item => {
item.subList.forEach(detail => {
if (detail.scaned) {
// var info = getPackingNumberAndBatch(this.managementList, detail.itemCode,
// detail.packingNumber, detail.batch);
// detail.toPackingNumber = info.packingNumber;
packingNumber.push(detail.packingNumber)
}
})
})
// #ifdef APP
getPrintProductReceiptList({
packingNumber: packingNumber.join(','),
type: 'MakeLabel'
}).then(res => {
console.log('打印', res)
let pointData = []
res.data.forEach(item => {
pointData.push({
barcodeString: item.barcodeString, //
itemCode: item.itemCode || '', //
itemName: item.itemName || '', //
itemDesc1: item.itemDesc1 || '', //
relateNumber: item.relateNumber || '', //relateNumber
batch: item.batch || '', //
productionLineCode: item.productionLineCode || '', //线
shiftCode: item.shiftCode || '', //
qty: item.qty || '', //
printTimes: item.printTimes || '' //
})
})
console.log('pointData', pointData)
uni.navigateTo({
url: `/pages/pointProductReceipt/index?points=${JSON.stringify(pointData)}`
});
}).catch(error => {
this.showErrorMessage(error)
})
// #endif
// #ifdef H5
const webUrl =
`${import.meta.env.VITE_JMREPORT_BASE_URL}/jmreport/view/922734157577715712?token=${storage.getStorage(storage.constant.token)}&asn_number=${packingNumber.join(',')}`
uni.navigateTo({
url: `/pages/pointProductReceipt/webview?url=${webUrl}`
});
// #endif
},
//
print() {
let _this = this
let packingNumber = []
this.detailSource.forEach(item => {
item.subList.forEach(detail => {
if (detail.scaned) {
// var info = getPackingNumberAndBatch(this.managementList, detail.itemCode,
// detail.packingNumber, detail.batch);
// detail.toPackingNumber = info.packingNumber;
packingNumber.push(detail.packingNumber)
}
})
})
// #ifdef APP
getPrintProductReceiptList({
packingNumber: packingNumber.join(','),
type: 'MakeLabel'
}).then(res => {
console.log('打印', res)
let pointData = []
res.data.forEach(item => {
pointData.push({
barcodeString: item.barcodeString, //
itemCode: item.itemCode || '', //
itemName: item.itemName || '', //
itemDesc1: item.itemDesc1 || '', //
relateNumber: item.relateNumber || '', //relateNumber
batch: item.batch || '', //
productionLineCode: item.productionLineCode || '', //线
shiftCode: item.shiftCode || '', //
qty: item.qty || '', //
printTimes: item.printTimes || '' //
})
})
console.log('pointData', pointData)
uni.navigateTo({
url: `/pages/pointProductReceipt/index?points=${JSON.stringify(pointData)}`
});
}).catch(error => {
_this.showErrorMessage(error)
})
// #endif
// #ifdef H5
getBalanceToPackage({
packingNumber: packingNumber.join(',')
}).then(res => {
console.log('PC打印', res)
_this.getH5BatchPrintingLable(res.data.number)
}).catch(error => {
_this.showErrorMessage(error)
})
// #endif
},
getH5BatchPrintingLable( number) {
let _this = this
batchPrintingLable(number).then(resLable => {
console.log('batchPrintingLable', resLable)
const webUrl = `${import.meta.env.VITE_JMREPORT_BASE_URL}/jmreport/view/922734157577715712`
const webData = {
token: storage.getStorage(storage.constant.token),
asn_number: resLable.data
}
uni.navigateTo({
url: `/pages/pointProductReceipt/webview?url=${webUrl}&webData=${JSON.stringify(webData)}`
});
})
},
commit() {
// this.scanCount = getScanCount(this.subList);
// if (this.scanCount == 0) {
@ -521,7 +543,7 @@
showCommitSuccessMessage(hint) {
this.$refs.comMessage.showSuccessMessage(hint, res => {
// navigateBack(1)
// navigateBack(1)
this.print()
})
},

Loading…
Cancel
Save