app_api.go 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. package routers
  2. import (
  3. "tmr-watch/comm"
  4. "tmr-watch/conf/setting"
  5. "tmr-watch/http/handle/api"
  6. "tmr-watch/http/handle/group"
  7. "tmr-watch/http/handle/sap"
  8. "tmr-watch/http/handle/zc"
  9. "tmr-watch/middleware/jwt"
  10. "github.com/gin-gonic/gin"
  11. ginSwagger "github.com/swaggo/gin-swagger"
  12. "github.com/swaggo/gin-swagger/swaggerFiles"
  13. )
  14. func AppAPI(opts ...func(engine *gin.Engine)) func(s *gin.Engine) {
  15. return func(s *gin.Engine) {
  16. for _, opt := range opts {
  17. opt(s)
  18. }
  19. s.POST("/pasture/account/distribute", group.DistributeAccount) // 账号下发
  20. s.Static("/static", setting.CurrentPath+"/dist/static") // 添加资源路径
  21. s.StaticFile("/", setting.CurrentPath+"/dist/index.html") //前端接口
  22. s.StaticFile("/favicon.ico", setting.CurrentPath+"/dist/favicon.ico") //前端接口
  23. s.Static("/file", setting.CurrentPath+"/uploads/file")
  24. s.Static("/uploads", setting.CurrentPath+"/uploads")
  25. s.POST("/auth", api.Auth) // 获取登录token
  26. s.POST("/authlogin", api.AuthLogin) // 获取登录token
  27. s.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler)) // API 注释
  28. if setting.CommSetting.PortName != "" {
  29. s.GET("/comm/:id/:x/:y/", comm.ProcessHttp)
  30. s.GET("/cps/:id/:limit", comm.ProcessHttpCPS)
  31. s.POST("/comm/:id/:x/:y/", comm.ProcessHttp)
  32. s.POST("/cps/:id/:limit", comm.ProcessHttpCPS)
  33. }
  34. eqm := s.Group("/manage/api")
  35. eqm.POST("/login", api.Auth)
  36. eqm.POST("/login/imei", api.AuthImei)
  37. s.GET("/getData", api.GetWxCode)
  38. s.GET("/getData/yq", api.GetYqWxCode)
  39. s.POST("/language/edit", api.EditLanguage)
  40. s.POST("/userwxopenid/binding", api.UserWXOpenIDBinding)
  41. apiV1 := s.Group("/authdata")
  42. apiV1.Use(jwt.JWT()) // token 验证
  43. {
  44. apiV1.POST("/rolemenus", api.GetRecuDataByName)
  45. apiV1.GET("/userinfo", api.GetUserinfo)
  46. apiV1.POST("/logout", api.UserLogout)
  47. apiV1.POST("/GetRecuDataByName", api.GetRecuDataByName) ////
  48. apiV1.POST("/GetDataByName", api.GetDataByName)
  49. apiV1.POST("/GetDataBySqlIN", api.GetDataBySqlIN)
  50. apiV1.POST("/GetDataByNames", api.GetDataByNames)
  51. apiV1.POST("/PostDataByName", api.PostDataByName)
  52. apiV1.POST("/PostDataByNames", api.PostDataByNames)
  53. apiV1.POST("/UpdateDataRelation", api.UpdateDataRelation) //log.error
  54. apiV1.POST("/GetDataByNameForm", api.GetDataByNameForm)
  55. apiV1.POST("/PostDataByNameForm", api.PostDataByNameForm)
  56. apiV1.POST("/GetUpkeepPlan", api.GetUpkeepPlan)
  57. apiV1.POST("/GetReportform", api.GetReportform)
  58. apiV1.POST("/GetArrList", api.GetArrList)
  59. apiV1.POST("/GETNurJudge", api.GETNurJudge)
  60. apiV1.POST("/GETNurJudgeRport", api.GETNurJudgeRport)
  61. apiV1.POST("/ExecDataByConfig", api.ExecDataByConfig)
  62. apiV1.POST("/ImportExcel", api.ImportExcel)
  63. apiV1.POST("/upload/:id/:name", api.UploadFile)
  64. apiV1.POST("/uploads", api.UploadFiles)
  65. apiV1.POST("/uploaderimage", api.UploaderImage)
  66. apiV1.POST("/uploaderTmrImage", api.UploaderTmrImage)
  67. apiV1.POST("/removeimage", api.RemovePicByName)
  68. apiV1.GET("/getthumbnailimage/:filename", api.GetThumbnailImage)
  69. apiV1.POST("/getoriginimage/:filename", api.GetOriginImage)
  70. apiV1.GET("/getfileraw/:filename", api.GetFileRaw)
  71. apiV1.GET("/downloadfile/:filename", api.DownloadFile)
  72. apiV1.POST("/removefile/:id", api.RemoveFileByName)
  73. apiV1.POST("/testdata", api.TestData)
  74. apiV1.POST("/Testpartitions", api.Testpartitions)
  75. //自定义报表
  76. apiV1.POST("/Createchart", api.Createchart)
  77. apiV1.POST("/Updatechart", api.Createchart)
  78. apiV1.POST("/exesql", api.ExecSQL)
  79. apiV1.POST("/Createdashboard", api.Updatedashboard)
  80. apiV1.POST("/Updatedashboard", api.Updatedashboard)
  81. apiV1.POST("/Dashboards", api.Dashboards)
  82. // 格润富德 API 数据获取
  83. apiV1.POST("/getDorm", api.GetDorm) // 牛舍信息
  84. apiV1.POST("/GetRJSBData", api.GetRJSBData)
  85. apiV1.POST("/PostRJSBData", api.PostRJSBData)
  86. apiV1.POST("/PostRJSBDatas", api.PostRJSBDatas)
  87. apiV1.POST("/autogeneration", api.Autogeneration)
  88. apiV1.POST("/spillage", api.GetSpillage)
  89. apiV1.POST("/trains", api.UpdateTrains)
  90. apiV1.POST("/lpplan/edit", api.UpdateLpplan)
  91. apiV1.POST("/lpplan/add", api.AddLpplan)
  92. apiV1.POST("/lpplandtl", api.GetLpplandtl)
  93. apiV1.POST("/lpplandtl/restore", api.RestoreLpplandtl)
  94. apiV1.POST("/lpplandtl/del", api.DelLpplandtl)
  95. apiV1.POST("/spillage/day", api.GetSpillageDay)
  96. apiV1.POST("/trains/day", api.UpdateTrainsDay)
  97. apiV1.POST("/lpplandtl/restore/day", api.RestoreLpplandtlDay)
  98. apiV1.POST("/lpplandtl/del/day", api.DelLpplandtlDay)
  99. apiV1.POST("/lpplandtl/add/day", api.AddLpplanDay)
  100. apiV1.POST("/lpplandtl/day", api.GetLpplandtlDay)
  101. apiV1.POST("/chart/feedEffMR", api.GetFeedEffMR)
  102. apiV1.POST("/chart/feedEffSL", api.GetFeedEffSL)
  103. apiV1.POST("/chart/feedEffHL", api.GetFeedEffHL)
  104. apiV1.POST("/chart/feedEffZH", api.GetFeedEffZH)
  105. apiV1.POST("/chart/feedEffCBFT", api.GetFeedEffCBFT)
  106. apiV1.POST("/chart/accuracyAllFT", api.GetAccuracyAllFT)
  107. apiV1.POST("/chart/accuracyAllJH", api.GetAccuracyAllJH)
  108. apiV1.POST("/chart/accuracyAllNQ", api.GetAccuracyAllNQ)
  109. apiV1.POST("/chart/accuracyAllCC", api.GetAccuracyAllCC)
  110. apiV1.POST("/chart/accuracyAllHL", api.GetAccuracyAllHL)
  111. apiV1.POST("/chart/accuracyAllLS", api.GetAccuracyAllLS)
  112. apiV1.POST("/chart/accuracyAllQX", api.GetAccuracyAllQX)
  113. apiV1.POST("/summary", api.GetSummary)
  114. apiV1.POST("/ftdetail/edit", api.UpdateFTdetail)
  115. apiV1.POST("/fpdetail/edit", api.UpdateFpdetailBar)
  116. apiV1.POST("/fpdetail/batch/edit", api.FpdBatchEdit)
  117. apiV1.POST("/ftdetai/del", api.DeleteFTdetail)
  118. apiV1.POST("/lpplandtl/add", api.AddLpplandtl)
  119. apiV1.POST("/lpplandtl/edit/sort", api.UpdateLpplandtlSort)
  120. apiV1.POST("/lpplandtl/date/add", api.AddLpplandtlDate)
  121. apiV1.POST("/lpplandtl/edit/date/sort", api.UpdateLpplandtlDateSort)
  122. apiV1.POST("/processAnalysist", api.GetProcessAnalysis)
  123. apiV1.POST("/feedp/undistribute", api.GetFeedpUndistributed)
  124. apiV1.POST("/feedtemplet/enable", api.UpdateFeedtempletStatus)
  125. apiV1.POST("/ftdry/add", api.AddFtdry)
  126. apiV1.POST("/checkDates", api.CheckDates)
  127. //编辑数据同步勾选状态
  128. apiV1.POST("/scheduled/status/edit", api.UpdateScheduledStatus)
  129. // 立即同步
  130. apiV1.POST("/synchronizeNow", api.SynchronizeNow)
  131. apiV1.POST("/fpdimportexcel", api.FpdImportExcel)
  132. apiV1.POST("/barfeedremain/excel", api.GetBarfeedremainExcel)
  133. //删除当前班次撒料时记录
  134. apiV1.POST("/spillageall/del", api.DeleteSpillageAll)
  135. apiV1.POST("/feedp/history", api.GetFeedpHistory)
  136. //查看撒料修改记录
  137. apiV1.POST("/spillageall/history", api.GetSpillageallHistory)
  138. //查看撒料设备
  139. apiV1.POST("/tmrListEnableTypeAll", api.GetTMRListEnableTypeAll)
  140. //查看提醒设置
  141. apiV1.POST("/remind/list", api.GetRemind)
  142. apiV1.POST("/remind/edit", api.UpdateRemind)
  143. //配方模板修改记录
  144. apiV1.POST("/recipetemplate/history", api.GetRecipeTemplateRecordHistory)
  145. //配方模板修改记录
  146. apiV1.POST("/feedtemplet/history", api.GetFeedtempletHistory)
  147. //app取料接口
  148. apiV1.POST("/downloadedplan", api.GetDownloadedplanMaterial1)
  149. apiV1.POST("/downloadedplan/list", api.GetDownloadedplanMaterialList)
  150. apiV1.POST("/subplan", api.GetSubPlan)
  151. apiV1.POST("/completeplan", api.CompletePlan)
  152. apiV1.POST("/realtimeweight", api.AddRealTimeWeight)
  153. //修改撒料计划tmr编号
  154. apiV1.POST("/materialtmr/edit", api.UpdateMaterialTMR)
  155. apiV1.POST("/materialtmr/date/edit", api.UpdateMaterialTMRDate)
  156. //集团端配方下发
  157. apiV1.POST("/formulaissued", api.AddFormulaIssued)
  158. //盘点单添加
  159. apiV1.POST("/biginventory", api.AddBigInventory)
  160. //sap原料上传
  161. apiV1.POST("/material/sap/upload", sap.MaterialOutbound)
  162. //sap剩料上传
  163. apiV1.POST("/surplus/sap/upload", sap.SurplusOutbound)
  164. apiV1.POST("/downloadplandtl1/image/upload", api.UploadFile1)
  165. apiV1.POST("/syncSCJH", zc.SyncSCJH)
  166. //修改日执行计划
  167. apiV1.POST("/dailydata/edit", api.UpdateDailyData)
  168. apiV1.POST("/formulastatistics", api.GetFormulaStatistics)
  169. apiV1.POST("/sap/feed", sap.SyncSapFeed)
  170. apiV1.POST("/sap/bar", sap.SyncSapBar)
  171. apiV1.POST("/sap/material", sap.MaterialOutbound)
  172. apiV1.POST("/feedbackup/check", api.CheckFeedTrgaddress)
  173. apiV1.POST("/ud/feedp/sync", api.UdFeedpSync)
  174. apiV1.POST("/tmrequipment/del", api.DelTmrEquipment)
  175. apiV1.POST("/tmrequipment/edit", api.AddTmrEquipment)
  176. apiV1.GET("/tmrequipment", api.GetTmrEquipment)
  177. //光明ud手动上传
  178. apiV1.POST("/gm/udbar", api.UdBarSync)
  179. apiV1.POST("/gm/udfeed", api.UdFeedSync)
  180. apiV1.POST("/gm/udfeedtemplet/push", api.UdFeedtempletPush)
  181. apiV1.POST("/gm/udutir/push", api.UdUtirPush)
  182. apiV1.POST("/gm/udbarfeedremain/push", api.UdBarFeedRemainPush)
  183. apiV1.POST("/gm/udmaterialIssue/push", api.UdMaterialIssuePush)
  184. apiV1.POST("/feedtemplet/del", api.DelFeedTemplet)
  185. apiV1.POST("/plan/sort/edit", api.EditPlanSort)
  186. //日执行计划修改为完成
  187. apiV1.POST("/plan/artificial/edit", api.EditDownloadedplanArtificial)
  188. apiV1.GET("/equipment/muster", api.GetTmrEquipmentMuster)
  189. // 修改混料实际重量
  190. apiV1.POST("/planexec/edit", api.EditDownloadedplanExecWeight)
  191. // 修改撒料实际重量
  192. apiV1.POST("/plan2/edit", api.EditDownloadplandtl2Weight)
  193. apiV1.POST("/surplus/add", api.AddSurplus)
  194. apiV1.POST("/surplus/del", api.DelSurplus)
  195. apiV1.GET("/surplus/list", api.GetelSurplus)
  196. // 云养牛搅拌上传
  197. apiV1.POST("/stir/yyn/upload", api.LabourStirPush)
  198. // 云养牛撒料上传
  199. apiV1.POST("/dusting/yyn/upload", api.LabourDustingPush)
  200. }
  201. //不需要登录验证的接口
  202. s.POST("/getopenid/:code", api.GetOpenID)
  203. apiV3 := s.Group("/thi") // restful 接口 tablename 是 表名字
  204. {
  205. apiV3.POST("/GetDataByName", api.GetDataByName)
  206. apiV3.POST("/PostDataByName", api.PostDataByName)
  207. apiV3.POST("/plandata", api.GetPlanData)
  208. apiV3.POST("/plandata/edit", api.PostPlanData)
  209. apiV3.POST("/plandata/batch/edit", api.PostPlanDatas)
  210. //推料接口
  211. apiV3.GET("/pusher/list", api.GetPusherList)
  212. apiV3.POST("/pusher/edit", api.EditPusherGPS)
  213. //羊圈通过RFID 需要传输的值:
  214. apiV3.GET("/plan/rfid", api.GetPlanRFID)
  215. }
  216. apiV4 := s.Group("/customreport") // restful 接口 tablename 是 表名字
  217. {
  218. apiV4.POST("/createchart", api.Createchart)
  219. apiV4.POST("/PostDataByName", api.PostDataByName)
  220. }
  221. }
  222. }