Compare commits

...

7 Commits

  1. 15
      src/common/record.js
  2. 7
      src/mycomponents/balance/balance.vue
  3. 10
      src/mycomponents/record/recordComDetailCard.vue
  4. 2
      src/mycomponents/scan/winScanPackage.vue
  5. 273
      src/mycomponents/scan/winScanParentPackage.vue
  6. 198
      src/pages/issue/record/directIssue0816.vue

15
src/common/record.js

@ -49,6 +49,21 @@ export function createDetailInfo(balance, pack) {
return detail;
}
export function createDetailByPackInfo(pack) {
// data.toInventoryStatus = this.toInventoryStatus == "" ? data.inventoryStatus : this.toInventoryStatus;
// data.inventoryStatus = data.inventoryStatus;
let detail = deepCopyData(pack); detail.scaned = true;
detail.balanceQty = new Decimal(detail.qty).toNumber()
detail.qty = new Decimal(detail.qty).toNumber();
detail.packQty = pack.packQty ? new Decimal(pack.packQty).toNumber() : 0
detail.packUnit = pack.packUnit
detail.handleQty = new Decimal(detail.qty).toNumber();
detail.package = pack;
return detail;
}
//计算实际数量
export function calcHandleQty(detailSource) {
for (let item of detailSource) {

7
src/mycomponents/balance/balance.vue

@ -2,7 +2,8 @@
<view :class="dataContent.scaned?'scan_view':''" style="background-color: #ffffff;margin-bottom: 1px; ">
<view class="uni-flex uni-row space-between" style="align-items: center">
<view>
<pack v-if="dataContent.parentNumber" title="父包装" :packingCode="dataContent.parentNumber"></pack>
<pack v-if="isShowParentPack &&dataContent.parentNumber" title="父包装"
:packingCode="dataContent.parentNumber"></pack>
<pack v-if="isShowPack && dataContent.packingNumber" :packingCode="dataContent.packingNumber"></pack>
<batch v-if="isShowBatch && dataContent.batch" :batch="dataContent.batch"></batch>
<location title="来源库位" v-if="isShowFromLocation" :locationCode="dataContent.locationCode"></location>
@ -91,6 +92,10 @@
type: Boolean,
default: false
},
isShowParentPack: {
type: Boolean,
default: true
},
},
watch: {

10
src/mycomponents/record/recordComDetailCard.vue

@ -9,7 +9,8 @@
:isShowBalanceQty="isShowBalanceQty"></item-qty>
<view style="margin-left: 10px; margin-top: 5px;">
<pack title='父包装' :packingCode='dataContent.containerNumber'></pack>
<location v-if="isShowParentToLocation" title='目标库位' :locationCode='dataContent.toLocationCode'></location>
<location v-if="isShowParentToLocation" title='目标库位'
:locationCode='dataContent.toLocationCode'></location>
</view>
</uni-swipe-action-item>
</uni-swipe-action>
@ -21,7 +22,7 @@
:right-options="detail.scaned?scanOptions:detailOptions">
<balance :dataContent="detail" :isShowStdPack="false" :isShowStatus="isShowStatus"
:isShowPack="true" :isShowFromLocation="isShowFromLocation"
:isShowToLocation="isShowToLocation">
:isShowToLocation="isShowToLocation" :isShowParentPack="isShowParentPack">
</balance>
</uni-swipe-action-item>
</uni-swipe-action>
@ -100,6 +101,11 @@
type: Boolean,
default: false
},
isShowParentPack: {
type: Boolean,
default: true
},
},
watch: {

2
src/mycomponents/scan/winScanPackage.vue

@ -208,7 +208,7 @@
getBalanceByFilter(params).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

273
src/mycomponents/scan/winScanParentPackage.vue

@ -0,0 +1,273 @@
<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 (childPackingNumber) {
let packingNumber = parentPackingNumber + "," + childPackingNumber;
filters.push({
column: "packingNumber",
action: "in",
value: packingNumber
})
} else {
filters.push({
column: "packingNumber",
action: "==",
value: packingNumber
})
}
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>

198
src/pages/issue/record/directIssue0816.vue

@ -18,9 +18,8 @@
<record-com-detail-card :dataContent="item" :index="index" :settingParam="dataContent"
:isShowFromLocation="false" @removeItem="removeItem(index,item)"
:isShowToLocation="false" :isShowParentToLocation="false" @updateData="updateData"
@removePack="removePack">
@removePack="removePack" :isShowParentPack="false">
</record-com-detail-card>
</view>
</view>
</scroll-view>
@ -45,9 +44,10 @@
</view>
<win-scan-button @goScan='openScanPopup'></win-scan-button>
</view>
<winComScanBalance ref="scanPopup" @getBalance='getScanResult' :bussinessCode="businessTypeCode">
</winComScanBalance>
<win-scan-parent-package ref="scanPopup" @getResult='getScanResult'></win-scan-parent-package>
<!-- <win-scan-package ref="scanPopup" @getResult='getScanResult'></win-scan-package> -->
<!-- <winComScanBalance ref="scanPopup" @getBalance='getScanResult' :bussinessCode="businessTypeCode">
</winComScanBalance> -->
<!-- <balanceQuery ref="refBalanceQuery"></balanceQuery> -->
<comMessage ref="comMessage"></comMessage>
</view>
@ -79,6 +79,7 @@
getBusinessType,
createItemInfo,
createDetailInfo,
createDetailByPackInfo,
calcTreeHandleQty,
calcHandleQty
} from '@/common/record.js';
@ -100,7 +101,7 @@
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue'
import winComScanBalance from '@/mycomponents/scan/winComScanBalance.vue'
// import balanceQuery from '@/mycomponents/query/balanceQuery.vue'
import winScanParentPackage from '@/mycomponents/scan/winScanParentPackage.vue'
export default {
components: {
@ -114,6 +115,7 @@
recordDetailCard,
balanceSelect,
winComScanBalance,
winScanParentPackage
// balanceQuery
},
data() {
@ -181,7 +183,6 @@
// showDrawer() {
// this.$refs.showRight.open();
// },
getBusinessType() {
getBusinessType(this.businessTypeCode, res => {
if (res.success) {
@ -197,72 +198,86 @@
getScanResult(result) {
let pack = result.package;
let balance = result.balance;
let childBalance = result.balance.childBalance;
let parentBalance = result.balance.parentBalance[0];
if (this.fromLocationCode && this.fromLocationCode != balance.locationCode) {
this.showErrorMessage("箱码[" + balance.packingNumber + "批次[" + balance.batch + "]在库位[" + this
.fromLocationCode + "]没有库存余额")
//1.
if (this.itemCode) {
var item = this.detailSource.find(res => res.itemCode == pack.itemCode)
if (item == undefined) {
this.showErrorMessage("请扫描物料为【" + this.itemCode + "】不在此次发料记录中")
return;
}
if (item.subList.length > 0) {
var detail = item.subList.find(r => {
if (r.packingNumber == pack.number &&
r.batch == pack.batch) {
return r;
}
})
if (detail && detail.scaned) {
this.showErrorMessage("箱码[" + pack.number + "批次[" + pack.batch + "]重复扫描")
return;
}
}
}
//2.
//
if (pack.parentNumber) {
this.setPackageData(result);
//
if (childBalance.length == 0) {
this.setPackageData(parentBalance, pack);
} else { //
this.setPackageData(childBalance[0], pack);
}
} else {
//
pack.subList.forEach(sub => {
let subBalance = childBalance.find(r => r.packingNumber == sub.number);
if (subBalance) {
//
if (subBalance.locationCode == parentBalance.locationCode) {
this.setPackageData(subBalance, sub);
} else {
this.setContainerData(result);
//
}
},
setPackageData(result) {
let balance = result.balance;
let label = result.label;
let pack = result.package;
} else {
//
this.setPackageData(parentBalance, sub);
}
})
}
},
setPackageData(balance, pack) {
var item = this.detailSource.find(res => {
if (res.itemCode == balance.itemCode) {
return res
}
})
if (item == undefined) {
if (this.itemCode != "" && this.itemCode != balance.itemCode) {
this.showErrorMessage("请扫描物料为【" + this.itemCode + "】的箱码")
return;
}
if (this.fromWarehouseCode == '') {
this.fromWarehouseCode = balance.warehouseCode;
}
var itemp = createItemInfo(balance, pack);
let newDetail = createDetailInfo(balance, pack); //
newDetail.parentNumber = pack.parentNumber;
newDetail.packingNumber = pack.number
newDetail.packUnit = pack.packUnit;
newDetail.packQty = pack.packQty;
if (balance.lableQty) {
newDetail.handleQty = balance.lableQty
}
let newDetail = this.createPackageDetail(balance, pack);
itemp.subList.push(newDetail);
this.detailSource.push(itemp)
this.detailSource.push(itemp);
this.itemCode = balance.itemCode;
this.fromLocationCode = balance.locationCode
this.fromLocationCode = balance.locationCode;
this.fromWarehouseCode = balance.warehouseCode;
this.scanPopupGetFocus()
} else {
var detail = item.subList.find(r => {
if (r.packingNumber == pack.number &&
r.batch == balance.batch &&
r.locationCode == balance.locationCode &&
r.batch == pack.batch &&
r.locationCode == pack.locationCode &&
r.inventoryStatus == balance.inventoryStatus) {
return r;
}
})
if (detail == undefined) {
let newDetail = createDetailInfo(balance, pack);
newDetail.parentNumber = pack.parentNumber;
newDetail.packingNumber = pack.number
newDetail.packUnit = pack.packUnit;
newDetail.packQty = pack.packQty;
if (balance.lableQty) {
newDetail.handleQty = balance.lableQty
}
let newDetail = this.createPackageDetail(balance, pack);
item.subList.push(newDetail);
this.scanPopupGetFocus()
} else {
@ -274,73 +289,26 @@
calcHandleQty(this.detailSource);
},
setContainerData(result) {
//1.
this.getBalance(result, resList => {
});
},
getBalance(result, callback) {
let packageInfo = result.package;
let filters = [{
column: "itemCode",
action: "==",
value: packageInfo.itemCode
}, {
column: "batch",
action: "==",
value: packageInfo.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
})
}
let packingNumber = packageInfo.number;
packageInfo.subList.forEach(sub => {
packingNumber = packingNumber + ',' + sub.number
})
packingNumber = packingNumber.trimEnd(',');
filters.push({
column: "packingNumber",
action: "in",
value: packingNumber
})
var params = {
filters: filters,
pageNo: 1,
pageSize: 100,
}
getBalanceByFilter(params).then(res => {
if (res.data.list.length > 0) {
res.data.list.forEach(r => {
// if (packageInfo.parentNumber !== null) {
// r.parentPackingNumber = packageInfo.parentNumber
// } else {
// r.parentPackingNumber = packageInfo.number
// }
})
callback(res.data.list)
createPackageDetail(balance, pack) {
let newDetail = {};
if (balance.packingNumber != pack.number) {
newDetail = createDetailByPackInfo(pack);
newDetail.inventoryStatus = balance.inventoryStatus;
} else {
newDetail = createDetailInfo(balance, pack);
if (balance.lableQty) {
newDetail.handleQty = balance.lableQty
}
}).catch(err => {
this.showErrorMessage(err.message);
})
}
newDetail.parentNumber = pack.parentNumber;
newDetail.packingNumber = pack.number
newDetail.packUnit = pack.packUnit;
newDetail.packQty = pack.packQty;
return newDetail;
},
showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => {
if (res) {
@ -432,12 +400,18 @@
this.updateData();
},
// openScanPopup() {
// if (this.businessType) {
// this.$refs.scanPopup.openScanPopup(this.businessType);
// } else {
// this.getBusinessType()
// }
// },
openScanPopup() {
if (this.businessType) {
this.$refs.scanPopup.openScanPopup(this.businessType);
} else {
this.getBusinessType()
}
setTimeout(r => {
this.$refs.scanPopup.openScanPopupByBusinessType(this.businessType);
})
},
showFromLocationPopup() {

Loading…
Cancel
Save