|
|
@ -54,18 +54,20 @@ |
|
|
|
<BasicForm |
|
|
|
ref="formRef" |
|
|
|
@success="getList" |
|
|
|
:rules="PurchasereturnRequestMainRules" |
|
|
|
:formAllSchemas="PurchasereturnRequestMain.allSchemas" |
|
|
|
:tableAllSchemas="PurchasereturnRequestDetail.allSchemas" |
|
|
|
:tableFormRules="PurchasereturnRequestDetailRules" |
|
|
|
:rules="PurchasereturnRequestMainRulesNew" |
|
|
|
:formAllSchemas="PurchasereturnRequestMainNew.allSchemas" |
|
|
|
:tableAllSchemas="PurchasereturnRequestDetailNew.allSchemas" |
|
|
|
:tableFormRules="PurchasereturnRequestDetailRulesNew" |
|
|
|
:tableData="tableData" |
|
|
|
:apiUpdate="PurchasereturnRequestMainApi.updatePurchasereturnRequestMain" |
|
|
|
:apiCreate="PurchasereturnRequestMainApi.createPurchasereturnRequestMain" |
|
|
|
:isBusiness="true" |
|
|
|
:isShowButton="isShowButton" |
|
|
|
:isShowButton="false" |
|
|
|
@handleAddTable="handleAddTable" |
|
|
|
@handleDeleteTable="handleDeleteTable" |
|
|
|
:isShowReduceButtonSelection="true" |
|
|
|
:isShowReduceButtonSelection="false" |
|
|
|
:isShowReduceButton="false" |
|
|
|
:updateTypeEdiltSubList="true" |
|
|
|
@tableSelectionDelete="tableSelectionDelete" |
|
|
|
@searchTableSuccess="searchTableSuccess" |
|
|
|
@submitForm="submitForm" |
|
|
@ -73,7 +75,7 @@ |
|
|
|
@onChange="onChangeForm" |
|
|
|
> |
|
|
|
<template #hahaha> |
|
|
|
<el-button style="margin-left:90px;width:100%" type="primary" @click="chooseReceiptList">选择收货单明细</el-button> |
|
|
|
<el-button style="width:100%" type="primary" @click="chooseReceiptList">选择收货单明细</el-button> |
|
|
|
|
|
|
|
</template> |
|
|
|
<template #hehehe> |
|
|
@ -140,15 +142,19 @@ |
|
|
|
<script setup lang="ts"> |
|
|
|
import download from '@/utils/download' |
|
|
|
import { CACHE_KEY, useCache } from '@/hooks/web/useCache' |
|
|
|
import { |
|
|
|
PurchasereturnRequestMainNew, |
|
|
|
PurchasereturnRequestMainRulesNew, |
|
|
|
PurchasereturnRequestDetailNew, |
|
|
|
PurchasereturnRequestDetailRulesNew, |
|
|
|
PurchasereturnPurchasereceiptRecordNew |
|
|
|
} from './purchasereturnRequestMainNew.data' |
|
|
|
import { |
|
|
|
PurchasereturnRequestMain, |
|
|
|
PurchasereturnRequestMainRules, |
|
|
|
PurchasereturnRequestDetail, |
|
|
|
PurchasereturnRequestDetailRules, |
|
|
|
PurchasereReturnRequestDetailLabel, |
|
|
|
PurchasereceiptRecordMain1, |
|
|
|
PurchasereturnPurchasereceiptRecord |
|
|
|
} from './purchasereturnRequestMain.data' |
|
|
|
PurchasereReturnRequestDetailLabel |
|
|
|
} from '../purchasereturnRequestMain/purchasereturnRequestMain.data' |
|
|
|
import * as PurchasereturnRequestMainApi from '@/api/wms/purchasereturnRequestMain' |
|
|
|
import * as PurchasereturnRequestDetailApi from '@/api/wms/purchasereturnRequestDetail' |
|
|
|
import * as PurchasereceiptRecordDetailApi from '@/api/wms/purchasereceiptRecordDetail' |
|
|
@ -160,8 +166,6 @@ import * as BalanceApi from '@/api/wms/balance' |
|
|
|
import { async } from '@antv/x6/lib/registry/marker/async' |
|
|
|
import { getJmreportBaseUrl } from '@/utils/systemParam' |
|
|
|
import { formatDate } from '@/utils/formatTime' |
|
|
|
import * as ItembasicApi from '@/api/wms/itembasic' |
|
|
|
import { Itembasic } from '@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data' |
|
|
|
// 采购退货申请 |
|
|
|
defineOptions({ name: 'PurchasereturnRequestMainNew' }) |
|
|
|
|
|
|
@ -182,36 +186,27 @@ const isShowButton = ref(true) |
|
|
|
const updataTableColumns = (val) => { |
|
|
|
tableColumns.value = val |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const onChangeForm = (field, cur, formRef)=>{ |
|
|
|
console.log('onChangeForm',field, cur, formRef) |
|
|
|
if(field=='supplierCode'){ |
|
|
|
//供应商 |
|
|
|
PurchasereturnRequestMain.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) |
|
|
|
} |
|
|
|
}) |
|
|
|
}else if(field == 'locationCode'){ |
|
|
|
// 退货库位 获取明细列表 |
|
|
|
tableData.value = [{ |
|
|
|
'batch':'20240908', |
|
|
|
'status':'合格', |
|
|
|
'inventoryBalance':300, |
|
|
|
'qty':1, |
|
|
|
'reason':'200', |
|
|
|
'remark':'', |
|
|
|
}] |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
const onEnter = async (field, value) => { |
|
|
|
console.log(field, value) |
|
|
|
|
|
|
|
if ('supplierCode' == field) { |
|
|
|
//供应商代码 |
|
|
|
formRef.value.opensearchTable( |
|
|
|
'purchaseReceiptRecordNumber', |
|
|
|
'number', |
|
|
|
'采购收货记录', |
|
|
|
PurchasereceiptRecordMain1.allSchemas, |
|
|
|
PurchasereceiptRecordDetailApi.getPurchasereceiptRecordDetailPageReturn, |
|
|
|
[ |
|
|
|
{ |
|
|
|
key: 'supplierCode', |
|
|
|
value: 'supplierCode', |
|
|
|
isMainValue: true |
|
|
|
} |
|
|
|
] |
|
|
|
) |
|
|
|
} else if ('purchaseReceiptRecordNumber' == field) { |
|
|
|
//采购收货记录 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 生成标签 |
|
|
@ -256,7 +251,6 @@ const searchTableSuccessLabel = (formField, searchField, val, formRef, type, row |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
// 查询页面返回 |
|
|
|
const searchTableSuccess = async (formField, searchField, val, formRef, type, row) => { |
|
|
|
console.log('searchTableSuccess', formField, searchField, val, formRef, type, row) |
|
|
@ -275,8 +269,17 @@ const searchTableSuccess = async (formField, searchField, val, formRef, type, ro |
|
|
|
}) |
|
|
|
console.log('物料供应商',res) |
|
|
|
if(res&&res.length>0){ |
|
|
|
PurchasereturnRequestMain.allSchemas.formSchema.forEach(item=>{ |
|
|
|
PurchasereturnRequestMainNew.allSchemas.formSchema.forEach(item=>{ |
|
|
|
if(item.field == 'supplierCode'){ |
|
|
|
//重置 |
|
|
|
setV['supplierCode'] = '' |
|
|
|
setV['supplierName'] = '' |
|
|
|
setV['hahaha'] = '' |
|
|
|
setV['poNumber'] = '' |
|
|
|
setV['poLine'] = '' |
|
|
|
setV['receiptNumber'] = '' |
|
|
|
setV['asnNumber'] = '' |
|
|
|
tableData.value = [] |
|
|
|
item.componentProps.options = res |
|
|
|
} |
|
|
|
}) |
|
|
@ -291,8 +294,63 @@ const searchTableSuccess = async (formField, searchField, val, formRef, type, ro |
|
|
|
const searchTableSuccessDetail = (formField, searchField, val, formRef) => { |
|
|
|
nextTick(() => { |
|
|
|
const setV = {} |
|
|
|
setV[formField] = val[0][searchField] |
|
|
|
if (formField == 'poLine' || formField == 'itemCode') { |
|
|
|
console.log(val) |
|
|
|
setV['poLine'] = val[0]['poLine'] |
|
|
|
setV['poNumber'] = val[0]['poNumber'] |
|
|
|
setV['itemCode'] = val[0]['itemCode'] |
|
|
|
setV['itemName'] = val[0]['itemName'] |
|
|
|
setV['itemDesc1'] = val[0]['itemDesc1'] |
|
|
|
setV['itemDesc2'] = val[0]['itemDesc2'] |
|
|
|
setV['batch'] = val[0]['toBatch'] |
|
|
|
setV['altBatch'] = val[0]['altBatch'] |
|
|
|
setV['containerNumber'] = val[0]['toContainerNumber'] |
|
|
|
setV['receiptQty'] = val[0]['qty'] |
|
|
|
setV['qty'] = val[0]['qty'] |
|
|
|
setV['uom'] = val[0]['uom'] |
|
|
|
setV['supplierQty'] = val[0]['supplierQty'] |
|
|
|
setV['supplierUom'] = val[0]['supplierUom'] |
|
|
|
setV['inventoryStatus'] = val[0]['inventoryStatus'] |
|
|
|
// setV['fromLocationCode'] = val[0]['toLocationCode'] |
|
|
|
// setV['toLocationCode'] = val[0]['toLocationCode'] |
|
|
|
setV['fromLocationGroupCode'] = val[0]['locationGroupCode'] |
|
|
|
setV['toLocationGroupCode'] = null |
|
|
|
setV['toWarehouseCode'] = null |
|
|
|
setV['toAreaTypes'] = null |
|
|
|
setV['fromAreaCode'] = val[0]['areaCode'] |
|
|
|
setV['toAreaCode'] = val[0]['toAreaCode'] |
|
|
|
setV['fromQwnerCode'] = val[0]['fromQwnerCode'] |
|
|
|
setV['toOwnerCode'] = val[0]['toOwnerCode'] |
|
|
|
setV['arriveDate'] = val[0]['arriveDate'] |
|
|
|
setV['produceDate'] = val[0]['produceDate'] |
|
|
|
setV['expireDate'] = val[0]['expireDate'] |
|
|
|
setV['convertRate'] = val[0]['convertRate'] |
|
|
|
setV['visualInspectResult'] = val[0]['visualInspectResult'] |
|
|
|
setV['visualInspectPhotos'] = val[0]['visualInspectPhotos'] |
|
|
|
setV['failedReason'] = val[0]['failedReason'] |
|
|
|
setV['singlePrice'] = val[0]['singlePrice'] |
|
|
|
setV['amount'] = val[0]['amount'] |
|
|
|
setV['projectCode'] = val[0]['projectCode'] |
|
|
|
// setV['packingNumber'] = val[0]['packingNumber'] |
|
|
|
// setV['inventoryBalance'] = val[0]['qty'] |
|
|
|
|
|
|
|
if (formField == 'itemCode') { |
|
|
|
setV['batch'] = val[0]['toBatch'] |
|
|
|
setV['containerNumber'] = val[0]['toContainerNumber'] |
|
|
|
setV['containerNumber'] = val[0]['containerNumber'] |
|
|
|
setV['containerNumber'] = val[0]['containerNumber'] |
|
|
|
// setV['fromLocationCode'] = val[0]['fromLocationCode'] |
|
|
|
// setV['toLocationCode'] = val[0]['toLocationCode'] |
|
|
|
} |
|
|
|
} else if (formField == 'packingNumber'){ |
|
|
|
setV[formField] = val[0][searchField] |
|
|
|
setV['inventoryBalance'] = val[0]['qty'] |
|
|
|
setV['batch'] = val[0]['batch'] |
|
|
|
setV['fromLocationCode'] = val[0]['locationCode'] |
|
|
|
} |
|
|
|
else { |
|
|
|
setV[formField] = val[0][searchField] |
|
|
|
} |
|
|
|
formRef.setValues(setV) |
|
|
|
}) |
|
|
|
} |
|
|
@ -449,10 +507,37 @@ const buttonTableClick = async (val, row) => { |
|
|
|
/** 添加/修改操作 */ |
|
|
|
const formRef = ref() |
|
|
|
const openForm = async (type: string, row?: number) => { |
|
|
|
|
|
|
|
isShowButton.value = true |
|
|
|
if (type == 'create') { |
|
|
|
originTableData.value = [] // 重置明细数据 |
|
|
|
tableData.value = [] // 重置明细数据 |
|
|
|
isShowButton.value = true |
|
|
|
PurchasereturnRequestMain.allSchemas.formSchema.forEach((item) => { |
|
|
|
if (item.field == 'supplierCode') { |
|
|
|
item.componentProps.disabled = true |
|
|
|
item.componentProps.isSearchList = true |
|
|
|
} |
|
|
|
if (item.field == 'asnNumber') { |
|
|
|
item.componentProps.disabled = true |
|
|
|
item.componentProps.isSearchList = true |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
if (type == 'update') { |
|
|
|
PurchasereturnRequestMain.allSchemas.formSchema.forEach((item) => { |
|
|
|
if (item.field == 'supplierCode') { |
|
|
|
item.componentProps.disabled = true |
|
|
|
item.componentProps.isSearchList = false |
|
|
|
} |
|
|
|
if (item.field == 'asnNumber') { |
|
|
|
item.componentProps.disabled = true |
|
|
|
item.componentProps.isSearchList = false |
|
|
|
} |
|
|
|
}) |
|
|
|
tableData.value = [{ |
|
|
|
|
|
|
|
}] |
|
|
|
} |
|
|
|
formRef.value.open(type, row) |
|
|
|
} |
|
|
|
|
|
|
@ -590,7 +675,132 @@ 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 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) |
|
|
|
} |
|
|
|
}) |
|
|
|
}else if(field == 'locationCode'){ |
|
|
|
// 退货库位 获取明细列表 |
|
|
|
let subList = await PurchasereturnRequestDetailApi.getBalancePurchaseReceiptReturn({ |
|
|
|
itemCode:formRef.value.formModel.itemCode, |
|
|
|
fromLocationCode:formRef.value.formModel.locationCode |
|
|
|
}) |
|
|
|
|
|
|
|
console.log('subList',subList) |
|
|
|
if(subList&&subList.length>0){ |
|
|
|
tableData.value = subList.map(item=>({ |
|
|
|
'batch':item['batch'], |
|
|
|
'status':item['inventoryStatus'], |
|
|
|
'inventoryBalance':item['qty'], |
|
|
|
'qty':1, |
|
|
|
'reason_type':'', |
|
|
|
'reason':'' |
|
|
|
})) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
// 选择收货单明细 |
|
|
|
const chooseReceiptList = ()=>{ |
|
|
@ -604,7 +814,7 @@ const chooseReceiptList = ()=>{ |
|
|
|
} |
|
|
|
searchTableRef.value.open( |
|
|
|
"收货单明细", |
|
|
|
PurchasereturnPurchasereceiptRecord.allSchemas, |
|
|
|
PurchasereturnPurchasereceiptRecordNew.allSchemas, |
|
|
|
PurchasereturnRequestDetailApi.getPurchasereturnPurchasereceiptRecordByItemCode, |
|
|
|
"hahaha", |
|
|
|
"hahaha", |
|
|
@ -628,6 +838,7 @@ const searchTableSuccess1 = (formField, searchField, val, type, row) => { |
|
|
|
if(formField=='hahaha'){ |
|
|
|
// 选择收货单明细 |
|
|
|
const setV = {} |
|
|
|
setV['hahaha'] = val[0]['asnNumber'] |
|
|
|
setV['poNumber'] = val[0]['poNumber'] |
|
|
|
setV['poLine'] = val[0]['poLine'] |
|
|
|
setV['receiptNumber'] = val[0]['receiptNumber'] |
|
|
@ -679,26 +890,14 @@ const submitForm = async (formType, submitData) => { |
|
|
|
// message.warning("退货数量不能大于收获数量") |
|
|
|
// return; |
|
|
|
// } |
|
|
|
if (tableData.value.find((item) => Number(item.qty) > Number(item.inventoryBalance))) { |
|
|
|
if (tableData.value.find((item) => item['qty']> item['inventoryBalance'])) { |
|
|
|
message.warning('退货数量不能大于库存余额') |
|
|
|
return |
|
|
|
} |
|
|
|
data.subList = tableData.value // 拼接子表数据参数 |
|
|
|
data.subList = tableData.value.filter(item=>item['qty']>0) // 拼接子表数据参数 |
|
|
|
formRef.value.formLoading = true |
|
|
|
try { |
|
|
|
if (formType === 'create') { |
|
|
|
let flag = false |
|
|
|
data.subList.forEach((item) => { |
|
|
|
if (item.qty == 0) { |
|
|
|
message.warning('数量不能为0') |
|
|
|
flag = true |
|
|
|
return |
|
|
|
} |
|
|
|
}) |
|
|
|
if (flag) { |
|
|
|
formRef.value.formLoading = false |
|
|
|
return |
|
|
|
} |
|
|
|
data.returnSourceType='1' |
|
|
|
await PurchasereturnRequestMainApi.createPurchasereturnRequestMain(data) |
|
|
|
message.success(t('common.createSuccess')) |
|
|
|