Browse Source

fix: purchaseReceipt 文件修改 Vue2升级Vue3 10/25-11-11

syhx_app_vue3
王志国 2 weeks ago
parent
commit
65aae6dea0
  1. 6
      src/pages/productRecycle/job/productRecycleJobDetail.vue
  2. 5
      src/pages/purchaseReceipt/coms/comReceiptDetailCard.vue
  3. 18
      src/pages/purchaseReceipt/coms/comReceiptDetailCardBacth.vue
  4. 2
      src/pages/purchaseReceipt/job/purchaseReceipt.vue
  5. 283
      src/pages/purchaseReceipt/job/receiptDetail.vue
  6. 28
      src/pages/purchaseReceipt/job/receiptJob.vue

6
src/pages/productRecycle/job/productRecycleJobDetail.vue

@ -324,7 +324,7 @@ const getScanResultAfterBatch = (result)=> {
itemDetail.balance.packQty = Number(result.package.packQty)
itemDetail.balance.packUnit = result.package.packUnit
}
calcHandleQty();
calcHandleQty1();
} else {
//
itemDetail = detail.subList.find(r => {
@ -348,7 +348,7 @@ const getScanResultAfterBatch = (result)=> {
itemDetail.balance.balanceQty = result.balance.qty;
itemDetail.balance.packQty = result.package.packQty
itemDetail.balance.packUnit = result.package.packUnit
calcHandleQty();
calcHandleQty1();
} else {
scanPopupGetFocus();
}
@ -370,7 +370,7 @@ const getScanResultAfterBatch = (result)=> {
itemDetail.balance.balanceQty = result.balance.qty;
itemDetail.balance.packQty = result.package.packQty
itemDetail.balance.packUnit = result.package.packUnit
calcHandleQty();
calcHandleQty1();
}
} else {

5
src/pages/purchaseReceipt/coms/comReceiptDetailCard.vue

@ -7,7 +7,10 @@
<itemCompareQty :dataContent="dataContent" :handleQty="dataContent.handleQty" :isShowPackUnit="false" style="width: 100%"></itemCompareQty>
</u-swipe-action>
</template>
<package-list :dataContent="dataContent.subList" :isEdit="settingParam.allowModifyQty == 'TRUE'" :settingParam="settingParam" @collapseChange="collapseChange" @updateData="updateData" :isShowFromLocation="false"></package-list>
<package-list :dataContent="dataContent.subList"
:isEdit="settingParam.allowModifyQty == 'TRUE'"
:settingParam="settingParam" @collapseChaWnge="collapseChange"
@updateData="updateData" :isShowFromLocation="false"></package-list>
</u-collapse-item>
</u-collapse>

18
src/pages/purchaseReceipt/coms/comReceiptDetailCardBacth.vue

@ -6,13 +6,12 @@
<view style="flex: 1">
<u-swipe-action @click="(...event)=>swipeClick(event,dataContent)"
:options="dataContent.handleQty>0? removeOptions:options"
:class="dataContent.scaned?'scan_view':''">
>
<itemCompareQty :dataContent="dataContent" :handleQty="dataContent.handleQty"
:isShowPackUnit="false"></itemCompareQty>
<batch v-if="dataContent.subList[0].batch" :batch="dataContent.subList[0].batch"></batch>
<location title="来源库位" v-if="dataContent.subList[0].fromLocationCode"
:locationCode="dataContent.subList[0].fromLocationCode">
</location>
<package-list :dataContent="dataContent.subList" :isEdit="settingParam.allowModifyQty=='TRUE'"
:settingParam="settingParam" @collapseChange="collapseChange" @updateData="updateData"
:isShowFromLocation="false"></package-list>
</u-swipe-action>
</view>
</template>
@ -30,18 +29,13 @@
<script setup lang="ts">
import itemCompareQty from '@/mycomponents/item/itemCompareQty.vue'
import recommend from '@/mycomponents/recommend/recommend.vue'
import Recommend from '@/mycomponents/recommend/recommend.vue'
import recommendQtyEdit from '@/mycomponents/qty/recommendQtyEdit.vue'
import JobDetailPopup from '@/mycomponents/detail/jobDetailPopup.vue'
import receiptDetailInfoPopup from '@/pages/purchaseReceipt/coms/receiptDetailInfoPopup.vue'
import winScanLocation from "@/mycomponents/scan/winScanLocation.vue"
import detailList from '@/mycomponents/detail/detailList.vue'
import packageList from '@/mycomponents/package/packageList.vue'
import PackageList from '@/mycomponents/package/packageList.vue'
import pack from '@/mycomponents/balance/pack.vue'
import location from '@/mycomponents/balance/location.vue'
import toLocation from '@/mycomponents/balance/toLocation.vue'
import batch from '@/mycomponents/balance/batch.vue'
import {
getDetailOption,

2
src/pages/purchaseReceipt/job/purchaseReceipt.vue

@ -1,6 +1,6 @@
<template>
<view class="">
<receipt-job :title="title" scanTitle="箱标签/ASN单号" :isShowAsn="false" :isShowJob="false" ref="receiptjob" operation="receipt"></receipt-job>
<receipt-job source_type="ASN" :title="title" scanTitle="箱标签/ASN单号" :isShowAsn="false" :isShowJob="false" ref="receiptjob" operation="receipt"></receipt-job>
</view>
</template>

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

@ -29,7 +29,7 @@
<!-- 管理精度是批次 -->
<comReceiptDetailCardBacth :dataContent="item" :index="index" :settingParam="jobContent"
@remove="updateData" @updateData="updateData" :locationAreaTypeList='toLocationAreaTypeList'
v-if="managementType == 'BY_BATCH'">
v-if="managementType == 'BY_BATCH' || managementType =='BY_QUANTITY'">
</comReceiptDetailCardBacth>
<com-receipt-detail-card :dataContent="item" :index="index" :settingParam="jobContent" @remove="updateData"
@updateData="updateData" :locationAreaTypeList='toLocationAreaTypeList' v-else>
@ -55,7 +55,7 @@
</view>
</view>
<win-scan-pack ref="scanPopup" @getResult="getScanResult"></win-scan-pack>
<win-scan-pack ref="scanPopup" @getResult="getScanResult" :locationCode='jobToLocationCode'></win-scan-pack>
<win-scan-button @goScan="openScanPopup" v-if="operation == 'receipt'"></win-scan-button>
<!-- <winScanPackAndCont ref="scanPopup" @getResult='getScanResult'></winScanPackAndCont> -->
<com-message ref="comMessageRef" />
@ -70,7 +70,9 @@ import { purchaseReceiptJobSubmit, getPurchaseReceiptJobDetail, takePurchaseRece
import { goHome, getCurrDateTime, getPackingNumberAndBatch, compareDesc, navigateBack, getSwitchInfoByCode } from '@/common/basic.js'
import { getDirectoryItemArray } from '@/common/directory.js'
import { Decimal } from 'decimal.js';
import { calc } from '@/common/calc'
import { getManagementPrecisions } from '@/common/balance.js'
import { getTreeDataSource, createRecordInfo, calcHandleQty, getScanCount, calcTreeHandleQty } from '@/common/detail.js'
@ -114,11 +116,17 @@ const count = ref(0)
const managementType = ref('')
const switchCode1 = ref('')
const scanedPackingNumber = ref('')
const packingNumberList = ref([])
const source_type = ref('')
const balanceInfo = ref('')
const packList = ref([])
onLoad((option) => {
id.value = option.id
scanMessage.value = option.scanMessage
scanedPackingNumber.value = option.scaned || ''
status.value = option.status || ''
source_type.value = option.source_type;
operation.value = option.operation
switchCode.value = 'purchasereceiptPrintPDA' // pda
switchCode1.value = "EnableQms" //QMSTRUEFALSE
@ -209,8 +217,9 @@ const getDetail = () => {
getManagementPrecisions(itemCodes, jobToLocationCode.value, res => {
if (res.success) {
managementList.value = res.list;
managementType.value = managementList.value.some(item => item.ManagementPrecision ==
'BY_BATCH') ? 'BY_BATCH' : ''
managementType.value = managementList.value &&
managementList.value[0] &&
managementList.value[0].ManagementPrecision ? managementList.value[0].ManagementPrecision : 'BY_PACKAGING'
}
})
if (scanMessage.value) {
@ -226,8 +235,11 @@ const getDetail = () => {
})
}
const getScanResult = (result) => {
balanceInfo.value = result.balance
if(managementType.value == 'BY_BATCH'){
getScanResultAfterBatch(result)
}else if(managementType.value == 'BY_QUANTITY' ){
getScanResultAfterQuantity(result)
}else{
getScanResultAfter(result)
}
@ -237,11 +249,11 @@ const getScanResultAfter = (result) => {
try {
const { itemCode } = result.label
let detail = detailSource.value.find((r) => r.itemCode == itemCode)
detail.scaned = true;
if (detail == undefined) {
showErrorMessage(`物料号【${itemCode}】不在列表中`)
return
}
detail.scaned = true;
if (result.label.labelType == 'ContainerLabel') {
const containerNumber = result.label.container
var itemDetail = detail.subList.filter((r) => r.containerNumber == containerNumber)
@ -289,7 +301,7 @@ const getScanResultAfter = (result) => {
pack.toLocationCode = toLocationCode.value
pack.labelQty = Number(result.label.qty)
}
calcTreeHandleQty(detailSource.value)
calcHandleQty(detailSource.value)
itemDetail.packList.sort(compareDesc('scanDate')) //
}
} else {
@ -333,11 +345,11 @@ const getScanResultAfterBatch = (result)=>{
try {
let itemCode = result.label.itemCode;
let detail = detailSource.value.find(r => r.itemCode == itemCode);
detail.scaned = true;
if (detail == undefined) {
showErrorMessage("物料号【" + itemCode + "】不在列表中")
return;
}
detail.scaned = true;
if (result.label.labelType == "ContainerLabel") {
let containerNumber = result.label.container;
let itemDetail = detail.subList.filter(r => r.containerNumber == containerNumber);
@ -350,10 +362,10 @@ const getScanResultAfterBatch = (result)=>{
itemDetail.forEach(item => {
item.scaned = true;
itemDetail.scanDate = new Date();
item.handleQty = item.qty;
item.handleQty = calc.add(item.handleQty,result.label.qty)
item.toLocationCode = toLocationCode.value;
})
calcHandleQty(detailSource.value);
// calcHandleQty(detailSource.value);
detailSource.value[0].subList.sort(compareDesc('scanDate')); //
continueScan()
}
@ -382,10 +394,19 @@ const getScanResultAfterBatch = (result)=>{
if (pack == undefined) {
showMessage("批次【" + batch + "】不在列表中")
} else {
if (pack.scaned) {
let isScan = false
if(packingNumber){
isScan = packList.value.some(item=>item == packingNumber)
}else{
isScan = false
}
if (isScan) {
pack.scanDate = new Date();
showMessage("批次【" + batch + "】已经扫描");
pack.handleQty = calc.add(pack.handleQty,result.label.qty)
// showMessage("" + batch + "");
} else {
packList.value.push(packingNumber)
pack.packList.push(packingNumber)
pack.scaned = true
pack.scanDate = new Date();
pack.handleQty = Number(result.label.qty);
@ -393,10 +414,9 @@ const getScanResultAfterBatch = (result)=>{
pack.labelQty = Number(result.label.qty);
}
}
calcTreeHandleQty(detailSource.value);
calcHandleQty(detailSource.value);
itemDetail.packList.sort(compareDesc('scanDate')); //
}
} else {
//,
let scanedLength = 0;
@ -405,36 +425,171 @@ const getScanResultAfterBatch = (result)=>{
scanedLength++;
}
})
if (itemDetail.scaned && scanedLength == itemDetail
.packList.length) {
let isScan = false
if(packingNumber){
isScan = packingNumberList.value.some(item=>item == packingNumber)
}else{
isScan = false
}
if (isScan) {
itemDetail.scanDate = new Date();
showMessage("批次【" + batch + "】已经扫描")
itemDetail.handleQty = calc.add(itemDetail.handleQty,result.label.qty)
// showMessage("" + batch + "")
} else {
packingNumberList.value.push(packingNumber)
itemDetail.scaned = true;
itemDetail.scanDate = new Date();
itemDetail.handleQty = Number(result.label.qty);
itemDetail.handleQty = calc.add(itemDetail.handleQty,result.label.qty)
itemDetail.toLocationCode = toLocationCode.value;
itemDetail.labelQty = Number(result.label.qty);
itemDetail.packList.forEach(pac => {
pac.scaned = true
pac.scanDate = new Date();
pac.handleQty = Number(pac.qty);
pac.handleQty = calc.add(pac.handleQty,result.label.qty);
pac.toLocationCode = toLocationCode.value;
})
calcTreeHandleQty(detailSource.value);
this.detailSource[0].subList.sort(compareDesc('scanDate')); //
this.continueScan()
this.$forceUpdate()
detail.handleQty = itemDetail.handleQty
detailSource.value[0].subList.sort(compareDesc('scanDate')); //
continueScan()
}
calcHandleQty(detailSource.value);
}
}
}
} catch (e) {
this.showErrorMessage(e.message)
}
}
//
const getScanResultAfterQuantity = (result)=> {
try {
let itemCode = result.label.itemCode;
let detail = detailSource.value.find(r => r.itemCode == itemCode);
if (detail == undefined) {
showErrorMessage("物料号【" + itemCode + "】不在列表中")
return;
}
detail.scaned = true;
if (result.label.labelType == "ContainerLabel") {
const containerNumber = result.label.container;
const itemDetail = detail.subList.filter(r => r.containerNumber == containerNumber);
if (itemDetail.length == 0) {
showErrorMessage("物料【" + itemCode + "】、托码【" + containerNumber + "】不在列表中")
} else {
if (itemDetail[0].scaned) {
showErrorMessage("物料【" + itemCode + "】、托码【" + containerNumber + "】已经扫描")
} else {
itemDetail.forEach(item => {
item.scaned = true;
itemDetail.scanDate = new Date();
item.handleQty = calc.add(item.handleQty,result.label.qty)
item.toLocationCode = toLocationCode.value;
})
// calcHandleQty(this.detailSource);
detailSource.value[0].subList.sort(compareDesc('scanDate')); //
continueScan()
}
}
} else if (result.label.labelType == "PurchaseLabel") {
const packingNumber = result.package.number;
const parentpackingNumber = result.package.parentNumber;
const batch = result.label.batch;
const qty = result.label.qty;
const detail = detailSource.value.find(r => r.itemCode == itemCode);
console.log(8989,this.detailSource)
if (detail == undefined) {
showMessage("物料号【" + itemCode + "】不在列表中")
} else {
//
// var itemDetail = detail.subList.find(r => r.batch ==
// batch);
// if (itemDetail == undefined) {
// itemDetail = detail.subList.find(r => r.batch ==
// batch);
// if (itemDetail == undefined) {
// this.showMessage("" + batch + "")
// } else {
// var pack = itemDetail.packList.find(p =>
// p.batch == batch)
// if (pack == undefined) {
// this.showMessage("" + batch + "")
// } else {
let isScan = false
const itemDetail = detail.subList[0]
let pack = detail.subList[0] && detail.subList[0].length>0 ?detail.subList[0] : {}
if(packingNumber){
isScan = packingNumberList.value.some(item=>item == packingNumber)
}else{
isScan = false
}
if (isScan) {
detail.subList[0].scanDate = new Date();
// this.showMessage("" + packingNumber + "");
detail.subList[0].handleQty = calc.add(detail.subList[0].handleQty,result.label.qty)
} else {
packingNumberList.value.push(packingNumber)
detail.subList[0].scaned = true
detail.subList[0].scanDate = new Date();
detail.subList[0].handleQty = Number(result.label.qty);
detail.subList[0].toLocationCode = toLocationCode.value;
detail.subList[0].labelQty = Number(result.label.qty);
}
// }
calcHandleQty(detailSource.value);
continueScan()
// itemDetail.packList[0] = detail.subList[0]; //
// }
// } else {
// //,
// var scanedLength = 0;
// itemDetail.packList.forEach(res => {
// if (res.scaned) {
// scanedLength++;
// }
// })
// debugger
// let isScan = false
// if(packingNumber){
// isScan = this.packingNumberList.some(item=>item == packingNumber)
// }else{
// isScan = false
// }
// if (isScan) {
// itemDetail.scanDate = new Date();
// // this.showMessage("" + packingNumber + "")
// itemDetail.handleQty = calc.add(itemDetail.handleQty,result.label.qty)
// } else {
// this.packingNumberList.push(packingNumber)
// itemDetail.scaned = true;
// itemDetail.scanDate = new Date();
// itemDetail.handleQty =itemDetail.handleQty ?itemDetail.handleQty:0
// itemDetail.handleQty = calc.add(itemDetail.handleQty,result.label.qty)
// console.log(itemDetail.handleQty)
// itemDetail.toLocationCode = this.toLocationCode;
// itemDetail.labelQty = Number(result.label.qty);
// itemDetail.packList.forEach(pac => {
// pac.scaned = true
// pac.scanDate = new Date();
// pac.handleQty = calc.add(pac.handleQty,result.label.qty);
// pac.toLocationCode = this.toLocationCode;
// })
// detail.handleQty = itemDetail.handleQty
// this.detailSource[0].subList.sort(compareDesc('scanDate')); //
// this.continueScan()
// this.$forceUpdate()
// }
// calcHandleQty(this.detailSource);
// }
}
}
} catch (e) {
showErrorMessage(e.message)
}
}
//
const continueScan = () => {
scanCount.value = getScanCount(subList.value)
@ -446,7 +601,7 @@ const continueScan = () => {
}
const updateData = () => {
calcTreeHandleQty(detailSource.value)
calcHandleQty(detailSource.value)
// calcHandleQty(this.detailSource);
}
@ -471,11 +626,36 @@ const commit = () => {
if (!checkLocation()) {
return
}
let itemCodes = []
detailSource.value.forEach(item => {
itemCodes.push(item.itemCode)
})
//
getManagementPrecisions(itemCodes, toLocationCode.value, res => {
if (res.success) {
managementList.value = res.list;
managementType.value = managementList.value &&
managementList.value[0] &&
managementList.value[0].ManagementPrecision ? managementList.value[0].ManagementPrecision : 'BY_PACKAGING'
if(managementType.value == 'BY_BATCH' || managementType.value == 'BY_QUANTITY'){
checkBatch()
}else{
check()
}
} else {
uni.hideLoading();
showErrorMessage(res.message);
}
})
}
//
const check = ()=>{
//
if (scanCount.value == subList.value.length) {
submitJob()
} else if (scanCount.value < subList.value.length) {
}
else if (scanCount.value < subList.value.length) {
//
if (jobContent.value.allowPartialComplete == 'TRUE') {
//
@ -492,13 +672,38 @@ const commit = () => {
//
comMessageRef.value.showErrorMessage("任务明细未全部完成,不允许部分提交!", res => {
if (res) {
openScanPopup()
openScanPopup(jobToLocationCode.value)
}
})
}
}
}
//
const checkBatch = ()=> {
//
const scanCount1 = detailSource.value
const current = detailSource.value.find(item=> item.handleQty<item.qty)
if(current){
//
if (jobContent.value.allowPartialComplete == "TRUE") {
//
comMessageRef.value.showQuestionMessage1("任务明细未全部完成,是否提交?", 'red', res => {
if (res) {
submitJob()
}
});
} else {
//
comMessageRef.value.showErrorMessage("任务明细未全部完成,不允许部分提交!", res => {
if (res) {
openScanPopup(jobToLocationCode.value);
}
});
}
}else{
submitJob();
}
}
const reject = () => {
if (!reasonText.value) {
showMessage('请输入拒收原因')
@ -530,17 +735,7 @@ const reject = () => {
const submitJob = () => {
proxy.$modal.loading('提交中....')
const itemCodes = []
detailSource.value.forEach((item) => {
itemCodes.push(item.itemCode)
})
//
getManagementPrecisions(itemCodes, toLocationCode.value, (res) => {
if (res.success) {
managementList.value = res.list
const params = setParams()
purchaseReceiptJobSubmit(params)
.then((res) => {
uni.hideLoading()
@ -556,7 +751,7 @@ const submitJob = () => {
})
} else if(!isCheckPrint1 && !isCheckPrint){
showCommitSuccessMessage("提交成功\n生成采购收货记录\n" + res.data.number)
}else {
}else if(source_type.value !='TOOL' && source_type.value != 'Develop') {
uni.showLoading({
title: '提交成功,将跳转到打印页面',
mask: true
@ -610,6 +805,9 @@ const submitJob = () => {
})
}, 2000)
}
} else if(source_type.value == 'TOOL' || source_type.value == 'Develop'){
uni.hideLoading()
this.showCommitSuccessMessage("提交成功\n生成采购收货记录\n" + res.data.number)
}else {
showErrorMessage(`提交失败[${res.msg}]`)
}
@ -622,11 +820,6 @@ const submitJob = () => {
}
});
})
} else {
uni.hideLoading()
showErrorMessage(res.message)
}
})
}
const setParams = () => {
@ -644,6 +837,7 @@ const setParams = () => {
pack.handleQty = 0
}
})
detail.toLocationCode = toLocationCode.value ? toLocationCode.value : jobToLocationCode.value
const info = getPackingNumberAndBatch(managementList.value, detail.itemCode, detail.packingNumber, detail.batch)
detail.toPackingNumber = info.packingNumber
detail.packingNumber = info.packingNumber;
@ -694,6 +888,7 @@ const switchChange = (isOn) => {
r.resizeCollapse()
})
})
scanCount.value = getScanCount(detailSource.value);
calcHandleQty(detailSource.value)
} else {
comMessageRef.value.showQuestionMessage('是否要关闭整单收货?', (res) => {
@ -731,7 +926,7 @@ const showErrorMessage = (message) => {
}
const openScanPopup = () => {
scanPopup.value.openScanPopup()
scanPopup.value.openScanPopup(jobToLocationCode.value)
}
const closeScanPopup = () => {

28
src/pages/purchaseReceipt/job/receiptJob.vue

@ -11,7 +11,7 @@
<receipt-job-list-popup ref="jobListPopup" @selectedItem="selectedItem"></receipt-job-list-popup>
</view>
<win-scan-button @goScan="openScanPopup" v-if="jobList.length > 0"></win-scan-button>
<winScanPackJob title="箱标签/ASN单号" ref="scanPopup" @getResult="getScanResult"> </winScanPackJob>
<winScanPackJob :title="scanHintTitle" ref="scanPopup" @getResult="getScanResult"> </winScanPackJob>
<jobListCom ref="jobListRef" @selectItem="selectItem"></jobListCom>
<com-message ref="comMessageRef" />
</view>
@ -58,6 +58,8 @@ const jobInfoPopup = ref()
const jobListPopup = ref()
const scanPopup = ref()
const jobListRef = ref()
const manageModel = import.meta.env.VITE_MANAGE_MODEL
const scanHintTitle = ref('')
const props = defineProps({
operation: {
type: String,
@ -78,7 +80,11 @@ const props = defineProps({
title: {
type: String,
default: ''
}
},
source_type: {
type: String,
default: ''
},
})
onMounted(() => {
nextTick(() => {
@ -88,6 +94,11 @@ onMounted(() => {
})
})
const refresh = () => {
if(manageModel == 'BY_BATCH'){
scanHintTitle.value = "ASN单号"
}else {
scanHintTitle.value = "箱标签/ASN单号"
}
getList('refresh')
}
const openFilter = () => {
@ -123,6 +134,13 @@ const getList = (type) => {
action: '==',
value: store.id
})
if(props.source_type){
filters.push({
column: "source_type",
action: "==",
value: props.source_type
})
}
const params = {
filters,
pageNo: pageNo.value,
@ -211,7 +229,7 @@ const getDataListByType = (code, type) => {
})
}
const openJobDetail = (item, scanMessageMes = '') => {
proxy.$tab.navigateTo(`./receiptDetail?id=${item.masterId}&status=${item.status}&operation=${props.operation}&scanMessage=${scanMessageMes}`)
proxy.$tab.navigateTo(`./receiptDetail?id=${item.masterId}&status=${item.status}&operation=${props.operation}&scanMessage=${scanMessageMes}&source_type=${props.source_type}`)
scanMessage.value = ''
}
const showItemList = (itemList) => {
@ -322,6 +340,10 @@ const getScanResult = (result) => {
}
]
} else {
if(manageModel == "BY_BATCH"){
showMessage("请扫描ASN单号")
return;
}
filters = [
{
column: "packingNumber",

Loading…
Cancel
Save