王志国
3 weeks ago
5 changed files with 855 additions and 32 deletions
@ -0,0 +1,126 @@ |
|||||
|
<template> |
||||
|
<view> |
||||
|
<view v-for="(item,index) in dataContent.subList"> |
||||
|
<u-swipe-action ref="swipeAction" |
||||
|
:class="item.scaned? 'scan_view':''" |
||||
|
:options="(item.scaned&&isEdit)?editAndRemoveOptions : item.scaned? removeOptions:options" |
||||
|
@click="(...event)=>swipeClick(event,item,index)"> |
||||
|
<item-qty :dataContent="item" :handleQty="item.handleQty" :isShowBalanceQty="false"></item-qty> |
||||
|
<location :locationCode="item.fromLocationCode"></location> |
||||
|
<recommendBalanceBatch style='margin-left: 20px;' :detail="item" :isShowLocation="false" |
||||
|
:isShowPack="item.packingNumber"></recommendBalanceBatch> |
||||
|
</u-swipe-action> |
||||
|
</view> |
||||
|
</view> |
||||
|
<qtyEdit ref="balanceQtyEdit" @confirm="confirm" :isShowStatus="true"></qtyEdit> |
||||
|
<detail-info-popup ref="detailInfoPopup"></detail-info-popup> |
||||
|
<comMessage ref="message"></comMessage> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import itemQty from '@/mycomponents/item/itemQty.vue' |
||||
|
import recommend from '@/mycomponents/recommend/recommend.vue' |
||||
|
import recommendBalance from '@/mycomponents/balance/recommendBalance.vue' |
||||
|
import recommendBalanceBatch from '@/mycomponents/balance/recommendBalanceBatch.vue' |
||||
|
import handleBalance from '@/mycomponents/balance/handleBalance.vue' |
||||
|
import recommendQtyEdit from '@/mycomponents/qty/recommendQtyEdit.vue' |
||||
|
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue' |
||||
|
import requiredLocation from '@/mycomponents/location/requiredLocation.vue' |
||||
|
import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue' |
||||
|
import qtyEdit from '@/mycomponents/qty/qtyEdit.vue' |
||||
|
import location from '@/mycomponents/balance/location.vue' |
||||
|
import detailInfoPopup from '@/pages/productionReceipt/coms/detailInfoPopup.vue' |
||||
|
import { |
||||
|
getDetailOption, |
||||
|
getPurchaseReceiptOption, |
||||
|
getRemoveOption, |
||||
|
getEditRemoveOption |
||||
|
} from '@/common/array.js'; |
||||
|
import {ref, watch, onMounted} from 'vue'; |
||||
|
|
||||
|
const props = defineProps({ |
||||
|
dataContent: { |
||||
|
type: Object, |
||||
|
default: () => ({}) |
||||
|
}, |
||||
|
settingParam: { |
||||
|
type: Object, |
||||
|
default: () => ({}) |
||||
|
}, |
||||
|
isEdit: { |
||||
|
type: Boolean, |
||||
|
default: true |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
const emit = defineEmits(['updateData']); |
||||
|
|
||||
|
const option = ref([]); |
||||
|
const showItem = ref({}); |
||||
|
const editItem = ref({}); |
||||
|
const batchItem = ref({}); |
||||
|
const detailOptions = ref([]); |
||||
|
const scanOptions = ref([]); |
||||
|
const options = ref([]); |
||||
|
const removeOptions = ref([]); |
||||
|
const editAndRemoveOptions = ref([]); |
||||
|
|
||||
|
const balanceQtyEdit = ref(null); |
||||
|
const receiptHint = ref(null); |
||||
|
const message = ref(null); |
||||
|
onMounted(() => { |
||||
|
removeOptions.value = getRemoveOption(); |
||||
|
editAndRemoveOptions.value = getEditRemoveOption(); |
||||
|
}); |
||||
|
|
||||
|
// 方法 |
||||
|
const resizeCollapse = () => { |
||||
|
// 实现 resizeCollapse 的逻辑 |
||||
|
}; |
||||
|
|
||||
|
const swipeClick = (e, item, index) => { |
||||
|
if (e.content.text === "编辑") { |
||||
|
edit(item); |
||||
|
} else if (e.content.text === "移除") { |
||||
|
remove(item, index); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const edit = (item) => { |
||||
|
console.log(item); |
||||
|
editItem.value = item; |
||||
|
// that.batchItem = batch; |
||||
|
// record.balance.balanceQty = record.balance.qty; |
||||
|
balanceQtyEdit.value?.openEditPopup(item); |
||||
|
}; |
||||
|
|
||||
|
const detail = (item) => { |
||||
|
showItem.value = item; |
||||
|
receiptHint.value?.openScanPopup(); |
||||
|
}; |
||||
|
|
||||
|
const remove = (item) => { |
||||
|
message.value?.showQuestionMessage("确定移除扫描信息?", (res) => { |
||||
|
if (res) { |
||||
|
item.handleQty = 0; |
||||
|
item.scaned = false; |
||||
|
// this.$emit('updateData', record) |
||||
|
} |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const confirm = (val) => { |
||||
|
console.log(val); |
||||
|
editItem.value.handleQty = val; |
||||
|
emit('updateData', editItem.value); |
||||
|
// let qty = 0; |
||||
|
// this.batchItem.Records.forEach(r => { |
||||
|
// qty += Number(r.qty); |
||||
|
// }) |
||||
|
// this.batchItem.handleQty = qty; |
||||
|
}; |
||||
|
|
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
</style> |
@ -0,0 +1,624 @@ |
|||||
|
<template> |
||||
|
<view> |
||||
|
<u-popup v-model="show" mode="bottom" :maskClick='false'> |
||||
|
<view class=""> |
||||
|
<view class="popup_box"> |
||||
|
<view class="pop_title"> |
||||
|
扫描箱码 |
||||
|
<text class="fr" @click="closeScanPopup()">关闭</text> |
||||
|
</view> |
||||
|
|
||||
|
<!-- <view class="uni-flex uni-row" style="align-items: center; |
||||
|
background-color: #fff; |
||||
|
margin-left: 20rpx; |
||||
|
margin-right: 20rpx; |
||||
|
margin-top: 8rpx; |
||||
|
border-radius: 8rpx;"> |
||||
|
<view class="uni-center" style="width: 25%; "> |
||||
|
来源库位 |
||||
|
</view> |
||||
|
<view class="" style="width: 75%; padding: 8rpx;"> |
||||
|
<uni-combox :candidates="fromLocationList" v-model="fromLocationCode" placeholder="请选择库位" |
||||
|
@confirm="fromLocationUpdate"></uni-combox> |
||||
|
</view> |
||||
|
</view> --> |
||||
|
|
||||
|
<view class=""> |
||||
|
<view class=""> |
||||
|
<win-com-scan ref="comscan" placeholder="箱标签" @getResult="onScan" :clearResult="true" |
||||
|
headerType="HPQ,HMQ" :isShowHistory="false"> |
||||
|
</win-com-scan> |
||||
|
|
||||
|
<view style="width: 100%;"> |
||||
|
<view style="width: 100%;" v-if="issueRecord.length>0"> |
||||
|
<view class="uni-flex uni-row space-between u-col-center"> |
||||
|
<view class="" style="padding: 10rpx;"> |
||||
|
历史记录 |
||||
|
</view> |
||||
|
<view class="" style="padding-right: 10rpx;"> |
||||
|
<u-icon :name="expendIcon" size="35rpx" @click="expands()"></u-icon> |
||||
|
</view> |
||||
|
</view> |
||||
|
<u-line class='line_color' style='padding-top: 10rpx;padding-bottom: 20rpx;'> |
||||
|
</u-line> |
||||
|
<scroll-view scroll-y="true" class="scroll-view" |
||||
|
v-if="expand&&issueRecord.length>0"> |
||||
|
<view class="uni-flex u-col" v-for="(record,index) in issueRecord"> |
||||
|
<view style="width: 100%;"> |
||||
|
<uni-swipe-action ref="swipeAction"> |
||||
|
<uni-swipe-action-item @click="swipeClick($event,record,index)" |
||||
|
:right-options="scanOptions"> |
||||
|
<view style="padding: 0px 10px"> |
||||
|
<balance :dataContent="record" :isShowFromLocation="false" |
||||
|
:isShowStatus='true' :isShowStdPack="false"></balance> |
||||
|
</view> |
||||
|
</uni-swipe-action-item> |
||||
|
</uni-swipe-action> |
||||
|
<u-line class='line_color'></u-line> |
||||
|
</view> |
||||
|
</view> |
||||
|
</scroll-view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</u-popup> |
||||
|
<balance-select ref="balanceSelect" @onSelectItem='selectBalanceItem'></balance-select> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
<balance-qty-edit ref="balanceQtyEdit" @confirm="confirm" :isShowStatus="true"></balance-qty-edit> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import winComScan from '@/mycomponents/scan/winComScan.vue' |
||||
|
import balance from '@/mycomponents/balance/balance.vue' |
||||
|
import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue' |
||||
|
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue' |
||||
|
|
||||
|
import { |
||||
|
getDetailOption, |
||||
|
getDetailEditRemoveOption |
||||
|
} from '@/common/array.js'; |
||||
|
import { |
||||
|
getWorkShopLineStation, |
||||
|
getBalanceByFilter, |
||||
|
getBalanceByParams, |
||||
|
} from '@/api/request2.js'; |
||||
|
|
||||
|
import { |
||||
|
calc |
||||
|
} from '@/common/calc.js'; |
||||
|
|
||||
|
import { |
||||
|
uniqueArray |
||||
|
} from '@/common/basic.js'; |
||||
|
|
||||
|
import { |
||||
|
getBalanceByManagementPrecision |
||||
|
} from '@/common/balance.js'; |
||||
|
import { |
||||
|
getDirectoryItemArray,getInventoryStatusDesc,getListLocationAreaTypeDesc |
||||
|
} from '@/common/directory.js'; |
||||
|
|
||||
|
|
||||
|
import { |
||||
|
getLabelInfo |
||||
|
} from '@/common/label.js'; |
||||
|
|
||||
|
import {ref, onMounted} from 'vue'; |
||||
|
const props = defineProps({ |
||||
|
title: { |
||||
|
type: String, |
||||
|
default: '' |
||||
|
} |
||||
|
}) |
||||
|
const emit = defineEmits(['closeScan','updateData','afterScan',]) |
||||
|
const dataContent = ref({}); |
||||
|
const jobContent = ref({}); |
||||
|
const expendIcon = ref('arrow-down'); |
||||
|
const show = ref(false); |
||||
|
const scanList = ref([]); |
||||
|
const toLocation = ref(null); |
||||
|
const toLocationCode = ref(''); |
||||
|
const fromLocationList = ref([]); |
||||
|
const fromLocationCode = ref(''); |
||||
|
const fromLocation = ref(null); |
||||
|
const issueRecord = ref([]); // 发料历史 |
||||
|
const expand = ref(true); |
||||
|
const scanOptions = ref({}); |
||||
|
const editItem = ref({}); |
||||
|
const positionList = ref([]); |
||||
|
const defaultValueList = ref([]); |
||||
|
const label = ref({}); |
||||
|
const fromInventoryStatuses = ref(""); |
||||
|
const packageInfo = ref({}); |
||||
|
const toLocationAreaTypeList = ref([]); |
||||
|
const headerType = ref('') |
||||
|
const showItem = ref({}) |
||||
|
|
||||
|
const balanceSelect = ref(null); |
||||
|
const comscan = ref(null); |
||||
|
const receiptHint = ref(null); |
||||
|
const comMessage = ref(null); |
||||
|
const detailOptions = ref(null) |
||||
|
onMounted(() => { |
||||
|
detailOptions.value = getDetailOption(); |
||||
|
scanOptions.value = getDetailEditRemoveOption(); |
||||
|
}); |
||||
|
|
||||
|
// 方法 |
||||
|
const openScanPopup = (content, jobcontent) => { |
||||
|
issueRecord.value = []; |
||||
|
dataContent.value = content; |
||||
|
jobContent.value = jobcontent; |
||||
|
initData(); |
||||
|
show.value = true; |
||||
|
setTimeout(() => { |
||||
|
getfocus(); |
||||
|
}, 500); |
||||
|
}; |
||||
|
|
||||
|
const openScanPopupForJobSimulate = (content, jobcontent, scanMessage) => { |
||||
|
issueRecord.value = []; |
||||
|
dataContent.value = content; |
||||
|
jobContent.value = jobcontent; |
||||
|
initData(); |
||||
|
getLabelInfo(scanMessage, headerType.value, (callback) => { |
||||
|
if (callback.success) { |
||||
|
onScan(callback); |
||||
|
} else { |
||||
|
showErrorMessage(callback.message); |
||||
|
} |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const closeScanPopup = () => { |
||||
|
losefocus(); |
||||
|
show.value = false |
||||
|
emit("closeScan"); |
||||
|
}; |
||||
|
|
||||
|
const initData = () => { |
||||
|
fromLocationList.value = []; |
||||
|
if (dataContent.value != null) { |
||||
|
fromInventoryStatuses.value = jobContent.value.outInventoryStatuses; |
||||
|
toLocation.value = dataContent.value.subList; |
||||
|
toLocationCode.value = dataContent.value.subList[0].toLocationCode; |
||||
|
toLocationAreaTypeList.value = getDirectoryItemArray(jobContent.value.toAreaTypes); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const showBalanceSelect = (items) => { |
||||
|
balanceSelect.value.openPopup(items); |
||||
|
}; |
||||
|
|
||||
|
const fromLocationUpdate = (fromlocation) => { |
||||
|
const location = fromLocationList.value.find(r => r === fromlocation); |
||||
|
if (location === undefined) { |
||||
|
fromLocationCode.value = ''; |
||||
|
showErrorMessage(`发料库位【${fromlocation}】不存在`, () => { |
||||
|
getfocus(); |
||||
|
}); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const onScan = (result) => { |
||||
|
console.log(11, result); |
||||
|
if (!result.package) { |
||||
|
showErrorMessage(`扫描数据错误[${result.label.code}]`, () => { |
||||
|
getfocus(); |
||||
|
}); |
||||
|
return; |
||||
|
} |
||||
|
if (toLocation.value && result.package.packUnit) { |
||||
|
const item = toLocation.value.find(r => r.itemCode === result.package.itemCode); |
||||
|
if (!item) { |
||||
|
showErrorMessage('扫描物料代码不属于该任务', () => { |
||||
|
getfocus(); |
||||
|
}); |
||||
|
return; |
||||
|
} |
||||
|
if (result.package.packUnit !== item.packUnit) { |
||||
|
getToLocationBalance(result); |
||||
|
} else { |
||||
|
getToLocationBalance(result); |
||||
|
} |
||||
|
} else { |
||||
|
getToLocationBalance(result); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const getToLocationBalance = (result) => { |
||||
|
uni.showLoading({ |
||||
|
title: '查询中', |
||||
|
mask: true |
||||
|
}); |
||||
|
const filters = []; |
||||
|
if (result.package.parentNumber) { |
||||
|
const packingNumber = `${result.package.parentNumber},${result.package.number}`; |
||||
|
filters.push({ |
||||
|
column: "packingNumber", |
||||
|
action: "in", |
||||
|
value: packingNumber |
||||
|
}); |
||||
|
} else { |
||||
|
filters.push({ |
||||
|
column: "packingNumber", |
||||
|
action: "==", |
||||
|
value: result.package.number |
||||
|
}); |
||||
|
} |
||||
|
filters.push({ |
||||
|
column: "itemCode", |
||||
|
action: "==", |
||||
|
value: result.package.itemCode |
||||
|
}); |
||||
|
filters.push({ |
||||
|
column: "batch", |
||||
|
action: "==", |
||||
|
value: result.package.batch |
||||
|
}); |
||||
|
filters.push({ |
||||
|
column: "areaType", |
||||
|
action: "in", |
||||
|
value: toLocationAreaTypeList.value.join(',') |
||||
|
}); |
||||
|
const params = { |
||||
|
filters: filters, |
||||
|
pageNo: 1, |
||||
|
pageSize: 100, |
||||
|
}; |
||||
|
getBalanceByFilter(params).then(res => { |
||||
|
uni.hideLoading(); |
||||
|
queryBalance(result); |
||||
|
}).catch(err => { |
||||
|
uni.hideLoading(); |
||||
|
showErrorMessage(err.message, () => { |
||||
|
getfocus(); |
||||
|
}); |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const queryBalance = (result) => { |
||||
|
try { |
||||
|
const packageInfo = result.package; |
||||
|
const itemCode = result.label.itemCode; |
||||
|
const packingCode = result.label.packingNumber; |
||||
|
const lot = result.label.batch; |
||||
|
const item = toLocation.value.find(r => r.itemCode === itemCode); |
||||
|
if (item === undefined) { |
||||
|
showErrorMessage(`未查找到物料【${itemCode}】的发料明细`, () => { |
||||
|
getfocus(); |
||||
|
}); |
||||
|
return; |
||||
|
} else { |
||||
|
item.scaned = true; |
||||
|
const params = { |
||||
|
itemCode: result.package.itemCode, |
||||
|
batch: result.label.batch, |
||||
|
packingNumber: result.label.packingNumber, |
||||
|
parentPackingNumber: result.package.parentNumber, |
||||
|
inventoryStatus: jobContent.value.outInventoryStatuses.split(','), |
||||
|
areaType: jobContent.value.fromAreaTypes.split(','), |
||||
|
bussinessCode: jobContent.value.businessType |
||||
|
}; |
||||
|
uni.showLoading({ |
||||
|
title: '查询中', |
||||
|
mask: true |
||||
|
}); |
||||
|
getBalanceByParams(params).then(res => { |
||||
|
if (res.data.length === 0) { |
||||
|
const status = getInventoryStatusDesc(params.inventoryStatus); |
||||
|
const areaType = getListLocationAreaTypeDesc(params.areaType); |
||||
|
const hint = `按物料号 [${params.itemCode}] \n` + |
||||
|
`包装号 [${params.packingNumber}] \n` + |
||||
|
`批次 [${params.batch}] \n` + |
||||
|
`状态 [${status}] \n` + |
||||
|
`库区 [${areaType}] \n` + |
||||
|
`未查找到库存余额`; |
||||
|
showErrorMessage(hint, () => { |
||||
|
getfocus(); |
||||
|
}); |
||||
|
} else if (res.data.length === 1) { |
||||
|
result.balance = res.data[0]; |
||||
|
if (result.label.packingNumber !== result.balance.packingNumber) { |
||||
|
result.balance.qty = Number(result.label.qty); |
||||
|
} else { |
||||
|
result.balance.qty = Number(result.balance.qty); |
||||
|
} |
||||
|
afterGetBalance(result.label, result.balance, result.package); |
||||
|
} else { |
||||
|
// 多条记录 |
||||
|
balanceSelect.value.openPopup(res.data); |
||||
|
} |
||||
|
uni.hideLoading(); |
||||
|
}).catch(error => { |
||||
|
uni.hideLoading(); |
||||
|
showErrorMessage(error, () => { |
||||
|
getfocus(); |
||||
|
}); |
||||
|
}); |
||||
|
} |
||||
|
} catch (e) { |
||||
|
uni.hideLoading(); |
||||
|
showErrorMessage(e.stack, () => { |
||||
|
getfocus(); |
||||
|
}); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const selectBalanceItem = (balance) => { |
||||
|
afterGetBalance(balance, balance, packageInfo.value); |
||||
|
}; |
||||
|
|
||||
|
const afterGetBalance = (label, balance, packageInfo) => { |
||||
|
try { |
||||
|
const itemCode = label.itemCode; |
||||
|
const packingCode = label.packingNumber; |
||||
|
const lot = label.batch; |
||||
|
const item = toLocation.value.find(r => r.itemCode === itemCode); |
||||
|
item.scaned = true; |
||||
|
fromLocationCode.value = balance.locationCode; |
||||
|
if (item.fromLocation !== fromLocationCode.value) { |
||||
|
if (item.batch !== undefined) { |
||||
|
addRecord(item.batch, label, balance, packageInfo); |
||||
|
} else { |
||||
|
if (jobContent.value.allowModifyBatch === "TRUE") { |
||||
|
showQuestionMessage(`在【${fromLocationCode.value}】库位下,批次【${lot}】不是推荐批次,是否要继续发料?`, (res) => { |
||||
|
if (res) { |
||||
|
const batch = createBatchInfo(label, balance, packageInfo); |
||||
|
if (fromLocation.Batchs.length > 0) { |
||||
|
batch.detail = fromLocation.Batchs[0].detail; |
||||
|
} |
||||
|
fromLocation.Batchs.unshift(batch); |
||||
|
getfocus(); |
||||
|
} |
||||
|
}); |
||||
|
} else { |
||||
|
showErrorMessage(`未查找到批次【${lot}】的发料明细`, () => { |
||||
|
getfocus(); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} else { |
||||
|
if (jobContent.value.allowModifyLocation === "TRUE") { |
||||
|
showQuestionMessage(`扫描物料[${itemCode}]的库位【${fromLocationCode.value}】与推荐的库位不一致,是否要继续发料?`, (res) => { |
||||
|
if (res) { |
||||
|
const locaion = createLocationInfo(label, balance, packageInfo); |
||||
|
item.Locations.push(locaion); |
||||
|
getfocus(); |
||||
|
emit("afterScan"); |
||||
|
} |
||||
|
}); |
||||
|
} else { |
||||
|
showErrorMessage(`扫描物料[${itemCode}]的库位【${fromLocationCode.value}】与推荐的库位不一致,不允许继续发料?`); |
||||
|
} |
||||
|
} |
||||
|
} catch (e) { |
||||
|
showErrorMessage(e.stack, () => { |
||||
|
getfocus(); |
||||
|
}); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const createLocationInfo = (label, balance, packageInfo) => { |
||||
|
const location = { |
||||
|
fromLocationCode: balance.locationCode, |
||||
|
qty: balance.qty, |
||||
|
uom: balance.uom, |
||||
|
handleQty: 0, |
||||
|
isNewAdd: true, |
||||
|
Batchs: [] |
||||
|
}; |
||||
|
const batch = createBatchInfo(label, balance, packageInfo); |
||||
|
batch.detail = balance; |
||||
|
batch.detail.fromLocationCode = balance.locationCode; |
||||
|
location.Batchs.push(batch); |
||||
|
return location; |
||||
|
}; |
||||
|
|
||||
|
const createBatchInfo = (label, balance, packageInfo) => { |
||||
|
const batch = { |
||||
|
batch: label.batch, |
||||
|
qty: 0, |
||||
|
uom: label.uom, |
||||
|
handleQty: Number(balance.qty), |
||||
|
Records: [] |
||||
|
}; |
||||
|
let record = {}; |
||||
|
if (balance !== null) { |
||||
|
record = creatRecordByBalance(balance, packageInfo); |
||||
|
batch.handleQty = Number(label.qty); |
||||
|
} else { |
||||
|
record = creatRecordByLabel(label, packageInfo); |
||||
|
batch.handleQty = Number(balance.qty); |
||||
|
} |
||||
|
batch.Records.push(record); |
||||
|
issueRecord.value.unshift(record); |
||||
|
return batch; |
||||
|
}; |
||||
|
|
||||
|
const creatRecordByLabel = (label, packageInfo) => { |
||||
|
const record = { |
||||
|
scaned: true, |
||||
|
itemCode: label.itemCode, |
||||
|
packingNumber: label.packingNumber, |
||||
|
parentPackingNumber: packageInfo.parentNumber, |
||||
|
batch: label.batch, |
||||
|
qty: Number(label.qty), |
||||
|
uom: label.uom, |
||||
|
inventoryStatus: "OK", |
||||
|
balance: null, |
||||
|
toLocationCode: toLocationCode.value, |
||||
|
supplierCode: label.supplierCode, |
||||
|
packUnit: packageInfo.packUnit, |
||||
|
packQty: packageInfo.packQty, |
||||
|
}; |
||||
|
return record; |
||||
|
}; |
||||
|
|
||||
|
const creatRecordByBalance = (balance, packageInfo) => { |
||||
|
balance.packQty = packageInfo.packQty; |
||||
|
balance.packUnit = packageInfo.packUnit; |
||||
|
const record = { |
||||
|
scaned: true, |
||||
|
itemCode: balance.itemCode, |
||||
|
packingNumber: packageInfo.number, |
||||
|
parentPackingNumber: packageInfo.parentNumber, |
||||
|
batch: packageInfo.batch, |
||||
|
qty: Number(balance.qty), |
||||
|
uom: balance.uom, |
||||
|
inventoryStatus: balance.inventoryStatus, |
||||
|
balance: balance, |
||||
|
toLocationCode: toLocationCode.value, |
||||
|
supplierCode: balance.supplierCode |
||||
|
}; |
||||
|
return record; |
||||
|
}; |
||||
|
|
||||
|
const calcBatchHandleQty = (balance) => { |
||||
|
dataContent.value.subList.forEach(item => { |
||||
|
if (item.itemCode === balance.itemCode) { |
||||
|
item.handleQty = balance.qty; |
||||
|
} |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const addRecord = (batch, label, balance, packageInfo) => { |
||||
|
let record = {}; |
||||
|
if (balance == null) { |
||||
|
record = creatRecordByLabel(label, packageInfo); |
||||
|
} else { |
||||
|
record = creatRecordByBalance(balance, packageInfo); |
||||
|
} |
||||
|
|
||||
|
if (packageInfo.parentNumber) { |
||||
|
let checkData = batch.Records.find(r => { |
||||
|
if (r.packingNumber === packageInfo.parentNumber && r.batch === packageInfo.batch) { |
||||
|
return r; |
||||
|
} |
||||
|
}); |
||||
|
if (checkData) { |
||||
|
// 提示已经扫描 |
||||
|
showErrorMessage(`箱码[${packageInfo.number}]批次[${packageInfo.batch}]的父包装已经扫描`); |
||||
|
} else { |
||||
|
calcBatchHandleQty(balance); |
||||
|
getfocus(); |
||||
|
} |
||||
|
} else { |
||||
|
calcBatchHandleQty(balance); |
||||
|
getfocus(); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const getfocus = () => { |
||||
|
if (comscan.value) { |
||||
|
comscan.value.getfocus(); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const losefocus = () => { |
||||
|
if (comscan.value) { |
||||
|
comscan.value.losefocus(); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const expands = () => { |
||||
|
expand.value = !expand.value; |
||||
|
expendIcon.value = expand.value ? "arrow-down" : "arrow-up"; |
||||
|
}; |
||||
|
|
||||
|
const swipeClick = (e, item, index) => { |
||||
|
if (e.content.text === "详情") { |
||||
|
detail(item); |
||||
|
} else if (e.content.text === "编辑") { |
||||
|
edit(item); |
||||
|
} else if (e.content.text === "移除") { |
||||
|
remove(item, index); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const edit = (item) => { |
||||
|
editItem.value = item; |
||||
|
item.balance.balanceQty = item.balance.qty; |
||||
|
balanceQtyEdit.value.openEditPopup(item.balance, item.qty); |
||||
|
}; |
||||
|
|
||||
|
const detail = (item) => { |
||||
|
showItem.value = item; |
||||
|
receiptHint.value.openScanPopup(); |
||||
|
}; |
||||
|
|
||||
|
const remove = (item, index) => { |
||||
|
showQuestionMessage("确定移除扫描信息?", (res) => { |
||||
|
if (res) { |
||||
|
item.handleQty = 0; |
||||
|
item.scaned = false; |
||||
|
emit('updateData', item); |
||||
|
} |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const packGetFocus = () => { |
||||
|
if (comscan.value) { |
||||
|
comscan.value.getfocus(); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const packLoseFocus = () => { |
||||
|
if (comscan.value) { |
||||
|
comscan.value.losefocus(); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const showMessage = (message, callback) => { |
||||
|
setTimeout(() => { |
||||
|
packLoseFocus(); |
||||
|
comMessage.value.showMessage(message, callback); |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const showErrorMessage = (message, callback) => { |
||||
|
setTimeout(() => { |
||||
|
packLoseFocus(); |
||||
|
comMessage.value.showErrorMessage(message, callback); |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const showQuestionMessage = (message, callback) => { |
||||
|
setTimeout(() => { |
||||
|
packLoseFocus(); |
||||
|
comMessage.value.showQuestionMessage(message, callback); |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const confirm = (val) => { |
||||
|
editItem.value.qty = Number(val); |
||||
|
emit('updateData', editItem.value); |
||||
|
}; |
||||
|
|
||||
|
const cancle = () => { |
||||
|
closeScanPopup(); |
||||
|
}; |
||||
|
|
||||
|
|
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss"> |
||||
|
button { |
||||
|
border: none; |
||||
|
} |
||||
|
|
||||
|
button::after { |
||||
|
border: none |
||||
|
} |
||||
|
|
||||
|
.scroll-view { |
||||
|
overflow-y: scroll; |
||||
|
height: auto; |
||||
|
max-height: 300rpx; |
||||
|
padding: 10rpx; |
||||
|
} |
||||
|
</style> |
Loading…
Reference in new issue