V6Component.cs 1.3 KB

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