V6Component.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using System;
  2. using System.Collections.Generic;
  3. using InABox.Integration.V6;
  4. namespace PRSDesktop.Integrations.V6
  5. {
  6. public class V6Component : V6BOMItem, IV6Component
  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. bc.Part_Code as {nameof(Code)},
  17. c.descr as {nameof(Description)},
  18. 1.0 as {nameof(PackSize)},
  19. sum(bc.comp_qty) as {nameof(Quantity)},
  20. bc.cost as {nameof(Cost)}
  21. from
  22. bom_comp bc
  23. left outer join
  24. quote_item qi on qi.quote_item_id = bc.quote_item_id
  25. left outer join
  26. quote q on q.quote_id = qi.quote_id
  27. left outer join
  28. componentry c on c.comp_lib_id = bc.comp_lib_id and c.comp_id = bc.comp_id
  29. where
  30. 1=1
  31. and
  32. qi.quote_vers_start <= q.quote_vers and qi.quote_vers_stop >= q.quote_vers
  33. group by
  34. bc.Part_Code, c.descr, bc.cost
  35. ";
  36. }
  37. }