From 6650f9f06aad467f855d9cdb6d98eccc3dcea9a5 Mon Sep 17 00:00:00 2001 From: louis <869322496@qq.com> Date: Thu, 29 Feb 2024 10:32:37 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8E=9F=E6=9D=90=E6=96=99=E7=9B=98?= =?UTF-8?q?=E7=82=B9=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/sql/raw_materials_inventory.sql | 23 +++ deploy/sql/vehicle_usage.sql | 15 -- src/app.module.ts | 5 +- src/modules/contract/contract.entity.ts | 8 +- .../materials_inventory.controller.ts | 4 + .../materials_inventory.entity.ts | 185 ++++++++++++++++++ .../materials_inventory.module.ts | 12 ++ .../materials_inventory.service.ts | 4 + .../vehicle-usage/vehicle-usage.entity.ts | 12 +- 9 files changed, 242 insertions(+), 26 deletions(-) create mode 100644 deploy/sql/raw_materials_inventory.sql delete mode 100644 deploy/sql/vehicle_usage.sql create mode 100644 src/modules/materials_inventory/materials_inventory.controller.ts create mode 100644 src/modules/materials_inventory/materials_inventory.entity.ts create mode 100644 src/modules/materials_inventory/materials_inventory.module.ts create mode 100644 src/modules/materials_inventory/materials_inventory.service.ts diff --git a/deploy/sql/raw_materials_inventory.sql b/deploy/sql/raw_materials_inventory.sql new file mode 100644 index 0000000..9b313cf --- /dev/null +++ b/deploy/sql/raw_materials_inventory.sql @@ -0,0 +1,23 @@ +CREATE TABLE `materials_inventory`( + id INT AUTO_INCREMENT PRIMARY KEY COMMENT 'ID', + company_name VARCHAR(255) COMMENT '公司名称', + product_name VARCHAR(255) COMMENT '产品名称', + unit VARCHAR(50) COMMENT '单位', + previous_inventory_quantity INT COMMENT '之前的库存数量', + previous_unit_price DECIMAL(10, 2) COMMENT '之前的单价', + previous_amount DECIMAL(10, 2) COMMENT '之前的金额', + inventory_time DATETIME COMMENT '入库时间', + inventory_quantity INT COMMENT '入库后数量', + inventory_unit_price DECIMAL(10, 2) COMMENT '入库后单价', + inventory_amount DECIMAL(10, 2) COMMENT '入库金额', + out_time DATETIME COMMENT '出库时间', + out_quantity INT COMMENT '出库数量', + out_unit_price DECIMAL(10, 2) COMMENT '出库单价', + out_amount DECIMAL(10, 2) COMMENT '出库金额', + current_inventory_quantity INT COMMENT '现在的结存数量', + current_unit_price DECIMAL(10, 2) COMMENT '现在的单价', + current_amount DECIMAL(10, 2) COMMENT '现在的金额', + agent VARCHAR(100) COMMENT '经办人', + issuance_number VARCHAR(100) COMMENT '领料单号', + remark VARCHAR(255) COMMENT '备注' +); \ No newline at end of file diff --git a/deploy/sql/vehicle_usage.sql b/deploy/sql/vehicle_usage.sql deleted file mode 100644 index c5973b2..0000000 --- a/deploy/sql/vehicle_usage.sql +++ /dev/null @@ -1,15 +0,0 @@ -CREATE TABLE vehicle_usage ( - id INT AUTO_INCREMENT PRIMARY KEY COMMENT '主键,用于唯一标识每条记录', - `year` INT COMMENT '年度', - vehicle_license VARCHAR(255) COMMENT '车牌号', - VARCHAR(255) COMMENT '外出使用的车辆名称', - applicant VARCHAR(255) COMMENT '申请人', - driver VARCHAR(255) COMMENT '出行司机', - current_mileage FLOAT COMMENT '当前车辆里程数(KM)', - expected_travel_time DATETIME COMMENT '预计出行时间', - purpose VARCHAR(255) COMMENT '使用事由', - actual_return_time DATETIME COMMENT '实际回司时间', - return_mileage FLOAT COMMENT '回城车辆里程数(KM)', - approval_by_leader VARCHAR(255) COMMENT '公司领导审批', - remarks VARCHAR(255) COMMENT '备注' -); \ No newline at end of file diff --git a/src/app.module.ts b/src/app.module.ts index 5ee2544..de220bc 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -28,6 +28,7 @@ import { ContractModule } from './modules/contract/contract.module'; import { VehicleUsageModule } from './modules/vehicle-usage/vehicle-usage.module'; import { VehicleUsageController } from './modules/vehicle-usage/vehicle-usage.controller'; import { VehicleUsageService } from './modules/vehicle-usage/vehicle-usage.service'; +import { MaterialsInventoryModule } from './modules/materials_inventory/materials_inventory.module'; @Module({ imports: [ @@ -58,7 +59,9 @@ import { VehicleUsageService } from './modules/vehicle-usage/vehicle-usage.servi ContractModule, - VehicleUsageModule + VehicleUsageModule, + + MaterialsInventoryModule ], providers: [ { provide: APP_FILTER, useClass: AllExceptionsFilter }, diff --git a/src/modules/contract/contract.entity.ts b/src/modules/contract/contract.entity.ts index e7cfddf..979533d 100644 --- a/src/modules/contract/contract.entity.ts +++ b/src/modules/contract/contract.entity.ts @@ -18,8 +18,8 @@ export class ContractEntity extends CommonEntity { @ApiProperty({ description: '合同标题' }) title: string; - @Column({ type: 'int', comment: '合同类型' }) - @ApiProperty({ description: '合同类型' }) + @Column({ type: 'int', comment: '合同类型(字典)' }) + @ApiProperty({ description: '合同类型(字典)' }) type: number; @Column({ name: 'party_a', length: 255, type: 'varchar', comment: '甲方' }) @@ -38,7 +38,7 @@ export class ContractEntity extends CommonEntity { @ApiProperty({ description: '交付期限' }) deliveryDeadline: Date; - @Column({ name: 'status', type: 'tinyint', default: 0, comment: '审核状态' }) - @ApiProperty({ description: '审核状态:0待审核,1同意,2.不同意' }) + @Column({ name: 'status', type: 'tinyint', default: 0, comment: '审核状态(字典)' }) + @ApiProperty({ description: '审核状态:0待审核,1同意,2.不同意(字典)' }) status: number; } diff --git a/src/modules/materials_inventory/materials_inventory.controller.ts b/src/modules/materials_inventory/materials_inventory.controller.ts new file mode 100644 index 0000000..c5d1b06 --- /dev/null +++ b/src/modules/materials_inventory/materials_inventory.controller.ts @@ -0,0 +1,4 @@ +import { Controller } from '@nestjs/common'; + +@Controller('materials-inventory') +export class MaterialsInventoryController {} diff --git a/src/modules/materials_inventory/materials_inventory.entity.ts b/src/modules/materials_inventory/materials_inventory.entity.ts new file mode 100644 index 0000000..c0d429e --- /dev/null +++ b/src/modules/materials_inventory/materials_inventory.entity.ts @@ -0,0 +1,185 @@ +import { ApiProperty } from '@nestjs/swagger'; +import { Column, Entity } from 'typeorm'; +import { CommonEntity } from '~/common/entity/common.entity'; + +@Entity({ name: 'meterials_inventory' }) +export class MeterialsInventoryEntity extends CommonEntity { + @Column({ name: 'company_name', type: 'varchar', length: 255, comment: '公司名称' }) + @ApiProperty({ description: '公司名称' }) + companyName: number; + + @Column({ + name: 'product', + type: 'int', + comment: '产品名称(字典)' + }) + @ApiProperty({ description: '产品名称(字典)' }) + product: number; + + @Column({ + name: 'unit', + type: 'int', + comment: '单位(字典)' + }) + @ApiProperty({ description: '单位(字典)' }) + unit: number; + + @Column({ + name: 'previous_inventory_quantity', + type: 'int', + default: 0, + comment: '之前的库存数量' + }) + @ApiProperty({ description: '之前的库存数量' }) + previousInventoryQuantity: number; + + @Column({ + name: 'previous_unit_price', + type: 'decimal', + precision: 10, + default: 0, + scale: 2, + comment: '之前的单价' + }) + @ApiProperty({ description: '之前的单价' }) + previousUnitPrice: number; + + @Column({ + name: 'previous_amount', + type: 'decimal', + precision: 10, + scale: 2, + default: 0, + comment: '之前的金额' + }) + @ApiProperty({ description: '之前的金额' }) + previousAmount: number; + + @Column({ + name: 'inventory_time', + type: 'date', + nullable: true, + comment: '入库时间' + }) + @ApiProperty({ description: '入库时间' }) + inventoryTime: Date; + + @Column({ + name: 'inventory_quantity', + type: 'int', + default: 0, + comment: '入库数量' + }) + @ApiProperty({ description: '入库数量' }) + inventoryQuantity: number; + + @Column({ + name: 'inventory_unit_price', + type: 'decimal', + precision: 10, + default: 0, + scale: 2, + comment: '入库单价' + }) + @ApiProperty({ description: '入库单价' }) + inventoryUnitPrice: number; + + @Column({ + name: 'inventory_amount', + type: 'decimal', + precision: 10, + default: 0, + scale: 2, + comment: '入库金额' + }) + @ApiProperty({ description: '入库金额' }) + inventoryAmount: number; + + @Column({ + name: 'out_time', + type: 'date', + nullable: true, + comment: '出库时间' + }) + @ApiProperty({ description: '出库时间' }) + outime: Date; + + @Column({ + name: 'out_quantity', + type: 'int', + default: 0, + comment: '出库数量' + }) + @ApiProperty({ description: '出库数量' }) + outQuantity: number; + + @Column({ + name: 'out_unit_price', + type: 'decimal', + precision: 10, + default: 0, + scale: 2, + comment: '出库单价' + }) + @ApiProperty({ description: '出库单价' }) + outUnitPrice: number; + + @Column({ + name: 'out_amount', + type: 'decimal', + precision: 10, + default: 0, + scale: 2, + comment: '出库金额' + }) + @ApiProperty({ description: '出库金额' }) + outAmount: number; + + @Column({ + name: 'current_inventory_quantity', + type: 'int', + default: 0, + comment: '现在的结存数量' + }) + @ApiProperty({ description: '现在的结存数量' }) + currentInventoryQuantity: number; + + @Column({ + name: 'current_unit_price', + type: 'decimal', + precision: 10, + default: 0, + scale: 2, + comment: '现在的单价' + }) + @ApiProperty({ description: '现在的单价' }) + currentUnitPrice: number; + + @Column({ + name: 'current_amount', + type: 'decimal', + precision: 10, + default: 0, + scale: 2, + comment: '现在的金额' + }) + @ApiProperty({ description: '现在的金额' }) + currentAmount: number; + + @Column({ name: 'agent', type: 'varchar', length: 50, comment: '经办人', nullable: true }) + @ApiProperty({ description: '经办人' }) + agent: string; + + @Column({ + name: 'issuance_number', + type: 'varchar', + length: 100, + comment: '领料单号' + }) + @ApiProperty({ description: '领料单号' }) + issuanceNumber: string; + + @Column({ name: 'remark', type: 'varchar', length: 255, comment: '备注', nullable: true }) + @ApiProperty({ description: '备注' }) + remark: string; +} diff --git a/src/modules/materials_inventory/materials_inventory.module.ts b/src/modules/materials_inventory/materials_inventory.module.ts new file mode 100644 index 0000000..0572e3d --- /dev/null +++ b/src/modules/materials_inventory/materials_inventory.module.ts @@ -0,0 +1,12 @@ +import { Module } from '@nestjs/common'; +import { MaterialsInventoryController } from './materials_inventory.controller'; +import { MaterialsInventoryService } from './materials_inventory.service'; +import { TypeOrmModule } from '@nestjs/typeorm'; +import { MeterialsInventoryEntity } from './materials_inventory.entity'; + +@Module({ + imports: [TypeOrmModule.forFeature([MeterialsInventoryEntity])], + controllers: [MaterialsInventoryController], + providers: [MaterialsInventoryService] +}) +export class MaterialsInventoryModule {} diff --git a/src/modules/materials_inventory/materials_inventory.service.ts b/src/modules/materials_inventory/materials_inventory.service.ts new file mode 100644 index 0000000..44c7be2 --- /dev/null +++ b/src/modules/materials_inventory/materials_inventory.service.ts @@ -0,0 +1,4 @@ +import { Injectable } from '@nestjs/common'; + +@Injectable() +export class MaterialsInventoryService {} diff --git a/src/modules/vehicle-usage/vehicle-usage.entity.ts b/src/modules/vehicle-usage/vehicle-usage.entity.ts index abd1972..994fd97 100644 --- a/src/modules/vehicle-usage/vehicle-usage.entity.ts +++ b/src/modules/vehicle-usage/vehicle-usage.entity.ts @@ -8,8 +8,8 @@ export class VehicleUsageEntity extends CommonEntity { @ApiProperty({ description: '年度' }) year: number; - @Column({ name: 'vehicle_license', type: 'int', comment: '外出使用的车辆名称' }) - @ApiProperty({ description: '外出使用的车辆名称' }) + @Column({ name: 'vehicle_license', type: 'int', comment: '外出使用的车辆名称(字典)' }) + @ApiProperty({ description: '外出使用的车辆名称(字典)' }) vehicleLicense: number; @Column({ @@ -68,11 +68,11 @@ export class VehicleUsageEntity extends CommonEntity { @ApiProperty({ description: '审核人' }) reviewer: string; - @Column({ name: 'status', type: 'tinyint', default: 0, comment: '审核状态' }) - @ApiProperty({ description: '审核状态:0待审核,1同意,2.不同意' }) + @Column({ name: 'status', type: 'tinyint', default: 0, comment: '审核状态(字典)' }) + @ApiProperty({ description: '审核状态:0待审核,1同意,2.不同意(字典)' }) status: number; - @Column({ name: 'remarks', type: 'varchar', length: 255, comment: '备注', nullable: true }) + @Column({ name: 'remark', type: 'varchar', length: 255, comment: '备注', nullable: true }) @ApiProperty({ description: '备注' }) - remarks: string; + remark: string; }