|
@ -1,6 +1,6 @@ |
|
|
<template> |
|
|
<template> |
|
|
<view> |
|
|
<view> |
|
|
<uni-popup ref="popup" :mask-click="false"> |
|
|
<u-popup v-model="show" mode="bottom"> |
|
|
<view class="popup_box"> |
|
|
<view class="popup_box"> |
|
|
<view class="pop_title uni-flex space-between"> |
|
|
<view class="pop_title uni-flex space-between"> |
|
|
<view class="" style="font-size: 35rpx;"> |
|
|
<view class="" style="font-size: 35rpx;"> |
|
@ -19,13 +19,13 @@ |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</uni-popup> |
|
|
</u-popup> |
|
|
<balance-select ref="balanceSelect" @onSelectItem='selectBalanceItem'></balance-select> |
|
|
<balance-select ref="balanceSelect" @onSelectItem='selectBalanceItem'></balance-select> |
|
|
</view> |
|
|
</view> |
|
|
<comMessage ref="comMessage"></comMessage> |
|
|
<comMessage ref="comMessage"></comMessage> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script> |
|
|
<script setup lang="ts"> |
|
|
import winComScan from '@/mycomponents/scan/winComScan.vue' |
|
|
import winComScan from '@/mycomponents/scan/winComScan.vue' |
|
|
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue' |
|
|
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue' |
|
|
import { |
|
|
import { |
|
@ -47,275 +47,260 @@ import { |
|
|
getListItemTypeDesc, |
|
|
getListItemTypeDesc, |
|
|
getItemTypeInfo |
|
|
getItemTypeInfo |
|
|
} from '@/common/directory.js'; |
|
|
} from '@/common/directory.js'; |
|
|
export default { |
|
|
|
|
|
name: 'winScanPack', |
|
|
import { ref, onMounted, watch } from 'vue' |
|
|
emits: ["getBalance"], |
|
|
|
|
|
components: { |
|
|
const props = defineProps({ |
|
|
winComScan, |
|
|
title: { |
|
|
balanceSelect |
|
|
type: String, |
|
|
|
|
|
default: '箱标签' |
|
|
}, |
|
|
}, |
|
|
props: { |
|
|
isShowHistory: { |
|
|
title: { |
|
|
type: Boolean, |
|
|
type: String, |
|
|
default: false |
|
|
default: '箱标签' |
|
|
|
|
|
}, |
|
|
|
|
|
isShowHistory: { |
|
|
|
|
|
type: Boolean, |
|
|
|
|
|
default: false |
|
|
|
|
|
}, |
|
|
|
|
|
headerType: { |
|
|
|
|
|
type: String, |
|
|
|
|
|
default: "HPQ,HMQ" |
|
|
|
|
|
}, |
|
|
|
|
|
balanceFromInventoryStatuses: { //是否传fromInventoryStatuses |
|
|
|
|
|
type: Boolean, |
|
|
|
|
|
default: true |
|
|
|
|
|
}, |
|
|
|
|
|
bussinessCode: { |
|
|
|
|
|
type: String, |
|
|
|
|
|
default: '' |
|
|
|
|
|
}, |
|
|
|
|
|
verifyCategory: { |
|
|
|
|
|
type: Boolean, |
|
|
|
|
|
default: false |
|
|
|
|
|
}, |
|
|
|
|
|
isCheckLocationBalance: { |
|
|
|
|
|
type: Boolean, |
|
|
|
|
|
default: true |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
}, |
|
|
data() { |
|
|
headerType: { |
|
|
return { |
|
|
type: String, |
|
|
scanResult: {}, |
|
|
default: "HPQ,HMQ" |
|
|
show: false, |
|
|
|
|
|
scanList: [], |
|
|
|
|
|
expand: false, |
|
|
|
|
|
showScanResult: {}, |
|
|
|
|
|
expendIcon: 'arrow-down', |
|
|
|
|
|
fromLocationCode: '', |
|
|
|
|
|
fromLocation: '', |
|
|
|
|
|
fromLocationList: [], |
|
|
|
|
|
fromLocationAreaTypeList: [], |
|
|
|
|
|
toLocationAreaTypeList: [], |
|
|
|
|
|
locationOnFocus: false, |
|
|
|
|
|
businessType: {}, |
|
|
|
|
|
inventoryStatus: [], |
|
|
|
|
|
managementPrecision: '', |
|
|
|
|
|
fromInventoryStatuses: [], |
|
|
|
|
|
itemTypesList: [], |
|
|
|
|
|
isCheck: false, |
|
|
|
|
|
resultData: {} |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
}, |
|
|
created() { |
|
|
balanceFromInventoryStatuses: { // 是否传 fromInventoryStatuses |
|
|
|
|
|
type: Boolean, |
|
|
|
|
|
default: true |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
bussinessCode: { |
|
|
openScanPopup(businessType) { |
|
|
type: String, |
|
|
this.businessType = businessType |
|
|
default: '' |
|
|
this.fromInventoryStatuses = getDirectoryItemArray(businessType.outInventoryStatuses) |
|
|
}, |
|
|
this.fromLocationAreaTypeList = getDirectoryItemArray(businessType.outAreaTypes) |
|
|
verifyCategory: { |
|
|
this.toLocationAreaTypeList = getDirectoryItemArray(businessType.inAreaTypes) |
|
|
type: Boolean, |
|
|
this.itemTypesList = getDirectoryItemArray(businessType.itemTypes) |
|
|
default: false |
|
|
this.$refs.popup.open('bottom') |
|
|
}, |
|
|
setTimeout(res=>{ |
|
|
isCheckLocationBalance: { |
|
|
this.getfocus() |
|
|
type: Boolean, |
|
|
},500) |
|
|
default: true |
|
|
}, |
|
|
} |
|
|
|
|
|
}) |
|
|
getScanResult(result) { |
|
|
|
|
|
this.resultData = result; |
|
|
|
|
|
if (!result.package) { |
|
|
|
|
|
this.showErrorMessage(result.label.code + "包装信息为空") |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
this.getItemCodeType(result.package.itemCode, callBack => { |
|
|
|
|
|
if(this.isCheckLocationBalance){ |
|
|
|
|
|
this.queryBalance(this.resultData); |
|
|
|
|
|
}else { |
|
|
|
|
|
this.queryBalance(this.resultData) |
|
|
|
|
|
} |
|
|
|
|
|
//this.queryBalance(this.resultData) |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
//查询到目标库位的库存余额 |
|
|
const scanResult = ref({}) |
|
|
getToLocationBalance(result) { |
|
|
const show = ref(false) |
|
|
uni.showLoading({ |
|
|
const scanList = ref([]) |
|
|
title: '查询中', |
|
|
const expand = ref(false) |
|
|
mask: true |
|
|
const expendIcon = ref('arrow-down') |
|
|
}) |
|
|
const fromLocationCode = ref('') |
|
|
var filters = [] |
|
|
const fromLocation = ref('') |
|
|
if (result.package.parentNumber) { |
|
|
const fromLocationList = ref([]) |
|
|
var packingNumber = result.package.parentNumber + "," + result.package.number; |
|
|
const fromLocationAreaTypeList = ref([]) |
|
|
filters.push({ |
|
|
const toLocationAreaTypeList = ref([]) |
|
|
column: "packingNumber", |
|
|
const businessType = ref({}) |
|
|
action: "in", |
|
|
const inventoryStatus = ref([]) |
|
|
value: packingNumber |
|
|
const fromInventoryStatuses = ref([]) |
|
|
}) |
|
|
const itemTypesList = ref([]) |
|
|
} else { |
|
|
const resultData = ref({}) |
|
|
filters.push({ |
|
|
|
|
|
column: "packingNumber", |
|
|
|
|
|
action: "==", |
|
|
|
|
|
value: result.package.number |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
filters.push({ |
|
|
const popup = ref(null) |
|
|
column: "itemCode", |
|
|
const comMessage = ref(null) |
|
|
action: "==", |
|
|
const comscan = ref(null) |
|
|
value: result.package.itemCode |
|
|
const balanceSelect = ref(null) |
|
|
}) |
|
|
|
|
|
filters.push({ |
|
|
|
|
|
column: "batch", |
|
|
|
|
|
action: "==", |
|
|
|
|
|
value: result.package.batch |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
filters.push({ |
|
|
// 方法 |
|
|
column: "areaType", |
|
|
const openScanPopup = (businessTypeValue) => { |
|
|
action: "in", |
|
|
businessType.value = businessTypeValue |
|
|
value: this.toLocationAreaTypeList.join(',') |
|
|
fromInventoryStatuses.value = getDirectoryItemArray(businessTypeValue.outInventoryStatuses) |
|
|
}) |
|
|
fromLocationAreaTypeList.value = getDirectoryItemArray(businessTypeValue.outAreaTypes) |
|
|
|
|
|
toLocationAreaTypeList.value = getDirectoryItemArray(businessTypeValue.inAreaTypes) |
|
|
|
|
|
itemTypesList.value = getDirectoryItemArray(businessTypeValue.itemTypes) |
|
|
|
|
|
show.value = true |
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
getfocus() |
|
|
|
|
|
}, 500) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const getScanResult = (result) => { |
|
|
|
|
|
resultData.value = result |
|
|
|
|
|
if (!result.package) { |
|
|
|
|
|
showErrorMessage(result.label.code + "包装信息为空") |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
getItemCodeType(result.package.itemCode, () => { |
|
|
|
|
|
if (props.isCheckLocationBalance) { |
|
|
|
|
|
queryBalance(resultData.value) |
|
|
|
|
|
} else { |
|
|
|
|
|
queryBalance(resultData.value) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
var params = { |
|
|
const getToLocationBalance = (result) => { |
|
|
filters: filters, |
|
|
uni.showLoading({ |
|
|
pageNo: 1, |
|
|
title: '查询中', |
|
|
pageSize: 100, |
|
|
mask: true |
|
|
} |
|
|
}) |
|
|
getBalanceByFilter(params).then(res => { |
|
|
const filters = [] |
|
|
uni.hideLoading() |
|
|
if (result.package.parentNumber) { |
|
|
if (res.data.list.length > 0) { |
|
|
const packingNumber = result.package.parentNumber + "," + result.package.number |
|
|
this.showErrorMessage("包装在库位【" + res.data.list[0].locationCode + "】已有库存余额"); |
|
|
filters.push({ |
|
|
} else { |
|
|
column: "packingNumber", |
|
|
this.queryBalance(this.resultData); |
|
|
action: "in", |
|
|
} |
|
|
value: packingNumber |
|
|
// callback(res.data) |
|
|
}) |
|
|
}).catch(err => { |
|
|
} else { |
|
|
this.showErrorMessage(err.message); |
|
|
filters.push({ |
|
|
}) |
|
|
column: "packingNumber", |
|
|
}, |
|
|
action: "==", |
|
|
|
|
|
value: result.package.number |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
queryBalance(result) { |
|
|
filters.push({ |
|
|
var params = { |
|
|
column: "itemCode", |
|
|
itemCode: result.package.itemCode, |
|
|
action: "==", |
|
|
batch: result.label.batch, |
|
|
value: result.package.itemCode |
|
|
packingNumber: result.label.packingNumber, |
|
|
}) |
|
|
parentPackingNumber: result.package.parentNumber, |
|
|
filters.push({ |
|
|
inventoryStatus: this.fromInventoryStatuses, |
|
|
column: "batch", |
|
|
areaType: this.fromLocationAreaTypeList, |
|
|
action: "==", |
|
|
bussinessCode: this.bussinessCode |
|
|
value: result.package.batch |
|
|
} |
|
|
}) |
|
|
uni.showLoading({ |
|
|
filters.push({ |
|
|
title: '查询中', |
|
|
column: "areaType", |
|
|
mask: true |
|
|
action: "in", |
|
|
}) |
|
|
value: toLocationAreaTypeList.value.join(',') |
|
|
getBalanceByParams(params).then(res => { |
|
|
}) |
|
|
uni.hideLoading() |
|
|
|
|
|
if (res.data.length == 0) { |
|
|
|
|
|
var status = getInventoryStatusDesc(params.inventoryStatus) |
|
|
|
|
|
var areaType = getListLocationAreaTypeDesc(params.areaType) |
|
|
|
|
|
var hint = |
|
|
|
|
|
"按物料号 [" + params.itemCode + "] \n" + |
|
|
|
|
|
"包装号 [" + params.packingNumber + "] \n" + |
|
|
|
|
|
"批次 [" + params.batch + "] \n" + |
|
|
|
|
|
"状态 [" + status + "] \n" + |
|
|
|
|
|
"库区 [" + areaType + "] \n" + |
|
|
|
|
|
"未查找到库存余额" |
|
|
|
|
|
this.showErrorMessage(hint) |
|
|
|
|
|
} else if (res.data.length == 1) { |
|
|
|
|
|
|
|
|
|
|
|
result.balance = res.data[0] |
|
|
const params = { |
|
|
if (result.label.packingNumber != result.balance.packingNumber) { |
|
|
filters: filters, |
|
|
result.balance.lableQty = result.label.qty |
|
|
pageNo: 1, |
|
|
} |
|
|
pageSize: 100, |
|
|
this.$emit("getBalance", result) |
|
|
} |
|
|
// this.closeScanPopup() |
|
|
getBalanceByFilter(params).then(res => { |
|
|
} else { |
|
|
uni.hideLoading() |
|
|
//多条记录 |
|
|
if (res.data.list.length > 0) { |
|
|
this.$refs.balanceSelect.openPopup(res.data); |
|
|
showErrorMessage("包装在库位【" + res.data.list[0].locationCode + "】已有库存余额") |
|
|
} |
|
|
} else { |
|
|
|
|
|
queryBalance(resultData.value) |
|
|
|
|
|
} |
|
|
|
|
|
}).catch(err => { |
|
|
|
|
|
showErrorMessage(err.message) |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
}).catch(error => { |
|
|
const queryBalance = (result) => { |
|
|
uni.hideLoading() |
|
|
const params = { |
|
|
this.showErrorMessage(error) |
|
|
itemCode: result.package.itemCode, |
|
|
}) |
|
|
batch: result.label.batch, |
|
|
}, |
|
|
packingNumber: result.label.packingNumber, |
|
|
|
|
|
parentPackingNumber: result.package.parentNumber, |
|
|
|
|
|
inventoryStatus: fromInventoryStatuses.value, |
|
|
|
|
|
areaType: fromLocationAreaTypeList.value, |
|
|
|
|
|
bussinessCode: props.bussinessCode |
|
|
|
|
|
} |
|
|
|
|
|
uni.showLoading({ |
|
|
|
|
|
title: '查询中', |
|
|
|
|
|
mask: true |
|
|
|
|
|
}) |
|
|
|
|
|
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 + "] \n" + |
|
|
|
|
|
"包装号 [" + params.packingNumber + "] \n" + |
|
|
|
|
|
"批次 [" + params.batch + "] \n" + |
|
|
|
|
|
"状态 [" + status + "] \n" + |
|
|
|
|
|
"库区 [" + areaType + "] \n" + |
|
|
|
|
|
"未查找到库存余额" |
|
|
|
|
|
showErrorMessage(hint) |
|
|
|
|
|
} else if (res.data.length === 1) { |
|
|
|
|
|
result.balance = res.data[0] |
|
|
|
|
|
if (result.label.packingNumber !== result.balance.packingNumber) { |
|
|
|
|
|
result.balance.lableQty = result.label.qty |
|
|
|
|
|
} |
|
|
|
|
|
emit('getBalance', result) |
|
|
|
|
|
} else { |
|
|
|
|
|
balanceSelect.value.openPopup(res.data) |
|
|
|
|
|
} |
|
|
|
|
|
}).catch(error => { |
|
|
|
|
|
uni.hideLoading() |
|
|
|
|
|
showErrorMessage(error) |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
getItemCodeType(itemCode, callBack) { |
|
|
const getItemCodeType = (itemCode, callBack) => { |
|
|
uni.showLoading({ |
|
|
uni.showLoading({ |
|
|
title: "加载中", |
|
|
title: "加载中", |
|
|
mask: true |
|
|
mask: true |
|
|
}) |
|
|
}) |
|
|
getBasicItemByCode(itemCode).then(res => { |
|
|
getBasicItemByCode(itemCode).then(res => { |
|
|
if (res.data != null && res.data.list.length > 0) { |
|
|
if (res.data && res.data.list.length > 0) { |
|
|
var result = res.data.list[0]; |
|
|
const result = res.data.list[0] |
|
|
var status = result.available; |
|
|
const status = result.available |
|
|
var type = result.type; |
|
|
const type = result.type |
|
|
if (status == "TRUE") { |
|
|
if (status === "TRUE") { |
|
|
if (checkDirectoryItemExist(this.itemTypesList, type)) { |
|
|
if (checkDirectoryItemExist(itemTypesList.value, type)) { |
|
|
if (this.verifyCategory) { |
|
|
if (props.verifyCategory) { |
|
|
if (result.category == 'LCJ' || result.category == 'BJ') { |
|
|
if (result.category === 'LCJ' || result.category === 'BJ') { |
|
|
callBack() |
|
|
callBack() |
|
|
} else { |
|
|
|
|
|
this.showErrorMessage("扫描物料的种类不是【量产件】或者【备件】") |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
callBack() |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
} else { |
|
|
var hint = getListItemTypeDesc(this.itemTypesList); |
|
|
showErrorMessage("扫描物料的种类不是【量产件】或者【备件】") |
|
|
uni.hideLoading() |
|
|
|
|
|
this.showErrorMessage("扫描物料[" + itemCode + "]是[" + |
|
|
|
|
|
getItemTypeInfo(type).label + "],需要的物料类型是[" + hint + "]") |
|
|
|
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
uni.hideLoading() |
|
|
callBack() |
|
|
this.showErrorMessage('物料【' + itemCode + '】不可用'); |
|
|
|
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
|
|
|
const hint = getListItemTypeDesc(itemTypesList.value) |
|
|
uni.hideLoading() |
|
|
uni.hideLoading() |
|
|
this.showErrorMessage('未查找到物料【' + itemCode + '】'); |
|
|
showErrorMessage("扫描物料[" + itemCode + "]是[" + |
|
|
} |
|
|
getItemTypeInfo(type).label + "],需要的物料类型是[" + hint + "]") |
|
|
}).catch(error => { |
|
|
|
|
|
uni.hideLoading(); |
|
|
|
|
|
this.showErrorMessage(error) |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
showErrorMessage(message) { |
|
|
|
|
|
this.losefocus() |
|
|
|
|
|
this.$refs.comMessage.showErrorMessage(message, res => { |
|
|
|
|
|
if (res) { |
|
|
|
|
|
if (this.$refs.comscan) { |
|
|
|
|
|
this.$refs.comscan.getfocus() |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
}); |
|
|
} else { |
|
|
}, |
|
|
uni.hideLoading() |
|
|
|
|
|
showErrorMessage('物料【' + itemCode + '】不可用') |
|
|
selectBalanceItem(item) { |
|
|
|
|
|
this.resultData.balance = item |
|
|
|
|
|
this.$emit("getBalance", this.resultData) |
|
|
|
|
|
// this.closeScanPopup() |
|
|
|
|
|
}, |
|
|
|
|
|
closeScanPopup() { |
|
|
|
|
|
this.losefocus(); |
|
|
|
|
|
this.$refs.popup.close() |
|
|
|
|
|
}, |
|
|
|
|
|
getfocus() { |
|
|
|
|
|
if (this.$refs.comscan) { |
|
|
|
|
|
this.$refs.comscan.getfocus() |
|
|
|
|
|
} |
|
|
} |
|
|
}, |
|
|
} else { |
|
|
losefocus() { |
|
|
uni.hideLoading() |
|
|
if (this.$refs.comscan) { |
|
|
showErrorMessage('未查找到物料【' + itemCode + '】') |
|
|
this.$refs.comscan.losefocus() |
|
|
} |
|
|
|
|
|
}).catch(error => { |
|
|
|
|
|
uni.hideLoading() |
|
|
|
|
|
showErrorMessage(error) |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const showErrorMessage = (message) => { |
|
|
|
|
|
losefocus() |
|
|
|
|
|
comMessage.value.showErrorMessage(message, res => { |
|
|
|
|
|
if (res) { |
|
|
|
|
|
if (comscan.value) { |
|
|
|
|
|
comscan.value.getfocus() |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const selectBalanceItem = (item) => { |
|
|
|
|
|
resultData.value.balance = item |
|
|
|
|
|
emit('getBalance', resultData.value) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const closeScanPopup = () => { |
|
|
|
|
|
losefocus() |
|
|
|
|
|
show.value = false |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const getfocus = () => { |
|
|
|
|
|
if (comscan.value) { |
|
|
|
|
|
comscan.value.getfocus() |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const losefocus = () => { |
|
|
|
|
|
if (comscan.value) { |
|
|
|
|
|
comscan.value.losefocus() |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const emit = defineEmits(['getBalance']) |
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
|
<style lang="scss"> |
|
|
<style lang="scss"> |
|
|