Browse Source

修改直接发料和发料任务扫描小包装2024/7/5 13:43:09

hella_vue3
zhang_li 3 months ago
parent
commit
e634cd5cdd
  1. 8
      src/api/request2.js
  2. 190
      src/mycomponents/scan/winComScanBalance.vue
  3. 146
      src/pages/issue/coms/comScanIssuePack.vue
  4. 1
      src/pages/issue/job/issueDetail.vue
  5. 177
      src/pages/issue/record/directIssue.vue
  6. 47
      src/pages/package/record/overPackageRecord.vue
  7. 22
      src/pages/repleinsh/coms/comScanReplishPack.vue

8
src/api/request2.js

@ -2591,3 +2591,11 @@ export function isCheckMesCode(code) {
export function getJimuPutawayJobDetail(data) { export function getJimuPutawayJobDetail(data) {
return http.post("/wms/jimu-report/getPutawayJobDetailForPDA",data) return http.post("/wms/jimu-report/getPutawayJobDetailForPDA",data)
} }
/**
* 查询库位后台自己查询管理模式
* @param {*}
*/
export function getBalanceByParams(data) {
return http.post("/wms/balance/getBalanceListByPackage",data)
}

190
src/mycomponents/scan/winComScanBalance.vue

@ -0,0 +1,190 @@
<template>
<view>
<uni-popup ref="popup" :mask-click="false">
<view class="popup_box">
<view class="pop_title uni-flex space-between">
<view class="" style="font-size: 35rpx"> 扫描{{ title }} </view>
<view class="">
<image class="fr icons_scan_close" src="/static/icons/icons_scan_close.svg" @click="closeScanPopup()"></image>
</view>
</view>
<view class="">
<view class="">
<win-com-scan ref="comscan" :placeholder="title" @getResult="getScanResult" :isShowHistory="isShowHistory" :clearResult="true" :headerType="headerType"></win-com-scan>
</view>
</view>
</view>
</uni-popup>
<balance-select ref="balanceSelect" @onSelectItem="selectBalanceItem"></balance-select>
<!-- 模拟扫描功能 -->
</view>
<comMessage ref="comMessage"></comMessage>
</template>
<script>
import winComScan from '@/mycomponents/scan/winComScan.vue'
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue'
import { getBalanceByManagementPrecisionByPacking } from '@/common/balance.js'
import { getBalanceByParams, getBasicItemByCode } from '@/api/request2.js'
import { getListLocationAreaTypeDesc, checkDirectoryItemExist, getDirectoryItemArray, getLocationAreaTypeName, getInventoryStatusDesc, getListItemTypeDesc, getItemTypeInfo } from '@/common/directory.js'
export default {
name: 'winScanPack',
emits: ['getBalance'],
components: {
winComScan,
balanceSelect
},
props: {
title: {
type: String,
default: '箱标签'
},
isShowHistory: {
type: Boolean,
default: false
},
headerType: {
type: String,
default: 'HPQ,HMQ'
},
balanceFromInventoryStatuses: {
// fromInventoryStatuses
type: Boolean,
default: true
},
bussinessCode: {
type: String,
default: ''
}
},
data() {
return {
scanResult: {},
show: false,
scanList: [],
expand: false,
showScanResult: {},
expendIcon: 'arrow-down',
fromLocationCode: '',
fromLocation: '',
fromLocationList: [],
fromLocationAreaTypeList: [],
locationOnFocus: false,
businessType: {},
inventoryStatus: [],
managementPrecision: '',
fromInventoryStatuses: [],
itemTypesList: [],
isCheck: false,
resultData: {}
}
},
created() {},
methods: {
openScanPopup(businessType) {
this.businessType = businessType
this.fromInventoryStatuses = getDirectoryItemArray(businessType.outInventoryStatuses)
this.fromLocationAreaTypeList = getDirectoryItemArray(businessType.outAreaTypes)
this.itemTypesList = getDirectoryItemArray(businessType.itemTypes)
this.$refs.popup.open('bottom')
},
getScanResult(result) {
this.resultData = result
this.getItemCodeType(result.package.itemCode, (callBack) => {
this.queryBalance(this.resultData)
})
},
queryBalance(result) {
const params = {
itemCode: result.package.itemCode,
batch: result.label.batch,
packingNumber: result.label.packingNumber,
inventoryStatus: this.fromInventoryStatuses,
areaType: this.fromLocationAreaTypeList
}
getBalanceByParams(params)
.then((res) => {
uni.hideLoading()
if (res.data.length == 0) {
const status = getInventoryStatusDesc(params.inventoryStatus)
const areaType = getListLocationAreaTypeDesc(params.areaType)
const hint = `按物料号 [${params.itemCode}] <br>` + `包装号 [${params.packingNumber}] <br>` + `批次 [${params.batch}] <br>` + `状态 [${status}] <br>` + `库区 [${areaType}] <br>` + '未查找到库存余额'
this.showErrorMessage(hint)
} else if (res.data.length == 1) {
result.balance = res.data[0]
this.$emit('getBalance', result)
this.closeScanPopup()
} else {
//
this.$refs.balanceSelect.openPopup(res.data)
}
})
.catch((error) => {
uni.hideLoading()
this.showErrorMessage(error)
})
},
getItemCodeType(itemCode, callBack) {
uni.showLoading({
title: '加载中',
mask: true
})
getBasicItemByCode(itemCode)
.then((res) => {
if (res.data != null && res.data.list.length > 0) {
const result = res.data.list[0]
const { status } = result
const { type } = result
if (status == 'ENABLE') {
if (checkDirectoryItemExist(this.itemTypesList, type)) {
callBack()
} else {
const hint = getListItemTypeDesc(this.itemTypesList)
uni.hideLoading()
this.showErrorMessage(`扫描物料[${itemCode}]是[${getItemTypeInfo(type).label}],需要的物料类型是[${hint}]`)
}
} else {
uni.hideLoading()
this.showErrorMessage(`物料【${itemCode}】不可用`)
}
} else {
uni.hideLoading()
this.showErrorMessage(`未查找到物料【${itemCode}`)
}
})
.catch((error) => {
uni.hideLoading()
this.showErrorMessage(error)
})
},
showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, (res) => {
if (res) {
}
})
},
selectBalanceItem(item) {
this.resultData.balance = item
this.$emit('getBalance', this.resultData)
this.closeScanPopup()
},
closeScanPopup() {
this.$refs.popup.close()
}
}
}
</script>
<style lang="scss">
.scroll-view {
overflow-y: scroll;
height: auto;
max-height: 300rpx;
}
</style>

146
src/pages/issue/coms/comScanIssuePack.vue

@ -60,7 +60,7 @@ import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue'
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue' import balanceSelect from '@/mycomponents/balance/balanceSelect.vue'
import { getDetailOption, getDetailEditRemoveOption } from '@/common/array.js' import { getDetailOption, getDetailEditRemoveOption } from '@/common/array.js'
import { getWorkShopLineStation } from '@/api/request2.js' import { getWorkShopLineStation, getBalanceByFilter } from '@/api/request2.js'
import { calc } from '@/common/calc.js' import { calc } from '@/common/calc.js'
@ -141,7 +141,7 @@ const closeScanPopup = () => {
const initData = () => { const initData = () => {
fromLocationList.value = [] fromLocationList.value = []
if (dataContent.value != null) { if (dataContent.value != null) {
fromInventoryStatuses.value = getDirectoryItemArray(jobContent.value.outInventoryStatuses) fromInventoryStatuses.value = jobContent.value.outInventoryStatuses
toLocation.value = dataContent.value[0] toLocation.value = dataContent.value[0]
toLocationCode.value = dataContent.value[0].toLocationCode toLocationCode.value = dataContent.value[0].toLocationCode
fromLocationList.value = getFromLocationList() fromLocationList.value = getFromLocationList()
@ -176,7 +176,146 @@ const fromLocationUpdate = (fromlocation) => {
showErrorMessage(`发料库位【${fromlocation}】不存在`) showErrorMessage(`发料库位【${fromlocation}】不存在`)
} }
} }
const onScanResult = (result) => {
try {
if (fromLocationCode.value == '') {
showErrorMessage('请选择来源库位', (res) => {
toLocationCombox.value.onFocus()
})
return
}
const packageInfoParams = result.package
const { itemCode } = result.label
const packingCode = result.label.packingNumber
const lot = result.label.batch
const item = toLocation.value.Items.find((r) => r.itemCode == itemCode)
if (item == undefined) {
showErrorMessage(`未查找到物料【${itemCode}】的发料明细`, (res) => {
getfocus()
})
return
}
//
uni.showLoading({
title: '加载中',
mask: true
})
getBalance(result.label, packageInfoParams, (balances) => {
packageInfo.value = packageInfoParams
//
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]
afterGetBalance(result.label, balance, packageInfoParams)
} else {
showBalanceSelect(newBalances)
}
}
} else {
//
if (balances.list.length == 0) {
showErrorMessage('未查找到该包装的库存信息,请重新扫描')
} else {
//
const subPackitems = balances.list.filter((r) => r.packingNumber == packageInfoParams.number)
//
const subParentPackitems = balances.list.filter((r) => r.packingNumber == packageInfoParams.parentNumber && r.locationCode == fromLocationCode.value)
//
if (subPackitems.length == 0) {
//
if (subParentPackitems.length > 0) {
if (subParentPackitems.length == 1) {
const balance = subParentPackitems[0]
balance.qty = packageInfoParams.qty
afterGetBalance(result.label, balance, packageInfo)
} else {
showBalanceSelect(subParentPackitems)
}
} else {
showErrorMessage(`按外包装【${packageInfoParams.parentNumber}】和子包装【${packageInfoParams.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(`该包装【${packageInfoParams.number}】在库位【${locationCode}】已经有库存余额,请重新扫描`)
}
}
}
uni.hideLoading()
})
} catch (e) {
showErrorMessage(e.stack)
uni.hideLoading()
}
}
const getBalance = (label, packageInfoParams, callback) => {
const filters = []
if (packageInfoParams.parentNumber) {
const packingNumber = `${packageInfoParams.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 onScan = (result) => { const onScan = (result) => {
if (toLocation.value && result.package.packUnit) { if (toLocation.value && result.package.packUnit) {
const item = toLocation.value.Items.find((r) => r.itemCode == result.package.itemCode) const item = toLocation.value.Items.find((r) => r.itemCode == result.package.itemCode)
@ -191,7 +330,7 @@ const onScan = (result) => {
} }
} }
} }
const onScanResult = (result) => { const onScanResult1 = (result) => {
try { try {
if (fromLocationCode.value == '') { if (fromLocationCode.value == '') {
showErrorMessage('请选择来源库位', (res) => { showErrorMessage('请选择来源库位', (res) => {
@ -330,6 +469,7 @@ const creatRecord = (label, balance, packageInfo) => {
scaned: true, scaned: true,
itemCode: label.itemCode, itemCode: label.itemCode,
packingNumber: label.packingNumber, packingNumber: label.packingNumber,
parentPackingNumber: packageInfo.parentNumber,
batch: label.batch, batch: label.batch,
qty: Number(balance.qty), qty: Number(balance.qty),
// qty: Number(label.qty) > Number(balance.qty) ? Number(balance.qty) : Number(label.qty), // qty: Number(label.qty) > Number(balance.qty) ? Number(balance.qty) : Number(label.qty),

1
src/pages/issue/job/issueDetail.vue

@ -247,6 +247,7 @@ const setParams = () => {
record.toPackingNumber = info.packingNumber record.toPackingNumber = info.packingNumber
record.toBatch = info.batch record.toBatch = info.batch
} }
record.fromParentPackingNumber = r.parentPackingNumber
subItem.recordList.push(record) subItem.recordList.push(record)
}) })
subList.push(deepCopyData(subItem)) subList.push(deepCopyData(subItem))

177
src/pages/issue/record/directIssue.vue

@ -37,15 +37,16 @@
<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"> </win-scan-pack-and-location>
<com-message ref="comMessageRef" /> <com-message ref="comMessageRef" :queryBalance="false" />
<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 { issueRecordSubmit, getWorkShopLineStation } from '@/api/request2.js' import { issueRecordSubmit, getWorkShopLineStation, getBalanceByFilter } from '@/api/request2.js'
import { goHome, getPackingNumberAndBatchByList, deepCopyData } from '@/common/basic.js' import { goHome, getPackingNumberAndBatchByList, deepCopyData } from '@/common/basic.js'
@ -65,6 +66,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()
@ -100,6 +102,8 @@ const workStationName = ref('')
const rawLocationCode = ref('') const rawLocationCode = ref('')
const fgLocationCode = ref('') const fgLocationCode = ref('')
const managementList = ref([]) const managementList = ref([])
const resultData = ref({})
const balanceSelectRef = ref()
onLoad((option) => { onLoad((option) => {
clearData() clearData()
@ -134,8 +138,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) => {
console.log(111, 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) => {
resultData.value.balance = balance
afterGetBalance(resultData.value)
}
const afterGetBalance = (result) => {
const { balance } = result const { balance } = result
const { label } = result const { label } = result
const pack = result.package const pack = result.package
@ -152,11 +277,54 @@ const getScanResult = (result) => {
if (item == undefined) { if (item == undefined) {
const itemp = createItemInfo(balance, pack) const itemp = createItemInfo(balance, pack)
const newDetail = createDetailInfo(balance, pack) const newDetail = createDetailInfo(balance, pack)
newDetail.parentNumber = pack.parentNumber
newDetail.packingNumber = pack.number
newDetail.packUnit = packUnit || '' newDetail.packUnit = packUnit || ''
newDetail.packQty = packQty || '' newDetail.packQty = packQty || ''
itemp.subList.push(newDetail) itemp.subList.push(newDetail)
detailSource.value.push(itemp) detailSource.value.push(itemp)
calcHandleQty(detailSource.value) calcHandleQty(detailSource.value)
} else {
const detail = item.subList.find((r) => {
if (r.packingNumber == balance.packingNumber && r.batch == balance.batch && r.locationCode == balance.locationCode && r.inventoryStatus == balance.inventoryStatus) {
return r
}
})
if (detail == undefined) {
const newDetail = createDetailInfo(balance, pack)
newDetail.parentNumber = pack.parentNumber
newDetail.packingNumber = pack.number
newDetail.packUnit = packUnit
newDetail.packQty = packQty
item.subList.push(newDetail)
calcHandleQty(detailSource.value)
} else if (detail.scaned == true) {
showErrorMessage(`箱码[${balance.packingNumber}批次[${balance.batch}]已经在列表中`)
}
}
}
const getScanResult1 = (result) => {
const { balance } = result
const { label } = result
const pack = result.package
const { packUnit } = pack
const { packQty } = pack
const item = detailSource.value.find((res) => {
if (res.itemCode == balance.itemCode) {
return res
}
})
if (fromWarehouseCode.value == '') {
fromWarehouseCode.value = balance.warehouseCode
}
if (item == undefined) {
const itemp = createItemInfo(balance, pack)
const newDetail = createDetailInfo(balance, pack) //
newDetail.packUnit = packUnit
newDetail.packQty = packQty
itemp.subList.push(newDetail)
detailSource.value.push(itemp)
calcHandleQty(detailSource.value)
} else { } else {
const detail = item.subList.find((r) => { const detail = item.subList.find((r) => {
if (r.packingNumber == balance.packingNumber && r.batch == balance.batch && r.locationCode == balance.locationCode && r.inventoryStatus == balance.inventoryStatus) { if (r.packingNumber == balance.packingNumber && r.batch == balance.batch && r.locationCode == balance.locationCode && r.inventoryStatus == balance.inventoryStatus) {
@ -174,7 +342,6 @@ const getScanResult = (result) => {
} }
} }
} }
// //
const getRecommendLocation = (balance, pack, callback) => { const getRecommendLocation = (balance, pack, callback) => {
proxy.$modal.loading('扫描中...') proxy.$modal.loading('扫描中...')
@ -362,6 +529,7 @@ const setRecordParams = () => {
submitItem.recordList = [ submitItem.recordList = [
{ {
toInventoryStatus: detail.inventoryStatus, toInventoryStatus: detail.inventoryStatus,
fromParentPackingNumber: detail.parentNumber,
fromPackingNumber: info.packingNumber, fromPackingNumber: info.packingNumber,
fromBatch: info.batch, fromBatch: info.batch,
toPackingNumber: info.packingNumber, toPackingNumber: info.packingNumber,
@ -452,6 +620,7 @@ const clearData = () => {
fromWarehouseCode.value = '' fromWarehouseCode.value = ''
toWarehouseCode.value = '' toWarehouseCode.value = ''
detailSource.value = [] detailSource.value = []
positionInfo.value = '请选择生产线'
} }
</script> </script>

47
src/pages/package/record/overPackageRecord.vue

@ -1,7 +1,7 @@
<template> <template>
<view class="page-wraper"> <view class="page-wraper">
<view class=""> <view class="">
<com-blank-view @goScan="showFromLocationPopup" v-if="detailSource.length == 0"></com-blank-view> <com-blank-view @goScan="getBusinessType" v-if="detailSource.length == 0"></com-blank-view>
</view> </view>
<view class="page-wraper" v-if="detailSource.length > 0"> <view class="page-wraper" v-if="detailSource.length > 0">
<view class="cen_card" style="background-color: #fff; margin: 10px"> <view class="cen_card" style="background-color: #fff; margin: 10px">
@ -52,9 +52,7 @@
</view> </view>
<win-scan-button @goScan="openScanPopup"></win-scan-button> <win-scan-button @goScan="openScanPopup"></win-scan-button>
</view> </view>
<winComScanBalance ref="scanPopup" @getBalance="getScanResult"> </winComScanBalance>
<win-scan-pack-and-location ref="scanPopup" @getResult="getScanResult" :allowModifyLocation="true" @confirm="handleConfirm"> </win-scan-pack-and-location>
<win-scan-location ref="scanLocationCode" title="来源库位" @getLocation="getLocation" :locationAreaTypeList="fromLocationAreaTypeList"></win-scan-location>
<com-message ref="comMessageRef" /> <com-message ref="comMessageRef" />
</view> </view>
</template> </template>
@ -62,10 +60,10 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, getCurrentInstance, nextTick } from 'vue' import { ref, getCurrentInstance, nextTick } from 'vue'
import { onLoad, onShow, onNavigationBarButtonTap, onReady, onBackPress, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app' import { onLoad, onShow, onNavigationBarButtonTap, onReady, onBackPress, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app'
import { overPackageRecordSubmit, getPackUnitByItemCode } from '@/api/request2.js' import { overPackageRecordSubmit, getPackUnitByItemCode, getBalanceByParams } from '@/api/request2.js'
import { goHome, getCurrDateTime } from '@/common/basic.js' import { goHome, getCurrDateTime } from '@/common/basic.js'
import { getInventoryStatusDesc, getDirectoryItemArray, getPackUnitName, getUomInfo } from '@/common/directory.js' import { getInventoryStatusDesc, getLocationAreaTypeName, getLocationAreaTypeInfo, getListLocationAreaTypeDesc, getDirectoryItemArray, getPackUnitName, getUomInfo } from '@/common/directory.js'
import { getBusinessType, createItemInfo, createDetailInfo, calcHandleQty } from '@/common/record.js' import { getBusinessType, createItemInfo, createDetailInfo, calcHandleQty } from '@/common/record.js'
@ -79,6 +77,7 @@ import recommendBalance from '@/mycomponents/balance/recommendBalance.vue'
import packageTarget from '@/mycomponents/package/packageTarget.vue' import packageTarget from '@/mycomponents/package/packageTarget.vue'
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue' import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue'
import packUnit from '@/mycomponents/qty/packUnit.vue' import packUnit from '@/mycomponents/qty/packUnit.vue'
import winComScanBalance from '@/mycomponents/scan/winComScanBalance.vue'
import { useCountStore } from '@/store' import { useCountStore } from '@/store'
// store // store
@ -91,6 +90,7 @@ const detailSource = ref([])
const fromLocationCode = ref('') const fromLocationCode = ref('')
const isShowLocation = ref(false) const isShowLocation = ref(false)
const fromLocationAreaTypeList = ref([]) const fromLocationAreaTypeList = ref([])
const fromInventoryStatuses = ref([])
const inInventoryStatus = ref('') const inInventoryStatus = ref('')
const outInventoryStatus = ref('') const outInventoryStatus = ref('')
const businessType = ref({}) const businessType = ref({})
@ -102,27 +102,32 @@ const show = ref(false)
const toPackUnitShow = ref('请选择') const toPackUnitShow = ref('请选择')
const toPackQty = ref('') const toPackQty = ref('')
const itemCode = ref('') const itemCode = ref('')
const resultData = ref({})
const scanPopup = ref() const scanPopup = ref()
const scanLocationCode = ref() const scanLocationCode = ref()
const toPackUnit = ref() const toPackUnit = ref()
const comMessageRef = ref() const comMessageRef = ref()
onShow(() => { onShow(() => {
getBusinessType()
})
onNavigationBarButtonTap((e) => {
if (e.index === 0) {
goHome()
}
})
const getBusinessType1 = () => {
const typeCode = 'OverPackage' const typeCode = 'OverPackage'
getBusinessType(typeCode, (res) => { getBusinessType(typeCode, (res) => {
if (res.success) { if (res.success) {
businessType.value = res.businessType businessType.value = res.businessType
fromInventoryStatuses.value = getDirectoryItemArray(res.fromInventoryStatuses)
fromLocationAreaTypeList.value = res.fromLocationAreaTypeList fromLocationAreaTypeList.value = res.fromLocationAreaTypeList
showFromLocationPopup() openScanPopup()
} else { } else {
showErrorMessage(res.message) showErrorMessage(res.message)
} }
}) })
})
onNavigationBarButtonTap((e) => {
if (e.index === 0) {
goHome()
} }
})
const getUomInfo1 = (uom) => { const getUomInfo1 = (uom) => {
const item = getUomInfo(uom) const item = getUomInfo(uom)
if (item == '') { if (item == '') {
@ -169,11 +174,20 @@ const handleConfirm = (fromLocationCode) => {
scanLocationCode.value.openScanPopupSimulate(fromLocationCode) scanLocationCode.value.openScanPopupSimulate(fromLocationCode)
} }
const getScanResult = (result) => { const getScanResult = (result) => {
setData(result)
}
const setData = (result) => {
const { balance } = result const { balance } = result
const { label } = result const { label } = result
const pack = result.package const pack = result.package
fromPackUnit.value = pack.packUnit fromPackUnit.value = pack.packUnit
fromPack.value = pack fromPack.value = pack
if (fromLocationCode.value && fromLocationCode.value != balance.locationCode) {
showErrorMessage(`箱码[${balance.packingNumber}批次[${balance.batch}]在库位[${fromLocationCode.value}]没有库存余额`)
return
}
const item = detailSource.value.find((res) => { const item = detailSource.value.find((res) => {
if (res.itemCode == balance.itemCode) { if (res.itemCode == balance.itemCode) {
return res return res
@ -189,6 +203,7 @@ const getScanResult = (result) => {
itemp.subList.push(newDetail) itemp.subList.push(newDetail)
detailSource.value.push(itemp) detailSource.value.push(itemp)
itemCode.value = balance.itemCode itemCode.value = balance.itemCode
fromLocationCode.value = balance.locationCode
} else { } else {
const detail = item.subList.find((r) => { const detail = item.subList.find((r) => {
if (r.packingNumber == balance.packingNumber && r.batch == balance.batch && r.locationCode == balance.locationCode && r.inventoryStatus == balance.inventoryStatus) { if (r.packingNumber == balance.packingNumber && r.batch == balance.batch && r.locationCode == balance.locationCode && r.inventoryStatus == balance.inventoryStatus) {
@ -231,11 +246,11 @@ const removePack = () => {
} }
const openScanPopup = () => { const openScanPopup = () => {
if (fromLocationCode.value == '') { if (businessType.value) {
showFromLocationPopup() scanPopup.value.openScanPopup(businessType.value)
return } else {
getBusinessType()
} }
scanPopup.value.openScanPopupForType(fromLocationCode.value, businessType.value)
} }
const showFromLocationPopup = () => { const showFromLocationPopup = () => {

22
src/pages/repleinsh/coms/comScanReplishPack.vue

@ -108,6 +108,7 @@ const positionList = ref([])
const defaultValueList = ref([]) const defaultValueList = ref([])
const label = ref({}) const label = ref({})
const fromInventoryStatuses = ref('') const fromInventoryStatuses = ref('')
const packageInfo = ref({})
const comMessageRef = ref('') const comMessageRef = ref('')
const balanceSelectRef = ref() const balanceSelectRef = ref()
const toLocationCombox = ref() const toLocationCombox = ref()
@ -187,7 +188,7 @@ const onScan = (result) => {
}) })
return return
} }
const packageInfo = result.package const packageInfoParams = result.package
const { itemCode } = result.label const { itemCode } = result.label
const packingCode = result.label.packingNumber const packingCode = result.label.packingNumber
const lot = result.label.batch const lot = result.label.batch
@ -204,7 +205,8 @@ const onScan = (result) => {
mask: true mask: true
}) })
getBalance(result.label, packageInfo, (balances) => { getBalance(result.label, packageInfoParams, (balances) => {
packageInfo.value = packageInfoParams
// //
const s = '' const s = ''
if (!result.package.parentNumber) { if (!result.package.parentNumber) {
@ -216,7 +218,7 @@ const onScan = (result) => {
showErrorMessage('未查找到该包装的库存信息,请重新扫描') showErrorMessage('未查找到该包装的库存信息,请重新扫描')
} else if (newBalances.length == 1) { } else if (newBalances.length == 1) {
const balance1 = newBalances[0] const balance1 = newBalances[0]
afterGetBalance(result.label, balance1, packageInfo) afterGetBalance(result.label, balance1, packageInfoParams)
} else { } else {
showBalanceSelect(newBalances) showBalanceSelect(newBalances)
} }
@ -227,9 +229,9 @@ const onScan = (result) => {
showErrorMessage('未查找到该包装的库存信息,请重新扫描') showErrorMessage('未查找到该包装的库存信息,请重新扫描')
} else { } else {
// //
const subPackitems = balances.list.filter((r) => r.packingNumber == packageInfo.number) const subPackitems = balances.list.filter((r) => r.packingNumber == packageInfoParams.number)
// //
const subParentPackitems = balances.list.filter((r) => r.packingNumber == packageInfo.parentNumber && r.locationCode == fromLocationCode.value) const subParentPackitems = balances.list.filter((r) => r.packingNumber == packageInfoParams.parentNumber && r.locationCode == fromLocationCode.value)
// //
if (subPackitems.length == 0) { if (subPackitems.length == 0) {
@ -238,13 +240,13 @@ const onScan = (result) => {
if (subParentPackitems.length > 0) { if (subParentPackitems.length > 0) {
if (subParentPackitems.length == 1) { if (subParentPackitems.length == 1) {
const balance = subParentPackitems[0] const balance = subParentPackitems[0]
balance.qty = packageInfo.qty balance.qty = packageInfoParams.qty
afterGetBalance(result.label, balance, packageInfo) afterGetBalance(result.label, balance, packageInfoParams)
} else { } else {
showBalanceSelect(subParentPackitems) showBalanceSelect(subParentPackitems)
} }
} else { } else {
showErrorMessage(`按外包装【${packageInfo.parentNumber}】和子包装【${packageInfo.number}】都未查找到库存余额`) showErrorMessage(`按外包装【${packageInfoParams.parentNumber}】和子包装【${packageInfoParams.number}】都未查找到库存余额`)
} }
} else { } else {
let locationCode = fromLocationCode.value let locationCode = fromLocationCode.value
@ -256,7 +258,7 @@ const onScan = (result) => {
locationCode = manyBlances[0].locationCode locationCode = manyBlances[0].locationCode
} }
} }
showErrorMessage(`该包装【${packageInfo.number}】在库位【${locationCode}】已经有库存余额,请重新扫描`) showErrorMessage(`该包装【${packageInfoParams.number}】在库位【${locationCode}】已经有库存余额,请重新扫描`)
} }
} }
} }
@ -322,7 +324,7 @@ const getBalance = (labelParams, packageInfo, callback) => {
} }
const selectBalanceItem = (balanceParams) => { const selectBalanceItem = (balanceParams) => {
afterGetBalance(label.value, balanceParams) afterGetBalance(label.value, balanceParams, packageInfo.value)
} }
const afterGetBalance = (labelParams, balanceParams, packageInfo) => { const afterGetBalance = (labelParams, balanceParams, packageInfo) => {

Loading…
Cancel
Save