Browse Source

HL-6157WMS维修备件退货,按照维修备件收货的样式做退货

hella_online_20241017
yufei_wang 2 months ago
parent
commit
6eb682239c
  1. 17
      src/api/wms/purchasereturnRequestDetail/index.ts
  2. 390
      src/views/wms/purchasereceiptManage/purchasereturnspare/purchasereturnRequestSpareMain/index.vue
  3. 1
      src/views/wms/purchasereceiptManage/sparereceipt/sparereceiptRequestMain/index.vue

17
src/api/wms/purchasereturnRequestDetail/index.ts

@ -112,4 +112,21 @@ export const exportPurchasereturnRequestDetail = async (params) => {
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/wms/purchasereturn-request-detail/get-import-template' })
}
// 选择收货单明细
// 查询采购退货申请子列表
export const queryPurchasereceiptSpareRecordBySupplier = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/wms/purchasereceipt-record-detail/queryPurchasereceiptSpareRecordBySupplier', data })
} else {
return await request.get({ url: `/wms/purchasereceipt-record-detail/queryPurchasereceiptSpareRecordBySupplier`, params })
}
}
// 维修退货申请子表数据
export const queryBalancePurchaseReceiptSpareReturn = async (params) => {
return await request.get({ url: `/wms/purchasereturn-request-main/queryBalancePurchaseReceiptSpareReturn`, params })
}

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

@ -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("退")

1
src/views/wms/purchasereceiptManage/sparereceipt/sparereceiptRequestMain/index.vue

@ -137,6 +137,7 @@ import { getJmreportBaseUrl } from '@/utils/systemParam'
import { usePageLoading } from '@/hooks/web/usePageLoading'
const { loadStart, loadDone } = usePageLoading()
//
//
defineOptions({ name: 'PurchasereceiptRequestMain' })
const message = useMessage() //

Loading…
Cancel
Save