select a.ParameterCode as ParameterCode,b.FatherParameterCode as FatherParameterCode, b.EngDesc as EngDesc, b.IsMidLevel as IsMidLevel,
a.CtrlValue0 as CtrlValue0, case b.InputType when 1 then a.EngDesc0 when 2 then '' else a.ManualValue0 end as case1,
a.CtrlValue1 as CtrlValue1, case b.InputType when 1 then a.EngDesc1 when 2 then '' else a.ManualValue1 end as case2
from ( select a0.ParameterCode as ParameterCode , a0.CtrlValue as CtrlValue0, a0.ManualValue as ManualValue0 , a0.EngDesc as EngDesc0 , a1.CtrlValue as CtrlValue1,
a1.ManualValue as ManualValue1 , a1.EngDesc as EngDesc1 from ( select c.ParameterCode as ParameterCode,c.CtrlValue as CtrlValue, c.ManualValue as ManualValue,d.EngDesc as EngDesc
from Q_ParameterConfig c left join D_ParameterEnum d on c.ParameterCode = d.ParameterCode and c.ManualValue = d.OptValue and c.FDNID ='v14c$c3e$$' and d.Productid ='208009' ) a0
left join ( select c.ParameterCode as ParameterCode,c.CtrlValue as CtrlValue, c.ManualValue as ManualValue,d.EngDesc as EngDesc from Q_ParameterConfig c
left join D_ParameterEnum d on c.ParameterCode = d.ParameterCode and c.ManualValue = d.OptValue and c.FDNID ='v14c$c3i$$' and d.Productid ='208009' ) a1
on a0.ParameterCode = a1.ParameterCode ) a left join (select ParameterCode,FatherParameterCode, EngDesc, InputType, SortNo,IsMidLevel from D_Parameter
where Productid = '208009') b on a.ParameterCode = b.ParameterCode order by b.SortNo
select TLNo, DisplayLevel,c.SBOMID as SBOMID,c.FatherSBOMID as FatherSBOMID, b.PartNumber as PartNumber, a.VarName as VarName,c.SBOMType as SBOMType ,
case c.SBOMType when 1 then b.Model when 5 then b.Model when 6 then b.Model else b.EngOuterDesc end as Model,
case c.SBOMType when 1 then b.EngOuterDesc when 5 then b.EngOuterDesc when 6 then b.EngOuterDesc else '' end as EngOuterDesc,
a.CtrlValue0 as CtrlValue0, case c.SBOMType when 1 then a.ManualValue0 when 5 then a.ManualValue0 when 6 then a.ManualValue0 when 3 then a.ManualValue0 else '' end as case1 ,
a.CtrlValue1 as CtrlValue1, case c.SBOMType when 1 then a.ManualValue1 when 5 then a.ManualValue1 when 6 then a.ManualValue1 when 3 then a.ManualValue1 else '' end as case2
from ( select a0.ERPID as ERPID,a0.VarName as VarName, a0.CtrlValue as CtrlValue0, a0.ManualValue as ManualValue0 , a1.CtrlValue as CtrlValue1, a1.ManualValue as ManualValue1
from ( select ErpID, VarName,CtrlValue, ManualValue from Q_SpartConfig where FDNID = 'v14c$c3e$$' ) a0 left join
( select ErpID, VarName,CtrlValue, ManualValue from Q_SpartConfig where FDNID = 'v14c$c3i$$' ) a1 on a0.VarName =a1.VarName ) a left join D_Spart b on a.ERPID = b.ERPID
left join (select VarName,ERPID, SBOMType, TLNo, DisplayLevel,SBOMID,FatherSBOMID from D_Sbom where Productid = '208009') c on a.VarName = c.VarName order by TLNo
select a.VarName as VarName,b.PartNumber as PartNumber,c.SBOMID AS SBOMID, b.EngInnerDesc as EngInnerDesc, c.SBOMType AS SBOMType,
case c.SBOMType when 1 then a.AddValue0 when 5 then a.AddValue0 when 6 then a.AddValue0 else '' end as case1 ,
case c.SBOMType when 1 then a.AddValue1 when 5 then a.AddValue1 when 6 then a.AddValue1 else '' end as case2
from (select a0.ErpID as ErpID ,a0.VarName as VarName, a0.AddValue as AddValue0 , a1.AddValue as AddValue1
from ( select ErpID,VarName,AddValue from Q_StatisticsSPartConfig where FDNID='v14c$c3e$$' ) a0 left join
( select ErpID,VarName,AddValue from Q_StatisticsSPartConfig where FDNID='v14c$c3i$$' ) a1 on a0.VarName = a1.VarName ) a left join
(select ErpID,PartNumber ,EngInnerDesc from D_Spart) b on a.ErpID=b.ErpID left join (select VarName, SBOMType, SortNo ,SBOMID
from D_StatisticsBOM where Productid = '208009') c on a.VarName = c.VarName order by SortNo
staConditionStr+=" case c.SBOMType when 1 then a.AddValue"+j+" when 5 then a.AddValue"+j
+ " when 6 then a.AddValue"+j+" else ''"+" end as case"+(j+1)+" , ";
// + " a.AddValue"+j+" as case"+(j+1)+" ,";
staStr+=" a"+j+"."+"AddValue as AddValue"+j+" ,";
staheadStr=" (select a0.ErpID as ErpID ,a0.VarName as VarName,";