Browse Source

fix: src\pages\productReceipt 文件修改 Vue2升级Vue3 10/25-11-11

syhx_app_vue3
王志国 2 weeks ago
parent
commit
d01ccb291d
  1. 136
      src/pages/productReceipt/coms/comProductDetailCardBatch.vue
  2. 151
      src/pages/productReceipt/coms/comProductRecordBatch.vue
  3. 18
      src/pages/productReceipt/job/ccProductReceiptJob.vue
  4. 16
      src/pages/productReceipt/job/completeReceiveJob.vue
  5. 69
      src/pages/productReceipt/job/productReceiptDetail.vue
  6. 4
      src/pages/productReceipt/job/productReceiptJob.vue

136
src/pages/productReceipt/coms/comProductDetailCardBatch.vue

@ -1,51 +1,52 @@
<template> <template>
<view class="" style="background-color: #fff;"> <view class="" style="background-color: #fff;">
<itemCompareQty :dataContent="dataContent" :handleQty="dataContent.handleQty"></itemCompareQty> <u-collapse>
<view class="" v-for="(item,index) in dataContent.subList" :key="index" > <u-collapse-item>
<u-swipe-action ref="swipeAction" v-if="index==0" <template #title>
:options="(item.scaned&&isEdit)?editAndRemoveOptions : item.scaned? removeOptions:options" <itemCompareQty :dataContent="dataContent" :handleQty="dataContent.handleQty"></itemCompareQty>
@click="(...event)=>swipeClick(event,item,'parent')" </template>
:class="item.scaned?'scan_view':''"> <view class="" v-for="(item,index) in dataContent.subList" :key="index">
<recommendBatch :detail="item" :isShowFromLocation="false" <u-swipe-action ref="swipeAction" v-if="index==0"
:isShowToLocation="settingParam.allowModifyLocation=='TRUE'"></recommendBatch> :options="item.scaned?scanOptions:detailOptions"
</u-swipe-action> @click="(...event)=>swipeClick(event,item)"
<view v-if="item.fgList!=undefined && item.fgList.length>0" class="card_view " style="margin-left: 20px;" :class="item.scaned?'scan_view':''">
v-for="(fg, index) in item.fgList" :key="index"> <recommend :detail="item" :isShowFromLocation="false"
<com-fg-card :detail='fg' class="scan_view"></com-fg-card> :isShowToLocation="settingParam.allowModifyLocation=='TRUE'"></recommend>
</view> </u-swipe-action>
</view> <view v-if="item.fgList!=undefined && item.fgList.length>0" class="card_view " style="margin-left: 20px;"
v-for="(fg, index) in item.fgList" :key="index">
<recommend-qty-edit ref="receiptEdit" :dataContent="editItem" :settingParam="settingParam" @confirm="confirm"> <com-fg-card :detail='fg' class="scan_view"></com-fg-card>
</recommend-qty-edit> </view>
<win-scan-location ref="scanLocationCode" title="目标库位" @getLocation='getLocation' </view>
:locationAreaTypeList="locationAreaTypeList"></win-scan-location> </u-collapse-item>
<productDetailInfoPopup ref="jobDetailPopup" :dataContent="showItem"></productDetailInfoPopup> </u-collapse>
<comMessage ref="message"></comMessage> <recommend-qty-edit ref="receiptEdit" :dataContent="editItem" :settingParam="settingParam" @confirm="confirm">
</view> </recommend-qty-edit>
<win-scan-location ref="scanLocationCode" title="目标库位" @getLocation='getLocation'
:locationAreaTypeList="locationAreaTypeList"></win-scan-location>
<productDetailInfoPopup ref="jobDetailPopup" :dataContent="showItem"></productDetailInfoPopup>
<comMessage ref="message"></comMessage>
</view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import itemCompareQty from '@/mycomponents/item/itemCompareQty.vue' import itemCompareQty from '@/mycomponents/item/itemCompareQty.vue'
import recommendBatch from '@/mycomponents/recommend/recommendBatch.vue' import Recommend from '@/mycomponents/recommend/recommend.vue'
import recommendQtyEdit from '@/mycomponents/qty/recommendQtyEdit.vue' import recommendQtyEdit from '@/mycomponents/qty/recommendQtyEdit.vue'
import productDetailInfoPopup from '@/pages/productReceipt/coms/productDetailInfoPopup.vue' import productDetailInfoPopup from '@/pages/productReceipt/coms/productDetailInfoPopup.vue'
import winScanLocation from "@/mycomponents/scan/winScanLocation.vue" import winScanLocation from "@/mycomponents/scan/winScanLocation.vue"
import comFgCard from "@/pages/productReceipt/coms/comFgCard.vue" import comFgCard from "@/pages/productReceipt/coms/comFgCard.vue"
import config from '@/static/config.js'
import pack from '@/mycomponents/balance/pack.vue' import {
import location from '@/mycomponents/balance/location.vue' getDetailOption,
import toLocation from '@/mycomponents/balance/toLocation.vue' getPurchaseReceiptOption
import batch from '@/mycomponents/balance/batch.vue' } from '@/common/array.js';
import config from '@/static/config.js'
import {
getRemoveOption, import {ref, watch, onMounted, computed, nextTick} from 'vue';
getEditRemoveOption import {useCountStore} from '@/store'
} from '@/common/array.js';
const store = useCountStore()
import { ref, watch, onMounted, computed,nextTick } from 'vue';
import { useCountStore } from '@/store'
const store = useCountStore()
const props = defineProps({ const props = defineProps({
dataContent: { dataContent: {
type: Object, type: Object,
@ -59,22 +60,17 @@ const props = defineProps({
type: Array, type: Array,
default: null default: null
}, },
isEdit: {
type: Boolean,
default: true
}
}); });
const emit = defineEmits(['updateData', 'remove']);
const showItem = ref({}); const showItem = ref({});
const editItem = ref({ const editItem = ref({
record: {} record: {}
}); });
const settingParam = ref({})
const locatonItem = ref({}); const locatonItem = ref({});
const detailOptions = ref([]); const detailOptions = ref([]);
const scanOptions = ref([]); const scanOptions = ref([]);
const options = ref([]);
const removeOptions = ref([]);
const editAndRemoveOptions = ref([]);
const collapse1 = ref(null); const collapse1 = ref(null);
const receiptEdit = ref(null); const receiptEdit = ref(null);
@ -90,11 +86,15 @@ watch(() => props.dataContent, (newDataContent, oldDataContent) => {
}); });
} }
} }
}, { immediate: true, deep: true }); }, {immediate: true, deep: true});
onMounted(() => { onMounted(() => {
removeOptions.value = getRemoveOption(); if (detailOptions.value.length == 0) {
editAndRemoveOptions.value = getEditRemoveOption(); detailOptions.value = getDetailOption();
}
if (scanOptions.value.length == 0) {
scanOptions.value = getPurchaseReceiptOption(settingParam.value.allowModifyQty, settingParam.value.allowModifyLocation)
}
}); });
// //
@ -145,34 +145,6 @@ const confirm = (qty) => {
editItem.value.handleQty = qty; editItem.value.handleQty = qty;
emit('updateData'); emit('updateData');
}; };
const isDevlement = computed(() => config.isDevelopment);
const copy = (detail) => {
const content = `HPQ;V1.0;I${detail.itemCode};P${detail.packingNumber};B${detail.batch};Q${detail.qty}`;
// #ifdef H5
navigator.clipboard.writeText(content).then(() => {
uni.showToast({
title: '复制采购标签成功',
icon: 'none'
});
});
// #endif
// #ifndef H5
uni.setClipboardData({
data: content,
success: () => {
uni.showToast({
title: '复制采购标签成功'
});
}
});
// #endif
};
const emit = defineEmits(['updateData', 'remove']);
</script> </script>
<style> <style>

151
src/pages/productReceipt/coms/comProductRecordBatch.vue

@ -0,0 +1,151 @@
<template>
<view class="" style="background-color: #fff;">
<u-collapse ref="collapse1" @change="">
<u-collapse-item :open="true">
<template #title>
<u-swipe-action ref="swipeAction"
:options="removeOptions"
@click="removeData($event,dataContent)">
<item-qty :dataContent="dataContent" :handleQty="dataContent.handleQty"
:isShowBalance="true"></item-qty>
</u-swipe-action>
</template>
<view class='split_line'></view>
<view class="" v-for="(item,index) in dataContent.subList">
<u-swipe-action ref="swipeAction"
:options="item.scaned?scanOptions:detailOptions"
@click="swipeClick($event,item,index)">
<balance :dataContent="item" :isShowStdPack="false" :isShowStatus="true"
:isShowPack="true" :isShowFromLocation="true"></balance>
</u-swipe-action>
</view>
</u-collapse-item>
</u-collapse>
<!-- <recommend-qty-edit ref="recommendQtyEdit" :dataContent="editItem" :handleQty="editItem.qty" @confirm="confirm" :isShowStatus="isShowStatus"></recommend-qty-edit> -->
<balance-qty-edit ref="balanceQtyEdit" @confirm="confirm"></balance-qty-edit>
<package-detail-popup ref='packageDetailPopup'>
</package-detail-popup>
<comMessage ref="comMessage"></comMessage>
</view>
</template>
<script setup>
import itemQty from '@/mycomponents/item/itemQty.vue'
import Recommend from '@/mycomponents/recommend/recommend.vue'
import productionLabel from '@/mycomponents/balance/productionLabel.vue'
import Record from '@/mycomponents/record/record.vue'
import BalanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue'
import RecommendQtyEdit from '@/mycomponents/qty/recommendQtyEdit.vue'
import PackageDetailPopup from '@/mycomponents/package/packageDetailPopup.vue'
import balance from '@/mycomponents/balance/balance.vue'
import {
getDetailOption,
getDetailEditRemoveOption,
getClearOption
} from '@/common/array.js';
import { ref, watch, onMounted, nextTick } from 'vue';
const props = defineProps({
dataContent: {
type: Object,
default: () => ({})
},
settingParam: {
type: Object,
default: () => ({})
},
fromInventoryStatus: {
type: String,
default: ""
},
toInventoryStatus: {
type: String,
default: ""
},
isShowStatus: {
type: Boolean,
default: false
}
});
const emit = defineEmits(['removeItem', 'removePack', 'updateData']);
const option = ref([]);
const title = ref("推荐详情");
const showItem = ref({});
const editItem = ref({});
const detailOptions = ref([]);
const scanOptions = ref([]);
const removeOptions = ref([]);
const dataList = ref([]);
const collapse1 = ref(null);
const comMessage = ref(null);
const balanceQtyEdit = ref(null);
const recommendQtyEdit = ref(null);
const packageDetailPopup = ref(null);
watch(() => props.dataContent, (newData, oldData) => {
if (newData.subList.length > 0) {
nextTick(() => {
if (collapse1.value) {
collapse1.value.resize();
}
});
}
}, { immediate: true, deep: true });
onMounted(() => {
detailOptions.value = getDetailOption();
scanOptions.value = getDetailEditRemoveOption();
removeOptions.value = getClearOption();
});
const removeData = (e, dataContent) => {
if (e.content.text === "清空") {
comMessage.value.showQuestionMessage("确定清空物料及箱码信息?", (res) => {
if (res) {
emit('removeItem');
}
});
}
};
const swipeClick = (e, item, index) => {
if (e.content.text === "详情") {
detail(item.package);
} else if (e.content.text === "编辑") {
edit(item);
} else if (e.content.text === "移除") {
remove(item, index);
}
};
const edit = (item) => {
editItem.value = item;
balanceQtyEdit.value.openEditPopup(editItem.value, editItem.value.handleQty);
};
const detail = (packageInfo) => {
showItem.value = packageInfo;
packageDetailPopup.value.openPopup(packageInfo);
};
const remove = (item, index) => {
comMessage.value.showQuestionMessage("确定移除扫描信息?", (res) => {
if (res) {
props.dataContent.subList.splice(index, 1);
emit('removePack');
}
});
};
const confirm = (qty) => {
editItem.value.handleQty = qty;
emit('updateData');
};
</script>
<style>
</style>

18
src/pages/productReceipt/job/ccProductReceiptJob.vue

@ -4,20 +4,16 @@
<job-filter ref="filter" otherTitle="ASN" @switchChangeToday="switchChangeToday" <job-filter ref="filter" otherTitle="ASN" @switchChangeToday="switchChangeToday"
@switchChangeWait="switchChangeWait" @onScanNumber="getScanNumber" :checkedToday="checkedToday" @switchChangeWait="switchChangeWait" @onScanNumber="getScanNumber" :checkedToday="checkedToday"
:checkedWaitTask="checkedWaitTask"> </job-filter> :checkedWaitTask="checkedWaitTask"> </job-filter>
<view v-if="jobList.length > 0"> <view v-if="jobList.length > 0">
<uni-swipe-action ref="swipeAction"> <view v-for="(item, index) in jobList" :key="index">
<view v-for="(item, index) in jobList" :key="index"> <u-swipe-action ref="swipeAction"
<uni-swipe-action-item :right-options="item.status == '2' ? detailGiveupOptions : detailOptions" @click="(...event)=>swipeClick(event, item)"
@click="swipeClick($event, item)"> :options="item.status == '2' ? detailGiveupOptions : detailOptions">
<com-product-job-card :dataContent="item" @click="openJobDetail(item)"></com-product-job-card> <com-product-job-card :dataContent="item" @click="openJobDetail(item)"></com-product-job-card>
</uni-swipe-action-item> </u-swipe-action>
</view> </view>
</uni-swipe-action>
<job-list-popup ref="jobListPopupRef" @selectedItem="selectedItem"></job-list-popup> <job-list-popup ref="jobListPopupRef" @selectedItem="selectedItem"></job-list-popup>
<job-info-popup ref="jobInfoPopupRef"></job-info-popup> <job-info-popup ref="jobInfoPopupRef"></job-info-popup>
<u-loadmore :status="loadingType" v-if="jobList.length > 0" /> <u-loadmore :status="loadingType" v-if="jobList.length > 0" />
<win-scan-button @goScan="openScanPopup" v-if="jobList.length > 0"></win-scan-button> <win-scan-button @goScan="openScanPopup" v-if="jobList.length > 0"></win-scan-button>
<winScanPackJob ref="scanPopup" @getResult="getScanResult"></winScanPackJob> <winScanPackJob ref="scanPopup" @getResult="getScanResult"></winScanPackJob>

16
src/pages/productReceipt/job/completeReceiveJob.vue

@ -4,17 +4,15 @@
<job-filter ref="filter" otherTitle="ASN" @switchChangeToday="switchChangeToday" @switchChangeWait="switchChangeWait" @onScanNumber="getScanNumber" :checkedToday="checkedToday" :checkedWaitTask="checkedWaitTask"> </job-filter> <job-filter ref="filter" otherTitle="ASN" @switchChangeToday="switchChangeToday" @switchChangeWait="switchChangeWait" @onScanNumber="getScanNumber" :checkedToday="checkedToday" :checkedWaitTask="checkedWaitTask"> </job-filter>
<view v-if="jobList.length > 0"> <view v-if="jobList.length > 0">
<uni-swipe-action ref="swipeAction"> <view v-for="(item, index) in jobList" :key="index">
<view v-for="(item, index) in jobList" :key="index"> <u-swipe-action ref="swipeAction"
<uni-swipe-action-item :right-options="item.status == '2' ? detailGiveupOptions : detailOptions" @click="swipeClick($event, item)"> :options="item.status == '2' ? detailGiveupOptions : detailOptions"
<com-product-job-card :dataContent="item" @click="openJobDetail(item)"></com-product-job-card> @click="(...event)=>swipeClick(event, item)">
</uni-swipe-action-item> <com-product-job-card :dataContent="item" @click="openJobDetail(item)"></com-product-job-card>
</view> </u-swipe-action>
</uni-swipe-action> </view>
<job-list-popup ref="jobListPopup" @selectedItem="selectedItem"></job-list-popup> <job-list-popup ref="jobListPopup" @selectedItem="selectedItem"></job-list-popup>
<job-info-popup ref="jobInfoPopup"></job-info-popup> <job-info-popup ref="jobInfoPopup"></job-info-popup>
<u-loadmore :status="loadingType" v-if="jobList.length > 0" /> <u-loadmore :status="loadingType" v-if="jobList.length > 0" />
<comMessage ref="comMessage"></comMessage> <comMessage ref="comMessage"></comMessage>
</view> </view>

69
src/pages/productReceipt/job/productReceiptDetail.vue

@ -237,15 +237,17 @@ const getScanResult = (result) => {
if (itemDetail == undefined) { if (itemDetail == undefined) {
showErrorMessage(`批次[${batch}]不在任务列表中`) showErrorMessage(`批次[${batch}]不在任务列表中`)
} else if (itemDetail.scaned) { } else if (itemDetail.scaned) {
showErrorMessage(`批次[${batch}]已经扫描`) itemDetail.handleQty = calc.add(Number(result.label.qty),itemDetail.handleQty);
} else { } else {
itemDetail.scaned = true itemDetail.scaned = true
itemDetail.handleQty = Number(result.label.qty) itemDetail.handleQty = Number(result.label.qty)
itemDetail.toLocationCode = toLocationCode.value // itemDetail.toLocationCode = toLocationCode.value
itemDetail.labelQty = Number(result.label.qty) itemDetail.labelQty = Number(result.label.qty)
calcHandleQty(detailSource.value)
continueScan() continueScan()
} }
calcHandleQty(detailSource.value)
} }
} }
@ -301,7 +303,7 @@ const showMessageHint = (hint, callback) => {
}) })
} }
const commit = () => { const commit = async () => {
scanCount.value = getScanCount(subList.value) scanCount.value = getScanCount(subList.value)
if (scanCount.value == 0) { if (scanCount.value == 0) {
showErrorMessage('扫描数为0,请先扫描') showErrorMessage('扫描数为0,请先扫描')
@ -316,18 +318,40 @@ const commit = () => {
}else{ }else{
toLocationCode.value = jobToLocationCode.value toLocationCode.value = jobToLocationCode.value
} }
//
let itemCodes = []
detailSource.value.forEach(item => {
itemCodes.push(item.itemCode)
})
await 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 (scanCount.value == subList.value.length) { if (scanCount.value == subList.value.length) {
if (checkCount()) { if(managementType.value == 'BY_BATCH' || managementType.value == 'BY_QUANTITY'){
submitJob() if (checkCountBatch()) {
submitJob();
}
}else{
if (checkCount()) {
submitJob();
}
} }
} else if (scanCount.value < subList.value.length) { } else if (scanCount.value < subList.value.length) {
// //
if (jobContent.value.allowPartialComplete == 'TRUE') { if (jobContent.value.allowPartialComplete == 'TRUE') {
// //
if (checkCount()) { if(managementType.value == 'BY_BATCH' || managementType.value == 'BY_QUANTITY'){
submitJob() if (checkCountBatch()) {
submitJob();
}
}else{
if (checkCount()) {
submitJob();
}
} }
} else { } else {
// //
@ -361,6 +385,33 @@ const checkCount = () => {
return isCheck return isCheck
} }
const checkCountBatch = ()=> {
let isCheck = true;
let hint = ""
for (let i = 0; i < detailSource.value.length; i++) {
const item = detailSource.value[i];
for (let j = 0; j < item.subList.length; j++) {
const subItem = item.subList[i]
console.log(calc.sub(subItem.handleQty, subItem.qty) )
if (calc.sub(subItem.handleQty, subItem.qty) < 0 || calc.sub(subItem.handleQty, subItem.qty) > 0) {
isCheck = false;
hint = "批次【" + subItem.batch + "】实际收货数量:[" + subItem.handleQty + "]与包装数量[" + subItem.qty +
"]不相等,是否继续收货?"
break
}
}
}
console.log(isCheck)
if (!isCheck) {
showQuestMessage(hint, res => {
if (res) {
submitJob();
}
})
}
return isCheck;
}
const submitJob = () => { const submitJob = () => {
proxy.$modal.loading('提交中....') proxy.$modal.loading('提交中....')
const itemCodes = [] const itemCodes = []

4
src/pages/productReceipt/job/productReceiptJob.vue

@ -12,7 +12,7 @@
<u-loadmore :status="loadingType" v-if="jobList.length > 0" /> <u-loadmore :status="loadingType" v-if="jobList.length > 0" />
</view> </view>
<win-scan-button @goScan="openScanPopup" v-if="jobList.length > 0"></win-scan-button> <win-scan-button @goScan="openScanPopup" v-if="manageModel!='BY_BATCH' && jobList.length > 0"></win-scan-button>
<winScanPackJob ref="scanPopup" @getResult="getScanResult"></winScanPackJob> <winScanPackJob ref="scanPopup" @getResult="getScanResult"></winScanPackJob>
<jobListCom ref="jobListRef" @selectItem="selectItem"></jobListCom> <jobListCom ref="jobListRef" @selectItem="selectItem"></jobListCom>
<com-message ref="comMessageRef" /> <com-message ref="comMessageRef" />
@ -71,6 +71,8 @@ const jobListPopupRef = ref()
const scanPopup = ref() const scanPopup = ref()
const jobListRef = ref() const jobListRef = ref()
const timer = ref(null) const timer = ref(null)
const manageModel = import.meta.env.VITE_MANAGE_MODEL
onMounted(() => { onMounted(() => {
detailOptions.value = getDetailOption() detailOptions.value = getDetailOption()
detailGiveupOptions.value = getDetailGiveupOption() detailGiveupOptions.value = getDetailGiveupOption()

Loading…
Cancel
Save