namespace Admin.NET.Plugin.AiDOP.FinishedWarehouse.Dto;
// ══════════════════════════════════════════════════════════════════════════
// S7 FQC 成品质量:检验任务列表 / 检验单(结果)列表 只读 DTO
//
// 数据源(均 aidopdev,只读):
// - 检验任务:qms_fqcbj(37 列,归口自旧系统 dopdemo,空表待上游抽数)
// - 检验单 :qms_qcpp_inspbill(主表)+ WorkOrdMaster(取 SAP 工单号,sczld=Batch)
// WP0-D4:按 tenant_id 过滤;TenantId 由前端 withAidopTenantParams 注入。
// 字段修正:物料名称=wlmc(非 lmc);检验数量=jysj(非 ysj);SAP工单号=WorkOrdMaster.WorkOrd。
// ══════════════════════════════════════════════════════════════════════════
/// FQC 检验任务列表 查询入参(只读,源 qms_fqcbj)。
public class FqcTaskListInput
{
/// 页码(从 1 开始)
public int Page { get; set; } = 1;
/// 每页条数(上限 200)
public int PageSize { get; set; } = 10;
/// 排序字段(前端 prop,白名单校验)
public string? OrderBy { get; set; }
/// 排序方向 asc/desc(默认 desc)
public string? OrderDir { get; set; }
/// 生产指令单(qms_fqcbj.sczld,模糊)
public string? ProductionOrderNo { get; set; }
/// 生产批号(qms_fqcbj.scph,模糊)
public string? ProductionBatchNo { get; set; }
/// 物料编码(qms_fqcbj.wlbm,模糊)
public string? MaterialCode { get; set; }
/// 申请时间起(qms_fqcbj.FAPPLYTIME,含当日,yyyy-MM-dd)
public string? ApplyTimeStart { get; set; }
/// 申请时间止(qms_fqcbj.FAPPLYTIME,含当日,yyyy-MM-dd)
public string? ApplyTimeEnd { get; set; }
/// 检验进度(qms_fqcbj.FINSPECTSTATUS,精确)
public string? InspectProgress { get; set; }
/// 检验优先级(qms_fqcbj.yxj,模糊;字典未接,原样匹配)
public string? Priority { get; set; }
/// 检验负责人(qms_fqcbj.jyfzr,模糊)
public string? Inspector { get; set; }
}
/// FQC 检验任务列表 行(只读)。prop 对齐前端列;源列见注释(qms_fqcbj)。
public class FqcTaskListRow
{
/// 主键(qms_fqcbj.id)
public long Id { get; set; }
/// 单据编号(qms_fqcbj.FBILLNO)
public string? BillNo { get; set; }
/// 生产指令单(qms_fqcbj.sczld)
public string? ProductionOrderNo { get; set; }
/// 申请组织(qms_fqcbj.FORGID,原样 id)
public long? ApplyOrgId { get; set; }
/// 申请时间(qms_fqcbj.FAPPLYTIME)
public DateTime? ApplyTime { get; set; }
/// 物料编码(qms_fqcbj.wlbm)
public string? MaterialCode { get; set; }
/// 产品名称(qms_fqcbj.cpmc)
public string? ProductName { get; set; }
/// 产品型号(qms_fqcbj.cpxh)
public string? ProductModel { get; set; }
/// 生产批号(qms_fqcbj.scph)
public string? ProductionBatchNo { get; set; }
/// 指令单数量(qms_fqcbj.sczldsl)
public decimal? OrderQty { get; set; }
/// 数量(qms_fqcbj.sl)
public decimal? Qty { get; set; }
/// 申请人(qms_fqcbj.FAPPLYUSER)
public string? Applicant { get; set; }
/// 备注(qms_fqcbj.FCOMMENT)
public string? Remark { get; set; }
/// 检验优先级(qms_fqcbj.yxj,原样,未接字典)
public string? Priority { get; set; }
/// 检验开始时间(qms_fqcbj.jykssj)
public DateTime? InspectStartTime { get; set; }
/// 检验完成时间(qms_fqcbj.jywcsj)
public DateTime? InspectFinishTime { get; set; }
/// 检验负责人(qms_fqcbj.jyfzr)
public string? Inspector { get; set; }
/// 检验进度(qms_fqcbj.FINSPECTSTATUS,原样)
public string? InspectProgress { get; set; }
}
/// FQC 检验单(结果)列表 查询入参(只读,源 qms_qcpp_inspbill)。
public class FqcResultListInput
{
/// 页码(从 1 开始)
public int Page { get; set; } = 1;
/// 每页条数(上限 200)
public int PageSize { get; set; } = 10;
/// 排序字段(前端 prop,白名单校验)
public string? OrderBy { get; set; }
/// 排序方向 asc/desc(默认 desc)
public string? OrderDir { get; set; }
/// 单据编号(qms_qcpp_inspbill.FBILLNO,模糊)
public string? BillNo { get; set; }
/// 生产批号(qms_qcpp_inspbill.scph,模糊)
public string? ProductionBatchNo { get; set; }
/// 物料编码(qms_qcpp_inspbill.FMATERIALCFG,模糊)
public string? MaterialCode { get; set; }
/// 物料名称(qms_qcpp_inspbill.wlmc,模糊)
public string? MaterialName { get; set; }
/// 检验人(qms_qcpp_inspbill.jyr,模糊)
public string? Inspector { get; set; }
/// 来源单据编号(qms_qcpp_inspbill.lydjbh,模糊)
public string? SourceBillNo { get; set; }
/// 生产指令单(qms_qcpp_inspbill.sczld,模糊)
public string? ProductionOrderNo { get; set; }
/// 检验日期起(qms_qcpp_inspbill.FINSPEENDDATE,含当日,yyyy-MM-dd)
public string? InspectDateStart { get; set; }
/// 检验日期止(qms_qcpp_inspbill.FINSPEENDDATE,含当日,yyyy-MM-dd)
public string? InspectDateEnd { get; set; }
/// 判定(qms_qcpp_inspbill.pd,原样精确)
public string? Judgment { get; set; }
}
/// FQC 检验单(结果)列表 行(只读)。prop 对齐前端列;源列见注释。
public class FqcResultListRow
{
/// 主键(qms_qcpp_inspbill.id)
public long Id { get; set; }
/// 单据编号(qms_qcpp_inspbill.FBILLNO)
public string? BillNo { get; set; }
/// 检验时间(qms_qcpp_inspbill.FINSPEENDDATE)
public DateTime? InspectTime { get; set; }
/// 生产批号(qms_qcpp_inspbill.scph)
public string? ProductionBatchNo { get; set; }
/// 物料编码(qms_qcpp_inspbill.FMATERIALCFG)
public string? MaterialCode { get; set; }
/// 物料名称(qms_qcpp_inspbill.wlmc)
public string? MaterialName { get; set; }
/// 规格型号(qms_qcpp_inspbill.ggxh)
public string? Spec { get; set; }
/// 检验人(qms_qcpp_inspbill.jyr)
public string? Inspector { get; set; }
/// 检验数量(qms_qcpp_inspbill.jysj)
public decimal? InspectQty { get; set; }
/// 来源单据编号(qms_qcpp_inspbill.lydjbh)
public string? SourceBillNo { get; set; }
/// 生产指令单(qms_qcpp_inspbill.sczld)
public string? ProductionOrderNo { get; set; }
/// 指令单数量(qms_qcpp_inspbill.sczldsl)
public decimal? OrderQty { get; set; }
/// SAP 工单号(WorkOrdMaster.WorkOrd,经 sczld=Batch,MIN 取确定值)
public string? SapWorkOrderNo { get; set; }
/// 判定(qms_qcpp_inspbill.pd,原样,字典未接)
public string? Judgment { get; set; }
/// 合格数量(qms_qcpp_inspbill.hgsl)
public decimal? QualifiedQty { get; set; }
/// 不合格数量(qms_qcpp_inspbill.bhgsl)
public decimal? UnqualifiedQty { get; set; }
}
// ══════════════════════════════════════════════════════════════════════════
// FQC 检验单只读详情:头(qms_qcpp_inspbill + SAP工单号)+ 品检项目明细(qms_qcpp_inspbillst,glid=id)
// 契约对齐 S6 IPQC:扁平头字段 + Lines[];id<=0/未命中 return null。样本 j1..j50 收敛为 Samples[](样品序号值)。
// ══════════════════════════════════════════════════════════════════════════
/// FQC 检验单详情(只读):扁平头 + 明细行。
public class FqcInspBillDetailDto
{
// —— 基本信息 ——
/// 主键(qms_qcpp_inspbill.id)
public long Id { get; set; }
/// 单据编号 FBILLNO
public string? BillNo { get; set; }
/// 检验时间 FINSPEENDDATE
public DateTime? InspectTime { get; set; }
/// 来源单据编号 lydjbh
public string? SourceBillNo { get; set; }
/// 检验人 jyr
public string? Inspector { get; set; }
/// 判定 pd(原样,字典未接)
public string? Judgment { get; set; }
// —— 成品信息 ——
/// 物料编码 FMATERIALCFG
public string? MaterialCode { get; set; }
/// 物料名称 wlmc
public string? MaterialName { get; set; }
/// 规格型号 ggxh
public string? Spec { get; set; }
/// 生产批号 scph
public string? ProductionBatchNo { get; set; }
// —— 生产信息 ——
/// 生产指令单 sczld
public string? ProductionOrderNo { get; set; }
/// 指令单数量 sczldsl
public decimal? OrderQty { get; set; }
/// SAP 工单号 WorkOrdMaster.WorkOrd(sczld=Batch, MIN)
public string? SapWorkOrderNo { get; set; }
// —— 检验数量 ——
/// 检验数量 jysj
public decimal? InspectQty { get; set; }
/// 合格数量 hgsl
public decimal? QualifiedQty { get; set; }
/// 不合格数量 bhgsl
public decimal? UnqualifiedQty { get; set; }
// —— 检规信息 ——
/// 击发编号 jfbh
public string? FireNo { get; set; }
/// 检规编号 jgbh
public string? InspectSpecNo { get; set; }
/// 检规版本 jgbb
public string? InspectSpecVersion { get; set; }
/// 品检项目明细(qms_qcpp_inspbillst,按 xh,id 排序)
public List Lines { get; set; } = new();
}
/// FQC 品检项目明细行(只读,仅已确认列 + 样本数组;jlhb/jyyqsbj/vbl 语义未确认后置)。
public class FqcInspBillDetailLineDto
{
/// 明细主键(qms_qcpp_inspbillst.id)
public long Id { get; set; }
/// 序号 xh
public int? SeqNo { get; set; }
/// 检验项目 jyxm
public string? InspectionItem { get; set; }
/// 接收标准 jsbz
public string? AcceptStandard { get; set; }
/// 技术要求 jsyq
public string? TechRequirement { get; set; }
/// 抽样方案 cyfa
public string? SamplingPlan { get; set; }
/// 样本量 ybl
public string? SampleQty { get; set; }
/// 上限 sx
public string? UpperLimit { get; set; }
/// 下限 xx
public string? LowerLimit { get; set; }
/// 规格标准 SizeSpecifications
public string? SizeSpecification { get; set; }
/// 判定 pd(原样)
public string? Judgment { get; set; }
/// 非数值型 OK NonNumericalTypeOK
public long? NonNumericOk { get; set; }
/// 非数值型 NG NonNumericalTypeNG
public long? NonNumericNg { get; set; }
/// 备注 bz
public string? Remark { get; set; }
/// 样品值(样品1..样品N,按序 j1..j50,末尾空值已裁剪;前端按非空动态展开)
public List Samples { get; set; } = new();
}
/// 明细查询行(内部):已确认列 + j1..j50 原始样本列,ToLine() 收敛为 Samples[]。禁止直接出前端。
public class FqcInspBillDetailLineRow
{
public long Id { get; set; }
public int? SeqNo { get; set; }
public string? InspectionItem { get; set; }
public string? AcceptStandard { get; set; }
public string? TechRequirement { get; set; }
public string? SamplingPlan { get; set; }
public string? SampleQty { get; set; }
public string? UpperLimit { get; set; }
public string? LowerLimit { get; set; }
public string? SizeSpecification { get; set; }
public string? Judgment { get; set; }
public long? NonNumericOk { get; set; }
public long? NonNumericNg { get; set; }
public string? Remark { get; set; }
public string? J1 { get; set; } public string? J2 { get; set; } public string? J3 { get; set; } public string? J4 { get; set; } public string? J5 { get; set; }
public string? J6 { get; set; } public string? J7 { get; set; } public string? J8 { get; set; } public string? J9 { get; set; } public string? J10 { get; set; }
public string? J11 { get; set; } public string? J12 { get; set; } public string? J13 { get; set; } public string? J14 { get; set; } public string? J15 { get; set; }
public string? J16 { get; set; } public string? J17 { get; set; } public string? J18 { get; set; } public string? J19 { get; set; } public string? J20 { get; set; }
public string? J21 { get; set; } public string? J22 { get; set; } public string? J23 { get; set; } public string? J24 { get; set; } public string? J25 { get; set; }
public string? J26 { get; set; } public string? J27 { get; set; } public string? J28 { get; set; } public string? J29 { get; set; } public string? J30 { get; set; }
public string? J31 { get; set; } public string? J32 { get; set; } public string? J33 { get; set; } public string? J34 { get; set; } public string? J35 { get; set; }
public string? J36 { get; set; } public string? J37 { get; set; } public string? J38 { get; set; } public string? J39 { get; set; } public string? J40 { get; set; }
public string? J41 { get; set; } public string? J42 { get; set; } public string? J43 { get; set; } public string? J44 { get; set; } public string? J45 { get; set; }
public string? J46 { get; set; } public string? J47 { get; set; } public string? J48 { get; set; } public string? J49 { get; set; } public string? J50 { get; set; }
/// 收敛为明细 DTO:j1..j50 → Samples[](裁剪末尾空值,保留样品序号位置)。
public FqcInspBillDetailLineDto ToLine()
{
var raw = new[]
{
J1, J2, J3, J4, J5, J6, J7, J8, J9, J10, J11, J12, J13, J14, J15, J16, J17, J18, J19, J20,
J21, J22, J23, J24, J25, J26, J27, J28, J29, J30, J31, J32, J33, J34, J35, J36, J37, J38, J39, J40,
J41, J42, J43, J44, J45, J46, J47, J48, J49, J50,
};
var last = -1;
for (var i = 0; i < raw.Length; i++)
if (!string.IsNullOrWhiteSpace(raw[i])) last = i;
var samples = last < 0 ? new List() : raw.Take(last + 1).ToList();
return new FqcInspBillDetailLineDto
{
Id = Id, SeqNo = SeqNo, InspectionItem = InspectionItem, AcceptStandard = AcceptStandard,
TechRequirement = TechRequirement, SamplingPlan = SamplingPlan, SampleQty = SampleQty,
UpperLimit = UpperLimit, LowerLimit = LowerLimit, SizeSpecification = SizeSpecification,
Judgment = Judgment, NonNumericOk = NonNumericOk, NonNumericNg = NonNumericNg, Remark = Remark,
Samples = samples,
};
}
}