stock_api_controller.go 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. package mobile_api_controllers
  2. import (
  3. "XT_New/enums"
  4. "XT_New/service"
  5. "github.com/astaxie/beego"
  6. )
  7. type StockApiController struct {
  8. MobileBaseAPIAuthController
  9. }
  10. func (this *StockApiController) GetWarehouse() {
  11. adminInfo := this.GetMobileAdminUserInfo()
  12. types, _ := this.GetInt64("type_id", 0)
  13. var type_id int64
  14. switch types {
  15. case 1:
  16. type_id, _ = beego.AppConfig.Int64("niprocart")
  17. break
  18. case 2:
  19. type_id, _ = beego.AppConfig.Int64("jms")
  20. break
  21. case 3:
  22. type_id, _ = beego.AppConfig.Int64("fistula_needle_set")
  23. break
  24. case 4:
  25. type_id, _ = beego.AppConfig.Int64("fistula_needle_set_16")
  26. break
  27. case 5:
  28. type_id, _ = beego.AppConfig.Int64("hemoperfusion")
  29. break
  30. case 6:
  31. type_id, _ = beego.AppConfig.Int64("dialyser_sterilised")
  32. break
  33. case 7:
  34. type_id, _ = beego.AppConfig.Int64("filtryzer")
  35. break
  36. case 8:
  37. type_id, _ = beego.AppConfig.Int64("dialyzers")
  38. break
  39. case 9:
  40. type_id, _ = beego.AppConfig.Int64("injector")
  41. break
  42. case 10:
  43. type_id, _ = beego.AppConfig.Int64("bloodlines")
  44. break
  45. case 11:
  46. type_id, _ = beego.AppConfig.Int64("tubingHemodialysis")
  47. break
  48. case 12:
  49. type_id, _ = beego.AppConfig.Int64("package")
  50. break
  51. case 13:
  52. type_id, _ = beego.AppConfig.Int64("aliquid")
  53. break
  54. }
  55. info, err := service.FindWarehouseInfoByGoodType(type_id, adminInfo.Org.Id)
  56. if err != nil {
  57. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  58. return
  59. }
  60. this.ServeSuccessJSON(map[string]interface{}{
  61. "list": info,
  62. })
  63. }