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; }