app_api.go 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  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("/userwxopenid/binding", api.UserWXOpenIDBinding)
  40. apiV1 := s.Group("/authdata")
  41. apiV1.Use(jwt.JWT()) // token 验证
  42. {
  43. apiV1.POST("/rolemenus", api.GetRecuDataByName)
  44. apiV1.GET("/userinfo", api.GetUserinfo)
  45. apiV1.POST("/logout", api.UserLogout)
  46. apiV1.POST("/GetRecuDataByName", api.GetRecuDataByName) ////
  47. apiV1.POST("/GetDataByName", api.GetDataByName)
  48. apiV1.POST("/GetDataBySqlIN", api.GetDataBySqlIN)
  49. apiV1.POST("/GetDataByNames", api.GetDataByNames)
  50. apiV1.POST("/PostDataByName", api.PostDataByName)
  51. apiV1.POST("/PostDataByNames", api.PostDataByNames)
  52. apiV1.POST("/UpdateDataRelation", api.UpdateDataRelation) //log.error
  53. apiV1.POST("/GetDataByNameForm", api.GetDataByNameForm)
  54. apiV1.POST("/PostDataByNameForm", api.PostDataByNameForm)
  55. apiV1.POST("/GetUpkeepPlan", api.GetUpkeepPlan)
  56. apiV1.POST("/GetReportform", api.GetReportform)
  57. apiV1.POST("/GetArrList", api.GetArrList)
  58. apiV1.POST("/GETNurJudge", api.GETNurJudge)
  59. apiV1.POST("/GETNurJudgeRport", api.GETNurJudgeRport)
  60. apiV1.POST("/ExecDataByConfig", api.ExecDataByConfig)
  61. apiV1.POST("/ImportExcel", api.ImportExcel)
  62. apiV1.POST("/upload/:id/:name", api.UploadFile)
  63. apiV1.POST("/uploads", api.UploadFiles)
  64. apiV1.POST("/uploaderimage", api.UploaderImage)
  65. apiV1.POST("/uploaderTmrImage", api.UploaderTmrImage)
  66. apiV1.POST("/removeimage", api.RemovePicByName)
  67. apiV1.GET("/getthumbnailimage/:filename", api.GetThumbnailImage)
  68. apiV1.POST("/getoriginimage/:filename", api.GetOriginImage)
  69. apiV1.GET("/getfileraw/:filename", api.GetFileRaw)
  70. apiV1.GET("/downloadfile/:filename", api.DownloadFile)
  71. apiV1.POST("/removefile/:id", api.RemoveFileByName)
  72. apiV1.POST("/testdata", api.TestData)
  73. apiV1.POST("/Testpartitions", api.Testpartitions)
  74. //自定义报表
  75. apiV1.POST("/Createchart", api.Createchart)
  76. apiV1.POST("/Updatechart", api.Createchart)
  77. apiV1.POST("/exesql", api.ExecSQL)
  78. apiV1.POST("/Createdashboard", api.Updatedashboard)
  79. apiV1.POST("/Updatedashboard", api.Updatedashboard)
  80. apiV1.POST("/Dashboards", api.Dashboards)
  81. // 格润富德 API 数据获取
  82. apiV1.POST("/getDorm", api.GetDorm) // 牛舍信息
  83. apiV1.POST("/GetRJSBData", api.GetRJSBData)
  84. apiV1.POST("/PostRJSBData", api.PostRJSBData)
  85. apiV1.POST("/PostRJSBDatas", api.PostRJSBDatas)
  86. apiV1.POST("/autogeneration", api.Autogeneration)
  87. apiV1.POST("/spillage", api.GetSpillage)
  88. apiV1.POST("/trains", api.UpdateTrains)
  89. apiV1.POST("/lpplan/edit", api.UpdateLpplan)
  90. apiV1.POST("/lpplan/add", api.AddLpplan)
  91. apiV1.POST("/lpplandtl", api.GetLpplandtl)
  92. apiV1.POST("/lpplandtl/restore", api.RestoreLpplandtl)
  93. apiV1.POST("/lpplandtl/del", api.DelLpplandtl)
  94. apiV1.POST("/spillage/day", api.GetSpillageDay)
  95. apiV1.POST("/trains/day", api.UpdateTrainsDay)
  96. apiV1.POST("/lpplandtl/restore/day", api.RestoreLpplandtlDay)
  97. apiV1.POST("/lpplandtl/del/day", api.DelLpplandtlDay)
  98. apiV1.POST("/lpplandtl/add/day", api.AddLpplanDay)
  99. apiV1.POST("/lpplandtl/day", api.GetLpplandtlDay)
  100. apiV1.POST("/chart/feedEffMR", api.GetFeedEffMR)
  101. apiV1.POST("/chart/feedEffSL", api.GetFeedEffSL)
  102. apiV1.POST("/chart/feedEffHL", api.GetFeedEffHL)
  103. apiV1.POST("/chart/feedEffZH", api.GetFeedEffZH)
  104. apiV1.POST("/chart/feedEffCBFT", api.GetFeedEffCBFT)
  105. apiV1.POST("/chart/accuracyAllFT", api.GetAccuracyAllFT)
  106. apiV1.POST("/chart/accuracyAllJH", api.GetAccuracyAllJH)
  107. apiV1.POST("/chart/accuracyAllNQ", api.GetAccuracyAllNQ)
  108. apiV1.POST("/chart/accuracyAllCC", api.GetAccuracyAllCC)
  109. apiV1.POST("/chart/accuracyAllHL", api.GetAccuracyAllHL)
  110. apiV1.POST("/chart/accuracyAllLS", api.GetAccuracyAllLS)
  111. apiV1.POST("/chart/accuracyAllQX", api.GetAccuracyAllQX)
  112. apiV1.POST("/summary", api.GetSummary)
  113. apiV1.POST("/ftdetail/edit", api.UpdateFTdetail)
  114. apiV1.POST("/fpdetail/edit", api.UpdateFpdetailBar)
  115. apiV1.POST("/fpdetail/batch/edit", api.FpdBatchEdit)
  116. apiV1.POST("/ftdetai/del", api.DeleteFTdetail)
  117. apiV1.POST("/lpplandtl/add", api.AddLpplandtl)
  118. apiV1.POST("/lpplandtl/edit/sort", api.UpdateLpplandtlSort)
  119. apiV1.POST("/lpplandtl/date/add", api.AddLpplandtlDate)
  120. apiV1.POST("/lpplandtl/edit/date/sort", api.UpdateLpplandtlDateSort)
  121. apiV1.POST("/processAnalysist", api.GetProcessAnalysis)
  122. apiV1.POST("/feedp/undistribute", api.GetFeedpUndistributed)
  123. apiV1.POST("/feedtemplet/enable", api.UpdateFeedtempletStatus)
  124. apiV1.POST("/ftdry/add", api.AddFtdry)
  125. apiV1.POST("/checkDates", api.CheckDates)
  126. //编辑数据同步勾选状态
  127. apiV1.POST("/scheduled/status/edit", api.UpdateScheduledStatus)
  128. // 立即同步
  129. apiV1.POST("/synchronizeNow", api.SynchronizeNow)
  130. apiV1.POST("/fpdimportexcel", api.FpdImportExcel)
  131. apiV1.POST("/barfeedremain/excel", api.GetBarfeedremainExcel)
  132. //删除当前班次撒料时记录
  133. apiV1.POST("/spillageall/del", api.DeleteSpillageAll)
  134. apiV1.POST("/feedp/history", api.GetFeedpHistory)
  135. //查看撒料修改记录
  136. apiV1.POST("/spillageall/history", api.GetSpillageallHistory)
  137. //查看撒料设备
  138. apiV1.POST("/tmrListEnableTypeAll", api.GetTMRListEnableTypeAll)
  139. //查看提醒设置
  140. apiV1.POST("/remind/list", api.GetRemind)
  141. apiV1.POST("/remind/edit", api.UpdateRemind)
  142. //配方模板修改记录
  143. apiV1.POST("/recipetemplate/history", api.GetRecipeTemplateRecordHistory)
  144. //配方模板修改记录
  145. apiV1.POST("/feedtemplet/history", api.GetFeedtempletHistory)
  146. //app取料接口
  147. apiV1.POST("/downloadedplan", api.GetDownloadedplanMaterial1)
  148. apiV1.POST("/downloadedplan/list", api.GetDownloadedplanMaterialList)
  149. apiV1.POST("/subplan", api.GetSubPlan)
  150. apiV1.POST("/completeplan", api.CompletePlan)
  151. apiV1.POST("/realtimeweight", api.AddRealTimeWeight)
  152. //修改撒料计划tmr编号
  153. apiV1.POST("/materialtmr/edit", api.UpdateMaterialTMR)
  154. apiV1.POST("/materialtmr/date/edit", api.UpdateMaterialTMRDate)
  155. //集团端配方下发
  156. apiV1.POST("/formulaissued", api.AddFormulaIssued)
  157. //盘点单添加
  158. apiV1.POST("/biginventory", api.AddBigInventory)
  159. //sap原料上传
  160. apiV1.POST("/material/sap/upload", sap.MaterialOutbound)
  161. apiV1.POST("/downloadplandtl1/image/upload", api.UploadFile1)
  162. apiV1.POST("/syncSCJH", zc.SyncSCJH)
  163. //修改日执行计划
  164. apiV1.POST("/dailydata/edit", api.UpdateDailyData)
  165. apiV1.POST("/formulastatistics", api.GetFormulaStatistics)
  166. apiV1.POST("/sap/feed", sap.SyncSapFeed)
  167. apiV1.POST("/sap/bar", sap.SyncSapBar)
  168. apiV1.POST("/sap/material", sap.MaterialOutbound)
  169. apiV1.POST("/feedbackup/check", api.CheckFeedTrgaddress)
  170. apiV1.POST("/ud/feedp/sync", api.UdFeedpSync)
  171. apiV1.POST("/tmrequipment/del", api.DelTmrEquipment)
  172. apiV1.POST("/tmrequipment/edit", api.AddTmrEquipment)
  173. apiV1.GET("/tmrequipment", api.GetTmrEquipment)
  174. //光明ud手动上传
  175. apiV1.POST("/gm/udbar", api.UdBarSync)
  176. apiV1.POST("/gm/udfeed", api.UdFeedSync)
  177. apiV1.POST("/gm/udfeedtemplet/push", api.UdFeedtempletPush)
  178. apiV1.POST("/gm/udutir/push", api.UdUtirPush)
  179. apiV1.POST("/gm/udbarfeedremain/push", api.UdBarFeedRemainPush)
  180. apiV1.POST("/gm/udmaterialIssue/push", api.UdMaterialIssuePush)
  181. apiV1.POST("/feedtemplet/del", api.DelFeedTemplet)
  182. apiV1.POST("/plan/sort/edit", api.EditPlanSort)
  183. //日执行计划修改为完成
  184. apiV1.POST("/plan/artificial/edit", api.EditDownloadedplanArtificial)
  185. apiV1.GET("/equipment/muster", api.GetTmrEquipmentMuster)
  186. }
  187. //不需要登录验证的接口
  188. s.POST("/getopenid/:code", api.GetOpenID)
  189. apiV3 := s.Group("/thi") // restful 接口 tablename 是 表名字
  190. {
  191. apiV3.POST("/GetDataByName", api.GetDataByName)
  192. apiV3.POST("/PostDataByName", api.PostDataByName)
  193. apiV3.POST("/plandata", api.GetPlanData)
  194. apiV3.POST("/plandata/edit", api.PostPlanData)
  195. apiV3.POST("/plandata/batch/edit", api.PostPlanDatas)
  196. //推料接口
  197. apiV3.GET("/pusher/list", api.GetPusherList)
  198. apiV3.POST("/pusher/edit", api.EditPusherGPS)
  199. //羊圈通过RFID 需要传输的值:
  200. apiV3.GET("/plan/rfid", api.GetPlanRFID)
  201. }
  202. apiV4 := s.Group("/customreport") // restful 接口 tablename 是 表名字
  203. {
  204. apiV4.POST("/createchart", api.Createchart)
  205. apiV4.POST("/PostDataByName", api.PostDataByName)
  206. }
  207. }
  208. }