Browse Source

增加组件、修改直接发料功能

ljc_0803
niexiting 4 months ago
parent
commit
2f5d6c0e84
  1. 17
      src/common/record.js
  2. 7
      src/mycomponents/balance/balance.vue
  3. 12
      src/mycomponents/record/recordComDetailCard.vue
  4. 273
      src/mycomponents/scan/winScanParentPackage.vue
  5. 203
      src/pages/issue/record/directIssue0816.vue

17
src/common/record.js

@ -39,7 +39,7 @@ export function createDetailInfo(balance, pack) {
let detail = deepCopyData(balance); let detail = deepCopyData(balance);
detail.balanceQty = new Decimal(detail.qty).toNumber() detail.balanceQty = new Decimal(detail.qty).toNumber()
detail.qty = new Decimal(detail.qty).toNumber(); detail.qty = new Decimal(detail.qty).toNumber();
detail.packQty = pack.packQty?new Decimal(pack.packQty).toNumber():0 detail.packQty = pack.packQty ? new Decimal(pack.packQty).toNumber() : 0
detail.packUnit = pack.packUnit detail.packUnit = pack.packUnit
detail.handleQty = new Decimal(detail.qty).toNumber(); detail.handleQty = new Decimal(detail.qty).toNumber();
detail.package = pack; detail.package = pack;
@ -49,6 +49,21 @@ export function createDetailInfo(balance, pack) {
return detail; 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) { export function calcHandleQty(detailSource) {
for (let item of 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="dataContent.scaned?'scan_view':''" style="background-color: #ffffff;margin-bottom: 1px; ">
<view class="uni-flex uni-row space-between" style="align-items: center"> <view class="uni-flex uni-row space-between" style="align-items: center">
<view> <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> <pack v-if="isShowPack && dataContent.packingNumber" :packingCode="dataContent.packingNumber"></pack>
<batch v-if="isShowBatch && dataContent.batch" :batch="dataContent.batch"></batch> <batch v-if="isShowBatch && dataContent.batch" :batch="dataContent.batch"></batch>
<location title="来源库位" v-if="isShowFromLocation" :locationCode="dataContent.locationCode"></location> <location title="来源库位" v-if="isShowFromLocation" :locationCode="dataContent.locationCode"></location>
@ -91,6 +92,10 @@
type: Boolean, type: Boolean,
default: false default: false
}, },
isShowParentPack: {
type: Boolean,
default: true
},
}, },
watch: { watch: {

12
src/mycomponents/record/recordComDetailCard.vue

@ -9,7 +9,8 @@
:isShowBalanceQty="isShowBalanceQty"></item-qty> :isShowBalanceQty="isShowBalanceQty"></item-qty>
<view style="margin-left: 10px; margin-top: 5px;"> <view style="margin-left: 10px; margin-top: 5px;">
<pack title='父包装' :packingCode='dataContent.containerNumber'></pack> <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> </view>
</uni-swipe-action-item> </uni-swipe-action-item>
</uni-swipe-action> </uni-swipe-action>
@ -21,7 +22,7 @@
:right-options="detail.scaned?scanOptions:detailOptions"> :right-options="detail.scaned?scanOptions:detailOptions">
<balance :dataContent="detail" :isShowStdPack="false" :isShowStatus="isShowStatus" <balance :dataContent="detail" :isShowStdPack="false" :isShowStatus="isShowStatus"
:isShowPack="true" :isShowFromLocation="isShowFromLocation" :isShowPack="true" :isShowFromLocation="isShowFromLocation"
:isShowToLocation="isShowToLocation"> :isShowToLocation="isShowToLocation" :isShowParentPack="isShowParentPack">
</balance> </balance>
</uni-swipe-action-item> </uni-swipe-action-item>
</uni-swipe-action> </uni-swipe-action>
@ -100,6 +101,11 @@
type: Boolean, type: Boolean,
default: false default: false
}, },
isShowParentPack: {
type: Boolean,
default: true
},
}, },
watch: { watch: {
@ -146,7 +152,7 @@
this.$refs.comMessage.showQuestionMessage("确定清空物料及箱码信息?", this.$refs.comMessage.showQuestionMessage("确定清空物料及箱码信息?",
res => { res => {
if (res) { if (res) {
this.$emit('removeItem',dataContent) this.$emit('removeItem', dataContent)
// this.$emit('removeItem', this.dataContent) // this.$emit('removeItem', this.dataContent)
} }
}); });

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>

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

@ -18,9 +18,8 @@
<record-com-detail-card :dataContent="item" :index="index" :settingParam="dataContent" <record-com-detail-card :dataContent="item" :index="index" :settingParam="dataContent"
:isShowFromLocation="false" @removeItem="removeItem(index,item)" :isShowFromLocation="false" @removeItem="removeItem(index,item)"
:isShowToLocation="false" :isShowParentToLocation="false" @updateData="updateData" :isShowToLocation="false" :isShowParentToLocation="false" @updateData="updateData"
@removePack="removePack"> @removePack="removePack" :isShowParentPack="false">
</record-com-detail-card> </record-com-detail-card>
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
@ -45,7 +44,8 @@
</view> </view>
<win-scan-button @goScan='openScanPopup'></win-scan-button> <win-scan-button @goScan='openScanPopup'></win-scan-button>
</view> </view>
<win-scan-package ref="scanPopup" @getResult='getScanResult'></win-scan-package> <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 ref="scanPopup" @getBalance='getScanResult' :bussinessCode="businessTypeCode">
</winComScanBalance> --> </winComScanBalance> -->
<!-- <balanceQuery ref="refBalanceQuery"></balanceQuery> --> <!-- <balanceQuery ref="refBalanceQuery"></balanceQuery> -->
@ -79,6 +79,7 @@
getBusinessType, getBusinessType,
createItemInfo, createItemInfo,
createDetailInfo, createDetailInfo,
createDetailByPackInfo,
calcTreeHandleQty, calcTreeHandleQty,
calcHandleQty calcHandleQty
} from '@/common/record.js'; } from '@/common/record.js';
@ -100,7 +101,7 @@
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue' import balanceSelect from '@/mycomponents/balance/balanceSelect.vue'
import winComScanBalance from '@/mycomponents/scan/winComScanBalance.vue' import winComScanBalance from '@/mycomponents/scan/winComScanBalance.vue'
// import balanceQuery from '@/mycomponents/query/balanceQuery.vue' // import balanceQuery from '@/mycomponents/query/balanceQuery.vue'
import winScanPackage from '@/mycomponents/scan/winScanPackage.vue' import winScanParentPackage from '@/mycomponents/scan/winScanParentPackage.vue'
export default { export default {
components: { components: {
@ -114,7 +115,7 @@
recordDetailCard, recordDetailCard,
balanceSelect, balanceSelect,
winComScanBalance, winComScanBalance,
winScanPackage winScanParentPackage
// balanceQuery // balanceQuery
}, },
data() { data() {
@ -196,82 +197,87 @@
}, },
getScanResult(result) { getScanResult(result) {
// let balance = result.balance;
let pack = result.package; let pack = result.package;
result.balance.forEach( let childBalance = result.balance.childBalance;
b => { let parentBalance = result.balance.parentBalance[0];
this.setPackageData(b,pack);
//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 &&
// getScanResult(result) { r.batch == pack.batch) {
// let pack = result.package; return r;
// let balance = result.balance; }
})
// if (this.fromLocationCode && this.fromLocationCode != balance.locationCode) {
// this.showErrorMessage("[" + balance.packingNumber + "[" + balance.batch + "][" + this
// .fromLocationCode + "]")
// return;
// }
// // if (detail && detail.scaned) {
// if (pack.parentNumber) { this.showErrorMessage("箱码[" + pack.number + "批次[" + pack.batch + "]重复扫描")
// this.setPackageData(result); return;
// } else { }
// this.setContainerData(result); }
// } }
// },
setPackageData(balance, pack) { //2.
// let balance = result.balance; //
// let pack = result.package; if (pack.parentNumber) {
//
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 {
//
}
} else {
//
this.setPackageData(parentBalance, sub);
}
})
}
},
setPackageData(balance, pack) {
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
} }
}) })
if (item == undefined) { 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); var itemp = createItemInfo(balance, pack);
let newDetail = createDetailInfo(balance, pack); // let newDetail = this.createPackageDetail(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
}
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 this.fromLocationCode = balance.locationCode;
this.fromWarehouseCode = balance.warehouseCode;
this.scanPopupGetFocus() this.scanPopupGetFocus()
} else { } else {
var detail = item.subList.find(r => { var detail = item.subList.find(r => {
if (r.packingNumber == pack.number && if (r.packingNumber == pack.number &&
r.batch == balance.batch && r.batch == pack.batch &&
r.locationCode == balance.locationCode && r.locationCode == pack.locationCode &&
r.inventoryStatus == balance.inventoryStatus) { r.inventoryStatus == balance.inventoryStatus) {
return r; return r;
} }
}) })
if (detail == undefined) { if (detail == undefined) {
let newDetail = createDetailInfo(balance, pack); let newDetail = this.createPackageDetail(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
}
item.subList.push(newDetail); item.subList.push(newDetail);
this.scanPopupGetFocus() this.scanPopupGetFocus()
} else { } else {
@ -283,73 +289,26 @@
calcHandleQty(this.detailSource); 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)
} else {
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) { showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => { this.$refs.comMessage.showErrorMessage(message, res => {
if (res) { if (res) {
@ -448,7 +407,7 @@
// this.getBusinessType() // this.getBusinessType()
// } // }
// }, // },
openScanPopup() { openScanPopup() {
setTimeout(r => { setTimeout(r => {
this.$refs.scanPopup.openScanPopupByBusinessType(this.businessType); this.$refs.scanPopup.openScanPopupByBusinessType(this.businessType);

Loading…
Cancel
Save