Browse Source

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

hella_vue3
王志国 4 weeks ago
parent
commit
e65e75151a
  1. 34
      src/mycomponents/scan/winCheckFgLabel.vue
  2. 46
      src/mycomponents/scan/winComScan.vue
  3. 15
      src/mycomponents/scan/winComScanBalance.vue
  4. 65
      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. 5
      src/mycomponents/scan/winScanPackAndCont.vue
  15. 117
      src/mycomponents/scan/winScanPackAndLocation.vue
  16. 36
      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

34
src/mycomponents/scan/winCheckFgLabel.vue

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

46
src/mycomponents/scan/winComScan.vue

@ -4,12 +4,15 @@
<view class="pop_tab">
<view class="tab_info">
<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 class="uni-flex uni-row space-between u-col-center">
<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>
</view>
</view>
@ -59,10 +62,10 @@ const props = defineProps({
type: Boolean,
default: true
},
boxFocus: {
type: Boolean,
default: true
},
// boxFocus: {
// type: Boolean,
// default: true
// },
isShowHistory: {
type: Boolean,
default: true
@ -84,16 +87,7 @@ const cursorIndex = ref(0)
const comMessageRef = ref('')
placeholderValue.value = `请扫描${props.placeholder}`
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(
@ -124,6 +118,7 @@ const setValue = (val) => {
}
const clearScanValue = () => {
scanMsg.value = ''
// this.cursorIndex = 0
getfocus()
}
const clickScanMsg = () => {
@ -132,14 +127,13 @@ const clickScanMsg = () => {
}
const handelScanMsg = () => {
//
const index = scanMsg.value.indexOf('\n')
if (index >= 0) {
if (scanMsg.value.indexOf('\n')) {
// that.scanMsg = 'HPQ;V1.0;ICE115F11161AG;PP20230427000027;B20230427002;Q50';
setTimeout(() => {
losefocus()
const content = scanMsg.value.trim()
if (content == '') {
getfocus()
// getfocus()
comMessageRef.value.showErrorMessage('扫描内容为空,请重新扫描', (res) => {
if (res) {
scanMsg.value = ''
@ -161,6 +155,7 @@ const handelScanMsg = () => {
emit('getResult', scanResult)
} else {
clear()
losefocus()
comMessageRef.value.showErrorMessage(scanResult.message, (res) => {
if (res) {
getfocus()
@ -168,9 +163,16 @@ const handelScanMsg = () => {
})
}
})
}, 500)
}, 200)
}
}
const handleFocus = ()=> {}
const handleBlur = ()=> {
// setTimeout(res=>{
// uni.hideKeyboard();
// },200)
}
const getfocus = () => {
nextTick((r) => {
boxfocus.value = true
@ -184,8 +186,10 @@ const losefocus = () => {
})
}
const clear = () => {
cursorIndex.value = 0
scanMsg.value = ''
if(props.clearResult){
cursorIndex.value = 0
scanMsg.value = ''
}
}
const iconClick = (type) => {
emit('clearResult', scanMsg.value)

15
src/mycomponents/scan/winComScanBalance.vue

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

65
src/mycomponents/scan/winComScanBalanceLocation.vue

@ -47,7 +47,7 @@ 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'
import {getLabelInfo} from '@/common/label.js';
export default {
name: 'winScanPack',
emits: ['getBalance', 'onCloseScanPopup'],
@ -113,25 +113,54 @@ export default {
this.fromLocationAreaTypeList = getDirectoryItemArray(businessType.outAreaTypes)
this.itemTypesList = getDirectoryItemArray(businessType.itemTypes)
this.$refs.popup.open('bottom')
setTimeout(res=>{
this.packGetFocus()
},500)
},
openScanPopupForJob(fromLocationCode, fromLocationList, jobContent) {
this.fromLocationCode = fromLocationCode
this.fromLocationList = fromLocationList
if (fromLocationCode != '') {
this.packGetFocus()
} else if (this.fromLocationList.length == 0) {
this.locationGetFocus()
} else {
this.fromLocationCode = this.fromLocationList[0]
}
setTimeout((res) => {
this.$refs.popup.open('bottom')
this.fromLocationCode = fromLocationCode;
this.fromLocationList = fromLocationList;
this.fromInventoryStatuses = getDirectoryItemArray(jobContent.outInventoryStatuses)
this.inventoryStatus = getDirectoryItemArray(jobContent.outInventoryStatuses); //; //
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 {
this.fromLocationCode = this.fromLocationList[0];
this.packGetFocus();
}
}
}, 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.inventoryStatus = getDirectoryItemArray(jobContent.outInventoryStatuses) // 出库库存状态; //出库库存状态
this.fromLocationAreaTypeList = getDirectoryItemArray(jobContent.fromAreaTypes) //
this.inventoryStatus = getDirectoryItemArray(jobContent.outInventoryStatuses); //; //
this.fromLocationAreaTypeList = getDirectoryItemArray(jobContent.fromAreaTypes); //
getLabelInfo(scanMessage, this.headerType, callback => {
if (callback.success) {
this.getScanResult(callback);
} else {
this.showErrorMessage(callback.message, res => {})
}
})
},
handleConfirm() {
@ -172,7 +201,12 @@ export default {
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>` + '未查找到库存余额'
const 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]
@ -225,6 +259,7 @@ export default {
})
},
showErrorMessage(message) {
this.packLoseFocus();
this.$refs.comMessage.showErrorMessage(message, (res) => {
if (res) {
if (this.$refs.comscan) {

39
src/mycomponents/scan/winComScanFg.vue

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

5
src/mycomponents/scan/winScanAsnNumber.vue

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

44
src/mycomponents/scan/winScanButton.vue

@ -1,6 +1,6 @@
<template>
<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>
<view>扫描</view>
</view>
@ -18,6 +18,48 @@
x: 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) => {
emit("goScan", '');
}

3
src/mycomponents/scan/winScanContainer.vue

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

15
src/mycomponents/scan/winScanFgLabel.vue

@ -16,9 +16,6 @@
</view>
</view>
</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" />
</view>
</template>
@ -40,17 +37,14 @@ const props = defineProps({
const show = ref(false)
const comscan = ref()
const comscansimulate = ref()
//
const simulateScan = (item) => {
comscansimulate.value.setItemCodeSimulate(item.itemCode, item.copyContent)
comscansimulate.value.clickScanMsg()
}
const openScanPopup = (itemCode) => {
show.value = true
setTimeout((res) => {
show.value = true
setTimeout((re) => {
comscan.value.setItemCode(itemCode)
}, 500)
getfocus()
}, 200)
}
@ -80,7 +74,7 @@ const getfocus = () => {
}
}
const losefocus = () => {
if (comscan.value != undefined) {
if (comscan.value) {
comscan.value.losefocus()
}
}
@ -94,7 +88,6 @@ defineExpose({
closeScanPopup,
losefocus,
getfocus,
simulateScan
})
</script>

3
src/mycomponents/scan/winScanItem.vue

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

5
src/mycomponents/scan/winScanJobNumber.vue

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

3
src/mycomponents/scan/winScanLocation.vue

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

3
src/mycomponents/scan/winScanPack.vue

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

5
src/mycomponents/scan/winScanPackAndCont.vue

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

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

36
src/mycomponents/scan/winScanPackAndLocationNoBalance.vue

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

3
src/mycomponents/scan/winScanPackAndPosition.vue

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

7
src/mycomponents/scan/winScanPackJob.vue

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

7
src/mycomponents/scan/winScanPackLevel.vue

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

55
src/mycomponents/scan/winScanPackage.vue

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