DP CLASS
/// <summary>
/// RDP class for SCRF Export report
/// </summary>
[
SRSReportQueryAttribute(queryStr(LSSCRFExportQuery))
]
public final class LSSCRFExportDP extends SRSReportDataProviderPreProcessTempDB
{
LSSCRFExportReportTmp scrfExportReportTmp;
NoYes scrfEnhancementFeature;
/// <summary>
/// Method to get report data for LSSCRFExportReportTmp table
/// </summary>
/// <returns>LSSCRFExportReportTmp</returns>
[SRSReportDataSetAttribute(tableStr(LSSCRFExportReportTmp))]
public LSSCRFExportReportTmp getLSSCRFExportReportTmp()
{
select scrfExportReportTmp;
return scrfExportReportTmp;
}
/// <summary>
/// Method to process report data
/// </summary>
public void processReport()
{
Query query = this.parmQuery();
QueryRun queryRun = new QueryRun(query);
LSSCRFMainTable scrfMainTable;
LSSCRFLine scrfLine;
LSSCRFFeatureLine featureLine;
scrfEnhancementFeature = LSEnableDisableFeaturesSetup::find(LSFeaturesList::SCRFEnhancement).Enabled;
scrfExportReportTmp.setConnection(this.parmUserConnection());
while (queryRun.next())
{
scrfMainTable = queryRun.get(tableNum(LSSCRFMainTable));
scrfLine = queryRun.get(tableNum(LSSCRFLine));
featureLine = queryRun.get(tableNum(LSSCRFFeatureLine));
this.insertData(scrfMainTable, scrfLine, featureLine);
}
}
/// <summary>
/// Method to insert report data into temp table
/// </summary>
/// <param name = "_scrfMainTable">_scrfMainTable</param>
/// <param name = "_scrfLine">_scrfLine</param>
/// <param name = "_featureLine">_featureLine</param>
public void insertData(LSSCRFMainTable _scrfMainTable, LSSCRFLine _scrfLine, LSSCRFFeatureLine _featureLine)
{
LSSCRFPackagingLine primaryPackagingLine, secondaryPackagingLine, tertiaryPackagingLine, quarternaryPackagingLine;
select firstonly primaryPackagingLine
where primaryPackagingLine.LinePackagingType == LSLinePackagingType::Primary
&& primaryPackagingLine.FeatureLineRecId == _featureLine.RecId;
select firstonly secondaryPackagingLine
where secondaryPackagingLine.LinePackagingType == LSLinePackagingType::Secondary
&& secondaryPackagingLine.FeatureLineRecId == _featureLine.RecId;
select firstonly tertiaryPackagingLine
where tertiaryPackagingLine.LinePackagingType == LSLinePackagingType::Tertiary
&& tertiaryPackagingLine.FeatureLineRecId == _featureLine.RecId;
select firstonly quarternaryPackagingLine
where quarternaryPackagingLine.LinePackagingType == LSLinePackagingType::Quartenary
&& quarternaryPackagingLine.FeatureLineRecId == _featureLine.RecId;
scrfExportReportTmp.clear();
scrfExportReportTmp.SCRFId = _scrfMainTable.SCRFId;
scrfExportReportTmp.Description = _scrfMainTable.Description;
scrfExportReportTmp.SCRFStatus = _scrfMainTable.SCRFStatus;
scrfExportReportTmp.SCRFWorkflowStatus = _scrfMainTable.SCRFWorkflowStatus;
scrfExportReportTmp.SubmittedBy = _scrfMainTable.SubmittedBy;
scrfExportReportTmp.SubmittedDate = _scrfMainTable.SubmittedDate;
scrfExportReportTmp.EffectiveDate = _scrfMainTable.EffectiveDate;
scrfExportReportTmp.CreatedFor = _scrfMainTable.CreatedFor;
scrfExportReportTmp.ReleaseNo = _scrfMainTable.ReleaseNo;
// strmin() - Former type
scrfExportReportTmp.ProductSubGroup = _scrfMainTable.ProductSubGroup;
scrfExportReportTmp.ReasonForChange = _scrfMainTable.ReasonForChange;
scrfExportReportTmp.HoldReason = _scrfMainTable.HoldReason;
scrfExportReportTmp.Provisional = _scrfMainTable.Provisional;
scrfExportReportTmp.CustAccount = _scrfMainTable.CustAccount;
scrfExportReportTmp.CountryOfSaleMulti = _scrfMainTable.CountryOfSaleMulti;
// strmin() - Machine
scrfExportReportTmp.RegionCode = _scrfMainTable.RegionCode;
scrfExportReportTmp.Standard = _scrfMainTable.Standard;
scrfExportReportTmp.Standard2 = _scrfMainTable.Standard2;
scrfExportReportTmp.Standard3 = _scrfMainTable.Standard3;
scrfExportReportTmp.BatchSizeId = _scrfMainTable.BatchSizeId;
[
scrfExportReportTmp.PreprintCode,
scrfExportReportTmp.BodySamplingCode,
scrfExportReportTmp.ExtBodyLabName
] = this.getBodySampling(_scrfMainTable.SCRFId);
scrfExportReportTmp.Thai501K = _scrfMainTable.Thai501K;
scrfExportReportTmp.AdditionalTestReq = strRem('\'' + _scrfMainTable.AdditionalTestReq, '\'-');
scrfExportReportTmp.ProductSelection = _scrfLine.ProductSelection;
scrfExportReportTmp.FactoryProductCode = _featureLine.FactoryProductCode;
scrfExportReportTmp.LatexType = _featureLine.LatexType;
scrfExportReportTmp.Shape = _featureLine.Shape;
scrfExportReportTmp.Texture = _featureLine.Texture;
scrfExportReportTmp.ThicknessFeature = _featureLine.ThicknessFeature;
scrfExportReportTmp.DimesionSpecification = _featureLine.DimesionSpecification;
scrfExportReportTmp.Size = _featureLine.Size;
scrfExportReportTmp.Length = _featureLine.Length;
scrfExportReportTmp.Thickness = _featureLine.Thickness;
scrfExportReportTmp.Width = _featureLine.Width;
scrfExportReportTmp.LubricantType = _featureLine.LubricantType;
scrfExportReportTmp.LubricantQty = _featureLine.LubricantQty;
scrfExportReportTmp.Color = _featureLine.Color;
scrfExportReportTmp.Flavour = _featureLine.Flavour;
scrfExportReportTmp.Masking = _featureLine.Masking;
scrfExportReportTmp.ExpiryDate = _featureLine.ExpiryDate;
scrfExportReportTmp.FoilType = _featureLine.FoilType;
scrfExportReportTmp.FilmType_Primary = primaryPackagingLine.FilmType;
scrfExportReportTmp.PrintingOn_Primary = primaryPackagingLine.RecId ? enum2Str(primaryPackagingLine.PrintingOn) : '';
scrfExportReportTmp.LotType_Primary = primaryPackagingLine.RecId ? enum2Str(primaryPackagingLine.LotType) : '';
scrfExportReportTmp.ExpDateFormat_Primary = primaryPackagingLine.ExpDateFormat;
scrfExportReportTmp.AdditionalPrinting_Primary = primaryPackagingLine.AdditionalPrinting;
scrfExportReportTmp.AdditionalPrintText_Primary = primaryPackagingLine.AdditionalPrintText;
scrfExportReportTmp.TopPk_Primary = primaryPackagingLine.TopPk;
scrfExportReportTmp.BottomPk_Primary = primaryPackagingLine.BottomPk;
scrfExportReportTmp.TopPk1_Primary = primaryPackagingLine.TopPk1;
scrfExportReportTmp.BottomPk1_Primary = primaryPackagingLine.BottomPk1;
scrfExportReportTmp.StripLength_Primary = primaryPackagingLine.StripLength;
scrfExportReportTmp.PartialStripAllowed_Primary = primaryPackagingLine.RecId ? enum2Str(primaryPackagingLine.PartialStripAllowed) : '';
scrfExportReportTmp.AllowableStrips_Primary = strLRTrim(strReplace(primaryPackagingLine.AllowableStrips, 'Max. partial strip allowed', strMin()));
scrfExportReportTmp.PartialStrips_Primary = primaryPackagingLine.RecId ? enum2Str(primaryPackagingLine.PartialStripsPacking) : '';
scrfExportReportTmp.BulkStripsOrFullyPacked_Primary = primaryPackagingLine.RecId ? enum2Str(primaryPackagingLine.BulkStripsOrFullyPacked) : '';
scrfExportReportTmp.PackingInfo_Primary = primaryPackagingLine.PackingInfo;
scrfExportReportTmp.AddPKNum_Primary = this.getAdditionalPkNum(primaryPackagingLine.RecId);
scrfExportReportTmp.Type_Secondary = secondaryPackagingLine.Type;
scrfExportReportTmp.PKNumber_Secondary = secondaryPackagingLine.PKNumber;
scrfExportReportTmp.AddPkNum_Secondary = this.getAdditionalPkNum(secondaryPackagingLine.RecId);
scrfExportReportTmp.CondomQtyIn2ndPack_Secondary = secondaryPackagingLine.CondomQtyIn2ndPack;
scrfExportReportTmp.PackingInfo_Secondary = secondaryPackagingLine.PackingInfo;
scrfExportReportTmp.AdditionalPrintText_Secondary = secondaryPackagingLine.AdditionalPrintText;
scrfExportReportTmp.Type_Tertiary = tertiaryPackagingLine.Type;
scrfExportReportTmp.PKNumber_Tertiary = tertiaryPackagingLine.PKNumber;
scrfExportReportTmp.AddPkNum_Tertiary = this.getAdditionalPkNum(tertiaryPackagingLine.RecId);
scrfExportReportTmp.CondomQtyIn3rdPack_Tertiary = tertiaryPackagingLine.CondomQtyIn3rdPack;
scrfExportReportTmp.PackingInfo_Tertiary = tertiaryPackagingLine.PackingInfo;
scrfExportReportTmp.AdditionalPrintText_Tertiary = tertiaryPackagingLine.AdditionalPrintText;
scrfExportReportTmp.Type_Quarternary = quarternaryPackagingLine.Type;
scrfExportReportTmp.PKNumber_Quarternary = quarternaryPackagingLine.PKNumber;
scrfExportReportTmp.AddPkNum_Quarternary = this.getAdditionalPkNum(quarternaryPackagingLine.RecId);
scrfExportReportTmp.CondomQtyInMasterCarton_Quarternary = quarternaryPackagingLine.CondomQtyInMasterCarton;
scrfExportReportTmp.PartialCartonAllowed_Quarternary = quarternaryPackagingLine.RecId ? enum2Str(quarternaryPackagingLine.PartialCartonAllowed) : '';
scrfExportReportTmp.PackingInfo_Quarternary = quarternaryPackagingLine.PackingInfo;
scrfExportReportTmp.SCRFEnhancementFeature = scrfEnhancementFeature;
scrfExportReportTmp.insert();
}
/// <summary>
/// Method to get additional PK numbers
/// </summary>
/// <param name = "_recId">_recId</param>
/// <returns>Additional PK numbers</returns>
public str getAdditionalPkNum(RecId _recId)
{
LSSCRFPackAdditionalReq primaryAddReq;
str addPKNum;
while select PKNumber from primaryAddReq
where primaryAddReq.LSSCRFPackagingLine == _recId && primaryAddReq.PKNumber
{
addPKNum += primaryAddReq.PKNumber + ',';
}
return addPKNum;
}
/// <summary>
/// Method to get the body sampling data
/// </summary>
/// <param name = "_scrfId">_scrfId</param>
/// <returns>Body sampling data</returns>
public container getBodySampling(LSSCRFId _scrfId)
{
LSSCRFApprovalPreprintBodySampling bodySampling;
LSPreprintCode prePrintCode;
LSBodySamplingCode bodySamplingCode;
LSExtBodyLabName extBodyLabName;
while select PreprintCode, BodySamplingCode, ExtBodyLabName from bodySampling
where bodySampling.SCRFId == _scrfId
{
if(bodySampling.PreprintCode != strMin())
{
prePrintCode += bodySampling.PreprintCode + ',';
}
if(bodySampling.BodySamplingCode != strMin())
{
bodySamplingCode += bodySampling.BodySamplingCode + ',';
}
if(bodySampling.ExtBodyLabName != strMin())
{
extBodyLabName += bodySampling.ExtBodyLabName + ',';
}
}
return [prePrintCode, bodySamplingCode, extBodyLabName];
}
}
Controller
/// <summary>
/// Controller class for Export SCRF report
/// </summary>
public class LSSCRFExportReportController extends SrsReportRunController implements BatchRetryable
{
/// <summary>
/// Main method
/// </summary>
/// <param name = "_args">_args</param>
public static void main(Args _args)
{
LSSCRFExportReportController controller = new LSSCRFExportReportController();
controller.parmReportName(ssrsReportStr(LSSCRFExportReport, DesginV1));
controller.parmArgs(_args);
controller.startOperation();
}
public ClassDescription caption()
{
return "@LS_HISOL:ExportSCRFReport";
}
/// <summary>
/// Specifies if the batch task is retryable for transient exceptions or not.
/// </summary>
/// <returns>
/// If true is returned, the batch task is retryable, otherwise it is not.
/// </returns>
[Hookable(false)]
final boolean isRetryable()
{
return true;
}
}