Browse Source

库存转移批次需求修改

intex_online20241111
zhang_li 1 month ago
parent
commit
7ee8ff6860
  1. 47
      src/components/TableForm/src/TableForm.vue
  2. 135
      src/views/wms/moveManage/inventorymove/inventorymoveRequestMainMOVE/index.vue
  3. 21
      src/views/wms/moveManage/inventorymove/inventorymoveRequestMainMOVE/inventorymoveRequestMain.data.ts

47
src/components/TableForm/src/TableForm.vue

@ -86,7 +86,7 @@
> >
<!-- 字符串输入框 --> <!-- 字符串输入框 -->
<el-form-item <el-form-item
v-if="!headerItem?.tableForm?.type || headerItem?.tableForm?.type == 'InputString'" v-if="!getFormItemType(row,headerItem)&&(!headerItem.tableForm.type || headerItem.tableForm.type == 'InputString')"
:prop="headerItem.field" :prop="headerItem.field"
style="display: flex; align-items: center" style="display: flex; align-items: center"
> >
@ -123,11 +123,11 @@
><Icon icon="ep:search" size="14" ><Icon icon="ep:search" size="14"
/></el-button> /></el-button>
</el-form-item> </el-form-item>
<el-form-item v-if="headerItem?.tableForm?.type == 'slot'"> <el-form-item v-if="getFormItemType(row,headerItem) == 'slot'">
<slot :row="row"></slot> <slot :row="row"></slot>
</el-form-item> </el-form-item>
<!-- 金额输入框 --> <!-- 金额输入框 -->
<el-form-item v-if="headerItem?.tableForm?.type == 'number'" :prop="headerItem.field"> <el-form-item v-if="getFormItemType(row,headerItem) == 'number'" :prop="headerItem.field">
<el-input <el-input
:key="headerItem.field + $index" :key="headerItem.field + $index"
v-model="row[headerItem.field]" v-model="row[headerItem.field]"
@ -160,7 +160,7 @@
/> />
</el-form-item> </el-form-item>
<!-- 下拉框 --> <!-- 下拉框 -->
<el-form-item v-if="headerItem?.tableForm?.type == 'Select'" :prop="headerItem.field"> <el-form-item v-if="getFormItemType(row,headerItem) == 'Select'" :prop="headerItem.field">
<el-select <el-select
:key="headerItem.field + $index" :key="headerItem.field + $index"
v-model="row[headerItem.field]" v-model="row[headerItem.field]"
@ -224,7 +224,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<!-- 时间选择器 --> <!-- 时间选择器 -->
<el-form-item v-if="headerItem?.tableForm?.type == 'FormTime'" :prop="headerItem.field"> <el-form-item v-if="getFormItemType(row,headerItem) == 'FormTime'" :prop="headerItem.field">
<el-time-picker <el-time-picker
:key="headerItem.field + $index" :key="headerItem.field + $index"
v-model="row[headerItem.field]" v-model="row[headerItem.field]"
@ -237,7 +237,7 @@
/> />
</el-form-item> </el-form-item>
<!-- 日期选择器 --> <!-- 日期选择器 -->
<el-form-item v-if="headerItem?.tableForm?.type == 'FormDate'" :prop="headerItem.field"> <el-form-item v-if="getFormItemType(row,headerItem) == 'FormDate'" :prop="headerItem.field">
<el-date-picker <el-date-picker
:key="headerItem.field + $index" :key="headerItem.field + $index"
v-model="row[headerItem.field]" v-model="row[headerItem.field]"
@ -286,7 +286,7 @@
/> />
</el-form-item> </el-form-item>
<!-- Switch 开关 --> <!-- Switch 开关 -->
<el-form-item v-if="headerItem?.tableForm?.type == 'Switch'" :prop="headerItem.field"> <el-form-item v-if="getFormItemType(row,headerItem) == 'Switch'" :prop="headerItem.field">
<el-switch <el-switch
:key="headerItem.field + $index" :key="headerItem.field + $index"
v-model="row[headerItem.field]" v-model="row[headerItem.field]"
@ -304,7 +304,7 @@
/> />
</el-form-item> </el-form-item>
<!-- Radio 单选--> <!-- Radio 单选-->
<el-form-item v-if="headerItem?.tableForm?.type == 'Radio'" :prop="headerItem.field"> <el-form-item v-if="getFormItemType(row,headerItem) == 'Radio'" :prop="headerItem.field">
<el-radio-group <el-radio-group
:key="headerItem.field + $index" :key="headerItem.field + $index"
v-model="row[headerItem.field]" v-model="row[headerItem.field]"
@ -328,7 +328,7 @@
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<!-- Checkbox 多选--> <!-- Checkbox 多选-->
<el-form-item v-if="headerItem?.tableForm?.type == 'Checkbox'" :prop="headerItem.field"> <el-form-item v-if="getFormItemType(row,headerItem) == 'Checkbox'" :prop="headerItem.field">
<el-checkbox-group <el-checkbox-group
:key="headerItem.field + $index" :key="headerItem.field + $index"
v-model="row[headerItem.field]" v-model="row[headerItem.field]"
@ -529,7 +529,6 @@ const props = defineProps({
} }
}) })
let isShowTableFormSearch = ref({}) let isShowTableFormSearch = ref({})
console.log(33333, props.tableFields)
isShowTableFormSearch.value = props.tableFields.find((item) => item.isShowTableFormSearch) isShowTableFormSearch.value = props.tableFields.find((item) => item.isShowTableFormSearch)
// //
@ -627,11 +626,21 @@ const handleTableSelect = (row, column, event) => {
// item // item
const itemIsDisabled = (colum, row) => { const itemIsDisabled = (colum, row) => {
return ( console.log(row['disabled_' + colum.field])
Boolean(colum.tableForm?.disabled) || if (row['disabled_' + colum.field] === true || row['disabled_' + colum.field] === false) {
Boolean(row.disabled) || return Boolean(row['disabled_' + colum.field])
Boolean(row['disabled_' + colum.field]) }
) else if (!row['disabled_' + colum.field] && (colum.tableForm?.disabled === true || colum.tableForm?.disabled === false)) {
return Boolean(colum.tableForm?.disabled)
}else {
return Boolean(row.disabled)
}
// return (
// Boolean(colum.tableForm?.disabled) ||
// Boolean(row.disabled) ||
// Boolean(row['disabled_' + colum.field])
// )
} }
// const { t } = useI18n() // // const { t } = useI18n() //
@ -762,6 +771,14 @@ const isFullscreen = ref(false)
const reloadFullscreen = (fullscreen)=>{ const reloadFullscreen = (fullscreen)=>{
isFullscreen.value = fullscreen isFullscreen.value = fullscreen
} }
//
const getFormItemType = (row, headerItem) => {
if (headerItem.field&&row[headerItem.field + 'FormItemType'] != undefined) {
return row[headerItem.field + 'FormItemType']
} else {
return headerItem?.tableForm?.type ? headerItem?.tableForm?.type :''
}
}
// setup // setup
defineExpose({ defineExpose({
TableBaseComponents_Ref, TableBaseComponents_Ref,

135
src/views/wms/moveManage/inventorymove/inventorymoveRequestMainMOVE/index.vue

@ -106,7 +106,6 @@ routeName.value = route.name
const tableColumns = ref([...InventorymoveRequestMain.allSchemas.tableColumns,...InventorymoveRequestDetail.allSchemas.tableMainColumns]) const tableColumns = ref([...InventorymoveRequestMain.allSchemas.tableColumns,...InventorymoveRequestDetail.allSchemas.tableMainColumns])
const businessType = ref() const businessType = ref()
console.log(99 , routeName.value)
const fromInventoryStatus = ref() const fromInventoryStatus = ref()
const toInventoryStatus = ref() const toInventoryStatus = ref()
const importFileName = ref() const importFileName = ref()
@ -123,7 +122,6 @@ if ( routeName.value == 'InventorymoveRequestMain') {
businessType.value = 'Move' businessType.value = 'Move'
importFileName.value = '库存移动申请' importFileName.value = '库存移动申请'
} }
console.log(99 , businessType.value)
@ -299,7 +297,6 @@ const getDefaultToLocationCode = async ()=>{
} }
}) })
let res = await LocationApi.selectBusinessTypeToLocation(params) let res = await LocationApi.selectBusinessTypeToLocation(params)
console.log('res',res)
if(res&&res.list.length>0){ if(res&&res.list.length>0){
tableData.value.forEach(item=>{ tableData.value.forEach(item=>{
if(!item['toLocationCode']){ if(!item['toLocationCode']){
@ -308,9 +305,11 @@ const getDefaultToLocationCode = async ()=>{
}) })
} }
} }
let fromManagementPrecision = ref('')
let toManagementPrecision = ref('')
// //
const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => { const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => {
nextTick(() => { nextTick(async() => {
if (type == 'tableForm') { if (type == 'tableForm') {
if(formField == 'fromPackingNumber'){ if(formField == 'fromPackingNumber'){
val = val.filter(item=>!tableData.value.find(item1=>item1['itemCode']==item['itemCode']&&item1['fromBatch']==item['batch']&&item1['fromPackingNumber']==item['packingNumber']&&item1['fromLocationCode']==item['locationCode']&&item1['fromInventoryStatus']==item['inventoryStatus'])) val = val.filter(item=>!tableData.value.find(item1=>item1['itemCode']==item['itemCode']&&item1['fromBatch']==item['batch']&&item1['fromPackingNumber']==item['packingNumber']&&item1['fromLocationCode']==item['locationCode']&&item1['fromInventoryStatus']==item['inventoryStatus']))
@ -328,6 +327,28 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) =>
newRow['toInventoryStatus'] = item['inventoryStatus']// newRow['toInventoryStatus'] = item['inventoryStatus']//
tableData.value.push(newRow) tableData.value.push(newRow)
}) })
}else if (formField == 'toLocationCode') {
row[formField] = val[0][searchField]
await ruleApi.getManagementPrecision({
itemCodes: [row['itemCode']],
locationCode:row['fromLocationCode']
}).then((res) => {
fromManagementPrecision.value = res[0].ManagementPrecision
})
await ruleApi.getManagementPrecision({
itemCodes: [row['itemCode']],
locationCode: val[0][searchField]
}).then((res) => {
toManagementPrecision.value = res[0].ManagementPrecision
})
if (fromManagementPrecision.value == 'BY_QUANTITY' && toManagementPrecision.value == 'BY_BATCH') {
row['fromBatchFormItemType'] = 'FormDate'
row['disabled_fromBatch'] = false
} else {
row['fromBatchFormItemType'] = ''
row['disabled_fromBatch'] = true
row['fromBatch'] =''
}
} else { } else {
row[formField] = val[0][searchField] row[formField] = val[0][searchField]
} }
@ -354,8 +375,8 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) =>
}) })
} }
// //
const searchTableSuccessDetail = (formField, searchField, val, formRef ) => { const searchTableSuccessDetail = (formField, searchField, val, formRef) => {
nextTick(() => { nextTick(async() => {
const setV = {} const setV = {}
if(formField == 'fromPackingNumber') { if(formField == 'fromPackingNumber') {
setV['fromPackingNumber'] = val[0]['packingNumber'] setV['fromPackingNumber'] = val[0]['packingNumber']
@ -366,7 +387,37 @@ const searchTableSuccessDetail = (formField, searchField, val, formRef ) => {
setV['fromLocationCode'] = val[0]['locationCode'] setV['fromLocationCode'] = val[0]['locationCode']
setV['uom'] = val[0]['uom'] setV['uom'] = val[0]['uom']
setV['toInventoryStatus'] = val[0]['inventoryStatus'] //InventorymoveRequestMain setV['toInventoryStatus'] = val[0]['inventoryStatus'] //InventorymoveRequestMain
} else if (formField == 'toLocationCode') {
setV[formField] = val[0][searchField]
await ruleApi.getManagementPrecision({
itemCodes: [formRef.formModel.itemCode],
locationCode:formRef.formModel.fromLocationCode
}).then((res) => {
fromManagementPrecision.value = res[0].ManagementPrecision
})
await ruleApi.getManagementPrecision({
itemCodes: [formRef.formModel.itemCode],
locationCode: val[0][searchField]
}).then((res) => {
toManagementPrecision.value = res[0].ManagementPrecision
})
if (fromManagementPrecision.value == 'BY_QUANTITY' && toManagementPrecision.value == 'BY_BATCH') {
const obj =ref(InventorymoveRequestDetail.allSchemas.formSchema.find(item => (item.field == 'fromBatch')))
obj.value.component= 'DatePicker'
obj.value.componentProps.disabled= false
obj.value.componentProps.type= 'date'
obj.value.componentProps.valueFormat= 'YYYYMMDD'
obj.value.componentProps.format = 'YYYYMMDD'
InventorymoveRequestDetailRules.fromBatch[0].required = true
} else {
const obj =ref(InventorymoveRequestDetail.allSchemas.formSchema.find(item => (item.field == 'fromBatch')))
obj.value.component= 'Input'
obj.value.componentProps={
disabled : true
}
setV['fromBatch'] =''
InventorymoveRequestDetailRules.fromBatch[0].required = false
}
} else { } else {
setV[formField] = val[0][searchField] setV[formField] = val[0][searchField]
} }
@ -457,7 +508,6 @@ const buttonTableClick = async (val, row) => {
buttonBaseClick('refresh',null) buttonBaseClick('refresh',null)
}).catch(err => { }).catch(err => {
tableObject.loading = false tableObject.loading = false
console.log(err)
}) })
} else if (val == 'mainReAdd') { // } else if (val == 'mainReAdd') { //
await message.confirm('确认要重新添加吗?') await message.confirm('确认要重新添加吗?')
@ -468,7 +518,6 @@ const buttonTableClick = async (val, row) => {
buttonBaseClick('refresh',null) buttonBaseClick('refresh',null)
}).catch(err => { }).catch(err => {
tableObject.loading = false tableObject.loading = false
console.log(err)
}) })
} else if (val == 'mainSubmit') { // } else if (val == 'mainSubmit') { //
await message.confirm('确认要提交审批吗?') await message.confirm('确认要提交审批吗?')
@ -479,7 +528,6 @@ const buttonTableClick = async (val, row) => {
buttonBaseClick('refresh',null) buttonBaseClick('refresh',null)
}).catch(err => { }).catch(err => {
tableObject.loading = false tableObject.loading = false
console.log(err)
}) })
} else if (val == 'mainTurnDown') { // } else if (val == 'mainTurnDown') { //
await message.confirm('确认要驳回吗?') await message.confirm('确认要驳回吗?')
@ -490,7 +538,6 @@ const buttonTableClick = async (val, row) => {
buttonBaseClick('refresh',null) buttonBaseClick('refresh',null)
}).catch(err => { }).catch(err => {
tableObject.loading = false tableObject.loading = false
console.log(err)
}) })
} else if (val == 'mainApprove') { // } else if (val == 'mainApprove') { //
await message.confirm('确认要审批通过吗?') await message.confirm('确认要审批通过吗?')
@ -501,7 +548,6 @@ const buttonTableClick = async (val, row) => {
buttonBaseClick('refresh',null) buttonBaseClick('refresh',null)
}).catch(err => { }).catch(err => {
tableObject.loading = false tableObject.loading = false
console.log(err)
}) })
} else if (val == 'mainHandle') { // } else if (val == 'mainHandle') { //
await message.confirm('确认要处理吗?') await message.confirm('确认要处理吗?')
@ -512,7 +558,6 @@ const buttonTableClick = async (val, row) => {
buttonBaseClick('refresh',null) buttonBaseClick('refresh',null)
}).catch(err => { }).catch(err => {
tableObject.loading = false tableObject.loading = false
console.log(err)
}) })
} else if (val == 'edit') { // } else if (val == 'edit') { //
openForm('update', row) openForm('update', row)
@ -531,20 +576,50 @@ const openForm =async (type: string, row?: number) => {
/** /**
* 详情 新增/编辑事件 * 详情 新增/编辑事件
*/ */
const detailOpenForm = (type, row) => { const detailOpenForm =async (type, row) => {
if(InventorymoveRequestDetail.allSchemas.formSchema.find(item => (item.field == 'fromPackingNumber'))?.componentProps?.searchCondition.find(item => (item.key == 'warehouseCode')) == undefined){ if(InventorymoveRequestDetail.allSchemas.formSchema.find(item => (item.field == 'fromPackingNumber'))?.componentProps?.searchCondition.find(item => (item.key == 'warehouseCode')) == undefined){
InventorymoveRequestDetail.allSchemas.formSchema.find(item => (item.field == 'fromPackingNumber'))?.componentProps?.searchCondition.push({ InventorymoveRequestDetail.allSchemas.formSchema.find(item => (item.field == 'fromPackingNumber'))?.componentProps?.searchCondition.push({
key: 'warehouseCode', key: 'warehouseCode',
value: fromWarehouseCodeMain.value, value: fromWarehouseCodeMain.value,
isMainValue: false isMainValue: false
}) })
} else { } else {
InventorymoveRequestDetail.allSchemas.formSchema.find(item => (item.field == 'fromPackingNumber'))?.componentProps?.searchCondition.find(item => { InventorymoveRequestDetail.allSchemas.formSchema.find(item => (item.field == 'fromPackingNumber'))?.componentProps?.searchCondition.find(item => {
if (item.key == 'warehouseCode') { if (item.key == 'warehouseCode') {
item.value = fromWarehouseCodeMain.value item.value = fromWarehouseCodeMain.value
} }
}) })
}
if (type == 'update') {
await ruleApi.getManagementPrecision({
itemCodes: [row['itemCode']],
locationCode:row['fromLocationCode']
}).then((res) => {
fromManagementPrecision.value = res[0].ManagementPrecision
})
await ruleApi.getManagementPrecision({
itemCodes: [row['itemCode']],
locationCode: row['toLocationCode']
}).then((res) => {
toManagementPrecision.value = res[0].ManagementPrecision
})
if (fromManagementPrecision.value == 'BY_QUANTITY' && toManagementPrecision.value == 'BY_BATCH') {
const obj =ref(InventorymoveRequestDetail.allSchemas.formSchema.find(item => (item.field == 'fromBatch')))
obj.value.component= 'DatePicker'
obj.value.componentProps.disabled= false
obj.value.componentProps.type= 'date'
obj.value.componentProps.valueFormat= 'YYYYMMDD'
obj.value.componentProps.format= 'YYYYMMDD'
InventorymoveRequestDetailRules.fromBatch[0].required = true
} else {
const obj =ref(InventorymoveRequestDetail.allSchemas.formSchema.find(item => (item.field == 'fromBatch')))
obj.value.component= 'Input'
obj.value.componentProps={
disabled : true
} }
InventorymoveRequestDetailRules.fromBatch[0].required = false
}
}
} }
const fromWarehouseCodeMain = ref() const fromWarehouseCodeMain = ref()
@ -629,11 +704,16 @@ const submitForm = async (formType, submitData) => {
message.warning('从库位和到库位不能相同') message.warning('从库位和到库位不能相同')
return return
} }
let batchList = tableData.value.filter(item=>item.fromBatchFormItemType&&item.fromBatchFormItemType == 'FormDate')
let noBatch = batchList.some(item => !item.fromBatch)
if(noBatch){
message.warning('请选择从批次')
return
}
data.subList = tableData.value // data.subList = tableData.value //
let isExist = false let isExist = false
tableData.value.forEach(item => { tableData.value.forEach(item => {
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);
if(rs.length > 1) isExist = true if(rs.length > 1) isExist = true
}) })
if (isExist) { if (isExist) {
@ -643,7 +723,6 @@ const submitForm = async (formType, submitData) => {
} }
flag.value = false flag.value = false
data.subList.forEach(item => { data.subList.forEach(item => {
console.log(556565,item);
if(fromInventoryStatus.value){ if(fromInventoryStatus.value){
//item.fromInventoryStatus = fromInventoryStatus.value //item.fromInventoryStatus = fromInventoryStatus.value
item.toInventoryStatus = toInventoryStatus.value item.toInventoryStatus = toInventoryStatus.value

21
src/views/wms/moveManage/inventorymove/inventorymoveRequestMainMOVE/inventorymoveRequestMain.data.ts

@ -566,7 +566,7 @@ export const InventorymoveRequestDetail = useCrudSchemas(reactive<CrudSchema[]>(
componentProps: { componentProps: {
style: {width: '100%'}, style: {width: '100%'},
type: 'date', type: 'date',
dateFormat: 'YYYY-MM-DD', format: 'YYYY-MM-DD',
valueFormat: 'x', valueFormat: 'x',
} }
}, },
@ -583,14 +583,24 @@ export const InventorymoveRequestDetail = useCrudSchemas(reactive<CrudSchema[]>(
table: { table: {
width: 150 width: 150
}, },
isTable:false,
tableForm: { tableForm: {
disabled: true disabled: true,
placeholder: '请选择从批次',
valueFormat: 'YYYYMMDD',
format: 'YYYYMMDD',
}, },
form: { form: {
component: 'Input',
componentProps: { componentProps: {
disabled: true disabled:true
// style: { width: '100%' },
// type: 'date',
// placeholder: '请选择从批次',
// format: 'YYYYMMDD',
// valueFormat: 'YYYYMMDD',
} }
} },
}, },
{ {
label: '到批次', label: '到批次',
@ -963,6 +973,9 @@ export const InventorymoveRequestDetailRules = reactive({
fromLocationCode: [ fromLocationCode: [
{ required: true, message: '请选择从库位代码', trigger: 'change' } { required: true, message: '请选择从库位代码', trigger: 'change' }
], ],
fromBatch: [
{ required: false, message: '请选择批次码', trigger: 'change' }
],
// fromPackingNumber: [ // fromPackingNumber: [
// { required: true, message: '请选择从包装号', trigger: 'change' } // { required: true, message: '请选择从包装号', trigger: 'change' }
// ], // ],

Loading…
Cancel
Save