Browse Source

物料降级记录

master_hella_20240701
chenfang 6 months ago
parent
commit
95f34e80fd
  1. 91
      src/views/wms/basicDataManage/itemManage/relegate/relegateRecord/index.vue
  2. 192
      src/views/wms/basicDataManage/itemManage/relegate/relegateRecord/relegateRecordMain.data.ts
  3. 76
      src/views/wms/basicDataManage/itemManage/relegate/relegateRequest/index.vue
  4. 4
      src/views/wms/basicDataManage/itemManage/relegate/relegateRequest/relegateRequestMain.data.ts

91
src/views/wms/basicDataManage/itemManage/relegate/relegateRecord/index.vue

@ -1,7 +1,7 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="RelegateRecordMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
<Search :schema="[...RelegateRecordMain.allSchemas.searchSchema, ...RelegateRecordDetail.allSchemas.searchSchema]" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
@ -27,9 +27,9 @@
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #code="{row}">
<el-button type="primary" link @click="openDetail(row, '代码', row.code)">
<span>{{ row.code }}</span>
<template #number="{row}">
<el-button type="primary" link @click="openDetail(row, '单据号', row.number)">
<span>{{ row.number }}</span>
</el-button>
</template>
<template #action="{ row }">
@ -41,29 +41,44 @@
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="basicFormRef"
@success="formsSuccess"
:isOpenSearchTable="true"
@success="getList"
:rules="RelegateRecordMainRules"
:formAllSchemas="RelegateRecordMain.allSchemas"
:tableAllSchemas="RelegateRecordDetail.allSchemas"
:tableFormRules="RelegateRecordDetailRules"
:apiUpdate="RelegateRecordMainApi.updateRelegateRecordMain"
:apiCreate="RelegateRecordMainApi.createRelegateRecordMain"
:isBusiness="true"
fromeWhere="RelegateRecordMain"
@submitForm="submitForm"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="RelegateRecordMain.allSchemas" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/wms/relegate-record-main/import" :importTemplateData="importTemplateData" @success="importSuccess" />
<Detail
ref="detailRef"
:isBasic="true"
:allSchemas="RelegateRecordMain.allSchemas"
:detailAllSchemas="RelegateRecordDetail.allSchemas"
:detailAllSchemasRules="RelegateRecordDetailRules"
:apiCreate="RelegateRecordDetailApi.createRelegateRecordDetail"
:apiUpdate="RelegateRecordDetailApi.updateRelegateRecordDetail"
:apiPage="RelegateRecordDetailApi.getRelegateRecordDetailPage"
:apiDelete="RelegateRecordDetailApi.deleteRelegateRecordDetail"
fromeWhere="RelegateRecordMain"
@searchTableSuccessDetail="searchTableSuccessDetail"
:detailButtonIsShowAdd="true"
:detailButtonIsShowDelete="true" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { RelegateRecordMain,RelegateRecordMainRules } from './relegate-record-main.data'
import { RelegateRecordMain,RelegateRecordMainRules,RelegateRecordDetail,RelegateRecordDetailRules } from './relegateRecordMain.data'
import * as RelegateRecordMainApi from '@/api/wms/relegateRecordMain'
import * as RelegateRecordDetailApi from '@/api/wms/relegateRecordDetail'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue'
defineOptions({ name: 'RelegateRecordMain' })
@ -74,7 +89,8 @@ const { t } = useI18n() // 国际化
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(RelegateRecordMain.allSchemas.tableColumns)
const tableColumns = ref([...RelegateRecordMain.allSchemas.tableColumns,...RelegateRecordDetail.allSchemas.tableMainColumns])
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
@ -85,13 +101,22 @@ const searchTableSuccess = (formField, searchField, val, formRef) => {
})
}
//
const searchTableSuccessDetail = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
})
}
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
const { tableObject, tableMethods } = useTable({
getListApi: RelegateRecordMainApi.getRelegateRecordMainPage //
getListApi: RelegateRecordDetailApi.getRelegateRecordDetailPage //
})
//
@ -119,8 +144,6 @@ const HeadButttondata = [
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
openForm('create')
} else if (val == 'import') { //
handleImport()
} else if (val == 'export') { //
handleExport()
} else if (val == 'refresh') { //
@ -152,19 +175,16 @@ const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row)
}
/**
* tableForm方法
*/
const tableFormKeys = {}
RelegateRecordDetail.allSchemas.tableFormColumns.forEach(item => {
tableFormKeys[item.field] = item.default ? item.default : ''
})
// form
const formsSuccess = async (formType,data) => {
var isHave =RelegateRecordMain.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime';
});
if(isHave){
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){
message.error('失效时间要大于生效时间')
return;
}
}
if(data.activeTime==0)data.activeTime = null;
if(data.expireTime==0)data.expireTime = null;
const submitForm = async (formType,data) => {
if (formType === 'create') {
await RelegateRecordMainApi.createRelegateRecordMain(data)
message.success(t('common.createSuccess'))
@ -211,20 +231,6 @@ const handleExport = async () => {
}
}
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: '物料降级记录主导入模版.xlsx'
})
//
const importSuccess = () => {
getList()
}
//
const searchFormClick = (searchData) => {
@ -238,7 +244,6 @@ const searchFormClick = (searchData) => {
/** 初始化 **/
onMounted(async () => {
getList()
importTemplateData.templateUrl = await RelegateRecordMainApi.importTemplate()
})
</script>

192
src/views/wms/basicDataManage/itemManage/relegate/relegateRecord/relegateRecordMain.data.ts

@ -11,10 +11,10 @@ export const RelegateRecordMainRules = reactive({
export const RelegateRecordMain = useCrudSchemas(reactive<CrudSchema[]>([
{
label: 'id',
field: 'id',
label: '单据号',
field: 'number',
sort: 'custom',
isForm: false,
isSearch: true,
},
{
label: '申请单号',
@ -27,37 +27,6 @@ export const RelegateRecordMain = useCrudSchemas(reactive<CrudSchema[]>([
field: 'executeTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: true,
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
}
},
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
valueFormat: 'x'
}
},
},
{
label: '生效日期',
field: 'activeDate',
sort: 'custom',
formatter: dateFormatter,
isSearch: true,
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
}
},
form: {
component: 'DatePicker',
componentProps: {
@ -70,22 +39,12 @@ export const RelegateRecordMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '是否可用',
field: 'available',
sort: 'custom',
isSearch: true,
},
{
label: '申请时间',
field: 'requestTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: true,
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
}
},
form: {
component: 'DatePicker',
componentProps: {
@ -95,102 +54,125 @@ export const RelegateRecordMain = useCrudSchemas(reactive<CrudSchema[]>([
},
},
{
label: '截止时间',
field: 'dueTime',
label: '部门',
field: 'departmentCode',
sort: 'custom',
},
{
label: '业务类型',
field: 'businessType',
sort: 'custom',
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))
// 表单校验
export const RelegateRecordDetailRules = reactive({
itemCode: [required],
downItemCode: [required],
businessType: [required],
fromBatch: [required],
fromPackingNumber: [required],
fromLocationCode: [required],
available: [required],
departmentCode: [required],
concurrencyStamp: [required],
})
export const RelegateRecordDetail = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '物料代码',
field: 'itemCode',
sort: 'custom',
formatter: dateFormatter,
isSearch: true,
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
}
},
{
label: '降级后物料代码',
field: 'downItemCode',
sort: 'custom',
isSearch: true,
},
{
label: '计量单位',
field: 'uom',
sort: 'custom',
},
{
label: '数量',
field: 'qty',
sort: 'custom',
},
{
label: '库存状态',
field: 'inventoryStatus',
sort: 'custom',
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
valueFormat: 'x'
}
component: 'Radio'
},
},
{
label: '部门',
field: 'departmentCode',
label: '从批次',
field: 'fromBatch',
sort: 'custom',
isSearch: true,
},
{
label: '用户组',
field: 'userGroupCode',
label: '从包装号',
field: 'fromPackingNumber',
sort: 'custom',
isSearch: true,
},
{
label: '接口类型',
field: 'interfaceType',
label: '从库位代码',
field: 'fromLocationCode',
sort: 'custom',
isSearch: true,
form: {
component: 'SelectV2'
},
},
{
label: '代码',
field: 'code',
label: '从库区类型',
field: 'fromAreaTypes',
sort: 'custom',
isSearch: true,
},
{
label: '单据号',
field: 'number',
label: '从库区代码',
field: 'fromAreaCodes',
sort: 'custom',
isSearch: true,
},
{
label: '业务类型',
field: 'businessType',
label: '到包装号',
field: 'toPackingNumber',
sort: 'custom',
},
{
label: '到批次',
field: 'toBatch',
sort: 'custom',
isSearch: true,
form: {
component: 'SelectV2'
},
},
{
label: '备注',
field: 'remark',
label: '到库位代码',
field: 'toLocationCode',
sort: 'custom',
isSearch: true,
},
{
label: '创建时间',
field: 'createTime',
label: '到仓库代码',
field: 'toWarehouseCode',
sort: 'custom',
formatter: dateFormatter,
isSearch: true,
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
}
},
isForm: false,
},
{
label: '扩展属性',
field: 'extraProperties',
label: '到库区类型',
field: 'toAreaTypes',
sort: 'custom',
isSearch: true,
},
{
label: '地点ID',
field: 'siteId',
label: '到库区代码',
field: 'toAreaCodes',
sort: 'custom',
isSearch: true,
},
{
label: '操作',

76
src/views/wms/basicDataManage/itemManage/relegate/relegateRequest/index.vue

@ -87,8 +87,6 @@ const businessType = 'relegate'
routeName.value = route.name
const tableColumns = ref([...RelegateRequestMain.allSchemas.tableColumns, ...RelegateRequestDetail.allSchemas.tableMainColumns])
const isShowButton = ref(true)
// //
const trueFalse = ref(false)
//
const searchTableSuccess = (formField, searchField, val, formRef, type, row) => {
@ -103,7 +101,7 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row) =>
row['toBatch'] = val[0]['batch']
row['toPackingNumber'] = val[0]['packingNumber']
row['fromLocationCode'] = val[0]['locationCode']
row['fromInventoryStatus'] = val[0]['inventoryStatus']
row['inventoryStatus'] = val[0]['inventoryStatus']
} else if (formField == 'downItemCode') {
row['downItemCode'] = val[0]['code']
} else if (formField == 'toLocationCode') {
@ -239,20 +237,86 @@ const butttondata = (row, $index) => {
return []
}
return [
defaultButtons.mainListCloseBtn({hide:isShowMainButton(row,['2','3','4','6']),hasPermi:'wms:relegate-request-main:close'}), //
defaultButtons.mainListCloseBtn({hide:isShowMainButton(row,['2','3','4']),hasPermi:'wms:relegate-request-main:close'}), //
defaultButtons.mainListReAddBtn({hide:isShowMainButton(row,['4','5']),hasPermi:'wms:relegate-request-main:reAdd'}), //
defaultButtons.mainListSubmitBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:relegate-request-main:submit'}), //
defaultButtons.mainListTurnDownBtn({hide:isShowMainButton(row,['2']),hasPermi:'wms:relegate-request-main:refused'}), //
defaultButtons.mainListApproveBtn({hide:isShowMainButton(row,['2']),hasPermi:'wms:relegate-request-main:agree'}), //
defaultButtons.mainListHandleBtn({hide:isShowMainButton(row,['3']),hasPermi:'wms:relegate-request-main:handle'}), //
defaultButtons.mainListEditBtn({ hide: isShowMainButton(row, ['1']), hasPermi: 'wms:relegate-request-main:update' }), //
defaultButtons.mainListDeleteBtn({ hasPermi: 'wms:relegate-request-main:delete' }), //
// defaultButtons.mainListDeleteBtn({ hasPermi: 'wms:relegate-request-main:delete' }), //
]
}
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
if (val == 'mainClose') { //
await message.confirm('确认要关闭吗?')
tableObject.loading = true
RelegateRequestMainApi.close(row.masterId).then(() => {
message.success(t('common.updateSuccess'))
tableObject.loading = false
getList()
}).catch(err => {
tableObject.loading = false
console.log(err)
})
} else if (val == 'mainReAdd') { //
await message.confirm('确认要重新添加吗?')
tableObject.loading = true
RelegateRequestMainApi.reAdd(row.masterId).then(() => {
message.success(t('common.updateSuccess'))
tableObject.loading = false
getList()
}).catch(err => {
tableObject.loading = false
console.log(err)
})
} else if (val == 'mainSubmit') { //
await message.confirm('确认要提交审批吗?')
tableObject.loading = true
RelegateRequestMainApi.submit(row.masterId).then(() => {
message.success(t('common.updateSuccess'))
tableObject.loading = false
getList()
}).catch(err => {
tableObject.loading = false
console.log(err)
})
} else if (val == 'mainTurnDown') { //
await message.confirm('确认要驳回吗?')
tableObject.loading = true
RelegateRequestMainApi.refused(row.masterId).then(() => {
message.success(t('common.updateSuccess'))
tableObject.loading = false
getList()
}).catch(err => {
tableObject.loading = false
console.log(err)
})
} else if (val == 'mainApprove') { //
await message.confirm('确认要审批通过吗?')
tableObject.loading = true
RelegateRequestMainApi.agree(row.masterId).then(() => {
message.success(t('common.updateSuccess'))
tableObject.loading = false
getList()
}).catch(err => {
tableObject.loading = false
console.log(err)
})
} else if (val == 'mainHandle') { //
await message.confirm('确认要处理吗?')
tableObject.loading = true
RelegateRequestMainApi.handle(row.masterId).then(() => {
message.success(t('common.updateSuccess'))
tableObject.loading = false
getList()
}).catch(err => {
tableObject.loading = false
console.log(err)
})
} else if (val == 'edit') { //
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)

4
src/views/wms/basicDataManage/itemManage/relegate/relegateRequest/relegateRequestMain.data.ts

@ -283,7 +283,7 @@ export const RelegateRequestMain = useCrudSchemas(reactive<CrudSchema[]>([
field: 'action',
isForm: false,
table: {
width: 150,
width: 200,
fixed: 'right'
}
}
@ -666,7 +666,7 @@ export const RelegateRequestDetail = useCrudSchemas(reactive<CrudSchema[]>([
isForm: false,
hiddenInMain:true,
table: {
width: 150,
width: 200,
fixed: 'right'
},
isTableForm: false

Loading…
Cancel
Save