Browse Source

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

syhx_app_vue3
王志国 2 weeks ago
parent
commit
91c322fb5b
  1. 8
      src/pages/productRecycle/coms/comRecycleJobCard.vue
  2. 5
      src/pages/productRecycle/job/productRecycleJob.vue
  3. 170
      src/pages/productRecycle/job/productRecycleJobDetail.vue

8
src/pages/productRecycle/coms/comRecycleJobCard.vue

@ -1,6 +1,6 @@
<template>
<job-com-main-card :dataContent="dataContent">
<jobComMainDetailCard :dataContent="dataContent"></jobComMainDetailCard>
<jobComMainDetailCard :dataContent="dataContent" :isShowToLocation='isShowToLocation'></jobComMainDetailCard>
</job-com-main-card>
</template>
@ -12,7 +12,11 @@ const props = defineProps({
dataContent: {
type: Object,
default: {}
}
},
isShowToLocation: {
type: Boolean,
default: true
},
})
</script>

5
src/pages/productRecycle/job/productRecycleJob.vue

@ -4,7 +4,7 @@
<job-filter ref="filter" otherTitle="ASN" @switchChangeToday="switchChangeToday" @switchChangeWait="switchChangeWait" @onScanNumber="getScanNumber" @onScanAsnNumber="getScanAsnNumber" :checkedToday="checkedToday" :checkedWaitTask="checkedWaitTask"> </job-filter>
<view v-if="jobList.length > 0" class="u-p-20">
<u-swipe-action :show="item.show" :index="index" v-for="(item, index) in jobList" :key="index" :options="item.status == '2' ? detailGiveupOptions : detailOptions" bg-color="rgba(255,255,255,0)" class="u-m-b-20" @click="swipeClick">
<comRecycleJobCard :dataContent="item" @click="openJobDetail(item)"></comRecycleJobCard>
<comRecycleJobCard :dataContent="item" @click="openJobDetail(item)" :isShowToLocation='false'></comRecycleJobCard>
</u-swipe-action>
<return-job-list-popup ref="jobListPopupRef" @selectedItem="selectedItem"></return-job-list-popup>
<return-info-popup ref="jobInfoPopupRef"></return-info-popup>
@ -128,6 +128,9 @@ const getList = (type) => {
if (type === 'refresh') {
uni.stopPullDownRefresh()
}
res.data.list.forEach(item=>{
item.fromLocationCode = item.toLocationCode
})
const { list } = res.data
totalCount.value = res.data.total
updateTitle(`${title.value}(${totalCount.value})`)

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

@ -46,7 +46,9 @@ import { getProductRecycleDetail, productRecycleJobsubmit, cancleTakeProductRecy
import { goHome, getCurrDateTime, getPackingNumberAndBatch, navigateBack } from '@/common/basic.js'
import { getInventoryStatusName } from '@/common/directory.js'
import {
calc
} from '@/common/calc'
import { getDataSource, createRecordInfo, calcHandleQty, getScanCount } from '@/common/detail.js'
import { getManagementPrecisions } from '@/common/balance.js'
@ -76,6 +78,7 @@ const comMessageRef = ref()
const jobDetailPopup = ref()
const fromLocationCode = ref()
const toLocationAreaTypeList = ref([])
const labelInfo = ref({})
onLoad((option) => {
uni.setNavigationBarTitle({
title: `${option.title}详情`
@ -162,8 +165,9 @@ const getDetail = () => {
getManagementPrecisions(itemCodes, fromLocationCode.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'
}
})
} else {
@ -202,8 +206,16 @@ const calcScanCount = (closeScan) => {
const updateData = () => {
calcHandleQty1()
}
const getScanResult = (result) => {
const getScanResult = (result)=> {
console.log(result.label)
labelInfo.value = result.label
if(managementType.value == 'BY_BATCH' ||managementType.value == "BY_QUANTITY" ){
getScanResultAfterBatch(result)
}else{
getScanResultAfter(result)
}
}
const getScanResultAfter = (result) => {
try {
const { packingNumber } = result.label
const { batch } = result.label
@ -275,6 +287,105 @@ const getScanResult = (result) => {
showErrorMessage(e.message)
}
}
const getScanResultAfterBatch = (result)=> {
try {
const packingNumber = result.label.packingNumber;
const batch = result.label.batch;
const qty = result.label.qty;
const itemCode = result.label.itemCode;
let itemDetail = undefined;
const detail = detailSource.value.find(r => r.itemCode == itemCode);
if (detail == undefined) {
showMessage("物料号【" + itemCode + "】不在列表中")
} else {
detail.scaned = true
let balanceStatus = getInventoryStatusName(result.balance.inventoryStatus);
//
itemDetail = detail.subList.find(r => {
return r.batch == batch &&
r.fromLocationCode == result.fromLocationCode &&
r.inventoryStatus == result.balance.inventoryStatus
})
if (itemDetail) {
//
if (itemDetail.scaned) {
// this.showErrorMessage("\n" + batch + "\n" + result
// .fromLocationCode + "\n" + balanceStatus + "\n")
itemDetail.handleQty = calc.add(itemDetail.handleQty,Number(result.label.qty));
itemDetail.balanceQty = Number(result.label.qty);
} else {
itemDetail.scaned = true;
itemDetail.handleQty = Number(result.label.qty);
itemDetail.balanceQty = Number(result.label.qty);
itemDetail.toInventoryStatus = result.balance.inventoryStatus;
itemDetail.inventoryStatus = result.balance.inventoryStatus;
itemDetail.balance = result.balance;
itemDetail.balance.balanceQty = Number(result.balance.qty);
itemDetail.balance.packQty = Number(result.package.packQty)
itemDetail.balance.packUnit = result.package.packUnit
}
calcHandleQty();
} else {
//
itemDetail = detail.subList.find(r => {
return r.batch == batch &&
r.fromLocationCode == result.fromLocationCode
})
if (itemDetail) {
let itemStatus = getInventoryStatusName(itemDetail.inventoryStatus);
//
if(balanceStatus!=itemStatus){
if (jobContent.value.allowModifyInventoryStatus == "TRUE") {
showQuestionMessage('实际库存状态[' + balanceStatus + ']与推荐库存状态[' + itemStatus +
']不一致,是否继续回收?', res => {
if (res) {
itemDetail.scaned = true;
itemDetail.handleQty = itemDetail.handleQty ? calc.add(itemDetail.handleQty,Number(result.label.qty)) : Number(result.label.qty);
itemDetail.toInventoryStatus = result.balance.inventoryStatus;
itemDetail.inventoryStatus = result.balance.inventoryStatus;
itemDetail.balance = result.balance;
itemDetail.balance.balanceQty = result.balance.qty;
itemDetail.balance.packQty = result.package.packQty
itemDetail.balance.packUnit = result.package.packUnit
calcHandleQty();
} else {
scanPopupGetFocus();
}
});
} else {
showQuestionMessage('任务中不允许修改库存状态,实际库存状态[' + balanceStatus + ']与推荐库存状态[' +
itemStatus +
']不一致,不允许回收!', res => {
scanPopupGetFocus();
});
}
//
}else{
itemDetail.scaned = true;
itemDetail.handleQty = itemDetail.handleQty ? calc.add(itemDetail.handleQty,Number(result.label.qty)) : Number(result.label.qty);
itemDetail.toInventoryStatus = result.balance.inventoryStatus;
itemDetail.inventoryStatus = result.balance.inventoryStatus;
itemDetail.balance = result.balance;
itemDetail.balance.balanceQty = result.balance.qty;
itemDetail.balance.packQty = result.package.packQty
itemDetail.balance.packUnit = result.package.packUnit
calcHandleQty();
}
} else {
showErrorMessage("\n批次【" + batch + "】\n库位【" + result
.fromLocationCode + "】\n状态【" + balanceStatus + "】\n不在任务列表中")
}
}
}
scanPopupGetFocus();
} catch (e) {
showErrorMessage(e.message);
}
}
const commit = () => {
scanCount.value = getScanCount(subList.value)
if (scanCount.value == 0) {
@ -284,12 +395,20 @@ const commit = () => {
// //
// //
if (scanCount.value == subList.value.length) {
checkCount();
if(managementType.value == 'BY_BATCH' ||managementType.value == "BY_QUANTITY" ){
checkCountBatch()
}else{
checkCount();
}
} else if (scanCount.value < subList.value.length) {
//
if (jobContent.value.allowPartialComplete == "TRUE") {
//
checkCount();
if(managementType.value == 'BY_BATCH' ||managementType.value == "BY_QUANTITY" ){
checkCountBatch()
}else{
checkCount();
}
} else {
//
comMessageRef.value.showErrorMessage("任务明细未全部完成,不允许部分提交!", res => {
@ -327,6 +446,41 @@ const checkCount = ()=>{
submitJob()
}
}
const checkCountBatch = ()=> {
//
let str = ''
let str1 = ''
detailSource.value.forEach((item) => {
item.subList.forEach(cur => {
if (cur.qty != cur.handleQty) {
let tempHandleQty = 0
if(cur.handleQty){
tempHandleQty=cur.handleQty
}else {
tempHandleQty =0
}
str += `物料号【${item.itemCode}】提交数量【${tempHandleQty}】与任务物料数量【${cur.qty}】不一致`
}
if(cur.handleQty > cur.balance.qty){
str1 += `物料号【${item.itemCode}】提交数量【${cur.handleQty}】不可以大于库存数量【${cur.balance.qty}`
}
})
})
if (str1) {
comMessageRef.value.showMessage(str1);
return
}
if (str) {
str = '任务明细未全部完成,是否提交?\n'+ str
comMessageRef.value.showQuestionMessage1(str, 'red', res => {
if (res) {
this.submitJob()
}
});
} else {
submitJob()
}
}
const submitJob = () => {
proxy.$modal.loading('提交中...')
let itemCodes = []
@ -368,7 +522,7 @@ const setParams = () => {
let info = getPackingNumberAndBatch(this.managementList, detail.itemCode, detail.packingNumber, detail.batch);
detail.toPackingNumber = info.packingNumber;
detail.packingNumber = info.packingNumber;
detail.fromPackingNumber = info.packingNumber;
detail.fromPackingNumber = labelInfo.value.packingNumber;
subList.push(detail)
}
})

Loading…
Cancel
Save