V6Component.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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 string Group { get; set; }
  9. public string Supplier { get; set; }
  10. public double PackSize { get; set; }
  11. public override void ValidateQuery(string sql, List<string> errors)
  12. {
  13. base.ValidateQuery(sql, errors);
  14. ValidateField(sql, nameof(PackSize), errors);
  15. ValidateField(sql, nameof(Group), errors);
  16. ValidateField(sql, nameof(Supplier), errors);
  17. }
  18. public static String SQL = $@"
  19. select
  20. bc.Part_Code as {nameof(Code)},
  21. c.descr as {nameof(Description)},
  22. 1.0 as {nameof(PackSize)},
  23. '' as {nameof(Group)},
  24. '' as {nameof(Supplier)},
  25. sum(bc.comp_qty) as {nameof(Quantity)},
  26. bc.cost as {nameof(Cost)}
  27. from
  28. bom_comp bc
  29. left outer join
  30. quote_item qi on qi.quote_item_id = bc.quote_item_id
  31. left outer join
  32. quote q on q.quote_id = qi.quote_id
  33. left outer join
  34. componentry c on c.comp_lib_id = bc.comp_lib_id and c.comp_id = bc.comp_id
  35. where
  36. 1=1
  37. and
  38. qi.quote_vers_start <= q.quote_vers and qi.quote_vers_stop >= q.quote_vers
  39. group by
  40. bc.Part_Code, c.descr, bc.cost
  41. ";
  42. }
  43. }