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>
<view class="" style="background-color: #fff;">
<itemCompareQty :dataContent="dataContent" :handleQty="dataContent.handleQty"></itemCompareQty>
<view class="" v-for="(item,index) in dataContent.subList" :key="index" >
<u-swipe-action ref="swipeAction" v-if="index==0"
:options="(item.scaned&&isEdit)?editAndRemoveOptions : item.scaned? removeOptions:options"
@click="(...event)=>swipeClick(event,item,'parent')"
:class="item.scaned?'scan_view':''">
<recommendBatch :detail="item" :isShowFromLocation="false"
:isShowToLocation="settingParam.allowModifyLocation=='TRUE'"></recommendBatch>
</u-swipe-action>
<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">
<com-fg-card :detail='fg' class="scan_view"></com-fg-card>
</view>
</view>
<recommend-qty-edit ref="receiptEdit" :dataContent="editItem" :settingParam="settingParam" @confirm="confirm">
</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>
<view class="" style="background-color: #fff;">
<u-collapse>
<u-collapse-item>
<template #title>
<itemCompareQty :dataContent="dataContent" :handleQty="dataContent.handleQty"></itemCompareQty>
</template>
<view class="" v-for="(item,index) in dataContent.subList" :key="index">
<u-swipe-action ref="swipeAction" v-if="index==0"
:options="item.scaned?scanOptions:detailOptions"
@click="(...event)=>swipeClick(event,item)"
:class="item.scaned?'scan_view':''">
<recommend :detail="item" :isShowFromLocation="false"
:isShowToLocation="settingParam.allowModifyLocation=='TRUE'"></recommend>
</u-swipe-action>
<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">
<com-fg-card :detail='fg' class="scan_view"></com-fg-card>
</view>
</view>
</u-collapse-item>
</u-collapse>
<recommend-qty-edit ref="receiptEdit" :dataContent="editItem" :settingParam="settingParam" @confirm="confirm">
</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>
<script setup lang="ts">
import itemCompareQty from '@/mycomponents/item/itemCompareQty.vue'
import recommendBatch from '@/mycomponents/recommend/recommendBatch.vue'
import recommendQtyEdit from '@/mycomponents/qty/recommendQtyEdit.vue'
import productDetailInfoPopup from '@/pages/productReceipt/coms/productDetailInfoPopup.vue'
import winScanLocation from "@/mycomponents/scan/winScanLocation.vue"
import comFgCard from "@/pages/productReceipt/coms/comFgCard.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 config from '@/static/config.js'
import {
getRemoveOption,
getEditRemoveOption
} from '@/common/array.js';
import { ref, watch, onMounted, computed,nextTick } from 'vue';
import { useCountStore } from '@/store'
const store = useCountStore()
import itemCompareQty from '@/mycomponents/item/itemCompareQty.vue'
import Recommend from '@/mycomponents/recommend/recommend.vue'
import recommendQtyEdit from '@/mycomponents/qty/recommendQtyEdit.vue'
import productDetailInfoPopup from '@/pages/productReceipt/coms/productDetailInfoPopup.vue'
import winScanLocation from "@/mycomponents/scan/winScanLocation.vue"
import comFgCard from "@/pages/productReceipt/coms/comFgCard.vue"
import config from '@/static/config.js'
import {
getDetailOption,
getPurchaseReceiptOption
} from '@/common/array.js';
import {ref, watch, onMounted, computed, nextTick} from 'vue';
import {useCountStore} from '@/store'
const store = useCountStore()
const props = defineProps({
dataContent: {
type: Object,
@ -59,22 +60,17 @@ const props = defineProps({
type: Array,
default: null
},
isEdit: {
type: Boolean,
default: true
}
});
const emit = defineEmits(['updateData', 'remove']);
const showItem = ref({});
const editItem = ref({
record: {}
});
const settingParam = ref({})
const locatonItem = ref({});
const detailOptions = ref([]);
const scanOptions = ref([]);
const options = ref([]);
const removeOptions = ref([]);
const editAndRemoveOptions = ref([]);
const collapse1 = ref(null);
const receiptEdit = ref(null);
@ -90,11 +86,15 @@ watch(() => props.dataContent, (newDataContent, oldDataContent) => {
});
}
}
}, { immediate: true, deep: true });
}, {immediate: true, deep: true});
onMounted(() => {
removeOptions.value = getRemoveOption();
editAndRemoveOptions.value = getEditRemoveOption();
if (detailOptions.value.length == 0) {
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;
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>
<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"
@switchChangeWait="switchChangeWait" @onScanNumber="getScanNumber" :checkedToday="checkedToday"
:checkedWaitTask="checkedWaitTask"> </job-filter>
<view v-if="jobList.length > 0">
<uni-swipe-action ref="swipeAction">
<view v-for="(item, index) in jobList" :key="index">
<uni-swipe-action-item :right-options="item.status == '2' ? detailGiveupOptions : detailOptions"
@click="swipeClick($event, item)">
<com-product-job-card :dataContent="item" @click="openJobDetail(item)"></com-product-job-card>
</uni-swipe-action-item>
</view>
</uni-swipe-action>
<view v-for="(item, index) in jobList" :key="index">
<u-swipe-action ref="swipeAction"
@click="(...event)=>swipeClick(event, item)"
:options="item.status == '2' ? detailGiveupOptions : detailOptions">
<com-product-job-card :dataContent="item" @click="openJobDetail(item)"></com-product-job-card>
</u-swipe-action>
</view>
<job-list-popup ref="jobListPopupRef" @selectedItem="selectedItem"></job-list-popup>
<job-info-popup ref="jobInfoPopupRef"></job-info-popup>
<u-loadmore :status="loadingType" v-if="jobList.length > 0" />
<win-scan-button @goScan="openScanPopup" v-if="jobList.length > 0"></win-scan-button>
<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>
<view v-if="jobList.length > 0">
<uni-swipe-action ref="swipeAction">
<view v-for="(item, index) in jobList" :key="index">
<uni-swipe-action-item :right-options="item.status == '2' ? detailGiveupOptions : detailOptions" @click="swipeClick($event, item)">
<com-product-job-card :dataContent="item" @click="openJobDetail(item)"></com-product-job-card>
</uni-swipe-action-item>
</view>
</uni-swipe-action>
<view v-for="(item, index) in jobList" :key="index">
<u-swipe-action ref="swipeAction"
:options="item.status == '2' ? detailGiveupOptions : detailOptions"
@click="(...event)=>swipeClick(event, item)">
<com-product-job-card :dataContent="item" @click="openJobDetail(item)"></com-product-job-card>
</u-swipe-action>
</view>
<job-list-popup ref="jobListPopup" @selectedItem="selectedItem"></job-list-popup>
<job-info-popup ref="jobInfoPopup"></job-info-popup>
<u-loadmore :status="loadingType" v-if="jobList.length > 0" />
<comMessage ref="comMessage"></comMessage>
</view>

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

@ -237,15 +237,17 @@ const getScanResult = (result) => {
if (itemDetail == undefined) {
showErrorMessage(`批次[${batch}]不在任务列表中`)
} else if (itemDetail.scaned) {
showErrorMessage(`批次[${batch}]已经扫描`)
itemDetail.handleQty = calc.add(Number(result.label.qty),itemDetail.handleQty);
} else {
itemDetail.scaned = true
itemDetail.handleQty = Number(result.label.qty)
itemDetail.toLocationCode = toLocationCode.value
// itemDetail.toLocationCode = toLocationCode.value
itemDetail.labelQty = Number(result.label.qty)
calcHandleQty(detailSource.value)
continueScan()
}
calcHandleQty(detailSource.value)
}
}
@ -301,7 +303,7 @@ const showMessageHint = (hint, callback) => {
})
}
const commit = () => {
const commit = async () => {
scanCount.value = getScanCount(subList.value)
if (scanCount.value == 0) {
showErrorMessage('扫描数为0,请先扫描')
@ -316,18 +318,40 @@ const commit = () => {
}else{
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 (checkCount()) {
submitJob()
if(managementType.value == 'BY_BATCH' || managementType.value == 'BY_QUANTITY'){
if (checkCountBatch()) {
submitJob();
}
}else{
if (checkCount()) {
submitJob();
}
}
} else if (scanCount.value < subList.value.length) {
//
if (jobContent.value.allowPartialComplete == 'TRUE') {
//
if (checkCount()) {
submitJob()
if(managementType.value == 'BY_BATCH' || managementType.value == 'BY_QUANTITY'){
if (checkCountBatch()) {
submitJob();
}
}else{
if (checkCount()) {
submitJob();
}
}
} else {
//
@ -361,6 +385,33 @@ const checkCount = () => {
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 = () => {
proxy.$modal.loading('提交中....')
const itemCodes = []

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

@ -12,7 +12,7 @@
<u-loadmore :status="loadingType" v-if="jobList.length > 0" />
</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>
<jobListCom ref="jobListRef" @selectItem="selectItem"></jobListCom>
<com-message ref="comMessageRef" />
@ -71,6 +71,8 @@ const jobListPopupRef = ref()
const scanPopup = ref()
const jobListRef = ref()
const timer = ref(null)
const manageModel = import.meta.env.VITE_MANAGE_MODEL
onMounted(() => {
detailOptions.value = getDetailOption()
detailGiveupOptions.value = getDetailGiveupOption()

Loading…
Cancel
Save