app_api.go 9.6 KB

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