|
|
@@ -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 盒子编号
|