|
|
@ -51,7 +51,7 @@ |
|
|
|
</ContentWrap> |
|
|
|
|
|
|
|
<!-- 表单弹窗:添加/修改 --> |
|
|
|
<BasicForm |
|
|
|
<!-- <BasicForm |
|
|
|
ref="formRef" |
|
|
|
@success="getList" |
|
|
|
:rules="PurchasereturnRequestMainRules" |
|
|
@ -72,7 +72,38 @@ |
|
|
|
fieldTableColumn="itemCode" |
|
|
|
@submitForm="submitForm" |
|
|
|
@onEnter="onEnter" |
|
|
|
/> |
|
|
|
/> --> |
|
|
|
<!-- 表单弹窗:添加/修改 --> |
|
|
|
<BasicForm |
|
|
|
ref="formRef" |
|
|
|
@success="getList" |
|
|
|
:rules="PurchasereturnRequestMainRulesNew" |
|
|
|
:formAllSchemas="PurchasereturnRequestMainNew.allSchemas" |
|
|
|
:tableAllSchemas="PurchasereturnRequestDetailNew.allSchemas" |
|
|
|
:tableFormRules="PurchasereturnRequestDetailRulesNew" |
|
|
|
:tableData="tableData" |
|
|
|
:apiUpdate="PurchasereturnRequestMainApi.updatePurchasereturnRequestMain" |
|
|
|
:apiCreate="PurchasereturnRequestMainApi.createPurchasereturnRequestMain" |
|
|
|
:isBusiness="true" |
|
|
|
:isShowButton="false" |
|
|
|
@handleDeleteTable="handleDeleteTable" |
|
|
|
:isShowReduceButtonSelection="false" |
|
|
|
:isShowReduceButton="false" |
|
|
|
:updateTypeEdiltSubList="true" |
|
|
|
@tableSelectionDelete="tableSelectionDelete" |
|
|
|
@searchTableSuccess="searchTableSuccess" |
|
|
|
@submitForm="submitForm" |
|
|
|
@onEnter="onEnter" |
|
|
|
@onChange="onChangeForm" |
|
|
|
> |
|
|
|
|
|
|
|
<template #hahaha> |
|
|
|
<el-button style="width:100%" type="primary" @click="chooseReceiptList">选择收货单明细</el-button> |
|
|
|
</template> |
|
|
|
<template #hehehe> |
|
|
|
<el-button style="width:100%" type="info" @click="choosePurchanseList">直接选择采购订单</el-button> |
|
|
|
</template> |
|
|
|
</BasicForm> |
|
|
|
<!-- 添加明细:采购收货记录单号 --> |
|
|
|
<SearchTable ref="searchTableRef" @searchTableSuccess="searchTableSuccess1" /> |
|
|
|
|
|
|
@ -131,6 +162,15 @@ import { |
|
|
|
PurchasereReturnRequestDetailLabel, |
|
|
|
PurchasereceiptRecordMain1 |
|
|
|
} from './purchasereturnRequestSpareMain.data' |
|
|
|
import { |
|
|
|
PurchasereturnRequestMainNew, |
|
|
|
PurchasereturnRequestMainRulesNew, |
|
|
|
PurchasereturnRequestDetailNew, |
|
|
|
PurchasereturnRequestDetailRulesNew, |
|
|
|
PurchasereturnPurchasereceiptRecordNew |
|
|
|
} from './purchasereturnRequestSpareMainNew.data' |
|
|
|
import * as PurchaseDetailApi from '@/api/wms/purchaseDetail' |
|
|
|
|
|
|
|
import * as PurchasereturnRequestMainApi from '@/api/wms/purchasereturnRequestMain' |
|
|
|
import * as PurchasereturnRequestDetailApi from '@/api/wms/purchasereturnRequestDetail' |
|
|
|
import * as PurchasereceiptRecordDetailApi from '@/api/wms/purchasereceiptRecordDetail' |
|
|
@ -143,8 +183,10 @@ import { async } from '@antv/x6/lib/registry/marker/async' |
|
|
|
import { getJmreportBaseUrl } from '@/utils/systemParam' |
|
|
|
import { formatDate } from '@/utils/formatTime' |
|
|
|
import { usePageLoading } from '@/hooks/web/usePageLoading' |
|
|
|
import { PurchaseMain, PurchaseDetail } from '@/views/wms/purchasereceiptManage/supplierdeliver/purchaseMainWms/purchaseMain.data' |
|
|
|
|
|
|
|
const { loadStart, loadDone } = usePageLoading() |
|
|
|
// 采购退货申请 |
|
|
|
// 维修备件退货申请 |
|
|
|
defineOptions({ name: 'PurchasereturnRequestSpareMain' }) |
|
|
|
|
|
|
|
const message = useMessage() // 消息弹窗 |
|
|
@ -229,7 +271,118 @@ const searchTableSuccessLabel = (formField, searchField, val, formRef, type, row |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
const onChangeForm = async (field, cur, formRef)=>{ |
|
|
|
console.log('onChangeForm',field, cur, formRef) |
|
|
|
if(field=='supplierCode'){ |
|
|
|
//供应商 |
|
|
|
PurchasereturnRequestMainNew.allSchemas.formSchema.forEach(item=>{ |
|
|
|
// 物料名称赋值 |
|
|
|
if(item.field=='supplierCode'){ |
|
|
|
let setV = {} |
|
|
|
setV['supplierName'] = item.componentProps.options?.find(el=>el.supplierCode==cur+'')['supplierName'] |
|
|
|
formRef.value.setValues(setV) |
|
|
|
} |
|
|
|
}) |
|
|
|
getPurchanseList() |
|
|
|
} |
|
|
|
} |
|
|
|
const getPurchanseList = async ()=>{ |
|
|
|
let res = await PurchaseDetailApi.getPurchaseDetailPageWMS({ |
|
|
|
supplierCode: formRef.value.formRef.formModel.supplierCode, |
|
|
|
itemCode: formRef.value.formRef.formModel.itemCode, |
|
|
|
pageSize: 20, |
|
|
|
pageNo: 1, |
|
|
|
sort: '', |
|
|
|
by: 'ASC' |
|
|
|
}) |
|
|
|
if(res&&res.list&&res.list.length==1){ |
|
|
|
const setV = {} |
|
|
|
setV['hahaha'] = '' |
|
|
|
setV['hehehe'] = res.list[0]['number'] |
|
|
|
setV['poNumber'] = res.list[0]['number'] |
|
|
|
setV['poLine'] = res.list[0]['lineNumber'] |
|
|
|
setV['receiptNumber'] = '' |
|
|
|
setV['asnNumber'] = '' |
|
|
|
formRef.value.formRef.setValues(setV) |
|
|
|
} |
|
|
|
console.log('采购订单',res) |
|
|
|
} |
|
|
|
// 直接选择采购订单 |
|
|
|
const choosePurchanseList = ()=>{ |
|
|
|
|
|
|
|
if(!formRef.value.formRef.formModel.supplierCode){ |
|
|
|
message.error('请选择供应商') |
|
|
|
return |
|
|
|
} |
|
|
|
searchTableRef.value.open( |
|
|
|
"直接选择采购订单", |
|
|
|
PurchaseMain.allSchemas, |
|
|
|
PurchaseDetailApi.getPurchaseDetailPageWMS, |
|
|
|
"hehehe", |
|
|
|
"hehehe", |
|
|
|
false, |
|
|
|
'tableForm', |
|
|
|
null, |
|
|
|
{ |
|
|
|
supplierCode:formRef.value.formRef.formModel.supplierCode, |
|
|
|
}, |
|
|
|
undefined, |
|
|
|
true, |
|
|
|
PurchaseDetail.allSchemas |
|
|
|
) |
|
|
|
} |
|
|
|
// 选择收货单明细 |
|
|
|
const chooseReceiptList = ()=>{ |
|
|
|
|
|
|
|
if(!formRef.value.formRef.formModel.supplierCode){ |
|
|
|
message.error('请选择供应商') |
|
|
|
return |
|
|
|
} |
|
|
|
searchTableRef.value.open( |
|
|
|
"收货单明细", |
|
|
|
PurchasereturnPurchasereceiptRecordNew.allSchemas, |
|
|
|
PurchasereturnRequestDetailApi.queryPurchasereceiptSpareRecordBySupplier, |
|
|
|
"hahaha", |
|
|
|
"hahaha", |
|
|
|
false, |
|
|
|
'tableForm', |
|
|
|
null, |
|
|
|
{ |
|
|
|
supplierCode:formRef.value.formRef.formModel.supplierCode, |
|
|
|
}, |
|
|
|
undefined, |
|
|
|
false, |
|
|
|
null |
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
const searchTableRef = ref() |
|
|
|
// 选择收货单明细、直接选择采购订单 |
|
|
|
const searchTableSuccess1 = (formField, searchField, val, type, row) => { |
|
|
|
console.log('searchTableSuccess1',formField, searchField, val, type, row) |
|
|
|
|
|
|
|
if(formField=='hahaha'){ |
|
|
|
// 选择收货单明细 |
|
|
|
const setV = {} |
|
|
|
setV['hehehe'] = '' |
|
|
|
setV['hahaha'] = val[0]['receiptNumber'] |
|
|
|
setV['poNumber'] = val[0]['poNumber'] |
|
|
|
setV['poLine'] = val[0]['poLine'] |
|
|
|
setV['receiptNumber'] = val[0]['receiptNumber'] |
|
|
|
setV['asnNumber'] = val[0]['asnNumber'] |
|
|
|
formRef.value.formRef.setValues(setV) |
|
|
|
}else if(formField=='hehehe'){ |
|
|
|
// 直接选择采购订单 |
|
|
|
const setV = {} |
|
|
|
setV['hahaha'] = '' |
|
|
|
setV['hehehe'] = val[0]['number'] |
|
|
|
setV['poNumber'] = val[0]['number'] |
|
|
|
setV['poLine'] = val[0]['lineNumber'] |
|
|
|
setV['receiptNumber'] = '' |
|
|
|
setV['asnNumber'] = '' |
|
|
|
formRef.value.formRef.setValues(setV) |
|
|
|
} |
|
|
|
} |
|
|
|
// 查询页面返回 |
|
|
|
const searchTableSuccess = async (formField, searchField, val, formRef, type, row) => { |
|
|
|
console.log('searchTableSuccess', formField, searchField, val, formRef, type, row) |
|
|
@ -237,115 +390,36 @@ const searchTableSuccess = async (formField, searchField, val, formRef, type, ro |
|
|
|
nextTick(async () => { |
|
|
|
if (type == 'tableForm') { |
|
|
|
// 明细查询页赋值 |
|
|
|
if (formField == 'itemCode') { |
|
|
|
val = val.filter(item=>!tableData.value.find(item1=>item1['itemCode']==item['itemCode']&&item1['batch']==item['batch']&&item1['packingNumber']==item['packingNumber']&&item1['fromLocationCode']==item['locationCode']&&item1['inventoryStatus']==item['inventoryStatus'])) |
|
|
|
|
|
|
|
val.forEach(item=>{ |
|
|
|
let newRow = {...item} |
|
|
|
newRow[formField] = item[searchField] |
|
|
|
newRow['batch'] =item['batch'] |
|
|
|
newRow['itemCode'] =item['itemCode'] |
|
|
|
newRow['uom'] = item['uom'] |
|
|
|
newRow['itemName'] = item['itemName'] |
|
|
|
newRow['inventoryBalance'] = item['qty'] |
|
|
|
newRow['fromLocationCode'] = item['locationCode'] |
|
|
|
newRow['packingNumber'] = item['packingNumber'] |
|
|
|
newRow['inventoryStatus'] = item['inventoryStatus'] |
|
|
|
tableData.value.push(newRow) |
|
|
|
}) |
|
|
|
|
|
|
|
} else if (formField == 'fromLocationCode') { |
|
|
|
row[formField] = val[0][searchField] |
|
|
|
// let params = { |
|
|
|
// itemCode: row.itemCode, |
|
|
|
// batch: row.batch, |
|
|
|
// locationCode:val[0]['code'] |
|
|
|
// } |
|
|
|
// let aa = await BalanceApi.getSumByConditions(params); |
|
|
|
// console.log('23423423',aa); |
|
|
|
// row['inventoryBalance'] = aa//库存余额 |
|
|
|
} else if (formField == 'packingNumber') { |
|
|
|
// row[formField] = val[0][searchField] |
|
|
|
val.forEach((item,index)=>{ |
|
|
|
if(index==0){ |
|
|
|
row[formField] = item[searchField] |
|
|
|
row['inventoryBalance'] = item['qty'] //库存余额 |
|
|
|
}else{ |
|
|
|
let newRow = {...row} |
|
|
|
newRow[formField] = item[searchField] |
|
|
|
row['inventoryBalance'] = item['qty'] //库存余额 |
|
|
|
tableData.value.push(newRow) |
|
|
|
} |
|
|
|
}) |
|
|
|
// row['inventoryBalance'] = val[0]['qty'] //库存余额 |
|
|
|
}else{ |
|
|
|
row[formField] = val[0][searchField] |
|
|
|
} |
|
|
|
row[formField] = val[0][searchField] |
|
|
|
} else { |
|
|
|
const setV = {} |
|
|
|
if (formField == 'purchaseReceiptRecordNumber') { |
|
|
|
// isShowButton.value = false |
|
|
|
setV[formField] = val[0][searchField] |
|
|
|
setV['purchaseReceiptRecordNumber'] = val[0]['number'] |
|
|
|
setV['supplierCode'] = val[0]['supplierCode'] |
|
|
|
setV['asnNumber'] = val[0]['asnNumber'] |
|
|
|
setV['ppNumber'] = val[0]['ppNumber'] |
|
|
|
// 获取子表数据 getBomDisassemble |
|
|
|
// PurchasereceiptRecordDetailApi.getPurchasereceiptRecordDetailList({ |
|
|
|
PurchasereceiptRecordDetailApi.getPurchasereceiptRecordDetailListToRepeat({ |
|
|
|
masterId: val[0]['masterId'] |
|
|
|
}) |
|
|
|
.then((res) => { |
|
|
|
if (res) tableData.value = res |
|
|
|
tableData.value.forEach((item) => { |
|
|
|
item.batch = item.toBatch |
|
|
|
item.packingNumber = item.fromPackingNumber |
|
|
|
item.containerNumber = item.toContainerNumber |
|
|
|
item.receiptQty = item.qty |
|
|
|
item.packUnit = item.packUnit |
|
|
|
item.packQty = item.packQty |
|
|
|
item.toLocationGroupCode = null |
|
|
|
item.toWarehouseCode = null |
|
|
|
item.fromLocationCode = null |
|
|
|
item.toAreaTypes = null |
|
|
|
item.toLocationCode = null |
|
|
|
// item.fromLocationCode = item.fromLocationCode |
|
|
|
// item.fromLocationGroupCode = item.fromLocationGroupCode |
|
|
|
}) |
|
|
|
originTableData.value = JSON.parse(JSON.stringify(tableData.value)) |
|
|
|
|
|
|
|
PurchasereturnRequestMain.allSchemas.formSchema.forEach((item) => { |
|
|
|
if (item.field == 'supplierCode') { |
|
|
|
item.componentProps.disabled = true |
|
|
|
} |
|
|
|
}) |
|
|
|
PurchasereturnRequestDetail.allSchemas.tableFormColumns.map((item) => { |
|
|
|
item.tableForm.disabled = true |
|
|
|
if (item.field == 'remark') { |
|
|
|
item.tableForm.disabled = false |
|
|
|
} |
|
|
|
if (item.field == 'qty') { |
|
|
|
item.tableForm.disabled = false |
|
|
|
} |
|
|
|
// if (item.field == 'returnedQty') { |
|
|
|
// item.tableForm.disabled = false |
|
|
|
// } |
|
|
|
if (item.field == 'reason') { |
|
|
|
item.tableForm.disabled = false |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
.catch((err) => { |
|
|
|
console.log(err) |
|
|
|
setV[formField] = val[0][searchField] |
|
|
|
if(formField=='supplierCode'){ |
|
|
|
setV['supplierName'] = val[0]['shortName'] |
|
|
|
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 = [] |
|
|
|
} |
|
|
|
} |
|
|
|
if (formField == 'supplierCode') { |
|
|
|
// isShowButton.value = true |
|
|
|
setV['supplierCode'] = val[0]['code'] |
|
|
|
// setV['purchaseReceiptRecordNumber'] = '' |
|
|
|
// tableData.value = [] |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
formRef.setValues(setV) |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
@ -728,108 +802,9 @@ PurchasereturnRequestDetail.allSchemas.tableFormColumns.forEach((item) => { |
|
|
|
const tableData = ref([]) |
|
|
|
const originTableData = ref([]) |
|
|
|
|
|
|
|
const searchTableRef = ref() |
|
|
|
// 添加明细 |
|
|
|
const handleAddTable = () => { |
|
|
|
const subTableDFata = originTableData.value.filter( |
|
|
|
(item) => !tableData.value.find((item1) => item1.id == item.id) |
|
|
|
) |
|
|
|
if (subTableDFata.length == 0) { |
|
|
|
message.warning('暂无可选择数据!') |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
const tableObject = { |
|
|
|
// 当前页 |
|
|
|
currentPage: 1, |
|
|
|
// 导出加载中 |
|
|
|
exportLoading: false, |
|
|
|
// 加载中 |
|
|
|
loading: false, |
|
|
|
// 页数 |
|
|
|
pageSize: subTableDFata.length, |
|
|
|
params: null, |
|
|
|
// 排序 |
|
|
|
sort: { |
|
|
|
order: '', // 排序规则 |
|
|
|
prop: '' // 排序字段 |
|
|
|
}, |
|
|
|
// 总条数 |
|
|
|
total: subTableDFata.length, |
|
|
|
// 表格数据 |
|
|
|
tableList: subTableDFata, |
|
|
|
currentRow: null |
|
|
|
} |
|
|
|
|
|
|
|
const tableColumns = PurchasereturnRequestDetail.allSchemas.tableFormColumns |
|
|
|
tableColumns.forEach((item) => { |
|
|
|
item.width = item.table?.width || 150 |
|
|
|
}) |
|
|
|
|
|
|
|
searchTableRef.value.openData('采购收货记录单号', tableObject, { tableColumns }, true) |
|
|
|
// searchTableRef.value.open( |
|
|
|
// ('供应商信息', |
|
|
|
// // _searchTableAllSchemas, |
|
|
|
// // _searchTablePage, // 接口 |
|
|
|
// // formField, |
|
|
|
// // searchField, |
|
|
|
// true,//是否多选 |
|
|
|
// // type, |
|
|
|
// // row, |
|
|
|
// _searchCondition |
|
|
|
// ) |
|
|
|
// ) |
|
|
|
|
|
|
|
// console.log(subTableDFata) |
|
|
|
// const {tableObject, tableMethods } = useTable({ |
|
|
|
// getListApi: getPage.value // 分页接口 |
|
|
|
// }) |
|
|
|
// searchTableRef.value.open( |
|
|
|
// ('供应商信息', |
|
|
|
// // _searchTableAllSchemas, |
|
|
|
// // _searchTablePage, // 接口 |
|
|
|
// // formField, |
|
|
|
// // searchField, |
|
|
|
// true,//是否多选 |
|
|
|
// // type, |
|
|
|
// // row, |
|
|
|
// _searchCondition |
|
|
|
// ) |
|
|
|
// ) |
|
|
|
// tableData.value.push(JSON.parse(JSON.stringify(tableFormKeys))) |
|
|
|
// let purchaseReceiptRecordNumber = formRef.value.formRef.formModel.purchaseReceiptRecordNumber |
|
|
|
// PurchasereturnRequestDetail.allSchemas.tableFormColumns.map((item) => { |
|
|
|
// item.tableForm.disabled = true |
|
|
|
// if (item.field == 'remark') { |
|
|
|
// item.tableForm.disabled = false |
|
|
|
// } |
|
|
|
// if (item.field == 'reason') { |
|
|
|
// item.tableForm.disabled = false |
|
|
|
// } |
|
|
|
// if (item.field == 'qty') { |
|
|
|
// item.tableForm.disabled = false |
|
|
|
// } |
|
|
|
// if(purchaseReceiptRecordNumber == ''){ |
|
|
|
// if (item.field == 'itemCode') { |
|
|
|
// item.tableForm.isInpuFocusShow = true |
|
|
|
// } |
|
|
|
// if(item.field == 'poLine'){ |
|
|
|
// item.tableForm.isInpuFocusShow = false |
|
|
|
// } |
|
|
|
// }else{ |
|
|
|
// if (item.field == 'itemCode') { |
|
|
|
// item.tableForm.isInpuFocusShow = false |
|
|
|
// } |
|
|
|
// if(item.field == 'poLine'){ |
|
|
|
// item.tableForm.isInpuFocusShow = true |
|
|
|
// } |
|
|
|
// } |
|
|
|
// }) |
|
|
|
} |
|
|
|
const searchTableSuccess1 = (formField, searchField, val, formRef, type, row) => { |
|
|
|
console.log(val) |
|
|
|
tableData.value = [...tableData.value, ...val] |
|
|
|
} |
|
|
|
// 删除明细 |
|
|
|
const handleDeleteTable = (item, index, formRef) => { |
|
|
|
let itemIndex = tableData.value.indexOf(item) |
|
|
@ -869,6 +844,9 @@ const submitForm = async (formType, submitData) => { |
|
|
|
if (data.masterId) { |
|
|
|
data.id = data.masterId |
|
|
|
} |
|
|
|
tableData.value.forEach(item=>{ |
|
|
|
item['fromLocationCode'] = data['locationCode'] |
|
|
|
}) |
|
|
|
console.log('submitForm', tableData.value) |
|
|
|
// if(tableData.value.find(item=>Number(item.returnedQty)>Number(item.receiptQty))){ |
|
|
|
// message.warning("退货数量不能大于收获数量") |
|
|
|