Преглед на файлове

fix(bug): 基点入库

1.  修改基点根据入库报文返回位置信息更新时,样本位置信息错误的问题
luchm преди 4 години
родител
ревизия
cf6d355596

+ 14 - 0
src/dashoo.cn/genepoint_srv/business/converseService/converse.go

@@ -290,10 +290,24 @@ type Equipment struct {
 }
 // 盒子规格信息
 type Box struct {
+	EquipmentId  int // 容器id
+	ShelfId  int  // 冻存架id
 	Id  int    // 盒子id
 	RowNum int          //盒子行数
 	ColumnNum int		// 盒子列数
+	XStation   int   // 位置 X代表第几列
+	YStation   int    // 位置 Y代表第几行
 }
+type EquipmentInfo struct {
+	Id  int    // id
+	Code  string     // 编码
+	Name string   // 名称
+}
+
+
+
+
+
 // 冻存架信息
 type Shelf struct {
 	EquipmentId  int // 设备id

+ 22 - 3
src/dashoo.cn/genepoint_srv/business/converseService/converseService.go

@@ -4,6 +4,7 @@ import (
 	"crypto/md5"
 	"dashoo.cn/genepoint_srv/business/arrangeService"
 	"fmt"
+	"gitee.com/johng/gf/util/gconv"
 	"github.com/Unknwon/com"
 	"github.com/gogf/gf/os/glog"
 	"log"
@@ -907,9 +908,21 @@ func (this *ConverseService) UpdateDetail(BarCode string, entity ResponseEntity,
  */
 func (this *ConverseService) UpdatePosition(rack_id string, tubes []Tube, entity ResponseEntity, parentId int) {
 	// 根据返回的报文中的盒子标识,获取盒子类型
-	sql := "select Id,RowNum,ColumnNum from bank_box where Barcode ='" + rack_id + "'"
+	sql := "select Id,RowNum,ColumnNum,EquipmentId,ShelfId,XStation,YStation   from bank_box where Barcode ='" + rack_id + "'"
 	var box Box
 	this.DBE.SQL(sql).Get(&box)
+
+	// 根据盒子信息获取容器和冻存架信息, 用于更新样本孔位信息
+	//  获取容器信息
+	equipmentsql := " select Id,Code,Name from bank_equipment where id = '"+ gconv.String( box.EquipmentId)+"'   "
+	var equipmentInfo EquipmentInfo
+	this.DBE.SQL(equipmentsql).Get(&equipmentInfo)
+	//  获取架子信息
+	shelfsql := " select Id,XStation,YStation from bank_shelf where id = '"+ gconv.String( box.ShelfId)+"'   "
+	var shelf Shelf
+	this.DBE.SQL(shelfsql).Get(&shelf)
+
+
 	RowNum := box.RowNum
 	ColumnNum := box.ColumnNum
 	glog.Info("冻存盒的行数:", RowNum, ";冻存盒的列数:", ColumnNum)
@@ -929,10 +942,16 @@ func (this *ConverseService) UpdatePosition(rack_id string, tubes []Tube, entity
 		}
 
 		glog.Info("管子在盒子中的位置坐标为:", box_y, ";", box_x)
-		var position = utils.NumberToLetter(box_x) + utils.ToStr(box_y)
-		sql = "update bank_sample set BoxId = '" + utils.ToStr(box.Id) + "',Position = '" + utils.ToStr(box_y) + ";" + utils.ToStr(box_x) + "' ,PositionInfo  = concat( REVERSE(SUBSTR(REVERSE(PositionInfo) FROM INSTR(REVERSE(PositionInfo),'-')+1)),'-" + position + "' ) where barcode ='" + id + "' "
+		//var position = utils.NumberToLetter(box_x) + utils.ToStr(box_y)
+
+		position := equipmentInfo.Code + "-" + utils.NumberToLetter(shelf.YStation) + utils.ToStr(shelf.XStation) + "-" +
+			"" + utils.NumberToLetter(box.YStation) + utils.ToStr(box.XStation) + "-" + utils.NumberToLetter(box_x) + utils.ToStr(box_y)
+		sql = "update bank_sample set BoxId = '" + utils.ToStr(box.Id) + "',Position = '" + utils.ToStr(box_y) + ";" +
+			"" + utils.ToStr(box_x) + "',PositionInfo = '"+position+"'  where barcode ='" + id + "' "
 		//执行sql 更新位置和坐标信息
 		this.DBE.Exec(sql)
+
+
 		this.UpdateDetail(id, entity, parentId, rack_id)
 	}
 }