luchm 5 vuotta sitten
vanhempi
commit
faa6b26a74

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

@@ -276,3 +276,12 @@ type Box struct {
 	RowNum int          //盒子行数
 	ColumnNum int		// 盒子列数
 }
+// 冻存架信息
+type Shelf struct {
+	EquipmentId  int // 设备id
+	Id int // 冻存架id
+	XStation   int   // 位置 X代表第几列
+	YStation   int    // 位置 Y代表第几行
+}
+
+

+ 91 - 2
src/dashoo.cn/genepoint_srv/business/converseService/converseService.go

@@ -3,6 +3,7 @@ package converseService
 import (
 	"crypto/md5"
 	"fmt"
+	"github.com/Unknwon/com"
 	"github.com/gogf/gf/os/glog"
 	"log"
 	"strconv"
@@ -582,24 +583,30 @@ func (this *ConverseService) ModifySampleStatusByApplyMainInfo(entryNo string, r
 
 	var operaIds, abnormalIds, taskType string
 	if applyMain.ApplyType == TASK_TUBE_STORING && strings.Contains(resp, "_storing") {
+
+		fmt.Println("开始入库1")
+
 		taskType = "tube_storing" //  冻存管入库
 		// 获取返回报文中成功的样本 和失败的样本
 		operaIds, abnormalIds = this.getOperaSampleIdsStr(applyMain.ApplyType, applyMain.Id, resp, entity)
 
 		//获取报文中的 盒子信息
 		var Rack_id string = entity.Data.Actual_data[0].Rack_id
-		glog.Info("冻存盒盒子编号:", Rack_id)
+		fmt.Println("冻存盒盒子编号:", Rack_id)
 		// 获取报文中的 位置信息和 样本编码
 		var tubes = entity.Data.Actual_data[0].Tubes
-		glog.Info("样本位置信息:", tubes)
+		fmt.Println("样本位置信息:", tubes)
 		//新增方法 更新位置信息
 		defer this.UpdatePosition(Rack_id, tubes)
 
+
 	} else if applyMain.ApplyType == TASK_TUBE_RETREIVING && strings.Contains(resp, "_storing") {
+		fmt.Println("开始入库2")
 		//lite设备 部分管子出库
 		taskType = "tube_retrieving"
 		operaIds, abnormalIds = this.getOperaSampleIdsStr(applyMain.ApplyType, applyMain.Id, resp, entity)
 	} else if applyMain.ApplyType == TASK_TUBE_RETREIVING &&  strings.Contains(resp, "_retrieving") /*resp == "rack_retrieving"*/ /*&& entity.Data.Is_end*/ {
+		fmt.Println("开始入库3")
 		//lite设备 整盒出库
 		taskType = "tube_retrieving"
 		operaIds, abnormalIds = this.getAllSampleIdsFromResEntity(entity)
@@ -607,12 +614,94 @@ func (this *ConverseService) ModifySampleStatusByApplyMainInfo(entryNo string, r
 		return
 	}
 
+	fmt.Println("resp:",resp)
+	// 此处判断,如果是冻存盒整盒入库,需要更新位置信息  盒  冻存盒当前的 所在的冻存架的id
+	if resp == "rack_storing"{
+		this.UpdateBoxInfo(entity)
+	}else if  resp == "rack_retrieving"{
+		// 冻存盒出库任务完成以后,需要清空冻存盒中的冻存架信息,同时清空
+		this.UpdateBoxInfoCK(entity)
+	}
+
+	//
 	this.handleSampleSuccess(operaIds, taskType, applyMain.Id)
 	if entity.Data.Type == "abnormal_end" {
 		this.handleSampleFailed(abnormalIds, taskType, applyMain.Id)
 	}
 }
 
+//2021/01/09 by 卢传敏
+// 根据入库返回报文,更新 冻存盒的信息盒
+func (this *ConverseService) UpdateBoxInfo( entity ResponseEntity )(err error){
+	//1.  获取当前返回的  冻存架信息,
+	var shelf Shelf
+
+	// 循环处理返回的数据,如果出现多盒存入的分批处理
+
+	for i := range entity.Data.Actual_data{
+		boxBarcode := entity.Data.Actual_data[i].Rack_id   // 冻存盒编号
+		Cu := entity.Data.Actual_data[i].Target.Cu			// 设备编号
+		Ltu := entity.Data.Actual_data[i].Target.Ltu		//
+		Unit := entity.Data.Actual_data[i].Target.Unit
+		Pos := entity.Data.Actual_data[i].Target.Pos
+		Group := entity.Data.Actual_data[i].Target.Group
+
+		fmt.Println("保存返回的冻存盒位置信息:cu:",Cu,",Ltu",Ltu,",Unit",Unit,",Group",Group,",Pos",Pos)
+
+		sql := "select a.id,a.XStation,a.YStation from bank_shelf a left join bank_equipment b  on a.EquipmentId = b.id  where  b.cu = '"+utils.ToStr(Cu)+"' " +
+			"and  a.Ltu = '"+utils.ToStr(Ltu)+"' and a.Unit ='"+utils.ToStr(Unit) +"' and a.Group ='"+utils.ToStr(Group)+"'"
+
+		this.DBE.SQL(sql).Get(&shelf)
+		fmt.Println("冻存架信息:",shelf.Id,shelf.XStation,shelf.YStation)
+
+		//  更新盒所在的冻存架的信息  计算位置信息,并更新
+		// 临时处理逻辑,默认 pos 为 盒子的  XStation
+		_,err = this.DBE.Exec("update bank_box set XStation ='"+utils.ToStr(Pos)+"',YStation =1 ,EquipmentId ='"+com.ToStr(shelf.EquipmentId)+"',shelfId ="+utils.ToStr(shelf.Id)+" where boxBarcode ='"+boxBarcode+"' ")
+		// 更新 当前冰箱冻存盒容量 信息
+		_,err = this.DBE.Exec(" update bank_currboxcapacity  set  `A"+utils.ToStr(Pos)+"`= -1 where shelfId ="+utils.ToStr(shelf.Id)+"" )
+
+	}
+	return err
+
+}
+//2021/01/09 by 卢传敏
+// 根据出库返回报文,更新 冻存盒的信息盒
+func (this *ConverseService) UpdateBoxInfoCK( entity ResponseEntity )(err error){
+	//1.  获取当前返回的  冻存架信息,
+	var shelf Shelf
+
+	// 循环处理返回的数据,如果出现多盒存入的分批处理
+
+	for i := range entity.Data.Actual_data{
+		boxBarcode := entity.Data.Actual_data[i].Rack_id   // 冻存盒编号
+		//Cu := entity.Data.Actual_data[i].Target.Cu			// 设备编号
+		//Ltu := entity.Data.Actual_data[i].Target.Ltu		//
+		//Unit := entity.Data.Actual_data[i].Target.Unit
+		Pos := entity.Data.Actual_data[i].Target.Pos
+		//Group := entity.Data.Actual_data[i].Target.Group
+
+		//fmt.Println("保存返回的冻存盒位置信息:cu:",Cu,",Ltu",Ltu,",Unit",Unit,",Group",Group,",Pos",Pos)
+		//
+		//sql := "select a.id,a.XStation,a.YStation from bank_shelf a left join bank_equipment b  on a.EquipmentId = b.id  where  b.cu = '"+utils.ToStr(Cu)+"' " +
+		//	"and  a.Ltu = '"+utils.ToStr(Ltu)+"' and a.Unit ='"+utils.ToStr(Unit) +"' and a.Group ='"+utils.ToStr(Group)+"'"
+
+		//this.DBE.SQL(sql).Get(&shelf)
+		fmt.Println("冻存架信息:",shelf.Id,shelf.XStation,shelf.YStation)
+
+		//  更新盒所在的冻存架的信息  计算位置信息,并更新
+		// 临时处理逻辑,默认 pos 为 盒子的  XStation
+		_,err = this.DBE.Exec("update bank_box set XStation =null,YStation =null ,   where boxBarcode ='"+boxBarcode+"' ")
+		// 更新 当前冰箱冻存盒容量 信息
+		_,err = this.DBE.Exec(" update bank_currboxcapacity  set  `A"+utils.ToStr(Pos)+"`= -2 where shelfId ="+utils.ToStr(shelf.Id)+"" )
+
+	}
+	return err
+
+}
+
+
+
+
 //  20201026 卢传敏新增根据返回报文,更新位置信息
 /**
  * rack_id 盒子编号

+ 1 - 1
src/dashoo.cn/genepoint_srv/controllers/converse/converse.go

@@ -28,7 +28,7 @@ func (this *ConverseController) SearchDatabase() map[string]*RequestEntity {
 	for _, value := range tasks {
 		var time int64 = time.Now().Unix()
 
-		taskid := value.Task_id + "_" + strconv.FormatInt(time, 10)
+		taskid :=/* value.Task_id + "@" +*/ strconv.FormatInt(time, 10)
 		log.Println("taskid:", taskid)
 		//如果没有任务实体, 则创建新任务实体
 		if _, ok := reqMap[value.Task_id]; !ok {