ffb50deb06af94168795f8e170bde9f593c835fb.svn-base 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. $(function() {
  2. "use strict";
  3. if (_.isUndefined(BWA.Chart) || _.isUndefined(BWA.Chart.PointHistoryServiceTypeGet)) {
  4. throw new Error('need chart.get.helper.js');
  5. return;
  6. }
  7. var PointHistoryServiceTypeGet = BWA.Chart.PointHistoryServiceTypeGet;
  8. function EnergyServiceGet(siteId) {
  9. this.base = PointHistoryServiceTypeGet;
  10. this.base(siteId);
  11. }
  12. EnergyServiceGet.prototype = PointHistoryServiceTypeGet.prototype;
  13. EnergyServiceGet.prototype.constructor = EnergyServiceGet;
  14. var searchConditions = EnergyServiceGet.SearchConditions = {};
  15. var CODE = $Code,
  16. FuelType = CODE.FuelType,
  17. FT = CODE.FacilityType,
  18. FC = CODE.FacilityCode,
  19. F = CODE.Formula;
  20. searchConditions[FuelType.ELECTRICITY] = {
  21. FacilityTypeId: FT.ELECTRICITY,
  22. FacilityCode: FC.ELECTRICITY,
  23. FormulaId: F[FT.ELECTRICITY].TOTAL_ELECTRICITY_AMOUNT,
  24. };
  25. searchConditions[FuelType.GAS] = {
  26. FacilityTypeId: FT.GAS,
  27. FacilityCode: FC.GAS,
  28. FormulaId: F[FT.GAS].TOTAL_GAS_AMOUNT,
  29. };
  30. searchConditions[FuelType.WATER] = {
  31. FacilityTypeId: FT.WATER,
  32. FacilityCode: FC.WATER,
  33. FormulaId: F[FT.WATER].TOTAL_WATER_AMOUNT,
  34. };
  35. //EnergyServiceGet.prototype.requestGetForUsgaeStatus = function (fuelTypeId, timeIntervalType) {
  36. EnergyServiceGet.prototype.requestGetForEnergyService = function (fuelTypeId, timeIntervalType, serviceTypeId) {
  37. var self = this;
  38. return function(startDate, endDate) {
  39. var parameters = _.extend(searchConditions[fuelTypeId], {
  40. TimeIntervalType: timeIntervalType,
  41. StartDate: startDate,
  42. EndDate: endDate,
  43. ServiceTypeId: serviceTypeId
  44. });
  45. return self.apiGet(parameters);
  46. }
  47. };
  48. BWA.Chart.EnergyServiceGet = EnergyServiceGet;
  49. });