Browse Source

直接翻包 不扫描库位

hella_online_20240829
lijuncheng 3 months ago
parent
commit
a462aa4553
  1. 215
      src/mycomponents/scan/winComScanBalance.vue
  2. 77
      src/pages/package/record/overPackageRecord.vue

215
src/mycomponents/scan/winComScanBalance.vue

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

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

@ -1,7 +1,8 @@
<template>
<view class="page-wraper">
<view class="">
<com-blank-view @goScan='showFromLocationPopup' v-if="detailSource.length==0"></com-blank-view>
<com-blank-view @goScan='getBusinessType' v-if="detailSource.length==0"></com-blank-view>
</view>
<view class="page-wraper" v-if="detailSource.length>0">
<view class="cen_card" style="background-color: #fff; margin:10px 0px 0px 10px;">
@ -60,10 +61,12 @@
<win-scan-button @goScan='openScanPopup'></win-scan-button>
</view>
<win-scan-pack-and-location ref="scanPopup" @getResult='getScanResult' :allowModifyLocation="true" @confirm="handleConfirm">
</win-scan-pack-and-location >
<win-scan-location ref="scanLocationCode" title="来源库位" @getLocation='getLocation'
:locationAreaTypeList="fromLocationAreaTypeList"></win-scan-location>
<winComScanBalance ref="scanPopup" @getBalance='getScanResult'>
</winComScanBalance>
<!-- <win-scan-location ref="scanLocationCode" title="来源库位" @getLocation='getLocation'
:locationAreaTypeList="fromLocationAreaTypeList"></win-scan-location> -->
<comMessage ref="comMessage"></comMessage>
</view>
</template>
@ -71,7 +74,8 @@
<script>
import {
overPackageRecordSubmit,
getPackUnitByItemCode
getPackUnitByItemCode,
getBalanceByParams
} from '@/api/request2.js';
import {
goHome
@ -79,6 +83,9 @@
import {
getInventoryStatusDesc,
getLocationAreaTypeName,
getLocationAreaTypeInfo,
getListLocationAreaTypeDesc,
getDirectoryItemArray,
getPackUnitName,
getUomInfo
@ -101,6 +108,9 @@
import packageTarget from '@/mycomponents/package/packageTarget.vue'
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue'
import packUnit from '@/mycomponents/qty/packUnit.vue'
import winComScanBalance from '@/mycomponents/scan/winComScanBalance.vue'
import {
getCurrDateTime
} from '@/common/basic.js';
@ -116,7 +126,8 @@
recommendBalance,
packageTarget,
recordComDetailCard,
packUnit
packUnit,
winComScanBalance
},
data() {
return {
@ -126,6 +137,7 @@
fromLocationCode: "",
isShowLocation: false,
fromLocationAreaTypeList: [],
fromInventoryStatuses: [],
inInventoryStatus: "", //
outInventoryStatus: "", //
businessType: {},
@ -136,20 +148,12 @@
show: false,
toPackUnitShow: "请选择",
toPackQty: "",
itemCode: ""
itemCode: "",
resultData: {}
};
},
onShow() {
var typeCode = "OverPackage"
getBusinessType(typeCode, res => {
if (res.success) {
this.businessType = res.businessType;
this.fromLocationAreaTypeList = res.fromLocationAreaTypeList
this.showFromLocationPopup();
} else {
this.showErrorMessage(res.message)
}
});
this.getBusinessType();
},
//
onNavigationBarButtonTap(e) {
@ -165,6 +169,19 @@
mounted() {},
methods: {
getBusinessType(){
var typeCode = "OverPackage"
getBusinessType(typeCode, res => {
if (res.success) {
this.businessType=res.businessType;
this.fromInventoryStatuses = getDirectoryItemArray(res.fromInventoryStatuses);
this.fromLocationAreaTypeList = res.fromLocationAreaTypeList
this.openScanPopup();
} else {
this.showErrorMessage(res.message)
}
});
},
getUomInfo(uom) {
let item = getUomInfo(uom);
if (item == '') {
@ -173,9 +190,6 @@
return item.label
}
},
scanPopupPack() {
this.$refs.scanPopupPack.openScanPopup();
},
showPackage() {
getPackUnitByItemCode(this.itemCode).then(res => {
if (res.data != null && res.data.list.length > 0) {
@ -214,11 +228,20 @@
this.$refs.scanLocationCode.openScanPopupSimulate(fromLocationCode)
},
getScanResult(result) {
this.setData(result);
},
setData(result) {
let balance = result.balance;
let label = result.label;
let pack = result.package;
this.fromPackUnit = pack.packUnit;
this.fromPack = pack;
if(this.fromLocationCode&&this.fromLocationCode!=balance.locationCode){
this.showErrorMessage("箱码[" + balance.packingNumber + "批次[" + balance.batch + "]在库位["+this.fromLocationCode+"]没有库存余额")
return;
}
var item = this.detailSource.find(res => {
if (res.itemCode == balance.itemCode) {
return res
@ -234,6 +257,7 @@
itemp.subList.push(newDetail);
this.detailSource.push(itemp)
this.itemCode = balance.itemCode;
this.fromLocationCode =balance.locationCode
} else {
var detail = item.subList.find(r => {
if (r.packingNumber == balance.packingNumber &&
@ -253,8 +277,6 @@
}
}
this.calcHandleQty();
},
calcHandleQty() {
@ -284,11 +306,12 @@
},
openScanPopup() {
if (this.fromLocationCode == "") {
this.showFromLocationPopup();
return
if(this.businessType){
this.$refs.scanPopup.openScanPopup(this.businessType);
}else {
this.getBusinessType()
}
this.$refs.scanPopup.openScanPopupForType(this.fromLocationCode, this.businessType);
},
showFromLocationPopup() {
this.$nextTick(() => {

Loading…
Cancel
Save