namespace Admin.NET.Plugin.AiDOP.Dto.S0.Quality; public class AdoS0QualityPagedQueryDto { public string? Keyword { get; set; } public int Page { get; set; } = 1; public int PageSize { get; set; } = 20; } public class AdoS0QualitySimpleOptionDto { public long Value { get; set; } public string Label { get; set; } = string.Empty; } public class AdoS0QmsRawWhitelistUpsertDto : IValidatableObject { public string? SupplierCode { get; set; } public string? SupplierName { get; set; } public string? MaterialCode { get; set; } public string? MaterialName { get; set; } public string? DimensionType { get; set; } public IEnumerable Validate(ValidationContext validationContext) { var dimensionType = string.IsNullOrWhiteSpace(DimensionType) ? "supplier" : DimensionType.Trim().ToLowerInvariant(); if (dimensionType is not ("supplier" or "material" or "material_supplier")) { yield return new ValidationResult("维度类型仅支持 supplier/material/material_supplier", [nameof(DimensionType)]); yield break; } if ((dimensionType == "supplier" || dimensionType == "material_supplier") && string.IsNullOrWhiteSpace(SupplierCode)) yield return new ValidationResult("供应商编码不能为空", [nameof(SupplierCode)]); if ((dimensionType == "supplier" || dimensionType == "material_supplier") && string.IsNullOrWhiteSpace(SupplierName)) yield return new ValidationResult("供应商名称不能为空", [nameof(SupplierName)]); if ((dimensionType == "material" || dimensionType == "material_supplier") && string.IsNullOrWhiteSpace(MaterialCode)) yield return new ValidationResult("物料编码不能为空", [nameof(MaterialCode)]); } } public class AdoS0QmsSamplingSchemeUpsertDto { [Required(ErrorMessage = "编号不能为空")] [MaxLength(255)] public string Number { get; set; } = string.Empty; [Required(ErrorMessage = "名称不能为空")] [MaxLength(255)] public string Name { get; set; } = string.Empty; [MaxLength(255)] public string? SamplingType { get; set; } [MaxLength(255)] public string? InspectionLevel { get; set; } [MaxLength(255)] public string? Strictness { get; set; } [MaxLength(255)] public string? AqlValue { get; set; } [MaxLength(255)] public string? InspectionType { get; set; } public long? InspectOrgId { get; set; } [MaxLength(255)] public string? InspectUserId { get; set; } [MaxLength(255)] public string? Status { get; set; } [MaxLength(255)] public string? EnableStatus { get; set; } [MaxLength(255)] public string? Comment { get; set; } public decimal? FixedSamplingRate { get; set; } } public class AdoS0QmsInspectionInstrumentUpsertDto { [Required(ErrorMessage = "编号不能为空")] [MaxLength(255)] public string Number { get; set; } = string.Empty; [Required(ErrorMessage = "名称不能为空")] [MaxLength(255)] public string Name { get; set; } = string.Empty; [MaxLength(255)] public string? Model { get; set; } [MaxLength(255)] public string? Specification { get; set; } [MaxLength(255)] public string? Manufacturer { get; set; } [MaxLength(255)] public string? Status { get; set; } [MaxLength(255)] public string? EnableStatus { get; set; } [MaxLength(255)] public string? Comment { get; set; } [MaxLength(255)] public string? GaugeCategory { get; set; } public int? CalibrationCycleDays { get; set; } [MaxLength(50)] public string? NextCalibrationDate { get; set; } } public class AdoS0QmsQualityBaseTypeUpsertDto { [Required(ErrorMessage = "类型分类不能为空")] [MaxLength(100)] public string TypeCategory { get; set; } = string.Empty; [Required(ErrorMessage = "类型编码不能为空")] [MaxLength(100)] public string TypeCode { get; set; } = string.Empty; [Required(ErrorMessage = "简称不能为空")] [MaxLength(200)] public string ShortName { get; set; } = string.Empty; [MaxLength(255)] public string? FullName { get; set; } public bool IsActive { get; set; } = true; [MaxLength(500)] public string? Remark { get; set; } } public class AdoS0QmsInspectionMethodUpsertDto { [Required(ErrorMessage = "编号不能为空")] [MaxLength(255)] public string Number { get; set; } = string.Empty; [Required(ErrorMessage = "名称不能为空")] [MaxLength(255)] public string Name { get; set; } = string.Empty; [MaxLength(255)] public string? ControlStrategy { get; set; } [MaxLength(255)] public string? Status { get; set; } [MaxLength(255)] public string? EnableStatus { get; set; } [MaxLength(255)] public string? Comment { get; set; } } public class AdoS0QmsInspectionItemUpsertDto { [Required(ErrorMessage = "编号不能为空")] [MaxLength(255)] public string Number { get; set; } = string.Empty; [Required(ErrorMessage = "名称不能为空")] [MaxLength(255)] public string Name { get; set; } = string.Empty; public long? CheckMethodId { get; set; } public long? CheckBasisId { get; set; } public long? CheckInstructId { get; set; } [MaxLength(255)] public string? RadioGroupField { get; set; } [MaxLength(255)] public string? RadioGroupField1 { get; set; } public long? MetricType { get; set; } [MaxLength(255)] public string? Status { get; set; } [MaxLength(255)] public string? EnableStatus { get; set; } [MaxLength(255)] public string? Comment { get; set; } } public class AdoS0QmsInspectionFrequencyUpsertDto { [Required(ErrorMessage = "编号不能为空")] [MaxLength(255)] public string Number { get; set; } = string.Empty; [Required(ErrorMessage = "名称不能为空")] [MaxLength(255)] public string Name { get; set; } = string.Empty; [MaxLength(255)] public string? Remark { get; set; } [MaxLength(255)] public string? Status { get; set; } [MaxLength(255)] public string? EnableStatus { get; set; } } public class AdoS0QmsInspectionBasisEntryDto { public long? Id { get; set; } public long? Seq { get; set; } public string? DocumentNumber { get; set; } public string? DocumentName { get; set; } public string? Attachment { get; set; } } public class AdoS0QmsInspectionBasisUpsertDto { [Required(ErrorMessage = "编号不能为空")] public string Number { get; set; } = string.Empty; [Required(ErrorMessage = "名称不能为空")] public string Name { get; set; } = string.Empty; public string? ControlStrategy { get; set; } public long? CreateOrgId { get; set; } public long? UseOrgId { get; set; } public string? Comment { get; set; } public string? Status { get; set; } public string? EnableStatus { get; set; } public List Items { get; set; } = []; } public class AdoS0QmsInspectionStandardEntryDto { public long? Id { get; set; } public long? Seq { get; set; } public string? CheckItems { get; set; } public string? CheckContent { get; set; } public string? NormType { get; set; } public string? SpecValue { get; set; } public decimal? TopValue { get; set; } public decimal? DownValue { get; set; } public long? CheckBasisId { get; set; } public long? CheckMethodId { get; set; } public long? CheckFrequencyId { get; set; } public long? CheckInstructId { get; set; } public string? Unit { get; set; } public long? KeyQuality { get; set; } } public class AdoS0QmsInspectionStandardUpsertDto { [Required(ErrorMessage = "编号不能为空")] public string Number { get; set; } = string.Empty; [Required(ErrorMessage = "名称不能为空")] public string Name { get; set; } = string.Empty; public string? Comment { get; set; } public string? ControlStrategy { get; set; } public long? CreateOrgId { get; set; } public long? UseOrgId { get; set; } public string? Status { get; set; } public string? EnableStatus { get; set; } public List Items { get; set; } = []; } public class AdoS0QmsInspectionPlanEntryDto { public long? Id { get; set; } public int? Seq { get; set; } public string? SetupType { get; set; } public string? MaterialCode { get; set; } public string? MaterialName { get; set; } public long? MaterialTypeId { get; set; } public string? SupplierId { get; set; } public long? SamplingSchemeId { get; set; } public long? InspectionStandardId { get; set; } public long? InspectOrgId { get; set; } public long? InspectUserId { get; set; } public long? QRouteId { get; set; } public string? OperationNo { get; set; } public long? OperationId { get; set; } public long? InspectionFrequencyId { get; set; } public string? ProcessSeq { get; set; } public long? InspectionType { get; set; } } public class AdoS0QmsInspectionPlanUpsertDto { [Required(ErrorMessage = "编号不能为空")] public string Number { get; set; } = string.Empty; [Required(ErrorMessage = "名称不能为空")] public string Name { get; set; } = string.Empty; public string? BizTypeId { get; set; } public string? Comment { get; set; } public string? ControlStrategy { get; set; } public long? CreateOrgId { get; set; } public long? UseOrgId { get; set; } public string? Status { get; set; } public string? EnableStatus { get; set; } public List Items { get; set; } = []; } // 【检验规范四表的必填与长度约束】 // · 必填(文件编号 / 物料编码 / 原材料名称 / 版本 / ≥1 明细)不写成 [Required], // 因为 Create 与 Update 共用本 DTO,加特性会把实测的 72 条历史脏记录锁死不可编辑。 // 必填一律由 AdoS0QmsSpecAggregateGuard 在控制器内按「新增严格 / 编辑禁止劣化」分别判定。 // · [MaxLength] 按 aidopdev 实测列长逐列对齐(information_schema,as_of 2026-09-02),不做 255 一刀切: // text 列不设限;上/下限是 varchar(50);过程/FQC/OQC 的「物料编码」是 text,与原材料的 varchar(255) 不同。 public class AdoS0QmsRawInspectionSpecEntryDto { public long? Id { get; set; } public int? Seq { get; set; } public string? InspectionItem { get; set; } public string? InspectionStandard { get; set; } public string? InspectionMethod { get; set; } public string? ImageCategory { get; set; } public string? SamplingScheme { get; set; } public string? Remark { get; set; } public string? Attachment { get; set; } [MaxLength(50)] public string? UpperLimit { get; set; } [MaxLength(50)] public string? LowerLimit { get; set; } } public class AdoS0QmsRawInspectionSpecUpsertDto { // 必填不在特性层:[Required] 会先于 AdoS0QmsSpecAggregateGuard 触发,把 Update 直接挡成 400, // 破坏「历史兼容」(实测 qms_gcjygf 有 3 行 wjbh 为空,曾因此不可编辑)。 [MaxLength(255)] public string? FileNumber { get; set; } [MaxLength(255)] public string? VersionNo { get; set; } [MaxLength(255)] public string? DrawingNo { get; set; } [MaxLength(255)] public string? RawMaterialName { get; set; } [MaxLength(255)] public string? MaterialCode { get; set; } [MaxLength(255)] public string? EffectiveDate { get; set; } [MaxLength(255)] public string? DrawingVersion { get; set; } [MaxLength(255)] public string? MaterialGrade { get; set; } [MaxLength(255)] public string? CavityOrMold { get; set; } public string? Attachment { get; set; } // fj text public string? FileName { get; set; } // filename text [MaxLength(255)] public string? Title { get; set; } public List Items { get; set; } = []; } public class AdoS0QmsProcessInspectionSpecEntryDto { public long? Id { get; set; } public string? OperationCode { get; set; } public string? OperationName { get; set; } public string? InspectionItem { get; set; } public string? InspectionMethod { get; set; } public string? InspectionSpec { get; set; } public string? ImageCategory { get; set; } public string? InspectionFrequency { get; set; } public string? TechnicalStandard { get; set; } public long? PeelingForce { get; set; } [MaxLength(50)] public string? UpperLimit { get; set; } [MaxLength(50)] public string? LowerLimit { get; set; } } public class AdoS0QmsProcessInspectionSpecUpsertDto { [MaxLength(255)] public string? ApplicableModel { get; set; } // 必填不在特性层:[Required] 会先于 AdoS0QmsSpecAggregateGuard 触发,把 Update 直接挡成 400, // 破坏「历史兼容」(实测 qms_gcjygf 有 3 行 wjbh 为空,曾因此不可编辑)。 [MaxLength(255)] public string? FileNumber { get; set; } [MaxLength(255)] public string? VersionNo { get; set; } [MaxLength(255)] public string? EffectiveDate { get; set; } public string? Attachment { get; set; } // fj text public string? MaterialCode { get; set; } // wlbm text(与原材料表 varchar(255) 不同) public string? Attachment2 { get; set; } // fj2 text public int? Version { get; set; } public List Items { get; set; } = []; } public class AdoS0QmsFqcInspectionSpecEntryDto { public long? Id { get; set; } public string? OperationCode { get; set; } public string? OperationName { get; set; } public string? InspectionItem { get; set; } public string? InspectionMethod { get; set; } public string? InspectionSpec { get; set; } public string? ImageCategory { get; set; } public string? InspectionFrequency { get; set; } public string? TechnicalStandard { get; set; } public long? PeelingForce { get; set; } [MaxLength(50)] public string? UpperLimit { get; set; } [MaxLength(50)] public string? LowerLimit { get; set; } } public class AdoS0QmsFqcInspectionSpecUpsertDto { [MaxLength(255)] public string? ApplicableModel { get; set; } // 必填不在特性层:[Required] 会先于 AdoS0QmsSpecAggregateGuard 触发,把 Update 直接挡成 400, // 破坏「历史兼容」(实测 qms_gcjygf 有 3 行 wjbh 为空,曾因此不可编辑)。 [MaxLength(255)] public string? FileNumber { get; set; } [MaxLength(255)] public string? VersionNo { get; set; } [MaxLength(255)] public string? EffectiveDate { get; set; } public string? Attachment { get; set; } // fj text public string? MaterialCode { get; set; } // wlbm text public string? Attachment2 { get; set; } // fj2 text public int? Version { get; set; } public List Items { get; set; } = []; } public class AdoS0QmsOqcInspectionSpecEntryDto { public long? Id { get; set; } public string? OperationCode { get; set; } public string? OperationName { get; set; } public string? InspectionItem { get; set; } public string? InspectionMethod { get; set; } public string? InspectionSpec { get; set; } public string? ImageCategory { get; set; } public string? InspectionFrequency { get; set; } public string? TechnicalStandard { get; set; } public long? PeelingForce { get; set; } [MaxLength(50)] public string? UpperLimit { get; set; } [MaxLength(50)] public string? LowerLimit { get; set; } } public class AdoS0QmsOqcInspectionSpecUpsertDto { [MaxLength(255)] public string? ApplicableModel { get; set; } // 必填不在特性层:[Required] 会先于 AdoS0QmsSpecAggregateGuard 触发,把 Update 直接挡成 400, // 破坏「历史兼容」(实测 qms_gcjygf 有 3 行 wjbh 为空,曾因此不可编辑)。 [MaxLength(255)] public string? FileNumber { get; set; } [MaxLength(255)] public string? VersionNo { get; set; } [MaxLength(255)] public string? EffectiveDate { get; set; } public string? Attachment { get; set; } // fj text public string? MaterialCode { get; set; } // wlbm text public string? Attachment2 { get; set; } // fj2 text public int? Version { get; set; } public List Items { get; set; } = []; }