Browse Source

维修备件退货

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

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

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

Loading…
Cancel
Save