/// <summary> /// 获取数据 /// </summary> /// <param name="bomItem"></param> /// <returns></returns> private DataTable GetComponentOptDt(DEBusinessItem bomItem, DERelation2 relation, int seq) { if (bomItem == null) { return(null); } var dt = BuildComponentOptDt(); var row = dt.NewRow(); foreach (DataColumn col in dt.Columns) { var val = bomItem.GetAttrValue(bomItem.ClassName, col.ColumnName.ToUpper()); var rltVal = relation.GetAttrValue(col.ColumnName.ToUpper()); switch (col.ColumnName) { default: row[col] = rltVal == null ? DBNull.Value : rltVal; break; case "OptionsId": row[col] = seq * 10; break; case "Offset": row[col] = rltVal == null ? 0 : rltVal; break; case "WIPType": row[col] = rltVal == null ? 4 : rltVal; break; case "AccuCostFlag": row[col] = rltVal == null ? true : rltVal; break; case "OptionalFlag": row[col] = rltVal == null ? false : rltVal; break; case "MutexRule": row[col] = rltVal == null ? 2 : rltVal; break; case "PlanFactor": row[col] = rltVal == null ? 100.00m : rltVal; break; } } dt.Rows.Add(row); return(dt); }
/// <summary> /// 获取数据 /// </summary> /// <param name="item"></param> /// <returns></returns> private DataTable GetBodyDt(DEBusinessItem baseItem, DEBusinessItem item, DERelation2 relation) { if (item == null) { return(null); } var dt = BuildBodyDt(); var row = dt.NewRow(); foreach (DataColumn col in dt.Columns) { var val = baseItem.GetAttrValue(baseItem.ClassName, col.ColumnName.ToUpper()); var rltVal = relation.GetAttrValue(col.ColumnName.ToUpper()); switch (col.ColumnName) { default: row[col] = rltVal == null ? DBNull.Value : rltVal; break; case "ResId": row[col] = val == null ? DBNull.Value : val; break; case "Qty": row[col] = rltVal == null ? 1.00m : rltVal; break; case "KeyFlag": case "FiniteScheduleRel": row[col] = rltVal == null ? 0 : rltVal; break; case "CrpFlag": row[col] = rltVal == null ? 1 : rltVal; break; case "UseRate": case "EfficiencyRate": case "OverRate": row[col] = rltVal == null ? 100.00m : rltVal; break; } } dt.Rows.Add(row); return(dt); }
/// <summary> /// 获取数据 /// </summary> /// <param name="dEBusinessItem"></param> /// <returns></returns> private DataTable GetRoutingInspDt(DEBusinessItem baseItem, DEBusinessItem item, DERelation2 relation) { if (item == null) { return(null); } var dt = BuildRoutingInspDt(); var row = dt.NewRow(); foreach (DataColumn col in dt.Columns) { var val = item.GetAttrValue(item.ClassName, col.ColumnName.ToUpper()); var rltVal = relation.GetAttrValue(col.ColumnName); switch (col.ColumnName) { default: row[col] = val == null ? DBNull.Value : val; break; case "PRoutinginspId": val = item.GetAttrValue(item.ClassName, "OPERATIONINSPID"); if (val == null) { return(null); } row[col] = val; break; case "OpTransType": //工序转移默认“手动” case "QtMethod": case "ItestRule": row[col] = val == null ? 1 : val; break; } } dt.Rows.Add(row); return(dt); }
/// <summary> /// 获取OperationRes数据 /// </summary> /// <param name="item"></param> /// <returns></returns> private DataTable GetOperationResDt(DEBusinessItem baseItem, DEBusinessItem item, DERelation2 relation) { if (item == null) { return(null); } var dt = BuildOperationResDt(); var row = dt.NewRow(); foreach (DataColumn col in dt.Columns) { var val = item.GetAttrValue(item.ClassName, col.ColumnName.ToUpper()); var rltVal = relation.GetAttrValue(col.ColumnName.ToUpper()); switch (col.ColumnName) { default: row[col] = rltVal == null ? DBNull.Value : rltVal; break; case "OperationId": val = baseItem.GetAttrValue(baseItem.ClassName, col.ColumnName.ToUpper()); row[col] = val == null ? DBNull.Value : val; break; case "BaseType": row[col] = val == null ? 1 : val; break; case "EfficientRate": row[col] = val == null ? 100 : val; break; } } dt.Rows.Add(row); return(dt); }
/// <summary> /// 获取数据 /// </summary> /// <param name="bomItem"></param> /// <returns></returns> private DataTable GetComponentDt(DEBusinessItem baseItem, DERelation2 relation, DEBusinessItem bomItem, ref int seqNo) { if (bomItem == null) { return(null); } var dt = BuildComponentDt(); var row = dt.NewRow(); seqNo++; foreach (DataColumn col in dt.Columns) { var val = bomItem.GetAttrValue(bomItem.ClassName, col.ColumnName.ToUpper()); var rltVal = relation.GetAttrValue(col.ColumnName.ToUpper()); switch (col.ColumnName) { default: row[col] = val == null ? DBNull.Value : val; break; case "BomId": val = baseItem.GetAttrValue(baseItem.ClassName, "BOMID"); row[col] = val == null ? DBNull.Value : val; break; case "InvCode": val = bomItem.GetAttrValue(bomItem.ClassName, "CODE"); row[col] = val == null ? DBNull.Value : val; break; case "SortSeq": case "OptionsId": case "OpComponentId": row[col] = (seqNo * 10); break; case "OpSeq": row[col] = 0000; //工序不启用,默认为0000 break; case "EffBegDate": row[col] = rltVal == null?DateTime.Parse("2000-01-01") : rltVal; break; case "EffEndDate": row[col] = rltVal == null?DateTime.Parse("2099-12-31") : rltVal; break; case "FVFlag": case "ProductType": row[col] = rltVal == null ? 1 : rltVal; break; case "BaseQtyN": val = relation.GetAttrValue("NUMBER"); row[col] = val == null ? 1m : val; break; case "BaseQtyD": row[col] = rltVal == null ? 1m : rltVal; break; case "CompScrap": row[col] = rltVal == null ? 0.000m : rltVal; break; case "ByproductFlag": row[col] = val == null ? false : val; break; } } dt.Rows.Add(row); return(dt); }
/// <summary> /// 获取数据 /// </summary> /// <param name="item"></param> /// <returns></returns> private DataTable GetRoutingDetailDt(DEBusinessItem baseItem, DEBusinessItem item, DERelation2 relation) { if (item == null) { return(null); } var dt = BuildRoutingDetailDt(); var row = dt.NewRow(); foreach (DataColumn col in dt.Columns) { var val = item.GetAttrValue(item.ClassName, col.ColumnName.ToUpper()); var rltVal = relation.GetAttrValue(col.ColumnName.ToUpper()); switch (col.ColumnName) { default: row[col] = val == null ? DBNull.Value : val; break; case "PRoutingId": val = baseItem.GetAttrValue(baseItem.ClassName, col.ColumnName.ToUpper()); row[col] = val == null ? DBNull.Value : val; break; case "PRoutingDId": val = item.GetAttrValue(item.ClassName, "OPERATIONID"); row[col] = val == null ? DBNull.Value : val; break; case "OperationCode": val = item.GetAttrValue(item.ClassName, "OPCODE"); row[col] = val == null ? DBNull.Value : val; break; case "PRoutinginspId": val = item.GetAttrValue(item.ClassName, "OPERATIONINSPID"); row[col] = val == null ? DBNull.Value : val; break; case "Description": row[col] = item.Name; break; case "WcCode": case "EffBegDate": case "EffEndDate": case "OpSeq": row[col] = rltVal == null ? DBNull.Value : rltVal; break; case "SubFlag": case "RltOptionFlag": case "BFFlag": case "FeeFlag": case "PlanSubFlag": row[col] = rltVal == null ? false : val; break; case "DeliveryDays": case "LtPercent": row[col] = rltVal == null ? 0 : val; break; case "ReportFlag": row[col] = rltVal == null ? true : val; break; } } dt.Rows.Add(row); return(dt); }