All files / src/domains/manufacturing/schemas manufacturing-config.schema.ts

0% Statements 0/34
100% Branches 0/0
100% Functions 0/0
0% Lines 0/32

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90                                                                                                                                                                                   
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { Document } from 'mongoose';
 
@Schema({ timestamps: true, collection: 'manufacturing_configurations' })
export class ManufacturingConfiguration extends Document {
  @Prop({ required: true, index: true })
  tenantId: string;
 
  @Prop({ default: true })
  manufacturingEnabled: boolean;
 
  @Prop({ default: true })
  mrpEnabled: boolean;
 
  @Prop({ default: true })
  mpsEnabled: boolean;
 
  @Prop({ default: false })
  finiteCapacityPlanningEnabled: boolean;
 
  @Prop({ default: true })
  infiniteCapacityPlanningEnabled: boolean;
 
  @Prop({ default: true })
  backflushEnabled: boolean;
 
  @Prop({ default: true })
  operationConfirmationRequired: boolean;
 
  @Prop({ default: true })
  qualityInspectionRequired: boolean;
 
  @Prop({ default: false })
  productionApprovalRequired: boolean;
 
  @Prop({ default: false })
  materialIssueApprovalRequired: boolean;
 
  @Prop({ default: 10 })
  overConsumptionTolerancePercent: number;
 
  @Prop({ default: 5 })
  underConsumptionTolerancePercent: number;
 
  @Prop({ default: 10 })
  overProductionTolerancePercent: number;
 
  @Prop({ default: 15 })
  scrapApprovalThresholdPercent: number;
 
  @Prop()
  defaultWipWarehouseId?: string;
 
  @Prop()
  defaultRawMaterialWarehouseId?: string;
 
  @Prop()
  defaultFinishedGoodsWarehouseId?: string;
 
  @Prop()
  defaultScrapWarehouseId?: string;
 
  @Prop()
  defaultReworkWarehouseId?: string;
 
  @Prop()
  defaultSubcontractWarehouseId?: string;
 
  @Prop({ default: 'Standard' })
  defaultCostingMethod: string; // 'Standard' | 'Actual'
 
  @Prop({ default: 'LotForLot' })
  lotSizingMethod: string;
 
  @Prop({ default: 90 })
  planningHorizonDays: number;
 
  @Prop({ default: true })
  safetyStockEnabled: boolean;
 
  @Prop({ default: true })
  laborTrackingEnabled: boolean;
 
  @Prop({ default: true })
  machineTrackingEnabled: boolean;
}
 
export const ManufacturingConfigurationSchema = SchemaFactory.createForClass(ManufacturingConfiguration);
ManufacturingConfigurationSchema.index({ tenantId: 1 }, { unique: true });