|
@ -38,7 +38,9 @@ |
|
|
<uni-swipe-action-item @click="swipeClick($event, item)" :right-options="item.scaned ? scanOptions : detailOptions"> |
|
|
<uni-swipe-action-item @click="swipeClick($event, item)" :right-options="item.scaned ? scanOptions : detailOptions"> |
|
|
<view class="uni-flex uni-row" style="align-items: center" :class="item.scaned ? 'scan_view' : 'item'"> |
|
|
<view class="uni-flex uni-row" style="align-items: center" :class="item.scaned ? 'scan_view' : 'item'"> |
|
|
<view class="" style="font-size: 30rpx; font-weight: bold"> {{ index + 1 }}. </view> |
|
|
<view class="" style="font-size: 30rpx; font-weight: bold"> {{ index + 1 }}. </view> |
|
|
<comCountDetailcards :ref="'countDetail_' + index" :dataContent="item" :index="index" @editItem="editItem" :settingParam="jobContent" @remove="updateData" @updateData="updateData"> </comCountDetailcards> |
|
|
<comCountDetailcards :ref="'countDetail_'+index" :dataContent="item" :index="index" @editItem="editItem" |
|
|
|
|
|
:settingParam="jobContent" @remove="updateData" @updateData="updateData"> |
|
|
|
|
|
</comCountDetailcards> |
|
|
</view> |
|
|
</view> |
|
|
<view class="split_line"></view> |
|
|
<view class="split_line"></view> |
|
|
</uni-swipe-action-item> |
|
|
</uni-swipe-action-item> |
|
@ -70,10 +72,11 @@ import { ref, getCurrentInstance, onMounted, nextTick, watch } from 'vue' |
|
|
import { onShow, onNavigationBarButtonTap, onReady, onReachBottom, onPullDownRefresh, onLoad, onBackPress } from '@dcloudio/uni-app' |
|
|
import { onShow, onNavigationBarButtonTap, onReady, onReachBottom, onPullDownRefresh, onLoad, onBackPress } from '@dcloudio/uni-app' |
|
|
import { getCountJobDetail, takeCountJob, cancleTakeCountJob, countJobSubmit } from '@/api/request2.js' |
|
|
import { getCountJobDetail, takeCountJob, cancleTakeCountJob, countJobSubmit } from '@/api/request2.js' |
|
|
|
|
|
|
|
|
import { goHome, navigateBack, compare } from '@/common/basic.js' |
|
|
import { goHome, navigateBack, getPackingNumberAndBatch ,compare } from '@/common/basic.js' |
|
|
|
|
|
|
|
|
import { getDetailOption, getDetailEditRemoveOption } from '@/common/array.js' |
|
|
import { getDetailOption, getDetailEditRemoveOption } from '@/common/array.js' |
|
|
import { getCountStageName } from '@/common/directory.js' |
|
|
import { getCountStageName } from '@/common/directory.js' |
|
|
|
|
|
import {getManagementPrecisions,} from '@/common/balance.js'; |
|
|
|
|
|
|
|
|
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
|
|
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
|
|
import comCountDetailcards from '@/pages/count/coms/comCountDetailcards.vue' |
|
|
import comCountDetailcards from '@/pages/count/coms/comCountDetailcards.vue' |
|
@ -107,7 +110,9 @@ const showItem = ref() |
|
|
const comMessageRef = ref() |
|
|
const comMessageRef = ref() |
|
|
const scanPopup = ref() |
|
|
const scanPopup = ref() |
|
|
const countQtyEditRef = ref() |
|
|
const countQtyEditRef = ref() |
|
|
|
|
|
const managementList = ref([]) |
|
|
|
|
|
const managementType = ref('') |
|
|
|
|
|
const emit = defineEmits(['removePack']) |
|
|
onLoad((option) => { |
|
|
onLoad((option) => { |
|
|
uni.setNavigationBarTitle({ |
|
|
uni.setNavigationBarTitle({ |
|
|
title: `${option.title}详情` |
|
|
title: `${option.title}详情` |
|
@ -192,7 +197,7 @@ const getDetail = () => { |
|
|
mask: true |
|
|
mask: true |
|
|
}) |
|
|
}) |
|
|
getCountJobDetail(id.value) |
|
|
getCountJobDetail(id.value) |
|
|
.then((res) => { |
|
|
.then(async (res) => { |
|
|
uni.hideLoading() |
|
|
uni.hideLoading() |
|
|
if (res.data == null) { |
|
|
if (res.data == null) { |
|
|
showMessage('未获取到详情') |
|
|
showMessage('未获取到详情') |
|
@ -208,6 +213,26 @@ const getDetail = () => { |
|
|
}) |
|
|
}) |
|
|
allDetails.value = res.data.subList |
|
|
allDetails.value = res.data.subList |
|
|
allCount.value = res.data.subList.length |
|
|
allCount.value = res.data.subList.length |
|
|
|
|
|
//获取管理模式,封装参数 |
|
|
|
|
|
let itemCodes = [] |
|
|
|
|
|
allDetails.value.forEach(item => { |
|
|
|
|
|
itemCodes.push(item.itemCode) |
|
|
|
|
|
item.scaned = false |
|
|
|
|
|
}) |
|
|
|
|
|
await getManagementPrecisions(itemCodes, fromLocationCode.value, res => { |
|
|
|
|
|
if (res.success) { |
|
|
|
|
|
managementList.value = res.list; |
|
|
|
|
|
managementType.value = managementList.value.some(item => item.ManagementPrecision == |
|
|
|
|
|
'BY_BATCH') ? 'BY_BATCH' : '' |
|
|
|
|
|
if (managementType.value == 'BY_BATCH') { |
|
|
|
|
|
allDetails.value.forEach(item => { |
|
|
|
|
|
item.packingNumber = '' |
|
|
|
|
|
item.toPackingNumber = '' |
|
|
|
|
|
item.fromPackingNumber = '' |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
initList() |
|
|
initList() |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
@ -252,6 +277,7 @@ const remove = (item, index) => { |
|
|
if (res) { |
|
|
if (res) { |
|
|
item.scaned = false |
|
|
item.scaned = false |
|
|
item.handleQty = 0 |
|
|
item.handleQty = 0 |
|
|
|
|
|
showList.value.splice(index, 1) |
|
|
emit('removePack') |
|
|
emit('removePack') |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
@ -288,36 +314,66 @@ const getScanResult = (result) => { |
|
|
const pack = result.package |
|
|
const pack = result.package |
|
|
const { batch } = result.label |
|
|
const { batch } = result.label |
|
|
const inventoryStatus = result.balance ? result.balance.inventoryStatus : 'OK' |
|
|
const inventoryStatus = result.balance ? result.balance.inventoryStatus : 'OK' |
|
|
const qty = result.balance ? result.balance.qty : 0 |
|
|
const qty = result.balance ? result.balance.qty : result.label.qty |
|
|
|
|
|
|
|
|
// 按物料、箱码、批次、状态匹配 |
|
|
// 按物料、箱码、批次、状态匹配 |
|
|
const items = allDetails.value.filter((r) => r.itemCode === itemCode && r.packingNumber === packingNumber && r.batch === batch && r.inventoryStatus === inventoryStatus) |
|
|
const items = allDetails.value.filter((r) => r.itemCode === itemCode && |
|
|
|
|
|
// r.packingNumber === packingNumber && |
|
|
|
|
|
r.batch === batch && |
|
|
|
|
|
r.inventoryStatus === inventoryStatus) |
|
|
// 不在任务列表中,是否添加库存 |
|
|
// 不在任务列表中,是否添加库存 |
|
|
if (items.length == 0) { |
|
|
if (items.length == 0) { |
|
|
comMessageRef.value.showQuestionMessage(`包装【${result.label.packingNumber}】不在任务列表中,是否要添加到列表中?`, (res) => { |
|
|
if(managementType.value == 'BY_BATCH'){ |
|
|
// 创建盘点信息,标记为已经扫描 |
|
|
comMessageRef.value.showQuestionMessage(`批次【${result.label.batch}】不在任务列表中,是否要添加到列表中?`, (res) => { |
|
|
if (res) { |
|
|
// 创建盘点信息,标记为已经扫描 |
|
|
const detail = createAddDetailInfo(pack, qty) |
|
|
if (res) { |
|
|
detail.countTime = new Date() |
|
|
const detail = createAddDetailInfo(pack, qty) |
|
|
allDetails.value.push(detail) |
|
|
detail.countTime = new Date() |
|
|
updateList() |
|
|
allDetails.value.push(detail) |
|
|
countQtyEditRef.value.openEditPopupShowSeconds(detail, null) |
|
|
updateList() |
|
|
} else { |
|
|
countQtyEditRef.value.openEditPopupShowSeconds(detail, null) |
|
|
scanPopupGetFocus() |
|
|
} else { |
|
|
} |
|
|
scanPopupGetFocus() |
|
|
}) |
|
|
} |
|
|
} else { |
|
|
}) |
|
|
const selectItem = items[0] |
|
|
}else { |
|
|
// 已经扫描 |
|
|
comMessageRef.value.showQuestionMessage(`包装【${result.label.packingNumber}】不在任务列表中,是否要添加到列表中?`, (res) => { |
|
|
if (selectItem.scaned) { |
|
|
// 创建盘点信息,标记为已经扫描 |
|
|
comMessageRef.value.showQuestionMessage(`包装【${result.label.packingNumber}】已经完成盘点,是否要编辑盘点结果?`, (res) => { |
|
|
|
|
|
if (res) { |
|
|
if (res) { |
|
|
currentEditItem.value = selectItem |
|
|
const detail = createAddDetailInfo(pack, qty) |
|
|
countQtyEditRef.value.openEditPopup(selectItem, null) |
|
|
detail.countTime = new Date() |
|
|
|
|
|
allDetails.value.push(detail) |
|
|
|
|
|
updateList() |
|
|
|
|
|
countQtyEditRef.value.openEditPopupShowSeconds(detail, null) |
|
|
} else { |
|
|
} else { |
|
|
scanPopupGetFocus() |
|
|
scanPopupGetFocus() |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
const selectItem = items[0] |
|
|
|
|
|
// 已经扫描 |
|
|
|
|
|
if (selectItem.scaned) { |
|
|
|
|
|
// 按批次 |
|
|
|
|
|
if(managementType.value == 'BY_BATCH'){ |
|
|
|
|
|
comMessageRef.value.showQuestionMessage(`批次【${result.label.batch}】已经完成盘点,是否要编辑盘点结果?`, (res) => { |
|
|
|
|
|
if (res) { |
|
|
|
|
|
currentEditItem.value = selectItem |
|
|
|
|
|
countQtyEditRef.value.openEditPopup(selectItem, null) |
|
|
|
|
|
} else { |
|
|
|
|
|
scanPopupGetFocus() |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}else { |
|
|
|
|
|
comMessageRef.value.showQuestionMessage(`包装【${result.label.packingNumber}】已经完成盘点,是否要编辑盘点结果?`, (res) => { |
|
|
|
|
|
if (res) { |
|
|
|
|
|
currentEditItem.value = selectItem |
|
|
|
|
|
countQtyEditRef.value.openEditPopup(selectItem, null) |
|
|
|
|
|
} else { |
|
|
|
|
|
scanPopupGetFocus() |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
// 未扫描,赋值 |
|
|
// 未扫描,赋值 |
|
|
selectItem.scaned = true |
|
|
selectItem.scaned = true |
|
@ -325,6 +381,7 @@ const getScanResult = (result) => { |
|
|
selectItem.handleQty = Number(qty) |
|
|
selectItem.handleQty = Number(qty) |
|
|
selectItem.packQty = pack.packQty |
|
|
selectItem.packQty = pack.packQty |
|
|
selectItem.packUnit = pack.packUnit |
|
|
selectItem.packUnit = pack.packUnit |
|
|
|
|
|
selectItem.parentPackingNumber = pack.parentPackingNumber |
|
|
selectItem.locationCode = fromLocationCode.value |
|
|
selectItem.locationCode = fromLocationCode.value |
|
|
selectItem.fromLocationCode = fromLocationCode.value |
|
|
selectItem.fromLocationCode = fromLocationCode.value |
|
|
|
|
|
|
|
@ -391,7 +448,7 @@ const createAddDetailInfo = (pack, qty) => { |
|
|
uom: pack.uom, |
|
|
uom: pack.uom, |
|
|
number: pack.number, |
|
|
number: pack.number, |
|
|
remark: '', |
|
|
remark: '', |
|
|
countQty: 0, |
|
|
countQty: Number(qty), |
|
|
balanceQty: Number(qty), |
|
|
balanceQty: Number(qty), |
|
|
fromLocationCode: fromLocationCode.value, |
|
|
fromLocationCode: fromLocationCode.value, |
|
|
locationCode: fromLocationCode.value, |
|
|
locationCode: fromLocationCode.value, |
|
@ -404,7 +461,10 @@ const createAddDetailInfo = (pack, qty) => { |
|
|
const commit = () => { |
|
|
const commit = () => { |
|
|
calcAllCount() |
|
|
calcAllCount() |
|
|
calcScanCount() |
|
|
calcScanCount() |
|
|
|
|
|
// if(scanCount.value){ |
|
|
|
|
|
// comMessageRef.value.showErrorMessage('请先进行扫描,再进行提交'); |
|
|
|
|
|
// return |
|
|
|
|
|
// } |
|
|
if (scanCount.value == allCount.value) { |
|
|
if (scanCount.value == allCount.value) { |
|
|
submitJob() |
|
|
submitJob() |
|
|
} else if (scanCount.value < allCount.value) { |
|
|
} else if (scanCount.value < allCount.value) { |
|
@ -426,7 +486,7 @@ const commit = () => { |
|
|
}) |
|
|
}) |
|
|
} else { |
|
|
} else { |
|
|
// 不允许部分提交,提示 |
|
|
// 不允许部分提交,提示 |
|
|
comMessageRef.value.showErrorMessage('请完成扫描后,再进行提交<br>' + `已经扫描[${scanCount.value}]总共[${getTotalCount()}]`, (res) => { |
|
|
comMessageRef.value.showErrorMessage('请完成扫描后,再进行提交\n' + `已经扫描[${scanCount.value}]总共[${getTotalCount()}]`, (res) => { |
|
|
if (res) { |
|
|
if (res) { |
|
|
openScanPopup() |
|
|
openScanPopup() |
|
|
} |
|
|
} |
|
@ -440,20 +500,34 @@ const submitJob = () => { |
|
|
title: '提交中....', |
|
|
title: '提交中....', |
|
|
mask: true |
|
|
mask: true |
|
|
}) |
|
|
}) |
|
|
const params = setParams() |
|
|
//获取管理模式,封装参数 |
|
|
countJobSubmit(params) |
|
|
let itemCodes = [] |
|
|
.then((res) => { |
|
|
allDetails.value.forEach(item => { |
|
|
uni.hideLoading() |
|
|
itemCodes.push(item.itemCode) |
|
|
if (res.data) { |
|
|
// item.scaned = false |
|
|
showCommitSuccessMessage(`提交成功<br>生成盘点记录<br>${res.data}`) |
|
|
}) |
|
|
} else { |
|
|
getManagementPrecisions(itemCodes, this.fromLocationCode, res => { |
|
|
showErrorMessage(`提交失败[${res.msg}]`) |
|
|
if (res.success) { |
|
|
} |
|
|
managementList.value = res.list |
|
|
}) |
|
|
const params = setParams() |
|
|
.catch((error) => { |
|
|
countJobSubmit(params) |
|
|
uni.hideLoading() |
|
|
.then((res) => { |
|
|
showErrorMessage(error) |
|
|
uni.hideLoading() |
|
|
}) |
|
|
const str = res.data || '' |
|
|
|
|
|
showCommitSuccessMessage("提交成功\n生成盘点记录\n" + str) |
|
|
|
|
|
// if (res.data) { |
|
|
|
|
|
// showCommitSuccessMessage(`提交成功\n生成盘点记录\n${res.data}`) |
|
|
|
|
|
// } else { |
|
|
|
|
|
// showErrorMessage(`提交失败[${res.msg}]`) |
|
|
|
|
|
// } |
|
|
|
|
|
}) |
|
|
|
|
|
.catch((error) => { |
|
|
|
|
|
uni.hideLoading() |
|
|
|
|
|
showErrorMessage(error) |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const setParams = () => { |
|
|
const setParams = () => { |
|
@ -463,6 +537,10 @@ const setParams = () => { |
|
|
allDetails.value.forEach((item) => { |
|
|
allDetails.value.forEach((item) => { |
|
|
if (item.scaned) { |
|
|
if (item.scaned) { |
|
|
item.countQty = item.handleQty |
|
|
item.countQty = item.handleQty |
|
|
|
|
|
let info = getPackingNumberAndBatch(this.managementList, item.itemCode, item.packingNumber, item.batch); |
|
|
|
|
|
item.toPackingNumber = info.packingNumber; |
|
|
|
|
|
item.packingNumber = info.packingNumber; |
|
|
|
|
|
item.fromPackingNumber = info.packingNumber; |
|
|
} |
|
|
} |
|
|
subList.push(item) |
|
|
subList.push(item) |
|
|
}) |
|
|
}) |
|
|