Browse Source

修改直接补料和补料任务库存匹配

hella_online_20240829
lijuncheng 3 months ago
parent
commit
2247f1ce48
  1. 2
      src/pages/repleinsh/coms/comScanReplishPack.vue
  2. 148
      src/pages/repleinsh/record/directRepleinshRecord.vue

2
src/pages/repleinsh/coms/comScanReplishPack.vue

@ -281,7 +281,7 @@
//
let subParentPackitems = balances.list.filter(r => r.packingNumber ==
packageInfo
.parentNumber)
.parentNumber&&r.locationCode==this.fromLocationCode)
//

148
src/pages/repleinsh/record/directRepleinshRecord.vue

@ -40,11 +40,12 @@
</view>
<win-scan-button @goScan='openScanPopup'></win-scan-button>
</view>
<win-scan-pack-and-location ref="scanPopup" @getResult='getScanResult' :allowModifyLocation='false'>
<win-scan-pack-and-location ref="scanPopup" @getResult='getScanResult' :allowModifyLocation='false' :queryBalance="false">
</win-scan-pack-and-location>
<comMessage ref="comMessage"></comMessage>
<win-scan-location ref="scanLocationCode" title="来源库位" @getLocation='getLocation'
:locationAreaTypeList="fromLocationAreaTypeList"></win-scan-location>
<balance-select ref="balanceSelect" @onSelectItem='selectBalanceItem'></balance-select>
</view>
</template>
@ -52,7 +53,8 @@
import {
repleinshRecordSubmit,
validateItemAndLocation,
getPutawayRecommendLocation
getPutawayRecommendLocation,
getBalanceByFilter
} from '@/api/request2.js';
import {
@ -92,6 +94,7 @@
import winScanLocation from "@/mycomponents/scan/winScanLocation.vue"
import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue"
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue'
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue'
export default {
components: {
@ -101,7 +104,8 @@
comBlankView,
winScanLocation,
winScanPackAndLocation,
recordComDetailCard
recordComDetailCard,
balanceSelect
},
data() {
return {
@ -118,7 +122,8 @@
recommendLocationList: [], //
fromWarehouseCode: '', //
businessTypeCode: "Repleinment",
toLocationCode:""
toLocationCode:"",
resultData:{}
};
},
onLoad(option) {
@ -148,7 +153,141 @@
mounted() {},
methods: {
getBalance(label, packageInfo, callback) {
var filters = []
if (packageInfo.parentNumber) {
var packingNumber = packageInfo.parentNumber + "," + label.packingNumber;
filters.push({
column: "packingNumber",
action: "in",
value: packingNumber
})
} else {
filters.push({
column: "packingNumber",
action: "==",
value: label.packingNumber
})
}
filters.push({
column: "itemCode",
action: "==",
value: label.itemCode
})
filters.push({
column: "batch",
action: "==",
value: label.batch
})
if (this.fromInventoryStatuses != null && this.fromInventoryStatuses != "") {
filters.push({
column: "inventoryStatus",
action: "in",
value: this.fromInventoryStatuses
})
}
var params = {
filters: filters,
pageNo: 1,
pageSize: 100,
}
getBalanceByFilter(params).then(res => {
callback(res.data)
}).catch(err => {
this.showErrorMessage(err.message);
})
},
getScanResult(result) {
this.resultData=result;
let packageInfo = result.package;
this.getBalance(result.label, packageInfo, balances =>{
//
let s = '';
if (!result.package.parentNumber) {
if (balances.list.length == 0) {
this.showErrorMessage('未查找到该包装的库存信息,请重新扫描')
} else {
let newBalances = balances.list.filter(b => b.locationCode == this
.fromLocationCode);
if (newBalances.length == 0) {
this.showErrorMessage('未查找到该包装的库存信息,请重新扫描')
} else if (newBalances.length == 1) {
let balance = newBalances[0];
result.balance=balance;
this.afterGetBalance(result);
} else {
this.showBalanceSelect(newBalances);
}
}
} else {
//
if (balances.list.length == 0) {
this.showErrorMessage('未查找到该包装的库存信息,请重新扫描')
} else {
//
let subPackitems = balances.list.filter(r => r.packingNumber == packageInfo
.number)
//
let subParentPackitems = balances.list.filter(r => r.packingNumber ==
packageInfo
.parentNumber&&r.locationCode==this.fromLocationCode)
//
if (subPackitems.length == 0) {
//
if (subParentPackitems.length > 0) {
if(subParentPackitems.length==1){
let balance = subParentPackitems[0];
balance.qty=packageInfo.qty;
result.balance =balance;
this.afterGetBalance(result);
}else {
this.showBalanceSelect(subParentPackitems);
}
} else {
this.showErrorMessage('按外包装【' + packageInfo.parentNumber + '】和子包装【' +
packageInfo.number + '】都未查找到库存余额')
}
} else {
var locationCode = this.fromLocationCode
if(balances.list==1){
locationCode=balances.list[0].locationCode
}else {
var manyBlances = balances.list.filter(r=>r.locationCode!=this.fromLocationCode)
if(manyBlances.length>0){
locationCode = manyBlances[0].locationCode;
}
}
this.showErrorMessage('该包装【' + packageInfo.number + '】在库位【' +
locationCode +
'】已经有库存余额,请重新扫描')
}
}
}
})
},
showBalanceSelect(items) {
this.$refs.balanceSelect.openPopup(items);
},
selectBalanceItem(balance) {
this.afterGetBalance(this.resultData, balance);
},
afterGetBalance(result){
let balance = result.balance;
let label = result.label;
let pack = result.package;
@ -197,7 +336,6 @@
}
}
}
},
showErrorMessage(message) {

Loading…
Cancel
Save