|
|
@@ -1,15 +1,21 @@
|
|
|
package equipment
|
|
|
|
|
|
import (
|
|
|
- // "fmt"
|
|
|
- // "strings"
|
|
|
- // "time"
|
|
|
+ "encoding/json"
|
|
|
+ "fmt"
|
|
|
+ "strings"
|
|
|
+ "time"
|
|
|
+
|
|
|
+ "dashoo.cn/backend/api/business/currboxcapacity"
|
|
|
+ "dashoo.cn/backend/api/business/equipment"
|
|
|
+ "dashoo.cn/backend/api/business/lastordernum"
|
|
|
+ "dashoo.cn/backend/api/business/sampleorgan"
|
|
|
+ "dashoo.cn/backend/api/business/samplesbusiness"
|
|
|
+ "dashoo.cn/backend/api/business/samplesinfo"
|
|
|
+ "dashoo.cn/backend/api/business/sampletype"
|
|
|
+ "dashoo.cn/backend/api/business/shelfset"
|
|
|
. "dashoo.cn/backend/api/controllers"
|
|
|
- // "dashoo.cn/backend/api/business/currboxcapacity"
|
|
|
- // "dashoo.cn/backend/api/business/equipment"
|
|
|
- // "dashoo.cn/backend/api/business/lastordernum"
|
|
|
- // "dashoo.cn/backend/api/business/shelfset"
|
|
|
- // "dashoo.cn/utils"
|
|
|
+ "dashoo.cn/utils"
|
|
|
)
|
|
|
|
|
|
// 冻存架 冻存盒
|
|
|
@@ -17,840 +23,856 @@ type ShelfSetController struct {
|
|
|
BaseController
|
|
|
}
|
|
|
|
|
|
-//// 冻存盒
|
|
|
-//type BoxData struct {
|
|
|
-// Shelfbox shelfset.Shelf
|
|
|
-// Boxshelf shelfset.Box
|
|
|
-// // Boxsample []samplesinfo.SamplesInfoShow
|
|
|
-//}
|
|
|
-
|
|
|
-//// 回传数据model
|
|
|
-//type Output struct {
|
|
|
-// Dimension [2]int `json:"dimension,omitempty"` //冰箱尺寸
|
|
|
-// Items interface{} `json:"items,omitempty"` //数据列表
|
|
|
-//}
|
|
|
-
|
|
|
-//// 添加样本model
|
|
|
-//type SampleModel struct {
|
|
|
-// BarCode string `json:"BarCode,omitempty"` // 样本条码
|
|
|
-// SampleCode string `json:"SampleCode,omitempty"` // 样本编码
|
|
|
-// SampleType string `json:"SampleType,omitempty"` // 样本类型
|
|
|
-// SampleTypeName string `json:"SampleTypeName,omitempty"` // 样本类型
|
|
|
-// Zuzhi string `json:"zuzhi,omitempty"` // 组织器官
|
|
|
-// Zuzhiming string `json:"zuzhiming,omitempty"` // 组织器官
|
|
|
-// SamplingSite string `json:"SamplingSite,omitempty"` // 取材部位
|
|
|
-// SamplingSiteName string `json:"SamplingSiteName,omitempty"` // 取材部位
|
|
|
-// Name string `json:"Name,omitempty"` // 名称
|
|
|
-// ReceiveDate time.Time `json:"ReceiveDate,omitempty"` // 接收日期
|
|
|
-// Capacity string `json:"Capacity,omitempty"` // 可用容量
|
|
|
-// Unit string `json:"Unit,omitempty"` // 单位(容量)
|
|
|
-// ValidityDate time.Time `json:"ValidityDate,omitempty"` // 有效日期
|
|
|
-// InnerCode string `json:"InnerCode,omitempty"` // 样本内码
|
|
|
-// SourceName string `json:"SourceName,omitempty"` // 样本来源
|
|
|
-// Remark string `json:"Remark,omitempty"` // 备注
|
|
|
-// PositionStr string `json:"PositionStr,omitempty"` // 位置信息
|
|
|
-//}
|
|
|
-
|
|
|
-//// 添加冻存盒model
|
|
|
-//type BoxModel struct {
|
|
|
-// XBox int `json:"xbox,omitempty"` // 冻存盒x
|
|
|
-// YBox int `json:"ybox,omitempty"` // 冻存盒y
|
|
|
-// XShelf int `json:"xshelf,omitempty"` // 冻存架x
|
|
|
-// YShelf int `json:"yshelf,omitempty"` // 冻存架y
|
|
|
-// // SampleType string `json:"sampletype,omitempty"` // 样本类型
|
|
|
-// BarCode string `json:"barcode,omitempty"` // 编码
|
|
|
-// Eid string `json:"eid,omitempty"` // 设备id
|
|
|
-// Boxxvalue int `json:"boxxvalue,omitempty"` // 冻存盒x大小
|
|
|
-// Boxyvalue int `json:"boxyvalue,omitempty"` // 冻存盒y大小
|
|
|
-//}
|
|
|
-
|
|
|
-//// @Title 报警项目列表
|
|
|
-//// @Description 报警项目列表
|
|
|
-//// @Success 200 {object} business.device.DeviceChannels
|
|
|
-//// @router /equipmentinfo/:eid [get]
|
|
|
-////func (this *ShelfSetController) EquipmentInfo() {
|
|
|
-//// eid := this.Ctx.Input.Param(":eid")
|
|
|
-//// svc := currboxcapacity.GetCurrboxcapacityService(utils.DBE)
|
|
|
-//// data := svc.GetCurrboxcapacityByid(eid)
|
|
|
-//// fmt.Println("=========================datattatat:", data)
|
|
|
-//// // dataStyleScheme := svc.GetStyleScheme("1")
|
|
|
-//// svcequipment := equipment.GetEquipmentService(utils.DBE)
|
|
|
-//// equipmentdata := svcequipment.GetInfoById(eid)
|
|
|
-//// map_list := make(map[string]string)
|
|
|
-//// sample_type := sampletype.GetSampleTypeService(utils.DBE)
|
|
|
-//// where := " AccCode='" + this.User.AccCode + "'"
|
|
|
-//// sample_type_list := sample_type.ListSampleType(where)
|
|
|
-//// for i := 0; i < len(sample_type_list); i++ {
|
|
|
-//// map_list[utils.ToStr(sample_type_list[i].Id)] = sample_type_list[i].Photo
|
|
|
-//// }
|
|
|
-//// this.Data["entitySampleType"] = sample_type_list
|
|
|
-//// this.Data["map_list"] = map_list
|
|
|
-//// this.Data["equipmentdata"] = equipmentdata
|
|
|
-//// this.Data["equipmentName"] = equipmentdata.Name
|
|
|
-//// this.Data["IsLargeSpec"] = equipmentdata.IsLargeSpec
|
|
|
-//// this.Data["json"] = &equipmentdata
|
|
|
-//// this.ServeJSON()
|
|
|
-////}
|
|
|
-
|
|
|
-//// @Title 报警项目列表
|
|
|
-//// @Description 报警项目列表
|
|
|
-//// @Success 200 {object} business.device.DeviceChannels
|
|
|
-//// @router /equipmentdraw/:eid [get]
|
|
|
-//func (this *ShelfSetController) EquipmentDraw() {
|
|
|
-// // 读取参数和初始化服务
|
|
|
-// eid := this.Ctx.Input.Param(":eid")
|
|
|
-// svc := currboxcapacity.GetCurrboxcapacityService(utils.DBE)
|
|
|
-// // 获取所有相关冻存架信息
|
|
|
-// data := svc.GetCurrboxcapacityByid(eid)
|
|
|
-// // 获取冰箱尺寸
|
|
|
-// sve := equipment.GetEquipmentService(utils.DBE)
|
|
|
-// entity := sve.GetInfoById(eid)
|
|
|
-// // 回传数据
|
|
|
-// var output Output
|
|
|
-// array := [2]int{entity.ColumnNum, entity.RowNum}
|
|
|
-// output.Items = &data
|
|
|
-// output.Dimension = array
|
|
|
-// this.Data["json"] = &output
|
|
|
-// this.ServeJSON()
|
|
|
-//}
|
|
|
-
|
|
|
-//// @Title 报警项目列表
|
|
|
-//// @Description 报警项目列表
|
|
|
-//// @Success 200 {object} business.device.DeviceChannels
|
|
|
-//// @router /boxdraw/:inputstr [get]
|
|
|
-////func (this *ShelfSetController) BoxDraw() {
|
|
|
-//// // 读取参数和初始服务
|
|
|
-//// var boxdata BoxData
|
|
|
-//// inputstr := this.Ctx.Input.Param(":inputstr")
|
|
|
-//// serials := strings.Split(inputstr, ",")
|
|
|
-//// id := serials[0]
|
|
|
-//// x := serials[1]
|
|
|
-//// y := serials[2]
|
|
|
-//// x_box := serials[3]
|
|
|
-//// y_box := serials[4]
|
|
|
-//// svs := shelfset.GetshelfsetService(utils.DBE)
|
|
|
-//// // 获取选中box
|
|
|
-//// svc := currboxcapacity.GetCurrboxcapacityService(utils.DBE)
|
|
|
-//// svc.GetBox(&boxdata.Boxshelf, id, x, y, x_box, y_box)
|
|
|
-//// boxdata.Boxsample = nil
|
|
|
-//// // 获取样本, where语句IState部分未经修改
|
|
|
-//// if boxdata.Boxshelf.Id != 0 {
|
|
|
-//// where := " IState in (1,5,10,99) and DeletionStateCode=0 and BoxId = " + utils.ToStr(boxdata.Boxshelf.Id)
|
|
|
-//// svc1 := samplesinfo.GetSamplesInfoService(utils.DBE)
|
|
|
-//// boxdata.Boxsample = svc1.QuerySampleList(this.User.AccCode, where)
|
|
|
-//// }
|
|
|
-//// // 获取冻存架
|
|
|
-//// svs.GetEntityByEquipmentId(id, x, y, &boxdata.Shelfbox)
|
|
|
-//// // 回传数据
|
|
|
-//// this.Data["json"] = boxdata
|
|
|
-//// this.ServeJSON()
|
|
|
-////}
|
|
|
-
|
|
|
-////// @Title 报警项目列表
|
|
|
-////// @Description 报警项目列表
|
|
|
-////// @Success 200 {object} business.device.DeviceChannels
|
|
|
-////// @router /getpos/:inputstr [get]
|
|
|
-////func (this *ShelfSetController) GetPosition() {
|
|
|
-//// inputstr := this.Ctx.Input.Param(":inputstr")
|
|
|
-//// serial := strings.Split(inputstr, "_")
|
|
|
-//// for i := 0; i < len(serial); i++ {
|
|
|
-//// // println("sdfasdf=f-======", serial[i])
|
|
|
-//// }
|
|
|
-//// svs := shelfset.GetshelfsetService(utils.DBE)
|
|
|
-//// shelf := svs.GetShelfByid(serial[7])
|
|
|
-//// box := svs.GetBoxByid(serial[8])
|
|
|
-
|
|
|
-//// posarr := [4]int{shelf[0].XStation, shelf[0].YStation, box[0].XStation, box[0].YStation}
|
|
|
-//// var datainfo DataInfo
|
|
|
-//// datainfo.Items = posarr
|
|
|
-//// this.Data["json"] = &datainfo
|
|
|
-//// this.ServeJSON()
|
|
|
-
|
|
|
-////}
|
|
|
-
|
|
|
-//// @Title 添加冻存盒或冻存架
|
|
|
-//// @Description 添加冻存盒或冻存架
|
|
|
-//// @Success 200 {object} business.device.DeviceChannels
|
|
|
-//// @router / [post]
|
|
|
-////func (this *ShelfSetController) AddforEquipment() {
|
|
|
-//// // 获得前端传输的model
|
|
|
-//// var model BoxModel
|
|
|
-//// var jsonblob = this.Ctx.Input.RequestBody
|
|
|
-//// json.Unmarshal(jsonblob, &model)
|
|
|
-//// serial := strings.Split(model.Eid, "_")
|
|
|
-//// // 日志初始化
|
|
|
-//// var lastnum lastordernum.LastOrderNum
|
|
|
-//// svss := shelfset.GetshelfsetService(utils.DBE)
|
|
|
-//// lastdata := svss.GetLastBoxNum(this.User.AccCode)
|
|
|
-//// lastnum.LastNum = lastdata
|
|
|
-//// // 其他初始化
|
|
|
-//// var errinfo ErrorInfo
|
|
|
-//// var shelf shelfset.Shelf
|
|
|
-//// var box shelfset.Box
|
|
|
-//// var shelfcap currboxcapacity.CurrBoxCapacity
|
|
|
-//// svc := currboxcapacity.GetCurrboxcapacityService(utils.DBE)
|
|
|
-//// if serial[1] == "1" {
|
|
|
-//// // 更新日志
|
|
|
-//// svss.UpdateBoxNum(lastnum, this.User.AccCode)
|
|
|
-
|
|
|
-//// svss.GetEntityByEquipmentId(serial[0], utils.ToStr(model.XShelf), utils.ToStr(model.YShelf), &shelf)
|
|
|
-//// box.AccCode = this.User.AccCode
|
|
|
-//// box.BarCode = model.BarCode
|
|
|
-//// box.ColumnNum = model.Boxyvalue
|
|
|
-//// box.RowNum = model.Boxxvalue
|
|
|
-//// box.SampleType = model.SampleType
|
|
|
-//// box.XStation = model.XBox
|
|
|
-//// box.YStation = model.YBox
|
|
|
-//// box.EquipmentId, _ = utils.StrTo(serial[0]).Int()
|
|
|
-//// box.ShelfId = shelf.Id
|
|
|
-//// box.Code = lastdata
|
|
|
-//// box.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
-//// box.CreateBy = this.User.Realname
|
|
|
-//// // 更新冻存盒颜色
|
|
|
-//// svc.GetCurrboxcapacityByShelfid(utils.ToStr(shelf.Id), &shelfcap)
|
|
|
-//// colname := string(box.YStation+64) + utils.ToStr(box.XStation)
|
|
|
-//// where := "AccCode='" + this.User.AccCode + "' and EquipmentId='" + serial[0] + "' and ShelfId ='" + utils.ToStr(shelf.Id) + "'"
|
|
|
-//// err := svc.Updata(colname, "-1", where)
|
|
|
-//// // 添加冻存盒
|
|
|
-//// _, err = svss.InsertEntity(&box)
|
|
|
-//// // 错误检测
|
|
|
-//// if err != nil {
|
|
|
-//// errinfo.Message = "添加冻存盒失败!"
|
|
|
-//// errinfo.Code = -2
|
|
|
-//// this.Data["json"] = &errinfo
|
|
|
-//// this.ServeJSON()
|
|
|
-//// return
|
|
|
-//// } else {
|
|
|
-//// errinfo.Message = "添加冻存盒成功!"
|
|
|
-//// errinfo.Code = 0
|
|
|
-//// this.Data["json"] = &errinfo
|
|
|
-//// this.ServeJSON()
|
|
|
-//// }
|
|
|
-//// } else {
|
|
|
-//// // 更新日志 添加设备
|
|
|
-//// svss.UpdateShelfNum(lastnum, this.User.AccCode)
|
|
|
-//// shelf.AccCode = this.User.AccCode
|
|
|
-//// shelf.EquipmentId, _ = utils.StrTo(serial[0]).Int()
|
|
|
-//// shelf.Code = lastdata
|
|
|
-//// shelf.BarCode = model.BarCode
|
|
|
-//// shelf.CreateBy = this.User.Realname
|
|
|
-//// shelf.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
-//// shelf.SampleType = model.SampleType
|
|
|
-//// shelf.RowNum = model.YBox
|
|
|
-//// shelf.ColumnNum = model.XBox
|
|
|
-//// shelf.XStation = model.XShelf
|
|
|
-//// shelf.YStation = model.YShelf
|
|
|
-//// _, err := svss.InsertEntity(&shelf)
|
|
|
-//// // 添加冻存盒颜色----currboxcap
|
|
|
-//// var colstr string = "AccCode, EquipmentId, ShelfId, RowNum, ColumnNum, XStation, YStation,"
|
|
|
-//// var valuestr string = "'" + this.User.AccCode + "'," + serial[0] + "," + utils.ToStr(shelf.Id) + "," + utils.ToStr(shelf.RowNum) + "," + utils.ToStr(shelf.ColumnNum) + "," + utils.ToStr(shelf.XStation) + "," + utils.ToStr(shelf.YStation) + ","
|
|
|
-//// for i := 1; i <= shelf.RowNum; i++ {
|
|
|
-//// for j := 1; j <= shelf.ColumnNum; j++ {
|
|
|
-//// colstr = colstr + string(i+64) + utils.ToStr(j) + ","
|
|
|
-//// valuestr = valuestr + "-2,"
|
|
|
-//// }
|
|
|
-//// }
|
|
|
-//// colstr = colstr[:len(colstr)-1]
|
|
|
-//// valuestr = valuestr[:len(valuestr)-1]
|
|
|
-//// err = svc.Add(colstr, valuestr)
|
|
|
-//// // 错误检测
|
|
|
-//// if err != nil {
|
|
|
-//// errinfo.Message = "添加冻存架失败!"
|
|
|
-//// errinfo.Code = -2
|
|
|
-//// this.Data["json"] = &errinfo
|
|
|
-//// this.ServeJSON()
|
|
|
-//// return
|
|
|
-//// } else {
|
|
|
-//// errinfo.Message = "添加冻存架成功!"
|
|
|
-//// errinfo.Code = 0
|
|
|
-//// this.Data["json"] = &errinfo
|
|
|
-//// this.ServeJSON()
|
|
|
-//// }
|
|
|
-//// }
|
|
|
-
|
|
|
-////}
|
|
|
-
|
|
|
-//// @Title 编辑冻存盒或冻存架
|
|
|
-//// @Description 编辑冻存盒或冻存架
|
|
|
-//// @Success 200 {object} controllers.Request
|
|
|
-//// @router /editforequip [put]
|
|
|
-////func (this *ShelfSetController) EditforEquipment() {
|
|
|
-//// var model BoxModel
|
|
|
-//// var jsonblob = this.Ctx.Input.RequestBody
|
|
|
-//// json.Unmarshal(jsonblob, &model)
|
|
|
-//// fmt.Println("==============modddeelll", model)
|
|
|
-//// serial := strings.Split(model.Eid, "_")
|
|
|
-//// svc := shelfset.GetshelfsetService(utils.DBE)
|
|
|
-//// var errinfo ErrorInfo
|
|
|
-//// if serial[1] == "2" {
|
|
|
-//// //初始化服务
|
|
|
-//// var shelfempty shelfset.Shelf
|
|
|
-//// var shelf shelfset.Shelf
|
|
|
-//// svc.GetEntityByEquipmentId(serial[0], utils.ToStr(model.XShelf), utils.ToStr(model.YShelf), &shelf)
|
|
|
-//// //编辑
|
|
|
-//// shelf.ModifiedBy = this.User.Realname
|
|
|
-//// shelf.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
-//// shelf.SampleType = model.SampleType
|
|
|
-//// shelf.BarCode = model.BarCode
|
|
|
-//// var cols []string = []string{"RowNum", "ColumnNum", "BarCode", "SampleType", "ModifiedUserId", "ModifiedBy"}
|
|
|
-//// opdesc := "编辑冻存架-" + shelf.ShelfSpecName + ",第" + utils.ToStr(shelf.YStation) + "行第" + utils.ToStr(shelf.XStation) + "列"
|
|
|
-//// err := svc.UpdateEntityAndWriteLog(shelf.Id, &shelf, &shelfempty, cols, utils.ToStr(this.User.Id), this.User.Username, opdesc, this.User.AccCode, "设备管理")
|
|
|
-//// // 错误检测
|
|
|
-//// if err != nil {
|
|
|
-//// errinfo.Message = "编辑冻存架失败!"
|
|
|
-//// errinfo.Code = -2
|
|
|
-//// this.Data["json"] = &errinfo
|
|
|
-//// this.ServeJSON()
|
|
|
-//// return
|
|
|
-//// } else {
|
|
|
-//// errinfo.Message = "编辑冻存架成功!"
|
|
|
-//// errinfo.Code = 0
|
|
|
-//// this.Data["json"] = &errinfo
|
|
|
-//// this.ServeJSON()
|
|
|
-//// }
|
|
|
-//// } else {
|
|
|
-//// var box shelfset.Box
|
|
|
-//// var boxempty shelfset.Box
|
|
|
-//// svc.GetEntityByShelfIdXY(serial[2], utils.ToStr(model.XBox), utils.ToStr(model.YBox), &box)
|
|
|
-//// box.ColumnNum = model.Boxyvalue
|
|
|
-//// box.RowNum = model.Boxxvalue
|
|
|
-//// box.ModifiedBy = this.User.Realname
|
|
|
-//// box.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
-//// box.SampleType = model.SampleType
|
|
|
-//// box.BarCode = model.BarCode
|
|
|
-//// var cols []string = []string{"RowNum", "ColumnNum", "BarCode", "SampleType", "ModifiedUserId", "ModifiedBy"}
|
|
|
-//// opdesc := "编辑冻存盒-" + box.Code + ",冻存架第" + serial[4] + "行第" + serial[3] + "列,冻存盒第" + utils.ToStr(box.YStation) + "行第" + utils.ToStr(box.XStation) + "列"
|
|
|
-//// err := svc.UpdateEntityAndWriteLog(box.Id, &box, &boxempty, cols, utils.ToStr(this.User.Id), this.User.Username, opdesc, this.User.AccCode, "设备管理")
|
|
|
-//// // 错误检测
|
|
|
-//// if err != nil {
|
|
|
-//// errinfo.Message = "编辑冻存盒失败!"
|
|
|
-//// errinfo.Code = -2
|
|
|
-//// this.Data["json"] = &errinfo
|
|
|
-//// this.ServeJSON()
|
|
|
-//// return
|
|
|
-//// } else {
|
|
|
-//// errinfo.Message = "编辑冻存盒成功!"
|
|
|
-//// errinfo.Code = 0
|
|
|
-//// this.Data["json"] = &errinfo
|
|
|
-//// this.ServeJSON()
|
|
|
-//// }
|
|
|
-//// }
|
|
|
-
|
|
|
-////}
|
|
|
-
|
|
|
-//// @Title 冻存架移动
|
|
|
-//// @Description 检测样本类型是否匹配和冻存架移动,分两个方法
|
|
|
-//// @Success 200 {object} controllers.Request
|
|
|
-//// @router /shelfmove/:inputstr [put]
|
|
|
-////func (this *ShelfSetController) BeforeMoveShelf() {
|
|
|
-//// inputstr := this.Ctx.Input.Param(":inputstr")
|
|
|
-//// println("===ssss=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-", inputstr)
|
|
|
-//// serial := strings.Split(inputstr, "_")
|
|
|
-//// var errinfo ErrorInfo
|
|
|
-//// var entity equipment.Equipment
|
|
|
-//// var shelf shelfset.Shelf
|
|
|
-//// sve := equipment.GetEquipmentService(utils.DBE)
|
|
|
-//// svs := shelfset.GetshelfsetService(utils.DBE)
|
|
|
-//// where := "Id = " + serial[0]
|
|
|
-//// sve.GetEntity(&entity, where)
|
|
|
-//// println("ccc-=====================", entity.SampleType)
|
|
|
-//// seriale := strings.Split(entity.SampleType, ",")
|
|
|
-//// svs.GetEntityByEquipmentId(serial[1], serial[2], serial[3], &shelf)
|
|
|
-//// println("xxx-=====================", shelf.SampleType)
|
|
|
-//// serials := strings.Split(shelf.SampleType, ",")
|
|
|
-//// var exist = false
|
|
|
-//// for i := 0; i < len(serials); i++ {
|
|
|
-//// for j := 0; j < len(seriale); j++ {
|
|
|
-//// if serials[i] == seriale[j] {
|
|
|
-//// exist = true
|
|
|
-//// }
|
|
|
-//// }
|
|
|
-//// if !exist {
|
|
|
-//// errinfo.Message = "存在不支持的样本类型!"
|
|
|
-//// errinfo.Code = -1
|
|
|
-//// this.Data["json"] = &errinfo
|
|
|
-//// this.ServeJSON()
|
|
|
-//// return
|
|
|
-//// }
|
|
|
-//// exist = false
|
|
|
-//// }
|
|
|
-//// this.MoveforShelf(utils.ToStr(shelf.Id))
|
|
|
-////}
|
|
|
-
|
|
|
-////func (this *ShelfSetController) MoveforShelf(shelfid string) {
|
|
|
-//// inputstr := this.Ctx.Input.Param(":inputstr")
|
|
|
-//// println("===ssss=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-", inputstr)
|
|
|
-//// serial := strings.Split(inputstr, "_")
|
|
|
-//// var errinfo ErrorInfo
|
|
|
-//// var shelf shelfset.Shelf
|
|
|
-//// var shelfempty shelfset.Shelf
|
|
|
-//// // shelf
|
|
|
-//// // equipmentid := serial[1]
|
|
|
-//// svc := shelfset.GetshelfsetService(utils.DBE)
|
|
|
-//// shelf.EquipmentId, _ = utils.StrTo(serial[0]).Int()
|
|
|
-//// shelf.XStation, _ = utils.StrTo(serial[4]).Int()
|
|
|
-//// shelf.YStation, _ = utils.StrTo(serial[5]).Int()
|
|
|
-//// shelf.ModifiedBy = this.User.Realname
|
|
|
-//// shelf.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
-//// var cols []string = []string{"EquipmentId", "XStation", "YStation", "ModifiedUserId", "ModifiedBy"}
|
|
|
-//// opdesc := "移动冻存架-原位置:" + serial[1] + ",第" + serial[3] + "行第" + serial[2] + "列"
|
|
|
-//// svc.UpdateEntityAndWriteLog(shelfid, &shelf, &shelfempty, cols, utils.ToStr(this.User.Id), this.User.Username, opdesc, this.User.AccCode, "设备管理")
|
|
|
-//// // 冻存盒颜色
|
|
|
-//// var currboxcapacitys currboxcapacity.CurrBoxCapacity
|
|
|
-//// svc1 := currboxcapacity.GetCurrboxcapacityService(utils.DBE)
|
|
|
-//// currboxcapacitys.EquipmentId, _ = utils.StrTo(serial[0]).Int()
|
|
|
-//// currboxcapacitys.ShelfId, _ = utils.StrTo(shelfid).Int()
|
|
|
-//// currboxcapacitys.XStation, _ = utils.StrTo(serial[4]).Int()
|
|
|
-//// currboxcapacitys.YStation, _ = utils.StrTo(serial[5]).Int()
|
|
|
-//// where1 := " AccCode='" + this.User.AccCode + "' and ShelfId=" + shelfid
|
|
|
-//// svc1.UpdateEntityByWhere(where1, &currboxcapacitys)
|
|
|
-//// // 冻存盒
|
|
|
-//// var boxempty shelfset.Box
|
|
|
-//// var colss []string = []string{"EquipmentId", "ModifiedUserId", "ModifiedBy"}
|
|
|
-//// boxempty.EquipmentId, _ = utils.StrTo(serial[0]).Int()
|
|
|
-//// boxempty.ModifiedBy = this.User.Realname
|
|
|
-//// boxempty.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
-//// where := " AccCode='" + this.User.AccCode + "' and ShelfId=" + shelfid
|
|
|
-//// svc.UpdateEntityColsByWhere(&boxempty, where, colss)
|
|
|
-//// // 样本---isAddFNum是否记录冻融次数
|
|
|
-//// tblDetai := this.User.AccCode + SamplesDetailtbName
|
|
|
-//// sql := ""
|
|
|
-//// if serial[6] == "true" {
|
|
|
-//// sql = "update " + tblDetai + " set EquipmentId=" + serial[0] + ",FreezingNum=FreezingNum+1 where ShelfId=" + shelfid + " and DeletionStateCode=0 and IState in (1,5)"
|
|
|
-//// } else {
|
|
|
-//// sql = "update " + tblDetai + " set EquipmentId=" + serial[0] + " where ShelfId=" + shelfid + " and DeletionStateCode=0 and IState in (1,5)"
|
|
|
-//// }
|
|
|
-//// svc.SqlMethod(sql)
|
|
|
-//// // 样本
|
|
|
-//// var SamplesData []samplesinfo.SamplesInfoShow
|
|
|
-//// where = " DeletionStateCode=0 and EquipmentId=" + serial[0] + " and ShelfId=" + shelfid + " and IState in (1,5)"
|
|
|
-//// svcSample := samplesinfo.GetSamplesInfoService(utils.DBE)
|
|
|
-//// SamplesData = svcSample.QuerySampleList(this.User.AccCode, where)
|
|
|
-
|
|
|
-//// svcequipment := equipment.GetEquipmentService(utils.DBE)
|
|
|
-//// newequipmententity := svcequipment.GetInfoById(serial[0])
|
|
|
-//// newpositon := "-新位置:" + newequipmententity.Name + ",第" + serial[5] + "行第" + serial[4] + "列"
|
|
|
-//// // //业务记录
|
|
|
-//// // for i := 0; i < len(SamplesData); i++ {
|
|
|
-//// // var databuss samplesbusiness.SamplesBusiness
|
|
|
-//// // databuss.AccCode = this.User.AccCode
|
|
|
-//// // databuss.OpType = 41
|
|
|
-//// // databuss.SampleCode = SamplesData[i].SampleCode
|
|
|
-//// // databuss.BarCode = SamplesData[i].BarCode
|
|
|
-//// // databuss.SampleType = SamplesData[i].SampleType
|
|
|
-//// // databuss.CapacityUsed = SamplesData[i].Capacity
|
|
|
-//// // databuss.CapacityRest = SamplesData[i].Capacity
|
|
|
-//// // databuss.Unit = SamplesData[i].Unit
|
|
|
-//// // databuss.EquipmentId = SamplesData[i].EquipmentId
|
|
|
-//// // databuss.ShelfId = SamplesData[i].ShelfId
|
|
|
-//// // databuss.BoxId = SamplesData[i].BoxId
|
|
|
-//// // databuss.Position = SamplesData[i].Position
|
|
|
-//// // databuss.PositionDesc = svcSample.GetPostiondescByPosId(databuss.EquipmentId, databuss.ShelfId, databuss.BoxId, databuss.Position)
|
|
|
-
|
|
|
-//// // databuss.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
-//// // databuss.CreateBy = this.User.Realname
|
|
|
-//// // databuss.OpDesc = opdesc + "-" + newpositon
|
|
|
-//// // svcSample.InsertEntityBytbl(this.User.AccCode+SamplesBusstbName, &databuss)
|
|
|
-//// // }
|
|
|
-//// errinfo.Message = "成功"
|
|
|
-//// errinfo.Code = 0
|
|
|
-//// this.Data["json"] = &errinfo
|
|
|
-//// this.ServeJSON()
|
|
|
-//// return
|
|
|
-////}
|
|
|
-
|
|
|
-//// @Title 冻存盒移动
|
|
|
-//// @Description 检测样本类型是否匹配和冻存盒移动,分两个方法
|
|
|
-//// @Success 200 {object} controllers.Request
|
|
|
-//// @router /boxmove/:inputstr [put]
|
|
|
-//func (this *ShelfSetController) BeforeMoveBox() {
|
|
|
-// inputstr := this.Ctx.Input.Param(":inputstr")
|
|
|
-// serial := strings.Split(inputstr, "_")
|
|
|
-// var errinfo ErrorInfo
|
|
|
-// var entity equipment.Equipment
|
|
|
-// var shelf shelfset.Shelf
|
|
|
-// var box shelfset.Box
|
|
|
-// sve := equipment.GetEquipmentService(utils.DBE)
|
|
|
-// svs := shelfset.GetshelfsetService(utils.DBE)
|
|
|
-// where := "Id = " + serial[0]
|
|
|
-// sve.GetEntity(&entity, where)
|
|
|
-// println("eee-=====================", entity.SampleType)
|
|
|
-// seriale := strings.Split(entity.SampleType, ",")
|
|
|
-// svs.GetEntityByEquipmentId(serial[1], serial[7], serial[8], &shelf)
|
|
|
-// svs.GetEntityByShelfIdXY(utils.ToStr(shelf.Id), serial[2], serial[3], &box)
|
|
|
-// println("bbb-=====================", box.SampleType)
|
|
|
-// serialb := strings.Split(box.SampleType, ",")
|
|
|
-// var exist = false
|
|
|
-// for i := 0; i < len(serialb); i++ {
|
|
|
-// for j := 0; j < len(seriale); j++ {
|
|
|
-// if serialb[i] == seriale[j] {
|
|
|
-// exist = true
|
|
|
-// }
|
|
|
-// }
|
|
|
-// if !exist {
|
|
|
-// errinfo.Message = "存在不支持的样本类型!"
|
|
|
-// errinfo.Code = -1
|
|
|
-// this.Data["json"] = &errinfo
|
|
|
-// this.ServeJSON()
|
|
|
-// return
|
|
|
-// }
|
|
|
-// exist = false
|
|
|
-// }
|
|
|
-// this.MoveforBox(utils.ToStr(box.Id), utils.ToStr(shelf.Id))
|
|
|
-//}
|
|
|
-
|
|
|
-//func (this *ShelfSetController) MoveforBox(boxid string, shelfoldid string) {
|
|
|
-// inputstr := this.Ctx.Input.Param(":inputstr")
|
|
|
-// println("===ss-=-=-=-=-=-=-=-", inputstr)
|
|
|
-// serial := strings.Split(inputstr, "_")
|
|
|
-// var box shelfset.Box
|
|
|
-// var boxempty shelfset.Box
|
|
|
-// var shelf shelfset.Shelf
|
|
|
-// var errinfo ErrorInfo
|
|
|
-// //equipmentid := this.GetString("equipmentid")
|
|
|
-// svc := shelfset.GetshelfsetService(utils.DBE)
|
|
|
-// svc.GetEntityByEquipmentId(serial[0], serial[9], serial[10], &shelf)
|
|
|
-// // 冻存盒
|
|
|
-// box.EquipmentId, _ = utils.StrTo(serial[0]).Int()
|
|
|
-// box.ShelfId = shelf.Id
|
|
|
-// box.XStation, _ = utils.StrTo(serial[4]).Int()
|
|
|
-// box.YStation, _ = utils.StrTo(serial[5]).Int()
|
|
|
-// box.ModifiedBy = this.User.Realname
|
|
|
-// box.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
-// var cols []string = []string{"EquipmentId", "ShelfId", "XStation", "YStation", "ModifiedUserId", "ModifiedBy"}
|
|
|
-// opdesc := "移动冻存盒-原位置:" + serial[1] + ",冻存架第" + serial[8] + "行第" + serial[7] + "列,冻存盒第" + serial[3] + "行第" + serial[2] + "列"
|
|
|
-// svc.UpdateEntityAndWriteLog(boxid, &box, &boxempty, cols, utils.ToStr(this.User.Id), this.User.Username, opdesc, this.User.AccCode, "设备管理")
|
|
|
-// // 冻存盒颜色
|
|
|
-// svc1 := currboxcapacity.GetCurrboxcapacityService(utils.DBE)
|
|
|
-// ystaion, _ := utils.StrTo(serial[3]).Int()
|
|
|
-// charname := Boxlinename(ystaion)
|
|
|
-// sqlfield := fmt.Sprintf("%v%v", charname, serial[2])
|
|
|
-// where := " EquipmentId='" + serial[1] + "' and ShelfId ='" + shelfoldid + "'"
|
|
|
-// svc1.Updata(sqlfield, "-2", where)
|
|
|
-// ystaion1, _ := utils.StrTo(serial[5]).Int()
|
|
|
-// charname1 := Boxlinename(ystaion1)
|
|
|
-// sqlfield1 := fmt.Sprintf("%v%v", charname1, serial[4])
|
|
|
-// where1 := " EquipmentId='" + serial[0] + "' and ShelfId ='" + utils.ToStr(shelf.Id) + "'"
|
|
|
-// svc1.Updata(sqlfield1, "-1", where1)
|
|
|
-// // 样本----冻融记录
|
|
|
-// tblDetai := this.User.AccCode + SamplesDetailtbName
|
|
|
-// sql := ""
|
|
|
-// if serial[6] == "true" {
|
|
|
-// sql = "update " + tblDetai + " set EquipmentId=" + serial[0] + ",ShelfId=" + utils.ToStr(shelf.Id) + ",FreezingNum=FreezingNum+1 where BoxId=" + boxid + " and DeletionStateCode=0 and IState in (1,5) "
|
|
|
-// } else {
|
|
|
-// sql = "update " + tblDetai + " set EquipmentId=" + serial[0] + ",ShelfId=" + utils.ToStr(shelf.Id) + " where BoxId=" + boxid + " and DeletionStateCode=0 and IState in (1,5) "
|
|
|
-// }
|
|
|
-// svc.SqlMethod(sql)
|
|
|
-// // 样本
|
|
|
-// var SamplesData []samplesinfo.SamplesInfoShow
|
|
|
-// where = " DeletionStateCode=0 and EquipmentId=" + serial[0] + " and ShelfId=" + utils.ToStr(shelf.Id) + " and BoxId=" + boxid + " and IState in (1,5) "
|
|
|
-// svcSample := samplesinfo.GetSamplesInfoService(utils.DBE)
|
|
|
-// SamplesData = svcSample.QuerySampleList(this.User.AccCode, where)
|
|
|
-// svcequipment := equipment.GetEquipmentService(utils.DBE)
|
|
|
-// newequipmententity := svcequipment.GetInfoById(serial[0])
|
|
|
-// newpositon := "新位置:" + newequipmententity.Name + ",冻存架第" + serial[10] + "行第" + serial[9] + "列,冻存盒第" + serial[5] + "行第" + serial[4] + "列"
|
|
|
-// // for i := 0; i < len(SamplesData); i++ {
|
|
|
-// // var databuss samplesbusiness.SamplesBusiness //业务记录
|
|
|
-// // databuss.AccCode = this.User.AccCode
|
|
|
-// // databuss.OpType = 41
|
|
|
-// // databuss.SampleCode = SamplesData[i].SampleCode
|
|
|
-// // databuss.BarCode = SamplesData[i].BarCode
|
|
|
-// // databuss.SampleType = SamplesData[i].SampleType
|
|
|
-// // databuss.CapacityUsed = SamplesData[i].Capacity
|
|
|
-// // databuss.CapacityRest = SamplesData[i].Capacity
|
|
|
-// // databuss.Unit = SamplesData[i].Unit
|
|
|
-// // databuss.EquipmentId = SamplesData[i].EquipmentId
|
|
|
-// // databuss.ShelfId = SamplesData[i].ShelfId
|
|
|
-// // databuss.BoxId = SamplesData[i].BoxId
|
|
|
-// // databuss.Position = SamplesData[i].Position
|
|
|
-// // databuss.PositionDesc = svcSample.GetPostiondescByPosId(databuss.EquipmentId, databuss.ShelfId, databuss.BoxId, databuss.Position)
|
|
|
-
|
|
|
-// // databuss.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
-// // databuss.CreateBy = this.User.Realname
|
|
|
-// // databuss.OpDesc = opdesc + "-" + newpositon
|
|
|
-// // svcSample.InsertEntityBytbl(this.User.AccCode+SamplesBusstbName, &databuss)
|
|
|
-// // }
|
|
|
-// errinfo.Message = "成功"
|
|
|
-// errinfo.Code = 0
|
|
|
-// this.Data["json"] = &errinfo
|
|
|
-// this.ServeJSON()
|
|
|
-// return
|
|
|
-//}
|
|
|
-
|
|
|
-//// @Title 冻存架复制
|
|
|
-//// @Description 冻存架复制
|
|
|
-//// @Success 200 {object} controllers.Request
|
|
|
-//// @router /shelfcopy/:inputstr [put]
|
|
|
-//func (this *ShelfSetController) CopyforShelf() {
|
|
|
-// inputstr := this.Ctx.Input.Param(":inputstr")
|
|
|
-// serial := strings.Split(inputstr, "_")
|
|
|
-// for i := 0; i < len(serial); i++ {
|
|
|
-// println("sdfasdf=f-======", serial[i])
|
|
|
-// }
|
|
|
-// var shelf shelfset.Shelf
|
|
|
-// var box_model []shelfset.Box
|
|
|
-// shelf_model := new(shelfset.Shelf)
|
|
|
-// id := serial[0]
|
|
|
-// data1 := serial[1]
|
|
|
-// data2 := strings.Split(data1, ",")
|
|
|
-// copybox := serial[2]
|
|
|
-// svc := shelfset.GetshelfsetService(utils.DBE)
|
|
|
-// svc.GetEntityByEquipmentId(id, serial[3], serial[4], shelf_model)
|
|
|
-// lastdata := svc.GetLastShelfNum(this.User.AccCode)
|
|
|
-// num_lastdata, _ := utils.StrTo(lastdata[1:]).Int64()
|
|
|
-// for i := 0; i < len(data2); i++ {
|
|
|
-// shelf.AccCode = this.User.AccCode
|
|
|
-// shelf.EquipmentId = shelf_model.EquipmentId
|
|
|
-// shelf.Code = "F" + utils.ToStr(num_lastdata)
|
|
|
-// shelf.ShelfSpecName = shelf_model.ShelfSpecName
|
|
|
-// station := strings.Split(utils.ToStr(data2[i]), ";")
|
|
|
-// fmt.Println(station)
|
|
|
-// shelf.XStation, _ = utils.StrTo(station[0]).Int()
|
|
|
-// shelf.YStation, _ = utils.StrTo(station[1]).Int()
|
|
|
-// shelf.BarCode = "F" + utils.ToStr(num_lastdata)
|
|
|
-// shelf.RowNum = shelf_model.RowNum
|
|
|
-// shelf.ColumnNum = shelf_model.ColumnNum
|
|
|
-// shelf.SampleType = shelf_model.SampleType
|
|
|
-// shelf.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
-// shelf.CreateBy = this.User.Realname
|
|
|
-// num_lastdata = num_lastdata + 1
|
|
|
-// svc.InsertEntity(&shelf)
|
|
|
-// svc1 := currboxcapacity.GetCurrboxcapacityService(utils.DBE)
|
|
|
-// if copybox == "true" {
|
|
|
-// where := "ShelfId=" + utils.ToStr(shelf_model.Id)
|
|
|
-// box_model = svc.BoxListByid(where)
|
|
|
-// lastdata_box := svc.GetLastBoxNum(this.User.AccCode)
|
|
|
-// num_lastdata_box, _ := utils.StrTo(lastdata_box[1:]).Int64()
|
|
|
-// for i := 0; i < len(box_model); i++ {
|
|
|
-// box_model[i].Code = "B" + utils.ToStr(num_lastdata_box)
|
|
|
-// box_model[i].BarCode = "B" + utils.ToStr(num_lastdata_box)
|
|
|
-// box_model[i].ShelfId = shelf.Id
|
|
|
-// box_model[i].CreateBy = this.User.Realname
|
|
|
-// box_model[i].CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
-// num_lastdata_box = num_lastdata_box + 1
|
|
|
-// svc.InsertEntity(&box_model[i])
|
|
|
-// }
|
|
|
-// num_lastdata_box = num_lastdata_box - 1
|
|
|
-// var lastnum lastordernum.LastOrderNum
|
|
|
-// lastnum.LastNum = "B" + utils.ToStr(num_lastdata_box)
|
|
|
-// svc.UpdateBoxNum(lastnum, this.User.AccCode)
|
|
|
-// svc1.RangeCurrboxcapacityByShelfid(utils.ToStr(shelf_model.Id), utils.ToStr(shelf.Id), utils.ToStr(shelf.XStation), utils.ToStr(shelf.YStation))
|
|
|
-// } else {
|
|
|
-// sqlfield := "AccCode,EquipmentId,ShelfId,XStation,YStation,RowNum,ColumnNum,"
|
|
|
-// sqlvalue := "'" + this.User.AccCode + "'," + utils.ToStr(shelf.EquipmentId) + "," + utils.ToStr(shelf.Id) + "," + utils.ToStr(shelf.XStation) + "," + utils.ToStr(shelf.YStation) + "," + utils.ToStr(shelf.RowNum) + "," + utils.ToStr(shelf.ColumnNum) + ","
|
|
|
-// i, j := shelf.RowNum, shelf.ColumnNum
|
|
|
-// for e := 0; e < i; e++ {
|
|
|
-// charname := Boxlinename(e + 1)
|
|
|
-// for f := 0; f < j; f++ {
|
|
|
-// fieldname := fmt.Sprintf("%v%v", charname, f+1)
|
|
|
-// if f == j-1 && e == i-1 {
|
|
|
-// sqlfield += fieldname
|
|
|
-// sqlvalue += "-2"
|
|
|
-// } else {
|
|
|
-// sqlfield += fieldname + ","
|
|
|
-// sqlvalue += "-2,"
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// svc1.Add(sqlfield, sqlvalue)
|
|
|
-// }
|
|
|
-// }
|
|
|
-// num_lastdata = num_lastdata - 1
|
|
|
-// var lastnum_shelf lastordernum.LastOrderNum
|
|
|
-// lastnum_shelf.LastNum = "F" + utils.ToStr(num_lastdata)
|
|
|
-// svc.UpdateShelfNum(lastnum_shelf, this.User.AccCode)
|
|
|
-
|
|
|
-// var errinfo ErrorInfo
|
|
|
-// errinfo.Message = "复制冻存架成功!"
|
|
|
-// errinfo.Code = 0
|
|
|
-// this.Data["json"] = &errinfo
|
|
|
-// this.ServeJSON()
|
|
|
-//}
|
|
|
-
|
|
|
-//// @Title 冻存架复制
|
|
|
-//// @Description 冻存架复制
|
|
|
-//// @Success 200 {object} controllers.Request
|
|
|
-//// @router /boxcopy/:inputstr [put]
|
|
|
-//func (this *ShelfSetController) CopyforBox() {
|
|
|
-// inputstr := this.Ctx.Input.Param(":inputstr")
|
|
|
-// serial := strings.Split(inputstr, "_")
|
|
|
-// for i := 0; i < len(serial); i++ {
|
|
|
-// println("sdfasdf=f-======", serial[i])
|
|
|
-// }
|
|
|
-// var shelf shelfset.Shelf
|
|
|
-// box_model := new(shelfset.Box)
|
|
|
-// var box shelfset.Box
|
|
|
-// var sqlfield_str string
|
|
|
-// //var fieldValue string
|
|
|
-// id := serial[0]
|
|
|
-// data1 := serial[5]
|
|
|
-// data2 := strings.Split(data1, ",")
|
|
|
-// svc := shelfset.GetshelfsetService(utils.DBE)
|
|
|
-// svc.GetEntityByEquipmentId(id, serial[1], serial[2], &shelf)
|
|
|
-// svc.GetEntityByShelfIdXY(utils.ToStr(shelf.Id), serial[3], serial[4], box_model)
|
|
|
-// lastdata_box := svc.GetLastBoxNum(this.User.AccCode)
|
|
|
-// num_lastdata_box, _ := utils.StrTo(lastdata_box[1:]).Int64()
|
|
|
-// for i := 0; i < len(data2); i++ {
|
|
|
-// box.AccCode = this.User.AccCode
|
|
|
-// box.EquipmentId = box_model.EquipmentId
|
|
|
-// box.ShelfId = box_model.ShelfId
|
|
|
-// box.Code = "B" + utils.ToStr(num_lastdata_box)
|
|
|
-// station := strings.Split(utils.ToStr(data2[i]), ";")
|
|
|
-// fmt.Println(station)
|
|
|
-// box.XStation, _ = utils.StrTo(station[0]).Int()
|
|
|
-// box.YStation, _ = utils.StrTo(station[1]).Int()
|
|
|
-// box.BarCode = "B" + utils.ToStr(num_lastdata_box)
|
|
|
-// box.RowNum = box_model.RowNum
|
|
|
-// box.ColumnNum = box_model.ColumnNum
|
|
|
-// box.SampleType = box_model.SampleType
|
|
|
-// box.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
-// box.CreateBy = this.User.Realname
|
|
|
-// num_lastdata_box = num_lastdata_box + 1
|
|
|
-// svc.InsertEntity(&box)
|
|
|
-// charname := Boxlinename(box.YStation)
|
|
|
-// sqlfield := fmt.Sprintf("%v%v", charname, box.XStation)
|
|
|
-// if i == len(data2)-1 {
|
|
|
-// sqlfield_str += sqlfield + "=-1 "
|
|
|
-// //fieldValue+="-1"
|
|
|
-// } else {
|
|
|
-// //sqlfield_str+=sqlfield+","
|
|
|
-// //fieldValue+="-1,"
|
|
|
-// sqlfield_str += sqlfield + "=-1,"
|
|
|
-// }
|
|
|
-
|
|
|
-// }
|
|
|
-// num_lastdata_box = num_lastdata_box - 1
|
|
|
-// var lastnum lastordernum.LastOrderNum
|
|
|
-// lastnum.LastNum = "B" + utils.ToStr(num_lastdata_box)
|
|
|
-// svc.UpdateBoxNum(lastnum, this.User.AccCode)
|
|
|
-// svc1 := currboxcapacity.GetCurrboxcapacityService(utils.DBE)
|
|
|
-// where := "AccCode='" + this.User.AccCode + "' and EquipmentId='" + serial[0] + "' and ShelfId ='" + utils.ToStr(shelf.Id) + "'"
|
|
|
-// svc1.UpdataCopyTo(sqlfield_str, where)
|
|
|
-
|
|
|
-// var errinfo ErrorInfo
|
|
|
-// errinfo.Message = "复制冻存盒成功!"
|
|
|
-// errinfo.Code = 0
|
|
|
-// this.Data["json"] = &errinfo
|
|
|
-// this.ServeJSON()
|
|
|
-//}
|
|
|
-
|
|
|
-//// @Title 删除冻存盒或冻存架
|
|
|
-//// @Description 删除冻存盒或冻存架
|
|
|
-//// @Param code path string true
|
|
|
-//// @Success 200 {object} ErrorInfo
|
|
|
-//// @Failure 403 :code 为空
|
|
|
-//// @router deleteforequip/:inputstr [delete]
|
|
|
-//func (this *ShelfSetController) DeleteforEquipment() {
|
|
|
-// inputstr := this.Ctx.Input.Param(":inputstr")
|
|
|
-// serial := strings.Split(inputstr, "_")
|
|
|
-// println("===ssss=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-", serial[0])
|
|
|
-// println("===ssss=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-", serial[1])
|
|
|
-// println("===ssss=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-", serial[2])
|
|
|
-// println("===ssss=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-", serial[3])
|
|
|
-// var errinfo ErrorInfo
|
|
|
-// var shelf shelfset.Shelf
|
|
|
-// svc1 := currboxcapacity.GetCurrboxcapacityService(utils.DBE)
|
|
|
-// svc := shelfset.GetshelfsetService(utils.DBE)
|
|
|
-
|
|
|
-// if serial[0] == "0" {
|
|
|
-// var shelfempty shelfset.Shelf
|
|
|
-// svc.GetEntityByEquipmentId(serial[3], serial[1], serial[2], &shelf)
|
|
|
-// var currboxcapacitys currboxcapacity.CurrBoxCapacity
|
|
|
-// err := svc1.DeleteCurrbox(currboxcapacitys, utils.ToStr(shelf.Id))
|
|
|
-// // 删除冻存盒
|
|
|
-// where_box := "ShelfId =" + utils.ToStr(shelf.Id)
|
|
|
-// box_list := svc.BoxListByid(where_box)
|
|
|
-// for i := 0; i < len(box_list); i++ {
|
|
|
-// var boxempty shelfset.Box
|
|
|
-// opdesc := "删除冻存盒-" + utils.ToStr(box_list[i].Code) + ",冻存架第" + serial[2] + "行第" + serial[1] + "列,冻存盒第" + utils.ToStr(box_list[i].YStation) + "行第" + utils.ToStr(box_list[i].XStation) + "列"
|
|
|
-// err = svc.DeleteEntityAndWriteLog(box_list[i].Id, &box_list[i], &boxempty, utils.ToStr(this.User.Id), this.User.Username, opdesc, this.User.AccCode, "设备管理")
|
|
|
-// }
|
|
|
-// opdesc := "删除冻存架-" + utils.ToStr(shelf.Id) + ",第" + serial[2] + "行第" + serial[1] + "列"
|
|
|
-// err = svc.DeleteEntityAndWriteLog(shelf.Id, &shelf, &shelfempty, utils.ToStr(this.User.Id), this.User.Username, opdesc, this.User.AccCode, "设备管理")
|
|
|
-// // 错误检测
|
|
|
-// 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()
|
|
|
-// }
|
|
|
-// } else {
|
|
|
-// var box shelfset.Box
|
|
|
-// var boxempty shelfset.Box
|
|
|
-// svc.GetEntityByEquipmentId(serial[3], serial[4], serial[5], &shelf)
|
|
|
-// // 更新颜色
|
|
|
-// x, _ := utils.StrTo(serial[2]).Int()
|
|
|
-// colname := string(x+64) + serial[1]
|
|
|
-// where := "AccCode='" + this.User.AccCode + "' and EquipmentId='" + serial[3] + "' and ShelfId ='" + utils.ToStr(shelf.Id) + "'"
|
|
|
-// err := svc1.Updata(colname, "-2", where)
|
|
|
-// svc.GetBoxBoolByXY(utils.ToStr(shelf.Id), serial[1], serial[2], &box)
|
|
|
-// opdesc := "删除冻存盒-" + box.Code + ",冻存架第" + utils.ToStr(shelf.YStation) + "行第" + utils.ToStr(shelf.XStation) + "列,冻存盒第" + utils.ToStr(box.YStation) + "行第" + utils.ToStr(box.XStation) + "列"
|
|
|
-// err = svc.DeleteEntityAndWriteLog(box.Id, &box, &boxempty, utils.ToStr(this.User.Id), this.User.Username, opdesc, this.User.AccCode, "设备管理")
|
|
|
-// // 错误检测
|
|
|
-// 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 :code 为空
|
|
|
-//// @router deletesample/:id [delete]
|
|
|
-//func (this *ShelfSetController) SampleDelete() {
|
|
|
-// id := this.Ctx.Input.Param(":id")
|
|
|
-// inputarr := strings.Split(id, ",")
|
|
|
-// // 初始化服务
|
|
|
-// var errinfo ErrorInfo
|
|
|
-// svs := samplesinfo.GetSamplesInfoService(utils.DBE)
|
|
|
-// // svc := currboxcapacity.GetCurrboxcapacityService(utils.DBE)
|
|
|
-// // svss := shelfset.GetshelfsetService(utils.DBE)
|
|
|
-// var datamain samplesinfo.SamplesMain
|
|
|
-// var datadetail samplesinfo.SamplesDetail
|
|
|
-// // var testdetail []samplesinfo.SamplesDetail
|
|
|
-// // var shelfcap currboxcapacity.CurrBoxCapacity
|
|
|
-// // var box []shelfset.Box
|
|
|
-// where := "SampleCode = '" + inputarr[1] + "'"
|
|
|
-// svs.GetEntityByWhere(this.User.AccCode+"SamplesMain", where, &datamain)
|
|
|
-// svs.GetEntityByWhere(this.User.AccCode+"SamplesDetail", where, &datadetail)
|
|
|
-// // 更改冻存盒颜色
|
|
|
-// // svc.GetCurrboxcapacityByShelfid(utils.ToStr(datadetail.ShelfId), &shelfcap)
|
|
|
-// // box = svss.GetBoxByid(utils.ToStr(datadetail.BoxId))
|
|
|
-// // colname := string(box[0].YStation+64) + utils.ToStr(box[0].XStation)
|
|
|
-// // where = "BoxId = " + utils.ToStr(datadetail.BoxId)
|
|
|
-// // svs.GetEntitysByWhere(this.User.AccCode+"SamplesDetail", where, &testdetail)
|
|
|
-// // where = "ShelfId = " + utils.ToStr(datadetail.ShelfId)
|
|
|
-// // if len(testdetail) == 1 {
|
|
|
-// // svc.Updata(colname, "-1", where) // 删除最后一个
|
|
|
-// // } else {
|
|
|
-// // svc.Updata(colname, inputarr[0], where)
|
|
|
-// // }
|
|
|
-// // 删除
|
|
|
-// err := svs.DelSMainInfo(this.User.AccCode, datamain.MId)
|
|
|
-// err = svs.DelSDetailInfo(this.User.AccCode, datadetail.Id)
|
|
|
-// // 错误检测
|
|
|
-// if err != nil {
|
|
|
-// errinfo.Message = "添加样本失败!"
|
|
|
-// errinfo.Code = -2
|
|
|
-// this.Data["json"] = &errinfo
|
|
|
-// this.ServeJSON()
|
|
|
-// return
|
|
|
-// }
|
|
|
-//}
|
|
|
+// 冻存盒
|
|
|
+type BoxData struct {
|
|
|
+ Shelfbox shelfset.Shelf
|
|
|
+ Boxshelf shelfset.Box
|
|
|
+ Boxsample []samplesinfo.SamplesInfoShow
|
|
|
+}
|
|
|
+
|
|
|
+// 回传数据model
|
|
|
+type Output struct {
|
|
|
+ Dimension [2]int `json:"dimension,omitempty"` //冰箱尺寸
|
|
|
+ Items interface{} `json:"items,omitempty"` //数据列表
|
|
|
+}
|
|
|
+
|
|
|
+// 添加样本model
|
|
|
+type SampleModel struct {
|
|
|
+ BarCode string `json:"BarCode,omitempty"` // 样本条码
|
|
|
+ SampleCode string `json:"SampleCode,omitempty"` // 样本编码
|
|
|
+ SampleType string `json:"SampleType,omitempty"` // 样本类型
|
|
|
+ SampleTypeName string `json:"SampleTypeName,omitempty"` // 样本类型
|
|
|
+ Zuzhi string `json:"zuzhi,omitempty"` // 组织器官
|
|
|
+ Zuzhiming string `json:"zuzhiming,omitempty"` // 组织器官
|
|
|
+ SamplingSite string `json:"SamplingSite,omitempty"` // 取材部位
|
|
|
+ SamplingSiteName string `json:"SamplingSiteName,omitempty"` // 取材部位
|
|
|
+ Name string `json:"Name,omitempty"` // 名称
|
|
|
+ ReceiveDate time.Time `json:"ReceiveDate,omitempty"` // 接收日期
|
|
|
+ Capacity string `json:"Capacity,omitempty"` // 可用容量
|
|
|
+ Unit string `json:"Unit,omitempty"` // 单位(容量)
|
|
|
+ ValidityDate time.Time `json:"ValidityDate,omitempty"` // 有效日期
|
|
|
+ InnerCode string `json:"InnerCode,omitempty"` // 样本内码
|
|
|
+ SourceName string `json:"SourceName,omitempty"` // 样本来源
|
|
|
+ Remark string `json:"Remark,omitempty"` // 备注
|
|
|
+ PositionStr string `json:"PositionStr,omitempty"` // 位置信息
|
|
|
+}
|
|
|
+
|
|
|
+// 添加冻存盒model
|
|
|
+type BoxModel struct {
|
|
|
+ XBox int `json:"xbox,omitempty"` // 冻存盒x
|
|
|
+ YBox int `json:"ybox,omitempty"` // 冻存盒y
|
|
|
+ XShelf int `json:"xshelf,omitempty"` // 冻存架x
|
|
|
+ YShelf int `json:"yshelf,omitempty"` // 冻存架y
|
|
|
+ SampleType string `json:"sampletype,omitempty"` // 样本类型
|
|
|
+ BarCode string `json:"barcode,omitempty"` // 编码
|
|
|
+ Eid string `json:"eid,omitempty"` // 设备id
|
|
|
+ Boxxvalue int `json:"boxxvalue,omitempty"` // 冻存盒x大小
|
|
|
+ Boxyvalue int `json:"boxyvalue,omitempty"` // 冻存盒y大小
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 报警项目列表
|
|
|
+// @Description 报警项目列表
|
|
|
+// @Success 200 {object} business.device.DeviceChannels
|
|
|
+// @router /equipmentinfo/:eid [get]
|
|
|
+func (this *ShelfSetController) EquipmentInfo() {
|
|
|
+ eid := this.Ctx.Input.Param(":eid")
|
|
|
+ svc := currboxcapacity.GetCurrboxcapacityService(utils.DBE)
|
|
|
+ data := svc.GetCurrboxcapacityByid(eid)
|
|
|
+ fmt.Println("=========================datattatat:", data)
|
|
|
+ // dataStyleScheme := svc.GetStyleScheme("1")
|
|
|
+ svcequipment := equipment.GetEquipmentService(utils.DBE)
|
|
|
+ equipmentdata := svcequipment.GetInfoById(eid)
|
|
|
+ map_list := make(map[string]string)
|
|
|
+ sample_type := sampletype.GetSampleTypeService(utils.DBE)
|
|
|
+ where := " AccCode='" + this.User.AccCode + "'"
|
|
|
+ sample_type_list := sample_type.ListSampleType(where)
|
|
|
+ for i := 0; i < len(sample_type_list); i++ {
|
|
|
+ map_list[utils.ToStr(sample_type_list[i].Id)] = sample_type_list[i].Photo
|
|
|
+ }
|
|
|
+ this.Data["entitySampleType"] = sample_type_list
|
|
|
+ this.Data["map_list"] = map_list
|
|
|
+ this.Data["equipmentdata"] = equipmentdata
|
|
|
+ this.Data["equipmentName"] = equipmentdata.Name
|
|
|
+ this.Data["IsLargeSpec"] = equipmentdata.IsLargeSpec
|
|
|
+ this.Data["json"] = &equipmentdata
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 报警项目列表
|
|
|
+// @Description 报警项目列表
|
|
|
+// @Success 200 {object} business.device.DeviceChannels
|
|
|
+// @router /equipmentdraw/:eid [get]
|
|
|
+func (this *ShelfSetController) EquipmentDraw() {
|
|
|
+ // 读取参数和初始化服务
|
|
|
+ eid := this.Ctx.Input.Param(":eid")
|
|
|
+ svc := currboxcapacity.GetCurrboxcapacityService(utils.DBE)
|
|
|
+ // 获取所有相关冻存架信息
|
|
|
+ data := svc.GetCurrboxcapacityByid(eid)
|
|
|
+ // 获取冰箱尺寸
|
|
|
+ sve := equipment.GetEquipmentService(utils.DBE)
|
|
|
+ entity := sve.GetInfoById(eid)
|
|
|
+ // 回传数据
|
|
|
+ var output Output
|
|
|
+ array := [2]int{entity.ColumnNum, entity.RowNum}
|
|
|
+ output.Items = &data
|
|
|
+ output.Dimension = array
|
|
|
+ this.Data["json"] = &output
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 报警项目列表
|
|
|
+// @Description 报警项目列表
|
|
|
+// @Success 200 {object} business.device.DeviceChannels
|
|
|
+// @router /boxdraw/:inputstr [get]
|
|
|
+func (this *ShelfSetController) BoxDraw() {
|
|
|
+ // 读取参数和初始服务
|
|
|
+ var boxdata BoxData
|
|
|
+ inputstr := this.Ctx.Input.Param(":inputstr")
|
|
|
+ serials := strings.Split(inputstr, ",")
|
|
|
+ id := serials[0]
|
|
|
+ x := serials[1]
|
|
|
+ y := serials[2]
|
|
|
+ x_box := serials[3]
|
|
|
+ y_box := serials[4]
|
|
|
+ svs := shelfset.GetshelfsetService(utils.DBE)
|
|
|
+ // 获取选中box
|
|
|
+ svc := currboxcapacity.GetCurrboxcapacityService(utils.DBE)
|
|
|
+ svc.GetBox(&boxdata.Boxshelf, id, x, y, x_box, y_box)
|
|
|
+ boxdata.Boxsample = nil
|
|
|
+ // 获取样本, where语句IState部分未经修改
|
|
|
+ if boxdata.Boxshelf.Id != 0 {
|
|
|
+ where := " IState in (1,5,10,99) and DeletionStateCode=0 and BoxId = " + utils.ToStr(boxdata.Boxshelf.Id)
|
|
|
+ svc1 := samplesinfo.GetSamplesInfoService(utils.DBE)
|
|
|
+ boxdata.Boxsample = svc1.QuerySampleList(this.User.AccCode, where)
|
|
|
+ }
|
|
|
+ // 获取冻存架
|
|
|
+ svs.GetEntityByEquipmentId(id, x, y, &boxdata.Shelfbox)
|
|
|
+ // 回传数据
|
|
|
+ this.Data["json"] = boxdata
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 报警项目列表
|
|
|
+// @Description 报警项目列表
|
|
|
+// @Success 200 {object} business.device.DeviceChannels
|
|
|
+// @router /getorgan [get]
|
|
|
+func (this *ShelfSetController) GetOrgan() {
|
|
|
+ svo := sampleorgan.GetSampleOrganService(utils.DBE)
|
|
|
+ var list []sampleorgan.SampleOrgan
|
|
|
+ where := " AccCode='" + this.User.AccCode + "' and TNodeParent != ''"
|
|
|
+ list = svo.GetEntityListByWhere(where)
|
|
|
+
|
|
|
+ var datainfo DataInfo
|
|
|
+ datainfo.Items = list
|
|
|
+ this.Data["json"] = &datainfo
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 报警项目列表
|
|
|
+// @Description 报警项目列表
|
|
|
+// @Success 200 {object} business.device.DeviceChannels
|
|
|
+// @router /getpos/:inputstr [get]
|
|
|
+func (this *ShelfSetController) GetPosition() {
|
|
|
+ inputstr := this.Ctx.Input.Param(":inputstr")
|
|
|
+ serial := strings.Split(inputstr, "_")
|
|
|
+ for i := 0; i < len(serial); i++ {
|
|
|
+ // println("sdfasdf=f-======", serial[i])
|
|
|
+ }
|
|
|
+ svs := shelfset.GetshelfsetService(utils.DBE)
|
|
|
+ shelf := svs.GetShelfByid(serial[7])
|
|
|
+ box := svs.GetBoxByid(serial[8])
|
|
|
+
|
|
|
+ posarr := [4]int{shelf[0].XStation, shelf[0].YStation, box[0].XStation, box[0].YStation}
|
|
|
+ var datainfo DataInfo
|
|
|
+ datainfo.Items = posarr
|
|
|
+ this.Data["json"] = &datainfo
|
|
|
+ this.ServeJSON()
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 添加冻存盒或冻存架
|
|
|
+// @Description 添加冻存盒或冻存架
|
|
|
+// @Success 200 {object} business.device.DeviceChannels
|
|
|
+// @router / [post]
|
|
|
+func (this *ShelfSetController) AddforEquipment() {
|
|
|
+ // 获得前端传输的model
|
|
|
+ var model BoxModel
|
|
|
+ var jsonblob = this.Ctx.Input.RequestBody
|
|
|
+ json.Unmarshal(jsonblob, &model)
|
|
|
+ serial := strings.Split(model.Eid, "_")
|
|
|
+ // 日志初始化
|
|
|
+ var lastnum lastordernum.LastOrderNum
|
|
|
+ svss := shelfset.GetshelfsetService(utils.DBE)
|
|
|
+ lastdata := svss.GetLastBoxNum(this.User.AccCode)
|
|
|
+ lastnum.LastNum = lastdata
|
|
|
+ // 其他初始化
|
|
|
+ var errinfo ErrorInfo
|
|
|
+ var shelf shelfset.Shelf
|
|
|
+ var box shelfset.Box
|
|
|
+ var shelfcap currboxcapacity.CurrBoxCapacity
|
|
|
+ svc := currboxcapacity.GetCurrboxcapacityService(utils.DBE)
|
|
|
+ if serial[1] == "1" {
|
|
|
+ // 更新日志
|
|
|
+ svss.UpdateBoxNum(lastnum, this.User.AccCode)
|
|
|
+
|
|
|
+ svss.GetEntityByEquipmentId(serial[0], utils.ToStr(model.XShelf), utils.ToStr(model.YShelf), &shelf)
|
|
|
+ box.AccCode = this.User.AccCode
|
|
|
+ box.BarCode = model.BarCode
|
|
|
+ box.ColumnNum = model.Boxyvalue
|
|
|
+ box.RowNum = model.Boxxvalue
|
|
|
+ box.SampleType = model.SampleType
|
|
|
+ box.XStation = model.XBox
|
|
|
+ box.YStation = model.YBox
|
|
|
+ box.EquipmentId, _ = utils.StrTo(serial[0]).Int()
|
|
|
+ box.ShelfId = shelf.Id
|
|
|
+ box.Code = lastdata
|
|
|
+ box.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
+ box.CreateBy = this.User.Realname
|
|
|
+ // 更新冻存盒颜色
|
|
|
+ svc.GetCurrboxcapacityByShelfid(utils.ToStr(shelf.Id), &shelfcap)
|
|
|
+ colname := string(box.YStation+64) + utils.ToStr(box.XStation)
|
|
|
+ where := "AccCode='" + this.User.AccCode + "' and EquipmentId='" + serial[0] + "' and ShelfId ='" + utils.ToStr(shelf.Id) + "'"
|
|
|
+ err := svc.Updata(colname, "-1", where)
|
|
|
+ // 添加冻存盒
|
|
|
+ _, err = svss.InsertEntity(&box)
|
|
|
+ // 错误检测
|
|
|
+ if err != nil {
|
|
|
+ errinfo.Message = "添加冻存盒失败!"
|
|
|
+ errinfo.Code = -2
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
+ } else {
|
|
|
+ errinfo.Message = "添加冻存盒成功!"
|
|
|
+ errinfo.Code = 0
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 更新日志 添加设备
|
|
|
+ svss.UpdateShelfNum(lastnum, this.User.AccCode)
|
|
|
+ shelf.AccCode = this.User.AccCode
|
|
|
+ shelf.EquipmentId, _ = utils.StrTo(serial[0]).Int()
|
|
|
+ shelf.Code = lastdata
|
|
|
+ shelf.BarCode = model.BarCode
|
|
|
+ shelf.CreateBy = this.User.Realname
|
|
|
+ shelf.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
+ shelf.SampleType = model.SampleType
|
|
|
+ shelf.RowNum = model.YBox
|
|
|
+ shelf.ColumnNum = model.XBox
|
|
|
+ shelf.XStation = model.XShelf
|
|
|
+ shelf.YStation = model.YShelf
|
|
|
+ _, err := svss.InsertEntity(&shelf)
|
|
|
+ // 添加冻存盒颜色----currboxcap
|
|
|
+ var colstr string = "AccCode, EquipmentId, ShelfId, RowNum, ColumnNum, XStation, YStation,"
|
|
|
+ var valuestr string = "'" + this.User.AccCode + "'," + serial[0] + "," + utils.ToStr(shelf.Id) + "," + utils.ToStr(shelf.RowNum) + "," + utils.ToStr(shelf.ColumnNum) + "," + utils.ToStr(shelf.XStation) + "," + utils.ToStr(shelf.YStation) + ","
|
|
|
+ for i := 1; i <= shelf.RowNum; i++ {
|
|
|
+ for j := 1; j <= shelf.ColumnNum; j++ {
|
|
|
+ colstr = colstr + string(i+64) + utils.ToStr(j) + ","
|
|
|
+ valuestr = valuestr + "-2,"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ colstr = colstr[:len(colstr)-1]
|
|
|
+ valuestr = valuestr[:len(valuestr)-1]
|
|
|
+ err = svc.Add(colstr, valuestr)
|
|
|
+ // 错误检测
|
|
|
+ if err != nil {
|
|
|
+ errinfo.Message = "添加冻存架失败!"
|
|
|
+ errinfo.Code = -2
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
+ } else {
|
|
|
+ errinfo.Message = "添加冻存架成功!"
|
|
|
+ errinfo.Code = 0
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 编辑冻存盒或冻存架
|
|
|
+// @Description 编辑冻存盒或冻存架
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
+// @router /editforequip [put]
|
|
|
+func (this *ShelfSetController) EditforEquipment() {
|
|
|
+ var model BoxModel
|
|
|
+ var jsonblob = this.Ctx.Input.RequestBody
|
|
|
+ json.Unmarshal(jsonblob, &model)
|
|
|
+ fmt.Println("==============modddeelll", model)
|
|
|
+ serial := strings.Split(model.Eid, "_")
|
|
|
+ svc := shelfset.GetshelfsetService(utils.DBE)
|
|
|
+ var errinfo ErrorInfo
|
|
|
+ if serial[1] == "2" {
|
|
|
+ //初始化服务
|
|
|
+ var shelfempty shelfset.Shelf
|
|
|
+ var shelf shelfset.Shelf
|
|
|
+ svc.GetEntityByEquipmentId(serial[0], utils.ToStr(model.XShelf), utils.ToStr(model.YShelf), &shelf)
|
|
|
+ //编辑
|
|
|
+ shelf.ModifiedBy = this.User.Realname
|
|
|
+ shelf.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
+ shelf.SampleType = model.SampleType
|
|
|
+ shelf.BarCode = model.BarCode
|
|
|
+ var cols []string = []string{"RowNum", "ColumnNum", "BarCode", "SampleType", "ModifiedUserId", "ModifiedBy"}
|
|
|
+ opdesc := "编辑冻存架-" + shelf.ShelfSpecName + ",第" + utils.ToStr(shelf.YStation) + "行第" + utils.ToStr(shelf.XStation) + "列"
|
|
|
+ err := svc.UpdateEntityAndWriteLog(shelf.Id, &shelf, &shelfempty, cols, utils.ToStr(this.User.Id), this.User.Username, opdesc, this.User.AccCode, "设备管理")
|
|
|
+ // 错误检测
|
|
|
+ if err != nil {
|
|
|
+ errinfo.Message = "编辑冻存架失败!"
|
|
|
+ errinfo.Code = -2
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
+ } else {
|
|
|
+ errinfo.Message = "编辑冻存架成功!"
|
|
|
+ errinfo.Code = 0
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ var box shelfset.Box
|
|
|
+ var boxempty shelfset.Box
|
|
|
+ svc.GetEntityByShelfIdXY(serial[2], utils.ToStr(model.XBox), utils.ToStr(model.YBox), &box)
|
|
|
+ box.ColumnNum = model.Boxyvalue
|
|
|
+ box.RowNum = model.Boxxvalue
|
|
|
+ box.ModifiedBy = this.User.Realname
|
|
|
+ box.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
+ box.SampleType = model.SampleType
|
|
|
+ box.BarCode = model.BarCode
|
|
|
+ var cols []string = []string{"RowNum", "ColumnNum", "BarCode", "SampleType", "ModifiedUserId", "ModifiedBy"}
|
|
|
+ opdesc := "编辑冻存盒-" + box.Code + ",冻存架第" + serial[4] + "行第" + serial[3] + "列,冻存盒第" + utils.ToStr(box.YStation) + "行第" + utils.ToStr(box.XStation) + "列"
|
|
|
+ err := svc.UpdateEntityAndWriteLog(box.Id, &box, &boxempty, cols, utils.ToStr(this.User.Id), this.User.Username, opdesc, this.User.AccCode, "设备管理")
|
|
|
+ // 错误检测
|
|
|
+ if err != nil {
|
|
|
+ errinfo.Message = "编辑冻存盒失败!"
|
|
|
+ errinfo.Code = -2
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
+ } else {
|
|
|
+ errinfo.Message = "编辑冻存盒成功!"
|
|
|
+ errinfo.Code = 0
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 冻存架移动
|
|
|
+// @Description 检测样本类型是否匹配和冻存架移动,分两个方法
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
+// @router /shelfmove/:inputstr [put]
|
|
|
+func (this *ShelfSetController) BeforeMoveShelf() {
|
|
|
+ inputstr := this.Ctx.Input.Param(":inputstr")
|
|
|
+ println("===ssss=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-", inputstr)
|
|
|
+ serial := strings.Split(inputstr, "_")
|
|
|
+ var errinfo ErrorInfo
|
|
|
+ var entity equipment.Equipment
|
|
|
+ var shelf shelfset.Shelf
|
|
|
+ sve := equipment.GetEquipmentService(utils.DBE)
|
|
|
+ svs := shelfset.GetshelfsetService(utils.DBE)
|
|
|
+ where := "Id = " + serial[0]
|
|
|
+ sve.GetEntity(&entity, where)
|
|
|
+ println("ccc-=====================", entity.SampleType)
|
|
|
+ seriale := strings.Split(entity.SampleType, ",")
|
|
|
+ svs.GetEntityByEquipmentId(serial[1], serial[2], serial[3], &shelf)
|
|
|
+ println("xxx-=====================", shelf.SampleType)
|
|
|
+ serials := strings.Split(shelf.SampleType, ",")
|
|
|
+ var exist = false
|
|
|
+ for i := 0; i < len(serials); i++ {
|
|
|
+ for j := 0; j < len(seriale); j++ {
|
|
|
+ if serials[i] == seriale[j] {
|
|
|
+ exist = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if !exist {
|
|
|
+ errinfo.Message = "存在不支持的样本类型!"
|
|
|
+ errinfo.Code = -1
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ exist = false
|
|
|
+ }
|
|
|
+ this.MoveforShelf(utils.ToStr(shelf.Id))
|
|
|
+}
|
|
|
+
|
|
|
+func (this *ShelfSetController) MoveforShelf(shelfid string) {
|
|
|
+ inputstr := this.Ctx.Input.Param(":inputstr")
|
|
|
+ println("===ssss=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-", inputstr)
|
|
|
+ serial := strings.Split(inputstr, "_")
|
|
|
+ var errinfo ErrorInfo
|
|
|
+ var shelf shelfset.Shelf
|
|
|
+ var shelfempty shelfset.Shelf
|
|
|
+ // shelf
|
|
|
+ // equipmentid := serial[1]
|
|
|
+ svc := shelfset.GetshelfsetService(utils.DBE)
|
|
|
+ shelf.EquipmentId, _ = utils.StrTo(serial[0]).Int()
|
|
|
+ shelf.XStation, _ = utils.StrTo(serial[4]).Int()
|
|
|
+ shelf.YStation, _ = utils.StrTo(serial[5]).Int()
|
|
|
+ shelf.ModifiedBy = this.User.Realname
|
|
|
+ shelf.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
+ var cols []string = []string{"EquipmentId", "XStation", "YStation", "ModifiedUserId", "ModifiedBy"}
|
|
|
+ opdesc := "移动冻存架-原位置:" + serial[1] + ",第" + serial[3] + "行第" + serial[2] + "列"
|
|
|
+ svc.UpdateEntityAndWriteLog(shelfid, &shelf, &shelfempty, cols, utils.ToStr(this.User.Id), this.User.Username, opdesc, this.User.AccCode, "设备管理")
|
|
|
+ // 冻存盒颜色
|
|
|
+ var currboxcapacitys currboxcapacity.CurrBoxCapacity
|
|
|
+ svc1 := currboxcapacity.GetCurrboxcapacityService(utils.DBE)
|
|
|
+ currboxcapacitys.EquipmentId, _ = utils.StrTo(serial[0]).Int()
|
|
|
+ currboxcapacitys.ShelfId, _ = utils.StrTo(shelfid).Int()
|
|
|
+ currboxcapacitys.XStation, _ = utils.StrTo(serial[4]).Int()
|
|
|
+ currboxcapacitys.YStation, _ = utils.StrTo(serial[5]).Int()
|
|
|
+ where1 := " AccCode='" + this.User.AccCode + "' and ShelfId=" + shelfid
|
|
|
+ svc1.UpdateEntityByWhere(where1, &currboxcapacitys)
|
|
|
+ // 冻存盒
|
|
|
+ var boxempty shelfset.Box
|
|
|
+ var colss []string = []string{"EquipmentId", "ModifiedUserId", "ModifiedBy"}
|
|
|
+ boxempty.EquipmentId, _ = utils.StrTo(serial[0]).Int()
|
|
|
+ boxempty.ModifiedBy = this.User.Realname
|
|
|
+ boxempty.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
+ where := " AccCode='" + this.User.AccCode + "' and ShelfId=" + shelfid
|
|
|
+ svc.UpdateEntityColsByWhere(&boxempty, where, colss)
|
|
|
+ // 样本---isAddFNum是否记录冻融次数
|
|
|
+ tblDetai := this.User.AccCode + SamplesDetailtbName
|
|
|
+ sql := ""
|
|
|
+ if serial[6] == "true" {
|
|
|
+ sql = "update " + tblDetai + " set EquipmentId=" + serial[0] + ",FreezingNum=FreezingNum+1 where ShelfId=" + shelfid + " and DeletionStateCode=0 and IState in (1,5)"
|
|
|
+ } else {
|
|
|
+ sql = "update " + tblDetai + " set EquipmentId=" + serial[0] + " where ShelfId=" + shelfid + " and DeletionStateCode=0 and IState in (1,5)"
|
|
|
+ }
|
|
|
+ svc.SqlMethod(sql)
|
|
|
+ // 样本
|
|
|
+ var SamplesData []samplesinfo.SamplesInfoShow
|
|
|
+ where = " DeletionStateCode=0 and EquipmentId=" + serial[0] + " and ShelfId=" + shelfid + " and IState in (1,5)"
|
|
|
+ svcSample := samplesinfo.GetSamplesInfoService(utils.DBE)
|
|
|
+ SamplesData = svcSample.QuerySampleList(this.User.AccCode, where)
|
|
|
+
|
|
|
+ svcequipment := equipment.GetEquipmentService(utils.DBE)
|
|
|
+ newequipmententity := svcequipment.GetInfoById(serial[0])
|
|
|
+ newpositon := "-新位置:" + newequipmententity.Name + ",第" + serial[5] + "行第" + serial[4] + "列"
|
|
|
+ //业务记录
|
|
|
+ for i := 0; i < len(SamplesData); i++ {
|
|
|
+ var databuss samplesbusiness.SamplesBusiness
|
|
|
+ databuss.AccCode = this.User.AccCode
|
|
|
+ databuss.OpType = 41
|
|
|
+ databuss.SampleCode = SamplesData[i].SampleCode
|
|
|
+ databuss.BarCode = SamplesData[i].BarCode
|
|
|
+ databuss.SampleType = SamplesData[i].SampleType
|
|
|
+ databuss.CapacityUsed = SamplesData[i].Capacity
|
|
|
+ databuss.CapacityRest = SamplesData[i].Capacity
|
|
|
+ databuss.Unit = SamplesData[i].Unit
|
|
|
+ databuss.EquipmentId = SamplesData[i].EquipmentId
|
|
|
+ databuss.ShelfId = SamplesData[i].ShelfId
|
|
|
+ databuss.BoxId = SamplesData[i].BoxId
|
|
|
+ databuss.Position = SamplesData[i].Position
|
|
|
+ databuss.PositionDesc = svcSample.GetPostiondescByPosId(databuss.EquipmentId, databuss.ShelfId, databuss.BoxId, databuss.Position)
|
|
|
+
|
|
|
+ databuss.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
+ databuss.CreateBy = this.User.Realname
|
|
|
+ databuss.OpDesc = opdesc + "-" + newpositon
|
|
|
+ svcSample.InsertEntityBytbl(this.User.AccCode+SamplesBusstbName, &databuss)
|
|
|
+ }
|
|
|
+ errinfo.Message = "成功"
|
|
|
+ errinfo.Code = 0
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 冻存盒移动
|
|
|
+// @Description 检测样本类型是否匹配和冻存盒移动,分两个方法
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
+// @router /boxmove/:inputstr [put]
|
|
|
+func (this *ShelfSetController) BeforeMoveBox() {
|
|
|
+ inputstr := this.Ctx.Input.Param(":inputstr")
|
|
|
+ serial := strings.Split(inputstr, "_")
|
|
|
+ var errinfo ErrorInfo
|
|
|
+ var entity equipment.Equipment
|
|
|
+ var shelf shelfset.Shelf
|
|
|
+ var box shelfset.Box
|
|
|
+ sve := equipment.GetEquipmentService(utils.DBE)
|
|
|
+ svs := shelfset.GetshelfsetService(utils.DBE)
|
|
|
+ where := "Id = " + serial[0]
|
|
|
+ sve.GetEntity(&entity, where)
|
|
|
+ println("eee-=====================", entity.SampleType)
|
|
|
+ seriale := strings.Split(entity.SampleType, ",")
|
|
|
+ svs.GetEntityByEquipmentId(serial[1], serial[7], serial[8], &shelf)
|
|
|
+ svs.GetEntityByShelfIdXY(utils.ToStr(shelf.Id), serial[2], serial[3], &box)
|
|
|
+ println("bbb-=====================", box.SampleType)
|
|
|
+ serialb := strings.Split(box.SampleType, ",")
|
|
|
+ var exist = false
|
|
|
+ for i := 0; i < len(serialb); i++ {
|
|
|
+ for j := 0; j < len(seriale); j++ {
|
|
|
+ if serialb[i] == seriale[j] {
|
|
|
+ exist = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if !exist {
|
|
|
+ errinfo.Message = "存在不支持的样本类型!"
|
|
|
+ errinfo.Code = -1
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ exist = false
|
|
|
+ }
|
|
|
+ this.MoveforBox(utils.ToStr(box.Id), utils.ToStr(shelf.Id))
|
|
|
+}
|
|
|
+
|
|
|
+func (this *ShelfSetController) MoveforBox(boxid string, shelfoldid string) {
|
|
|
+ inputstr := this.Ctx.Input.Param(":inputstr")
|
|
|
+ println("===ss-=-=-=-=-=-=-=-", inputstr)
|
|
|
+ serial := strings.Split(inputstr, "_")
|
|
|
+ var box shelfset.Box
|
|
|
+ var boxempty shelfset.Box
|
|
|
+ var shelf shelfset.Shelf
|
|
|
+ var errinfo ErrorInfo
|
|
|
+ //equipmentid := this.GetString("equipmentid")
|
|
|
+ svc := shelfset.GetshelfsetService(utils.DBE)
|
|
|
+ svc.GetEntityByEquipmentId(serial[0], serial[9], serial[10], &shelf)
|
|
|
+ // 冻存盒
|
|
|
+ box.EquipmentId, _ = utils.StrTo(serial[0]).Int()
|
|
|
+ box.ShelfId = shelf.Id
|
|
|
+ box.XStation, _ = utils.StrTo(serial[4]).Int()
|
|
|
+ box.YStation, _ = utils.StrTo(serial[5]).Int()
|
|
|
+ box.ModifiedBy = this.User.Realname
|
|
|
+ box.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
+ var cols []string = []string{"EquipmentId", "ShelfId", "XStation", "YStation", "ModifiedUserId", "ModifiedBy"}
|
|
|
+ opdesc := "移动冻存盒-原位置:" + serial[1] + ",冻存架第" + serial[8] + "行第" + serial[7] + "列,冻存盒第" + serial[3] + "行第" + serial[2] + "列"
|
|
|
+ svc.UpdateEntityAndWriteLog(boxid, &box, &boxempty, cols, utils.ToStr(this.User.Id), this.User.Username, opdesc, this.User.AccCode, "设备管理")
|
|
|
+ // 冻存盒颜色
|
|
|
+ svc1 := currboxcapacity.GetCurrboxcapacityService(utils.DBE)
|
|
|
+ ystaion, _ := utils.StrTo(serial[3]).Int()
|
|
|
+ charname := Boxlinename(ystaion)
|
|
|
+ sqlfield := fmt.Sprintf("%v%v", charname, serial[2])
|
|
|
+ where := " EquipmentId='" + serial[1] + "' and ShelfId ='" + shelfoldid + "'"
|
|
|
+ svc1.Updata(sqlfield, "-2", where)
|
|
|
+ ystaion1, _ := utils.StrTo(serial[5]).Int()
|
|
|
+ charname1 := Boxlinename(ystaion1)
|
|
|
+ sqlfield1 := fmt.Sprintf("%v%v", charname1, serial[4])
|
|
|
+ where1 := " EquipmentId='" + serial[0] + "' and ShelfId ='" + utils.ToStr(shelf.Id) + "'"
|
|
|
+ svc1.Updata(sqlfield1, "-1", where1)
|
|
|
+ // 样本----冻融记录
|
|
|
+ tblDetai := this.User.AccCode + SamplesDetailtbName
|
|
|
+ sql := ""
|
|
|
+ if serial[6] == "true" {
|
|
|
+ sql = "update " + tblDetai + " set EquipmentId=" + serial[0] + ",ShelfId=" + utils.ToStr(shelf.Id) + ",FreezingNum=FreezingNum+1 where BoxId=" + boxid + " and DeletionStateCode=0 and IState in (1,5) "
|
|
|
+ } else {
|
|
|
+ sql = "update " + tblDetai + " set EquipmentId=" + serial[0] + ",ShelfId=" + utils.ToStr(shelf.Id) + " where BoxId=" + boxid + " and DeletionStateCode=0 and IState in (1,5) "
|
|
|
+ }
|
|
|
+ svc.SqlMethod(sql)
|
|
|
+ // 样本
|
|
|
+ var SamplesData []samplesinfo.SamplesInfoShow
|
|
|
+ where = " DeletionStateCode=0 and EquipmentId=" + serial[0] + " and ShelfId=" + utils.ToStr(shelf.Id) + " and BoxId=" + boxid + " and IState in (1,5) "
|
|
|
+ svcSample := samplesinfo.GetSamplesInfoService(utils.DBE)
|
|
|
+ SamplesData = svcSample.QuerySampleList(this.User.AccCode, where)
|
|
|
+ svcequipment := equipment.GetEquipmentService(utils.DBE)
|
|
|
+ newequipmententity := svcequipment.GetInfoById(serial[0])
|
|
|
+ newpositon := "新位置:" + newequipmententity.Name + ",冻存架第" + serial[10] + "行第" + serial[9] + "列,冻存盒第" + serial[5] + "行第" + serial[4] + "列"
|
|
|
+ for i := 0; i < len(SamplesData); i++ {
|
|
|
+ var databuss samplesbusiness.SamplesBusiness //业务记录
|
|
|
+ databuss.AccCode = this.User.AccCode
|
|
|
+ databuss.OpType = 41
|
|
|
+ databuss.SampleCode = SamplesData[i].SampleCode
|
|
|
+ databuss.BarCode = SamplesData[i].BarCode
|
|
|
+ databuss.SampleType = SamplesData[i].SampleType
|
|
|
+ databuss.CapacityUsed = SamplesData[i].Capacity
|
|
|
+ databuss.CapacityRest = SamplesData[i].Capacity
|
|
|
+ databuss.Unit = SamplesData[i].Unit
|
|
|
+ databuss.EquipmentId = SamplesData[i].EquipmentId
|
|
|
+ databuss.ShelfId = SamplesData[i].ShelfId
|
|
|
+ databuss.BoxId = SamplesData[i].BoxId
|
|
|
+ databuss.Position = SamplesData[i].Position
|
|
|
+ databuss.PositionDesc = svcSample.GetPostiondescByPosId(databuss.EquipmentId, databuss.ShelfId, databuss.BoxId, databuss.Position)
|
|
|
+
|
|
|
+ databuss.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
+ databuss.CreateBy = this.User.Realname
|
|
|
+ databuss.OpDesc = opdesc + "-" + newpositon
|
|
|
+ svcSample.InsertEntityBytbl(this.User.AccCode+SamplesBusstbName, &databuss)
|
|
|
+ }
|
|
|
+ errinfo.Message = "成功"
|
|
|
+ errinfo.Code = 0
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 冻存架复制
|
|
|
+// @Description 冻存架复制
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
+// @router /shelfcopy/:inputstr [put]
|
|
|
+func (this *ShelfSetController) CopyforShelf() {
|
|
|
+ inputstr := this.Ctx.Input.Param(":inputstr")
|
|
|
+ serial := strings.Split(inputstr, "_")
|
|
|
+ for i := 0; i < len(serial); i++ {
|
|
|
+ println("sdfasdf=f-======", serial[i])
|
|
|
+ }
|
|
|
+ var shelf shelfset.Shelf
|
|
|
+ var box_model []shelfset.Box
|
|
|
+ shelf_model := new(shelfset.Shelf)
|
|
|
+ id := serial[0]
|
|
|
+ data1 := serial[1]
|
|
|
+ data2 := strings.Split(data1, ",")
|
|
|
+ copybox := serial[2]
|
|
|
+ svc := shelfset.GetshelfsetService(utils.DBE)
|
|
|
+ svc.GetEntityByEquipmentId(id, serial[3], serial[4], shelf_model)
|
|
|
+ lastdata := svc.GetLastShelfNum(this.User.AccCode)
|
|
|
+ num_lastdata, _ := utils.StrTo(lastdata[1:]).Int64()
|
|
|
+ for i := 0; i < len(data2); i++ {
|
|
|
+ shelf.AccCode = this.User.AccCode
|
|
|
+ shelf.EquipmentId = shelf_model.EquipmentId
|
|
|
+ shelf.Code = "F" + utils.ToStr(num_lastdata)
|
|
|
+ shelf.ShelfSpecName = shelf_model.ShelfSpecName
|
|
|
+ station := strings.Split(utils.ToStr(data2[i]), ";")
|
|
|
+ fmt.Println(station)
|
|
|
+ shelf.XStation, _ = utils.StrTo(station[0]).Int()
|
|
|
+ shelf.YStation, _ = utils.StrTo(station[1]).Int()
|
|
|
+ shelf.BarCode = "F" + utils.ToStr(num_lastdata)
|
|
|
+ shelf.RowNum = shelf_model.RowNum
|
|
|
+ shelf.ColumnNum = shelf_model.ColumnNum
|
|
|
+ shelf.SampleType = shelf_model.SampleType
|
|
|
+ shelf.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
+ shelf.CreateBy = this.User.Realname
|
|
|
+ num_lastdata = num_lastdata + 1
|
|
|
+ svc.InsertEntity(&shelf)
|
|
|
+ svc1 := currboxcapacity.GetCurrboxcapacityService(utils.DBE)
|
|
|
+ if copybox == "true" {
|
|
|
+ where := "ShelfId=" + utils.ToStr(shelf_model.Id)
|
|
|
+ box_model = svc.BoxListByid(where)
|
|
|
+ lastdata_box := svc.GetLastBoxNum(this.User.AccCode)
|
|
|
+ num_lastdata_box, _ := utils.StrTo(lastdata_box[1:]).Int64()
|
|
|
+ for i := 0; i < len(box_model); i++ {
|
|
|
+ box_model[i].Code = "B" + utils.ToStr(num_lastdata_box)
|
|
|
+ box_model[i].BarCode = "B" + utils.ToStr(num_lastdata_box)
|
|
|
+ box_model[i].ShelfId = shelf.Id
|
|
|
+ box_model[i].CreateBy = this.User.Realname
|
|
|
+ box_model[i].CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
+ num_lastdata_box = num_lastdata_box + 1
|
|
|
+ svc.InsertEntity(&box_model[i])
|
|
|
+ }
|
|
|
+ num_lastdata_box = num_lastdata_box - 1
|
|
|
+ var lastnum lastordernum.LastOrderNum
|
|
|
+ lastnum.LastNum = "B" + utils.ToStr(num_lastdata_box)
|
|
|
+ svc.UpdateBoxNum(lastnum, this.User.AccCode)
|
|
|
+ svc1.RangeCurrboxcapacityByShelfid(utils.ToStr(shelf_model.Id), utils.ToStr(shelf.Id), utils.ToStr(shelf.XStation), utils.ToStr(shelf.YStation))
|
|
|
+ } else {
|
|
|
+ sqlfield := "AccCode,EquipmentId,ShelfId,XStation,YStation,RowNum,ColumnNum,"
|
|
|
+ sqlvalue := "'" + this.User.AccCode + "'," + utils.ToStr(shelf.EquipmentId) + "," + utils.ToStr(shelf.Id) + "," + utils.ToStr(shelf.XStation) + "," + utils.ToStr(shelf.YStation) + "," + utils.ToStr(shelf.RowNum) + "," + utils.ToStr(shelf.ColumnNum) + ","
|
|
|
+ i, j := shelf.RowNum, shelf.ColumnNum
|
|
|
+ for e := 0; e < i; e++ {
|
|
|
+ charname := Boxlinename(e + 1)
|
|
|
+ for f := 0; f < j; f++ {
|
|
|
+ fieldname := fmt.Sprintf("%v%v", charname, f+1)
|
|
|
+ if f == j-1 && e == i-1 {
|
|
|
+ sqlfield += fieldname
|
|
|
+ sqlvalue += "-2"
|
|
|
+ } else {
|
|
|
+ sqlfield += fieldname + ","
|
|
|
+ sqlvalue += "-2,"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ svc1.Add(sqlfield, sqlvalue)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ num_lastdata = num_lastdata - 1
|
|
|
+ var lastnum_shelf lastordernum.LastOrderNum
|
|
|
+ lastnum_shelf.LastNum = "F" + utils.ToStr(num_lastdata)
|
|
|
+ svc.UpdateShelfNum(lastnum_shelf, this.User.AccCode)
|
|
|
+
|
|
|
+ var errinfo ErrorInfo
|
|
|
+ errinfo.Message = "复制冻存架成功!"
|
|
|
+ errinfo.Code = 0
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 冻存架复制
|
|
|
+// @Description 冻存架复制
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
+// @router /boxcopy/:inputstr [put]
|
|
|
+func (this *ShelfSetController) CopyforBox() {
|
|
|
+ inputstr := this.Ctx.Input.Param(":inputstr")
|
|
|
+ serial := strings.Split(inputstr, "_")
|
|
|
+ for i := 0; i < len(serial); i++ {
|
|
|
+ println("sdfasdf=f-======", serial[i])
|
|
|
+ }
|
|
|
+ var shelf shelfset.Shelf
|
|
|
+ box_model := new(shelfset.Box)
|
|
|
+ var box shelfset.Box
|
|
|
+ var sqlfield_str string
|
|
|
+ //var fieldValue string
|
|
|
+ id := serial[0]
|
|
|
+ data1 := serial[5]
|
|
|
+ data2 := strings.Split(data1, ",")
|
|
|
+ svc := shelfset.GetshelfsetService(utils.DBE)
|
|
|
+ svc.GetEntityByEquipmentId(id, serial[1], serial[2], &shelf)
|
|
|
+ svc.GetEntityByShelfIdXY(utils.ToStr(shelf.Id), serial[3], serial[4], box_model)
|
|
|
+ lastdata_box := svc.GetLastBoxNum(this.User.AccCode)
|
|
|
+ num_lastdata_box, _ := utils.StrTo(lastdata_box[1:]).Int64()
|
|
|
+ for i := 0; i < len(data2); i++ {
|
|
|
+ box.AccCode = this.User.AccCode
|
|
|
+ box.EquipmentId = box_model.EquipmentId
|
|
|
+ box.ShelfId = box_model.ShelfId
|
|
|
+ box.Code = "B" + utils.ToStr(num_lastdata_box)
|
|
|
+ station := strings.Split(utils.ToStr(data2[i]), ";")
|
|
|
+ fmt.Println(station)
|
|
|
+ box.XStation, _ = utils.StrTo(station[0]).Int()
|
|
|
+ box.YStation, _ = utils.StrTo(station[1]).Int()
|
|
|
+ box.BarCode = "B" + utils.ToStr(num_lastdata_box)
|
|
|
+ box.RowNum = box_model.RowNum
|
|
|
+ box.ColumnNum = box_model.ColumnNum
|
|
|
+ box.SampleType = box_model.SampleType
|
|
|
+ box.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
+ box.CreateBy = this.User.Realname
|
|
|
+ num_lastdata_box = num_lastdata_box + 1
|
|
|
+ svc.InsertEntity(&box)
|
|
|
+ charname := Boxlinename(box.YStation)
|
|
|
+ sqlfield := fmt.Sprintf("%v%v", charname, box.XStation)
|
|
|
+ if i == len(data2)-1 {
|
|
|
+ sqlfield_str += sqlfield + "=-1 "
|
|
|
+ //fieldValue+="-1"
|
|
|
+ } else {
|
|
|
+ //sqlfield_str+=sqlfield+","
|
|
|
+ //fieldValue+="-1,"
|
|
|
+ sqlfield_str += sqlfield + "=-1,"
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ num_lastdata_box = num_lastdata_box - 1
|
|
|
+ var lastnum lastordernum.LastOrderNum
|
|
|
+ lastnum.LastNum = "B" + utils.ToStr(num_lastdata_box)
|
|
|
+ svc.UpdateBoxNum(lastnum, this.User.AccCode)
|
|
|
+ svc1 := currboxcapacity.GetCurrboxcapacityService(utils.DBE)
|
|
|
+ where := "AccCode='" + this.User.AccCode + "' and EquipmentId='" + serial[0] + "' and ShelfId ='" + utils.ToStr(shelf.Id) + "'"
|
|
|
+ svc1.UpdataCopyTo(sqlfield_str, where)
|
|
|
+
|
|
|
+ var errinfo ErrorInfo
|
|
|
+ errinfo.Message = "复制冻存盒成功!"
|
|
|
+ errinfo.Code = 0
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 删除冻存盒或冻存架
|
|
|
+// @Description 删除冻存盒或冻存架
|
|
|
+// @Param code path string true
|
|
|
+// @Success 200 {object} ErrorInfo
|
|
|
+// @Failure 403 :code 为空
|
|
|
+// @router deleteforequip/:inputstr [delete]
|
|
|
+func (this *ShelfSetController) DeleteforEquipment() {
|
|
|
+ inputstr := this.Ctx.Input.Param(":inputstr")
|
|
|
+ serial := strings.Split(inputstr, "_")
|
|
|
+ println("===ssss=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-", serial[0])
|
|
|
+ println("===ssss=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-", serial[1])
|
|
|
+ println("===ssss=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-", serial[2])
|
|
|
+ println("===ssss=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-", serial[3])
|
|
|
+ var errinfo ErrorInfo
|
|
|
+ var shelf shelfset.Shelf
|
|
|
+ svc1 := currboxcapacity.GetCurrboxcapacityService(utils.DBE)
|
|
|
+ svc := shelfset.GetshelfsetService(utils.DBE)
|
|
|
+
|
|
|
+ if serial[0] == "0" {
|
|
|
+ var shelfempty shelfset.Shelf
|
|
|
+ svc.GetEntityByEquipmentId(serial[3], serial[1], serial[2], &shelf)
|
|
|
+ var currboxcapacitys currboxcapacity.CurrBoxCapacity
|
|
|
+ err := svc1.DeleteCurrbox(currboxcapacitys, utils.ToStr(shelf.Id))
|
|
|
+ // 删除冻存盒
|
|
|
+ where_box := "ShelfId =" + utils.ToStr(shelf.Id)
|
|
|
+ box_list := svc.BoxListByid(where_box)
|
|
|
+ for i := 0; i < len(box_list); i++ {
|
|
|
+ var boxempty shelfset.Box
|
|
|
+ opdesc := "删除冻存盒-" + utils.ToStr(box_list[i].Code) + ",冻存架第" + serial[2] + "行第" + serial[1] + "列,冻存盒第" + utils.ToStr(box_list[i].YStation) + "行第" + utils.ToStr(box_list[i].XStation) + "列"
|
|
|
+ err = svc.DeleteEntityAndWriteLog(box_list[i].Id, &box_list[i], &boxempty, utils.ToStr(this.User.Id), this.User.Username, opdesc, this.User.AccCode, "设备管理")
|
|
|
+ }
|
|
|
+ opdesc := "删除冻存架-" + utils.ToStr(shelf.Id) + ",第" + serial[2] + "行第" + serial[1] + "列"
|
|
|
+ err = svc.DeleteEntityAndWriteLog(shelf.Id, &shelf, &shelfempty, utils.ToStr(this.User.Id), this.User.Username, opdesc, this.User.AccCode, "设备管理")
|
|
|
+ // 错误检测
|
|
|
+ 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()
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ var box shelfset.Box
|
|
|
+ var boxempty shelfset.Box
|
|
|
+ svc.GetEntityByEquipmentId(serial[3], serial[4], serial[5], &shelf)
|
|
|
+ // 更新颜色
|
|
|
+ x, _ := utils.StrTo(serial[2]).Int()
|
|
|
+ colname := string(x+64) + serial[1]
|
|
|
+ where := "AccCode='" + this.User.AccCode + "' and EquipmentId='" + serial[3] + "' and ShelfId ='" + utils.ToStr(shelf.Id) + "'"
|
|
|
+ err := svc1.Updata(colname, "-2", where)
|
|
|
+ svc.GetBoxBoolByXY(utils.ToStr(shelf.Id), serial[1], serial[2], &box)
|
|
|
+ opdesc := "删除冻存盒-" + box.Code + ",冻存架第" + utils.ToStr(shelf.YStation) + "行第" + utils.ToStr(shelf.XStation) + "列,冻存盒第" + utils.ToStr(box.YStation) + "行第" + utils.ToStr(box.XStation) + "列"
|
|
|
+ err = svc.DeleteEntityAndWriteLog(box.Id, &box, &boxempty, utils.ToStr(this.User.Id), this.User.Username, opdesc, this.User.AccCode, "设备管理")
|
|
|
+ // 错误检测
|
|
|
+ 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 :code 为空
|
|
|
+// @router deletesample/:id [delete]
|
|
|
+func (this *ShelfSetController) SampleDelete() {
|
|
|
+ id := this.Ctx.Input.Param(":id")
|
|
|
+ inputarr := strings.Split(id, ",")
|
|
|
+ // 初始化服务
|
|
|
+ var errinfo ErrorInfo
|
|
|
+ svs := samplesinfo.GetSamplesInfoService(utils.DBE)
|
|
|
+ // svc := currboxcapacity.GetCurrboxcapacityService(utils.DBE)
|
|
|
+ // svss := shelfset.GetshelfsetService(utils.DBE)
|
|
|
+ var datamain samplesinfo.SamplesMain
|
|
|
+ var datadetail samplesinfo.SamplesDetail
|
|
|
+ // var testdetail []samplesinfo.SamplesDetail
|
|
|
+ // var shelfcap currboxcapacity.CurrBoxCapacity
|
|
|
+ // var box []shelfset.Box
|
|
|
+ where := "SampleCode = '" + inputarr[1] + "'"
|
|
|
+ svs.GetEntityByWhere(this.User.AccCode+"SamplesMain", where, &datamain)
|
|
|
+ svs.GetEntityByWhere(this.User.AccCode+"SamplesDetail", where, &datadetail)
|
|
|
+ // 更改冻存盒颜色
|
|
|
+ // svc.GetCurrboxcapacityByShelfid(utils.ToStr(datadetail.ShelfId), &shelfcap)
|
|
|
+ // box = svss.GetBoxByid(utils.ToStr(datadetail.BoxId))
|
|
|
+ // colname := string(box[0].YStation+64) + utils.ToStr(box[0].XStation)
|
|
|
+ // where = "BoxId = " + utils.ToStr(datadetail.BoxId)
|
|
|
+ // svs.GetEntitysByWhere(this.User.AccCode+"SamplesDetail", where, &testdetail)
|
|
|
+ // where = "ShelfId = " + utils.ToStr(datadetail.ShelfId)
|
|
|
+ // if len(testdetail) == 1 {
|
|
|
+ // svc.Updata(colname, "-1", where) // 删除最后一个
|
|
|
+ // } else {
|
|
|
+ // svc.Updata(colname, inputarr[0], where)
|
|
|
+ // }
|
|
|
+ // 删除
|
|
|
+ err := svs.DelSMainInfo(this.User.AccCode, datamain.MId)
|
|
|
+ err = svs.DelSDetailInfo(this.User.AccCode, datadetail.Id)
|
|
|
+ // 错误检测
|
|
|
+ if err != nil {
|
|
|
+ errinfo.Message = "添加样本失败!"
|
|
|
+ errinfo.Code = -2
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+}
|