Browse Source

采购上架批次数量

intex_online20241111
zhang_li 4 weeks ago
parent
commit
93aa9012a7
  1. 2
      src/common/record.js
  2. 225
      src/mycomponents/record/recordComDetailCardBatch.vue
  3. 117
      src/pages/putaway/record/putawayRecord.vue

2
src/common/record.js

@ -81,8 +81,6 @@ export function calcHandleQty(detailSource) {
} }
//添加数量 //添加数量
export function calcHandleQtyAdd(detailSource,label) { export function calcHandleQtyAdd(detailSource,label) {
console.log(label.qty)
console.log(detailSource)
for (let item of detailSource) { for (let item of detailSource) {
item.handleQty = item.handleQty || new Decimal(0).toNumber(); item.handleQty = item.handleQty || new Decimal(0).toNumber();
item.qty = item.qty|| new Decimal(0).toNumber(); item.qty = item.qty|| new Decimal(0).toNumber();

225
src/mycomponents/record/recordComDetailCardBatch.vue

@ -0,0 +1,225 @@
<template>
<view class="" style="background-color: #fff;">
<uni-collapse ref="collapse1">
<uni-collapse-item :open="true">
<template v-slot:title>
<uni-swipe-action>
<uni-swipe-action-item @click="removeItem($event,dataContent)" :right-options="removeOptions">
<item-qty :dataContent="dataContent" :isShowBalance="true"
:isShowBalanceQty="isShowBalanceQty"
:isShowRecommendQty="false"
></item-qty>
<view style="margin-left: 10px; margin-top: 5px;">
<pack title='父包装' v-if="dataContent.containerNumber" :packingCode='dataContent.containerNumber'></pack>
<location v-if="isShowParentToLocation" title='目标库位'
:locationCode='dataContent.toLocationCode'></location>
</view>
</uni-swipe-action-item>
</uni-swipe-action>
</template>
<view class='split_line'></view>
<view class="" v-for="(detail,index) in dataContent.subList" :key="index">
<uni-swipe-action>
<uni-swipe-action-item @click="swipeClick($event,detail,index)"
:right-options="detail.scaned?scanOptions:detailOptions">
<balance :dataContent="detail" :isShowStdPack="false" :isShowStatus="isShowStatus"
:isShowPack="true" :isShowFromLocation="isShowFromLocation"
:isShowToLocation="isShowToLocation" :isShowParentPack="isShowParentPack">
</balance>
</uni-swipe-action-item>
</uni-swipe-action>
<!-- <view class='split_line'></view> -->
</view>
</uni-collapse-item>
</uni-collapse>
<balance-qty-edit ref="balanceQtyEdit" @confirm="confirm" ></balance-qty-edit>
<record-detail-popup ref="recordDetailPopup"></record-detail-popup>
<comMessage ref="comMessage"></comMessage>
</view>
</template>
<script>
import itemQty from '@/mycomponents/item/itemQty.vue'
import balance from '@/mycomponents/balance/balance.vue'
import recommend from '@/mycomponents/recommend/recommend.vue'
import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue'
import balanceDetailPopup from '@/mycomponents/balance/balanceDetailPopup.vue'
import purchaseLabel from '@/mycomponents/balance/purchaseLabel.vue'
import location from '@/mycomponents/balance/location.vue'
import recordDetailPopup from '@/mycomponents/detail/recordDetailPopup.vue'
import pack from '@/mycomponents/balance/pack.vue'
import PackageAndItemCard from '@/mycomponents/package/PackageAndItemCard.vue'
import {
getDetailOption,
getDetailEditRemoveOption,
getClearOption,
getEditLocationRemoveOption,
getRecordOption
} from '@/common/array.js';
export default {
components: {
itemQty,
recommend,
balance,
balanceQtyEdit,
balanceDetailPopup,
purchaseLabel,
location,
recordDetailPopup,
pack,
PackageAndItemCard
// winListHint
},
props: {
dataContent: {
type: Object,
default: {}
},
settingParam: {
type: Object,
default: {}
},
isShowStatus: {
type: Boolean,
default: true
},
isShowFromLocation: {
type: Boolean,
default: true
},
isShowToLocation: {
type: Boolean,
default: true
},
isShowParentToLocation: {
type: Boolean,
default: true
},
isShowBalanceQty: {
type: Boolean,
default: false
},
isShowParentPack: {
type: Boolean,
default: true
},
isShowModifedLocation: {
type: Boolean,
default: false
},
allowModifyQty: {
type: Boolean,
default: true
},
allowModifyLocation: {
type: Boolean,
default: false
}
},
watch: {
dataContent: {
handler(newName, oldName) {
if (this.dataContent.subList.length > 0) {
this.$nextTick(res => {
setTimeout(() => {
if (this.$refs.collapse1) {
this.$refs.collapse1.resize();
}
}, 500)
})
}
},
immediate: true,
deep: true
}
},
data() {
return {
option: [],
title: "推荐详情",
showItem: {},
editItem: {},
detailOptions: [],
scanOptions: [],
removeOptions: [],
dataList: []
}
},
mounted() {
this.detailOptions = getDetailOption();
this.scanOptions = getRecordOption(this.allowModifyQty,this.allowModifyLocation);
this.removeOptions = this.isShowModifedLocation ?getEditLocationRemoveOption():getClearOption();
},
methods: {
removeItem(e, dataContent) {
if (e.content.text == "移除") {
this.$refs.comMessage.showQuestionMessage("确定清空物料及箱码信息?",
res => {
if (res) {
this.$emit('removeItem', dataContent)
// this.$emit('removeItem', this.dataContent)
}
});
} else {
this.editLocation(dataContent)
}
},
swipeClick(e, item, index) {
if (e.content.text == "详情") {
this.detail(item)
} else if (e.content.text == "编辑") {
this.edit(item)
} else if (e.content.text == "移除") {
this.remove(item, index)
}
},
edit(item) {
this.editItem = item;
this.$refs.balanceQtyEdit.openEditPopup(this.editItem, this.editItem.handleQty);
},
detail(item) {
this.showItem = item;
this.$refs.recordDetailPopup.openPopup(item);
},
remove(item, index) {
this.$refs.comMessage.showQuestionMessage("确定移除扫描信息?",
res => {
if (res) {
this.dataContent.subList.splice(index, 1)
this.$emit('removePack')
}
});
},
editLocation(item) {
this.editItem = item;
this.$emit('editLocation', item)
},
confirm(qty) {
// this.editItem.qty = qty;
this.editItem.handleQty = qty;
this.$emit('updateData')
}
}
}
</script>
<style>
</style>

117
src/pages/putaway/record/putawayRecord.vue

@ -15,12 +15,21 @@
<scroll-view scroll-y="true" class="page-main-scroll"> <scroll-view scroll-y="true" class="page-main-scroll">
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id"> <view class="detail-list" v-for="(item, index) in detailSource" :key="item.id">
<view class=""> <view class="">
<record-com-detail-card-batch :dataContent="item" :index="index" :settingParam="dataContent"
:isShowFromLocation="false" @removeItem="removeItem(index,item)"
:isShowModifedLocation="true"
@updateData="updateData"
@editLocation="showScanToLocation"
@removePack="removePack"
v-if="managementType == 'BY_BATCH'||managementType =='BY_QUANTITY' ">
</record-com-detail-card-batch>
<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)"
:isShowModifedLocation="true" :isShowModifedLocation="true"
@updateData="updateData" @updateData="updateData"
@editLocation="showScanToLocation" @editLocation="showScanToLocation"
@removePack="removePack"> @removePack="removePack"
v-else>
</record-com-detail-card> </record-com-detail-card>
</view> </view>
@ -81,7 +90,8 @@
getBusinessType, getBusinessType,
createItemInfo, createItemInfo,
createDetailInfo, createDetailInfo,
calcHandleQty calcHandleQty,
calcHandleQtyAdd
} from '@/common/record.js'; } from '@/common/record.js';
import { import {
@ -97,6 +107,7 @@
import winScanLocation from "@/mycomponents/scan/winScanLocation.vue" import winScanLocation from "@/mycomponents/scan/winScanLocation.vue"
import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue" import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue"
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue' import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue'
import recordComDetailCardBatch from '@/mycomponents/record/recordComDetailCardBatch.vue'
export default { export default {
components: { components: {
@ -106,7 +117,8 @@
comBlankView, comBlankView,
winScanLocation, winScanLocation,
winScanPackAndLocation, winScanPackAndLocation,
recordComDetailCard recordComDetailCard,
recordComDetailCardBatch
}, },
data() { data() {
return { return {
@ -125,6 +137,7 @@
fromWarehouseCode: '', // fromWarehouseCode: '', //
businessTypeCode: "PurchasePutaway", businessTypeCode: "PurchasePutaway",
editItem:{}, editItem:{},
managementType:''
}; };
}, },
onLoad(option) { onLoad(option) {
@ -157,7 +170,88 @@
mounted() {}, mounted() {},
methods: { methods: {
getScanResult(result) { getScanResult(result,managementType) {
this.managementType = managementType
if(managementType == "BY_BATCH" ||managementType == "BY_QUANTITY" ){
this. getScanResultAfterBatch(result)
}else{
this. getScanResultAfter(result)
}
},
getScanResultAfterBatch(result){
let balance = result.balance;
let label = result.label;
let pack = result.package;
let poLine =label.poLine;
let poNumber =label.poNumber;
let supplierCode=label.supplierCode;
var item = this.detailSource.find(res => {
if (res.itemCode == balance.itemCode) {
return res
}
})
if (this.fromWarehouseCode == '') {
this.fromWarehouseCode = balance.warehouseCode;
}
if (item == undefined) {
//
this.getRecommendLocation(balance, pack, toLocation => {
var itemp = createItemInfo(balance, pack);
itemp.toLocationCode = toLocation.locationCode;
let newDetail = createDetailInfo(balance, pack); //
newDetail.toLocationCode = toLocation.locationCode;
newDetail.toWarehouseCode = toLocation.toWarehouseCode;
newDetail.poLine=poLine;
newDetail.poNumber=poNumber;
newDetail.supplierCode=supplierCode;
newDetail.fromInventoryStatus = balance.inventoryStatus;
newDetail.handleQty =0;
newDetail.balanceQty =result.balance.qty;
itemp.subList.push(newDetail);
this.detailSource.push(itemp)
calcHandleQtyAdd(this.detailSource,result.label);
})
} else {
var detail = item.subList.find(r => {
if (
r.batch == balance.batch &&
r.locationCode == balance.locationCode &&
r.inventoryStatus == balance.inventoryStatus) {
return r;
}
})
if (detail == undefined) {
this.getRecommendLocation(balance, pack, toLocation => {
let newDetail = createDetailInfo(balance, pack);
newDetail.toLocationCode = toLocation.locationCode;
newDetail.toWarehouseCode = toLocation.toWarehouseCode;
newDetail.poLine=poLine;
newDetail.poNumber=poNumber;
newDetail.supplierCode=supplierCode;
newDetail.fromInventoryStatus = balance.inventoryStatus;
newDetail.handleQty =0;
newDetail.balanceQty =result.balance.qty;
if(item.subList&&item.subList.length>0){
if(item.subList[0].batch!=newDetail.batch){
this.showErrorMessage("扫描的批次是["+newDetail.batch+"],请扫描["+item.subList[0].batch+"的批次的箱码")
}
}else {
item.subList.push(newDetail);
calcHandleQtyAdd(this.detailSource,result.label);
}
});
} else {
if (detail.scaned == true) {
calcHandleQtyAdd(this.detailSource,result.label);
// this.showErrorMessage( "[" + balance.batch + "]")
}
}
}
},
getScanResultAfter(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;
@ -189,7 +283,7 @@
this.detailSource.push(itemp) this.detailSource.push(itemp)
calcHandleQty(this.detailSource); calcHandleQty(this.detailSource);
}) })
} else { } else {
var detail = item.subList.find(r => { var detail = item.subList.find(r => {
if (r.packingNumber == balance.packingNumber && if (r.packingNumber == balance.packingNumber &&
@ -225,7 +319,6 @@
} }
}, },
// //
getRecommendLocation(balance, pack, callback) { getRecommendLocation(balance, pack, callback) {
uni.showLoading({ uni.showLoading({
@ -344,8 +437,14 @@
if (res.success) { if (res.success) {
this.managementList = res.list; this.managementList = res.list;
var params = this.setRecordParams() var params = this.setRecordParams()
console.log("提交参数", JSON.stringify(params)); console.log("提交参数", params);
const isHaveItem =params.subList.find(item=>item.handleQty > item.balanceQty)
if(isHaveItem){
this.showErrorMessage(`物料号${isHaveItem.itemCode}`)
this.$refs.comMessage.showConfirmWarningModal('物料号'+isHaveItem.itemCode+'数量[' + isHaveItem.handleQty + ']不允许大于库存数量[' + isHaveItem.balanceQty + ']')
uni.hideLoading()
return
}
putawayRecordSubmit(params).then(res => { putawayRecordSubmit(params).then(res => {
uni.hideLoading() uni.hideLoading()
if (res.data) { if (res.data) {
@ -415,6 +514,8 @@
submitItem.fromLocationCode = detail.locationCode; submitItem.fromLocationCode = detail.locationCode;
submitItem.toLocationCode = detail.toLocationCode; submitItem.toLocationCode = detail.toLocationCode;
submitItem.balanceQty = detail.balanceQty;
submitItem.itemName = item.itemName; submitItem.itemName = item.itemName;
// detail.toInventoryStatus = detail.inventoryStatus // detail.toInventoryStatus = detail.inventoryStatus

Loading…
Cancel
Save