Browse Source

mycomponents/scan 文件迁移 8/8-10/25

hella_vue3
王志国 4 weeks ago
parent
commit
e65e75151a
  1. 20
      src/mycomponents/scan/winCheckFgLabel.vue
  2. 42
      src/mycomponents/scan/winComScan.vue
  3. 15
      src/mycomponents/scan/winComScanBalance.vue
  4. 61
      src/mycomponents/scan/winComScanBalanceLocation.vue
  5. 39
      src/mycomponents/scan/winComScanFg.vue
  6. 5
      src/mycomponents/scan/winScanAsnNumber.vue
  7. 44
      src/mycomponents/scan/winScanButton.vue
  8. 3
      src/mycomponents/scan/winScanContainer.vue
  9. 15
      src/mycomponents/scan/winScanFgLabel.vue
  10. 3
      src/mycomponents/scan/winScanItem.vue
  11. 5
      src/mycomponents/scan/winScanJobNumber.vue
  12. 3
      src/mycomponents/scan/winScanLocation.vue
  13. 3
      src/mycomponents/scan/winScanPack.vue
  14. 3
      src/mycomponents/scan/winScanPackAndCont.vue
  15. 101
      src/mycomponents/scan/winScanPackAndLocation.vue
  16. 26
      src/mycomponents/scan/winScanPackAndLocationNoBalance.vue
  17. 3
      src/mycomponents/scan/winScanPackAndPosition.vue
  18. 7
      src/mycomponents/scan/winScanPackJob.vue
  19. 7
      src/mycomponents/scan/winScanPackLevel.vue
  20. 55
      src/mycomponents/scan/winScanPackage.vue
  21. 274
      src/mycomponents/scan/winScanParentPackage.vue

20
src/mycomponents/scan/winCheckFgLabel.vue

@ -75,16 +75,16 @@ const comscanCustomerLabel = ref()
const comMessageRef = ref() const comMessageRef = ref()
const openScanPopupForType = (customerCodeParams) => { const openScanPopupForType = (customerCodeParams) => {
customerCode.value = customerCodeParams customerCode.value = customerCodeParams
if (fromLocationCode.value != '') {
packGetFocus()
} else {
locationGetFocus()
}
fromInventoryStatuses.value = getDirectoryItemArray(businessType.value.outInventoryStatuses) fromInventoryStatuses.value = getDirectoryItemArray(businessType.value.outInventoryStatuses)
inventoryStatus.value = getDirectoryItemArray(businessType.value.outInventoryStatuses) // inventoryStatus.value = getDirectoryItemArray(businessType.value.outInventoryStatuses) //
fromLocationAreaTypeList.value = getDirectoryItemArray(businessType.value.fromLocationAreaTypeList) // fromLocationAreaTypeList.value = getDirectoryItemArray(businessType.value.fromLocationAreaTypeList) //
setTimeout((res) => {
show.value = true show.value = true
setTimeout(() => {
if (fromLocationCode.value != '') {
packGetFocus();
} else {
locationGetFocus();
}
}, 500) }, 500)
} }
@ -92,15 +92,19 @@ const openScanPopupForType = (customerCodeParams) => {
const openScanPopupForJob = (fromLocationCode, fromLocationList, jobContent) => { const openScanPopupForJob = (fromLocationCode, fromLocationList, jobContent) => {
fromLocationCode.value = fromLocationCode fromLocationCode.value = fromLocationCode
fromLocationList.value = fromLocationList fromLocationList.value = fromLocationList
fromInventoryStatuses.value = getDirectoryItemArray(businessType.value.outInventoryStatuses)
inventoryStatus.value = getDirectoryItemArray(businessType.value.outInventoryStatuses) //
fromLocationAreaTypeList.value = getDirectoryItemArray(businessType.value.fromLocationAreaTypeList) //
show.value = true
setTimeout((res) => {
if (fromLocationCode != '') { if (fromLocationCode != '') {
packGetFocus() packGetFocus()
} else if (fromLocationList.value.length == 0) { } else if (fromLocationList.value.length == 0) {
locationGetFocus() locationGetFocus()
} else { } else {
fromLocationCode.value = fromLocationList.value[0] fromLocationCode.value = fromLocationList.value[0]
packGetFocus()
} }
setTimeout((res) => {
show.value = true
}, 500) }, 500)
fromInventoryStatuses.value = getDirectoryItemArray(jobContent.outInventoryStatuses) fromInventoryStatuses.value = getDirectoryItemArray(jobContent.outInventoryStatuses)
inventoryStatus.value = getDirectoryItemArray(jobContent.outInventoryStatuses) // 出库库存状态; //出库库存状态 inventoryStatus.value = getDirectoryItemArray(jobContent.outInventoryStatuses) // 出库库存状态; //出库库存状态

42
src/mycomponents/scan/winComScan.vue

@ -4,12 +4,15 @@
<view class="pop_tab"> <view class="pop_tab">
<view class="tab_info"> <view class="tab_info">
<view class="conbox"> <view class="conbox">
<textarea inputmode="none" v-model="scanMsg" trim="all" maxlength="1000" style="margin-left: 5px; width: 90%" :focus="boxfocus" :placeholder="placeholderValue" @input="handelScanMsg" :cursor="cursorIndex"></textarea> <textarea v-model="scanMsg" trim="all" maxlength="1000" style="margin-left: 5px; width: 90%"
:focus="boxfocus" :placeholder="placeholderValue" @input="handelScanMsg"
@blur="handleBlur" @focus="handleFocus"
:cursor="cursorIndex"></textarea>
</view> </view>
<view class="uni-flex uni-row space-between u-col-center"> <view class="uni-flex uni-row space-between u-col-center">
<view class="uni-flex"> <view class="uni-flex">
<button class="clean_scan_btn" @click="clearScanValue()">清空</button> <button class="clean_scan_btn" @touchend.prevent="clearScanValue()">清空</button>
<button class="scan_btn" @click="clickScanMsg()">扫描</button> <button class="scan_btn" @click="clickScanMsg()">扫描</button>
</view> </view>
</view> </view>
@ -59,10 +62,10 @@ const props = defineProps({
type: Boolean, type: Boolean,
default: true default: true
}, },
boxFocus: { // boxFocus: {
type: Boolean, // type: Boolean,
default: true // default: true
}, // },
isShowHistory: { isShowHistory: {
type: Boolean, type: Boolean,
default: true default: true
@ -84,16 +87,7 @@ const cursorIndex = ref(0)
const comMessageRef = ref('') const comMessageRef = ref('')
placeholderValue.value = `请扫描${props.placeholder}` placeholderValue.value = `请扫描${props.placeholder}`
onMounted(() => { onMounted(() => {
boxfocus.value = true
// uni.hideKeyboard()
// // #ifdef H5
// if (document.querySelector('textarea') != null) {
// document.querySelector('textarea').setAttribute('inputmode', 'none')
// }
// // #endif
// hide()
// document.querySelector('textarea').setAttribute('inputmode', 'none')
}) })
// //
watch( watch(
@ -124,6 +118,7 @@ const setValue = (val) => {
} }
const clearScanValue = () => { const clearScanValue = () => {
scanMsg.value = '' scanMsg.value = ''
// this.cursorIndex = 0
getfocus() getfocus()
} }
const clickScanMsg = () => { const clickScanMsg = () => {
@ -132,14 +127,13 @@ const clickScanMsg = () => {
} }
const handelScanMsg = () => { const handelScanMsg = () => {
// //
const index = scanMsg.value.indexOf('\n') if (scanMsg.value.indexOf('\n')) {
if (index >= 0) {
// that.scanMsg = 'HPQ;V1.0;ICE115F11161AG;PP20230427000027;B20230427002;Q50'; // that.scanMsg = 'HPQ;V1.0;ICE115F11161AG;PP20230427000027;B20230427002;Q50';
setTimeout(() => { setTimeout(() => {
losefocus() losefocus()
const content = scanMsg.value.trim() const content = scanMsg.value.trim()
if (content == '') { if (content == '') {
getfocus() // getfocus()
comMessageRef.value.showErrorMessage('扫描内容为空,请重新扫描', (res) => { comMessageRef.value.showErrorMessage('扫描内容为空,请重新扫描', (res) => {
if (res) { if (res) {
scanMsg.value = '' scanMsg.value = ''
@ -161,6 +155,7 @@ const handelScanMsg = () => {
emit('getResult', scanResult) emit('getResult', scanResult)
} else { } else {
clear() clear()
losefocus()
comMessageRef.value.showErrorMessage(scanResult.message, (res) => { comMessageRef.value.showErrorMessage(scanResult.message, (res) => {
if (res) { if (res) {
getfocus() getfocus()
@ -168,9 +163,16 @@ const handelScanMsg = () => {
}) })
} }
}) })
}, 500) }, 200)
} }
} }
const handleFocus = ()=> {}
const handleBlur = ()=> {
// setTimeout(res=>{
// uni.hideKeyboard();
// },200)
}
const getfocus = () => { const getfocus = () => {
nextTick((r) => { nextTick((r) => {
boxfocus.value = true boxfocus.value = true
@ -184,9 +186,11 @@ const losefocus = () => {
}) })
} }
const clear = () => { const clear = () => {
if(props.clearResult){
cursorIndex.value = 0 cursorIndex.value = 0
scanMsg.value = '' scanMsg.value = ''
} }
}
const iconClick = (type) => { const iconClick = (type) => {
emit('clearResult', scanMsg.value) emit('clearResult', scanMsg.value)
} }

15
src/mycomponents/scan/winComScanBalance.vue

@ -118,6 +118,9 @@ export default {
this.toLocationAreaTypeList = getDirectoryItemArray(businessType.inAreaTypes) this.toLocationAreaTypeList = getDirectoryItemArray(businessType.inAreaTypes)
this.itemTypesList = getDirectoryItemArray(businessType.itemTypes) this.itemTypesList = getDirectoryItemArray(businessType.itemTypes)
this.$refs.popup.open('bottom') this.$refs.popup.open('bottom')
setTimeout(res=>{
this.getfocus()
},500)
}, },
getScanResult(result) { getScanResult(result) {
@ -128,7 +131,7 @@ export default {
} }
this.getItemCodeType(result.package.itemCode, callBack => { this.getItemCodeType(result.package.itemCode, callBack => {
if(this.isCheckLocationBalance){ if(this.isCheckLocationBalance){
this.getToLocationBalance(this.resultData) this.queryBalance(this.resultData);
}else { }else {
this.queryBalance(this.resultData) this.queryBalance(this.resultData)
} }
@ -214,11 +217,11 @@ export default {
var status = getInventoryStatusDesc(params.inventoryStatus) var status = getInventoryStatusDesc(params.inventoryStatus)
var areaType = getListLocationAreaTypeDesc(params.areaType) var areaType = getListLocationAreaTypeDesc(params.areaType)
var hint = var hint =
"按物料号 [" + params.itemCode + "] <br>" + "按物料号 [" + params.itemCode + "] \n" +
"包装号 [" + params.packingNumber + "] <br>" + "包装号 [" + params.packingNumber + "] \n" +
"批次 [" + params.batch + "] <br>" + "批次 [" + params.batch + "] \n" +
"状态 [" + status + "] <br>" + "状态 [" + status + "] \n" +
"库区 [" + areaType + "] <br>" + "库区 [" + areaType + "] \n" +
"未查找到库存余额" "未查找到库存余额"
this.showErrorMessage(hint) this.showErrorMessage(hint)
} else if (res.data.length == 1) { } else if (res.data.length == 1) {

61
src/mycomponents/scan/winComScanBalanceLocation.vue

@ -47,7 +47,7 @@ import { getBalanceByManagementPrecisionByPacking } from '@/common/balance.js'
import { getBalanceByParams, getBasicItemByCode } from '@/api/request2.js' import { getBalanceByParams, getBasicItemByCode } from '@/api/request2.js'
import { getListLocationAreaTypeDesc, checkDirectoryItemExist, getDirectoryItemArray, getLocationAreaTypeName, getInventoryStatusDesc, getListItemTypeDesc, getItemTypeInfo } from '@/common/directory.js' import { getListLocationAreaTypeDesc, checkDirectoryItemExist, getDirectoryItemArray, getLocationAreaTypeName, getInventoryStatusDesc, getListItemTypeDesc, getItemTypeInfo } from '@/common/directory.js'
import {getLabelInfo} from '@/common/label.js';
export default { export default {
name: 'winScanPack', name: 'winScanPack',
emits: ['getBalance', 'onCloseScanPopup'], emits: ['getBalance', 'onCloseScanPopup'],
@ -113,25 +113,54 @@ export default {
this.fromLocationAreaTypeList = getDirectoryItemArray(businessType.outAreaTypes) this.fromLocationAreaTypeList = getDirectoryItemArray(businessType.outAreaTypes)
this.itemTypesList = getDirectoryItemArray(businessType.itemTypes) this.itemTypesList = getDirectoryItemArray(businessType.itemTypes)
this.$refs.popup.open('bottom') this.$refs.popup.open('bottom')
setTimeout(res=>{
this.packGetFocus()
},500)
}, },
openScanPopupForJob(fromLocationCode, fromLocationList, jobContent) { openScanPopupForJob(fromLocationCode, fromLocationList, jobContent) {
this.fromLocationCode = fromLocationCode this.fromLocationCode = fromLocationCode
this.fromLocationList = fromLocationList this.fromLocationCode = fromLocationCode;
if (fromLocationCode != '') { this.fromLocationList = fromLocationList;
this.packGetFocus() this.fromInventoryStatuses = getDirectoryItemArray(jobContent.outInventoryStatuses)
} else if (this.fromLocationList.length == 0) { this.inventoryStatus = getDirectoryItemArray(jobContent.outInventoryStatuses); //; //
this.locationGetFocus() this.fromLocationAreaTypeList = getDirectoryItemArray(jobContent.fromAreaTypes); //
this.$refs.popup.open('bottom')
setTimeout(res => {
if (this.fromLocationCode != '') {
this.packGetFocus();
} else {
if (this.fromLocationList.length == 0) {
this.locationGetFocus();
} else { } else {
this.fromLocationCode = this.fromLocationList[0] this.fromLocationCode = this.fromLocationList[0];
this.packGetFocus();
}
} }
setTimeout((res) => {
this.$refs.popup.open('bottom')
}, 500) }, 500)
},
//
openScanPopupForJobSimulate(fromLocationCode, fromLocationList, jobContent, scanMessage) {
this.fromLocationCode = fromLocationCode;
this.fromLocationList = fromLocationList;
if (!fromLocationCode) {
if (this.fromLocationList.length == 0) {
// this.locationGetFocus();
alert('没有来源库位:List')
} else {
this.fromLocationCode = this.fromLocationList[0];
}
}
this.fromInventoryStatuses = getDirectoryItemArray(jobContent.outInventoryStatuses) this.fromInventoryStatuses = getDirectoryItemArray(jobContent.outInventoryStatuses)
this.inventoryStatus = getDirectoryItemArray(jobContent.outInventoryStatuses) // 出库库存状态; //出库库存状态 this.inventoryStatus = getDirectoryItemArray(jobContent.outInventoryStatuses); //; //
this.fromLocationAreaTypeList = getDirectoryItemArray(jobContent.fromAreaTypes) // this.fromLocationAreaTypeList = getDirectoryItemArray(jobContent.fromAreaTypes); //
getLabelInfo(scanMessage, this.headerType, callback => {
if (callback.success) {
this.getScanResult(callback);
} else {
this.showErrorMessage(callback.message, res => {})
}
})
}, },
handleConfirm() { handleConfirm() {
@ -172,7 +201,12 @@ export default {
if (res.data.length == 0) { if (res.data.length == 0) {
const status = getInventoryStatusDesc(params.inventoryStatus) const status = getInventoryStatusDesc(params.inventoryStatus)
const areaType = getListLocationAreaTypeDesc(params.areaType) const areaType = getListLocationAreaTypeDesc(params.areaType)
const hint = `按物料号 [${params.itemCode}] <br>` + `包装号 [${params.packingNumber}] <br>` + `批次 [${params.batch}] <br>` + `状态 [${status}] <br>` + `库区 [${areaType}] <br>` + '未查找到库存余额' const hint = `按物料号 [${params.itemCode}] \n` +
`包装号 [${params.packingNumber}] \n` +
`批次 [${params.batch}] \n` +
`状态 [${status}] \n` +
`库区 [${areaType}] \n` +
'未查找到库存余额'
this.showErrorMessage(hint) this.showErrorMessage(hint)
} else if (res.data.length == 1) { } else if (res.data.length == 1) {
result.balance = res.data[0] result.balance = res.data[0]
@ -225,6 +259,7 @@ export default {
}) })
}, },
showErrorMessage(message) { showErrorMessage(message) {
this.packLoseFocus();
this.$refs.comMessage.showErrorMessage(message, (res) => { this.$refs.comMessage.showErrorMessage(message, (res) => {
if (res) { if (res) {
if (this.$refs.comscan) { if (this.$refs.comscan) {

39
src/mycomponents/scan/winComScanFg.vue

@ -5,11 +5,15 @@
<view class="pop_tab"> <view class="pop_tab">
<view class="tab_info"> <view class="tab_info">
<view class="conbox"> <view class="conbox">
<textarea inputmode="none" v-model="scanMsg" trim="all" maxlength="1000" style="margin-left: 5px; width: 90%" :focus="boxfocus" :placeholder="placeholderValue" @focus="getfocus" @blur="losefocus" @input="handelScanMsg" :cursor="cursorIndex"></textarea> <textarea inputmode="none" v-model="scanMsg"
trim="all" maxlength="1000" style="margin-left: 5px; width: 90%"
:focus="boxfocus" :placeholder="placeholderValue"
@focus="handleFocus" @input="handelScanMsg" :cursor="cursorIndex">
</textarea>
</view> </view>
<view class="uni-flex uni-row space-between u-col-center"> <view class="uni-flex uni-row space-between u-col-center">
<view class="uni-flex"> <view class="uni-flex">
<button class="clean_scan_btn" @click="clearScanValue()">清空</button> <button class="clean_scan_btn" @touchend.prevent="clearScanValue()">清空</button>
<button class="scan_btn" @click="clickScanMsg()">扫描</button> <button class="scan_btn" @click="clickScanMsg()">扫描</button>
</view> </view>
</view> </view>
@ -47,9 +51,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, getCurrentInstance, onMounted, nextTick, watch } from 'vue' import { ref, getCurrentInstance, onMounted, nextTick, watch } from 'vue'
import { Exception } from 'sass'
import { getLabelInfo } from '../../common/label.js' import { getLabelInfo } from '../../common/label.js'
import { getMesPackInfo } from '@/api/request2.js' import { getMesPackInfo } from '@/api/request2.js'
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
@ -91,9 +93,9 @@ onMounted(() => {
// uni.hideKeyboard() // uni.hideKeyboard()
// #ifdef H5 // #ifdef H5
if (document.querySelector('textarea') != null) { // if (document.querySelector('textarea') != null) {
document.querySelector('textarea').setAttribute('inputmode', 'none') // document.querySelector('textarea').setAttribute('inputmode', 'none')
} // }
// #endif // #endif
// hide() // hide()
placeholderValue.value = `请扫描${props.placeholder}` placeholderValue.value = `请扫描${props.placeholder}`
@ -104,20 +106,7 @@ watch(
placeholderValue.value = `请扫描${placeholder.value}` placeholderValue.value = `请扫描${placeholder.value}`
} }
) )
const handleFocus = () => {}
const hide = () => {
// #ifdef APP-PLUS
//
const interval = setInterval(function () {
uni.hideKeyboard() //
console.log('刷新')
}, 5)
setTimeout(() => {
clearInterval(interval)
console.log('停止刷新')
}, 1000)
// #endif
}
const setItemCodeSimulate = (itemCode, scanMsg) => { const setItemCodeSimulate = (itemCode, scanMsg) => {
itemCode.value = itemCode itemCode.value = itemCode
@ -135,6 +124,7 @@ const setValue = (val) => {
scanMsg.value = val scanMsg.value = val
} }
const clearScanValue = () => { const clearScanValue = () => {
cursorIndex.value = 0
scanMsg.value = '' scanMsg.value = ''
getfocus() getfocus()
} }
@ -151,7 +141,6 @@ const handelScanMsg = () => {
const content = scanMsg.value.trim() const content = scanMsg.value.trim()
// let content = that.scanMsg; // let content = that.scanMsg;
if (content == '') { if (content == '') {
getfocus()
comMessageRef.value.showErrorMessage('扫描内容为空,请重新扫描', (res) => { comMessageRef.value.showErrorMessage('扫描内容为空,请重新扫描', (res) => {
if (res) { if (res) {
scanMsg.value = '' scanMsg.value = ''
@ -182,6 +171,10 @@ const handelScanMsg = () => {
// const productDate = content.substr(lengthMat, 8) // const productDate = content.substr(lengthMat, 8)
// const batch = content.substr(lengthMat + 8, 3) // const batch = content.substr(lengthMat + 8, 3)
const order = content.substr(-8) const order = content.substr(-8)
if (content.length != lengthBc) {
clear();
throw new Error("解析错误:扫描标签长度与配置条码的长度不一致")
}
if (scanPartNumber != partNumber) { if (scanPartNumber != partNumber) {
clear() clear()
throw new Error(`解析错误:扫描的客户物料号【${scanPartNumber}】与生成条码配置表中的客户物料号【${partNumber}】不一致`) throw new Error(`解析错误:扫描的客户物料号【${scanPartNumber}】与生成条码配置表中的客户物料号【${partNumber}】不一致`)
@ -213,6 +206,7 @@ const handelScanMsg = () => {
emit('getResult', scanResult) emit('getResult', scanResult)
} }
} catch (error) { } catch (error) {
losefocus()
comMessageRef.value.showErrorMessage(error.message, (res) => { comMessageRef.value.showErrorMessage(error.message, (res) => {
if (res) { if (res) {
getfocus() getfocus()
@ -221,6 +215,7 @@ const handelScanMsg = () => {
} }
}) })
.catch((error) => { .catch((error) => {
losefocus()
comMessageRef.value.showErrorMessage(error, (res) => { comMessageRef.value.showErrorMessage(error, (res) => {
if (res) { if (res) {
scanMsg.value = '' scanMsg.value = ''

5
src/mycomponents/scan/winScanAsnNumber.vue

@ -1,6 +1,6 @@
<template> <template>
<view class=""> <view class="">
<u-popup v-model="isShow" mode="bottom"> <u-popup ref="popRef" v-model="isShow" 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=""> 扫描{{ title }} </view> <view class=""> 扫描{{ title }} </view>
@ -39,8 +39,9 @@ const scanList = ref([])
const expendIcon = ref('arrow-down') const expendIcon = ref('arrow-down')
const scan = ref() const scan = ref()
const openScanPopup = () => { const openScanPopup = () => {
setTimeout((res) => {
isShow.value = true isShow.value = true
setTimeout((res) => {
getfocus('bottom')
}, 500) }, 500)
} }
const closeScanPopup = () => { const closeScanPopup = () => {

44
src/mycomponents/scan/winScanButton.vue

@ -1,6 +1,6 @@
<template> <template>
<view> <view>
<view class="scan_float" @click="goScan('bottom')"> <view class="scan_float" :style="{left:viewLeft,top:viewTop}" ref="scanRef" @click="goScan('bottom')" @touchstart="handleTouchStart" @touchmove.prevent="handleTouchMove">
<image src="@/static/icons_ui/icon_scan_white.svg"></image> <image src="@/static/icons_ui/icon_scan_white.svg"></image>
<view>扫描</view> <view>扫描</view>
</view> </view>
@ -18,6 +18,48 @@
x: 0, x: 0,
y: 0 y: 0
}) })
const btnX = ref(20)
const btnY = ref(20)
const viewLeft = ref('auto')
const viewTop = ref('auto')
const getScreenWidth = ()=>{
return uni.getSystemInfoSync().windowWidth
}
const getScreenHeight = ()=>{
return uni.getSystemInfoSync().windowHeight
}
const handleTouchStart = (e) => {
const {
clientX,
clientY
} = e.changedTouches[0]
btnX.value = clientX - e.currentTarget.offsetLeft
btnY.value = clientY - e.currentTarget.offsetTop
}
const handleTouchMove = (e)=>{
let maxLeft = getScreenWidth() - 60
let maxTop = getScreenHeight() - 40
const {
clientX,
clientY
} = e.changedTouches[0]
// this.$refs.scanRef.$el.style.left = e.changedTouches[0].clientX-this.btnX+'px'
// this.$refs.scanRef.$el.style.top = e.changedTouches[0].clientY-this.btnY+'px'
let newLeft = clientX - btnX.value
let newTop = clientY - btnY.value
if (newTop > 0 && newTop < maxTop) {
viewTop.value = newTop + 'px'
}
if (newLeft > 0 && newLeft < maxLeft) {
viewLeft.value = newLeft + 'px'
}
// const query = uni.createSelectorQuery().in(this)
// console.log('scanRef',query.select("#scanRef"))
// query.select("#scanRef").boundingClientRect((data=>{
// console.log('',data)
// })).exec();
}
const goScan = (content) => { const goScan = (content) => {
emit("goScan", ''); emit("goScan", '');
} }

3
src/mycomponents/scan/winScanContainer.vue

@ -39,8 +39,9 @@ const show = ref(false)
const scan = ref() const scan = ref()
const comMessageRef = ref() const comMessageRef = ref()
const openScanPopup = () => { const openScanPopup = () => {
setTimeout((res) => {
show.value = true show.value = true
setTimeout((res) => {
getfocus()
}, 500) }, 500)
} }
const closeScanPopup = () => { const closeScanPopup = () => {

15
src/mycomponents/scan/winScanFgLabel.vue

@ -16,9 +16,6 @@
</view> </view>
</view> </view>
</u-popup> </u-popup>
<!-- 模拟扫描功能 -->
<win-com-scan-fg v-show="false" ref="comscansimulate" @getResult="getScanResult" :isShowHistory="false" :clearResult="true"></win-com-scan-fg>
<com-message ref="comMessageRef" @afterClose="getfocus" /> <com-message ref="comMessageRef" @afterClose="getfocus" />
</view> </view>
</template> </template>
@ -40,17 +37,14 @@ const props = defineProps({
const show = ref(false) const show = ref(false)
const comscan = ref() const comscan = ref()
const comscansimulate = ref() const comscansimulate = ref()
//
const simulateScan = (item) => {
comscansimulate.value.setItemCodeSimulate(item.itemCode, item.copyContent)
comscansimulate.value.clickScanMsg()
}
const openScanPopup = (itemCode) => { const openScanPopup = (itemCode) => {
setTimeout((res) => {
show.value = true show.value = true
setTimeout((res) => {
setTimeout((re) => { setTimeout((re) => {
comscan.value.setItemCode(itemCode) comscan.value.setItemCode(itemCode)
}, 500) }, 500)
getfocus()
}, 200) }, 200)
} }
@ -80,7 +74,7 @@ const getfocus = () => {
} }
} }
const losefocus = () => { const losefocus = () => {
if (comscan.value != undefined) { if (comscan.value) {
comscan.value.losefocus() comscan.value.losefocus()
} }
} }
@ -94,7 +88,6 @@ defineExpose({
closeScanPopup, closeScanPopup,
losefocus, losefocus,
getfocus, getfocus,
simulateScan
}) })
</script> </script>

3
src/mycomponents/scan/winScanItem.vue

@ -52,8 +52,9 @@ const scan = ref()
const expendIcon = ref('arrow-down') const expendIcon = ref('arrow-down')
const comMessageRef = ref() const comMessageRef = ref()
const openScanPopup = () => { const openScanPopup = () => {
setTimeout((res) => {
isShow.value = true isShow.value = true
setTimeout((res) => {
getfocus()
}, 500) }, 500)
} }
const closeScanPopup = () => { const closeScanPopup = () => {

5
src/mycomponents/scan/winScanJobNumber.vue

@ -41,8 +41,9 @@ const scanList = ref([])
const expendIcon = ref('arrow-down') const expendIcon = ref('arrow-down')
const scan = ref() const scan = ref()
const openScanPopup = () => { const openScanPopup = () => {
setTimeout((res) => {
isShow.value = true isShow.value = true
setTimeout((res) => {
getfocus()
}, 500) }, 500)
} }
const closeScanPopup = () => { const closeScanPopup = () => {
@ -52,7 +53,7 @@ const closeScanPopup = () => {
isShow.value = false isShow.value = false
} }
const getfocus = () => { const getfocus = () => {
if (isShow.value) { if (scan.value) {
scan.value.getfocus() scan.value.getfocus()
} }
} }

3
src/mycomponents/scan/winScanLocation.vue

@ -48,8 +48,9 @@ const scan = ref()
const comMessageRef = ref() const comMessageRef = ref()
const comscansimulate = ref() const comscansimulate = ref()
const openScanPopup = () => { const openScanPopup = () => {
setTimeout((res) => {
show.value = true show.value = true
setTimeout((res) => {
getfocus()
}, 500) }, 500)
} }
const openScanPopupSimulate = (location) => { const openScanPopupSimulate = (location) => {

3
src/mycomponents/scan/winScanPack.vue

@ -55,8 +55,9 @@ const simulateScan = (scanMessage) => {
}) })
} }
const openScanPopup = () => { const openScanPopup = () => {
setTimeout((res) => {
show.value = true show.value = true
setTimeout((res) => {
getfocus()
}, 200) }, 200)
} }

3
src/mycomponents/scan/winScanPackAndCont.vue

@ -52,8 +52,9 @@ export default {
created() {}, created() {},
methods: { methods: {
openScanPopup() { openScanPopup() {
setTimeout((res) => {
this.$refs.popup.open('bottom') this.$refs.popup.open('bottom')
setTimeout(res => {
this.getfocus()
}, 500) }, 500)
}, },

101
src/mycomponents/scan/winScanPackAndLocation.vue

@ -48,6 +48,7 @@ import { getBasicLocationByCode } from '@/api/request2.js'
import { getListLocationAreaTypeDesc, checkDirectoryItemExist, getDirectoryItemArray, getLocationAreaTypeName, getInventoryStatusDesc } from '@/common/directory.js' import { getListLocationAreaTypeDesc, checkDirectoryItemExist, getDirectoryItemArray, getLocationAreaTypeName, getInventoryStatusDesc } from '@/common/directory.js'
import { getLabelInfo } from '@/common/label.js' import { getLabelInfo } from '@/common/label.js'
import {a} from "unocss-preset-weapp/dist/utilities-322cd311";
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const props = defineProps({ const props = defineProps({
@ -90,7 +91,11 @@ const props = defineProps({
// fromInventoryStatuses // fromInventoryStatuses
type: Boolean, type: Boolean,
default: true default: true
} },
toLocationCode: {
type: String,
default: ""
},
}) })
const scanResult = ref({}) const scanResult = ref({})
const show = ref(false) const show = ref(false)
@ -112,7 +117,7 @@ const balanceSelectRef = ref()
const comscan = ref() const comscan = ref()
const comMessageRef = ref() const comMessageRef = ref()
const location = ref() const location = ref()
const chooseWhich = ref('1')
const handleConfirm = () => { const handleConfirm = () => {
emit('confirm', fromLocationCode.value) emit('confirm', fromLocationCode.value)
} }
@ -120,25 +125,29 @@ const handleConfirm = () => {
const openScanPopupForType = (fromLocationCodeParams, businessTypeParams) => { const openScanPopupForType = (fromLocationCodeParams, businessTypeParams) => {
businessType.value = businessTypeParams businessType.value = businessTypeParams
fromLocationCode.value = fromLocationCodeParams fromLocationCode.value = fromLocationCodeParams
fromInventoryStatuses.value = getDirectoryItemArray(businessType.value.outInventoryStatuses)
inventoryStatus.value = getDirectoryItemArray(businessType.value.outInventoryStatuses) //
fromLocationAreaTypeList.value = getDirectoryItemArray(businessType.value.outAreaTypes) //
show.value = true
setTimeout((res) => {
if (fromLocationCodeParams != '') { if (fromLocationCodeParams != '') {
packGetFocus() packGetFocus()
} else { } else {
locationGetFocus() locationGetFocus()
} }
fromInventoryStatuses.value = getDirectoryItemArray(businessType.value.outInventoryStatuses)
inventoryStatus.value = getDirectoryItemArray(businessType.value.outInventoryStatuses) //
fromLocationAreaTypeList.value = getDirectoryItemArray(businessType.value.outAreaTypes) //
if (!show.value) {
setTimeout((res) => {
show.value = true
}, 500) }, 500)
} }
}
// //
const openScanPopupForJob = (fromLocationCodePrams, fromLocationListPrams, jobContent) => { const openScanPopupForJob = (fromLocationCodePrams, fromLocationListPrams, jobContent) => {
fromLocationCode.value = fromLocationCodePrams fromLocationCode.value = fromLocationCodePrams
fromLocationList.value = fromLocationListPrams fromLocationList.value = fromLocationListPrams
fromInventoryStatuses.value = getDirectoryItemArray(jobContent.outInventoryStatuses)
inventoryStatus.value = getDirectoryItemArray(jobContent.outInventoryStatuses) // 出库库存状态; //出库库存状态
fromLocationAreaTypeList.value = getDirectoryItemArray(jobContent.fromAreaTypes) //
show.value = true
setTimeout((res) => {
if (fromLocationCodePrams != '') { if (fromLocationCodePrams != '') {
packGetFocus() packGetFocus()
} else if (fromLocationList.value.length == 0) { } else if (fromLocationList.value.length == 0) {
@ -146,12 +155,8 @@ const openScanPopupForJob = (fromLocationCodePrams, fromLocationListPrams, jobCo
} else { } else {
fromLocationCode.value = fromLocationList.value[0] fromLocationCode.value = fromLocationList.value[0]
} }
setTimeout((res) => {
show.value = true
}, 500) }, 500)
fromInventoryStatuses.value = getDirectoryItemArray(jobContent.outInventoryStatuses)
inventoryStatus.value = getDirectoryItemArray(jobContent.outInventoryStatuses) // 出库库存状态; //出库库存状态
fromLocationAreaTypeList.value = getDirectoryItemArray(jobContent.fromAreaTypes) //
} }
// //
const openScanPopupForJobSimulate = (fromLocationCodeParams, fromLocationListParams, jobContent, item) => { const openScanPopupForJobSimulate = (fromLocationCodeParams, fromLocationListParams, jobContent, item) => {
@ -169,7 +174,12 @@ const openScanPopupForJobSimulate = (fromLocationCodeParams, fromLocationListPar
fromInventoryStatuses.value = getDirectoryItemArray(jobContent.outInventoryStatuses) fromInventoryStatuses.value = getDirectoryItemArray(jobContent.outInventoryStatuses)
inventoryStatus.value = getDirectoryItemArray(jobContent.outInventoryStatuses) // 出库库存状态; //出库库存状态 inventoryStatus.value = getDirectoryItemArray(jobContent.outInventoryStatuses) // 出库库存状态; //出库库存状态
fromLocationAreaTypeList.value = getDirectoryItemArray(jobContent.fromAreaTypes) // fromLocationAreaTypeList.value = getDirectoryItemArray(jobContent.fromAreaTypes) //
uni.showLoading({
title: "获取标签信息",
mask: true
})
getLabelInfo(scanMessage, headerType.value, (callback) => { getLabelInfo(scanMessage, headerType.value, (callback) => {
uni.hideLoading()
if (callback.success) { if (callback.success) {
getScanResult(callback) getScanResult(callback)
} else { } else {
@ -255,7 +265,7 @@ const getScanResult = (result) => {
// this.checkPackage(result); // this.checkPackage(result);
// } // }
} }
const checkPackage = (result) => { const checkPackage = async (result) => {
if (result.label != null) { if (result.label != null) {
scanResult.value = result scanResult.value = result
// uni.showLoading({ // uni.showLoading({
@ -263,11 +273,21 @@ const checkPackage = (result) => {
// mask: true // mask: true
// }) // })
if (props.queryBalance == true) { if (props.queryBalance == true) {
getBalanceByManagementPrecisionByPacking(result.label, fromLocationCode.value, props.balanceFromInventoryStatuses ? fromInventoryStatuses.value : undefined, (res) => { await getBalanceByManagementPrecisionByPacking(result.label, fromLocationCode.value, props.balanceFromInventoryStatuses ? fromInventoryStatuses.value : undefined, (res) => {
uni.hideLoading() uni.hideLoading()
if (res.success) { if (res.success) {
managementPrecision.value = res.managementPrecision managementPrecision.value = res.managementPrecision
afterQueryBalance(res.data.list) if (managementPrecision.value == 'BY_BATCH') {
res.data.list.forEach(item => {
item.packingNumber = ''
})
}
chooseWhich.value = '2'
if (res.data && res.data.list && res.data.list.length > 1) {
showBalanceSelect(res.data.list);
} else {
afterQueryBalance(res.data.list);
}
} else { } else {
showErrorMessage(res.message, (res) => { showErrorMessage(res.message, (res) => {
packGetFocus() packGetFocus()
@ -298,9 +318,9 @@ const afterQueryBalance = (datas) => {
uni.hideLoading() uni.hideLoading()
} }
// //
const allowNoneBalance = (datas) => { const allowNoneBalance = async (datas) => {
if (datas.length == 0) { if (datas.length == 0) {
packCallBack(null) await packCallBack(null)
} else { } else {
showErrorMessage(`在来源库位[${fromLocationCode.value}],已经查找到该包装的库存记录,请重新扫描`, (res) => { showErrorMessage(`在来源库位[${fromLocationCode.value}],已经查找到该包装的库存记录,请重新扫描`, (res) => {
packGetFocus() packGetFocus()
@ -311,7 +331,7 @@ const allowNoneBalance = (datas) => {
const mustHavaBalance = (datas) => { const mustHavaBalance = (datas) => {
if (datas.length == 0) { if (datas.length == 0) {
showErrorMessage(`${getQueryCondition()}<br>未查找到库存记录`, (res) => { showErrorMessage(`${getQueryCondition()}\n未查找到库存记录`, (res) => {
packGetFocus() packGetFocus()
}) })
} else if (datas.length == 1) { } else if (datas.length == 1) {
@ -330,13 +350,18 @@ const mustHavaBalance = (datas) => {
// } // }
} else { } else {
showBalanceSelect(datas) showBalanceSelect(datas)
chooseWhich.value = '1'
} }
} }
const showBalanceSelect = (items) => { const showBalanceSelect = (items) => {
balanceSelectRef.value.openPopup(items) balanceSelectRef.value.openPopup(items)
} }
const selectBalanceItem = (balance) => { const selectBalanceItem = (balance) => {
packCallBack(balance) if (chooseWhich.value == 1) {
packCallBack(balance);
} else {
countCallBack(balance);
}
// 20231228 // 20231228
// if (balance.qty > 0) { // if (balance.qty > 0) {
// this.packCallBack(balance); // this.packCallBack(balance);
@ -361,12 +386,17 @@ const countCallBack = (datas) => {
balance: datas, balance: datas,
fromLocationCode: fromLocationCode.value fromLocationCode: fromLocationCode.value
} }
packGetFocus() // this.packGetFocus();
emit('getResult', data) //
if (managementPrecision.value == 'BY_BATCH' || managementPrecision.value == 'BY_QUANTITY') {
emit("getResult", data, managementPrecision.value);
} else {
emit("getResult", data);
}
emit('getCountScanResult', data) emit('getCountScanResult', data)
} }
const packCallBack = (item) => { const packCallBack = async (item) => {
if (comscan.value) { if (comscan.value) {
comscan.value.clear() comscan.value.clear()
} }
@ -378,10 +408,15 @@ const packCallBack = (item) => {
fromLocationCode: fromLocationCode.value fromLocationCode: fromLocationCode.value
} }
packGetFocus() packGetFocus()
emit('getResult', data) //
if (managementPrecision.value == 'BY_BATCH' || managementPrecision.value == 'BY_QUANTITY') {
emit("getResult", data, managementPrecision.value);
} else {
emit("getResult", data);
}
} }
const packGetFocus = () => { const packGetFocus = () => {
if (comscan.value != undefined) { if (comscan.value) {
comscan.value.getfocus() comscan.value.getfocus()
} }
} }
@ -395,16 +430,20 @@ const locationGetFocus = () => {
locationOnFocus.value = true locationOnFocus.value = true
} }
const getQueryCondition = () => { const getQueryCondition = () => {
let condition = '按照以下条件:<br>' let condition = '按照以下条件:\n'
const { label } = scanResult.value const { label } = scanResult.value
const status = getInventoryStatusDesc(inventoryStatus.value) let isShowStatus = props.balanceFromInventoryStatuses ? fromInventoryStatuses.value : undefined
let status = ''
if (isShowStatus) {
status = getInventoryStatusDesc(isShowStatus);
}
switch (managementPrecision.value) { switch (managementPrecision.value) {
case 'BY_PACKAGING': case 'BY_PACKAGING':
condition = `${condition}物料号=[${label.itemCode}]<br>箱码=[${label.packingNumber}]<br>批次=[${label.batch}]<br>库位=[${fromLocationCode.value}]` condition = `${condition}物料号=[${label.itemCode}]\n箱码=[${label.packingNumber}]\n批次=[${label.batch}]\n库位=[${fromLocationCode.value}]`
break break
case 'BY_BATCH': case 'BY_BATCH':
condition = `${condition}物料号=[${label.itemCode}]<br>批次=[${label.batch}]<br>库位=[${fromLocationCode.value}]` condition = `${condition}物料号=[${label.itemCode}]\n批次=[${label.batch}]\n库位=[${fromLocationCode.value}]`
break break
case 'BY_QUANTITY': case 'BY_QUANTITY':
condition = `${condition}物料号=[${label.itemCode}]<br>库位=[${fromLocationCode.value}]` condition = `${condition}物料号=[${label.itemCode}]<br>库位=[${fromLocationCode.value}]`
@ -413,7 +452,7 @@ const getQueryCondition = () => {
condition = `${condition}物料号=[${label.itemCode}]` condition = `${condition}物料号=[${label.itemCode}]`
break break
} }
if (inventoryStatus.value.length > 0) { if (status) {
condition = `${condition}<br>库存状态=[${status}]` condition = `${condition}<br>库存状态=[${status}]`
} }
return condition return condition

26
src/mycomponents/scan/winScanPackAndLocationNoBalance.vue

@ -100,35 +100,37 @@ const comMessageRef = ref()
const openScanPopupForType = (fromLocationCodeParms, businessTypeParms) => { const openScanPopupForType = (fromLocationCodeParms, businessTypeParms) => {
businessType.value = businessTypeParms businessType.value = businessTypeParms
fromLocationCode.value = fromLocationCodeParms fromLocationCode.value = fromLocationCodeParms
fromInventoryStatuses.value = getDirectoryItemArray(businessType.value.outInventoryStatuses)
inventoryStatus.value = getDirectoryItemArray(businessType.value.outInventoryStatuses) //
fromLocationTypeArray.value = getDirectoryItemArray(businessType.value.outLocationTypes) //
show.value = true
setTimeout((res) => {
if (fromLocationCodeParms != '') { if (fromLocationCodeParms != '') {
packGetFocus() packGetFocus()
} else { } else {
locationGetFocus() locationGetFocus()
} }
fromInventoryStatuses.value = getDirectoryItemArray(businessType.value.outInventoryStatuses)
inventoryStatus.value = getDirectoryItemArray(businessType.value.outInventoryStatuses) //
fromLocationTypeArray.value = getDirectoryItemArray(businessType.value.outLocationTypes) //
setTimeout((res) => {
show.value = true
}, 500) }, 500)
} }
// //
const openScanPopupForJob = (fromLocationCodeParms, fromLocationListParms, jobContent) => { const openScanPopupForJob = (fromLocationCodeParms, fromLocationListParms, jobContent) => {
fromLocationCode.value = fromLocationCodeParms fromLocationCode.value = fromLocationCodeParms
fromLocationList.value = fromLocationListParms fromLocationList.value = fromLocationListParms
fromInventoryStatuses.value = getDirectoryItemArray(jobContent.outInventoryStatuses)
inventoryStatus.value = getDirectoryItemArray(jobContent.outInventoryStatuses) // 出库库存状态; //出库库存状态
fromLocationTypeArray.value = getDirectoryItemArray(jobContent.fromLocationTypes) //
show.value = true
setTimeout((res) => {
if (fromLocationListParms != '') { if (fromLocationListParms != '') {
packGetFocus() packGetFocus()
} else if (fromLocationList.value.length == 0) { } else if (fromLocationList.value.length == 0) {
locationGetFocus() locationGetFocus()
} else { } else {
fromLocationCode.value = tfromLocationList.value[0] fromLocationCode.value = fromLocationList.value[0]
packGetFocus()
} }
setTimeout((res) => {
show.value = true
}, 500) }, 500)
fromInventoryStatuses.value = getDirectoryItemArray(jobContent.outInventoryStatuses)
inventoryStatus.value = getDirectoryItemArray(jobContent.outInventoryStatuses) // 出库库存状态; //出库库存状态
fromLocationTypeArray.value = getDirectoryItemArray(jobContent.fromLocationTypes) //
} }
const closeScanPopup = (content) => { const closeScanPopup = (content) => {
packLoseFocus() packLoseFocus()
@ -176,7 +178,7 @@ const getScanResult = (scanResult) => {
} else { } else {
uni.hideLoading() uni.hideLoading()
const hint = getListLocationTypeDesc(fromLocationTypeArray.value) const hint = getListLocationTypeDesc(fromLocationTypeArray.value)
showErrorMessage(`库位[${fromLocationCode.value}]是${getLocationTypeName(type)},<br>需要的库位类型是[${hint}]`, (callback) => { showErrorMessage(`库位[${fromLocationCode.value}]是${getLocationTypeName(type)},\n需要的库位类型是[${hint}]`, (callback) => {
locationGetFocus() locationGetFocus()
}) })
} }

3
src/mycomponents/scan/winScanPackAndPosition.vue

@ -81,8 +81,9 @@ const openScanPopup = () => {
showErrorMessage(error) showErrorMessage(error)
}) })
} }
setTimeout((res) => {
isShow.value = true isShow.value = true
setTimeout((res) => {
getfocus()
}, 500) }, 500)
} }

7
src/mycomponents/scan/winScanPackJob.vue

@ -46,6 +46,9 @@ const show = ref(false)
// //
const openScanPopup = () => { const openScanPopup = () => {
show.value = true show.value = true
setTimeout(()=>{
packGetFocus()
},500)
} }
// //
const closeScanPopup = (content) => { const closeScanPopup = (content) => {
@ -59,13 +62,13 @@ const getScanResult = (result) => {
emit('getResult', result) emit('getResult', result)
} }
const packGetFocus = () => { const packGetFocus = () => {
if (comscan.value != undefined) { if (comscan.value) {
comscan.value.getfocus() comscan.value.getfocus()
} }
} }
const packLoseFocus = () => { const packLoseFocus = () => {
if (comscan.value != undefined) { if (comscan.value) {
comscan.value.losefocus() comscan.value.losefocus()
} }
} }

7
src/mycomponents/scan/winScanPackLevel.vue

@ -78,8 +78,9 @@
}) })
} }
const openScanPopup = () => { const openScanPopup = () => {
setTimeout((res) => {
show.value = true show.value = true
setTimeout((res) => {
getfocus()
}, 200) }, 200)
} }
const closeScanPopup = () => { const closeScanPopup = () => {
@ -114,14 +115,14 @@
const getfocus = () => { const getfocus = () => {
if (comscan.value != undefined) { if (comscan.value) {
comscan.value.getfocus() comscan.value.getfocus()
} }
} }
const losefocus = () => { const losefocus = () => {
if (comscan.value != undefined) { if (comscan.value) {
comscan.value.losefocus() comscan.value.losefocus()
} }
} }

55
src/mycomponents/scan/winScanPackage.vue

@ -26,7 +26,11 @@
import { ref, getCurrentInstance, onMounted, nextTick, watch } from 'vue' import { ref, getCurrentInstance, onMounted, nextTick, watch } from 'vue'
import winComScan from '@/mycomponents/scan/winComScan.vue' import winComScan from '@/mycomponents/scan/winComScan.vue'
import { getBalanceByFilter } from '@/api/request2.js' import { getBalanceByFilter } from '@/api/request2.js'
import {
getInventoryStatusDesc,
getDirectoryItemArray,
getLocationAreaTypeName
} from '@/common/directory.js';
const props = defineProps({ const props = defineProps({
title: { title: {
type: String, type: String,
@ -46,13 +50,15 @@ const comscansimulate = ref()
const comscan = ref() const comscan = ref()
const comMessageRef = ref() const comMessageRef = ref()
const businessType = ref(null) const businessType = ref(null)
const scanResult = ref({})
const simulateScan = (item) => { const simulateScan = (item) => {
comscansimulate.value.setItemCodeSimulate(item.copyContent) comscansimulate.value.setItemCodeSimulate(item.copyContent)
comscansimulate.value.clickScanMsg() comscansimulate.value.clickScanMsg()
} }
const openScanPopup = () => { const openScanPopup = () => {
setTimeout((res) => {
show.value = true show.value = true
setTimeout((res) => {
getfocus()
}, 200) }, 200)
} }
@ -62,10 +68,11 @@ const closeScanPopup = () => {
emit('close', '') emit('close', '')
} }
const openScanPopupByBusinessType = (businessTypeParams) => { const openScanPopupByBusinessType = (businessTypeParams) => {
setTimeout((res) => {
show.value = false show.value = false
setTimeout((res) => {
getfocus()
businessType.value = businessTypeParams businessType.value = businessTypeParams
}, 200) }, 500)
} }
const scanClick = () => { const scanClick = () => {
if (comscan.value) { if (comscan.value) {
@ -81,6 +88,7 @@ const cancelClick = () => {
const getScanResult = (result) => { const getScanResult = (result) => {
if (result.success) { if (result.success) {
scanResult.value = result
getBalance(result, (res) => { getBalance(result, (res) => {
result.balance = res result.balance = res
emit('getResult', result) emit('getResult', result)
@ -122,6 +130,29 @@ const getParams = (label)=> {
} }
return filters; return filters;
} }
const getQueryCondition = ()=> {
let condition = '按照以下条件:\n';
let label = scanResult.value.label;
let status = getInventoryStatusDesc(getDirectoryItemArray(businessType.value.outInventoryStatuses));
let areaType = getLocationAreaTypeName(businessType.value.outAreaTypes)
condition = condition + '物料号=[' + label.itemCode
+ ']\n箱码=[' + label.packingNumber +
']\n批次=[' +
label.batch +
']'
if (status) {
condition = condition + '\n库存状态=[' + status + ']'
}
if (areaType) {
condition = condition + '\n库区类型=[' + areaType + ']'
}
if (businessType.value.outAreaCodes) {
condition = condition + '\n库区代码=[' + businessType.value.outAreaCodes + ']'
}
return condition;
}
const getBalance = (result, callback) => { const getBalance = (result, callback) => {
let filters = [] let filters = []
const { label } = result const { label } = result
@ -156,7 +187,7 @@ const getBalance = (result, callback) => {
.then((res) => { .then((res) => {
if (res.data.list.length > 0) { if (res.data.list.length > 0) {
res.data.list.forEach(r => { res.data.list.forEach(r => {
if (packageInfo.parentNumber !== null) { if (packageInfo.parentNumber) {
r.parentPackingNumber = packageInfo.parentNumber r.parentPackingNumber = packageInfo.parentNumber
} else { } else {
r.parentPackingNumber = packageInfo.number r.parentPackingNumber = packageInfo.number
@ -181,9 +212,7 @@ const getBalance = (result, callback) => {
params.filters = filters; params.filters = filters;
getBalanceByFilter(params).then(res1 => { getBalanceByFilter(params).then(res1 => {
if (res1.data.list.length == 0) { if (res1.data.list.length == 0) {
this.showErrorMessage('未查找到该包装的库存余额', res => { showErrorMessage(getQueryCondition()+'\n未查找到该包装的库存余额')
this.packGetFocus();
})
} else { } else {
res1.data.list.forEach(r => r.parentPackingNumber = packageInfo.number) res1.data.list.forEach(r => r.parentPackingNumber = packageInfo.number)
callback(res1.data.list) callback(res1.data.list)
@ -192,9 +221,7 @@ const getBalance = (result, callback) => {
this.showErrorMessage(err.message); this.showErrorMessage(err.message);
}) })
} else { } else {
this.showErrorMessage('未查找到该包装的库存余额', res => { showErrorMessage(getQueryCondition()+'\n未查找到该包装的库存余额')
this.packGetFocus();
})
} }
} }
}) })
@ -203,13 +230,13 @@ const getBalance = (result, callback) => {
}) })
} }
const getfocus = () => { const getfocus = () => {
if (comscan.value != undefined) { if (comscan.value) {
comscan.value.getfocus() comscan.value.getfocus()
} }
} }
const losefocus = () => { const losefocus = () => {
if (comscan.value != undefined) { if (comscan.value) {
comscan.value.losefocus() comscan.value.losefocus()
} }
} }
@ -218,8 +245,10 @@ const showMessage = (message) => {
comMessageRef.value.showMessage(message) comMessageRef.value.showMessage(message)
} }
const showErrorMessage = (message) => { const showErrorMessage = (message) => {
losefocus()
comMessageRef.value.showErrorMessage(message, (res) => { comMessageRef.value.showErrorMessage(message, (res) => {
if (res) { if (res) {
getfocus()
} }
}) })
} }

274
src/mycomponents/scan/winScanParentPackage.vue

@ -0,0 +1,274 @@
<template>
<view>
<uni-popup ref="popup" @change="change" :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"
:headerType="headerType" :isShowHistory="isShowHistory" :clearResult="true"></win-com-scan>
</view>
</view>
</view>
</uni-popup>
<!-- 模拟扫描功能 -->
<win-com-scan v-show="false" ref="comscansimulate" @getResult="getScanResult" :headerType="headerType"
:isShowHistory="false" :clearResult="true"></win-com-scan>
<comMessage ref="comMessage" @afterClose="getfocus"></comMessage>
</view>
</template>
<script>
import winComScan from '@/mycomponents/scan/winComScan.vue'
import {
getBalanceByFilter
} from '@/api/request2.js';
export default {
name: 'winScanParentPackage',
components: {
winComScan,
},
props: {
title: {
type: String,
default: '箱标签'
},
isShowHistory: {
type: Boolean,
default: true
},
headerType: {
type: String,
default: 'HPQ,HMQ'
}
},
data() {
return {
show: false,
businessType: null
}
},
created() {
},
methods: {
simulateScan(item) {
this.$refs.comscansimulate.setItemCodeSimulate(item.copyContent)
this.$refs.comscansimulate.clickScanMsg();
},
openScanPopup() {
this.$refs.popup.open('bottom')
setTimeout(res => {
this.getfocus()
}, 500)
},
openScanPopupByBusinessType(businessType) {
this.$refs.popup.open('bottom')
setTimeout(res => {
this.getfocus()
this.businessType = businessType;
}, 500)
},
closeScanPopup() {
this.losefocus()
this.$refs.popup.close();
this.$emit("close", '');
},
scanClick() {
if (this.$refs.comscan) {
this.$refs.comscan.clickScanMsg();
}
},
cancelClick() {
if (this.$refs.comscan) {
this.$refs.comscan.clearScanValue();
}
},
getScanResult(result) {
if (result.success) {
this.getBalance(result, res => {
result.balance = res;
this.$emit("getResult", result);
})
} else {
this.showMessage(result.message)
}
},
getParams(label) {
let filters = [{
column: "itemCode",
action: "==",
value: label.itemCode
}, {
column: "batch",
action: "==",
value: label.batch
}];
if (this.businessType.outInventoryStatuses != null) {
filters.push({
column: "inventoryStatus",
action: "in",
value: this.businessType.outInventoryStatuses
})
}
if (this.businessType.outAreaTypes != null) {
filters.push({
column: "areaType",
action: "in",
value: this.businessType.outAreaTypes
})
}
if (this.businessType.outAreaCodes != null) {
filters.push({
column: "areaCode",
action: "in",
value: this.businessType.outAreaCodes
})
}
return filters;
},
getBalance(result, callback) {
let filters = [];
let packageInfo = result.package;
let comfilters = this.getParams(packageInfo);
let balance = {
parentBalance: {},
childBalance: []
};
let parentPackingNumber = packageInfo.parentNumber;
let childPackingNumber = packageInfo.number;
//packageInfo.subList0
//1.
if (parentPackingNumber) {
let packingNumber = parentPackingNumber + "," + childPackingNumber;
filters.push({
column: "packingNumber",
action: "in",
value: packingNumber
})
} else {
filters.push({
column: "packingNumber",
action: "==",
value: childPackingNumber
})
}
filters = filters.concat(comfilters);
var params = {
filters: filters,
pageNo: 1,
pageSize: 100,
}
getBalanceByFilter(params).then(res => {
res.data.list.forEach(r => {
if (packageInfo.parentNumber) {
r.parentPackingNumber = parentPackingNumber
} else {
r.parentPackingNumber = childPackingNumber
}
})
//
if (packageInfo.subList.length > 0) {
let packparams = '';
packageInfo.subList.forEach(pack => {
packparams = packparams + pack.number + ','
})
packparams = packparams.trimEnd(',');
filters = [];
filters.push({
column: "packingNumber",
action: "in",
value: packparams
})
filters = filters.concat(comfilters);
params.filters = filters;
getBalanceByFilter(params).then(res1 => {
if (res1.data.list.length == 0) {
this.showErrorMessage('未查找到该包装的库存余额', res => {
this.packGetFocus();
})
} else {
res1.data.list.forEach(r => r.parentPackingNumber = childPackingNumber)
balance.parentBalance = res.data.list.filter(r => r.packingNumber ==
childPackingNumber)
balance.childBalance = res1.data.list;
callback(balance);
}
}).catch(err => {
this.showErrorMessage(err.message);
})
} else {
//
//()
balance.childBalance = res.data.list.filter(r => r.packingNumber == childPackingNumber)
balance.parentBalance = res.data.list.filter(r => r.packingNumber == parentPackingNumber)
callback(balance);
}
}).catch(err => {
this.showErrorMessage(err.message);
})
},
getfocus() {
if (this.$refs.comscan) {
this.$refs.comscan.getfocus();
}
},
losefocus() {
if (this.$refs.comscan) {
this.$refs.comscan.losefocus();
}
},
showMessage(message) {
this.$refs.comMessage.showMessage(message);
},
change(e) {
this.show = e.show
},
showErrorMessage(message) {
this.losefocus()
this.$refs.comMessage.showErrorMessage(message, res => {
if (res) {
this.getfocus();
}
});
},
}
}
</script>
<style lang="scss">
.scroll-view {
overflow-y: scroll;
height: auto;
max-height: 300rpx;
}
</style>
Loading…
Cancel
Save