|
@ -94,7 +94,8 @@ import { formatDate } from '@/utils/formatTime' |
|
|
import dayjs from 'dayjs' |
|
|
import dayjs from 'dayjs' |
|
|
import { usePageLoading } from '@/hooks/web/usePageLoading' |
|
|
import { usePageLoading } from '@/hooks/web/usePageLoading' |
|
|
const { loadStart, loadDone } = usePageLoading() |
|
|
const { loadStart, loadDone } = usePageLoading() |
|
|
// 库存转移申请 |
|
|
// 物料隔离申请 |
|
|
|
|
|
// 只有物料隔离申请在使用的 |
|
|
defineOptions({ name: 'InventorymoveRequestMain' }) |
|
|
defineOptions({ name: 'InventorymoveRequestMain' }) |
|
|
|
|
|
|
|
|
const message = useMessage() // 消息弹窗 |
|
|
const message = useMessage() // 消息弹窗 |
|
@ -115,11 +116,6 @@ const { tableObject, tableMethods } = useTable({ |
|
|
getListApi: InventorymoveRequestDetailApi.getInventorymoveRequestDetailPage // 分页接口 |
|
|
getListApi: InventorymoveRequestDetailApi.getInventorymoveRequestDetailPage // 分页接口 |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
// 判断 路由名称 进行条件过滤 |
|
|
|
|
|
/** |
|
|
|
|
|
* OktoholdRequestMain 合格转隔离 |
|
|
|
|
|
*/ |
|
|
|
|
|
if ( routeName.value == 'OktoholdRequestMain') { |
|
|
|
|
|
tableObject.params = { |
|
|
tableObject.params = { |
|
|
// fromInventoryStatus: 'OK', |
|
|
// fromInventoryStatus: 'OK', |
|
|
// toInventoryStatus:'HOLD', |
|
|
// toInventoryStatus:'HOLD', |
|
@ -129,67 +125,6 @@ if ( routeName.value == 'OktoholdRequestMain') { |
|
|
// toInventoryStatus.value = "HOLD" |
|
|
// toInventoryStatus.value = "HOLD" |
|
|
businessType.value = 'OkToHold' |
|
|
businessType.value = 'OkToHold' |
|
|
importFileName.value = '物料转隔离申请' |
|
|
importFileName.value = '物料转隔离申请' |
|
|
} |
|
|
|
|
|
else if ( routeName.value == 'NoktoholdRequestMain') { |
|
|
|
|
|
tableObject.params = { |
|
|
|
|
|
// fromInventoryStatus: 'NOK', |
|
|
|
|
|
// toInventoryStatus:'HOLD', |
|
|
|
|
|
businessType :'NokToHold' |
|
|
|
|
|
} |
|
|
|
|
|
// fromInventoryStatus.value = 'NOK' |
|
|
|
|
|
// toInventoryStatus.value = "HOLD" |
|
|
|
|
|
businessType.value = 'NokToHold' |
|
|
|
|
|
importFileName.value = '不合格转隔离申请' |
|
|
|
|
|
} |
|
|
|
|
|
else if ( routeName.value == 'HoldtookRequestMain') { |
|
|
|
|
|
tableObject.params = { |
|
|
|
|
|
// fromInventoryStatus: 'HOLD', |
|
|
|
|
|
// toInventoryStatus:'OK', |
|
|
|
|
|
businessType :'HoldToOk' |
|
|
|
|
|
} |
|
|
|
|
|
// fromInventoryStatus.value = 'HOLD' |
|
|
|
|
|
// toInventoryStatus.value = "OK" |
|
|
|
|
|
businessType.value = 'HoldToOk' |
|
|
|
|
|
importFileName.value = '隔离转合格申请' |
|
|
|
|
|
} else if ( routeName.value == 'HoldtoscrapRequestMain') { |
|
|
|
|
|
tableObject.params = { |
|
|
|
|
|
// fromInventoryStatus: 'HOLD', |
|
|
|
|
|
// toInventoryStatus:'SCRAP', |
|
|
|
|
|
businessType:'HoldToScrap' |
|
|
|
|
|
} |
|
|
|
|
|
// fromInventoryStatus.value = 'HOLD' |
|
|
|
|
|
// toInventoryStatus.value = "SCRAP" |
|
|
|
|
|
businessType.value = 'HoldToScrap' |
|
|
|
|
|
importFileName.value = '隔离转报废申请' |
|
|
|
|
|
} else if ( routeName.value == 'OktoscrapRequestMain') { |
|
|
|
|
|
tableObject.params = { |
|
|
|
|
|
// fromInventoryStatus: 'OK', |
|
|
|
|
|
// toInventoryStatus:'SCRAP', |
|
|
|
|
|
businessType :'OkToScrap' |
|
|
|
|
|
} |
|
|
|
|
|
// fromInventoryStatus.value = 'OK' |
|
|
|
|
|
// toInventoryStatus.value = "SCRAP" |
|
|
|
|
|
businessType.value = 'OkToScrap' |
|
|
|
|
|
importFileName.value = '合格转报废申请' |
|
|
|
|
|
} |
|
|
|
|
|
else if ( routeName.value == 'ScraptoholdRequestMain') { |
|
|
|
|
|
tableObject.params = { |
|
|
|
|
|
// fromInventoryStatus: 'SCRAP', |
|
|
|
|
|
// toInventoryStatus:'HOLD', |
|
|
|
|
|
businessType :'ScrapToHold' |
|
|
|
|
|
} |
|
|
|
|
|
// fromInventoryStatus.value = 'SCRAP' |
|
|
|
|
|
// toInventoryStatus.value = "HOLD" |
|
|
|
|
|
businessType.value = 'ScrapToHold' |
|
|
|
|
|
importFileName.value = '报废转隔离申请' |
|
|
|
|
|
} else { |
|
|
|
|
|
tableObject.params = { |
|
|
|
|
|
businessType :'Move' |
|
|
|
|
|
} |
|
|
|
|
|
businessType.value = 'Move' |
|
|
|
|
|
importFileName.value = '库存移动申请' |
|
|
|
|
|
} |
|
|
|
|
|
console.log(99 , businessType.value) |
|
|
|
|
|
|
|
|
|
|
|
InventorymoveRequestMain.allSchemas.tableFormColumns.map(item =>{ |
|
|
InventorymoveRequestMain.allSchemas.tableFormColumns.map(item =>{ |
|
|
if(item.field == 'fromWarehouseCode') { |
|
|
if(item.field == 'fromWarehouseCode') { |
|
@ -349,27 +284,20 @@ const updataTableColumns = (val) => { |
|
|
// 物料隔离-获取到库位默认值 |
|
|
// 物料隔离-获取到库位默认值 |
|
|
const getDefaultToLocationCode = async ()=>{ |
|
|
const getDefaultToLocationCode = async ()=>{ |
|
|
let searchCondition = [] |
|
|
let searchCondition = [] |
|
|
InventorymoveRequestDetail.allSchemas.tableFormColumns.map(item => { |
|
|
InventorymoveRequestMain.allSchemas.formSchema.map(item => { |
|
|
if(item.field == "toLocationCode"){ |
|
|
if(item.field == "toLocationCode"){ |
|
|
searchCondition = item.tableForm.searchCondition |
|
|
searchCondition = item.componentProps.searchCondition |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
let params = {} |
|
|
let params = {} |
|
|
searchCondition.forEach(item=>{ |
|
|
searchCondition.forEach(item=>{ |
|
|
if(item['isMainValue']){ |
|
|
|
|
|
params[item['key']] = formRef.value.formRef.formModel[item['value']] |
|
|
|
|
|
}else{ |
|
|
|
|
|
params[item['key']] = item['value'] |
|
|
params[item['key']] = item['value'] |
|
|
} |
|
|
|
|
|
}) |
|
|
}) |
|
|
|
|
|
console.log('params',params) |
|
|
let res = await LocationApi.selectBusinessTypeToLocation(params) |
|
|
let res = await LocationApi.selectBusinessTypeToLocation(params) |
|
|
console.log('res',res) |
|
|
console.log('获取到库位默认值',res) |
|
|
if(res&&res.list.length>0){ |
|
|
if(res&&res.list.length>0){ |
|
|
tableData.value.forEach(item=>{ |
|
|
formRef.value.formRef.formModel["toLocationCode"] = res.list[0]['code'] |
|
|
if(!item['toLocationCode']){ |
|
|
|
|
|
item['toLocationCode'] = res.list[0]['code'] |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
// 查询页面返回 |
|
|
// 查询页面返回 |
|
@ -389,26 +317,9 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => |
|
|
newRow['fromLocationCode'] = item['locationCode'] |
|
|
newRow['fromLocationCode'] = item['locationCode'] |
|
|
newRow['uom'] = item['uom'] |
|
|
newRow['uom'] = item['uom'] |
|
|
newRow['qty'] = item['qty'] |
|
|
newRow['qty'] = item['qty'] |
|
|
if(routeName.value == 'OktoholdRequestMain'){ |
|
|
newRow['toInventoryStatus'] = "HOLD" // 物料隔离申请 |
|
|
newRow['toInventoryStatus'] = "HOLD" |
|
|
|
|
|
}else if(routeName.value == 'NoktoholdRequestMain'){ |
|
|
|
|
|
newRow['toInventoryStatus'] = "HOLD" |
|
|
|
|
|
}else if ( routeName.value == 'HoldtookRequestMain') { |
|
|
|
|
|
newRow['toInventoryStatus'] = "OK" |
|
|
|
|
|
}else if ( routeName.value == 'HoldtoscrapRequestMain') { |
|
|
|
|
|
newRow['toInventoryStatus'] = "SCRAP" |
|
|
|
|
|
}else if ( routeName.value == 'OktoscrapRequestMain') { |
|
|
|
|
|
newRow['toInventoryStatus'] = "SCRAP" |
|
|
|
|
|
}else if ( routeName.value == 'ScraptoholdRequestMain') { |
|
|
|
|
|
newRow['toInventoryStatus'] = "HOLD" |
|
|
|
|
|
}else{ |
|
|
|
|
|
newRow['toInventoryStatus'] = item['inventoryStatus'] |
|
|
|
|
|
} |
|
|
|
|
|
tableData.value.push(newRow) |
|
|
tableData.value.push(newRow) |
|
|
}) |
|
|
}) |
|
|
if(routeName.value == 'OktoholdRequestMain'){ |
|
|
|
|
|
getDefaultToLocationCode() |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
} else { |
|
|
row[formField] = val[0][searchField] |
|
|
row[formField] = val[0][searchField] |
|
|
} |
|
|
} |
|
@ -446,21 +357,8 @@ const searchTableSuccessDetail = (formField, searchField, val, formRef ) => { |
|
|
setV['fromInventoryStatus'] = val[0]['inventoryStatus'] |
|
|
setV['fromInventoryStatus'] = val[0]['inventoryStatus'] |
|
|
setV['fromLocationCode'] = val[0]['locationCode'] |
|
|
setV['fromLocationCode'] = val[0]['locationCode'] |
|
|
setV['uom'] = val[0]['uom'] |
|
|
setV['uom'] = val[0]['uom'] |
|
|
if(routeName.value == 'OktoholdRequestMain'){ |
|
|
|
|
|
setV['toInventoryStatus'] = "HOLD" |
|
|
setV['toInventoryStatus'] = "HOLD" |
|
|
}else if(routeName.value == 'NoktoholdRequestMain'){ |
|
|
|
|
|
setV['toInventoryStatus'] = "HOLD" |
|
|
|
|
|
}else if ( routeName.value == 'HoldtookRequestMain') { |
|
|
|
|
|
setV['toInventoryStatus'] = "OK" |
|
|
|
|
|
}else if ( routeName.value == 'HoldtoscrapRequestMain') { |
|
|
|
|
|
setV['toInventoryStatus'] = "SCRAP" |
|
|
|
|
|
}else if ( routeName.value == 'OktoscrapRequestMain') { |
|
|
|
|
|
setV['toInventoryStatus'] = "SCRAP" |
|
|
|
|
|
}else if ( routeName.value == 'ScraptoholdRequestMain') { |
|
|
|
|
|
setV['toInventoryStatus'] = "HOLD" |
|
|
|
|
|
}else{ |
|
|
|
|
|
setV['toInventoryStatus'] = val[0]['inventoryStatus'] |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
} else { |
|
|
setV[formField] = val[0][searchField] |
|
|
setV[formField] = val[0][searchField] |
|
|
} |
|
|
} |
|
@ -638,6 +536,8 @@ const openForm =async (type: string, row?: number) => { |
|
|
} |
|
|
} |
|
|
tableData.value = [] // 重置明细数据 |
|
|
tableData.value = [] // 重置明细数据 |
|
|
formRef.value.open(type, row) |
|
|
formRef.value.open(type, row) |
|
|
|
|
|
getDefaultToLocationCode() |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -695,27 +595,9 @@ const handleExport = async () => { |
|
|
// 发起导出 |
|
|
// 发起导出 |
|
|
loadStart() |
|
|
loadStart() |
|
|
const excelTitle = ref(route.meta.title) |
|
|
const excelTitle = ref(route.meta.title) |
|
|
if(routeName.value == 'OktoholdRequestMain'){ |
|
|
|
|
|
const data = await InventorymoveRequestMainApi.exportOkToHoldRequestMain(tableObject.params) |
|
|
const data = await InventorymoveRequestMainApi.exportOkToHoldRequestMain(tableObject.params) |
|
|
download.excel(data, `【${excelTitle.value}】【${formatDate(new Date())}】.xlsx`) |
|
|
download.excel(data, `【${excelTitle.value}】【${formatDate(new Date())}】.xlsx`) |
|
|
}else if ( routeName.value == 'HoldtookRequestMain') { |
|
|
|
|
|
const data = await InventorymoveRequestMainApi.exportHoldToOkRequestMain(tableObject.params) |
|
|
|
|
|
download.excel(data, `【${excelTitle.value}】【${formatDate(new Date())}】.xlsx`) |
|
|
|
|
|
}else if ( routeName.value == 'HoldtoscrapRequestMain') { |
|
|
|
|
|
const data = await InventorymoveRequestMainApi.exportHoldToScrapRequestMain(tableObject.params) |
|
|
|
|
|
download.excel(data, `【${excelTitle.value}】【${formatDate(new Date())}】.xlsx`) |
|
|
|
|
|
}else if ( routeName.value == 'OktoscrapRequestMain') { |
|
|
|
|
|
const data = await InventorymoveRequestMainApi.exportOkToScrapRequestMain(tableObject.params) |
|
|
|
|
|
download.excel(data, `【${excelTitle.value}】【${formatDate(new Date())}】.xlsx`) |
|
|
|
|
|
} |
|
|
|
|
|
// else if ( routeName.value == 'ScraptoholdRequestMain') { |
|
|
|
|
|
// const data = await InventorymoveRequestMainApi.exportScrapToHoldRequestMain(tableObject.params) |
|
|
|
|
|
// download.excel(data, '报废转隔离申请主.xlsx') |
|
|
|
|
|
// } |
|
|
|
|
|
else{ |
|
|
|
|
|
const data = await InventorymoveRequestMainApi.exportInventorymoveRequestMain(tableObject.params) |
|
|
|
|
|
download.excel(data, `【${excelTitle.value}】【${formatDate(new Date())}】.xlsx`) |
|
|
|
|
|
} |
|
|
|
|
|
} catch { |
|
|
} catch { |
|
|
} finally { |
|
|
} finally { |
|
|
loadDone() |
|
|
loadDone() |
|
@ -754,7 +636,8 @@ const submitForm = async (formType, submitData) => { |
|
|
if(data.masterId){ |
|
|
if(data.masterId){ |
|
|
data.id = data.masterId |
|
|
data.id = data.masterId |
|
|
} |
|
|
} |
|
|
let findLocation = tableData.value.find(item=>item.fromLocationCode&&item.toLocationCode&&item.fromLocationCode==item.toLocationCode) |
|
|
let toLocationCode = data['toLocationCode'] // 到库位 |
|
|
|
|
|
let findLocation = tableData.value.find(item=>item.fromLocationCode&&toLocationCode&&item.fromLocationCode==toLocationCode) |
|
|
if(findLocation){ |
|
|
if(findLocation){ |
|
|
message.warning('从库位和到库位不能相同') |
|
|
message.warning('从库位和到库位不能相同') |
|
|
return |
|
|
return |
|
@ -762,6 +645,7 @@ const submitForm = async (formType, submitData) => { |
|
|
data.subList = tableData.value // 拼接子表数据参数 |
|
|
data.subList = tableData.value // 拼接子表数据参数 |
|
|
let isExist = false |
|
|
let isExist = false |
|
|
tableData.value.forEach(item => { |
|
|
tableData.value.forEach(item => { |
|
|
|
|
|
item['toLocationCode'] = toLocationCode |
|
|
let rs = tableData.value.filter(filterItem => (filterItem.fromPackingNumber&&filterItem.fromPackingNumber == item.fromPackingNumber) ) |
|
|
let rs = tableData.value.filter(filterItem => (filterItem.fromPackingNumber&&filterItem.fromPackingNumber == item.fromPackingNumber) ) |
|
|
console.log(rs,5666); |
|
|
console.log(rs,5666); |
|
|
if(rs.length > 1) isExist = true |
|
|
if(rs.length > 1) isExist = true |
|
|