V6Glass.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using System.Collections.Generic;
  2. using InABox.Integration.V6;
  3. namespace PRSDesktop.Integrations.V6
  4. {
  5. public class V6Glass : V6BOMItem, IV6Glass
  6. {
  7. public string Group { get; set; }
  8. public string Supplier { get; set; }
  9. public string Treatment { get; set; }
  10. public double Height { get; set; }
  11. public double Width { get; set; }
  12. public string Location { get; set; }
  13. public override void ValidateQuery(string sql, List<string> errors)
  14. {
  15. base.ValidateQuery(sql, errors);
  16. ValidateField(sql, nameof(Treatment), errors);
  17. ValidateField(sql, nameof(Height), errors);
  18. ValidateField(sql, nameof(Width), errors);
  19. ValidateField(sql, nameof(Location), errors);
  20. ValidateField(sql, nameof(Group), errors);
  21. ValidateField(sql, nameof(Supplier), errors);
  22. }
  23. public static string SQL = $@"
  24. select
  25. bf.location as {nameof(Location)},
  26. f.fill_code as {nameof(Code)},
  27. f.descr as {nameof(Description)},
  28. bf.fill_height as {nameof(Height)},
  29. bf.fill_width as {nameof(Width)},
  30. bf.treatment as {nameof(Treatment)},
  31. '' as {nameof(Group)},
  32. '' as {nameof(Supplier)},
  33. bf.cost as {nameof(Cost)},
  34. sum(bf.fill_count) as {nameof(Quantity)}
  35. from
  36. bom_fill bf
  37. left outer join
  38. fill f on bf.fill_lib_id = f.fill_lib_id and bf.fill_id = f.fill_id
  39. left outer join
  40. quote_item qi on qi.quote_item_id = bf.quote_item_id
  41. left outer join
  42. quote q on q.quote_id = qi.quote_id
  43. where
  44. 1=1
  45. and
  46. bf.COST_BY_BOM='T'
  47. and
  48. qi.quote_vers_start <= q.quote_vers and qi.quote_vers_stop >= q.quote_vers
  49. group by
  50. bf.location, f.fill_code, f.descr, bf.fill_height, bf.fill_width, bf.treatment, bf.cost";
  51. }
  52. }