Browse Source

YT-2003:补料消耗记录

intex_online20250311
songguoqiang 4 weeks ago
parent
commit
369ea274e9
  1. 56
      src/api/wms/repleinshItemCodeConsumeRecord/index.ts
  2. 244
      src/views/wms/issueManage/repleinshItemCodeConsumeRecord/index.vue
  3. 150
      src/views/wms/issueManage/repleinshItemCodeConsumeRecord/repleinshItemCodeConsumeRecord.data.ts

56
src/api/wms/repleinshItemCodeConsumeRecord/index.ts

@ -0,0 +1,56 @@
import request from '@/config/axios'
export interface RepleinshItemCodeConsumeRecordVO {
itemCode: string
model: string
qty: number
isGenerate: string
consumeTime: Date
businessType: string
erpAreaType: string
issueRecordNumber: string
remark: string
available: string
createTime: Date
}
// 查询补料消耗记录列表
export const getRepleinshItemCodeConsumeRecordPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/wms/repleinsh-item-code-consume-record/senior', data })
} else {
return await request.get({ url: `/wms/repleinsh-item-code-consume-record/page`, params })
}
}
// 查询补料消耗记录详情
export const getRepleinshItemCodeConsumeRecord = async (id: number) => {
return await request.get({ url: `/wms/repleinsh-item-code-consume-record/get?id=` + id })
}
// 新增补料消耗记录
export const createRepleinshItemCodeConsumeRecord = async (data: RepleinshItemCodeConsumeRecordVO) => {
return await request.post({ url: `/wms/repleinsh-item-code-consume-record/create`, data })
}
// 修改补料消耗记录
export const updateRepleinshItemCodeConsumeRecord = async (data: RepleinshItemCodeConsumeRecordVO) => {
return await request.put({ url: `/wms/repleinsh-item-code-consume-record/update`, data })
}
// 删除补料消耗记录
export const deleteRepleinshItemCodeConsumeRecord = async (id: number) => {
return await request.delete({ url: `/wms/repleinsh-item-code-consume-record/delete?id=` + id })
}
// 导出补料消耗记录 Excel
export const exportRepleinshItemCodeConsumeRecord = async (params) => {
return await request.download({ url: `/wms/repleinsh-item-code-consume-record/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/wms/repleinsh-item-code-consume-record/get-import-template' })
}

244
src/views/wms/issueManage/repleinshItemCodeConsumeRecord/index.vue

@ -0,0 +1,244 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="RepleinshItemCodeConsumeRecord.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="RepleinshItemCodeConsumeRecord.allSchemas"
/>
<!-- 列表 -->
<ContentWrap>
<Table
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total
}"
v-model:pageSize="tableObject.pageSize"
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>
</el-button>
</template>
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" />
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="basicFormRef"
@success="formsSuccess"
:rules="RepleinshItemCodeConsumeRecordRules"
:formAllSchemas="RepleinshItemCodeConsumeRecord.allSchemas"
:apiUpdate="RepleinshItemCodeConsumeRecordApi.updateRepleinshItemCodeConsumeRecord"
:apiCreate="RepleinshItemCodeConsumeRecordApi.createRepleinshItemCodeConsumeRecord"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="RepleinshItemCodeConsumeRecord.allSchemas" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/wms/repleinsh-item-code-consume-record/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { RepleinshItemCodeConsumeRecord,RepleinshItemCodeConsumeRecordRules } from './repleinshItemCodeConsumeRecord.data'
import * as RepleinshItemCodeConsumeRecordApi from '@/api/wms/repleinshItemCodeConsumeRecord'
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: 'RepleinshItemCodeConsumeRecord' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(RepleinshItemCodeConsumeRecord.allSchemas.tableColumns)
//
const searchTableSuccess = (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: RepleinshItemCodeConsumeRecordApi.getRepleinshItemCodeConsumeRecordPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
// defaultButtons.defaultAddBtn({hasPermi:'wms:repleinshItemCodeConsumeRecord:create'}), //
// defaultButtons.defaultImportBtn({hasPermi:'wms:repleinshItemCodeConsumeRecord:import'}), //
defaultButtons.defaultExportBtn(null), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
// {
// label: '',
// name: 'zdy',
// hide: false,
// type: 'primary',
// icon: 'Select',
// color: ''
// },
]
//
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
openForm('create')
} else if (val == 'import') { //
handleImport()
} else if (val == 'export') { //
handleExport()
} else if (val == 'refresh') { //
getList()
} else if (val == 'filtrate') { //
} else { //
console.log('其他按钮', item)
}
}
// -
const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'wms:repleinshItemCodeConsumeRecord:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'wms:repleinshItemCodeConsumeRecord:delete'}), //
]
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
}
}
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row)
}
// form
const formsSuccess = async (formType,data) => {
var isHave =RepleinshItemCodeConsumeRecord.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;
if (formType === 'create') {
await RepleinshItemCodeConsumeRecordApi.createRepleinshItemCodeConsumeRecord(data)
message.success(t('common.createSuccess'))
} else {
await RepleinshItemCodeConsumeRecordApi.updateRepleinshItemCodeConsumeRecord(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
getList()
}
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basicRepleinshItemCodeConsumeRecord')
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await RepleinshItemCodeConsumeRecordApi.deleteRepleinshItemCodeConsumeRecord(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await RepleinshItemCodeConsumeRecordApi.exportRepleinshItemCodeConsumeRecord(tableObject.params)
download.excel(data, '补料消耗记录.xlsx')
} catch {
} finally {
exportLoading.value = false
}
}
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: '补料消耗记录导入模版.xlsx'
})
//
const importSuccess = () => {
getList()
}
//
const searchFormClick = (searchData) => {
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
/** 初始化 **/
onMounted(async () => {
getList()
importTemplateData.templateUrl = await RepleinshItemCodeConsumeRecordApi.importTemplate()
})
</script>

150
src/views/wms/issueManage/repleinshItemCodeConsumeRecord/repleinshItemCodeConsumeRecord.data.ts

@ -0,0 +1,150 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
// 表单校验
export const RepleinshItemCodeConsumeRecordRules = reactive({
})
export const RepleinshItemCodeConsumeRecord = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '物料代码',
field: 'itemCode',
sort: 'custom',
isSearch: true,
},
{
label: '受入号',
field: 'model',
sort: 'custom',
isSearch: true,
},
{
label: '数量',
field: 'qty',
sort: 'custom',
},
{
label: '单位',
field: 'uom',
sort: 'custom',
},
{
label: '车间代码',
field: 'workshop',
sort: 'custom',
},
{
label: '产线代码',
field: 'productionLine',
sort: 'custom',
},
{
label: '工位',
field: 'workstationCode',
sort: 'custom',
},
{
label: '从库位代码',
field: 'fromLocationCode',
sort: 'custom',
},
{
label: '到库位代码',
field: 'toLocationCode',
sort: 'custom',
},
{
label: '是否生成',
field: 'isGenerate',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch:true,
isTable: true,
sort: 'custom',
table: {
width: 150
},
},
{
label: '消耗时间',
field: 'consumeTime',
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: 'businessType',
sort: 'custom',
},
{
label: 'ERP库区类型',
field: 'erpAreaType',
sort: 'custom',
isSearch: true,
form: {
component: 'SelectV2'
},
},
{
label: '发料记录号',
field: 'issueRecordNumber',
sort: 'custom',
isSearch: true,
},
{
label: '备注',
field: 'remark',
sort: 'custom',
},
// {
// label: '是否可用默认TRUE',
// field: 'available',
// sort: 'custom',
// },
{
label: '创建时间',
field: 'createTime',
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
table: {
width: 180
},
hiddenInMain: true,
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x'
}
}
},
// {
// label: '操作',
// field: 'action',
// isForm: false,
// table: {
// width: 150,
// fixed: 'right'
// }
// }
]))
Loading…
Cancel
Save