Browse Source

直接翻包 不扫描库位

hella_online_20240829
lijuncheng 4 months ago
parent
commit
a462aa4553
  1. 215
      src/mycomponents/scan/winComScanBalance.vue
  2. 107
      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>

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

@ -1,7 +1,8 @@
<template> <template>
<view class="page-wraper"> <view class="page-wraper">
<view class=""> <view class="">
<com-blank-view @goScan='showFromLocationPopup' v-if="detailSource.length==0"></com-blank-view> <com-blank-view @goScan='getBusinessType' v-if="detailSource.length==0"></com-blank-view>
</view> </view>
<view class="page-wraper" v-if="detailSource.length>0"> <view class="page-wraper" v-if="detailSource.length>0">
<view class="cen_card" style="background-color: #fff; margin:10px 0px 0px 10px;"> <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> <win-scan-button @goScan='openScanPopup'></win-scan-button>
</view> </view>
<win-scan-pack-and-location ref="scanPopup" @getResult='getScanResult' :allowModifyLocation="true" @confirm="handleConfirm"> <winComScanBalance ref="scanPopup" @getBalance='getScanResult'>
</win-scan-pack-and-location > </winComScanBalance>
<win-scan-location ref="scanLocationCode" title="来源库位" @getLocation='getLocation'
:locationAreaTypeList="fromLocationAreaTypeList"></win-scan-location>
<!-- <win-scan-location ref="scanLocationCode" title="来源库位" @getLocation='getLocation'
:locationAreaTypeList="fromLocationAreaTypeList"></win-scan-location> -->
<comMessage ref="comMessage"></comMessage> <comMessage ref="comMessage"></comMessage>
</view> </view>
</template> </template>
@ -71,7 +74,8 @@
<script> <script>
import { import {
overPackageRecordSubmit, overPackageRecordSubmit,
getPackUnitByItemCode getPackUnitByItemCode,
getBalanceByParams
} from '@/api/request2.js'; } from '@/api/request2.js';
import { import {
goHome goHome
@ -79,6 +83,9 @@
import { import {
getInventoryStatusDesc, getInventoryStatusDesc,
getLocationAreaTypeName,
getLocationAreaTypeInfo,
getListLocationAreaTypeDesc,
getDirectoryItemArray, getDirectoryItemArray,
getPackUnitName, getPackUnitName,
getUomInfo getUomInfo
@ -101,6 +108,9 @@
import packageTarget from '@/mycomponents/package/packageTarget.vue' import packageTarget from '@/mycomponents/package/packageTarget.vue'
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue' import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue'
import packUnit from '@/mycomponents/qty/packUnit.vue' import packUnit from '@/mycomponents/qty/packUnit.vue'
import winComScanBalance from '@/mycomponents/scan/winComScanBalance.vue'
import { import {
getCurrDateTime getCurrDateTime
} from '@/common/basic.js'; } from '@/common/basic.js';
@ -116,7 +126,8 @@
recommendBalance, recommendBalance,
packageTarget, packageTarget,
recordComDetailCard, recordComDetailCard,
packUnit packUnit,
winComScanBalance
}, },
data() { data() {
return { return {
@ -126,6 +137,7 @@
fromLocationCode: "", fromLocationCode: "",
isShowLocation: false, isShowLocation: false,
fromLocationAreaTypeList: [], fromLocationAreaTypeList: [],
fromInventoryStatuses: [],
inInventoryStatus: "", // inInventoryStatus: "", //
outInventoryStatus: "", // outInventoryStatus: "", //
businessType: {}, businessType: {},
@ -136,20 +148,12 @@
show: false, show: false,
toPackUnitShow: "请选择", toPackUnitShow: "请选择",
toPackQty: "", toPackQty: "",
itemCode: "" itemCode: "",
resultData: {}
}; };
}, },
onShow(){ onShow() {
var typeCode = "OverPackage" this.getBusinessType();
getBusinessType(typeCode, res => {
if (res.success) {
this.businessType = res.businessType;
this.fromLocationAreaTypeList = res.fromLocationAreaTypeList
this.showFromLocationPopup();
} else {
this.showErrorMessage(res.message)
}
});
}, },
// //
onNavigationBarButtonTap(e) { onNavigationBarButtonTap(e) {
@ -165,6 +169,19 @@
mounted() {}, mounted() {},
methods: { 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) { getUomInfo(uom) {
let item = getUomInfo(uom); let item = getUomInfo(uom);
if (item == '') { if (item == '') {
@ -173,9 +190,6 @@
return item.label return item.label
} }
}, },
scanPopupPack() {
this.$refs.scanPopupPack.openScanPopup();
},
showPackage() { showPackage() {
getPackUnitByItemCode(this.itemCode).then(res => { getPackUnitByItemCode(this.itemCode).then(res => {
if (res.data != null && res.data.list.length > 0) { if (res.data != null && res.data.list.length > 0) {
@ -210,15 +224,24 @@
this.toPackUnitShow = e[0].label this.toPackUnitShow = e[0].label
}, },
// //
handleConfirm(fromLocationCode){ handleConfirm(fromLocationCode) {
this.$refs.scanLocationCode.openScanPopupSimulate(fromLocationCode) this.$refs.scanLocationCode.openScanPopupSimulate(fromLocationCode)
}, },
getScanResult(result) { getScanResult(result) {
this.setData(result);
},
setData(result) {
let balance = result.balance; let balance = result.balance;
let label = result.label; let label = result.label;
let pack = result.package; let pack = result.package;
this.fromPackUnit = pack.packUnit; this.fromPackUnit = pack.packUnit;
this.fromPack = pack; 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 => { var item = this.detailSource.find(res => {
if (res.itemCode == balance.itemCode) { if (res.itemCode == balance.itemCode) {
return res return res
@ -234,6 +257,7 @@
itemp.subList.push(newDetail); itemp.subList.push(newDetail);
this.detailSource.push(itemp) this.detailSource.push(itemp)
this.itemCode = balance.itemCode; this.itemCode = balance.itemCode;
this.fromLocationCode =balance.locationCode
} else { } else {
var detail = item.subList.find(r => { var detail = item.subList.find(r => {
if (r.packingNumber == balance.packingNumber && if (r.packingNumber == balance.packingNumber &&
@ -253,8 +277,6 @@
} }
} }
this.calcHandleQty(); this.calcHandleQty();
}, },
calcHandleQty() { calcHandleQty() {
@ -284,19 +306,20 @@
}, },
openScanPopup() { openScanPopup() {
if (this.fromLocationCode == "") { if(this.businessType){
this.showFromLocationPopup(); this.$refs.scanPopup.openScanPopup(this.businessType);
return }else {
this.getBusinessType()
} }
this.$refs.scanPopup.openScanPopupForType(this.fromLocationCode, this.businessType);
}, },
showFromLocationPopup() { showFromLocationPopup() {
this.$nextTick(() => { this.$nextTick(() => {
let overPackageRecord = uni.getStorageSync('overPackageRecord') let overPackageRecord = uni.getStorageSync('overPackageRecord')
if(overPackageRecord){ if (overPackageRecord) {
this.$refs.scanLocationCode.openScanPopupSimulate(overPackageRecord) this.$refs.scanLocationCode.openScanPopupSimulate(overPackageRecord)
}else{ } else {
this.$refs.scanLocationCode.openScanPopup(); this.$refs.scanLocationCode.openScanPopup();
} }
}) })
@ -315,7 +338,7 @@
}, },
commit() { commit() {
if (this.detailSource.length > 0 && this.detailSource[0].subList.length > 0) { if (this.detailSource.length > 0 && this.detailSource[0].subList.length > 0) {
if (!this.toPackUnit||this.toPackUnit == "包装规格") { if (!this.toPackUnit || this.toPackUnit == "包装规格") {
this.showErrorMessage("请选择目标包装规格") this.showErrorMessage("请选择目标包装规格")
return; return;
} }
@ -357,18 +380,18 @@
let list = [] let list = []
res.data.forEach(item => { res.data.forEach(item => {
list.push({ list.push({
itemCode:item.itemCode, // itemCode: item.itemCode, //
itemName: item.itemName, // itemName: item.itemName, //
packName: item.packName,// packName: item.packName, //
packageCode: item.toPackingNumber, // packageCode: item.toPackingNumber, //
batch:item.toBatch,// batch: item.toBatch, //
parentNumber:item.parentNumber,// parentNumber: item.parentNumber, //
itemType: item.itemType,// itemType: item.itemType, //
asnNumber:item.asnNumber,//ASN asnNumber: item.asnNumber, //ASN
supplierCode: item.supplierCode, // supplierCode: item.supplierCode, //
qty: item.qty, // qty: item.qty, //
printTimes:getCurrDateTime(), // printTimes: getCurrDateTime(), //
productionLineCode:item.productionLineCode,//线 productionLineCode: item.productionLineCode, //线
barcodeString: item.barcodeString, // barcodeString: item.barcodeString, //
barcodeBase64: '', barcodeBase64: '',
}) })
@ -439,7 +462,7 @@
this.scanPopupGetFocus(); this.scanPopupGetFocus();
}, },
getLocation(location, code) { getLocation(location, code) {
if(code){ if (code) {
uni.setStorageSync('overPackageRecord', code) uni.setStorageSync('overPackageRecord', code)
} }
this.getFromLocationCode(location, code) this.getFromLocationCode(location, code)
@ -450,7 +473,7 @@
}, },
showCommitSuccessMessage(hint,pointData) { showCommitSuccessMessage(hint, pointData) {
this.$refs.comMessage.showSuccessMessage(hint, res => { this.$refs.comMessage.showSuccessMessage(hint, res => {
this.detailSource = [] this.detailSource = []
this.fromLocationCode = ''; this.fromLocationCode = '';

Loading…
Cancel
Save