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. 37
      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> <template>
<view> <view>
<uni-popup ref="popup" :maskClick='false'> <winComScanBalanceLocation ref="scanPopup" @getBalance='getScanResult' @onCloseScanPopup="closeScanPopup" bussinessCode="OverPackage"></winComScanBalanceLocation>
<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>
<balance-select ref="balanceSelect" @onSelectItem='selectBalanceItem'></balance-select> <balance-select ref="balanceSelect" @onSelectItem='selectBalanceItem'></balance-select>
<comMessage ref="comMessage"></comMessage> <comMessage ref="comMessage"></comMessage>
<balance-qty-edit ref="balanceQtyEdit" @confirm="confirm" :isShowStatus="true"></balance-qty-edit> <balance-qty-edit ref="balanceQtyEdit" @confirm="confirm" :isShowStatus="true"></balance-qty-edit>
@ -103,6 +12,7 @@
import balance from '@/mycomponents/balance/balance.vue' import balance from '@/mycomponents/balance/balance.vue'
import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue' import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue'
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue' import balanceSelect from '@/mycomponents/balance/balanceSelect.vue'
import winComScanBalanceLocation from '@/mycomponents/scan/winComScanBalanceLocation.vue'
import { import {
getDetailOption, getDetailOption,
@ -116,10 +26,7 @@
calc calc
} from '@/common/calc.js'; } from '@/common/calc.js';
import { import { getDirectoryItemArray } from '@/common/directory';
getBalanceByManagementPrecision
} from '@/common/balance.js';
import { getDirectoryItemArray } from '../../../common/directory';
export default { export default {
name: 'winScanPack', name: 'winScanPack',
@ -127,7 +34,8 @@ import { getDirectoryItemArray } from '../../../common/directory';
winComScan, winComScan,
balance, balance,
balanceQtyEdit, balanceQtyEdit,
balanceSelect balanceSelect,
winComScanBalanceLocation
}, },
props: { props: {
title: { title: {
@ -139,7 +47,6 @@ import { getDirectoryItemArray } from '../../../common/directory';
return { return {
dataContent: {}, dataContent: {},
jobContent: {}, jobContent: {},
expendIcon: 'arrow-down',
show: false, show: false,
scanList: [], scanList: [],
toLocation: null, toLocation: null,
@ -151,9 +58,6 @@ import { getDirectoryItemArray } from '../../../common/directory';
expand: true, expand: true,
scanOptions: {}, scanOptions: {},
editItem: {}, editItem: {},
positionInfo: "请选择位置",
positionList: [],
defaultValueList: [],
fromInventoryStatuses: "", fromInventoryStatuses: "",
packageInfo: {}, packageInfo: {},
label: {} label: {}
@ -173,18 +77,11 @@ import { getDirectoryItemArray } from '../../../common/directory';
this.dataContent = content; this.dataContent = content;
this.jobContent = jobcontent; this.jobContent = jobcontent;
this.initData(); this.initData();
// this.positionInfo = this.jobContent.workShopCode + "-" + this.jobContent.subList[0].productionLineCode + this.$refs.scanPopup.openScanPopupForJob(this.fromLocationCode, this.fromLocationList, this.jobContent)
// "-" + this.jobContent.subList[0].workStationCode
setTimeout(res => {
this.$refs.popup.open('bottom')
}, 500)
}, },
closeScanPopup() { closeScanPopup() {
this.$refs.popup.close();
this.$emit("closeScan") this.$emit("closeScan")
//
// Object.assign(this.$data, this.$options.data());
}, },
initData() { initData() {
@ -226,6 +123,22 @@ import { getDirectoryItemArray } from '../../../common/directory';
this.showErrorMessage('翻包库位【' + fromlocation + '】不存在') this.showErrorMessage('翻包库位【' + fromlocation + '】不存在')
} }
}, },
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) { onScan(result) {
@ -398,7 +311,8 @@ import { getDirectoryItemArray } from '../../../common/directory';
let record = { let record = {
scaned: true, scaned: true,
itemCode: label.itemCode, itemCode: label.itemCode,
packingNumber: label.packingNumber, packingNumber: packageInfo.number,
parentPackingNumber:packageInfo.parentNumber,
batch: label.batch, batch: label.batch,
qty: Number(balance.qty), qty: Number(balance.qty),
// qty: Number(label.qty) > Number(balance.qty) ? Number(balance.qty) : Number(label.qty), // qty: Number(label.qty) > Number(balance.qty) ? Number(balance.qty) : Number(label.qty),
@ -430,22 +344,17 @@ import { getDirectoryItemArray } from '../../../common/directory';
}, },
getfocus() { getfocus() {
if (this.$refs.comscan != undefined) { if (this.$refs.scanPopup ) {
this.$refs.comscan.getfocus(); this.$refs.scanPopup.getfocus();
} }
}, },
losefocus() { losefocus() {
if (this.$refs.comscan != undefined) { if (this.$refs.scanPopup ) {
this.$refs.comscan.losefocus(); this.$refs.scanPopup.losefocus();
} }
}, },
expands() {
this.expand = !this.expand;
this.expendIcon = this.expand == true ? "arrow-down" : "arrow-up"
},
swipeClick(e, item, index) { swipeClick(e, item, index) {
if (e.content.text == "详情") { if (e.content.text == "详情") {
this.detail(item) this.detail(item)
@ -490,10 +399,10 @@ import { getDirectoryItemArray } from '../../../common/directory';
}, },
packGetFocus() { packGetFocus() {
this.$refs.comscan.getfocus(); this.$refs.scanPopup.getfocus();
}, },
packLoseFocus() { packLoseFocus() {
this.$refs.comscan.losefocus(); this.$refs.scanPopup.packLoseFocus();
}, },
showMessage(message, callback) { showMessage(message, callback) {
setTimeout(r => { setTimeout(r => {

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

@ -71,6 +71,7 @@
getCurrDateTime, getCurrDateTime,
getDirectoryItemArray, getDirectoryItemArray,
getPackingNumberAndBatch, getPackingNumberAndBatch,
deepCopyData
} from '@/common/basic.js'; } from '@/common/basic.js';
import { import {
@ -104,7 +105,7 @@
comOverPackJobDetailCard, comOverPackJobDetailCard,
comScanPackagePack, comScanPackagePack,
jobTop, jobTop,
workStation workStation,
}, },
data() { data() {
return { return {
@ -124,7 +125,7 @@
onLoad(option) { onLoad(option) {
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: option.title+'详情' title: option.title + '详情'
}) })
this.id = option.id; this.id = option.id;
if (this.id != undefined) { if (this.id != undefined) {
@ -177,18 +178,11 @@
methods: { methods: {
resizeCollapse() { resizeCollapse() {
this.$nextTick(r => { this.$nextTick(r => {
if(this.$refs.comOverPackJobDetailCard){ if (this.$refs.comOverPackJobDetailCard) {
this.$refs.comOverPackJobDetailCard.forEach(r => { this.$refs.comOverPackJobDetailCard.forEach(r => {
r.resizeCollapse(); r.resizeCollapse();
}) })
} }
// this.$refs.mainCollapse.forEach(r => {
// r.childrens.forEach(i => {
// i.init();
// })
// r.resize();
// })
}); });
}, },
@ -278,7 +272,7 @@
itemCodes.push(item.itemCode) itemCodes.push(item.itemCode)
}) })
}) })
this.checkSubmit(); this.checkSubmit();
//使 //使
@ -340,18 +334,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.number, // packageCode: item.number, //
batch:item.batch,// batch: item.batch, //
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: '',
}) })
@ -385,6 +379,7 @@
record.fromPackingNumber = r record.fromPackingNumber = r
.packingNumber; .packingNumber;
record.fromParentPackingNumber =r.parentPackingNumber;
record.fromBatch = r.batch; record.fromBatch = r.batch;
record.fromContainerNumber = r record.fromContainerNumber = r
.ContainerNumber; .ContainerNumber;
@ -434,7 +429,7 @@
// } // }
subItem.recordList.push(record); subItem.recordList.push(record);
}) })
subList.push(subItem); subList.push(deepCopyData(subItem));
} }
} }
}) })
@ -568,7 +563,7 @@
// }) // })
// } // }
// }) // })
// Promise.all(pointData.map(item => { // Promise.all(pointData.map(item => {
// return getPackageLabel(item.packageCode) // return getPackageLabel(item.packageCode)
// })).then(res => { // })).then(res => {

Loading…
Cancel
Save