AdoS0QualityDtos.cs 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455
  1. namespace Admin.NET.Plugin.AiDOP.Dto.S0.Quality;
  2. public class AdoS0QualityPagedQueryDto
  3. {
  4. public string? Keyword { get; set; }
  5. public int Page { get; set; } = 1;
  6. public int PageSize { get; set; } = 20;
  7. }
  8. public class AdoS0QualitySimpleOptionDto
  9. {
  10. public long Value { get; set; }
  11. public string Label { get; set; } = string.Empty;
  12. }
  13. public class AdoS0QmsRawWhitelistUpsertDto : IValidatableObject
  14. {
  15. public string? SupplierCode { get; set; }
  16. public string? SupplierName { get; set; }
  17. public string? MaterialCode { get; set; }
  18. public string? MaterialName { get; set; }
  19. public string? DimensionType { get; set; }
  20. public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
  21. {
  22. var dimensionType = string.IsNullOrWhiteSpace(DimensionType)
  23. ? "supplier"
  24. : DimensionType.Trim().ToLowerInvariant();
  25. if (dimensionType is not ("supplier" or "material" or "material_supplier"))
  26. {
  27. yield return new ValidationResult("维度类型仅支持 supplier/material/material_supplier", [nameof(DimensionType)]);
  28. yield break;
  29. }
  30. if ((dimensionType == "supplier" || dimensionType == "material_supplier")
  31. && string.IsNullOrWhiteSpace(SupplierCode))
  32. yield return new ValidationResult("供应商编码不能为空", [nameof(SupplierCode)]);
  33. if ((dimensionType == "supplier" || dimensionType == "material_supplier")
  34. && string.IsNullOrWhiteSpace(SupplierName))
  35. yield return new ValidationResult("供应商名称不能为空", [nameof(SupplierName)]);
  36. if ((dimensionType == "material" || dimensionType == "material_supplier")
  37. && string.IsNullOrWhiteSpace(MaterialCode))
  38. yield return new ValidationResult("物料编码不能为空", [nameof(MaterialCode)]);
  39. }
  40. }
  41. public class AdoS0QmsSamplingSchemeUpsertDto
  42. {
  43. [Required(ErrorMessage = "编号不能为空")]
  44. [MaxLength(255)]
  45. public string Number { get; set; } = string.Empty;
  46. [Required(ErrorMessage = "名称不能为空")]
  47. [MaxLength(255)]
  48. public string Name { get; set; } = string.Empty;
  49. [MaxLength(255)]
  50. public string? SamplingType { get; set; }
  51. [MaxLength(255)]
  52. public string? InspectionLevel { get; set; }
  53. [MaxLength(255)]
  54. public string? Strictness { get; set; }
  55. [MaxLength(255)]
  56. public string? AqlValue { get; set; }
  57. [MaxLength(255)]
  58. public string? InspectionType { get; set; }
  59. public long? InspectOrgId { get; set; }
  60. [MaxLength(255)]
  61. public string? InspectUserId { get; set; }
  62. [MaxLength(255)]
  63. public string? Status { get; set; }
  64. [MaxLength(255)]
  65. public string? EnableStatus { get; set; }
  66. [MaxLength(255)]
  67. public string? Comment { get; set; }
  68. public decimal? FixedSamplingRate { get; set; }
  69. }
  70. public class AdoS0QmsInspectionInstrumentUpsertDto
  71. {
  72. [Required(ErrorMessage = "编号不能为空")]
  73. [MaxLength(255)]
  74. public string Number { get; set; } = string.Empty;
  75. [Required(ErrorMessage = "名称不能为空")]
  76. [MaxLength(255)]
  77. public string Name { get; set; } = string.Empty;
  78. [MaxLength(255)]
  79. public string? Model { get; set; }
  80. [MaxLength(255)]
  81. public string? Specification { get; set; }
  82. [MaxLength(255)]
  83. public string? Manufacturer { get; set; }
  84. [MaxLength(255)]
  85. public string? Status { get; set; }
  86. [MaxLength(255)]
  87. public string? EnableStatus { get; set; }
  88. [MaxLength(255)]
  89. public string? Comment { get; set; }
  90. [MaxLength(255)]
  91. public string? GaugeCategory { get; set; }
  92. public int? CalibrationCycleDays { get; set; }
  93. [MaxLength(50)]
  94. public string? NextCalibrationDate { get; set; }
  95. }
  96. public class AdoS0QmsQualityBaseTypeUpsertDto
  97. {
  98. [Required(ErrorMessage = "类型分类不能为空")]
  99. [MaxLength(100)]
  100. public string TypeCategory { get; set; } = string.Empty;
  101. [Required(ErrorMessage = "类型编码不能为空")]
  102. [MaxLength(100)]
  103. public string TypeCode { get; set; } = string.Empty;
  104. [Required(ErrorMessage = "简称不能为空")]
  105. [MaxLength(200)]
  106. public string ShortName { get; set; } = string.Empty;
  107. [MaxLength(255)]
  108. public string? FullName { get; set; }
  109. public bool IsActive { get; set; } = true;
  110. [MaxLength(500)]
  111. public string? Remark { get; set; }
  112. }
  113. public class AdoS0QmsInspectionMethodUpsertDto
  114. {
  115. [Required(ErrorMessage = "编号不能为空")]
  116. [MaxLength(255)]
  117. public string Number { get; set; } = string.Empty;
  118. [Required(ErrorMessage = "名称不能为空")]
  119. [MaxLength(255)]
  120. public string Name { get; set; } = string.Empty;
  121. [MaxLength(255)]
  122. public string? ControlStrategy { get; set; }
  123. [MaxLength(255)]
  124. public string? Status { get; set; }
  125. [MaxLength(255)]
  126. public string? EnableStatus { get; set; }
  127. [MaxLength(255)]
  128. public string? Comment { get; set; }
  129. }
  130. public class AdoS0QmsInspectionItemUpsertDto
  131. {
  132. [Required(ErrorMessage = "编号不能为空")]
  133. [MaxLength(255)]
  134. public string Number { get; set; } = string.Empty;
  135. [Required(ErrorMessage = "名称不能为空")]
  136. [MaxLength(255)]
  137. public string Name { get; set; } = string.Empty;
  138. public long? CheckMethodId { get; set; }
  139. public long? CheckBasisId { get; set; }
  140. public long? CheckInstructId { get; set; }
  141. [MaxLength(255)]
  142. public string? RadioGroupField { get; set; }
  143. [MaxLength(255)]
  144. public string? RadioGroupField1 { get; set; }
  145. public long? MetricType { get; set; }
  146. [MaxLength(255)]
  147. public string? Status { get; set; }
  148. [MaxLength(255)]
  149. public string? EnableStatus { get; set; }
  150. [MaxLength(255)]
  151. public string? Comment { get; set; }
  152. }
  153. public class AdoS0QmsInspectionFrequencyUpsertDto
  154. {
  155. [Required(ErrorMessage = "编号不能为空")]
  156. [MaxLength(255)]
  157. public string Number { get; set; } = string.Empty;
  158. [Required(ErrorMessage = "名称不能为空")]
  159. [MaxLength(255)]
  160. public string Name { get; set; } = string.Empty;
  161. [MaxLength(255)]
  162. public string? Remark { get; set; }
  163. [MaxLength(255)]
  164. public string? Status { get; set; }
  165. [MaxLength(255)]
  166. public string? EnableStatus { get; set; }
  167. }
  168. public class AdoS0QmsInspectionBasisEntryDto
  169. {
  170. public long? Id { get; set; }
  171. public long? Seq { get; set; }
  172. public string? DocumentNumber { get; set; }
  173. public string? DocumentName { get; set; }
  174. public string? Attachment { get; set; }
  175. }
  176. public class AdoS0QmsInspectionBasisUpsertDto
  177. {
  178. [Required(ErrorMessage = "编号不能为空")]
  179. public string Number { get; set; } = string.Empty;
  180. [Required(ErrorMessage = "名称不能为空")]
  181. public string Name { get; set; } = string.Empty;
  182. public string? ControlStrategy { get; set; }
  183. public long? CreateOrgId { get; set; }
  184. public long? UseOrgId { get; set; }
  185. public string? Comment { get; set; }
  186. public string? Status { get; set; }
  187. public string? EnableStatus { get; set; }
  188. public List<AdoS0QmsInspectionBasisEntryDto> Items { get; set; } = [];
  189. }
  190. public class AdoS0QmsInspectionStandardEntryDto
  191. {
  192. public long? Id { get; set; }
  193. public long? Seq { get; set; }
  194. public string? CheckItems { get; set; }
  195. public string? CheckContent { get; set; }
  196. public string? NormType { get; set; }
  197. public string? SpecValue { get; set; }
  198. public decimal? TopValue { get; set; }
  199. public decimal? DownValue { get; set; }
  200. public long? CheckBasisId { get; set; }
  201. public long? CheckMethodId { get; set; }
  202. public long? CheckFrequencyId { get; set; }
  203. public long? CheckInstructId { get; set; }
  204. public string? Unit { get; set; }
  205. public long? KeyQuality { get; set; }
  206. }
  207. public class AdoS0QmsInspectionStandardUpsertDto
  208. {
  209. [Required(ErrorMessage = "编号不能为空")]
  210. public string Number { get; set; } = string.Empty;
  211. [Required(ErrorMessage = "名称不能为空")]
  212. public string Name { get; set; } = string.Empty;
  213. public string? Comment { get; set; }
  214. public string? ControlStrategy { get; set; }
  215. public long? CreateOrgId { get; set; }
  216. public long? UseOrgId { get; set; }
  217. public string? Status { get; set; }
  218. public string? EnableStatus { get; set; }
  219. public List<AdoS0QmsInspectionStandardEntryDto> Items { get; set; } = [];
  220. }
  221. public class AdoS0QmsInspectionPlanEntryDto
  222. {
  223. public long? Id { get; set; }
  224. public int? Seq { get; set; }
  225. public string? SetupType { get; set; }
  226. public string? MaterialCode { get; set; }
  227. public string? MaterialName { get; set; }
  228. public long? MaterialTypeId { get; set; }
  229. public string? SupplierId { get; set; }
  230. public long? SamplingSchemeId { get; set; }
  231. public long? InspectionStandardId { get; set; }
  232. public long? InspectOrgId { get; set; }
  233. public long? InspectUserId { get; set; }
  234. public long? QRouteId { get; set; }
  235. public string? OperationNo { get; set; }
  236. public long? OperationId { get; set; }
  237. public long? InspectionFrequencyId { get; set; }
  238. public string? ProcessSeq { get; set; }
  239. public long? InspectionType { get; set; }
  240. }
  241. public class AdoS0QmsInspectionPlanUpsertDto
  242. {
  243. [Required(ErrorMessage = "编号不能为空")]
  244. public string Number { get; set; } = string.Empty;
  245. [Required(ErrorMessage = "名称不能为空")]
  246. public string Name { get; set; } = string.Empty;
  247. public string? BizTypeId { get; set; }
  248. public string? Comment { get; set; }
  249. public string? ControlStrategy { get; set; }
  250. public long? CreateOrgId { get; set; }
  251. public long? UseOrgId { get; set; }
  252. public string? Status { get; set; }
  253. public string? EnableStatus { get; set; }
  254. public List<AdoS0QmsInspectionPlanEntryDto> Items { get; set; } = [];
  255. }
  256. // 【检验规范四表的必填与长度约束】
  257. // · 必填(文件编号 / 物料编码 / 原材料名称 / 版本 / ≥1 明细)不写成 [Required],
  258. // 因为 Create 与 Update 共用本 DTO,加特性会把实测的 72 条历史脏记录锁死不可编辑。
  259. // 必填一律由 AdoS0QmsSpecAggregateGuard 在控制器内按「新增严格 / 编辑禁止劣化」分别判定。
  260. // · [MaxLength] 按 aidopdev 实测列长逐列对齐(information_schema,as_of 2026-09-02),不做 255 一刀切:
  261. // text 列不设限;上/下限是 varchar(50);过程/FQC/OQC 的「物料编码」是 text,与原材料的 varchar(255) 不同。
  262. public class AdoS0QmsRawInspectionSpecEntryDto
  263. {
  264. public long? Id { get; set; }
  265. public int? Seq { get; set; }
  266. public string? InspectionItem { get; set; }
  267. public string? InspectionStandard { get; set; }
  268. public string? InspectionMethod { get; set; }
  269. public string? ImageCategory { get; set; }
  270. public string? SamplingScheme { get; set; }
  271. public string? Remark { get; set; }
  272. public string? Attachment { get; set; }
  273. [MaxLength(50)]
  274. public string? UpperLimit { get; set; }
  275. [MaxLength(50)]
  276. public string? LowerLimit { get; set; }
  277. }
  278. public class AdoS0QmsRawInspectionSpecUpsertDto
  279. {
  280. // 必填不在特性层:[Required] 会先于 AdoS0QmsSpecAggregateGuard 触发,把 Update 直接挡成 400,
  281. // 破坏「历史兼容」(实测 qms_gcjygf 有 3 行 wjbh 为空,曾因此不可编辑)。
  282. [MaxLength(255)]
  283. public string? FileNumber { get; set; }
  284. [MaxLength(255)] public string? VersionNo { get; set; }
  285. [MaxLength(255)] public string? DrawingNo { get; set; }
  286. [MaxLength(255)] public string? RawMaterialName { get; set; }
  287. [MaxLength(255)] public string? MaterialCode { get; set; }
  288. [MaxLength(255)] public string? EffectiveDate { get; set; }
  289. [MaxLength(255)] public string? DrawingVersion { get; set; }
  290. [MaxLength(255)] public string? MaterialGrade { get; set; }
  291. [MaxLength(255)] public string? CavityOrMold { get; set; }
  292. public string? Attachment { get; set; } // fj text
  293. public string? FileName { get; set; } // filename text
  294. [MaxLength(255)] public string? Title { get; set; }
  295. public List<AdoS0QmsRawInspectionSpecEntryDto> Items { get; set; } = [];
  296. }
  297. public class AdoS0QmsProcessInspectionSpecEntryDto
  298. {
  299. public long? Id { get; set; }
  300. public string? OperationCode { get; set; }
  301. public string? OperationName { get; set; }
  302. public string? InspectionItem { get; set; }
  303. public string? InspectionMethod { get; set; }
  304. public string? InspectionSpec { get; set; }
  305. public string? ImageCategory { get; set; }
  306. public string? InspectionFrequency { get; set; }
  307. public string? TechnicalStandard { get; set; }
  308. public long? PeelingForce { get; set; }
  309. [MaxLength(50)]
  310. public string? UpperLimit { get; set; }
  311. [MaxLength(50)]
  312. public string? LowerLimit { get; set; }
  313. }
  314. public class AdoS0QmsProcessInspectionSpecUpsertDto
  315. {
  316. [MaxLength(255)] public string? ApplicableModel { get; set; }
  317. // 必填不在特性层:[Required] 会先于 AdoS0QmsSpecAggregateGuard 触发,把 Update 直接挡成 400,
  318. // 破坏「历史兼容」(实测 qms_gcjygf 有 3 行 wjbh 为空,曾因此不可编辑)。
  319. [MaxLength(255)]
  320. public string? FileNumber { get; set; }
  321. [MaxLength(255)] public string? VersionNo { get; set; }
  322. [MaxLength(255)] public string? EffectiveDate { get; set; }
  323. public string? Attachment { get; set; } // fj text
  324. public string? MaterialCode { get; set; } // wlbm text(与原材料表 varchar(255) 不同)
  325. public string? Attachment2 { get; set; } // fj2 text
  326. public int? Version { get; set; }
  327. public List<AdoS0QmsProcessInspectionSpecEntryDto> Items { get; set; } = [];
  328. }
  329. public class AdoS0QmsFqcInspectionSpecEntryDto
  330. {
  331. public long? Id { get; set; }
  332. public string? OperationCode { get; set; }
  333. public string? OperationName { get; set; }
  334. public string? InspectionItem { get; set; }
  335. public string? InspectionMethod { get; set; }
  336. public string? InspectionSpec { get; set; }
  337. public string? ImageCategory { get; set; }
  338. public string? InspectionFrequency { get; set; }
  339. public string? TechnicalStandard { get; set; }
  340. public long? PeelingForce { get; set; }
  341. [MaxLength(50)]
  342. public string? UpperLimit { get; set; }
  343. [MaxLength(50)]
  344. public string? LowerLimit { get; set; }
  345. }
  346. public class AdoS0QmsFqcInspectionSpecUpsertDto
  347. {
  348. [MaxLength(255)] public string? ApplicableModel { get; set; }
  349. // 必填不在特性层:[Required] 会先于 AdoS0QmsSpecAggregateGuard 触发,把 Update 直接挡成 400,
  350. // 破坏「历史兼容」(实测 qms_gcjygf 有 3 行 wjbh 为空,曾因此不可编辑)。
  351. [MaxLength(255)]
  352. public string? FileNumber { get; set; }
  353. [MaxLength(255)] public string? VersionNo { get; set; }
  354. [MaxLength(255)] public string? EffectiveDate { get; set; }
  355. public string? Attachment { get; set; } // fj text
  356. public string? MaterialCode { get; set; } // wlbm text
  357. public string? Attachment2 { get; set; } // fj2 text
  358. public int? Version { get; set; }
  359. public List<AdoS0QmsFqcInspectionSpecEntryDto> Items { get; set; } = [];
  360. }
  361. public class AdoS0QmsOqcInspectionSpecEntryDto
  362. {
  363. public long? Id { get; set; }
  364. public string? OperationCode { get; set; }
  365. public string? OperationName { get; set; }
  366. public string? InspectionItem { get; set; }
  367. public string? InspectionMethod { get; set; }
  368. public string? InspectionSpec { get; set; }
  369. public string? ImageCategory { get; set; }
  370. public string? InspectionFrequency { get; set; }
  371. public string? TechnicalStandard { get; set; }
  372. public long? PeelingForce { get; set; }
  373. [MaxLength(50)]
  374. public string? UpperLimit { get; set; }
  375. [MaxLength(50)]
  376. public string? LowerLimit { get; set; }
  377. }
  378. public class AdoS0QmsOqcInspectionSpecUpsertDto
  379. {
  380. [MaxLength(255)] public string? ApplicableModel { get; set; }
  381. // 必填不在特性层:[Required] 会先于 AdoS0QmsSpecAggregateGuard 触发,把 Update 直接挡成 400,
  382. // 破坏「历史兼容」(实测 qms_gcjygf 有 3 行 wjbh 为空,曾因此不可编辑)。
  383. [MaxLength(255)]
  384. public string? FileNumber { get; set; }
  385. [MaxLength(255)] public string? VersionNo { get; set; }
  386. [MaxLength(255)] public string? EffectiveDate { get; set; }
  387. public string? Attachment { get; set; } // fj text
  388. public string? MaterialCode { get; set; } // wlbm text
  389. public string? Attachment2 { get; set; } // fj2 text
  390. public int? Version { get; set; }
  391. public List<AdoS0QmsOqcInspectionSpecEntryDto> Items { get; set; } = [];
  392. }