package mobile_api_controllers

import (
	"XT_New/enums"
	"XT_New/service"
	"github.com/astaxie/beego"
)

type StockApiController struct {
	MobileBaseAPIAuthController
}

func (this *StockApiController) GetWarehouse() {
	adminInfo := this.GetMobileAdminUserInfo()
	types, _ := this.GetInt64("type_id", 0)
	var type_id int64
	switch types {
	case 1:
		type_id, _ = beego.AppConfig.Int64("niprocart")

		break
	case 2:
		type_id, _ = beego.AppConfig.Int64("jms")
		break
	case 3:
		type_id, _ = beego.AppConfig.Int64("fistula_needle_set")

		break
	case 4:
		type_id, _ = beego.AppConfig.Int64("fistula_needle_set_16")

		break
	case 5:
		type_id, _ = beego.AppConfig.Int64("hemoperfusion")

		break
	case 6:
		type_id, _ = beego.AppConfig.Int64("dialyser_sterilised")
		break
	case 7:
		type_id, _ = beego.AppConfig.Int64("filtryzer")
		break
	case 8:
		type_id, _ = beego.AppConfig.Int64("dialyzers")

		break
	case 9:
		type_id, _ = beego.AppConfig.Int64("injector")
		break
	case 10:
		type_id, _ = beego.AppConfig.Int64("bloodlines")
		break
	case 11:
		type_id, _ = beego.AppConfig.Int64("tubingHemodialysis")
		break
	case 12:
		type_id, _ = beego.AppConfig.Int64("package")
		break
	case 13:
		type_id, _ = beego.AppConfig.Int64("aliquid")
		break
	}

	info, err := service.FindWarehouseInfoByGoodType(type_id, adminInfo.Org.Id)
	if err != nil {
		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
		return
	}
	this.ServeSuccessJSON(map[string]interface{}{
		"list": info,
	})

}
