formula_estimate.go 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. package model
  2. import (
  3. "fmt"
  4. operationPb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/operation"
  5. )
  6. type PastureCommonRequest struct {
  7. Name string `json:"name"`
  8. Page int32 `json:"page,omitempty"`
  9. Offset int32 `json:"offset"`
  10. PageCount int32 `json:"pagecount,omitempty"`
  11. ReturnType string `json:"returntype,omitempty"`
  12. Checked int32 `json:"checked,omitempty"`
  13. ParamMaps interface{} `json:"parammaps"`
  14. }
  15. type FormulaEstimateParams struct {
  16. PastureId string `json:"pastureid"`
  17. StartTime string `json:"startTime"`
  18. StopTime string `json:"stopTime"`
  19. Search string `json:"search"`
  20. TempletId string `json:"templetid"`
  21. Barid string `json:"barid"`
  22. ImforName string `json:"inforname,omitempty"`
  23. }
  24. type PastureCommonResponse struct {
  25. Code int32 `json:"code"`
  26. Msg string `json:"msg"`
  27. Data *PastureCommonData `json:"data"`
  28. }
  29. type PastureCommonData struct {
  30. List interface{} `json:"list"`
  31. Data interface{} `json:"data"`
  32. PageSize int32 `json:"pageSize"`
  33. Total int32 `json:"total"`
  34. PageNum int32 `json:"pageNum"`
  35. }
  36. type InventoryStatisticsParams struct {
  37. PastureId string `json:"pastureid"`
  38. StartTime string `json:"startTime"`
  39. StopTime string `json:"stopTime"`
  40. FeedName string `json:"feedname"`
  41. }
  42. type InventoryStatisticsList struct {
  43. FeedName string `json:"feedname"`
  44. LaidSum string `json:"laidsum"` // 入库重量
  45. StartPrice string `json:"startprice"` // 期初价格
  46. StartSum string `json:"startsum"` // 期初库存
  47. StopPrice string `json:"stopprice"` // 期末价格
  48. StopSum string `json:"stopsum"` // 期末库存
  49. UseSumRG string `json:"usesumRG"` // 人工用料重量
  50. UseSumXH string `json:"usesumXH"` // 损耗重量
  51. UseSumXT string `json:"usesumXT"` // 系统出库重量
  52. }
  53. type UserMaterialsStatisticsParams struct {
  54. PastureId string `json:"pastureid"`
  55. StartTime string `json:"startTime"`
  56. StopTime string `json:"stopTime"`
  57. FeedName string `json:"fname"`
  58. Typea string `json:"typea"`
  59. }
  60. type UserMaterialsList struct {
  61. Data1 []interface{} `json:"data1"`
  62. Data2 []*UserMaterialsListData2 `json:"data2"`
  63. }
  64. type UserMaterialsListData2 struct {
  65. Children []*Children `json:"children"`
  66. Label string `json:"label"`
  67. }
  68. type Children struct {
  69. Label string `json:"label"`
  70. Prop string `json:"prop"`
  71. }
  72. type PriceStatisticsParams struct {
  73. PastureId string `json:"pastureid"`
  74. StartTime string `json:"startTime"`
  75. StopTime string `json:"stopTime"`
  76. FeedName string `json:"fname"`
  77. }
  78. // FeedStatisticsParams 饲喂效率-效率统计
  79. type FeedStatisticsParams struct {
  80. PastureId string `json:"pastureid"`
  81. StartTime string `json:"startTime"`
  82. StopTime string `json:"stopTime"`
  83. Date string `json:"date"`
  84. FeedTName string `json:"ftname"`
  85. BarName string `json:"barname"`
  86. CowClass string `json:"cowclass"`
  87. Times string `json:"times"`
  88. }
  89. func NewFeedStatisticsParams(pastureId int64, req *operationPb.SearchFeedStatisticsRequest) *FeedStatisticsParams {
  90. times := ""
  91. if req.ClassNumber > 0 {
  92. times = fmt.Sprintf("%d", req.ClassNumber)
  93. }
  94. return &FeedStatisticsParams{
  95. PastureId: fmt.Sprintf("%d", pastureId),
  96. StartTime: req.StartTime,
  97. StopTime: req.EndTime,
  98. Date: req.StartTime,
  99. FeedTName: req.FormulaTemplate,
  100. BarName: req.BarnName,
  101. CowClass: req.CattleCategoryName,
  102. Times: times,
  103. }
  104. }
  105. // FeedChartParams 饲喂效率-图形统计
  106. type FeedChartParams struct {
  107. ParamMaps interface{} `json:"parammaps"`
  108. }
  109. type ParamMaps struct {
  110. PastureId string `json:"pastureid"`
  111. StartTime string `json:"startTime"`
  112. StopTime string `json:"stopTime"`
  113. Status int32 `json:"status"`
  114. }
  115. // MixFeedStatisticsParams 准确性分析-混料统计
  116. type MixFeedStatisticsParams struct {
  117. PastureId string `json:"pastureid"`
  118. StartTime string `json:"startTime"`
  119. StopTime string `json:"stopTime"`
  120. TmrTName string `json:"tmrTName"`
  121. ProjName string `json:"projName"`
  122. Times string `json:"times"`
  123. ButtonType string `json:"buttonType"`
  124. TempletName string `json:"templetName"`
  125. Isuse string `json:"isuse"`
  126. Hlwc1 int32 `json:"hlwc1,omitempty"`
  127. Hlwc2 int32 `json:"hlwc2,omitempty"`
  128. Hlzq1 int32 `json:"hlzq1,omitempty"`
  129. Hlzq2 int32 `json:"hlzq2,omitempty"`
  130. Hlzql1 int32 `json:"hlzql1,omitempty"`
  131. Hlzql2 int32 `json:"hlzql2,omitempty"`
  132. Error bool `json:"error,omitempty"`
  133. }
  134. func NewMixFeedStatisticsParams(pastureId int64, req *operationPb.MixFeedStatisticsRequest) *MixFeedStatisticsParams {
  135. times := ""
  136. if req.ClassNumber > 0 {
  137. times = fmt.Sprintf("%d", req.ClassNumber)
  138. }
  139. return &MixFeedStatisticsParams{
  140. PastureId: fmt.Sprintf("%d", pastureId),
  141. StartTime: req.StartTime,
  142. StopTime: req.StartTime,
  143. TmrTName: req.EquipmentName,
  144. ProjName: req.TrainNumber,
  145. Times: times,
  146. ButtonType: req.ButtonType,
  147. TempletName: req.FormulationName,
  148. Isuse: req.IsUse,
  149. Hlwc1: req.Hlwc1,
  150. Hlwc2: req.Hlwc2,
  151. Hlzq1: req.Hlzq1,
  152. Hlzq2: req.Hlzq2,
  153. Hlzql1: req.Hlzql1,
  154. Hlzql2: req.Hlzql2,
  155. Error: req.IsError,
  156. }
  157. }
  158. // SprinkleStatisticsParams 准确性分析-撒料统计
  159. type SprinkleStatisticsParams struct {
  160. PastureId string `json:"pastureid"`
  161. StartTime string `json:"startTime"`
  162. StopTime string `json:"stopTime"`
  163. TmrTName string `json:"tmrTName"`
  164. ProjName string `json:"projName"`
  165. Times string `json:"times"`
  166. Fname string `json:"fname"`
  167. ButtonType string `json:"buttontype"`
  168. TempletName string `json:"templetname"`
  169. Isuse string `json:"isuse,omitempty"`
  170. Slwc1 int32 `json:"slwc1,omitempty"`
  171. Slwc2 int32 `json:"slwc2,omitempty"`
  172. Slzq1 int32 `json:"slzq1,omitempty"`
  173. Slzq2 int32 `json:"slzq2,omitempty"`
  174. Slzql1 int32 `json:"slzql1,omitempty"`
  175. Slzql2 int32 `json:"slzql2,omitempty"`
  176. Error bool `json:"error,omitempty"`
  177. }
  178. func NewSprinkleStatisticsParams(pastureId int64, req *operationPb.SprinkleStatisticsRequest) *SprinkleStatisticsParams {
  179. times := ""
  180. if req.ClassNumber > 0 {
  181. times = fmt.Sprintf("%d", req.ClassNumber)
  182. }
  183. return &SprinkleStatisticsParams{
  184. PastureId: fmt.Sprintf("%d", pastureId),
  185. StartTime: req.StartTime,
  186. StopTime: req.StartTime,
  187. TmrTName: req.EquipmentName,
  188. ProjName: req.TrainNumber,
  189. Times: times,
  190. ButtonType: req.ButtonType,
  191. TempletName: req.FormulationName,
  192. Isuse: req.IsUse,
  193. Fname: req.BarnName,
  194. Slwc1: req.Slwc1,
  195. Slwc2: req.Slwc2,
  196. Slzq2: req.Slzq2,
  197. Slzq1: req.Slzq1,
  198. Slzql1: req.Slzql1,
  199. Slzql2: req.Slzql2,
  200. Error: req.IsError,
  201. }
  202. }
  203. // ProcessAnalysisParams 过程分析
  204. type ProcessAnalysisParams struct {
  205. PastureId string `json:"pastureid"`
  206. StartTime string `json:"startTime"`
  207. StopTime string `json:"stopTime"`
  208. TmrTName []string `json:"tmrTName"`
  209. IsCompleted string `json:"iscompleted"`
  210. LpPlanType string `json:"lpplantype"`
  211. FClassId string `json:"fclassid"`
  212. Hlwc1 int32 `json:"hlwc1,omitempty"`
  213. Hlwc2 int32 `json:"hlwc2,omitempty"`
  214. Hlzq1 int32 `json:"hlzq1,omitempty"`
  215. Hlzq2 int32 `json:"hlzq2,omitempty"`
  216. Slwc1 int32 `json:"slwc1,omitempty"`
  217. Slwc2 int32 `json:"slwc2,omitempty"`
  218. Slzq1 int32 `json:"slzq1,omitempty"`
  219. Slzq2 int32 `json:"slzq2,omitempty"`
  220. Error string `json:"error,omitempty"`
  221. }
  222. func NewProcessAnalysisParams(pastureId int64, req *operationPb.ProcessAnalysisRequest) *ProcessAnalysisParams {
  223. return &ProcessAnalysisParams{
  224. PastureId: fmt.Sprintf("%d", pastureId),
  225. StartTime: req.StartTime,
  226. StopTime: req.StartTime,
  227. TmrTName: req.TmrName,
  228. IsCompleted: "",
  229. LpPlanType: fmt.Sprintf("%d", req.PlanType),
  230. FClassId: req.MixFeedType,
  231. Hlzq1: req.Hlzq1,
  232. Hlzq2: req.Hlzq2,
  233. Hlwc1: req.Hlwc1,
  234. Hlwc2: req.Hlwc2,
  235. Slwc1: req.Slwc1,
  236. Slwc2: req.Slwc2,
  237. Slzq2: req.Slzq2,
  238. Slzq1: req.Slzq1,
  239. Error: req.ErrorRange,
  240. }
  241. }
  242. // AccuracyAggParams 准确性分析-汇总统计
  243. type AccuracyAggParams struct {
  244. PastureId string `json:"pastureid"`
  245. StartTime string `json:"startTime"`
  246. StopTime string `json:"stopTime"`
  247. FName string `json:"fname"`
  248. Sort string `json:"sort"`
  249. Times string `json:"times"`
  250. Status string `json:"status"`
  251. Genre int32 `json:"genre"`
  252. IsDate int32 `json:"isdate"`
  253. Hlwc1 int32 `json:"hlwc1,omitempty"`
  254. Hlwc2 int32 `json:"hlwc2,omitempty"`
  255. Hlzq1 int32 `json:"hlzq1,omitempty"`
  256. Hlzq2 int32 `json:"hlzq2,omitempty"`
  257. Hlzql1 int32 `json:"hlzql1,omitempty"`
  258. Hlzql2 int32 `json:"hlzql2,omitempty"`
  259. Slwc1 int32 `json:"slwc1,omitempty"`
  260. Slwc2 int32 `json:"slwc2,omitempty"`
  261. Slzq1 int32 `json:"slzq1,omitempty"`
  262. Slzq2 int32 `json:"slzq2,omitempty"`
  263. Slzql1 int32 `json:"slzql1,omitempty"`
  264. Slzql2 int32 `json:"slzql2,omitempty"`
  265. Error bool `json:"error,omitempty"`
  266. }
  267. func NewAccuracyAggParams(pastureId int64, req *operationPb.AccuracyAggStatisticsRequest) *AccuracyAggParams {
  268. return &AccuracyAggParams{
  269. PastureId: fmt.Sprintf("%d", pastureId),
  270. StartTime: req.StartTime,
  271. StopTime: req.EndTime,
  272. FName: req.Fname,
  273. Sort: req.Sort,
  274. Status: req.Status,
  275. Times: req.Times,
  276. Genre: req.Genre,
  277. IsDate: req.Isdate,
  278. Hlwc1: req.Hlwc1,
  279. Hlwc2: req.Hlwc2,
  280. Hlzq1: req.Hlzq1,
  281. Hlzq2: req.Hlzq2,
  282. Hlzql1: req.Hlzql1,
  283. Hlzql2: req.Hlzql2,
  284. Slwc1: req.Slwc1,
  285. Slwc2: req.Slwc2,
  286. Slzq1: req.Slzq1,
  287. Slzq2: req.Slzq2,
  288. Slzql1: req.Slzql1,
  289. Slzql2: req.Slzql2,
  290. Error: req.IsError,
  291. }
  292. }
  293. // TrainNumberParams 班次
  294. type TrainNumberParams struct {
  295. PastureId string `json:"pastureid"`
  296. InfoRName string `json:"inforname"`
  297. }
  298. // TrainNumberList 班次
  299. type TrainNumberList struct {
  300. InfoName string `json:"inforname"`
  301. InfoValue string `json:"inforvalue"`
  302. }
  303. type GetDataByNameParams struct {
  304. PastureId string `json:"pastureid"`
  305. StartTime string `json:"startTime"`
  306. StopTime string `json:"stopTime"`
  307. Pid string `json:"pid"`
  308. }
  309. type FeedStatisticsResponse struct {
  310. Code int32 `json:"code"`
  311. Msg string `json:"msg"`
  312. Data *FeedStatisticsData `json:"data"`
  313. }
  314. type FeedStatisticsData struct {
  315. List map[string]interface{} `json:"list"`
  316. }
  317. var DefaultSheetName = "Sheet1"
  318. type FeedStatisticsConversions struct {
  319. PastureName string `json:"pasture_name"` // 牧场名称
  320. TmrDryMatter string `json:"tmr_dry_matter"` // TMR干物质
  321. BarName string `json:"bar_name"` // 栏舍名称
  322. MilkYield string `json:"milk_yield"` // 产奶量
  323. TodayLeftovers string `json:"today_leftovers"` // 今日剩料量
  324. FeedCosts float64 `json:"feed_costs"` // 公斤奶饲料成本
  325. LeftoverRate string `json:"leftover_rate"` // 剩料率
  326. ActualDryMatterIntake string `json:"actual_dry_matter_intake"` // 实际干物质采食量
  327. ActualCost string `json:"actual_cost"` // 实际成本
  328. ActualNumberOfCattle string `json:"actual_number_of_cattle"` // 实际牛头数
  329. AmountToBeMixed string `json:"amount_to_be_mixed"` // 应混料量
  330. MixingTime string `json:"mixing_time"` // 混料时间
  331. CategoryCattleName string `json:"category_cattle_name"` // 牲畜类别
  332. TheoreticalDryMatter string `json:"theoretical_dry_matter"` // 理论干物质
  333. LeftoverMaterial float64 `json:"leftover_material"` // 转投剩料量
  334. FormulatedDryMatterIntake string `json:"formulated_dry_matter_intake"` // 配方干物质采食量
  335. CostOfFormulation string `json:"cost_of_formulation"` // 配方成本
  336. FoodIntakeRate string `json:"food_intake_rate"` // 采食率
  337. FeedConversionRatio float64 `json:"feed_conversion_ratio"` // 饲料转化率
  338. FeedFormulaName string `json:"feed_formula_name"` // 配方模板
  339. ActualMixedVolume string `json:"actual_mixed_volume"` // 实际混料量
  340. SprinkleVolume string `json:"sprinkle_volume"` // 撒料量
  341. }
  342. type MixedSprinkleDetailRequest struct {
  343. PastureId string `json:"pastureid"`
  344. Id string `json:"id"`
  345. PId string `json:"pid"`
  346. FClassId string `json:"fclassid"`
  347. }
  348. func NewMixedSprinkleDetailRequest(pastureId int64, req *operationPb.ProcessMixedSprinkleDetailRequest) *MixedSprinkleDetailRequest {
  349. return &MixedSprinkleDetailRequest{
  350. PastureId: fmt.Sprintf("%d", pastureId),
  351. FClassId: req.FclassId,
  352. PId: req.Pid,
  353. Id: req.Id,
  354. }
  355. }