formula_estimate.go 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426
  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. if req.TmrName == nil {
  224. req.TmrName = make([]string, 0)
  225. }
  226. lpPlanType := ""
  227. if req.PlanType > 0 {
  228. lpPlanType = fmt.Sprintf("%d", req.PlanType)
  229. }
  230. return &ProcessAnalysisParams{
  231. PastureId: fmt.Sprintf("%d", pastureId),
  232. StartTime: req.StartTime,
  233. StopTime: req.EndTime,
  234. TmrTName: req.TmrName,
  235. IsCompleted: "",
  236. LpPlanType: lpPlanType,
  237. FClassId: req.MixFeedType,
  238. Hlzq1: req.Hlzq1,
  239. Hlzq2: req.Hlzq2,
  240. Hlwc1: req.Hlwc1,
  241. Hlwc2: req.Hlwc2,
  242. Slwc1: req.Slwc1,
  243. Slwc2: req.Slwc2,
  244. Slzq2: req.Slzq2,
  245. Slzq1: req.Slzq1,
  246. Error: req.ErrorRange,
  247. }
  248. }
  249. // AccuracyAggParams 准确性分析-汇总统计
  250. type AccuracyAggParams struct {
  251. PastureId string `json:"pastureid"`
  252. StartTime string `json:"startTime"`
  253. StopTime string `json:"stopTime"`
  254. FName string `json:"fname"`
  255. Sort string `json:"sort"`
  256. Times string `json:"times"`
  257. Status string `json:"status"`
  258. Genre int32 `json:"genre"`
  259. IsDate int32 `json:"isdate"`
  260. Hlwc1 int32 `json:"hlwc1,omitempty"`
  261. Hlwc2 int32 `json:"hlwc2,omitempty"`
  262. Hlzq1 int32 `json:"hlzq1,omitempty"`
  263. Hlzq2 int32 `json:"hlzq2,omitempty"`
  264. Hlzql1 int32 `json:"hlzql1,omitempty"`
  265. Hlzql2 int32 `json:"hlzql2,omitempty"`
  266. Slwc1 int32 `json:"slwc1,omitempty"`
  267. Slwc2 int32 `json:"slwc2,omitempty"`
  268. Slzq1 int32 `json:"slzq1,omitempty"`
  269. Slzq2 int32 `json:"slzq2,omitempty"`
  270. Slzql1 int32 `json:"slzql1,omitempty"`
  271. Slzql2 int32 `json:"slzql2,omitempty"`
  272. Error bool `json:"error,omitempty"`
  273. }
  274. func NewAccuracyAggParams(pastureId int64, req *operationPb.AccuracyAggStatisticsRequest) *AccuracyAggParams {
  275. return &AccuracyAggParams{
  276. PastureId: fmt.Sprintf("%d", pastureId),
  277. StartTime: req.StartTime,
  278. StopTime: req.EndTime,
  279. FName: req.Fname,
  280. Sort: req.Sort,
  281. Status: req.Status,
  282. Times: req.Times,
  283. Genre: req.Genre,
  284. IsDate: req.Isdate,
  285. Hlwc1: req.Hlwc1,
  286. Hlwc2: req.Hlwc2,
  287. Hlzq1: req.Hlzq1,
  288. Hlzq2: req.Hlzq2,
  289. Hlzql1: req.Hlzql1,
  290. Hlzql2: req.Hlzql2,
  291. Slwc1: req.Slwc1,
  292. Slwc2: req.Slwc2,
  293. Slzq1: req.Slzq1,
  294. Slzq2: req.Slzq2,
  295. Slzql1: req.Slzql1,
  296. Slzql2: req.Slzql2,
  297. Error: req.IsError,
  298. }
  299. }
  300. // TrainNumberParams 班次
  301. type TrainNumberParams struct {
  302. PastureId string `json:"pastureid"`
  303. InfoRName string `json:"inforname"`
  304. }
  305. // TrainNumberList 班次
  306. type TrainNumberList struct {
  307. InfoName string `json:"inforname"`
  308. InfoValue string `json:"inforvalue"`
  309. }
  310. type GetDataByNameParams struct {
  311. PastureId string `json:"pastureid"`
  312. StartTime string `json:"startTime"`
  313. StopTime string `json:"stopTime"`
  314. Pid string `json:"pid"`
  315. Optdevice string `json:"optdevice,omitempty"`
  316. FtId int32 `json:"ftid,omitempty"`
  317. Name string `json:"name,omitempty"`
  318. }
  319. type FeedStatisticsResponse struct {
  320. Code int32 `json:"code"`
  321. Msg string `json:"msg"`
  322. Data *FeedStatisticsData `json:"data"`
  323. }
  324. type FeedStatisticsData struct {
  325. List map[string]interface{} `json:"list"`
  326. }
  327. var DefaultSheetName = "Sheet1"
  328. type FeedStatisticsConversions struct {
  329. PastureName string `json:"pasture_name"` // 牧场名称
  330. TmrDryMatter string `json:"tmr_dry_matter"` // TMR干物质
  331. BarName string `json:"bar_name"` // 栏舍名称
  332. MilkYield string `json:"milk_yield"` // 产奶量
  333. TodayLeftovers string `json:"today_leftovers"` // 今日剩料量
  334. FeedCosts float64 `json:"feed_costs"` // 公斤奶饲料成本
  335. LeftoverRate string `json:"leftover_rate"` // 剩料率
  336. ActualDryMatterIntake string `json:"actual_dry_matter_intake"` // 实际干物质采食量
  337. ActualCost string `json:"actual_cost"` // 实际成本
  338. ActualNumberOfCattle string `json:"actual_number_of_cattle"` // 实际牛头数
  339. AmountToBeMixed string `json:"amount_to_be_mixed"` // 应混料量
  340. MixingTime string `json:"mixing_time"` // 混料时间
  341. CategoryCattleName string `json:"category_cattle_name"` // 牲畜类别
  342. TheoreticalDryMatter string `json:"theoretical_dry_matter"` // 理论干物质
  343. LeftoverMaterial float64 `json:"leftover_material"` // 转投剩料量
  344. FormulatedDryMatterIntake string `json:"formulated_dry_matter_intake"` // 配方干物质采食量
  345. CostOfFormulation string `json:"cost_of_formulation"` // 配方成本
  346. FoodIntakeRate string `json:"food_intake_rate"` // 采食率
  347. FeedConversionRatio float64 `json:"feed_conversion_ratio"` // 饲料转化率
  348. FeedFormulaName string `json:"feed_formula_name"` // 配方模板
  349. ActualMixedVolume string `json:"actual_mixed_volume"` // 实际混料量
  350. SprinkleVolume string `json:"sprinkle_volume"` // 撒料量
  351. }
  352. type MixedSprinkleDetailRequest struct {
  353. PastureId string `json:"pastureid"`
  354. Id string `json:"id"`
  355. PId string `json:"pid"`
  356. FClassId string `json:"fclassid"`
  357. }
  358. func NewMixedSprinkleDetailRequest(pastureId int64, req *operationPb.ProcessMixedSprinkleDetailRequest) *MixedSprinkleDetailRequest {
  359. return &MixedSprinkleDetailRequest{
  360. PastureId: fmt.Sprintf("%d", pastureId),
  361. FClassId: req.FclassId,
  362. PId: req.Pid,
  363. Id: req.Id,
  364. }
  365. }
  366. type PastureFeedTemplateHistoryRequest struct {
  367. PastureId string `json:"pastureid"`
  368. FTid int64 `json:"ftid"`
  369. StartDate string `json:"startdate"`
  370. EndDate string `json:"enddate"`
  371. }
  372. type PastureFeedTemplateHistoryResponse struct {
  373. Code int32 `json:"code"`
  374. Msg string `json:"msg"`
  375. Data interface{} `json:"data"`
  376. }
  377. type PastureBarnHistoryRequest struct {
  378. PastureId string `json:"pastureid,omitempty"`
  379. BarName string `json:"barname"`
  380. StartDate string `json:"startDate"`
  381. EndDate string `json:"endDate"`
  382. }
  383. type PastureBarnHistoryResponse struct {
  384. Code int32 `json:"code"`
  385. Msg string `json:"msg"`
  386. Data interface{} `json:"data"`
  387. }