feat: 原材料盘点模块
This commit is contained in:
parent
f402438a5a
commit
6650f9f06a
|
@ -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 '备注'
|
||||||
|
);
|
|
@ -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 '备注'
|
|
||||||
);
|
|
|
@ -28,6 +28,7 @@ import { ContractModule } from './modules/contract/contract.module';
|
||||||
import { VehicleUsageModule } from './modules/vehicle-usage/vehicle-usage.module';
|
import { VehicleUsageModule } from './modules/vehicle-usage/vehicle-usage.module';
|
||||||
import { VehicleUsageController } from './modules/vehicle-usage/vehicle-usage.controller';
|
import { VehicleUsageController } from './modules/vehicle-usage/vehicle-usage.controller';
|
||||||
import { VehicleUsageService } from './modules/vehicle-usage/vehicle-usage.service';
|
import { VehicleUsageService } from './modules/vehicle-usage/vehicle-usage.service';
|
||||||
|
import { MaterialsInventoryModule } from './modules/materials_inventory/materials_inventory.module';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [
|
imports: [
|
||||||
|
@ -58,7 +59,9 @@ import { VehicleUsageService } from './modules/vehicle-usage/vehicle-usage.servi
|
||||||
|
|
||||||
ContractModule,
|
ContractModule,
|
||||||
|
|
||||||
VehicleUsageModule
|
VehicleUsageModule,
|
||||||
|
|
||||||
|
MaterialsInventoryModule
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: APP_FILTER, useClass: AllExceptionsFilter },
|
{ provide: APP_FILTER, useClass: AllExceptionsFilter },
|
||||||
|
|
|
@ -18,8 +18,8 @@ export class ContractEntity extends CommonEntity {
|
||||||
@ApiProperty({ description: '合同标题' })
|
@ApiProperty({ description: '合同标题' })
|
||||||
title: string;
|
title: string;
|
||||||
|
|
||||||
@Column({ type: 'int', comment: '合同类型' })
|
@Column({ type: 'int', comment: '合同类型(字典)' })
|
||||||
@ApiProperty({ description: '合同类型' })
|
@ApiProperty({ description: '合同类型(字典)' })
|
||||||
type: number;
|
type: number;
|
||||||
|
|
||||||
@Column({ name: 'party_a', length: 255, type: 'varchar', comment: '甲方' })
|
@Column({ name: 'party_a', length: 255, type: 'varchar', comment: '甲方' })
|
||||||
|
@ -38,7 +38,7 @@ export class ContractEntity extends CommonEntity {
|
||||||
@ApiProperty({ description: '交付期限' })
|
@ApiProperty({ description: '交付期限' })
|
||||||
deliveryDeadline: Date;
|
deliveryDeadline: Date;
|
||||||
|
|
||||||
@Column({ name: 'status', type: 'tinyint', default: 0, comment: '审核状态' })
|
@Column({ name: 'status', type: 'tinyint', default: 0, comment: '审核状态(字典)' })
|
||||||
@ApiProperty({ description: '审核状态:0待审核,1同意,2.不同意' })
|
@ApiProperty({ description: '审核状态:0待审核,1同意,2.不同意(字典)' })
|
||||||
status: number;
|
status: number;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
import { Controller } from '@nestjs/common';
|
||||||
|
|
||||||
|
@Controller('materials-inventory')
|
||||||
|
export class MaterialsInventoryController {}
|
|
@ -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;
|
||||||
|
}
|
|
@ -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 {}
|
|
@ -0,0 +1,4 @@
|
||||||
|
import { Injectable } from '@nestjs/common';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class MaterialsInventoryService {}
|
|
@ -8,8 +8,8 @@ export class VehicleUsageEntity extends CommonEntity {
|
||||||
@ApiProperty({ description: '年度' })
|
@ApiProperty({ description: '年度' })
|
||||||
year: number;
|
year: number;
|
||||||
|
|
||||||
@Column({ name: 'vehicle_license', type: 'int', comment: '外出使用的车辆名称' })
|
@Column({ name: 'vehicle_license', type: 'int', comment: '外出使用的车辆名称(字典)' })
|
||||||
@ApiProperty({ description: '外出使用的车辆名称' })
|
@ApiProperty({ description: '外出使用的车辆名称(字典)' })
|
||||||
vehicleLicense: number;
|
vehicleLicense: number;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
|
@ -68,11 +68,11 @@ export class VehicleUsageEntity extends CommonEntity {
|
||||||
@ApiProperty({ description: '审核人' })
|
@ApiProperty({ description: '审核人' })
|
||||||
reviewer: string;
|
reviewer: string;
|
||||||
|
|
||||||
@Column({ name: 'status', type: 'tinyint', default: 0, comment: '审核状态' })
|
@Column({ name: 'status', type: 'tinyint', default: 0, comment: '审核状态(字典)' })
|
||||||
@ApiProperty({ description: '审核状态:0待审核,1同意,2.不同意' })
|
@ApiProperty({ description: '审核状态:0待审核,1同意,2.不同意(字典)' })
|
||||||
status: number;
|
status: number;
|
||||||
|
|
||||||
@Column({ name: 'remarks', type: 'varchar', length: 255, comment: '备注', nullable: true })
|
@Column({ name: 'remark', type: 'varchar', length: 255, comment: '备注', nullable: true })
|
||||||
@ApiProperty({ description: '备注' })
|
@ApiProperty({ description: '备注' })
|
||||||
remarks: string;
|
remark: string;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue