|
|
@@ -483,6 +483,7 @@ func (this *EquipmentController) AddEquipment() {
|
|
|
equip.Item = 1 // 立式 取消了这项选择
|
|
|
equip.RowNum = model.RowNum
|
|
|
equip.ColumnNum = model.ColumnNum
|
|
|
+ equip.DItem = model.DItem
|
|
|
equip.Width, _ = utils.StrTo(model.Width).Float32()
|
|
|
equip.Height, _ = utils.StrTo(model.Height).Float32()
|
|
|
equip.Depth, _ = utils.StrTo(model.Depth).Float32()
|
|
|
@@ -530,74 +531,84 @@ func (this *EquipmentController) AddEquipment() {
|
|
|
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,"
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ err = addShelfAndBox(this.User.AccCode, this.User.Realname, this.User.Id, num_lastdata, num_lastdata_box,
|
|
|
+ shelf_x_int, shelf_y_int, box_x_int, box_y_int, i, j, equip,
|
|
|
+ svcshelf, svc)
|
|
|
+ if err != nil {
|
|
|
+ errinfo.Message = "冻存盒架子添加!" + err.Error()
|
|
|
+ errinfo.Code = -2
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
}
|
|
|
- svc1 := currboxcapacity.GetCurrboxcapacityService(utils.DBE)
|
|
|
- svc1.Add(sqlfield, sqlvalue)
|
|
|
+ //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
|
|
|
@@ -621,74 +632,16 @@ func (this *EquipmentController) AddEquipment() {
|
|
|
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,"
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ err = addShelfAndBox(this.User.AccCode, this.User.Realname, this.User.Id, num_lastdata, num_lastdata_box,
|
|
|
+ shelf_x_int, shelf_y_int, box_x_int, box_y_int, i, j, equip,
|
|
|
+ svcshelf, svc)
|
|
|
+ if err != nil {
|
|
|
+ errinfo.Message = "冻存盒架子添加!" + err.Error()
|
|
|
+ errinfo.Code = -2
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
}
|
|
|
- svc1 := currboxcapacity.GetCurrboxcapacityService(utils.DBE)
|
|
|
- svc1.Add(sqlfield, sqlvalue)
|
|
|
}
|
|
|
}
|
|
|
num_lastdata_box = num_lastdata_box - 1
|
|
|
@@ -724,74 +677,16 @@ func (this *EquipmentController) AddEquipment() {
|
|
|
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,"
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ err = addShelfAndBox(this.User.AccCode, this.User.Realname, this.User.Id, num_lastdata, num_lastdata_box,
|
|
|
+ shelf_x_int, shelf_y_int, box_x_int, box_y_int, i, j, equip,
|
|
|
+ svcshelf, svc)
|
|
|
+ if err != nil {
|
|
|
+ errinfo.Message = "冻存盒架子添加!" + err.Error()
|
|
|
+ errinfo.Code = -2
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
}
|
|
|
- svc1 := currboxcapacity.GetCurrboxcapacityService(utils.DBE)
|
|
|
- svc1.Add(sqlfield, sqlvalue)
|
|
|
}
|
|
|
}
|
|
|
num_lastdata_box = num_lastdata_box - 1
|
|
|
@@ -815,74 +710,16 @@ func (this *EquipmentController) AddEquipment() {
|
|
|
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,"
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ err = addShelfAndBox(this.User.AccCode, this.User.Realname, this.User.Id, num_lastdata, num_lastdata_box,
|
|
|
+ shelf_x_int, shelf_y_int, box_x_int, box_y_int, i, j, equip,
|
|
|
+ svcshelf, svc)
|
|
|
+ if err != nil {
|
|
|
+ errinfo.Message = "冻存盒架子添加!" + err.Error()
|
|
|
+ errinfo.Code = -2
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
}
|
|
|
- svc1 := currboxcapacity.GetCurrboxcapacityService(utils.DBE)
|
|
|
- svc1.Add(sqlfield, sqlvalue)
|
|
|
}
|
|
|
}
|
|
|
num_lastdata_box = num_lastdata_box - 1
|
|
|
@@ -905,74 +742,16 @@ func (this *EquipmentController) AddEquipment() {
|
|
|
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,"
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ err = addShelfAndBox(this.User.AccCode, this.User.Realname, this.User.Id, num_lastdata, num_lastdata_box,
|
|
|
+ shelf_x_int, shelf_y_int, box_x_int, box_y_int, i, j, equip,
|
|
|
+ svcshelf, svc)
|
|
|
+ if err != nil {
|
|
|
+ errinfo.Message = "冻存盒架子添加!" + err.Error()
|
|
|
+ errinfo.Code = -2
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
}
|
|
|
- svc1 := currboxcapacity.GetCurrboxcapacityService(utils.DBE)
|
|
|
- svc1.Add(sqlfield, sqlvalue)
|
|
|
}
|
|
|
}
|
|
|
num_lastdata_box = num_lastdata_box - 1
|
|
|
@@ -1025,74 +804,16 @@ func (this *EquipmentController) AddEquipment() {
|
|
|
continue
|
|
|
}
|
|
|
}
|
|
|
- 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,"
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ err = addShelfAndBox(this.User.AccCode, this.User.Realname, this.User.Id, num_lastdata, num_lastdata_box,
|
|
|
+ shelf_x_int, shelf_y_int, box_x_int, box_y_int, i, j, equip,
|
|
|
+ svcshelf, svc)
|
|
|
+ if err != nil {
|
|
|
+ errinfo.Message = "冻存盒架子添加!" + err.Error()
|
|
|
+ errinfo.Code = -2
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
}
|
|
|
- svc1 := currboxcapacity.GetCurrboxcapacityService(utils.DBE)
|
|
|
- svc1.Add(sqlfield, sqlvalue)
|
|
|
}
|
|
|
}
|
|
|
num_lastdata_box = num_lastdata_box - 1
|
|
|
@@ -1104,7 +825,7 @@ func (this *EquipmentController) AddEquipment() {
|
|
|
lastnum_shelf.LastNum = "F" + utils.ToStr(num_lastdata)
|
|
|
svcshelf.UpdateShelfNum(lastnum_shelf, this.User.AccCode)
|
|
|
|
|
|
- }else if model.DItem == 25 { // Thermo Fisher CE8120
|
|
|
+ } else if model.DItem == 25 {
|
|
|
shelf_x_int := 1
|
|
|
shelf_y_int := 1
|
|
|
box_x_int := 1
|
|
|
@@ -1114,97 +835,42 @@ func (this *EquipmentController) AddEquipment() {
|
|
|
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 i := 1; i <= equip.RowNum; i++ { //40
|
|
|
for j := 1; j <= equip.ColumnNum; j++ {
|
|
|
- if j == 4 { //第4个为小型格4行5x5冻存盒
|
|
|
+ if j >= 1 && i <= 4 {
|
|
|
shelf_x_int = 1
|
|
|
- shelf_y_int = 14
|
|
|
- box_x_int = 5
|
|
|
- box_y_int = 5
|
|
|
- } else { //其他为大型格14行9*9冻存盒
|
|
|
+ shelf_y_int = 4
|
|
|
+ box_x_int = 9
|
|
|
+ box_y_int = 9
|
|
|
+ } else if i >= 5 && i <= 10 {
|
|
|
shelf_x_int = 1
|
|
|
- shelf_y_int = 14
|
|
|
+ shelf_y_int = 6
|
|
|
box_x_int = 9
|
|
|
box_y_int = 9
|
|
|
- }
|
|
|
- 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)
|
|
|
- }
|
|
|
+ if j > 6 {
|
|
|
+ continue
|
|
|
}
|
|
|
- } 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,"
|
|
|
- }
|
|
|
- }
|
|
|
+ } else if i >= 11 && i <= 40 {
|
|
|
+ shelf_x_int = 1
|
|
|
+ shelf_y_int = 12
|
|
|
+ box_x_int = 10
|
|
|
+ box_y_int = 10
|
|
|
+ if j > 30 {
|
|
|
+ continue
|
|
|
}
|
|
|
}
|
|
|
- svc1 := currboxcapacity.GetCurrboxcapacityService(utils.DBE)
|
|
|
- svc1.Add(sqlfield, sqlvalue)
|
|
|
+ err = addShelfAndBox(this.User.AccCode, this.User.Realname, this.User.Id, num_lastdata, num_lastdata_box,
|
|
|
+ shelf_x_int, shelf_y_int, box_x_int, box_y_int, i, j, equip,
|
|
|
+ svcshelf, svc)
|
|
|
+ if err != nil {
|
|
|
+ errinfo.Message = "冻存盒架子添加!" + err.Error()
|
|
|
+ errinfo.Code = -2
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- 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 {
|
|
|
@@ -1219,74 +885,16 @@ func (this *EquipmentController) AddEquipment() {
|
|
|
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,"
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ err = addShelfAndBox(this.User.AccCode, this.User.Realname, this.User.Id, num_lastdata, num_lastdata_box,
|
|
|
+ shelf_x_int, shelf_y_int, box_x_int, box_y_int, i, j, equip,
|
|
|
+ svcshelf, svc)
|
|
|
+ if err != nil {
|
|
|
+ errinfo.Message = "冻存盒架子添加!" + err.Error()
|
|
|
+ errinfo.Code = -2
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
}
|
|
|
- svc1 := currboxcapacity.GetCurrboxcapacityService(utils.DBE)
|
|
|
- svc1.Add(sqlfield, sqlvalue)
|
|
|
}
|
|
|
}
|
|
|
num_lastdata_box = num_lastdata_box - 1
|
|
|
@@ -1325,6 +933,83 @@ func (this *EquipmentController) AddEquipment() {
|
|
|
this.ServeJSON()
|
|
|
}
|
|
|
|
|
|
+// 同步添加冻存架和冻存盒 姜立伟 2021-08-16
|
|
|
+func addShelfAndBox(accCode, realName, userId string, num_lastdata, num_lastdata_box int64, shelfX, shelfY, boxX, boxY,
|
|
|
+ i, j int, equipment equipment.Equipment, svcshelf *shelfset.ShelfsetService, svc *equipment.EquipmentService) error{
|
|
|
+ var shelfempty shelfset.Shelf
|
|
|
+ shelfempty.AccCode = accCode
|
|
|
+ shelfempty.EquipmentId = equipment.Id
|
|
|
+ shelfempty.Code = "F" + utils.ToStr(num_lastdata)
|
|
|
+ shelfempty.BarCode = "F" + utils.ToStr(num_lastdata)
|
|
|
+ shelfempty.RowNum = shelfX
|
|
|
+ shelfempty.ColumnNum = shelfY
|
|
|
+ shelfempty.XStation = j
|
|
|
+ shelfempty.YStation = i
|
|
|
+ shelfempty.SampleType = equipment.SampleType
|
|
|
+ shelfempty.CreateBy = realName
|
|
|
+ shelfempty.CreateUserId, _ = utils.StrTo(userId).Int()
|
|
|
+ num_lastdata = num_lastdata + 1
|
|
|
+ _, err := svcshelf.InsertEntity(&shelfempty)
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ sqlfield := " AccCode,EquipmentId,ShelfId,XStation,YStation,RowNum,ColumnNum,"
|
|
|
+ sqlvalue := "'" + accCode + "'," + utils.ToStr(equipment.Id) + "," + utils.ToStr(shelfempty.Id) + "," + utils.ToStr(j) + "," + utils.ToStr(i) + "," + utils.ToStr(shelfX) + "," + utils.ToStr(shelfY) + ","
|
|
|
+ ii, jj := shelfX, shelfY
|
|
|
+ //添加冻存盒
|
|
|
+ if boxX > 0 && boxY > 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 <= shelfX; a++ {
|
|
|
+ for b := 1; b <= shelfY; b++ {
|
|
|
+ var boxempty shelfset.Box
|
|
|
+ boxempty.AccCode = accCode
|
|
|
+ boxempty.EquipmentId = equipment.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 = boxX
|
|
|
+ boxempty.ColumnNum = boxY
|
|
|
+ boxempty.SampleType = equipment.SampleType
|
|
|
+ boxempty.CreateBy = realName
|
|
|
+ boxempty.CreateBy = 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)
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
// @Title 删除容器设备
|
|
|
// @Description 删除容器设备
|
|
|
// @Param code path string true "需要删除的传感器编号"
|