LogikalComponent.cs 967 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. using InABox.Integration.Logikal;
  2. using System;
  3. using System.Collections.Generic;
  4. namespace PRSDesktop.Integrations.Logikal
  5. {
  6. public class LogikalComponent : LogikalBOMItem, ILogikalComponent
  7. {
  8. public double PackSize { get; set; }
  9. public override void ValidateQuery(string sql, List<string> errors)
  10. {
  11. base.ValidateQuery(sql, errors);
  12. ValidateField(sql, nameof(PackSize), errors);
  13. }
  14. public static String SQL = $@"
  15. select
  16. a.[ArticleCode_BaseNumber] as {nameof(Code)},
  17. a.[description] as {nameof(Description)},
  18. 1.0 as {nameof(PackSize)},
  19. sum(a.[units]) as {nameof(Quantity)},
  20. a.[Price] as {nameof(Cost)}
  21. from
  22. articles a
  23. join
  24. insertions i on a.[insertionid] = i.[insertionid]
  25. join
  26. elevations e on i.[elevationid] = e.[elevationid]
  27. where
  28. a.[ArticleType] not in (5,7)
  29. group by
  30. a.[ArticleCode_BaseNumber],
  31. a.[description],
  32. a.[Price]";
  33. }
  34. }