You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

217 lines
5.8KB

  1. class CropPlot {
  2. TbCropDTO tbCropDTO;
  3. List<Activities> activities;
  4. String sowingDate;
  5. int soakSeedsTime;
  6. int seedIncubationTime;
  7. int numberPlants;
  8. int numberCurrentPlants;
  9. String endOfFarmingDate;
  10. CropPlot(
  11. {this.tbCropDTO,
  12. this.activities,
  13. this.sowingDate,
  14. this.soakSeedsTime,
  15. this.seedIncubationTime,
  16. this.numberPlants,
  17. this.numberCurrentPlants,
  18. this.endOfFarmingDate});
  19. CropPlot.fromJson(Map<String, dynamic> json) {
  20. tbCropDTO = json['tbCropDTO'] != null
  21. ? new TbCropDTO.fromJson(json['tbCropDTO'])
  22. : null;
  23. if (json['activityTimeline'] != null) {
  24. activities = new List<Activities>();
  25. json['activityTimeline'].forEach((v) {
  26. activities.add(new Activities.fromJson(v));
  27. });
  28. }
  29. sowingDate = json['sowingDate'];
  30. soakSeedsTime = json['soakSeedsTime'];
  31. seedIncubationTime = json['seedIncubationTime'];
  32. numberPlants = json['numberPlants'];
  33. numberCurrentPlants = json['numberCurrentPlants'];
  34. endOfFarmingDate = json['endOfFarmingDate'];
  35. }
  36. Map<String, dynamic> toJson() {
  37. final Map<String, dynamic> data = new Map<String, dynamic>();
  38. if (this.tbCropDTO != null) {
  39. data['tbCropDTO'] = this.tbCropDTO.toJson();
  40. }
  41. if (this.activities != null) {
  42. data['activityTimeline'] =
  43. this.activities.map((v) => v.toJson()).toList();
  44. }
  45. data['sowingDate'] = this.sowingDate;
  46. data['soakSeedsTime'] = this.soakSeedsTime;
  47. data['seedIncubationTime'] = this.seedIncubationTime;
  48. data['numberPlants'] = this.numberPlants;
  49. data['numberCurrentPlants'] = this.numberCurrentPlants;
  50. data['endOfFarmingDate'] = this.endOfFarmingDate;
  51. return data;
  52. }
  53. }
  54. class TbCropDTO {
  55. int id;
  56. String qrCode;
  57. String code;
  58. num areaM2;
  59. int type;
  60. String startDate;
  61. String endDate;
  62. String status;
  63. String description;
  64. int ageDayStartAt;
  65. int tbSuppliesId;
  66. String suppliesName;
  67. int tbGuidelineId;
  68. int netHouseId;
  69. String netHouseName;
  70. int areaId;
  71. String area;
  72. List<TbDetailUsers> tbDetailUsers;
  73. TbCropDTO(
  74. {this.id,
  75. this.qrCode,
  76. this.code,
  77. this.areaM2,
  78. this.type,
  79. this.startDate,
  80. this.endDate,
  81. this.status,
  82. this.description,
  83. this.ageDayStartAt,
  84. this.tbSuppliesId,
  85. this.suppliesName,
  86. this.tbGuidelineId,
  87. this.netHouseId,
  88. this.netHouseName,
  89. this.areaId,
  90. this.area,
  91. this.tbDetailUsers});
  92. TbCropDTO.fromJson(Map<String, dynamic> json) {
  93. id = json['id'];
  94. qrCode = json['qrCode'];
  95. code = json['code'];
  96. areaM2 = json['areaM2'];
  97. type = json['type'];
  98. startDate = json['startDate'];
  99. endDate = json['endDate'];
  100. status = json['status'];
  101. description = json['description'];
  102. ageDayStartAt = json['ageDayStartAt'];
  103. tbSuppliesId = json['tbSuppliesId'];
  104. suppliesName = json['suppliesName'];
  105. tbGuidelineId = json['tbGuidelineId'];
  106. netHouseId = json['netHouseId'];
  107. netHouseName = json['netHouseName'];
  108. areaId = json['areaId'];
  109. area = json['area'];
  110. if (json['tbDetailUsers'] != null) {
  111. tbDetailUsers = new List<TbDetailUsers>();
  112. json['tbDetailUsers'].forEach((v) {
  113. tbDetailUsers.add(new TbDetailUsers.fromJson(v));
  114. });
  115. }
  116. }
  117. Map<String, dynamic> toJson() {
  118. final Map<String, dynamic> data = new Map<String, dynamic>();
  119. data['id'] = this.id;
  120. data['qrCode'] = this.qrCode;
  121. data['code'] = this.code;
  122. data['areaM2'] = this.areaM2;
  123. data['type'] = this.type;
  124. data['startDate'] = this.startDate;
  125. data['endDate'] = this.endDate;
  126. data['status'] = this.status;
  127. data['description'] = this.description;
  128. data['ageDayStartAt'] = this.ageDayStartAt;
  129. data['tbSuppliesId'] = this.tbSuppliesId;
  130. data['suppliesName'] = this.suppliesName;
  131. data['tbGuidelineId'] = this.tbGuidelineId;
  132. data['netHouseId'] = this.netHouseId;
  133. data['netHouseName'] = this.netHouseName;
  134. data['areaId'] = this.areaId;
  135. data['area'] = this.area;
  136. if (this.tbDetailUsers != null) {
  137. data['tbDetailUsers'] =
  138. this.tbDetailUsers.map((v) => v.toJson()).toList();
  139. }
  140. return data;
  141. }
  142. }
  143. class TbDetailUsers {
  144. int id;
  145. String fullName;
  146. String phone;
  147. TbDetailUsers({this.id, this.fullName, this.phone});
  148. TbDetailUsers.fromJson(Map<String, dynamic> json) {
  149. id = json['id'];
  150. fullName = json['fullName'];
  151. phone = json['phone'];
  152. }
  153. Map<String, dynamic> toJson() {
  154. final Map<String, dynamic> data = new Map<String, dynamic>();
  155. data['id'] = this.id;
  156. data['fullName'] = this.fullName;
  157. data['phone'] = this.phone;
  158. return data;
  159. }
  160. }
  161. class Activities {
  162. int id;
  163. int ageDay;
  164. int cropId;
  165. String executeDate;
  166. String description;
  167. int activityTypeId;
  168. String activityTypeName;
  169. String activityTypeDescription;
  170. Activities(
  171. {this.id,
  172. this.ageDay,
  173. this.cropId,
  174. this.executeDate,
  175. this.description,
  176. this.activityTypeId,
  177. this.activityTypeName,
  178. this.activityTypeDescription});
  179. Activities.fromJson(Map<String, dynamic> json) {
  180. id = json['id'];
  181. ageDay = json['ageDay'];
  182. cropId = json['cropId'];
  183. executeDate = json['executeDate'];
  184. description = json['description'];
  185. activityTypeId = json['activityTypeId'];
  186. activityTypeName = json['activityTypeName'];
  187. activityTypeDescription = json['activityTypeDescription'];
  188. }
  189. Map<String, dynamic> toJson() {
  190. final Map<String, dynamic> data = new Map<String, dynamic>();
  191. data['id'] = this.id;
  192. data['ageDay'] = this.ageDay;
  193. data['cropId'] = this.cropId;
  194. data['executeDate'] = this.executeDate;
  195. data['description'] = this.description;
  196. data['activityTypeId'] = this.activityTypeId;
  197. data['activityTypeName'] = this.activityTypeName;
  198. data['activityTypeDescription'] = this.activityTypeDescription;
  199. return data;
  200. }
  201. }