Browse Source

修改翻包任务支持扫子扣父

hella_online_20240829
lijuncheng 4 months ago
parent
commit
5b7c9b365d
  1. 315
      src/mycomponents/scan/winComScanBalanceLocation.vue
  2. 151
      src/pages/package/coms/comScanPackagePack.vue
  3. 13
      src/pages/package/job/overPackageJobDetail.vue

315
src/mycomponents/scan/winComScanBalanceLocation.vue

@ -0,0 +1,315 @@
<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="uni-flex uni-row" style="align-items: center;
background-color: #fff;
margin-left: 20rpx;
margin-right: 20rpx;
border-radius: 8rpx;
height: 30px;">
<view class="uni-center" style="width: 25%; font-size: 35rpx;">
来源库位
</view>
<!-- style="width: 75%;padding: 8rpx" -->
<view class="">
<!-- <input v-model="fromLocationCode" placeholder="请扫描来源库位" :focus="locationOnFocus"
placeholder-style="font-size:12px" style="padding: 5px;" @confirm="scanLocation" /> -->
<view v-if='allowModifyLocation'>
<uni-combox :candidates="fromLocationList" v-model="fromLocationCode" placeholder="请扫描来源库位"
@confirm="handleConfirm" style='height: 30rpx;border:1px solid #fff ;'></uni-combox>
</view>
<view v-else>
<text style="padding: 5px;font-size: 40rpx;">
{{fromLocationCode}}
</text>
</view>
</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","onCloseScanPopup"],
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
},
bussinessCode:{
type: String,
default: ''
},
//
allowModifyLocation: {
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')
},
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')
}, 500)
this.fromInventoryStatuses = getDirectoryItemArray(jobContent.outInventoryStatuses)
this.inventoryStatus = getDirectoryItemArray(jobContent.outInventoryStatuses); //; //
this.fromLocationAreaTypeList = getDirectoryItemArray(jobContent.fromAreaTypes); //
},
handleConfirm() {
this.$emit('confirm', this.fromLocationCode)
},
getScanResult(result) {
if (this.fromLocationCode == '') {
this.showErrorMessage('请选择来源库位', res => {
});
return;
}
this.resultData = result;
if(!result.package){
this.showErrorMessage(result.label.code+"包装信息为空")
return;
}
//
this.getItemCodeType(result.package.itemCode,callBack=>{
this.queryBalance(this.resultData)
})
},
queryBalance(result) {
var params = {
locationCode:this.fromLocationCode,
itemCode: result.package.itemCode,
batch: result.label.batch,
packingNumber: result.label.packingNumber,
parentPackingNumber:result.package.parentNumber,
inventoryStatus: this.fromInventoryStatuses,
areaType: this.fromLocationAreaTypeList,
bussinessCode:this.bussinessCode
}
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]
if(result.label.packingNumber!=result.balance.packingNumber){
result.balance.lableQty=result.label.qty
}
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) {
if(this.$refs.comscan){
this.$refs.comscan.getfocus()
}
}
});
},
selectBalanceItem(item) {
this.resultData.balance = item
this.$emit("getBalance", this.resultData)
// this.closeScanPopup()
},
closeScanPopup() {
this.$refs.popup.close()
this.$emit("onCloseScanPopup")
},
getfocus(){
if(this.$refs.comscan){
this.$refs.comscan.getfocus()
}
},
packGetFocus() {
if (this.$refs.comscan) {
this.$refs.comscan.getfocus();
}
},
packLoseFocus() {
if (this.$refs.comscan) {
this.$refs.comscan.losefocus();
}
},
}
}
</script>
<style lang="scss">
.scroll-view {
overflow-y: scroll;
height: auto;
max-height: 300rpx;
}
</style>

151
src/pages/package/coms/comScanPackagePack.vue

@ -1,97 +1,6 @@
<template>
<view>
<uni-popup ref="popup" :maskClick='false'>
<view class="">
<view class="popup_box">
<view class="pop_title uni-flex space-between">
<view class="" style="font-size: 35rpx;">
扫描箱码
</view>
<view class="">
<image class="fr icons_scan_close" src="/static/icons/icons_scan_close.svg"
@click="closeScanPopup()"></image>
</view>
</view>
<!-- <view class="uni-flex uni-row" style="align-items: center;
background-color: #fff;
margin-left: 20rpx;
margin-right: 20rpx;
padding:20rpx;
border-radius: 8rpx;">
<view class="uni-center">
位置 :
</view>
<view class="" style="width: 75%;padding: 0rpx">
<view class="uni-flex u-col-center uni-row" @click="showSelect">
<view class="" style="margin-left: 15rpx;font-size: 30rpx;">
{{positionInfo}}
</view>
<u-select v-model="show" mode="mutil-column-auto" :list="positionList" :defaultValue="defaultValueList"
@confirm="confirmSelect"></u-select>
</view>
</view>
</view> -->
<!-- <u-line class='line_color'></u-line> -->
<view class="uni-flex uni-row" style="align-items: center;
background-color: #fff;
margin-left: 20rpx;
margin-right: 20rpx;
margin-top: 8rpx;
border-radius: 8rpx;">
<view class="uni-center" style="width: 25%; ">
来源库位
</view>
<view class="" style="width: 75%; padding: 8rpx;">
<uni-combox :candidates="fromLocationList" v-model="fromLocationCode" placeholder="请选择库位"
@confirm="fromLocationUpdate"></uni-combox>
</view>
</view>
<view class="">
<view class="">
<win-com-scan ref="comscan" placeholder="箱标签" @getResult="onScan" :clearResult="true"
headerType="HPQ,HMQ" :isShowHistory="false">
</win-com-scan>
<view style="width: 100%;">
<view style="width: 100%;" v-if="issueRecord.length>0">
<view class="uni-flex uni-row space-between u-col-center">
<view class="" style="padding: 10rpx;">
历史记录
</view>
<view class="" style="padding-right: 10rpx;">
<u-icon :name="expendIcon" size="35rpx" @click="expands()"></u-icon>
</view>
</view>
<u-line class='line_color' style='padding-top: 10rpx;padding-bottom: 20rpx;'>
</u-line>
<scroll-view scroll-y="true" class="scroll-view"
v-if="expand&&issueRecord.length>0">
<view class="uni-flex u-col" v-for="(record,index) in issueRecord">
<view style="width: 100%;">
<uni-swipe-action ref="swipeAction">
<uni-swipe-action-item @click="swipeClick($event,record,index)"
:right-options="scanOptions">
<view style="padding: 0px 10px">
<balance :dataContent="record" :isShowFromLocation="false"
:isShowStdPack="false"></balance>
</view>
</uni-swipe-action-item>
</uni-swipe-action>
<u-line class='line_color'></u-line>
</view>
</view>
</scroll-view>
</view>
</view>
</view>
</view>
</view>
</view>
</uni-popup>
<winComScanBalanceLocation ref="scanPopup" @getBalance='getScanResult' @onCloseScanPopup="closeScanPopup" bussinessCode="OverPackage"></winComScanBalanceLocation>
<balance-select ref="balanceSelect" @onSelectItem='selectBalanceItem'></balance-select>
<comMessage ref="comMessage"></comMessage>
<balance-qty-edit ref="balanceQtyEdit" @confirm="confirm" :isShowStatus="true"></balance-qty-edit>
@ -103,6 +12,7 @@
import balance from '@/mycomponents/balance/balance.vue'
import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue'
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue'
import winComScanBalanceLocation from '@/mycomponents/scan/winComScanBalanceLocation.vue'
import {
getDetailOption,
@ -116,10 +26,7 @@
calc
} from '@/common/calc.js';
import {
getBalanceByManagementPrecision
} from '@/common/balance.js';
import { getDirectoryItemArray } from '../../../common/directory';
import { getDirectoryItemArray } from '@/common/directory';
export default {
name: 'winScanPack',
@ -127,7 +34,8 @@ import { getDirectoryItemArray } from '../../../common/directory';
winComScan,
balance,
balanceQtyEdit,
balanceSelect
balanceSelect,
winComScanBalanceLocation
},
props: {
title: {
@ -139,7 +47,6 @@ import { getDirectoryItemArray } from '../../../common/directory';
return {
dataContent: {},
jobContent: {},
expendIcon: 'arrow-down',
show: false,
scanList: [],
toLocation: null,
@ -151,9 +58,6 @@ import { getDirectoryItemArray } from '../../../common/directory';
expand: true,
scanOptions: {},
editItem: {},
positionInfo: "请选择位置",
positionList: [],
defaultValueList: [],
fromInventoryStatuses: "",
packageInfo: {},
label: {}
@ -173,18 +77,11 @@ import { getDirectoryItemArray } from '../../../common/directory';
this.dataContent = content;
this.jobContent = jobcontent;
this.initData();
// this.positionInfo = this.jobContent.workShopCode + "-" + this.jobContent.subList[0].productionLineCode +
// "-" + this.jobContent.subList[0].workStationCode
setTimeout(res => {
this.$refs.popup.open('bottom')
}, 500)
this.$refs.scanPopup.openScanPopupForJob(this.fromLocationCode, this.fromLocationList, this.jobContent)
},
closeScanPopup() {
this.$refs.popup.close();
this.$emit("closeScan")
//
// Object.assign(this.$data, this.$options.data());
},
initData() {
@ -227,6 +124,22 @@ import { getDirectoryItemArray } from '../../../common/directory';
}
},
getScanResult(result){
var balance =result.balance;
var packageInfo =result.package;
let itemCode = balance.itemCode;
let item = this.toLocation.Items.find(r => r.itemCode == itemCode);
if (item == undefined) {
this.showErrorMessage('未查找到物料【' + itemCode + '】的翻包明细',
res => {
this.getfocus();
}
)
} else {
this.afterGetBalance(result.label, balance, packageInfo);
}
},
onScan(result) {
try {
@ -398,7 +311,8 @@ import { getDirectoryItemArray } from '../../../common/directory';
let record = {
scaned: true,
itemCode: label.itemCode,
packingNumber: label.packingNumber,
packingNumber: packageInfo.number,
parentPackingNumber:packageInfo.parentNumber,
batch: label.batch,
qty: Number(balance.qty),
// qty: Number(label.qty) > Number(balance.qty) ? Number(balance.qty) : Number(label.qty),
@ -430,22 +344,17 @@ import { getDirectoryItemArray } from '../../../common/directory';
},
getfocus() {
if (this.$refs.comscan != undefined) {
this.$refs.comscan.getfocus();
if (this.$refs.scanPopup ) {
this.$refs.scanPopup.getfocus();
}
},
losefocus() {
if (this.$refs.comscan != undefined) {
this.$refs.comscan.losefocus();
if (this.$refs.scanPopup ) {
this.$refs.scanPopup.losefocus();
}
},
expands() {
this.expand = !this.expand;
this.expendIcon = this.expand == true ? "arrow-down" : "arrow-up"
},
swipeClick(e, item, index) {
if (e.content.text == "详情") {
this.detail(item)
@ -490,10 +399,10 @@ import { getDirectoryItemArray } from '../../../common/directory';
},
packGetFocus() {
this.$refs.comscan.getfocus();
this.$refs.scanPopup.getfocus();
},
packLoseFocus() {
this.$refs.comscan.losefocus();
this.$refs.scanPopup.packLoseFocus();
},
showMessage(message, callback) {
setTimeout(r => {

13
src/pages/package/job/overPackageJobDetail.vue

@ -71,6 +71,7 @@
getCurrDateTime,
getDirectoryItemArray,
getPackingNumberAndBatch,
deepCopyData
} from '@/common/basic.js';
import {
@ -104,7 +105,7 @@
comOverPackJobDetailCard,
comScanPackagePack,
jobTop,
workStation
workStation,
},
data() {
return {
@ -182,13 +183,6 @@
r.resizeCollapse();
})
}
// this.$refs.mainCollapse.forEach(r => {
// r.childrens.forEach(i => {
// i.init();
// })
// r.resize();
// })
});
},
@ -385,6 +379,7 @@
record.fromPackingNumber = r
.packingNumber;
record.fromParentPackingNumber =r.parentPackingNumber;
record.fromBatch = r.batch;
record.fromContainerNumber = r
.ContainerNumber;
@ -434,7 +429,7 @@
// }
subItem.recordList.push(record);
})
subList.push(subItem);
subList.push(deepCopyData(subItem));
}
}
})

Loading…
Cancel
Save