Browse Source

HL-5752物料隔离新增明细时, 把到库位从明细中放到上方选择,赋与明细中到库位同样逻辑的默认值

hella_online_20240829
wangyufei 2 months ago
parent
commit
9732096388
  1. 170
      src/views/wms/moveManage/inventorymove/inventorymoveRequestMainOKHOLD/index.vue
  2. 48
      src/views/wms/moveManage/inventorymove/inventorymoveRequestMainOKHOLD/inventorymoveRequestMain.data.ts

170
src/views/wms/moveManage/inventorymove/inventorymoveRequestMainOKHOLD/index.vue

@ -94,7 +94,8 @@ import { formatDate } from '@/utils/formatTime'
import dayjs from 'dayjs'
import { usePageLoading } from '@/hooks/web/usePageLoading'
const { loadStart, loadDone } = usePageLoading()
//
//
// 使
defineOptions({ name: 'InventorymoveRequestMain' })
const message = useMessage() //
@ -115,81 +116,15 @@ const { tableObject, tableMethods } = useTable({
getListApi: InventorymoveRequestDetailApi.getInventorymoveRequestDetailPage //
})
//
/**
* OktoholdRequestMain 合格转隔离
*/
if ( routeName.value == 'OktoholdRequestMain') {
tableObject.params = {
// fromInventoryStatus: 'OK',
// toInventoryStatus:'HOLD',
businessType :'OkToHold'
}
// fromInventoryStatus.value = 'OK'
// toInventoryStatus.value = "HOLD"
businessType.value = 'OkToHold'
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 = '合格转报废申请'
tableObject.params = {
// fromInventoryStatus: 'OK',
// toInventoryStatus:'HOLD',
businessType :'OkToHold'
}
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)
// fromInventoryStatus.value = 'OK'
// toInventoryStatus.value = "HOLD"
businessType.value = 'OkToHold'
importFileName.value = '物料转隔离申请'
InventorymoveRequestMain.allSchemas.tableFormColumns.map(item =>{
if(item.field == 'fromWarehouseCode') {
@ -349,27 +284,20 @@ const updataTableColumns = (val) => {
// -
const getDefaultToLocationCode = async ()=>{
let searchCondition = []
InventorymoveRequestDetail.allSchemas.tableFormColumns.map(item => {
InventorymoveRequestMain.allSchemas.formSchema.map(item => {
if(item.field == "toLocationCode"){
searchCondition = item.tableForm.searchCondition
searchCondition = item.componentProps.searchCondition
}
})
let params = {}
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)
console.log('res',res)
console.log('获取到库位默认值',res)
if(res&&res.list.length>0){
tableData.value.forEach(item=>{
if(!item['toLocationCode']){
item['toLocationCode'] = res.list[0]['code']
}
})
formRef.value.formRef.formModel["toLocationCode"] = res.list[0]['code']
}
}
//
@ -389,26 +317,9 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) =>
newRow['fromLocationCode'] = item['locationCode']
newRow['uom'] = item['uom']
newRow['qty'] = item['qty']
if(routeName.value == 'OktoholdRequestMain'){
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']
}
newRow['toInventoryStatus'] = "HOLD" //
tableData.value.push(newRow)
})
if(routeName.value == 'OktoholdRequestMain'){
getDefaultToLocationCode()
}
} else {
row[formField] = val[0][searchField]
}
@ -446,21 +357,8 @@ const searchTableSuccessDetail = (formField, searchField, val, formRef ) => {
setV['fromInventoryStatus'] = val[0]['inventoryStatus']
setV['fromLocationCode'] = val[0]['locationCode']
setV['uom'] = val[0]['uom']
if(routeName.value == 'OktoholdRequestMain'){
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']
}
setV['toInventoryStatus'] = "HOLD"
} else {
setV[formField] = val[0][searchField]
}
@ -638,6 +536,8 @@ const openForm =async (type: string, row?: number) => {
}
tableData.value = [] //
formRef.value.open(type, row)
getDefaultToLocationCode()
}
/**
@ -695,27 +595,9 @@ const handleExport = async () => {
//
loadStart()
const excelTitle = ref(route.meta.title)
if(routeName.value == 'OktoholdRequestMain'){
const data = await InventorymoveRequestMainApi.exportOkToHoldRequestMain(tableObject.params)
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`)
}
const data = await InventorymoveRequestMainApi.exportOkToHoldRequestMain(tableObject.params)
download.excel(data, `${excelTitle.value}】【${formatDate(new Date())}】.xlsx`)
} catch {
} finally {
loadDone()
@ -754,7 +636,8 @@ const submitForm = async (formType, submitData) => {
if(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){
message.warning('从库位和到库位不能相同')
return
@ -762,6 +645,7 @@ const submitForm = async (formType, submitData) => {
data.subList = tableData.value //
let isExist = false
tableData.value.forEach(item => {
item['toLocationCode'] = toLocationCode
let rs = tableData.value.filter(filterItem => (filterItem.fromPackingNumber&&filterItem.fromPackingNumber == item.fromPackingNumber) )
console.log(rs,5666);
if(rs.length > 1) isExist = true

48
src/views/wms/moveManage/inventorymove/inventorymoveRequestMainOKHOLD/inventorymoveRequestMain.data.ts

@ -152,6 +152,44 @@ export const InventorymoveRequestMain = useCrudSchemas(reactive<CrudSchema[]>([
},
isForm: false,
},
{
label: '到库位代码', // 子表数据--新增在form上展示
field: 'toLocationCode',
sort: 'custom',
isForm:true,
isTable:false,
isDetail:false,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
enterSearch: true,
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择到库位代码',
searchField: 'code',
searchTitle: '库位信息',
searchAllSchemas: Location.allSchemas,
searchPage: LocationApi.selectBusinessTypeToLocation,
searchCondition: [
{
key: 'businessType',
value: 'OkToHold',
isMainValue: false
},{
key: 'isIn',
value: 'in',
isMainValue: false
}],
verificationParams: [{
key: 'code',
action: '==',
value: '',
isMainValue: false,
isSearch: true,
isFormModel: true,
}], // 失去焦点校验参数
}
}
},
{
label: '截止时间',
field: 'dueTime',
@ -464,6 +502,9 @@ export const InventorymoveRequestMainRules = reactive({
fromWarehouseCode: [
{ required: true, message: '请选择从仓库代码', trigger: 'blur' }
],
toLocationCode: [
{ required: true, message: '请选择到库位代码', trigger: 'change' }
],
status: [
{ required: true, message: '请选择状态', trigger: 'change' }
],
@ -703,7 +744,7 @@ export const InventorymoveRequestDetail = useCrudSchemas(reactive<CrudSchema[]>(
table: {
width: 150
},
isTableForm:true,
isTableForm:false, //放在主表展示了--喜婷
tableForm: {
enterSearch: true,
isInpuFocusShow: true, // 开启查询弹窗
@ -751,7 +792,7 @@ export const InventorymoveRequestDetail = useCrudSchemas(reactive<CrudSchema[]>(
key: 'isIn',
value: 'in',
isMainValue: false
}],
}],
verificationParams: [{
key: 'code',
action: '==',
@ -940,9 +981,6 @@ export const InventorymoveRequestDetailRules = reactive({
fromInventoryStatus: [
{ required: true, message: '请选择从库存状态', trigger: 'change' }
],
toLocationCode: [
{ required: true, message: '请选择到库位代码', trigger: 'change' }
],
remark: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],

Loading…
Cancel
Save