| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116 |
- package equipment
- import (
- "encoding/json"
- "fmt"
- "strconv"
- "strings"
- "time"
- "dashoo.cn/backend/api/business/authcode"
- "dashoo.cn/backend/api/business/currboxcapacity"
- "dashoo.cn/backend/api/business/equipment"
- "dashoo.cn/backend/api/business/lastordernum"
- "dashoo.cn/backend/api/business/role"
- "dashoo.cn/backend/api/business/samplesinfo"
- "dashoo.cn/backend/api/business/shelfset"
- . "dashoo.cn/backend/api/controllers"
- "dashoo.cn/business2/permission"
- "dashoo.cn/utils"
- . "dashoo.cn/utils/db"
- )
- // 设备异常报警接口说明
- type EquipmentController struct {
- BaseController
- }
- type Equipments struct {
- CurrBoxCapacity []currboxcapacity.CurrBoxCapacity
- Equipment equipment.Equipment
- }
- type EquipmentInfo struct {
- Equipment equipment.EquipmentView
- SampleCount int
- ShelfCount int64
- BoxCount int64
- SensorData []SensorsShowData
- SensorCount int
- }
- type SensorsShowData struct {
- AuthCode string
- SensorNo string
- Temperature string
- Time time.Time
- }
- type EquipmentModel struct {
- Code string `json:"Code,omitempty"` // 设备编码
- Name string `json:"Name,omitempty"` // 设备名
- Brand string `json:"Brand,omitempty"` // 品牌
- ModelVersion string `json:"ModelVersion,omitempty"` // 型号
- ModelId int `json:"ModelId,omitempty"` // 型号ID
- RowNum int `json:"RowNum,omitempty"` // 名称
- ColumnNum int `json:"ColumnNum,omitempty"` // 接收日期
- Width string `json:"Width,omitempty"` // 可用容量
- Height string `json:"Height,omitempty"` // 单位(容量)
- Depth string `json:"Depth,omitempty"` // 有效日期
- TCode []string `json:"TCode,omitempty"` // 样本内码
- Shelf_X int `json:"shelf_x,omitempty"` // 样本来源
- Shelf_y int `json:"shelf_y,omitempty"` // 备注
- Box_X int `json:"box_x,omitempty"` // 样本来源
- Box_y int `json:"box_y,omitempty"` // 备注
- ValidityDate int64 `json:"ValidityDate,omitempty"` // 备注
- UseDate int64 `json:"UseDate,omitempty"` // 备注
- ProduceDate int64 `json:"ProduceDate,omitempty"` // 备注
- Checkedstr string `json:"checkedstr,omitempty"` // 样本类型
- Remark string `json:"Remark,omitempty"` // 位置信息
- DItem int `json:"DItem,omitempty"` // 设备类型19:贝尔Cryobiobank13K液氮罐;20:贝尔Cryobiobank13K_BloodBag液氮罐
- }
- // @Title 报警项目列表
- // @Description 报警项目列表
- // @Success 200 {object} business.device.DeviceChannels
- // @router /list [get]
- func (this *EquipmentController) List() {
- page := this.GetPageInfoForm()
- svc := equipment.GetEquipmentService(utils.DBE)
- svcPermission := permission.GetPermissionService(utils.DBE)
- eids := svcPermission.GetEquipmentIdById(utils.ToStr(this.User.Id))
- where := " a.AccCode = '" + this.User.AccCode + "'"
- if eids != "" {
- where = where + " and (a.CreateUserId= " + utils.ToStr(this.User.Id) + " or a.Id in (" + eids + "))"
- } else {
- where = where + "and a.CreateUserId= " + utils.ToStr(this.User.Id)
- }
- searchkey := this.GetString("searchkey")
- if searchkey != "" {
- where = where + " and (a.Code like '%" + searchkey + "%' or a.Name like '%" + searchkey + "%') "
- }
- total, list := svc.GetEquipmenViewtList(page.CurrentPage, page.Size, "a.Id desc", where)
- var equipmentsinfos []EquipmentInfo
- for i := 0; i < len(list); i++ {
- var equipmentsinfo EquipmentInfo
- equipmentsinfo.Equipment = list[i]
- //样本总数
- svcsample := samplesinfo.GetSamplesInfoService(utils.DBE)
- tblsample := this.User.AccCode + SamplesDetailtbName
- wheresample := " IState=1 and DeletionStateCode=0 and EquipmentId = " + utils.ToStr(list[i].Id)
- samplenum := svcsample.GetSampleOwnCount(tblsample, wheresample)
- equipmentsinfo.SampleCount = samplenum
- //冻存架总数
- whereshelf := " AccCode='" + this.User.AccCode + "' and EquipmentId = " + utils.ToStr(list[i].Id)
- svcshelf := shelfset.GetshelfsetService(utils.DBE)
- equipmentsinfo.ShelfCount = svcshelf.GetShelfCount(whereshelf)
- //冻存盒总数
- equipmentsinfo.BoxCount = svcshelf.GetBoxCount(whereshelf)
- //Sensor序列号
- var esentitylist []equipment.EquipmentSensors
- wheresensor := "where AccCode='" + this.User.AccCode + "' and EquipmentId=" + utils.ToStr(list[i].Id)
- esentitylist = svc.GetSensorsList(wheresensor)
- var sensorshowdatalist []SensorsShowData
- for j := 0; j < len(esentitylist); j++ {
- var sensorshowdata SensorsShowData
- sensorshowdata.AuthCode = esentitylist[j].AuthCode
- sensorshowdata.SensorNo = esentitylist[j].SensorNo
- sensorshowdatalist = append(sensorshowdatalist, sensorshowdata)
- }
- equipmentsinfo.SensorCount = len(esentitylist)
- equipmentsinfo.SensorData = sensorshowdatalist
- equipmentsinfos = append(equipmentsinfos, equipmentsinfo)
- }
- var datainfo DataInfo
- datainfo.Items = equipmentsinfos
- datainfo.CurrentItemCount = total
- this.Data["json"] = &datainfo
- this.ServeJSON()
- }
- // @Title 容器列表
- // @Description 容器列表所有容器数据
- // @Success 200 {object} business.device.DeviceChannels
- // @router /equipalllist [get]
- func (this *EquipmentController) EquipAllList() {
- svc := equipment.GetEquipmentService(utils.DBE)
- svcrole := role.GetRoleService(utils.DBE)
- roleids := svcrole.GetRoleidsByuid(utils.ToStr(this.User.Id))
- where := " a.AccCode = '" + this.User.AccCode + "'"
- where = where + " and (a.CreateUserId=" + utils.ToStr(this.User.Id) + " or a.Id in (select EquipmentId Id FROM Base_RoleEquipment where RoleId in (" + strings.Join(roleids, ",") + ")))"
- Name := this.GetString("Name")
- if Name != "" {
- where = where + " and Name like '%" + Name + "%' "
- }
- total, list := svc.GetEquipmenViewtList(0, 0, "a.Id desc", where)
- var datainfo DataInfo
- datainfo.Items = list
- datainfo.CurrentItemCount = total
- this.Data["json"] = &datainfo
- this.ServeJSON()
- }
- // @Title 名字id列表
- // @Description 获取设备的名字与id列表
- // @Success 200 {object} business.device.DeviceChannels
- // @router /elist [get]
- func (this *EquipmentController) NameIdList() {
- svc := equipment.GetEquipmentService(utils.DBE)
- svcPermission := permission.GetPermissionService(utils.DBE)
- eids := svcPermission.GetEquipmentIdById(utils.ToStr(this.User.Id))
- where := " a.AccCode = '" + this.User.AccCode + "'"
- if eids != "" {
- where = where + " and (a.CreateUserId= " + utils.ToStr(this.User.Id) + " or a.Id in (" + eids + "))"
- } else {
- where = where + "and a.CreateUserId= " + utils.ToStr(this.User.Id)
- }
- var list []string
- _, entities := svc.GetEquipmenViewtList(0, 0, "a.Id desc", where)
- for i := 0; i < len(entities); i++ {
- list = append(list, entities[i].Name)
- list = append(list, utils.ToStr(entities[i].Id))
- }
- var datainfo DataInfo
- datainfo.Items = list
- this.Data["json"] = &datainfo
- this.ServeJSON()
- }
- // @Title 获取品牌数据
- // @Description 获取品牌数据
- // @Success 200 {object} business.device.DeviceChannels
- // @router /brands [get]
- func (this *EquipmentController) GetBrands() {
- svc := equipment.GetEquipmentService(utils.DBE)
- // 获得所有的品牌
- brands := svc.GetAllBrands(this.User.AccCode)
- var datainfo DataInfo
- datainfo.Items = brands
- this.Data["json"] = &datainfo
- this.ServeJSON()
- }
- // @Title 根据品牌取型号
- // @Description 设备列表
- // @Success 200 {object} business.device.DeviceChannels
- // @router /dmodels/:brand [get]
- func (this *EquipmentController) Dmodels() {
- brand := this.Ctx.Input.Param(":brand")
- svc := equipment.GetEquipmentService(utils.DBE)
- // 获得所有的品牌
- dmodels := svc.GetModelsByBrand(brand, this.User.AccCode)
- var datainfo DataInfo
- datainfo.Items = dmodels
- this.Data["json"] = &datainfo
- this.ServeJSON()
- }
- // @Title 报警器列表
- // @Description 设备列表
- // @Success 200 {object} business.device.DeviceChannels
- // @router /photo/:id [get]
- func (this *EquipmentController) GetPhoto() {
- id := this.Ctx.Input.Param(":id")
- svc := equipment.GetEquipmentService(utils.DBE)
- // 获得对应型号的照片数据
- var entity equipment.EquipMentModel
- where := "DModel='" + id + "'"
- svc.GetEntity(&entity, where)
- var datainfo DataInfo
- realArr := [2]string{entity.Photo, entity.SpareData}
- datainfo.Items = realArr
- this.Data["json"] = &datainfo
- this.ServeJSON()
- }
- // @Title 根据型号获取设备信息
- // @Description 根据型号获取设备信息
- // @Success 200 {object} business.device.DeviceChannels
- // @router /getbydmodel/:dmodel [get]
- func (this *EquipmentController) GetBydModel() {
- dmodel := this.Ctx.Input.Param(":dmodel")
- svc := equipment.GetEquipmentService(utils.DBE)
- var entity equipment.EquipMentModel
- where := "Id='" + dmodel + "'"
- svc.GetEntity(&entity, where)
- this.Data["json"] = &entity
- this.ServeJSON()
- }
- // @Title 根据Id获取设备信息
- // @Description 根据型号获取设备信息
- // @Success 200 {object} business.device.DeviceChannels
- // @router /getmodel/:id [get]
- func (this *EquipmentController) GetModel() {
- id := this.Ctx.Input.Param(":id")
- svc := equipment.GetEquipmentService(utils.DBE)
- entity := svc.GetEquipmentViewById(id)
- this.Data["json"] = &entity
- this.ServeJSON()
- }
- // @Title 根据ID判断是否有冻存架使用
- // @Description 根据ID判断是否有冻存架使用
- // @Success 200 {object} business.device.DeviceChannels
- // @router /getisusedbyshelf/:id [get]
- func (this *EquipmentController) GetisUsedByShelf() {
- id := this.Ctx.Input.Param(":id")
- var shelf shelfset.Shelf
- svcshelf := shelfset.GetshelfsetService(utils.DBE)
- has := svcshelf.GetShelfByEquipment(id, &shelf)
- var errinfo ErrorInfo
- if has {
- errinfo.Code = 0
- errinfo.Message = "有冻存架"
- } else {
- errinfo.Code = -1
- errinfo.Message = "无冻存架"
- }
- this.Data["json"] = &errinfo
- this.ServeJSON()
- }
- // @Title 创建报警项目
- // @Description 创建报警项目
- // @Param body body business.device.DeviceChannels "报警项目信息"
- // @Success 200 {object} controllers.Request
- // @router /editequip/:id [put]
- func (this *EquipmentController) EditEquipment() {
- id := this.Ctx.Input.Param(":id")
- // 获得前端传输的model
- var model EquipmentModel
- var jsonblob = this.Ctx.Input.RequestBody
- json.Unmarshal(jsonblob, &model)
- //赋值
- var equip equipment.Equipment
- equip.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
- equip.ModifiedBy = this.User.Realname
- equip.Remark = model.Remark
- equip.Code = model.Code
- equip.ModelId = model.ModelId
- equip.Name = model.Name
- equip.Brand = model.Brand
- equip.ModelVersion = model.ModelVersion
- equip.Item = 1 // 立式 取消了这项选择
- equip.RowNum = model.RowNum
- equip.ColumnNum = model.ColumnNum
- equip.Width, _ = utils.StrTo(model.Width).Float32()
- equip.Height, _ = utils.StrTo(model.Height).Float32()
- equip.Depth, _ = utils.StrTo(model.Depth).Float32()
- equip.SampleType = model.Checkedstr
- equip.ProduceDate = time.Unix(model.ProduceDate/1000, 0)
- equip.UseDate = time.Unix(model.UseDate/1000, 0)
- equip.ValidityDate = time.Unix(model.ValidityDate/1000, 0)
- // 初始化服务
- var errinfo ErrorInfo
- var equipempty equipment.Equipment
- svc := equipment.GetEquipmentService(utils.DBE)
- // 处理数据, 保存设备
- var cols []string = []string{"ModelId", "ModifiedUserId", "ModifiedBy", "Remark", "Code", "Name", "Brand", "ModelVersion", "Item", "RowNum", "ColumnNum", "Width", "Height", "Depth", "SampleType", "ProduceDate", "UseDate", "ValidityDate"}
- opdesc := "修改设备-" + equip.Name
- err := svc.UpdateEntityAndWriteLog(id, &equip, &equipempty, cols, utils.ToStr(this.User.Id), this.User.Username, opdesc, this.User.AccCode, "设备管理")
- //删除Sensors
- wheresensor := " where AccCode='" + this.User.AccCode + "' and EquipmentId=" + id
- svc.DeleteSensors(wheresensor)
- //添加Sensors
- //添加Sensors
- if len(model.TCode) > 0 {
- sensorsinfoarr := model.TCode
- for i := 0; i < len(sensorsinfoarr); i++ {
- // sensordata := strings.Split(sensorsinfoarr[i], ";")
- var esentity equipment.EquipmentSensors
- esentity.AccCode = this.User.AccCode
- esentity.EquipmentId, _ = utils.StrTo(id).Int()
- // 授权码暂时取消
- // esentity.AuthCode = sensordata[0]
- esentity.SensorNo = sensorsinfoarr[i]
- esentity.CreateBy = this.User.Realname
- esentity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
- _, _ = svc.InsertEntity(&esentity)
- }
- }
- // 错误检测
- if err != nil {
- errinfo.Message = "编辑设备失败!"
- errinfo.Code = -1
- this.Data["json"] = &errinfo
- this.ServeJSON()
- return
- } else {
- errinfo.Message = "编辑设备成功!"
- errinfo.Code = 0
- this.Data["json"] = &errinfo
- this.ServeJSON()
- return
- }
- }
- // @Title 复制所选设备
- // @Description 复制所选设备
- // @Param body body business.device.DeviceChannels "报警项目信息"
- // @Success 200 {object} controllers.Request
- // @router /copyequip/:id [put]
- func (this *EquipmentController) CopyEquipment() {
- id := this.Ctx.Input.Param(":id")
- var entity equipment.Equipment
- svc := equipment.GetEquipmentService(utils.DBE)
- svc.GetEntityById(id, &entity)
- entity.Id = 0
- entity.Name = entity.Name + utils.ToStr(time.Now())[7:19]
- entity.Code = entity.Code + utils.ToStr(time.Now())[7:19]
- entity.HCode = ""
- entity.ModifiedUserId = 0
- entity.ModifiedBy = ""
- entity.CreateBy = this.User.Realname
- entity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
- _, err := svc.InsertEntity(&entity)
- new_id := entity.Id
- var shelf_list []shelfset.Shelf
- where := "EquipmentId=" + id
- svc.GetEntities(&shelf_list, where)
- svcshelf := shelfset.GetshelfsetService(utils.DBE)
- lastdata := svcshelf.GetLastShelfNum(this.User.AccCode)
- num_lastdata, _ := utils.StrTo(lastdata[1:]).Int64()
- for i := 0; i < len(shelf_list); i++ {
- old_shelf_id := shelf_list[i].Id
- shelf_list[i].Id = 0
- shelf_list[i].Code = "F" + utils.ToStr(num_lastdata)
- shelf_list[i].BarCode = "F" + utils.ToStr(num_lastdata)
- shelf_list[i].EquipmentId = new_id
- shelf_list[i].ModifiedBy = ""
- shelf_list[i].ModifiedUserId = 0
- shelf_list[i].CreateBy = this.User.Realname
- shelf_list[i].CreateUserId, _ = utils.StrTo(this.User.Id).Int()
- num_lastdata = num_lastdata + 1
- _, err = svc.InsertEntity(&shelf_list[i])
- new_shelf_id := shelf_list[i].Id
- var box_list []shelfset.Box
- where1 := "EquipmentId=" + id + " and ShelfId=" + utils.ToStr(old_shelf_id)
- svc.GetEntities(&box_list, where1)
- lastdata_box := svcshelf.GetLastBoxNum(this.User.AccCode)
- num_lastdata_box, _ := utils.StrTo(lastdata_box[1:]).Int64()
- for j := 0; j < len(box_list); j++ {
- box_list[j].Id = 0
- box_list[j].Code = "B" + utils.ToStr(num_lastdata_box)
- box_list[j].BarCode = "B" + utils.ToStr(num_lastdata_box)
- box_list[j].EquipmentId = new_id
- box_list[j].ShelfId = new_shelf_id
- box_list[j].ModifiedBy = ""
- box_list[j].ModifiedUserId = 0
- box_list[j].CreateBy = this.User.Realname
- box_list[j].CreateUserId, _ = utils.StrTo(this.User.Id).Int()
- num_lastdata_box = num_lastdata_box + 1
- _, err = svc.InsertEntity(&box_list[j])
- }
- num_lastdata_box = num_lastdata_box - 1
- var lastnum lastordernum.LastOrderNum
- lastnum.LastNum = "B" + utils.ToStr(num_lastdata_box)
- svcshelf.UpdateBoxNum(lastnum, this.User.AccCode)
- var currboxcapacitys currboxcapacity.CurrBoxCapacity
- svc.GetEntity(&currboxcapacitys, where1)
- currboxcapacitys.Id = 0
- currboxcapacitys.EquipmentId = new_id
- currboxcapacitys.ShelfId = new_shelf_id
- _, err = svc.InsertEntity(&currboxcapacitys)
- }
- num_lastdata = num_lastdata - 1
- var lastnum_shelf lastordernum.LastOrderNum
- lastnum_shelf.LastNum = "F" + utils.ToStr(num_lastdata)
- svcshelf.UpdateShelfNum(lastnum_shelf, this.User.AccCode)
- var errinfo ErrorInfo
- // 错误检测
- if err != nil {
- errinfo.Message = "复制设备失败!"
- errinfo.Code = -1
- this.Data["json"] = &errinfo
- this.ServeJSON()
- return
- } else {
- errinfo.Message = "复制设备成功!"
- errinfo.Code = 0
- this.Data["json"] = &errinfo
- this.ServeJSON()
- return
- }
- }
- // @Title 创建容器设备数据
- // @Description 创建容器设备数据
- // @Param body body business.device.DeviceChannels "报警项目信息"
- // @Success 200 {object} controllers.Request
- // @router / [post]
- func (this *EquipmentController) AddEquipment() {
- // 获得前端传输的model
- var model EquipmentModel
- var jsonblob = this.Ctx.Input.RequestBody
- json.Unmarshal(jsonblob, &model)
- //赋值
- var equip equipment.Equipment
- equip.AccCode = this.User.AccCode
- equip.Code = model.Code
- equip.ModelId = model.ModelId
- equip.Name = model.Name
- equip.Brand = model.Brand
- equip.ModelVersion = model.ModelVersion
- equip.Item = 1 // 立式 取消了这项选择
- equip.RowNum = model.RowNum
- equip.ColumnNum = model.ColumnNum
- equip.Width, _ = utils.StrTo(model.Width).Float32()
- equip.Height, _ = utils.StrTo(model.Height).Float32()
- equip.Depth, _ = utils.StrTo(model.Depth).Float32()
- equip.SampleType = model.Checkedstr
- equip.State = 1 //默认启用
- equip.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
- equip.CreateBy = this.User.Realname
- equip.Remark = model.Remark
- equip.ProduceDate = time.Unix(model.ProduceDate/1000, 0)
- equip.UseDate = time.Unix(model.UseDate/1000, 0)
- equip.ValidityDate = time.Unix(model.ValidityDate/1000, 0)
- //添加设备
- svc := equipment.GetEquipmentService(utils.DBE)
- _, err := svc.InsertEntity(&equip)
- var errinfo ErrorInfo
- if err != nil {
- errinfo.Message = "添加设备失败!" + err.Error()
- errinfo.Code = -2
- this.Data["json"] = &errinfo
- this.ServeJSON()
- return
- }
- //同步添加冻存架
- // 19:贝尔Cryobiobank13K液氮罐;20:贝尔Cryobiobank13K_BloodBag液氮罐
- if model.DItem == 19 {
- shelf_x_int := 1
- shelf_y_int := 1
- box_x_int := 1
- box_y_int := 1
- svcshelf := shelfset.GetshelfsetService(utils.DBE)
- lastdata := svcshelf.GetLastShelfNum(this.User.AccCode)
- num_lastdata, _ := utils.StrTo(lastdata[1:]).Int64()
- lastdata_box := svcshelf.GetLastBoxNum(this.User.AccCode)
- num_lastdata_box, _ := utils.StrTo(lastdata_box[1:]).Int64()
- for i := 1; i <= equip.RowNum; i++ {
- for j := 1; j <= equip.ColumnNum; j++ {
- if j == 4 { //第4个为小型格4行5x5冻存盒
- shelf_x_int = 1
- shelf_y_int = 10
- box_x_int = 5
- box_y_int = 5
- } else { //其他为大型格12行10x10冻存盒
- shelf_x_int = 1
- shelf_y_int = 10
- box_x_int = 10
- box_y_int = 10
- }
- var shelfempty shelfset.Shelf
- shelfempty.AccCode = this.User.AccCode
- shelfempty.EquipmentId = equip.Id
- shelfempty.Code = "F" + utils.ToStr(num_lastdata)
- shelfempty.BarCode = "F" + utils.ToStr(num_lastdata)
- shelfempty.RowNum = shelf_x_int
- shelfempty.ColumnNum = shelf_y_int
- shelfempty.XStation = j
- shelfempty.YStation = i
- shelfempty.SampleType = equip.SampleType
- shelfempty.CreateBy = this.User.Realname
- shelfempty.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
- num_lastdata = num_lastdata + 1
- _, err = svcshelf.InsertEntity(&shelfempty)
- sqlfield := " AccCode,EquipmentId,ShelfId,XStation,YStation,RowNum,ColumnNum,"
- sqlvalue := "'" + this.User.AccCode + "'," + utils.ToStr(equip.Id) + "," + utils.ToStr(shelfempty.Id) + "," + utils.ToStr(j) + "," + utils.ToStr(i) + "," + utils.ToStr(shelf_x_int) + "," + utils.ToStr(shelf_y_int) + ","
- ii, jj := shelf_x_int, shelf_y_int
- //添加冻存盒
- if box_x_int > 0 && box_y_int > 0 {
- for e := 0; e < ii; e++ {
- charname := Boxlinename(e + 1)
- for f := 0; f < jj; f++ {
- fieldname := fmt.Sprintf("%v%v", charname, f+1)
- if f == jj-1 && e == ii-1 {
- sqlfield += fieldname
- sqlvalue += "-1"
- } else {
- sqlfield += fieldname + ","
- sqlvalue += "-1,"
- }
- }
- }
- for a := 1; a <= shelf_x_int; a++ {
- for b := 1; b <= shelf_y_int; b++ {
- var boxempty shelfset.Box
- boxempty.AccCode = this.User.AccCode
- boxempty.EquipmentId = equip.Id
- boxempty.ShelfId = shelfempty.Id
- boxempty.Code = "B" + utils.ToStr(num_lastdata_box)
- boxempty.BarCode = "B" + utils.ToStr(num_lastdata_box)
- boxempty.YStation = a
- boxempty.XStation = b
- boxempty.RowNum = box_x_int
- boxempty.ColumnNum = box_y_int
- boxempty.SampleType = equip.SampleType
- boxempty.CreateBy = this.User.Realname
- boxempty.CreateBy = this.User.Realname
- num_lastdata_box = num_lastdata_box + 1
- _, err = svc.InsertEntity(&boxempty)
- }
- }
- } else {
- for e := 0; e < ii; e++ {
- charname := Boxlinename(e + 1)
- for f := 0; f < jj; f++ {
- fieldname := fmt.Sprintf("%v%v", charname, f+1)
- if f == jj-1 && e == ii-1 {
- sqlfield += fieldname
- sqlvalue += "-2"
- } else {
- sqlfield += fieldname + ","
- sqlvalue += "-2,"
- }
- }
- }
- }
- svc1 := currboxcapacity.GetCurrboxcapacityService(utils.DBE)
- svc1.Add(sqlfield, sqlvalue)
- }
- }
- num_lastdata_box = num_lastdata_box - 1
- var lastnum lastordernum.LastOrderNum
- lastnum.LastNum = "B" + utils.ToStr(num_lastdata_box)
- svcshelf.UpdateBoxNum(lastnum, this.User.AccCode)
- num_lastdata = num_lastdata - 1
- var lastnum_shelf lastordernum.LastOrderNum
- lastnum_shelf.LastNum = "F" + utils.ToStr(num_lastdata)
- svcshelf.UpdateShelfNum(lastnum_shelf, this.User.AccCode)
- } else if model.DItem == 20 {
- shelf_x_int := 1
- shelf_y_int := 6
- box_x_int := 1
- box_y_int := 1
- svcshelf := shelfset.GetshelfsetService(utils.DBE)
- lastdata := svcshelf.GetLastShelfNum(this.User.AccCode)
- num_lastdata, _ := utils.StrTo(lastdata[1:]).Int64()
- lastdata_box := svcshelf.GetLastBoxNum(this.User.AccCode)
- num_lastdata_box, _ := utils.StrTo(lastdata_box[1:]).Int64()
- for i := 1; i <= equip.RowNum; i++ {
- for j := 1; j <= equip.ColumnNum; j++ {
- var shelfempty shelfset.Shelf
- shelfempty.AccCode = this.User.AccCode
- shelfempty.EquipmentId = equip.Id
- shelfempty.Code = "F" + utils.ToStr(num_lastdata)
- shelfempty.BarCode = "F" + utils.ToStr(num_lastdata)
- shelfempty.RowNum = shelf_x_int
- shelfempty.ColumnNum = shelf_y_int
- shelfempty.XStation = j
- shelfempty.YStation = i
- shelfempty.SampleType = equip.SampleType
- shelfempty.CreateBy = this.User.Realname
- shelfempty.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
- num_lastdata = num_lastdata + 1
- _, err = svcshelf.InsertEntity(&shelfempty)
- sqlfield := " AccCode,EquipmentId,ShelfId,XStation,YStation,RowNum,ColumnNum,"
- sqlvalue := "'" + this.User.AccCode + "'," + utils.ToStr(equip.Id) + "," + utils.ToStr(shelfempty.Id) + "," + utils.ToStr(j) + "," + utils.ToStr(i) + "," + utils.ToStr(shelf_x_int) + "," + utils.ToStr(shelf_y_int) + ","
- ii, jj := shelf_x_int, shelf_y_int
- //添加冻存盒
- if box_x_int > 0 && box_y_int > 0 {
- for e := 0; e < ii; e++ {
- charname := Boxlinename(e + 1)
- for f := 0; f < jj; f++ {
- fieldname := fmt.Sprintf("%v%v", charname, f+1)
- if f == jj-1 && e == ii-1 {
- sqlfield += fieldname
- sqlvalue += "-1"
- } else {
- sqlfield += fieldname + ","
- sqlvalue += "-1,"
- }
- }
- }
- for a := 1; a <= shelf_x_int; a++ {
- for b := 1; b <= shelf_y_int; b++ {
- var boxempty shelfset.Box
- boxempty.AccCode = this.User.AccCode
- boxempty.EquipmentId = equip.Id
- boxempty.ShelfId = shelfempty.Id
- boxempty.Code = "B" + utils.ToStr(num_lastdata_box)
- boxempty.BarCode = "B" + utils.ToStr(num_lastdata_box)
- boxempty.YStation = a
- boxempty.XStation = b
- boxempty.RowNum = box_x_int
- boxempty.ColumnNum = box_y_int
- boxempty.SampleType = equip.SampleType
- boxempty.CreateBy = this.User.Realname
- boxempty.CreateBy = this.User.Realname
- num_lastdata_box = num_lastdata_box + 1
- _, err = svc.InsertEntity(&boxempty)
- }
- }
- } else {
- for e := 0; e < ii; e++ {
- charname := Boxlinename(e + 1)
- for f := 0; f < jj; f++ {
- fieldname := fmt.Sprintf("%v%v", charname, f+1)
- if f == jj-1 && e == ii-1 {
- sqlfield += fieldname
- sqlvalue += "-2"
- } else {
- sqlfield += fieldname + ","
- sqlvalue += "-2,"
- }
- }
- }
- }
- svc1 := currboxcapacity.GetCurrboxcapacityService(utils.DBE)
- svc1.Add(sqlfield, sqlvalue)
- }
- }
- num_lastdata_box = num_lastdata_box - 1
- var lastnum lastordernum.LastOrderNum
- lastnum.LastNum = "B" + utils.ToStr(num_lastdata_box)
- svcshelf.UpdateBoxNum(lastnum, this.User.AccCode)
- num_lastdata = num_lastdata - 1
- var lastnum_shelf lastordernum.LastOrderNum
- lastnum_shelf.LastNum = "F" + utils.ToStr(num_lastdata)
- svcshelf.UpdateShelfNum(lastnum_shelf, this.User.AccCode)
- } else {
- if model.Shelf_X > 0 && model.Shelf_y > 0 {
- shelf_x_int := model.Shelf_X
- shelf_y_int := model.Shelf_y
- box_x_int := model.Box_X
- box_y_int := model.Box_y
- svcshelf := shelfset.GetshelfsetService(utils.DBE)
- lastdata := svcshelf.GetLastShelfNum(this.User.AccCode)
- num_lastdata, _ := utils.StrTo(lastdata[1:]).Int64()
- lastdata_box := svcshelf.GetLastBoxNum(this.User.AccCode)
- num_lastdata_box, _ := utils.StrTo(lastdata_box[1:]).Int64()
- for i := 1; i <= equip.RowNum; i++ {
- for j := 1; j <= equip.ColumnNum; j++ {
- var shelfempty shelfset.Shelf
- shelfempty.AccCode = this.User.AccCode
- shelfempty.EquipmentId = equip.Id
- shelfempty.Code = "F" + utils.ToStr(num_lastdata)
- shelfempty.BarCode = "F" + utils.ToStr(num_lastdata)
- shelfempty.RowNum = shelf_x_int
- shelfempty.ColumnNum = shelf_y_int
- shelfempty.XStation = j
- shelfempty.YStation = i
- shelfempty.SampleType = equip.SampleType
- shelfempty.CreateBy = this.User.Realname
- shelfempty.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
- num_lastdata = num_lastdata + 1
- _, err = svcshelf.InsertEntity(&shelfempty)
- sqlfield := " AccCode,EquipmentId,ShelfId,XStation,YStation,RowNum,ColumnNum,"
- sqlvalue := "'" + this.User.AccCode + "'," + utils.ToStr(equip.Id) + "," + utils.ToStr(shelfempty.Id) + "," + utils.ToStr(j) + "," + utils.ToStr(i) + "," + utils.ToStr(shelf_x_int) + "," + utils.ToStr(shelf_y_int) + ","
- ii, jj := shelf_x_int, shelf_y_int
- //添加冻存盒
- if box_x_int > 0 && box_y_int > 0 {
- for e := 0; e < ii; e++ {
- charname := Boxlinename(e + 1)
- for f := 0; f < jj; f++ {
- fieldname := fmt.Sprintf("%v%v", charname, f+1)
- if f == jj-1 && e == ii-1 {
- sqlfield += fieldname
- sqlvalue += "-1"
- } else {
- sqlfield += fieldname + ","
- sqlvalue += "-1,"
- }
- }
- }
- for a := 1; a <= shelf_x_int; a++ {
- for b := 1; b <= shelf_y_int; b++ {
- var boxempty shelfset.Box
- boxempty.AccCode = this.User.AccCode
- boxempty.EquipmentId = equip.Id
- boxempty.ShelfId = shelfempty.Id
- boxempty.Code = "B" + utils.ToStr(num_lastdata_box)
- boxempty.BarCode = "B" + utils.ToStr(num_lastdata_box)
- boxempty.YStation = a
- boxempty.XStation = b
- boxempty.RowNum = box_x_int
- boxempty.ColumnNum = box_y_int
- boxempty.SampleType = equip.SampleType
- boxempty.CreateBy = this.User.Realname
- boxempty.CreateBy = this.User.Realname
- num_lastdata_box = num_lastdata_box + 1
- _, err = svc.InsertEntity(&boxempty)
- }
- }
- } else {
- for e := 0; e < ii; e++ {
- charname := Boxlinename(e + 1)
- for f := 0; f < jj; f++ {
- fieldname := fmt.Sprintf("%v%v", charname, f+1)
- if f == jj-1 && e == ii-1 {
- sqlfield += fieldname
- sqlvalue += "-2"
- } else {
- sqlfield += fieldname + ","
- sqlvalue += "-2,"
- }
- }
- }
- }
- svc1 := currboxcapacity.GetCurrboxcapacityService(utils.DBE)
- svc1.Add(sqlfield, sqlvalue)
- }
- }
- num_lastdata_box = num_lastdata_box - 1
- var lastnum lastordernum.LastOrderNum
- lastnum.LastNum = "B" + utils.ToStr(num_lastdata_box)
- svcshelf.UpdateBoxNum(lastnum, this.User.AccCode)
- num_lastdata = num_lastdata - 1
- var lastnum_shelf lastordernum.LastOrderNum
- lastnum_shelf.LastNum = "F" + utils.ToStr(num_lastdata)
- svcshelf.UpdateShelfNum(lastnum_shelf, this.User.AccCode)
- }
- }
- //添加Sensors
- if len(model.TCode) > 0 {
- sensorsinfoarr := model.TCode
- for i := 0; i < len(sensorsinfoarr); i++ {
- // sensordata := strings.Split(sensorsinfoarr[i], ";")
- var esentity equipment.EquipmentSensors
- esentity.AccCode = this.User.AccCode
- esentity.EquipmentId = equip.Id
- // 授权码暂时取消
- // esentity.AuthCode = sensordata[0]
- esentity.SensorNo = sensorsinfoarr[i]
- esentity.CreateBy = this.User.Realname
- esentity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
- _, _ = svc.InsertEntity(&esentity)
- }
- }
- errinfo.Message = "添加设备成功!"
- errinfo.Code = 0
- this.Data["json"] = &errinfo
- this.ServeJSON()
- }
- // @Title 删除容器设备
- // @Description 删除容器设备
- // @Param code path string true "需要删除的传感器编号"
- // @Success 200 {object} ErrorInfo
- // @Failure 403 :id 为空
- // @router delequip/:id [delete]
- func (this *EquipmentController) EquipmentDelete() {
- id := this.Ctx.Input.Param(":id")
- name := this.GetString("name")
- var entity equipment.Equipment
- var entityempty equipment.Equipment
- svc := equipment.GetEquipmentService(utils.DBE)
- opdesc := "删除设备-" + name
- err := svc.DeleteEntityAndWriteLog(id, &entity, &entityempty, utils.ToStr(this.User.Id), this.User.Username, opdesc, this.User.AccCode, "设备管理")
- //删除样本
- svc1 := shelfset.GetshelfsetService(utils.DBE)
- where_shelf := "EquipmentId =" + id
- var shelfempty shelfset.Shelf
- svc1.DeleteEntity(&shelfempty, where_shelf)
- var currboxcapacitys currboxcapacity.CurrBoxCapacity
- svc1.DeleteEntity(&currboxcapacitys, where_shelf)
- var boxempty shelfset.Box
- svc1.DeleteEntity(&boxempty, where_shelf)
- //删除Sensors
- wheresensor := "where AccCode='" + this.User.AccCode + "' and EquipmentId=" + id
- svc.DeleteSensors(wheresensor)
- var errinfo ErrorInfo
- // 错误检测
- if err != nil {
- errinfo.Message = "删除设备失败!"
- errinfo.Code = -1
- this.Data["json"] = &errinfo
- this.ServeJSON()
- return
- } else {
- errinfo.Message = "删除设备成功!"
- errinfo.Code = 0
- this.Data["json"] = &errinfo
- this.ServeJSON()
- }
- }
- // @Title 更新所有冻存盒颜色值
- // @Description 更新所有冻存盒颜色值
- // @Param code path string true "需要删除的传感器编号"
- // @Success 200 {object} ErrorInfo
- // @Failure 403 :id 为空
- // @router /refresh [put]
- func (this *EquipmentController) RefreshCapacity() {
- s := currboxcapacity.GetCurrboxcapacityService(utils.DBE)
- var acccodes []Id_Str //账户AccCode列表
- curracccode := this.User.AccCode
- if curracccode == "" {
- sqltables := "select distinct AccCode Id from Equipment "
- s.DBE.Sql(sqltables).Find(&acccodes)
- } else { //账户内部刷新
- acccodes = append(acccodes, Id_Str{curracccode})
- }
- var tablename string //表名
- var boxdata []samplesinfo.SampleBoxCount
- for _, v := range acccodes {
- tablename = string(v.Id) + "SamplesDetail" //样本表名
- var fieldname, updatesql string
- whereshelf := " where AccCode = '" + v.Id + "'"
- var shelflist []shelfset.Shelf
- shelflist = s.GetShelfList(whereshelf) //获取冻存架列表
- for si := 0; si < len(shelflist); si++ { //循环遍历冻存架,去样本库中查找样本
- fieldStr := " UpdateTime= now() "
- updateStr := " UpdateTime= now() "
- //先将所有的状态置成-1//////////////////////////开始/////////////////////////////////
- var boxlist []shelfset.Box
- boxlist = s.GetBoxByShelfId(utils.ToStr(shelflist[si].Id))
- boxlistcount := len(boxlist)
- for bi := 0; bi < boxlistcount; bi++ {
- updatename := Boxlinename(boxlist[bi].YStation) + utils.ToStr(boxlist[bi].XStation)
- updateStr = updateStr + ","
- updateStr = updateStr + updatename + "= -1"
- }
- if updateStr != "" {
- updatesql = " update CurrBoxCapacity set " + updateStr + " where ShelfId = " + utils.ToStr(shelflist[si].Id)
- fmt.Println(updatesql)
- _, err := s.DBE.Exec(updatesql)
- LogError(err)
- }
- //先将所有的状态置成-1//////////////////////////结束/////////////////////////////////
- //更改冻存盒的实际状态////////////////////开始//////////////////////////////////////
- boxwhere := " where IState=1 and DeletionStateCode = 0 and ShelfId =" + utils.ToStr(shelflist[si].Id) + ""
- svc := samplesinfo.GetSamplesInfoService(utils.DBE)
- boxdata = svc.QuerySampleBoxDataList(tablename, boxwhere) //一个冻存盒Id是一条数据
- if len(boxdata) > 0 {
- for i := 0; i < len(boxdata); i++ {
- box := new(shelfset.Box)
- s.GetBoxById(utils.ToStr(boxdata[i].BoxId), box)
- if box.Id == 0 { //如果找不到冻存盒
- continue
- } else {
- fieldStr = fieldStr + ","
- boxdata[i].AllCount = int(box.RowNum * box.ColumnNum)
- crate := float64(boxdata[i].CurrCount) / float64(boxdata[i].AllCount) * 100
- c_str := strconv.FormatFloat(crate, 'f', 2, 64)
- c_f64, _ := strconv.ParseFloat(c_str, 64)
- boxdata[i].CurrRate = c_f64
- fieldname = Boxlinename(box.YStation) + utils.ToStr(box.XStation)
- }
- fieldStr = fieldStr + fieldname + "=" + utils.ToStr(boxdata[i].CurrRate)
- }
- if fieldStr != "" {
- updatesql = " update CurrBoxCapacity set " + fieldStr + " where ShelfId = " + utils.ToStr(shelflist[si].Id)
- fmt.Println(updatesql)
- _, err := s.DBE.Exec(updatesql)
- LogError(err)
- }
- }
- //更改冻存盒的实际状态//////////////////////结束////////////////////////////////////
- }
- }
- }
- // @Title 获取传感器列表
- // @Description 获取传感器列表
- // @Success 200 {object} business.device.DeviceChannels
- // @router /getsensorslist [get]
- func (this *EquipmentController) GetSensorsList() {
- svcauthcode := authcode.GetAuthCodeService(utils.DBE)
- var aclist []authcode.AuthCode
- whereac := " AccCode='" + this.User.AccCode + "'"
- aclist = svcauthcode.GetList(" Id desc limit 1 ", whereac)
- keystr := ""
- if len(aclist) > 0 {
- keystr = aclist[0].AuthCode
- }
- ////支持多个授权码
- // for i := 0; i < len(aclist); i++ {
- // if ki == len(aclist)-1 {
- // keystr = keystr + "'" + aclist[i].AuthCode + "'"
- // } else {
- // keystr = keystr + "'" + aclist[i].AuthCode + "'" + ","
- // }
- // }
- //调接口获取sensors
- var ccsensor []equipment.CCSensor
- if keystr != "" {
- strUrlwaring := utils.Cfg.MustValue("server", "dataapiurl") + "/channels/channels"
- json.Unmarshal(ApiKeyRequest(strUrlwaring, "GET", keystr, nil), &ccsensor)
- }
- var datainfo DataInfo
- datainfo.Items = ccsensor
- this.Data["json"] = &datainfo
- this.ServeJSON()
- }
- // @Title 验证传感器编号是否有权限
- // @Description 获取传感器列表
- // @Success 200 {object} business.device.DeviceChannels
- // @router /validsensorsispermi [get]
- func (this *EquipmentController) ValidsensorsisPermi() {
- svcauthcode := authcode.GetAuthCodeService(utils.DBE)
- var aclist []authcode.AuthCode
- whereac := " AccCode='" + this.User.AccCode + "'"
- aclist = svcauthcode.GetList(" Id desc limit 1 ", whereac)
- var errinfo ErrorInfo
- if len(aclist) == 0 {
- errinfo.Message = "请先设置授权码"
- errinfo.Code = -2
- this.Data["json"] = &errinfo
- this.ServeJSON()
- return
- }
- keystr := aclist[0].AuthCode
- sensors := this.GetString("sensors")
- sensorarr := strings.Split(sensors, ",")
- //调接口获取sensors
- var ccsensor []equipment.CCSensor
- if keystr != "" {
- strUrlwaring := utils.Cfg.MustValue("server", "dataapiurl") + "/channels/channels"
- json.Unmarshal(ApiKeyRequest(strUrlwaring, "GET", keystr, nil), &ccsensor)
- }
- isok := false //是否通过验证
- nohavesensor := "" // 不存在的sensor
- for si := 0; si < len(sensorarr); si++ {
- isok = false
- for i := 0; i < len(ccsensor); i++ {
- if ccsensor[i].Serial == sensorarr[si] {
- isok = true
- break
- }
- }
- if !isok {
- nohavesensor = sensorarr[si]
- break
- }
- }
- if isok {
- errinfo.Message = "验证通过!"
- errinfo.Code = 0
- this.Data["json"] = &errinfo
- this.ServeJSON()
- } else {
- errinfo.Message = "模块序列号" + nohavesensor + "不存在"
- errinfo.Code = -1
- this.Data["json"] = &errinfo
- this.ServeJSON()
- }
- }
- // @Title 根据容器id获取温度模块
- // @Description 获取传感器列表
- // @Success 200 {object} business.device.DeviceChannels
- // @router /getsensorsbyequid [get]
- func (this *EquipmentController) GetSensorsbyEquid() {
- equid := this.GetString("equid")
- svc := equipment.GetEquipmentService(utils.DBE)
- var esentitylist []equipment.EquipmentSensors
- wheresensor := "where AccCode='" + this.User.AccCode + "' and EquipmentId=" + equid
- esentitylist = svc.GetSensorsList(wheresensor)
- this.Data["json"] = esentitylist
- this.ServeJSON()
- }
- // @Title 报警器列表
- // @Description 设备列表
- // @Success 200 {object} business.device.DeviceChannels
- // @router /bindequipment/:id [get]
- func (this *EquipmentController) GetEquipmentByOrganId() {
- id := this.Ctx.Input.Param(":id")
- svc := equipment.GetEquipmentService(utils.DBE)
- var entity []equipment.Equipment
- where := "OrganizeId='" + id + "'"
- svc.GetEntities(&entity, where)
- var datainfo DataInfo
- datainfo.Items = entity
- this.Data["json"] = &datainfo
- this.ServeJSON()
- }
- // @Title 样本库获取容器列表
- // @Description BioBank获取设备的名字与id、层数列表
- // @Success 200 {object} business.device.DeviceChannels
- // @router /equipmentlist [get]
- //func (this *EquipmentController) NameIdRowList() {
- // svc := equipment.GetEquipmentService(utils.DBE)
- // svcrole := role.GetRoleService(utils.DBE)
- // roleids := svcrole.GetRoleidsByuid(utils.ToStr(this.User.Id))
- // where := " a.AccCode = '" + this.User.AccCode + "'"
- // where = where + " and (a.CreateUserId=" + utils.ToStr(this.User.Id) + " or a.Id in (select EquipmentId Id FROM Base_RoleEquipment where RoleId in (" + strings.Join(roleids, ",") + ")))"
- // var list []string
- // _, entities := svc.GetEquipmenViewtList(0, 0, "a.Id desc", where)
- // for i := 0; i < len(entities); i++ {
- // list = append(list, entities[i].Name)
- // list = append(list, utils.ToStr(entities[i].Id))
- // list = append(list, utils.ToStr(entities[i].RowNum))
- // list = append(list, utils.ToStr(entities[i].ColumnNum))
- // list = append(list, utils.ToStr(entities[i].DItem))
- // }
- // var datainfo DataInfo
- // datainfo.Items = list
- // this.Data["json"] = &datainfo
- // this.ServeJSON()
- //}
- // @Title 样本库获取Shelf列表
- // @Description BioBank获取设备的名字与id、层数列表
- // @Success 200 {object} business.device.DeviceChannels
- // @router /shelflist [get]
- //func (this *EquipmentController) Shelflist() {
- // EquipmentId := this.GetString("EquipmentId")
- // var list []shelfset.Shelf
- // svc := equipment.GetEquipmentService(utils.DBE)
- // where := " EquipmentId ='" + EquipmentId + "'"
- // svc.GetEntitysByWhere(ShelfName, where, &list)
- // var datainfo DataInfo
- // datainfo.Items = list
- // this.Data["json"] = &datainfo
- // this.ServeJSON()
- //}
- // @Title 样本库获取Box列表
- // @Description BioBank获取设备的名字与id、层数列表
- // @Success 200 {object} business.device.DeviceChannels
- // @router /boxlist [get]
- //func (this *EquipmentController) Boxlist() {
- // Shelf := this.GetString("Shelf")
- // var list []shelfset.Box
- // svc := equipment.GetEquipmentService(utils.DBE)
- // where := " ShelfId ='" + Shelf + "'"
- // svc.GetEntitysByWhere(BoxName, where, &list)
- // var datainfo DataInfo
- // datainfo.Items = list
- // this.Data["json"] = &datainfo
- // this.ServeJSON()
- //}
|