|
@@ -770,6 +770,96 @@ func (this *EquipmentController) AddEquipment() {
|
|
|
lastnum_shelf.LastNum = "F" + utils.ToStr(num_lastdata)
|
|
lastnum_shelf.LastNum = "F" + utils.ToStr(num_lastdata)
|
|
|
svcshelf.UpdateShelfNum(lastnum_shelf, this.User.AccCode)
|
|
svcshelf.UpdateShelfNum(lastnum_shelf, this.User.AccCode)
|
|
|
|
|
|
|
|
|
|
+ } else if model.DItem == 22 {
|
|
|
|
|
+ shelf_x_int := 1
|
|
|
|
|
+ shelf_y_int := 13
|
|
|
|
|
+ box_x_int := 10
|
|
|
|
|
+ box_y_int := 10
|
|
|
|
|
+ svcshelf := shelfset.GetshelfsetService(utils.DBE)
|
|
|
|
|
+ lastdata := svcshelf.GetLastShelfNum(this.User.AccCode)
|
|
|
|
|
+ num_lastdata, _ := utils.StrTo(lastdata[1:]).Int64()
|
|
|
|
|
+ lastdata_box := svcshelf.GetLastBoxNum(this.User.AccCode)
|
|
|
|
|
+ num_lastdata_box, _ := utils.StrTo(lastdata_box[1:]).Int64()
|
|
|
|
|
+ for i := 1; i <= equip.RowNum; i++ {
|
|
|
|
|
+ for j := 1; j <= equip.ColumnNum; j++ {
|
|
|
|
|
+ var shelfempty shelfset.Shelf
|
|
|
|
|
+ shelfempty.AccCode = this.User.AccCode
|
|
|
|
|
+ shelfempty.EquipmentId = equip.Id
|
|
|
|
|
+ shelfempty.Code = "F" + utils.ToStr(num_lastdata)
|
|
|
|
|
+ shelfempty.BarCode = "F" + utils.ToStr(num_lastdata)
|
|
|
|
|
+ shelfempty.RowNum = shelf_x_int
|
|
|
|
|
+ shelfempty.ColumnNum = shelf_y_int
|
|
|
|
|
+ shelfempty.XStation = j
|
|
|
|
|
+ shelfempty.YStation = i
|
|
|
|
|
+ shelfempty.SampleType = equip.SampleType
|
|
|
|
|
+ shelfempty.CreateBy = this.User.Realname
|
|
|
|
|
+ shelfempty.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
|
|
+ num_lastdata = num_lastdata + 1
|
|
|
|
|
+ _, err = svcshelf.InsertEntity(&shelfempty)
|
|
|
|
|
+ sqlfield := " AccCode,EquipmentId,ShelfId,XStation,YStation,RowNum,ColumnNum,"
|
|
|
|
|
+ sqlvalue := "'" + this.User.AccCode + "'," + utils.ToStr(equip.Id) + "," + utils.ToStr(shelfempty.Id) + "," + utils.ToStr(j) + "," + utils.ToStr(i) + "," + utils.ToStr(shelf_x_int) + "," + utils.ToStr(shelf_y_int) + ","
|
|
|
|
|
+ ii, jj := shelf_x_int, shelf_y_int
|
|
|
|
|
+ //添加冻存盒
|
|
|
|
|
+ if box_x_int > 0 && box_y_int > 0 {
|
|
|
|
|
+ for e := 0; e < ii; e++ {
|
|
|
|
|
+ charname := Boxlinename(e + 1)
|
|
|
|
|
+ for f := 0; f < jj; f++ {
|
|
|
|
|
+ fieldname := fmt.Sprintf("%v%v", charname, f+1)
|
|
|
|
|
+ if f == jj-1 && e == ii-1 {
|
|
|
|
|
+ sqlfield += fieldname
|
|
|
|
|
+ sqlvalue += "-1"
|
|
|
|
|
+ } else {
|
|
|
|
|
+ sqlfield += fieldname + ","
|
|
|
|
|
+ sqlvalue += "-1,"
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ for a := 1; a <= shelf_x_int; a++ {
|
|
|
|
|
+ for b := 1; b <= shelf_y_int; b++ {
|
|
|
|
|
+ var boxempty shelfset.Box
|
|
|
|
|
+ boxempty.AccCode = this.User.AccCode
|
|
|
|
|
+ boxempty.EquipmentId = equip.Id
|
|
|
|
|
+ boxempty.ShelfId = shelfempty.Id
|
|
|
|
|
+ boxempty.Code = "B" + utils.ToStr(num_lastdata_box)
|
|
|
|
|
+ boxempty.BarCode = "B" + utils.ToStr(num_lastdata_box)
|
|
|
|
|
+ boxempty.YStation = a
|
|
|
|
|
+ boxempty.XStation = b
|
|
|
|
|
+ boxempty.RowNum = box_x_int
|
|
|
|
|
+ boxempty.ColumnNum = box_y_int
|
|
|
|
|
+ boxempty.SampleType = equip.SampleType
|
|
|
|
|
+ boxempty.CreateBy = this.User.Realname
|
|
|
|
|
+ boxempty.CreateBy = this.User.Realname
|
|
|
|
|
+ num_lastdata_box = num_lastdata_box + 1
|
|
|
|
|
+ _, err = svc.InsertEntity(&boxempty)
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ for e := 0; e < ii; e++ {
|
|
|
|
|
+ charname := Boxlinename(e + 1)
|
|
|
|
|
+ for f := 0; f < jj; f++ {
|
|
|
|
|
+ fieldname := fmt.Sprintf("%v%v", charname, f+1)
|
|
|
|
|
+ if f == jj-1 && e == ii-1 {
|
|
|
|
|
+ sqlfield += fieldname
|
|
|
|
|
+ sqlvalue += "-2"
|
|
|
|
|
+ } else {
|
|
|
|
|
+ sqlfield += fieldname + ","
|
|
|
|
|
+ sqlvalue += "-2,"
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ svc1 := currboxcapacity.GetCurrboxcapacityService(utils.DBE)
|
|
|
|
|
+ svc1.Add(sqlfield, sqlvalue)
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ num_lastdata_box = num_lastdata_box - 1
|
|
|
|
|
+ var lastnum lastordernum.LastOrderNum
|
|
|
|
|
+ lastnum.LastNum = "B" + utils.ToStr(num_lastdata_box)
|
|
|
|
|
+ svcshelf.UpdateBoxNum(lastnum, this.User.AccCode)
|
|
|
|
|
+ num_lastdata = num_lastdata - 1
|
|
|
|
|
+ var lastnum_shelf lastordernum.LastOrderNum
|
|
|
|
|
+ lastnum_shelf.LastNum = "F" + utils.ToStr(num_lastdata)
|
|
|
|
|
+ svcshelf.UpdateShelfNum(lastnum_shelf, this.User.AccCode)
|
|
|
} else {
|
|
} else {
|
|
|
|
|
|
|
|
if model.Shelf_X > 0 && model.Shelf_y > 0 {
|
|
if model.Shelf_X > 0 && model.Shelf_y > 0 {
|