LogikalGlass.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. using InABox.Integration.Logikal;
  2. using System.Collections.Generic;
  3. namespace PRSDesktop.Integrations.Logikal
  4. {
  5. public class LogikalGlass : LogikalBOMItem, ILogikalGlass
  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 = $@"select
  24. g.[Name] as [{nameof(Code)}],
  25. g.[Description] as [{nameof(Description)}],
  26. g.[width_output] as [{nameof(Height)}],
  27. g.[height_output] as [{nameof(Width)}],
  28. g.[Configuration] as [{nameof(Treatment)}],
  29. '' as [{nameof(Location)}],
  30. 'Glass' as [{nameof(Group)}],
  31. coalesce(s.[CustomerNo],s.[ActiveTitle]) as [{nameof(Supplier)}],
  32. g.[Amount] as [{nameof(Quantity)}],
  33. g.[Price] as [{nameof(Cost)}]
  34. from
  35. glass g
  36. join
  37. insertions i on g.[insertionid] = i.[insertionid]
  38. join
  39. elevations e on i.[elevationid] = e.[elevationid]
  40. left outer join
  41. suppliers s on g.[LK_SupplierID] = s.[SupplierID]";
  42. /*
  43. select
  44. g.[Name] as [{nameof(Code)}],
  45. g.[Description] as [{nameof(Description)}],
  46. g.[width_output] as [{nameof(Height)}],
  47. g.[height_output] as [{nameof(Width)}],
  48. g.[Configuration] as [{nameof(Treatment)}],
  49. '' as [{nameof(Location)}],
  50. d.[DiscountGroup] as [{nameof(Group)}],
  51. coalesce(s.[CustomerNo],s.[ActiveTitle]) as [{nameof(Supplier)}],
  52. g.[Amount] as [{nameof(Quantity)}],
  53. g.[Price] as [{nameof(Cost)}]
  54. from
  55. glass g
  56. join
  57. insertions i on g.[insertionid] = i.[insertionid]
  58. join
  59. elevations e on i.[elevationid] = e.[elevationid]
  60. join
  61. estimationdiscounts d on g.[LK_DiscountID] = d.[EstimationDiscountID]
  62. left outer join
  63. suppliers s on g.[LK_SupplierID] = s.[SupplierID]
  64. */
  65. }
  66. }