| | |
| | | VITE_GLOB_API_URL=/prod-api |
| | | |
| | | # å
¨å±å å¯å¼å
³(å³å¼å¯äºå è§£å¯åè½æä¼çæ 䏿¯å
¨é¨æ¥å£å å¯ éè¦åå端对åº) |
| | | VITE_GLOB_ENABLE_ENCRYPT=true |
| | | VITE_GLOB_ENABLE_ENCRYPT=false |
| | | # RSAå
¬é¥ 请æ±å å¯ä½¿ç¨ 注æè¿ä¸¤ä¸ªæ¯ä¸¤å¯¹RSAå
¬ç§é¥ 请æ±å å¯-åç«¯è§£å¯æ¯ä¸å¯¹ ååºè§£å¯-å端å 坿¯ä¸å¯¹ |
| | | VITE_GLOB_RSA_PUBLIC_KEY=MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKoR8mX0rGKLqzcWmOzbfj64K8ZIgOdHnzkXSOVOZbFu/TJhZ7rFAN+eaGkl3C4buccQd/EjEsj9ir7ijT7h96MCAwEAAQ== |
| | | # RSAç§é¥ ååºè§£å¯ä½¿ç¨ 注æè¿ä¸¤ä¸ªæ¯ä¸¤å¯¹RSAå
¬ç§é¥ 请æ±å å¯-åç«¯è§£å¯æ¯ä¸å¯¹ ååºè§£å¯-å端å 坿¯ä¸å¯¹ |
| | |
| | | VITE_GLOB_APP_CLIENT_ID=e5cd7e4891bf95d1d19206ce24a7b32e |
| | | |
| | | # å¼å¯SSE |
| | | VITE_GLOB_SSE_ENABLE=true |
| | | VITE_GLOB_SSE_ENABLE=false |
| | | |
| | |
| | | chargeUser: number; |
| | | |
| | | /** |
| | | * ç»åé¨é¨ |
| | | */ |
| | | chargeDept: number; |
| | | |
| | | /** |
| | | * å·¥åç±»åï¼1-å
¥åºå 2-åºåºåï¼ åå
¸ |
| | | */ |
| | | type: string; |
| | |
| | | * 夿³¨ |
| | | */ |
| | | remark: string; |
| | | /** |
| | | * åºå
¥åºéæ©çå¤ä»¶å表 |
| | | */ |
| | | spareList: any; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { IDS, PageQuery, PageResult } from '#/api/common'; |
| | | import type { SpareInoutdtVO } from '#/api/eims/spare-inoutdt/model'; |
| | | |
| | | import { commonExport } from '#/api/helper'; |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | enum Api { |
| | | root = '/eims/spareInoutdt', |
| | | spareInoutdtExport = '/eims/spareInoutdt/export', |
| | | spareInoutdtList = '/eims/spareInoutdt/list' |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ãå¤ä»¶åºå
¥åºæç»ãå表 |
| | | * @param query |
| | | * @returns {*} |
| | | */ |
| | | |
| | | export function listSpareInoutdt(params?: PageQuery) { |
| | | return requestClient.get<PageResult<SpareInoutdtVO>>(Api.spareInoutdtList, { params }); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ãå¤ä»¶åºå
¥åºæç»ãè¯¦ç» |
| | | * @param spareInoutdtId |
| | | */ |
| | | export function getSpareInoutdt(spareInoutdtId: any) { |
| | | return requestClient.get<SpareInoutdtVO>(`${Api.root}/${spareInoutdtId}`); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢ãå¤ä»¶åºå
¥åºæç»ã |
| | | * @param data |
| | | */ |
| | | export function addSpareInoutdt(data: any) { |
| | | return requestClient.postWithMsg<void>(Api.root, data); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ãå¤ä»¶åºå
¥åºæç»ã |
| | | * @param data |
| | | */ |
| | | export function updateSpareInoutdt(data: any) { |
| | | return requestClient.putWithMsg<void>(Api.root, data); |
| | | } |
| | | |
| | | /** |
| | | * å é¤ãå¤ä»¶åºå
¥åºæç»ã |
| | | * @param spareInoutdtIds |
| | | */ |
| | | export function delSpareInoutdt(spareInoutdtIds: IDS) { |
| | | return requestClient.deleteWithMsg<void>(`${Api.root}/${spareInoutdtIds}`); |
| | | } |
| | | |
| | | /** |
| | | * 导åºãå¤ä»¶åºå
¥åºæç»ã |
| | | * @param data |
| | | */ |
| | | export function spareInoutdtExport(data: any) { |
| | | return commonExport(Api.spareInoutdtExport, data); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | export interface SpareInoutdtVO { |
| | | /** |
| | | * |
| | | */ |
| | | id: number | string; |
| | | |
| | | /** |
| | | * åºåºåæå
¥åºåid |
| | | */ |
| | | inoutId: number | string; |
| | | |
| | | /** |
| | | * å¤ä»¶id |
| | | */ |
| | | spareId: number | string; |
| | | |
| | | /** |
| | | * ä¹ååºå |
| | | */ |
| | | beforeStock: number; |
| | | |
| | | /** |
| | | * å®é
åºå |
| | | */ |
| | | actualStock: number; |
| | | |
| | | /** |
| | | * æ°é |
| | | */ |
| | | quantity: number; |
| | | |
| | | /** |
| | | * åä»· |
| | | */ |
| | | unitPrice: number; |
| | | |
| | | /** |
| | | * éé¢ |
| | | */ |
| | | amount: number; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | remark: string; |
| | | } |
| | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | enum Api { |
| | | inoutList = '/eims/spare/listInout', |
| | | root = '/eims/spare', |
| | | spareExport = '/eims/spare/export', |
| | | spareList = '/eims/spare/list' |
| | |
| | | return requestClient.get<PageResult<SpareVO>>(Api.spareList, { params }); |
| | | } |
| | | |
| | | export function listInout(params?: PageQuery) { |
| | | return requestClient.get<PageResult<any>>(Api.inoutList, { params }); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ãå¤ä»¶å°è´¦ãè¯¦ç» |
| | | * @param spareId |
| | |
| | | const columns = props?.columns?.filter((i) => i.field !== 'action'); |
| | | |
| | | const gridOptions: VxeGridProps = { |
| | | size: 'mini', |
| | | checkboxConfig: { |
| | | // é«äº® |
| | | highlight: true, |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <script setup lang="ts"> |
| | | import type { VxeGridProps } from '#/adapter/vxe-table'; |
| | | |
| | | import { ref } from 'vue'; |
| | | |
| | | import { useVbenModal } from '@vben/common-ui'; |
| | | import { DictEnum } from '@vben/constants'; |
| | | |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | import { renderDict } from '#/utils/render'; |
| | | import InnerView from '#/views/eims/spare/index.vue'; |
| | | |
| | | const emit = defineEmits<{ updateSelect: [any] }>(); |
| | | |
| | | const [BasicModal, modalApi] = useVbenModal({ |
| | | fullscreenButton: false, |
| | | draggable: true, |
| | | onCancel: handleCancel, |
| | | onConfirm: handleConfirm |
| | | }); |
| | | const innerView = ref(); |
| | | |
| | | async function handleConfirm() { |
| | | try { |
| | | modalApi.modalLoading(true); |
| | | const tableSelect = innerView.value.tableSelect(); |
| | | const eList = tableSelect.filter((item: any) => !item.actualStock && item.actualStock <= 0); |
| | | // æ£æµéæ©çå¤ä»¶åºåæ¯å¦æ£å¸¸ |
| | | if (eList.length > 0) { |
| | | message.error('åå¨åºåä¸è¶³å¤ä»¶ï¼è¯·éæ°éæ©'); |
| | | return false; |
| | | } |
| | | emit('updateSelect', tableSelect); |
| | | await handleCancel(); |
| | | } catch (error) { |
| | | console.error(error); |
| | | } finally { |
| | | modalApi.modalLoading(false); |
| | | } |
| | | } |
| | | |
| | | async function handleCancel() { |
| | | modalApi.close(); |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <BasicModal :fullscreen-button="true" class="w-[800px]"> |
| | | <InnerView ref="innerView" /> |
| | | </BasicModal> |
| | | </template> |
| | | |
| | | <style scoped></style> |
| | |
| | | label: 'ä¾åºå' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'openSpare', |
| | | label: 'éæ©å¤ä»¶', |
| | | formItemClass: 'col-span-1 w-[80px]' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'outSpareList', |
| | | label: '' |
| | | }, |
| | | { |
| | | component: 'TreeSelect', |
| | | // å¨draweréæ´æ° è¿éä¸éè¦é»è®¤çcomponentProps |
| | | defaultValue: undefined, |
| | |
| | | <script setup lang="ts"> |
| | | import type { Recordable } from '@vben/types'; |
| | | |
| | | import { onMounted } from 'vue'; |
| | | import { onMounted, ref } from 'vue'; |
| | | |
| | | import { Page, useVbenDrawer, type VbenFormProps } from '@vben/common-ui'; |
| | | import { $t } from '@vben/locales'; |
| | |
| | | |
| | | import { columns, querySchema } from './data'; |
| | | import drawer from './spare-in-drawer.vue'; |
| | | import { columns as inoutCol } from '#/views/eims/spare-inoutdt/data'; |
| | | import { listSpareInoutdt } from '#/api/eims/spare-inoutdt'; |
| | | import BasisSubTable from '#/views/eims/components/basis-sub-table.vue'; |
| | | |
| | | const formOptions: VbenFormProps = { |
| | | commonConfig: { |
| | |
| | | }, |
| | | id: 'spre-inout-index' |
| | | }; |
| | | |
| | | const inoutId = ref<string>(); |
| | | const [BasicTable, tableApi] = useVbenVxeGrid({ |
| | | formOptions, |
| | | gridOptions, |
| | | gridEvents: { |
| | | sortChange: (sortParams) => vxeSortEvent(tableApi, sortParams) |
| | | sortChange: (sortParams) => vxeSortEvent(tableApi, sortParams), |
| | | cellClick: (e: any) => { |
| | | const { row } = e; |
| | | inoutId.value = row.id; |
| | | } |
| | | } |
| | | }); |
| | | |
| | |
| | | |
| | | <template> |
| | | <Page :auto-content-height="true"> |
| | | <div class="flex h-full gap-[8px]"> |
| | | <BasicTable class="flex-1 overflow-hidden" table-title="å¤ä»¶å
¥åºåå表"> |
| | | <div class="flex h-full gap-[8px] flex-col"> |
| | | <BasicTable class="h-2/3" table-title="å¤ä»¶å
¥åºåå表"> |
| | | <template #toolbar-tools> |
| | | <Space> |
| | | <a-button v-access:code="['eims:spareInout:export']" @click="handleDownloadExcel"> |
| | |
| | | </Space> |
| | | </template> |
| | | </BasicTable> |
| | | <BasisSubTable |
| | | :columns="inoutCol" |
| | | :list-api="listSpareInoutdt" |
| | | :req-value="inoutId" |
| | | class="h-1/3" |
| | | req-key="inoutId" |
| | | title="å
¥åºæç»" |
| | | /> |
| | | </div> |
| | | <Drawer @reload="tableApi.query()" /> |
| | | </Page> |
| | |
| | | <script setup lang="ts"> |
| | | import { computed, ref } from 'vue'; |
| | | |
| | | import { useVbenDrawer } from '@vben/common-ui'; |
| | | import { useVbenDrawer, useVbenModal } from '@vben/common-ui'; |
| | | import { $t } from '@vben/locales'; |
| | | import { addFullName, cloneDeep, getPopupContainer } from '@vben/utils'; |
| | | |
| | |
| | | |
| | | import { drawerSchema } from './data'; |
| | | import CodeInput from '#/views/eims/components/code-input.vue'; |
| | | import spareModal from '#/views/eims/components/spare-modal.vue'; |
| | | import SelectSpareTable from '#/views/eims/spare-out/select-spare-table.vue'; |
| | | import { message } from 'ant-design-vue'; |
| | | import type { VxeGridProps } from '#/adapter/vxe-table'; |
| | | import { renderDict } from '#/utils/render'; |
| | | import { DictEnum } from '@vben/constants'; |
| | | /** |
| | | * åºåºåéæ©çå¤ä»¶æ°æ® |
| | | */ |
| | | const outSpareList = ref([]); |
| | | const selectSpareTable = ref(); |
| | | const outCol: VxeGridProps['columns'] = [ |
| | | { |
| | | field: 'action', |
| | | slots: { default: 'action' }, |
| | | title: 'å é¤', |
| | | width: 60 |
| | | }, |
| | | { |
| | | title: 'å¤ä»¶åç§°', |
| | | field: 'name', |
| | | width: 180 |
| | | }, |
| | | { |
| | | title: 'å¤ä»¶ç¼ç ', |
| | | field: 'code', |
| | | width: 120 |
| | | }, |
| | | { |
| | | title: 'å¤ä»¶åå·', |
| | | field: 'modelNo', |
| | | width: 100 |
| | | }, |
| | | { |
| | | title: '计éåä½', |
| | | field: 'unit', |
| | | slots: { |
| | | default: ({ row }) => { |
| | | if (!row.unit || row.unit === '') { |
| | | return ''; |
| | | } |
| | | return renderDict(row.unit, DictEnum.EIMS_SPARE_UNIT); |
| | | } |
| | | }, |
| | | width: 80 |
| | | }, |
| | | |
| | | { |
| | | title: 'å®é
åºå', |
| | | field: 'actualStock', |
| | | width: 100 |
| | | }, |
| | | { |
| | | title: 'æ°é', |
| | | field: 'quantity', |
| | | editRender: { |
| | | name: 'input' |
| | | }, |
| | | width: 80 |
| | | }, |
| | | { |
| | | title: 'åèä»·', |
| | | field: 'referPrice', |
| | | width: 90 |
| | | } |
| | | ]; |
| | | const emit = defineEmits<{ reload: [] }>(); |
| | | |
| | | const isUpdate = ref(false); |
| | |
| | | if (!isOpen) { |
| | | return null; |
| | | } |
| | | outSpareList.value = []; |
| | | drawerApi.drawerLoading(true); |
| | | const { id } = drawerApi.getData() as { id?: number | string }; |
| | | isUpdate.value = !!id; |
| | |
| | | if (isUpdate.value && id) { |
| | | const record = await getSpareInout(id); |
| | | await formApi.setValues(record); |
| | | outSpareList.value = record?.spareList; |
| | | if (isUpdate.value && record.chargeDept) { |
| | | await setupUserOptions(record.chargeDept); |
| | | } |
| | | } |
| | | |
| | | drawerApi.drawerLoading(false); |
| | |
| | | if (!valid) { |
| | | return; |
| | | } |
| | | const selectSpareList = selectSpareTable.value.tableData(); |
| | | // æ£æµæ¯å¦è¾å
¥åºåºæ°é |
| | | const eList = selectSpareList.filter((item: any) => !item.quantity || item.quantity <= 0); |
| | | if (selectSpareList.length<= 0 || eList.length > 0) { |
| | | message.error('å
¥åºæ°é为空ï¼è¯·æ£æ¥ï¼'); |
| | | return false; |
| | | } |
| | | const data = cloneDeep(await formApi.getValues()); |
| | | data.spareList = selectSpareList; |
| | | await (isUpdate.value ? updateSpareInout(data) : addSpareInout(data)); |
| | | emit('reload'); |
| | | await handleCancel(); |
| | |
| | | drawerApi.close(); |
| | | await formApi.resetForm(); |
| | | } |
| | | |
| | | // å¤ä»¶modal |
| | | const [SpareModal, spareModalApi] = useVbenModal({ |
| | | connectedComponent: spareModal, |
| | | draggable: true, |
| | | title: 'éæ©å¤ä»¶' |
| | | }); |
| | | |
| | | function handleSpareModal() { |
| | | spareModalApi.setData({}); |
| | | spareModalApi.open(); |
| | | } |
| | | |
| | | /** |
| | | * éæ©çå¤ä»¶ |
| | | * @param spareList |
| | | */ |
| | | function selectSpare(spareList: any) { |
| | | outSpareList.value = spareList; |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <BasicDrawer :close-on-click-modal="false" :title="title" class="w-[600px]"> |
| | | <BasicDrawer :close-on-click-modal="false" :title="title" class="w-[1000px]"> |
| | | <BasicForm> |
| | | <template #orderCode="slotProps"> |
| | | <CodeInput v-bind="slotProps" :disabled="isUpdate" prefix="RK" /> |
| | | </template> |
| | | <template #openSpare="slotProps"> |
| | | <a-button type="primary" v-bind="slotProps" :disabled="isUpdate" @click.stop="handleSpareModal">æ·»å å¤ä»¶</a-button> |
| | | </template> |
| | | <template #outSpareList> |
| | | <SelectSpareTable ref="selectSpareTable" :columns="outCol" :data="outSpareList" :is-update="isUpdate" /> |
| | | </template> |
| | | </BasicForm> |
| | | |
| | | <SpareModal class="w-[1200px]" @update-select="selectSpare" /> |
| | | </BasicDrawer> |
| | | </template> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { VxeGridProps } from '#/adapter/vxe-table'; |
| | | |
| | | import { type FormSchemaGetter } from '#/adapter/form'; |
| | | import { renderDict } from '#/utils/render'; |
| | | import { DictEnum } from '@vben/constants'; |
| | | export const querySchema: FormSchemaGetter = () => []; |
| | | |
| | | export const columns: VxeGridProps['columns'] = [ |
| | | { type: 'checkbox', width: 60, fixed: 'left' }, |
| | | { |
| | | title: 'å¤ä»¶åç§°', |
| | | field: 'spareName', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | title: 'å¤ä»¶ç¼å·', |
| | | field: 'spareCode', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | title: 'è§æ ¼åå·', |
| | | field: 'modelNo', |
| | | minWidth: 100 |
| | | }, |
| | | { |
| | | title: '计éåä½', |
| | | field: 'unit', |
| | | sortable: true, |
| | | slots: { |
| | | default: ({ row }) => { |
| | | if (!row.unit || row.unit === '') { |
| | | return ''; |
| | | } |
| | | return renderDict(row.unit, DictEnum.EIMS_SPARE_UNIT); |
| | | } |
| | | }, |
| | | width: 100 |
| | | }, |
| | | { |
| | | title: 'ä¹ååºå', |
| | | field: 'beforeStock', |
| | | minWidth: 100 |
| | | }, |
| | | { |
| | | title: 'å½ååºå', |
| | | field: 'actualStock', |
| | | minWidth: 100 |
| | | }, |
| | | { |
| | | title: 'æ°é', |
| | | field: 'quantity', |
| | | minWidth: 80 |
| | | }, |
| | | { |
| | | title: 'åä»·', |
| | | field: 'unitPrice', |
| | | minWidth: 80 |
| | | }, |
| | | { |
| | | title: 'éé¢', |
| | | field: 'amount', |
| | | minWidth: 80 |
| | | } |
| | | ]; |
| | | export const drawerSchema: FormSchemaGetter = () => []; |
| | |
| | | } |
| | | ]; |
| | | |
| | | |
| | | |
| | | export const drawerSchema: FormSchemaGetter = () => [ |
| | | { |
| | | component: 'Input', |
| | |
| | | label: '客æ·' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'openSpare', |
| | | label: 'éæ©å¤ä»¶', |
| | | formItemClass: 'col-span-1 w-[80px]' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'outSpareList', |
| | | label: '' |
| | | }, |
| | | { |
| | | component: 'TreeSelect', |
| | | // å¨draweréæ´æ° è¿éä¸éè¦é»è®¤çcomponentProps |
| | | defaultValue: undefined, |
| | |
| | | <script setup lang="ts"> |
| | | import type { Recordable } from '@vben/types'; |
| | | |
| | | import { onMounted } from 'vue'; |
| | | import { onMounted, ref } from 'vue'; |
| | | |
| | | import { Page, useVbenDrawer, type VbenFormProps } from '@vben/common-ui'; |
| | | import { $t } from '@vben/locales'; |
| | |
| | | |
| | | import { columns, querySchema } from './data'; |
| | | import drawer from './spare-out-drawer.vue'; |
| | | import { columns as inoutCol } from '#/views/eims/spare-inoutdt/data'; |
| | | import { listSpareInoutdt } from '#/api/eims/spare-inoutdt'; |
| | | import BasisSubTable from '#/views/eims/components/basis-sub-table.vue'; |
| | | |
| | | const formOptions: VbenFormProps = { |
| | | commonConfig: { |
| | |
| | | }, |
| | | id: 'spre-inout-index' |
| | | }; |
| | | |
| | | const inoutId = ref<string>(); |
| | | const [BasicTable, tableApi] = useVbenVxeGrid({ |
| | | formOptions, |
| | | gridOptions, |
| | | gridEvents: { |
| | | sortChange: (sortParams) => vxeSortEvent(tableApi, sortParams) |
| | | sortChange: (sortParams) => vxeSortEvent(tableApi, sortParams), |
| | | cellClick: (e: any) => { |
| | | const { row } = e; |
| | | inoutId.value = row.id; |
| | | } |
| | | } |
| | | }); |
| | | |
| | |
| | | |
| | | <template> |
| | | <Page :auto-content-height="true"> |
| | | <div class="flex h-full gap-[8px]"> |
| | | <BasicTable class="flex-1 overflow-hidden" table-title="å¤ä»¶åºåºåå表"> |
| | | <div class="flex h-full gap-[8px] flex-col"> |
| | | <BasicTable class="h-2/3" table-title="å¤ä»¶åºåºåå表"> |
| | | <template #toolbar-tools> |
| | | <Space> |
| | | <a-button v-access:code="['eims:spareInout:export']" @click="handleDownloadExcel"> |
| | |
| | | </Space> |
| | | </template> |
| | | </BasicTable> |
| | | <BasisSubTable |
| | | :columns="inoutCol" |
| | | :list-api="listSpareInoutdt" |
| | | :req-value="inoutId" |
| | | class="h-1/3" |
| | | req-key="inoutId" |
| | | title="åºåºæç»" |
| | | /> |
| | | </div> |
| | | <Drawer @reload="tableApi.query()" /> |
| | | </Page> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <script setup lang="ts"> |
| | | import type { Recordable } from '@vben/types'; |
| | | |
| | | import { reactive, ref, watch } from 'vue'; |
| | | |
| | | import { $t } from '@vben/locales'; |
| | | import { getVxePopupContainer } from '@vben/utils'; |
| | | |
| | | import { Popconfirm, Space } from 'ant-design-vue'; |
| | | |
| | | import { useVbenVxeGrid, type VxeGridProps, vxeSortEvent } from '#/adapter/vxe-table'; |
| | | |
| | | |
| | | interface Props { |
| | | title?: string; |
| | | columns?: VxeGridProps['columns']; |
| | | data: any; |
| | | isUpdate?: boolean; |
| | | } |
| | | const props = defineProps<Props>(); |
| | | |
| | | const responsiveData = reactive(props.data); |
| | | defineExpose({ |
| | | tableData |
| | | }); |
| | | |
| | | watch( |
| | | () => props.data, |
| | | (data) => { |
| | | responsiveData.splice(0, responsiveData.length, ...data); |
| | | } |
| | | ); |
| | | |
| | | const gridOptions: VxeGridProps = { |
| | | checkboxConfig: { |
| | | // é«äº® |
| | | highlight: true, |
| | | // 翻页æ¶ä¿çéä¸ç¶æ |
| | | reserve: true |
| | | // ç¹å»è¡éä¸ |
| | | // trigger: 'row' |
| | | }, |
| | | columns: props.columns, |
| | | height: 'auto', |
| | | keepSource: true, |
| | | data: responsiveData, |
| | | pagerConfig: { |
| | | enabled: false |
| | | }, |
| | | toolbarConfig: { |
| | | enabled: false |
| | | }, |
| | | rowConfig: { |
| | | isHover: true, |
| | | keyField: 'id' |
| | | }, |
| | | sortConfig: { |
| | | // è¿ç¨æåº |
| | | remote: true, |
| | | // æ¯æå¤å段æåº é»è®¤å
³é |
| | | multiple: true |
| | | }, |
| | | editConfig: { |
| | | mode: 'cell', |
| | | trigger: 'click' |
| | | }, |
| | | id: 'local-table' |
| | | }; |
| | | |
| | | const [BasicTable, tableApi] = useVbenVxeGrid({ |
| | | gridOptions, |
| | | gridEvents: { |
| | | sortChange: (sortParams) => vxeSortEvent(tableApi, sortParams) |
| | | } |
| | | }); |
| | | |
| | | function handleDelete(row: Recordable<any>) { |
| | | const index = responsiveData.findIndex((item: any) => item.id === row.id); |
| | | if (index !== -1) { |
| | | responsiveData.splice(index, 1); |
| | | } |
| | | } |
| | | // é䏿°æ® |
| | | function tableData() { |
| | | return tableApi.grid.getData(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * TODO åç»æ©å±ç¹å»äºä»¶ |
| | | */ |
| | | const slotName = ref<string>('equName'); |
| | | </script> |
| | | |
| | | <template> |
| | | <div class="w-full h-min"> |
| | | <BasicTable :table-title="title" size="small"> |
| | | <template #[slotName]="{ row }"> |
| | | <Space> |
| | | <span>{{ row[slotName] }}</span> |
| | | </Space> |
| | | </template> |
| | | |
| | | <template #action="{ row }"> |
| | | <Space> |
| | | <Popconfirm :get-popup-container="getVxePopupContainer" placement="left" title="确认å é¤ï¼" @confirm="handleDelete(row)"> |
| | | <ghost-button :disabled="isUpdate" danger @click.stop=""> |
| | | {{ $t('pages.common.delete') }} |
| | | </ghost-button> |
| | | </Popconfirm> |
| | | </Space> |
| | | </template> |
| | | </BasicTable> |
| | | </div> |
| | | </template> |
| | | |
| | | <style lang="scss" scoped> |
| | | :deep(.p-2) { |
| | | padding: 0; |
| | | } |
| | | </style> |
| | |
| | | <script setup lang="ts"> |
| | | import type { VxeGridProps } from '#/adapter/vxe-table'; |
| | | |
| | | import { computed, ref } from 'vue'; |
| | | |
| | | import { useVbenDrawer } from '@vben/common-ui'; |
| | | import { useVbenDrawer, useVbenModal } from '@vben/common-ui'; |
| | | import { DictEnum } from '@vben/constants'; |
| | | import { $t } from '@vben/locales'; |
| | | import { addFullName, cloneDeep, getPopupContainer } from '@vben/utils'; |
| | | |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { addSpareInout, getSpareInout, updateSpareInout } from '#/api/eims/spare-inout'; |
| | | import { getDeptTree, userList } from '#/api/system/user'; |
| | | import { renderDict } from '#/utils/render'; |
| | | import CodeInput from '#/views/eims/components/code-input.vue'; |
| | | import spareModal from '#/views/eims/components/spare-modal.vue'; |
| | | |
| | | import { drawerSchema } from './data'; |
| | | import CodeInput from '#/views/eims/components/code-input.vue'; |
| | | import SelectSpareTable from './select-spare-table.vue'; |
| | | |
| | | const emit = defineEmits<{ reload: [] }>(); |
| | | |
| | | /** |
| | | * åºåºåéæ©çå¤ä»¶æ°æ® |
| | | */ |
| | | const outSpareList = ref([]); |
| | | const selectSpareTable = ref(); |
| | | |
| | | const outCol: VxeGridProps['columns'] = [ |
| | | { |
| | | field: 'action', |
| | | slots: { default: 'action' }, |
| | | title: 'å é¤', |
| | | width: 60 |
| | | }, |
| | | { |
| | | title: 'å¤ä»¶åç§°', |
| | | field: 'name', |
| | | width: 180 |
| | | }, |
| | | { |
| | | title: 'å¤ä»¶ç¼ç ', |
| | | field: 'code', |
| | | width: 120 |
| | | }, |
| | | { |
| | | title: 'å¤ä»¶åå·', |
| | | field: 'modelNo', |
| | | width: 100 |
| | | }, |
| | | { |
| | | title: '计éåä½', |
| | | field: 'unit', |
| | | slots: { |
| | | default: ({ row }) => { |
| | | if (!row.unit || row.unit === '') { |
| | | return ''; |
| | | } |
| | | return renderDict(row.unit, DictEnum.EIMS_SPARE_UNIT); |
| | | } |
| | | }, |
| | | width: 80 |
| | | }, |
| | | |
| | | { |
| | | title: 'å®é
åºå', |
| | | field: 'actualStock', |
| | | width: 100 |
| | | }, |
| | | { |
| | | title: 'æ°é', |
| | | field: 'quantity', |
| | | editRender: { |
| | | name: 'input' |
| | | }, |
| | | width: 80 |
| | | }, |
| | | { |
| | | title: 'åèä»·', |
| | | field: 'referPrice', |
| | | width: 90 |
| | | } |
| | | ]; |
| | | |
| | | const isUpdate = ref(false); |
| | | const title = computed(() => { |
| | |
| | | drawerApi.drawerLoading(true); |
| | | const { id } = drawerApi.getData() as { id?: number | string }; |
| | | isUpdate.value = !!id; |
| | | outSpareList.value = []; |
| | | // åå§å |
| | | await setupDeptSelect(); |
| | | // æ´æ° && èµå¼ |
| | | if (isUpdate.value && id) { |
| | | const record = await getSpareInout(id); |
| | | await formApi.setValues(record); |
| | | // æ´æ°åºåºåçå¤ä»¶æç» |
| | | outSpareList.value = record?.spareList; |
| | | if (isUpdate.value && record.chargeDept) { |
| | | await setupUserOptions(record.chargeDept); |
| | | } |
| | | } |
| | | |
| | | drawerApi.drawerLoading(false); |
| | |
| | | /** æ ¹æ®é¨é¨IDå è½½ç¨æ· */ |
| | | await setupUserOptions(deptId); |
| | | /** åååéè¦éæ°éæ©ç¨æ· */ |
| | | formModel.operatorId = undefined; |
| | | formModel.chargeUser = undefined; |
| | | }, |
| | | placeholder: 'è¯·éæ©', |
| | | showSearch: true, |
| | |
| | | } |
| | | ]); |
| | | } |
| | | |
| | | async function handleConfirm() { |
| | | try { |
| | | drawerApi.drawerLoading(true); |
| | |
| | | if (!valid) { |
| | | return; |
| | | } |
| | | const selectSpareList = selectSpareTable.value.tableData(); |
| | | // æ£æµæ¯å¦è¾å
¥åºåºæ°é |
| | | const eList = selectSpareList.filter((item: any) => !item.quantity || item.quantity <= 0 || item.quantity > item.actualStock); |
| | | if (selectSpareList.length<= 0 ||eList.length > 0) { |
| | | message.error('åºåºæ°é为空æå¤§äºåºåï¼è¯·æ£æ¥ï¼'); |
| | | return false; |
| | | } |
| | | const data = cloneDeep(await formApi.getValues()); |
| | | data.spareList = selectSpareList; |
| | | await (isUpdate.value ? updateSpareInout(data) : addSpareInout(data)); |
| | | emit('reload'); |
| | | await handleCancel(); |
| | |
| | | drawerApi.close(); |
| | | await formApi.resetForm(); |
| | | } |
| | | |
| | | // å¤ä»¶modal |
| | | const [SpareModal, spareModalApi] = useVbenModal({ |
| | | connectedComponent: spareModal, |
| | | draggable: true, |
| | | title: 'éæ©å¤ä»¶' |
| | | }); |
| | | |
| | | function handleSpareModal() { |
| | | spareModalApi.setData({}); |
| | | spareModalApi.open(); |
| | | } |
| | | |
| | | /** |
| | | * éæ©çå¤ä»¶ |
| | | * @param spareList |
| | | */ |
| | | function selectSpare(spareList: any) { |
| | | outSpareList.value = spareList; |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <BasicDrawer :close-on-click-modal="false" :title="title" class="w-[600px]"> |
| | | <BasicDrawer :close-on-click-modal="false" :title="title" class="w-[1000px]"> |
| | | <BasicForm> |
| | | <template #orderCode="slotProps"> |
| | | <CodeInput v-bind="slotProps" :disabled="isUpdate" prefix="CK" /> |
| | | </template> |
| | | |
| | | <template #openSpare="slotProps"> |
| | | <a-button type="primary" v-bind="slotProps" :disabled="isUpdate" @click.stop="handleSpareModal">æ·»å å¤ä»¶</a-button> |
| | | </template> |
| | | |
| | | <template #outSpareList> |
| | | <SelectSpareTable ref="selectSpareTable" :columns="outCol" :data="outSpareList" :is-update="isUpdate" /> |
| | | </template> |
| | | </BasicForm> |
| | | <SpareModal class="w-[1200px]" @update-select="selectSpare" /> |
| | | </BasicDrawer> |
| | | </template> |
| | |
| | | import type { VxeGridProps } from '#/adapter/vxe-table'; |
| | | |
| | | import { DictEnum } from '@vben/constants'; |
| | | import { getPopupContainer } from '@vben/utils'; |
| | | |
| | | import { Tag } from 'ant-design-vue'; |
| | | |
| | | import { type FormSchemaGetter } from '#/adapter/form'; |
| | | import { getDictOptions } from '#/utils/dict'; |
| | | import { renderDict } from '#/utils/render'; |
| | | import { getPopupContainer } from '@vben/utils'; |
| | | |
| | | export const querySchema: FormSchemaGetter = () => [ |
| | | { |
| | |
| | | sortable: true, |
| | | slots: { |
| | | default: ({ row }) => { |
| | | if (row.unit === null || row.unit === '') { |
| | | if (!row.unit || row.unit === '') { |
| | | return ''; |
| | | } |
| | | return renderDict(row.unit, DictEnum.EIMS_SPARE_UNIT); |
| | |
| | | } |
| | | ]; |
| | | |
| | | export const inoutCol: VxeGridProps['columns'] = [ |
| | | { |
| | | title: 'åºå
¥åºåå·', |
| | | field: 'orderCode', |
| | | width: 180 |
| | | }, |
| | | { |
| | | title: 'æ¥æ', |
| | | field: 'orderTime', |
| | | width: 180 |
| | | }, |
| | | { |
| | | title: 'æ¹å', |
| | | field: 'type1', |
| | | width: 80, |
| | | slots: { |
| | | default: ({ row }) => { |
| | | const type = row.type; |
| | | switch (type) { |
| | | case '1': { |
| | | return <Tag color="green"> å
¥åº </Tag>; |
| | | } |
| | | case '2': { |
| | | return <Tag color="blue"> åºåº </Tag>; |
| | | } |
| | | // No default |
| | | } |
| | | return ''; |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | title: 'ç±»å', |
| | | field: 'type', |
| | | width: 100, |
| | | slots: { |
| | | default: ({ row }) => { |
| | | if (!row.type || row.type === '') { |
| | | return ''; |
| | | } |
| | | return renderDict(row.type, DictEnum.SPARE_INOUT_TYPE); |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | title: 'å
¥åº', |
| | | field: 'inQuantity', |
| | | width: 120, |
| | | slots: { |
| | | default: ({ row }) => { |
| | | return row.type && row.type === '1' ? row.quantity : ''; |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | title: 'åºåº', |
| | | field: 'outQuantity', |
| | | width: 120, |
| | | slots: { |
| | | default: ({ row }) => { |
| | | return row.type && row.type === '2' ? row.quantity : ''; |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | title: 'åºå', |
| | | field: 'actualStock', |
| | | width: 80 |
| | | }, |
| | | { |
| | | title: 'åä»·', |
| | | field: 'unitPrice', |
| | | width: 80 |
| | | }, |
| | | { |
| | | title: 'éé¢', |
| | | field: 'amount', |
| | | width: 80 |
| | | } |
| | | ]; |
| | | |
| | | export const drawerSchema: FormSchemaGetter = () => [ |
| | | { |
| | | component: 'Input', |
| | |
| | | show: () => false, |
| | | triggerFields: ['imgUrl'] |
| | | }, |
| | | label: 'å¤ä»¶é¢è§', |
| | | label: 'å¤ä»¶é¢è§' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | |
| | | import { Image, Modal, Popconfirm, Space } from 'ant-design-vue'; |
| | | |
| | | import { useVbenVxeGrid, vxeCheckboxChecked, type VxeGridProps, vxeSortEvent } from '#/adapter/vxe-table'; |
| | | import { delSpare, listSpare, spareExport } from '#/api/eims/spare'; |
| | | import { delSpare, listInout, listSpare, spareExport } from '#/api/eims/spare'; |
| | | import { configInfoByKey } from '#/api/system/config'; |
| | | import { commonDownloadExcel } from '#/utils/file/download'; |
| | | import BasisSubTable from '#/views/eims/components/basis-sub-table.vue'; |
| | | |
| | | import { columns, querySchema } from './data'; |
| | | import { columns, inoutCol, querySchema } from './data'; |
| | | import spareDrawer from './spare-drawer.vue'; |
| | | import SpareTypeTree from './spare-type-tree.vue'; |
| | | |
| | |
| | | height: 'auto', |
| | | keepSource: true, |
| | | pagerConfig: { |
| | | enabled: false, |
| | | enabled: false |
| | | }, |
| | | proxyConfig: { |
| | | enabled: true, |
| | |
| | | keyField: 'id' |
| | | }, |
| | | columnConfig: { |
| | | resizable: true, |
| | | resizable: true |
| | | }, |
| | | sortConfig: { |
| | | // è¿ç¨æåº |
| | |
| | | }, |
| | | id: 'eims-spare-index' |
| | | }; |
| | | |
| | | const id = ref<string>(); |
| | | const [BasicTable, tableApi] = useVbenVxeGrid({ |
| | | formOptions, |
| | | gridOptions, |
| | | gridEvents: { |
| | | sortChange: (sortParams) => vxeSortEvent(tableApi, sortParams) |
| | | sortChange: (sortParams) => vxeSortEvent(tableApi, sortParams), |
| | | cellClick: (e: any) => { |
| | | const { row } = e; |
| | | id.value = row.id; |
| | | } |
| | | } |
| | | }); |
| | | |
| | |
| | | <Page :auto-content-height="true"> |
| | | <div class="flex h-full gap-[8px]"> |
| | | <SpareTypeTree v-model:select-type-id="selectTypeId" class="w-[260px]" @reload="() => tableApi.reload()" @select="() => tableApi.reload()" /> |
| | | <BasicTable class="flex-1 overflow-hidden" table-title="å¤ä»¶å°è´¦"> |
| | | <template #toolbar-tools> |
| | | <Space> |
| | | <a-button v-access:code="['eims:spare:export']" @click="handleDownloadExcel"> |
| | | {{ $t('pages.common.export') }} |
| | | </a-button> |
| | | <a-button |
| | | :disabled="!vxeCheckboxChecked(tableApi)" |
| | | danger |
| | | type="primary" |
| | | v-access:code="['eims:spare:remove']" |
| | | @click="handleMultiDelete" |
| | | > |
| | | {{ $t('pages.common.delete') }} |
| | | </a-button> |
| | | <a-button type="primary" v-access:code="['eims:spare:add']" @click="handleAdd"> |
| | | {{ $t('pages.common.add') }} |
| | | </a-button> |
| | | </Space> |
| | | </template> |
| | | <div class="flex-1 overflow-hidden"> |
| | | <div class="flex h-full gap-[8px] flex-col"> |
| | | <BasicTable class="h-2/3" table-title="å¤ä»¶å°è´¦"> |
| | | <template #toolbar-tools> |
| | | <Space> |
| | | <a-button v-access:code="['eims:spare:export']" @click="handleDownloadExcel"> |
| | | {{ $t('pages.common.export') }} |
| | | </a-button> |
| | | <a-button |
| | | :disabled="!vxeCheckboxChecked(tableApi)" |
| | | danger |
| | | type="primary" |
| | | v-access:code="['eims:spare:remove']" |
| | | @click="handleMultiDelete" |
| | | > |
| | | {{ $t('pages.common.delete') }} |
| | | </a-button> |
| | | <a-button type="primary" v-access:code="['eims:spare:add']" @click="handleAdd"> |
| | | {{ $t('pages.common.add') }} |
| | | </a-button> |
| | | </Space> |
| | | </template> |
| | | |
| | | <template #imgUrl="{ row }"> |
| | | <Image v-if="preview && isImageFile(row.imgUrl)" :src="row.imgUrl" height="38px" /> |
| | | <span v-else>{{ row.imgUrl }}</span> |
| | | </template> |
| | | <template #imgUrl="{ row }"> |
| | | <Image v-if="preview && isImageFile(row.imgUrl)" :src="row.imgUrl" height="38px" /> |
| | | <span v-else>{{ row.imgUrl }}</span> |
| | | </template> |
| | | |
| | | <template #action="{ row }"> |
| | | <Space> |
| | | <ghost-button v-access:code="['eims:spare:edit']" @click.stop="handleEdit(row)"> |
| | | {{ $t('pages.common.edit') }} |
| | | </ghost-button> |
| | | <Popconfirm :get-popup-container="getVxePopupContainer" placement="left" title="确认å é¤ï¼" @confirm="handleDelete(row)"> |
| | | <ghost-button danger v-access:code="['eims:spare:remove']" @click.stop=""> |
| | | {{ $t('pages.common.delete') }} |
| | | </ghost-button> |
| | | </Popconfirm> |
| | | </Space> |
| | | </template> |
| | | </BasicTable> |
| | | <template #action="{ row }"> |
| | | <Space> |
| | | <ghost-button v-access:code="['eims:spare:edit']" @click.stop="handleEdit(row)"> |
| | | {{ $t('pages.common.edit') }} |
| | | </ghost-button> |
| | | <Popconfirm :get-popup-container="getVxePopupContainer" placement="left" title="确认å é¤ï¼" @confirm="handleDelete(row)"> |
| | | <ghost-button danger v-access:code="['eims:spare:remove']" @click.stop=""> |
| | | {{ $t('pages.common.delete') }} |
| | | </ghost-button> |
| | | </Popconfirm> |
| | | </Space> |
| | | </template> |
| | | </BasicTable> |
| | | <BasisSubTable :columns="inoutCol" :list-api="listInout" :req-value="id" class="h-1/3" req-key="id" title="åºå
¥åºæç»" /> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <SpareDrawer @reload="tableApi.query()" /> |
| | | </Page> |
| | | </template> |
| | | |
| | | <style> |
| | | <style lang="scss" scoped> |
| | | /* ç»ä¸ææåçè¾¹æ¡åè¡é« */ |
| | | .vxe-table--body .vxe-body--row .vxe-body--column { |
| | | height: 56px !important; |
| | |
| | | driverClassName: com.mysql.cj.jdbc.Driver |
| | | # jdbc ææåæ°é
ç½®åè https://lionli.blog.csdn.net/article/details/122018562 |
| | | # rewriteBatchedStatements=true æ¹å¤çä¼å 大å¹
æåæ¹éæå
¥æ´æ°å 餿§è½(å¯¹æ°æ®åºææ§è½æè ä½¿ç¨æ¹éæä½åºèèæ§è½é®é¢) |
| | | url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true |
| | | url: jdbc:mysql://localhost:3306/eims?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true |
| | | username: root |
| | | password: root |
| | | password: 123456 |
| | | # ä»åºæ°æ®æº |
| | | slave: |
| | | lazy: true |
| | |
| | | # æ°æ®åºç´¢å¼ |
| | | database: 0 |
| | | # redis å¯ç å¿
é¡»é
ç½® |
| | | password: ruoyi123 |
| | | #password: ruoyi123 |
| | | # è¿æ¥è¶
æ¶æ¶é´ |
| | | timeout: 10s |
| | | # æ¯å¦å¼å¯ssl |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | *å¤ä»¶åºå
¥åºç±»å |
| | | */ |
| | | String SPARE_INOUT_TYPE = "spare_inout_type"; |
| | | interface SPARE_INOUT_TYPE_DETAIL { |
| | | String RK = "1";// éè´å
¥åº |
| | | String CK = "2"; // é¢ç¨åºåº |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.constraints.*; |
| | | import cn.dev33.satoken.annotation.SaCheckPermission; |
| | | import org.dromara.eims.domain.vo.EimsSpareInoutVo; |
| | | import org.dromara.eims.domain.vo.EimsSpareInoutdtVo; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.dromara.common.idempotent.annotation.RepeatSubmit; |
| | |
| | | return eimsSpareService.queryPageList(bo, pageQuery); |
| | | } |
| | | |
| | | @SaCheckPermission("eims:spare:list") |
| | | @GetMapping("/listInout") |
| | | public TableDataInfo<EimsSpareInoutdtVo> listInout(EimsSpareBo bo, PageQuery pageQuery) { |
| | | return eimsSpareService.querySpareInoutList(bo, pageQuery); |
| | | } |
| | | |
| | | /** |
| | | * 导åºå¤ä»¶å°è´¦å表 |
| | | */ |
| | |
| | | return eimsSpareInoutService.queryPageList(bo, pageQuery); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 导åºå¤ä»¶åºå
¥åºå表 |
| | | */ |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.eims.controller; |
| | | |
| | | import java.util.List; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.constraints.*; |
| | | import cn.dev33.satoken.annotation.SaCheckPermission; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.dromara.common.idempotent.annotation.RepeatSubmit; |
| | | import org.dromara.common.log.annotation.Log; |
| | | import org.dromara.common.web.core.BaseController; |
| | | import org.dromara.common.mybatis.core.page.PageQuery; |
| | | import org.dromara.common.core.domain.R; |
| | | import org.dromara.common.core.validate.AddGroup; |
| | | import org.dromara.common.core.validate.EditGroup; |
| | | import org.dromara.common.log.enums.BusinessType; |
| | | import org.dromara.common.excel.utils.ExcelUtil; |
| | | import org.dromara.eims.domain.vo.EimsSpareInoutdtVo; |
| | | import org.dromara.eims.domain.bo.EimsSpareInoutdtBo; |
| | | import org.dromara.eims.service.IEimsSpareInoutdtService; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | |
| | | /** |
| | | * å¤ä»¶åºå
¥åºæç» |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-04-11 |
| | | */ |
| | | @Validated |
| | | @RequiredArgsConstructor |
| | | @RestController |
| | | @RequestMapping("/eims/spareInoutdt") |
| | | public class EimsSpareInoutdtController extends BaseController { |
| | | |
| | | private final IEimsSpareInoutdtService eimsSpareInoutdtService; |
| | | |
| | | /** |
| | | * æ¥è¯¢å¤ä»¶åºå
¥åºæç»å表 |
| | | */ |
| | | @SaCheckPermission("eims:spareInoutdt:list") |
| | | @GetMapping("/list") |
| | | public TableDataInfo<EimsSpareInoutdtVo> list(EimsSpareInoutdtBo bo, PageQuery pageQuery) { |
| | | return eimsSpareInoutdtService.queryPageList(bo, pageQuery); |
| | | } |
| | | |
| | | /** |
| | | * 导åºå¤ä»¶åºå
¥åºæç»å表 |
| | | */ |
| | | @SaCheckPermission("eims:spareInoutdt:export") |
| | | @Log(title = "å¤ä»¶åºå
¥åºæç»", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(EimsSpareInoutdtBo bo, HttpServletResponse response) { |
| | | List<EimsSpareInoutdtVo> list = eimsSpareInoutdtService.queryList(bo); |
| | | ExcelUtil.exportExcel(list, "å¤ä»¶åºå
¥åºæç»", EimsSpareInoutdtVo.class, response); |
| | | } |
| | | |
| | | /** |
| | | * è·åå¤ä»¶åºå
¥åºæç»è¯¦ç»ä¿¡æ¯ |
| | | * |
| | | * @param id ä¸»é® |
| | | */ |
| | | @SaCheckPermission("eims:spareInoutdt:query") |
| | | @GetMapping("/{id}") |
| | | public R<EimsSpareInoutdtVo> getInfo(@NotNull(message = "主é®ä¸è½ä¸ºç©º") |
| | | @PathVariable Long id) { |
| | | return R.ok(eimsSpareInoutdtService.queryById(id)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢å¤ä»¶åºå
¥åºæç» |
| | | */ |
| | | @SaCheckPermission("eims:spareInoutdt:add") |
| | | @Log(title = "å¤ä»¶åºå
¥åºæç»", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping() |
| | | public R<Void> add(@Validated(AddGroup.class) @RequestBody EimsSpareInoutdtBo bo) { |
| | | return toAjax(eimsSpareInoutdtService.insertByBo(bo)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹å¤ä»¶åºå
¥åºæç» |
| | | */ |
| | | @SaCheckPermission("eims:spareInoutdt:edit") |
| | | @Log(title = "å¤ä»¶åºå
¥åºæç»", businessType = BusinessType.UPDATE) |
| | | @RepeatSubmit() |
| | | @PutMapping() |
| | | public R<Void> edit(@Validated(EditGroup.class) @RequestBody EimsSpareInoutdtBo bo) { |
| | | return toAjax(eimsSpareInoutdtService.updateByBo(bo)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤å¤ä»¶åºå
¥åºæç» |
| | | * |
| | | * @param ids 主é®ä¸² |
| | | */ |
| | | @SaCheckPermission("eims:spareInoutdt:remove") |
| | | @Log(title = "å¤ä»¶åºå
¥åºæç»", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public R<Void> remove(@NotEmpty(message = "主é®ä¸è½ä¸ºç©º") |
| | | @PathVariable Long[] ids) { |
| | | return toAjax(eimsSpareInoutdtService.deleteWithValidByIds(List.of(ids), true)); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.eims.domain; |
| | | |
| | | import org.dromara.common.mybatis.core.domain.BaseEntity; |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serial; |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * å¤ä»¶åºå
¥åºæç»å¯¹è±¡ eims_spare_inoutdt |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-04-11 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @TableName("eims_spare_inoutdt") |
| | | public class EimsSpareInoutdt extends BaseEntity { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableId(value = "id") |
| | | private Long id; |
| | | |
| | | /** |
| | | * åºåºåæå
¥åºåid |
| | | */ |
| | | private Long inoutId; |
| | | |
| | | /** |
| | | * å¤ä»¶id |
| | | */ |
| | | private Long spareId; |
| | | |
| | | /** |
| | | * ä¹ååºå |
| | | */ |
| | | private Long beforeStock; |
| | | |
| | | /** |
| | | * å®é
åºå |
| | | */ |
| | | private Long actualStock; |
| | | |
| | | /** |
| | | * æ°é |
| | | */ |
| | | private Long quantity; |
| | | |
| | | /** |
| | | * åä»· |
| | | */ |
| | | private BigDecimal unitPrice; |
| | | |
| | | /** |
| | | * éé¢ |
| | | */ |
| | | private BigDecimal amount; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | |
| | | |
| | | } |
| | |
| | | private String remark; |
| | | |
| | | |
| | | |
| | | /** |
| | | * åºåºå
¥åºæ°é |
| | | */ |
| | | private Long quantity; |
| | | |
| | | |
| | | } |
| | |
| | | import lombok.EqualsAndHashCode; |
| | | import jakarta.validation.constraints.*; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import org.dromara.eims.domain.vo.EimsSpareVo; |
| | | |
| | | /** |
| | | * å¤ä»¶åºå
¥åºä¸å¡å¯¹è±¡ eims_spare_inout |
| | |
| | | */ |
| | | private String remark; |
| | | |
| | | //åºå
¥åºéæ©çå¤ä»¶æç» |
| | | private List<EimsSpareBo> spareList; |
| | | |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.eims.domain.bo; |
| | | |
| | | import org.dromara.eims.domain.EimsSpareInoutdt; |
| | | import org.dromara.common.mybatis.core.domain.BaseEntity; |
| | | import org.dromara.common.core.validate.AddGroup; |
| | | import org.dromara.common.core.validate.EditGroup; |
| | | import io.github.linpeilie.annotations.AutoMapper; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import jakarta.validation.constraints.*; |
| | | |
| | | /** |
| | | * å¤ä»¶åºå
¥åºæç»ä¸å¡å¯¹è±¡ eims_spare_inoutdt |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-04-11 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @AutoMapper(target = EimsSpareInoutdt.class, reverseConvertGenerate = false) |
| | | public class EimsSpareInoutdtBo extends BaseEntity { |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @NotNull(message = "ä¸è½ä¸ºç©º", groups = { EditGroup.class }) |
| | | private Long id; |
| | | |
| | | /** |
| | | * åºåºåæå
¥åºåid |
| | | */ |
| | | @NotNull(message = "åºåºåæå
¥åºåidä¸è½ä¸ºç©º", groups = { AddGroup.class, EditGroup.class }) |
| | | private Long inoutId; |
| | | |
| | | /** |
| | | * å¤ä»¶id |
| | | */ |
| | | @NotNull(message = "å¤ä»¶idä¸è½ä¸ºç©º", groups = { AddGroup.class, EditGroup.class }) |
| | | private Long spareId; |
| | | |
| | | /** |
| | | * ä¹ååºå |
| | | */ |
| | | @NotNull(message = "ä¹ååºåä¸è½ä¸ºç©º", groups = { AddGroup.class, EditGroup.class }) |
| | | private Long beforeStock; |
| | | |
| | | /** |
| | | * å®é
åºå |
| | | */ |
| | | @NotNull(message = "å®é
åºåä¸è½ä¸ºç©º", groups = { AddGroup.class, EditGroup.class }) |
| | | private Long actualStock; |
| | | |
| | | /** |
| | | * æ°é |
| | | */ |
| | | @NotNull(message = "æ°éä¸è½ä¸ºç©º", groups = { AddGroup.class, EditGroup.class }) |
| | | private Long quantity; |
| | | |
| | | /** |
| | | * åä»· |
| | | */ |
| | | @NotNull(message = "åä»·ä¸è½ä¸ºç©º", groups = { AddGroup.class, EditGroup.class }) |
| | | private Long unitPrice; |
| | | |
| | | /** |
| | | * éé¢ |
| | | */ |
| | | @NotNull(message = "éé¢ä¸è½ä¸ºç©º", groups = { AddGroup.class, EditGroup.class }) |
| | | private Long amount; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | |
| | | |
| | | } |
| | |
| | | import org.dromara.common.excel.convert.ExcelDictConvert; |
| | | import io.github.linpeilie.annotations.AutoMapper; |
| | | import lombok.Data; |
| | | import org.dromara.eims.domain.bo.EimsSpareBo; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | |
| | | @ExcelProperty(value = "夿³¨") |
| | | private String remark; |
| | | |
| | | |
| | | //åºå
¥åºéæ©çå¤ä»¶æç» |
| | | private List<EimsSpareVo> spareList; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.eims.domain.vo; |
| | | |
| | | import org.dromara.eims.domain.EimsSpareInoutdt; |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import org.dromara.common.excel.annotation.ExcelDictFormat; |
| | | import org.dromara.common.excel.convert.ExcelDictConvert; |
| | | import io.github.linpeilie.annotations.AutoMapper; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | |
| | | |
| | | /** |
| | | * å¤ä»¶åºå
¥åºæç»è§å¾å¯¹è±¡ eims_spare_inoutdt |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-04-11 |
| | | */ |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | @AutoMapper(target = EimsSpareInoutdt.class) |
| | | public class EimsSpareInoutdtVo implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @ExcelProperty(value = "") |
| | | private Long id; |
| | | |
| | | /** |
| | | * åºåºåæå
¥åºåid |
| | | */ |
| | | @ExcelProperty(value = "åºåºåæå
¥åºåid") |
| | | private Long inoutId; |
| | | |
| | | /** |
| | | * å¤ä»¶id |
| | | */ |
| | | @ExcelProperty(value = "å¤ä»¶id") |
| | | private Long spareId; |
| | | |
| | | /** |
| | | * ä¹ååºå |
| | | */ |
| | | @ExcelProperty(value = "ä¹ååºå") |
| | | private Long beforeStock; |
| | | |
| | | /** |
| | | * å®é
åºå |
| | | */ |
| | | @ExcelProperty(value = "å®é
åºå") |
| | | private Long actualStock; |
| | | |
| | | /** |
| | | * æ°é |
| | | */ |
| | | @ExcelProperty(value = "æ°é") |
| | | private Long quantity; |
| | | |
| | | /** |
| | | * åä»· |
| | | */ |
| | | @ExcelProperty(value = "åä»·") |
| | | private BigDecimal unitPrice; |
| | | |
| | | /** |
| | | * éé¢ |
| | | */ |
| | | @ExcelProperty(value = "éé¢") |
| | | private BigDecimal amount; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | @ExcelProperty(value = "夿³¨") |
| | | private String remark; |
| | | |
| | | //å¤ä»¶ |
| | | private String spareName; |
| | | private String spareCode; |
| | | private String modelNo; |
| | | //åºå
¥åºå |
| | | private String orderCode; |
| | | private Date orderTime; |
| | | private String type; |
| | | private String unit; |
| | | |
| | | |
| | | } |
| | |
| | | */ |
| | | @ExcelProperty(value = "夿³¨") |
| | | private String remark; |
| | | |
| | | /** |
| | | * åºåºå
¥åºæ°é |
| | | */ |
| | | private Long quantity; |
| | | |
| | | } |
| | |
| | | package org.dromara.eims.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Constants; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.dromara.eims.domain.EimsSpareInout; |
| | | import org.dromara.eims.domain.EimsSpareInoutdt; |
| | | import org.dromara.eims.domain.vo.EimsSpareInoutVo; |
| | | import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
| | | import org.dromara.eims.domain.vo.EimsSpareInoutdtVo; |
| | | |
| | | /** |
| | | * å¤ä»¶åºå
¥åºMapperæ¥å£ |
| | |
| | | */ |
| | | public interface EimsSpareInoutMapper extends BaseMapperPlus<EimsSpareInout, EimsSpareInoutVo> { |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.eims.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Constants; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.dromara.eims.domain.EimsMaintSt; |
| | | import org.dromara.eims.domain.EimsSpareInoutdt; |
| | | import org.dromara.eims.domain.vo.EimsMaintStVo; |
| | | import org.dromara.eims.domain.vo.EimsSpareInoutdtVo; |
| | | import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
| | | |
| | | /** |
| | | * å¤ä»¶åºå
¥åºæç»Mapperæ¥å£ |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-04-11 |
| | | */ |
| | | public interface EimsSpareInoutdtMapper extends BaseMapperPlus<EimsSpareInoutdt, EimsSpareInoutdtVo> { |
| | | |
| | | Page<EimsSpareInoutdtVo> selectSpareInoutdtList(@Param("page") Page<EimsSpareInoutdtVo> page, @Param(Constants.WRAPPER) Wrapper<EimsSpareInoutdt> queryWrapper); |
| | | } |
| | | |
| | |
| | | package org.dromara.eims.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Constants; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.dromara.eims.domain.EimsSpare; |
| | | import org.dromara.eims.domain.EimsSpareInout; |
| | | import org.dromara.eims.domain.vo.EimsSpareInoutVo; |
| | | import org.dromara.eims.domain.vo.EimsSpareInoutdtVo; |
| | | import org.dromara.eims.domain.vo.EimsSpareVo; |
| | | import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
| | | |
| | |
| | | * @date 2025-03-20 |
| | | */ |
| | | public interface EimsSpareMapper extends BaseMapperPlus<EimsSpare, EimsSpareVo> { |
| | | |
| | | Page<EimsSpareInoutdtVo> selectSpareInoutList(@Param("page") Page<EimsSpareInoutdtVo> page, @Param(Constants.WRAPPER) Wrapper<EimsSpare> queryWrapper); |
| | | } |
| | |
| | | * @return æ¯å¦å 餿å |
| | | */ |
| | | Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); |
| | | |
| | | |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.eims.service; |
| | | |
| | | import org.dromara.eims.domain.vo.EimsSpareInoutdtVo; |
| | | import org.dromara.eims.domain.bo.EimsSpareInoutdtBo; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.common.mybatis.core.page.PageQuery; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * å¤ä»¶åºå
¥åºæç»Serviceæ¥å£ |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-04-11 |
| | | */ |
| | | public interface IEimsSpareInoutdtService { |
| | | |
| | | /** |
| | | * æ¥è¯¢å¤ä»¶åºå
¥åºæç» |
| | | * |
| | | * @param id ä¸»é® |
| | | * @return å¤ä»¶åºå
¥åºæç» |
| | | */ |
| | | EimsSpareInoutdtVo queryById(Long id); |
| | | |
| | | /** |
| | | * å页æ¥è¯¢å¤ä»¶åºå
¥åºæç»å表 |
| | | * |
| | | * @param bo æ¥è¯¢æ¡ä»¶ |
| | | * @param pageQuery å页忰 |
| | | * @return å¤ä»¶åºå
¥åºæç»å页å表 |
| | | */ |
| | | TableDataInfo<EimsSpareInoutdtVo> queryPageList(EimsSpareInoutdtBo bo, PageQuery pageQuery); |
| | | |
| | | /** |
| | | * æ¥è¯¢ç¬¦åæ¡ä»¶çå¤ä»¶åºå
¥åºæç»å表 |
| | | * |
| | | * @param bo æ¥è¯¢æ¡ä»¶ |
| | | * @return å¤ä»¶åºå
¥åºæç»å表 |
| | | */ |
| | | List<EimsSpareInoutdtVo> queryList(EimsSpareInoutdtBo bo); |
| | | |
| | | /** |
| | | * æ°å¢å¤ä»¶åºå
¥åºæç» |
| | | * |
| | | * @param bo å¤ä»¶åºå
¥åºæç» |
| | | * @return æ¯å¦æ°å¢æå |
| | | */ |
| | | Boolean insertByBo(EimsSpareInoutdtBo bo); |
| | | |
| | | /** |
| | | * ä¿®æ¹å¤ä»¶åºå
¥åºæç» |
| | | * |
| | | * @param bo å¤ä»¶åºå
¥åºæç» |
| | | * @return æ¯å¦ä¿®æ¹æå |
| | | */ |
| | | Boolean updateByBo(EimsSpareInoutdtBo bo); |
| | | |
| | | /** |
| | | * æ ¡éªå¹¶æ¹éå é¤å¤ä»¶åºå
¥åºæç»ä¿¡æ¯ |
| | | * |
| | | * @param ids å¾
å é¤ç主é®éå |
| | | * @param isValid æ¯å¦è¿è¡æææ§æ ¡éª |
| | | * @return æ¯å¦å 餿å |
| | | */ |
| | | Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); |
| | | } |
| | |
| | | package org.dromara.eims.service; |
| | | |
| | | import org.dromara.eims.domain.bo.EimsSpareInoutBo; |
| | | import org.dromara.eims.domain.vo.EimsSpareInoutVo; |
| | | import org.dromara.eims.domain.vo.EimsSpareInoutdtVo; |
| | | import org.dromara.eims.domain.vo.EimsSpareVo; |
| | | import org.dromara.eims.domain.bo.EimsSpareBo; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | |
| | | * @return æ¯å¦å 餿å |
| | | */ |
| | | Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); |
| | | |
| | | |
| | | /** |
| | | * æ ¹æ®å¤ä»¶æ¥è¯¢åºå
¥åºæç» |
| | | * @param bo |
| | | * @param pageQuery |
| | | * @return |
| | | */ |
| | | TableDataInfo<EimsSpareInoutdtVo> querySpareInoutList(EimsSpareBo bo, PageQuery pageQuery); |
| | | } |
| | |
| | | package org.dromara.eims.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import org.dromara.common.core.constant.DictConstants; |
| | | import org.dromara.common.core.utils.MapstructUtils; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.eims.domain.EimsSpare; |
| | | import org.dromara.eims.domain.EimsSpareInoutdt; |
| | | import org.dromara.eims.domain.bo.EimsSpareBo; |
| | | import org.dromara.eims.domain.vo.EimsSpareInoutdtVo; |
| | | import org.dromara.eims.domain.vo.EimsSpareVo; |
| | | import org.dromara.eims.mapper.EimsSpareInoutdtMapper; |
| | | import org.dromara.eims.mapper.EimsSpareMapper; |
| | | import org.springframework.stereotype.Service; |
| | | import org.dromara.eims.domain.bo.EimsSpareInoutBo; |
| | | import org.dromara.eims.domain.vo.EimsSpareInoutVo; |
| | | import org.dromara.eims.domain.EimsSpareInout; |
| | | import org.dromara.eims.mapper.EimsSpareInoutMapper; |
| | | import org.dromara.eims.service.IEimsSpareInoutService; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Collection; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * å¤ä»¶åºå
¥åºServiceä¸å¡å±å¤ç |
| | |
| | | public class EimsSpareInoutServiceImpl implements IEimsSpareInoutService { |
| | | |
| | | private final EimsSpareInoutMapper baseMapper; |
| | | private final EimsSpareInoutdtMapper inoutdtMapper; |
| | | private final EimsSpareMapper spareMapper; |
| | | |
| | | /** |
| | | * æ¥è¯¢å¤ä»¶åºå
¥åº |
| | |
| | | */ |
| | | @Override |
| | | public EimsSpareInoutVo queryById(Long id){ |
| | | return baseMapper.selectVoById(id); |
| | | EimsSpareInoutVo eimsSpareInoutVo = baseMapper.selectVoById(id); |
| | | QueryWrapper<EimsSpareInoutdt> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.lambda().eq(EimsSpareInoutdt::getInoutId, id); |
| | | List<EimsSpareInoutdtVo> dtVos = inoutdtMapper.selectVoList(queryWrapper); |
| | | if(!dtVos.isEmpty()){ |
| | | Map<Long, Long> map = dtVos.stream() |
| | | .collect(Collectors.toMap( |
| | | EimsSpareInoutdtVo::getSpareId, |
| | | EimsSpareInoutdtVo::getQuantity |
| | | )); |
| | | List<Long> spareIdList = dtVos.stream() |
| | | .map(EimsSpareInoutdtVo::getSpareId) // è·å spareId åæ®µ |
| | | .toList(); |
| | | |
| | | List<EimsSpareVo> eimsSpareListVos = spareMapper.selectVoBatchIds(spareIdList); |
| | | |
| | | for (EimsSpareVo spareVo : eimsSpareListVos) { |
| | | // å设 quantity ç弿¯ä¸ä¸ªåºå®å¼ï¼ä¾å¦ 10ï¼ |
| | | spareVo.setQuantity(map.get(spareVo.getId())); |
| | | } |
| | | |
| | | eimsSpareInoutVo.setSpareList(eimsSpareListVos); |
| | | } |
| | | |
| | | |
| | | |
| | | return eimsSpareInoutVo; |
| | | } |
| | | |
| | | /** |
| | |
| | | Page<EimsSpareInoutVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); |
| | | return TableDataInfo.build(result); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æ¥è¯¢ç¬¦åæ¡ä»¶çå¤ä»¶åºå
¥åºå表 |
| | |
| | | return lqw; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æ°å¢å¤ä»¶åºå
¥åº |
| | | * |
| | | * @param bo å¤ä»¶åºå
¥åº |
| | | * @return æ¯å¦æ°å¢æå |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public Boolean insertByBo(EimsSpareInoutBo bo) { |
| | | public synchronized Boolean insertByBo(EimsSpareInoutBo bo) { |
| | | EimsSpareInout add = MapstructUtils.convert(bo, EimsSpareInout.class); |
| | | validEntityBeforeSave(add); |
| | | boolean flag = baseMapper.insert(add) > 0; |
| | | if (flag) { |
| | | bo.setId(add.getId()); |
| | | } |
| | | //å
¥åºï¼åºå åºåº-åºå ï¼é»è®¤å
¥åºï¼ |
| | | int OperationType; |
| | | |
| | | //åºåº |
| | | if(bo.getType().equals(DictConstants.SPARE_INOUT_TYPE_DETAIL.CK)){ |
| | | OperationType = -1; |
| | | } else { |
| | | OperationType = 1; |
| | | } |
| | | |
| | | List<EimsSpareBo> spareList = Optional.ofNullable(bo.getSpareList()).orElse(new ArrayList<>()); |
| | | // æå
¥åºåºæç» |
| | | List<EimsSpareInoutdt> dtList = spareList.stream() |
| | | .map(eimsSpareBo -> { |
| | | EimsSpareInoutdt dt = new EimsSpareInoutdt(); |
| | | dt.setInoutId(add.getId()); |
| | | dt.setSpareId(eimsSpareBo.getId()); |
| | | dt.setBeforeStock(eimsSpareBo.getActualStock()); |
| | | // 注æå
¥åºåºåº |
| | | dt.setActualStock(eimsSpareBo.getActualStock() + (eimsSpareBo.getQuantity() * OperationType)); |
| | | dt.setQuantity(eimsSpareBo.getQuantity()); |
| | | |
| | | // 设置åä»·åéé¢ |
| | | Optional.ofNullable(eimsSpareBo.getReferPrice()).ifPresent(referPrice -> { |
| | | dt.setUnitPrice(referPrice); |
| | | dt.setAmount(referPrice.multiply(BigDecimal.valueOf(eimsSpareBo.getQuantity()))); |
| | | }); |
| | | |
| | | return dt; |
| | | }) |
| | | .toList(); |
| | | |
| | | // æ¹éæå
¥æ°æ® |
| | | if (!dtList.isEmpty()) { |
| | | inoutdtMapper.insertBatch(dtList); |
| | | } |
| | | |
| | | // æ´æ°å¤ä»¶çåºå |
| | | List<EimsSpare> updateSpareList = spareList.stream().map(spareBo -> { |
| | | EimsSpare spare = new EimsSpare(); |
| | | spare.setId(spareBo.getId()); |
| | | spare.setActualStock(spareBo.getActualStock() + (spareBo.getQuantity() * OperationType)); |
| | | // 设置åä»·åéé¢ |
| | | Optional.ofNullable(spareBo.getReferPrice()).ifPresent(referPrice -> { |
| | | spare.setStockAmount(referPrice.multiply(BigDecimal.valueOf(spare.getActualStock()))); |
| | | }); |
| | | return spare; |
| | | }).toList(); |
| | | |
| | | if (!updateSpareList.isEmpty()) { |
| | | spareMapper.updateBatchById(updateSpareList); |
| | | } |
| | | return flag; |
| | | } |
| | |
| | | } |
| | | return baseMapper.deleteByIds(ids) > 0; |
| | | } |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.eims.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import org.dromara.common.core.utils.MapstructUtils; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.common.mybatis.core.page.PageQuery; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.eims.domain.vo.EimsMaintStVo; |
| | | import org.springframework.stereotype.Service; |
| | | import org.dromara.eims.domain.bo.EimsSpareInoutdtBo; |
| | | import org.dromara.eims.domain.vo.EimsSpareInoutdtVo; |
| | | import org.dromara.eims.domain.EimsSpareInoutdt; |
| | | import org.dromara.eims.mapper.EimsSpareInoutdtMapper; |
| | | import org.dromara.eims.service.IEimsSpareInoutdtService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Collection; |
| | | |
| | | /** |
| | | * å¤ä»¶åºå
¥åºæç»Serviceä¸å¡å±å¤ç |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-04-11 |
| | | */ |
| | | @RequiredArgsConstructor |
| | | @Service |
| | | public class EimsSpareInoutdtServiceImpl implements IEimsSpareInoutdtService { |
| | | |
| | | private final EimsSpareInoutdtMapper baseMapper; |
| | | |
| | | /** |
| | | * æ¥è¯¢å¤ä»¶åºå
¥åºæç» |
| | | * |
| | | * @param id ä¸»é® |
| | | * @return å¤ä»¶åºå
¥åºæç» |
| | | */ |
| | | @Override |
| | | public EimsSpareInoutdtVo queryById(Long id){ |
| | | return baseMapper.selectVoById(id); |
| | | } |
| | | |
| | | /** |
| | | * å页æ¥è¯¢å¤ä»¶åºå
¥åºæç»å表 |
| | | * |
| | | * @param bo æ¥è¯¢æ¡ä»¶ |
| | | * @param pageQuery å页忰 |
| | | * @return å¤ä»¶åºå
¥åºæç»å页å表 |
| | | */ |
| | | @Override |
| | | public TableDataInfo<EimsSpareInoutdtVo> queryPageList(EimsSpareInoutdtBo bo, PageQuery pageQuery) { |
| | | Page<EimsSpareInoutdtVo> result = baseMapper.selectSpareInoutdtList(pageQuery.build(), buildWrapper(bo)); |
| | | return TableDataInfo.build(result); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ç¬¦åæ¡ä»¶çå¤ä»¶åºå
¥åºæç»å表 |
| | | * |
| | | * @param bo æ¥è¯¢æ¡ä»¶ |
| | | * @return å¤ä»¶åºå
¥åºæç»å表 |
| | | */ |
| | | @Override |
| | | public List<EimsSpareInoutdtVo> queryList(EimsSpareInoutdtBo bo) { |
| | | LambdaQueryWrapper<EimsSpareInoutdt> lqw = buildQueryWrapper(bo); |
| | | return baseMapper.selectVoList(lqw); |
| | | } |
| | | |
| | | private LambdaQueryWrapper<EimsSpareInoutdt> buildQueryWrapper(EimsSpareInoutdtBo bo) { |
| | | Map<String, Object> params = bo.getParams(); |
| | | LambdaQueryWrapper<EimsSpareInoutdt> lqw = Wrappers.lambdaQuery(); |
| | | lqw.eq(bo.getInoutId() != null, EimsSpareInoutdt::getInoutId, bo.getInoutId()); |
| | | lqw.eq(bo.getSpareId() != null, EimsSpareInoutdt::getSpareId, bo.getSpareId()); |
| | | return lqw; |
| | | } |
| | | |
| | | private QueryWrapper<EimsSpareInoutdt> buildWrapper(EimsSpareInoutdtBo bo) { |
| | | Map<String, Object> params = bo.getParams(); |
| | | QueryWrapper<EimsSpareInoutdt> qw = Wrappers.query(); |
| | | qw.eq("io.id",bo.getInoutId()); |
| | | return qw; |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢å¤ä»¶åºå
¥åºæç» |
| | | * |
| | | * @param bo å¤ä»¶åºå
¥åºæç» |
| | | * @return æ¯å¦æ°å¢æå |
| | | */ |
| | | @Override |
| | | public Boolean insertByBo(EimsSpareInoutdtBo bo) { |
| | | EimsSpareInoutdt add = MapstructUtils.convert(bo, EimsSpareInoutdt.class); |
| | | validEntityBeforeSave(add); |
| | | boolean flag = baseMapper.insert(add) > 0; |
| | | if (flag) { |
| | | bo.setId(add.getId()); |
| | | } |
| | | return flag; |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹å¤ä»¶åºå
¥åºæç» |
| | | * |
| | | * @param bo å¤ä»¶åºå
¥åºæç» |
| | | * @return æ¯å¦ä¿®æ¹æå |
| | | */ |
| | | @Override |
| | | public Boolean updateByBo(EimsSpareInoutdtBo bo) { |
| | | EimsSpareInoutdt update = MapstructUtils.convert(bo, EimsSpareInoutdt.class); |
| | | validEntityBeforeSave(update); |
| | | return baseMapper.updateById(update) > 0; |
| | | } |
| | | |
| | | /** |
| | | * ä¿ååçæ°æ®æ ¡éª |
| | | */ |
| | | private void validEntityBeforeSave(EimsSpareInoutdt entity){ |
| | | //TODO åä¸äºæ°æ®æ ¡éª,å¦å¯ä¸çº¦æ |
| | | } |
| | | |
| | | /** |
| | | * æ ¡éªå¹¶æ¹éå é¤å¤ä»¶åºå
¥åºæç»ä¿¡æ¯ |
| | | * |
| | | * @param ids å¾
å é¤ç主é®éå |
| | | * @param isValid æ¯å¦è¿è¡æææ§æ ¡éª |
| | | * @return æ¯å¦å 餿å |
| | | */ |
| | | @Override |
| | | public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { |
| | | if(isValid){ |
| | | //TODO åä¸äºä¸å¡ä¸çæ ¡éª,夿æ¯å¦éè¦æ ¡éª |
| | | } |
| | | return baseMapper.deleteByIds(ids) > 0; |
| | | } |
| | | } |
| | |
| | | package org.dromara.eims.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import org.dromara.common.core.utils.MapstructUtils; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.eims.domain.EimsSpareInout; |
| | | import org.dromara.eims.domain.bo.EimsSpareInoutBo; |
| | | import org.dromara.eims.domain.vo.EimsSpareInoutVo; |
| | | import org.dromara.eims.domain.vo.EimsSpareInoutdtVo; |
| | | import org.springframework.stereotype.Service; |
| | | import org.dromara.eims.domain.bo.EimsSpareBo; |
| | | import org.dromara.eims.domain.vo.EimsSpareVo; |
| | |
| | | return TableDataInfo.build(result); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public TableDataInfo<EimsSpareInoutdtVo> querySpareInoutList(EimsSpareBo bo, PageQuery pageQuery) { |
| | | Page<EimsSpareInoutdtVo> result = baseMapper.selectSpareInoutList(pageQuery.build(), buildWrapper(bo)); |
| | | return TableDataInfo.build(result); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ç¬¦åæ¡ä»¶çå¤ä»¶å°è´¦å表 |
| | | * |
| | |
| | | lqw.like(StringUtils.isNotBlank(bo.getSupplier()), EimsSpare::getSupplier, bo.getSupplier()); |
| | | lqw.eq(StringUtils.isNotBlank(bo.getUnit()), EimsSpare::getUnit, bo.getUnit()); |
| | | return lqw; |
| | | } |
| | | |
| | | private QueryWrapper<EimsSpare> buildWrapper(EimsSpareBo bo) { |
| | | Map<String, Object> params = bo.getParams(); |
| | | QueryWrapper<EimsSpare> qw = Wrappers.query(); |
| | | qw.eq( "sp.id", bo.getId()); |
| | | return qw; |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | return baseMapper.deleteByIds(ids) > 0; |
| | | } |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="org.dromara.eims.mapper.EimsSpareInoutdtMapper"> |
| | | <resultMap type="org.dromara.eims.domain.vo.EimsSpareInoutdtVo" id="SpareInoutdtVoResult"> |
| | | </resultMap> |
| | | <select id="selectSpareInoutdtList" resultMap="SpareInoutdtVoResult"> |
| | | SELECT dt.*, sp.name spareName, sp.code spareCode, sp.model_no modelNo, sp.unit unit, io.order_code orderCode |
| | | FROM eims_spare_inoutdt dt |
| | | LEFT JOIN eims_spare_inout io on dt.inout_id = io.id |
| | | LEFT JOIN eims_spare sp on dt.spare_id = sp.id |
| | | ${ew.getCustomSqlSegment} |
| | | </select> |
| | | </mapper> |
| | |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="org.dromara.eims.mapper.EimsSpareMapper"> |
| | | |
| | | <resultMap type="org.dromara.eims.domain.vo.EimsSpareInoutdtVo" id="SpareInoutdtVoResult"> |
| | | </resultMap> |
| | | <select id="selectSpareInoutList" resultMap="SpareInoutdtVoResult"> |
| | | SELECT io.*, dt.quantity, dt.actual_stock, dt.unit_price, dt.amount |
| | | FROM eims_spare_inout io |
| | | JOIN eims_spare_inoutdt dt on io.id = dt.inout_id |
| | | JOIN eims_spare sp on dt.spare_id = sp.id |
| | | ${ew.getCustomSqlSegment} |
| | | </select> |
| | | </mapper> |