|
@ -30,16 +30,17 @@ |
|
|
</view> |
|
|
</view> |
|
|
<win-scan-button @goScan="openScanPopup"></win-scan-button> |
|
|
<win-scan-button @goScan="openScanPopup"></win-scan-button> |
|
|
</view> |
|
|
</view> |
|
|
<win-scan-pack-and-location ref="scanPopup" @getResult="getScanResult" :allowModifyLocation="false"> </win-scan-pack-and-location> |
|
|
<win-scan-pack-and-location ref="scanPopup" @getResult="getScanResult" :allowModifyLocation="false" :queryBalance="false"> </win-scan-pack-and-location> |
|
|
<com-message ref="comMessageRef" /> |
|
|
<com-message ref="comMessageRef" /> |
|
|
<win-scan-location ref="scanLocationCode" title="来源库位" @getLocation="getLocation" :locationAreaTypeList="fromLocationAreaTypeList"></win-scan-location> |
|
|
<win-scan-location ref="scanLocationCode" title="来源库位" @getLocation="getLocation" :locationAreaTypeList="fromLocationAreaTypeList"></win-scan-location> |
|
|
|
|
|
<balance-select ref="balanceSelectRef" @onSelectItem="selectBalanceItem"></balance-select> |
|
|
</view> |
|
|
</view> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
<script setup lang="ts"> |
|
|
import { ref, getCurrentInstance, nextTick } from 'vue' |
|
|
import { ref, getCurrentInstance, nextTick } from 'vue' |
|
|
import { onLoad, onNavigationBarButtonTap, onReady, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app' |
|
|
import { onLoad, onNavigationBarButtonTap, onReady, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app' |
|
|
import { repleinshRecordSubmit, validateItemAndLocation, getPutawayRecommendLocation } from '@/api/request2.js' |
|
|
import { repleinshRecordSubmit, validateItemAndLocation, getPutawayRecommendLocation, getBalanceByFilter } from '@/api/request2.js' |
|
|
|
|
|
|
|
|
import { goHome, updateTitle, getCurrDateTime, getPackingNumberAndBatchByList, deepCopyData } from '@/common/basic.js' |
|
|
import { goHome, updateTitle, getCurrDateTime, getPackingNumberAndBatchByList, deepCopyData } from '@/common/basic.js' |
|
|
|
|
|
|
|
@ -59,6 +60,7 @@ import winScanLocation from '@/mycomponents/scan/winScanLocation.vue' |
|
|
import winScanPackAndLocation from '@/mycomponents/scan/winScanPackAndLocation.vue' |
|
|
import winScanPackAndLocation from '@/mycomponents/scan/winScanPackAndLocation.vue' |
|
|
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue' |
|
|
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue' |
|
|
import recordDetailCard from '@/mycomponents/record/recordDetailCard.vue' |
|
|
import recordDetailCard from '@/mycomponents/record/recordDetailCard.vue' |
|
|
|
|
|
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue' |
|
|
import { useCountStore } from '@/store' |
|
|
import { useCountStore } from '@/store' |
|
|
// 获取自定义的store |
|
|
// 获取自定义的store |
|
|
const store = useCountStore() |
|
|
const store = useCountStore() |
|
@ -78,6 +80,9 @@ const recommendLocationList = ref([]) // 推荐库位列表 |
|
|
const fromWarehouseCode = ref('') // 来源仓库 |
|
|
const fromWarehouseCode = ref('') // 来源仓库 |
|
|
const businessTypeCode = ref('Repleinment') |
|
|
const businessTypeCode = ref('Repleinment') |
|
|
const toLocationCode = ref('') |
|
|
const toLocationCode = ref('') |
|
|
|
|
|
const resultData = ref({}) |
|
|
|
|
|
const balanceSelectRef = ref({}) |
|
|
|
|
|
|
|
|
const managementList = ref([]) |
|
|
const managementList = ref([]) |
|
|
// const positionList = ref([]) |
|
|
// const positionList = ref([]) |
|
|
// const show = ref(false) |
|
|
// const show = ref(false) |
|
@ -105,8 +110,129 @@ onNavigationBarButtonTap((e) => { |
|
|
goHome() |
|
|
goHome() |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
|
|
|
const getBalance = (label, packageInfo, callback) => { |
|
|
|
|
|
const filters = [] |
|
|
|
|
|
|
|
|
|
|
|
if (packageInfo.parentNumber) { |
|
|
|
|
|
const packingNumber = `${packageInfo.parentNumber},${label.packingNumber}` |
|
|
|
|
|
filters.push({ |
|
|
|
|
|
column: 'packingNumber', |
|
|
|
|
|
action: 'in', |
|
|
|
|
|
value: packingNumber |
|
|
|
|
|
}) |
|
|
|
|
|
} else { |
|
|
|
|
|
filters.push({ |
|
|
|
|
|
column: 'packingNumber', |
|
|
|
|
|
action: '==', |
|
|
|
|
|
value: label.packingNumber |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
filters.push({ |
|
|
|
|
|
column: 'itemCode', |
|
|
|
|
|
action: '==', |
|
|
|
|
|
value: label.itemCode |
|
|
|
|
|
}) |
|
|
|
|
|
filters.push({ |
|
|
|
|
|
column: 'batch', |
|
|
|
|
|
action: '==', |
|
|
|
|
|
value: label.batch |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
if (fromInventoryStatuses.value != null && fromInventoryStatuses.value != '') { |
|
|
|
|
|
filters.push({ |
|
|
|
|
|
column: 'inventoryStatus', |
|
|
|
|
|
action: 'in', |
|
|
|
|
|
value: fromInventoryStatuses.value |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const params = { |
|
|
|
|
|
filters, |
|
|
|
|
|
pageNo: 1, |
|
|
|
|
|
pageSize: 100 |
|
|
|
|
|
} |
|
|
|
|
|
getBalanceByFilter(params) |
|
|
|
|
|
.then((res) => { |
|
|
|
|
|
callback(res.data) |
|
|
|
|
|
}) |
|
|
|
|
|
.catch((err) => { |
|
|
|
|
|
showErrorMessage(err.message) |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
const getScanResult = (result) => { |
|
|
const getScanResult = (result) => { |
|
|
|
|
|
resultData.value = result |
|
|
|
|
|
const packageInfo = result.package |
|
|
|
|
|
getBalance(result.label, packageInfo, (balances) => { |
|
|
|
|
|
// 扫描的是外包装 |
|
|
|
|
|
const s = '' |
|
|
|
|
|
if (!result.package.parentNumber) { |
|
|
|
|
|
if (balances.list.length == 0) { |
|
|
|
|
|
showErrorMessage('未查找到该包装的库存信息,请重新扫描') |
|
|
|
|
|
} else { |
|
|
|
|
|
const newBalances = balances.list.filter((b) => b.locationCode == fromLocationCode.value) |
|
|
|
|
|
if (newBalances.length == 0) { |
|
|
|
|
|
showErrorMessage('未查找到该包装的库存信息,请重新扫描') |
|
|
|
|
|
} else if (newBalances.length == 1) { |
|
|
|
|
|
const balance = newBalances[0] |
|
|
|
|
|
result.balance = balance |
|
|
|
|
|
afterGetBalance(result) |
|
|
|
|
|
} else { |
|
|
|
|
|
showBalanceSelect(newBalances) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
// 扫描的是小包装 |
|
|
|
|
|
if (balances.list.length == 0) { |
|
|
|
|
|
showErrorMessage('未查找到该包装的库存信息,请重新扫描') |
|
|
|
|
|
} else { |
|
|
|
|
|
// 小包装库存 |
|
|
|
|
|
const subPackitems = balances.list.filter((r) => r.packingNumber == packageInfo.number) |
|
|
|
|
|
// 外包装库存 |
|
|
|
|
|
const subParentPackitems = balances.list.filter((r) => r.packingNumber == packageInfo.parentNumber && r.locationCode == fromLocationCode.value) |
|
|
|
|
|
|
|
|
|
|
|
// 小包装没有库存, |
|
|
|
|
|
if (subPackitems.length == 0) { |
|
|
|
|
|
// 外包装有库存,出库后剩余库存未转换为出库包装规格 |
|
|
|
|
|
|
|
|
|
|
|
if (subParentPackitems.length > 0) { |
|
|
|
|
|
if (subParentPackitems.length == 1) { |
|
|
|
|
|
const balance = subParentPackitems[0] |
|
|
|
|
|
balance.qty = packageInfo.qty |
|
|
|
|
|
result.balance = balance |
|
|
|
|
|
afterGetBalance(result) |
|
|
|
|
|
} else { |
|
|
|
|
|
showBalanceSelect(subParentPackitems) |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
showErrorMessage(`按外包装【${packageInfo.parentNumber}】和子包装【${packageInfo.number}】都未查找到库存余额`) |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
let locationCode = fromLocationCode.value |
|
|
|
|
|
if (balances.list == 1) { |
|
|
|
|
|
locationCode = balances.list[0].locationCode |
|
|
|
|
|
} else { |
|
|
|
|
|
const manyBlances = balances.list.filter((r) => r.locationCode != fromLocationCode.value) |
|
|
|
|
|
if (manyBlances.length > 0) { |
|
|
|
|
|
locationCode = manyBlances[0].locationCode |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
showErrorMessage(`该包装【${packageInfo.number}】在库位【${locationCode}】已经有库存余额,请重新扫描`) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const showBalanceSelect = (items) => { |
|
|
|
|
|
balanceSelectRef.value.openPopup(items) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const selectBalanceItem = (balance) => { |
|
|
|
|
|
afterGetBalance(resultData.value, balance) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const afterGetBalance = (result) => { |
|
|
const { balance } = result |
|
|
const { balance } = result |
|
|
const { label } = result |
|
|
const { label } = result |
|
|
const pack = result.package |
|
|
const pack = result.package |
|
|