Browse Source

库存转移批次需求修改

intex_online20241111
zhang_li 1 month ago
parent
commit
7ee8ff6860
  1. 47
      src/components/TableForm/src/TableForm.vue
  2. 111
      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
v-if="!headerItem?.tableForm?.type || headerItem?.tableForm?.type == 'InputString'"
v-if="!getFormItemType(row,headerItem)&&(!headerItem.tableForm.type || headerItem.tableForm.type == 'InputString')"
:prop="headerItem.field"
style="display: flex; align-items: center"
>
@ -123,11 +123,11 @@
><Icon icon="ep:search" size="14"
/></el-button>
</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>
</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
:key="headerItem.field + $index"
v-model="row[headerItem.field]"
@ -160,7 +160,7 @@
/>
</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
:key="headerItem.field + $index"
v-model="row[headerItem.field]"
@ -224,7 +224,7 @@
</el-select>
</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
:key="headerItem.field + $index"
v-model="row[headerItem.field]"
@ -237,7 +237,7 @@
/>
</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
:key="headerItem.field + $index"
v-model="row[headerItem.field]"
@ -286,7 +286,7 @@
/>
</el-form-item>
<!-- 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
:key="headerItem.field + $index"
v-model="row[headerItem.field]"
@ -304,7 +304,7 @@
/>
</el-form-item>
<!-- 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
:key="headerItem.field + $index"
v-model="row[headerItem.field]"
@ -328,7 +328,7 @@
</el-radio-group>
</el-form-item>
<!-- 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
:key="headerItem.field + $index"
v-model="row[headerItem.field]"
@ -529,7 +529,6 @@ const props = defineProps({
}
})
let isShowTableFormSearch = ref({})
console.log(33333, props.tableFields)
isShowTableFormSearch.value = props.tableFields.find((item) => item.isShowTableFormSearch)
//
@ -627,11 +626,21 @@ const handleTableSelect = (row, column, event) => {
// item
const itemIsDisabled = (colum, row) => {
return (
Boolean(colum.tableForm?.disabled) ||
Boolean(row.disabled) ||
Boolean(row['disabled_' + colum.field])
)
console.log(row['disabled_' + colum.field])
if (row['disabled_' + colum.field] === true || row['disabled_' + colum.field] === false) {
return 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() //
@ -762,6 +771,14 @@ const isFullscreen = ref(false)
const reloadFullscreen = (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
defineExpose({
TableBaseComponents_Ref,

111
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 businessType = ref()
console.log(99 , routeName.value)
const fromInventoryStatus = ref()
const toInventoryStatus = ref()
const importFileName = ref()
@ -123,7 +122,6 @@ if ( routeName.value == 'InventorymoveRequestMain') {
businessType.value = 'Move'
importFileName.value = '库存移动申请'
}
console.log(99 , businessType.value)
@ -299,7 +297,6 @@ const getDefaultToLocationCode = async ()=>{
}
})
let res = await LocationApi.selectBusinessTypeToLocation(params)
console.log('res',res)
if(res&&res.list.length>0){
tableData.value.forEach(item=>{
if(!item['toLocationCode']){
@ -308,9 +305,11 @@ const getDefaultToLocationCode = async ()=>{
})
}
}
let fromManagementPrecision = ref('')
let toManagementPrecision = ref('')
//
const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => {
nextTick(() => {
nextTick(async() => {
if (type == 'tableForm') {
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']))
@ -328,6 +327,28 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) =>
newRow['toInventoryStatus'] = item['inventoryStatus']//
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 {
row[formField] = val[0][searchField]
}
@ -354,8 +375,8 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) =>
})
}
//
const searchTableSuccessDetail = (formField, searchField, val, formRef ) => {
nextTick(() => {
const searchTableSuccessDetail = (formField, searchField, val, formRef) => {
nextTick(async() => {
const setV = {}
if(formField == 'fromPackingNumber') {
setV['fromPackingNumber'] = val[0]['packingNumber']
@ -366,7 +387,37 @@ const searchTableSuccessDetail = (formField, searchField, val, formRef ) => {
setV['fromLocationCode'] = val[0]['locationCode']
setV['uom'] = val[0]['uom']
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 {
setV[formField] = val[0][searchField]
}
@ -457,7 +508,6 @@ const buttonTableClick = async (val, row) => {
buttonBaseClick('refresh',null)
}).catch(err => {
tableObject.loading = false
console.log(err)
})
} else if (val == 'mainReAdd') { //
await message.confirm('确认要重新添加吗?')
@ -468,7 +518,6 @@ const buttonTableClick = async (val, row) => {
buttonBaseClick('refresh',null)
}).catch(err => {
tableObject.loading = false
console.log(err)
})
} else if (val == 'mainSubmit') { //
await message.confirm('确认要提交审批吗?')
@ -479,7 +528,6 @@ const buttonTableClick = async (val, row) => {
buttonBaseClick('refresh',null)
}).catch(err => {
tableObject.loading = false
console.log(err)
})
} else if (val == 'mainTurnDown') { //
await message.confirm('确认要驳回吗?')
@ -490,7 +538,6 @@ const buttonTableClick = async (val, row) => {
buttonBaseClick('refresh',null)
}).catch(err => {
tableObject.loading = false
console.log(err)
})
} else if (val == 'mainApprove') { //
await message.confirm('确认要审批通过吗?')
@ -501,7 +548,6 @@ const buttonTableClick = async (val, row) => {
buttonBaseClick('refresh',null)
}).catch(err => {
tableObject.loading = false
console.log(err)
})
} else if (val == 'mainHandle') { //
await message.confirm('确认要处理吗?')
@ -512,7 +558,6 @@ const buttonTableClick = async (val, row) => {
buttonBaseClick('refresh',null)
}).catch(err => {
tableObject.loading = false
console.log(err)
})
} else if (val == 'edit') { //
openForm('update', row)
@ -531,7 +576,7 @@ 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){
InventorymoveRequestDetail.allSchemas.formSchema.find(item => (item.field == 'fromPackingNumber'))?.componentProps?.searchCondition.push({
key: 'warehouseCode',
@ -545,6 +590,36 @@ const detailOpenForm = (type, row) => {
}
})
}
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()
@ -629,11 +704,16 @@ const submitForm = async (formType, submitData) => {
message.warning('从库位和到库位不能相同')
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 //
let isExist = false
tableData.value.forEach(item => {
let rs = tableData.value.filter(filterItem => (filterItem.fromPackingNumber&&filterItem.fromPackingNumber == item.fromPackingNumber) )
console.log(rs,5666);
if(rs.length > 1) isExist = true
})
if (isExist) {
@ -643,7 +723,6 @@ const submitForm = async (formType, submitData) => {
}
flag.value = false
data.subList.forEach(item => {
console.log(556565,item);
if(fromInventoryStatus.value){
//item.fromInventoryStatus = fromInventoryStatus.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: {
style: {width: '100%'},
type: 'date',
dateFormat: 'YYYY-MM-DD',
format: 'YYYY-MM-DD',
valueFormat: 'x',
}
},
@ -583,15 +583,25 @@ export const InventorymoveRequestDetail = useCrudSchemas(reactive<CrudSchema[]>(
table: {
width: 150
},
isTable:false,
tableForm: {
disabled: true
disabled: true,
placeholder: '请选择从批次',
valueFormat: 'YYYYMMDD',
format: 'YYYYMMDD',
},
form: {
component: 'Input',
componentProps: {
disabled: true
}
disabled:true
// style: { width: '100%' },
// type: 'date',
// placeholder: '请选择从批次',
// format: 'YYYYMMDD',
// valueFormat: 'YYYYMMDD',
}
},
},
{
label: '到批次',
field: 'toBatch',
@ -963,6 +973,9 @@ export const InventorymoveRequestDetailRules = reactive({
fromLocationCode: [
{ required: true, message: '请选择从库位代码', trigger: 'change' }
],
fromBatch: [
{ required: false, message: '请选择批次码', trigger: 'change' }
],
// fromPackingNumber: [
// { required: true, message: '请选择从包装号', trigger: 'change' }
// ],

Loading…
Cancel
Save