Browse Source

维修备件退货

hella_online_20241017
yufei_wang 2 months ago
parent
commit
5ce7c8baeb
  1. 69
      src/views/wms/purchasereceiptManage/purchasereturnspare/purchasereturnRequestSpareMain/index.vue

69
src/views/wms/purchasereceiptManage/purchasereturnspare/purchasereturnRequestSpareMain/index.vue

@ -92,9 +92,11 @@
:updateTypeEdiltSubList="true"
@tableSelectionDelete="tableSelectionDelete"
@searchTableSuccess="searchTableSuccess"
@clearSearchInput="clearSearchInput"
@submitForm="submitForm"
@onEnter="onEnter"
@onChange="onChangeForm"
@inputNumberChange="inputNumberChange"
>
<template #hahaha>
@ -367,6 +369,21 @@ const searchTableSuccess1 = (formField, searchField, val, type, row) => {
formRef.value.formRef.setValues(setV)
}
}
const clearSearchInput = (formField) => {
if(formField == 'supplierCode'){
formRef.value.formRef.setValues({
hahaha:'',
hehehe:'',
poNumber:'',
receiptNumber:'',
asnNumber:'',
})
tableData.value = []
}else if(formField == 'locationCode'){
tableData.value = []
}
}
//
const searchTableSuccess = async (formField, searchField, val, formRef, type, row) => {
console.log('searchTableSuccess', formField, searchField, val, formRef, type, row)
@ -381,15 +398,27 @@ const searchTableSuccess = async (formField, searchField, val, formRef, type, ro
if(formField=='supplierCode'){
setV['supplierName'] = val[0]['shortName']
tableData.value = []
}else if(formField == 'locationCode' ){
}
formRef.setValues(setV)
if(formField == 'locationCode' ){
// 退
let subList = await PurchasereturnRequestDetailApi.queryBalancePurchaseReceiptSpareReturn({
supplierCode:formRef.formModel.supplierCode,//
poNumber:formRef.formModel.poNumber,//
receiptNumber:formRef.formModel.receiptNumber,//
fromLocationCode:val[0][searchField]//
getTableData()
}
}
})
}
const getTableData = async ()=>{
let formModel = formRef.value.formRef.formModel
console.log('formRef',formRef.value)
console.log('formModel',formModel)
let subList = await PurchasereturnRequestDetailApi.queryBalancePurchaseReceiptSpareReturn({
supplierCode:formModel.supplierCode,//
poNumber:formModel.poNumber,//
receiptNumber:formModel.receiptNumber,//
fromLocationCode:formModel.locationCode//
})
console.log('subList',subList)
if(subList&&subList.length>0){
tableData.value = subList
@ -399,13 +428,6 @@ const searchTableSuccess = async (formField, searchField, val, formRef, type, ro
}else{
tableData.value = []
}
}
formRef.setValues(setV)
}
})
}
//
const searchTableSuccessDetail = (formField, searchField, val, formRef) => {
@ -823,6 +845,16 @@ const tableSelectionDelete = (selection) => {
}
}
//true0
const inputNumberChange = (field, val,row, index) => {
console.log('inputNumberChange',formRef.value.formRef)
if(field=='qty'){
if(row['balanceQty']!=null&&row['qty']>row['balanceQty']){
message.error(`物料${row['itemCode']}退货数量不能大于库存余额`)
}
}
console.log('inputNumberChange',field, val,row, index)
}
//
const submitForm = async (formType, submitData) => {
let data = { ...submitData }
@ -834,15 +866,12 @@ const submitForm = async (formType, submitData) => {
item['poNumber'] = data['poNumber']
})
console.log('submitForm', tableData.value)
// if(tableData.value.find(item=>Number(item.returnedQty)>Number(item.receiptQty))){
// message.warning("退")
// return;
// }
if (tableData.value.find((item) => Number(item.qty) > Number(item.inventoryBalance))) {
message.warning('退货数量不能大于库存余额')
let errorItemCode = tableData.value.find((item) => Number(item.qty) > Number(item.balanceQty))
if (errorItemCode) {
message.error(`物料${errorItemCode['itemCode']}退货数量不能大于库存余额`)
return
}
data.subList = tableData.value //
data.subList = tableData.value.filter(item=>Number(item['qty'])>0) //
formRef.value.formLoading = true
try {
if (formType === 'create') {

Loading…
Cancel
Save