|
|
@@ -3,6 +3,7 @@ package converseService
|
|
|
import (
|
|
|
"crypto/md5"
|
|
|
"fmt"
|
|
|
+ "github.com/gogf/gf/os/glog"
|
|
|
"log"
|
|
|
"strconv"
|
|
|
"strings"
|
|
|
@@ -173,7 +174,7 @@ func (this *ConverseService) GenerateRequestEntity(taskType int, task_id string)
|
|
|
case 2:
|
|
|
requestName = "rack_retrieving"
|
|
|
break
|
|
|
- case 3:
|
|
|
+ case 3,8:
|
|
|
requestName = "tube_storing"
|
|
|
break
|
|
|
case 4:
|
|
|
@@ -204,10 +205,10 @@ func (this *ConverseService) HandleTaskDetail(taskType int, entity *RequestEntit
|
|
|
case 1:
|
|
|
handleRackStore(entity, detail)
|
|
|
break
|
|
|
- case 2:
|
|
|
+ case 2: //出库
|
|
|
handleRackRetrieve(entity, detail)
|
|
|
break
|
|
|
- case 3:
|
|
|
+ case 3,8: //冻存管 入库
|
|
|
handleTubeStore(entity, detail)
|
|
|
break
|
|
|
case 4:
|
|
|
@@ -479,6 +480,9 @@ func (this *ConverseService) handleSampleSuccess(idsStr string, response string,
|
|
|
func (this *ConverseService) sampleRKSuccessDBModify(idsStr string, parentId int) error {
|
|
|
updatesql := "UPDATE " + TABLE_APPLY_DETAIL + " SET IsLocked = '" + STATUS_UNLOCK + "', taskstatus = '" + strconv.Itoa(SUCCESS) + "' WHERE barcode IN (" + idsStr + ")" + " AND parentid = '" + strconv.Itoa(parentId) + "'"
|
|
|
updatesql2 := "UPDATE " + TABLE_SAMPLE + " SET IsLocked = '" + STATUS_UNLOCK + "', IState = '" + RK_PASS + "' WHERE barcode IN (" + idsStr + ")"
|
|
|
+
|
|
|
+ //更新每个样本的孔位信息
|
|
|
+
|
|
|
_, err := this.DBE.Exec(updatesql)
|
|
|
_, err = this.DBE.Exec(updatesql2)
|
|
|
return err
|
|
|
@@ -515,14 +519,26 @@ func (this *ConverseService) GetApplyMain(entryNo string) Bank_Apply_Main {
|
|
|
return entity
|
|
|
}
|
|
|
|
|
|
+
|
|
|
//根据出入库单信息判断任务信息, 并修改样本状态
|
|
|
func (this *ConverseService) ModifySampleStatusByApplyMainInfo(entryNo string, resp string, entity ResponseEntity) {
|
|
|
|
|
|
applyMain := this.GetApplyMain(entryNo)
|
|
|
var operaIds, abnormalIds, taskType string
|
|
|
if applyMain.ApplyType == TASK_TUBE_STORING && strings.Contains(resp, "_storing") {
|
|
|
- taskType = "tube_storing"
|
|
|
+ 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)
|
|
|
+ // 获取报文中的 位置信息和 样本编码
|
|
|
+ var tubes = entity.Data.Actual_data[0].Tubes
|
|
|
+ glog.Info("样本位置信息:",tubes)
|
|
|
+ //新增方法 更新位置信息
|
|
|
+ defer this.UpdatePosition(Rack_id,tubes)
|
|
|
+
|
|
|
+
|
|
|
} else if applyMain.ApplyType == TASK_TUBE_RETREIVING && strings.Contains(resp, "_storing") {
|
|
|
//lite设备 部分管子出库
|
|
|
taskType = "tube_retrieving"
|
|
|
@@ -541,8 +557,38 @@ func (this *ConverseService) ModifySampleStatusByApplyMainInfo(entryNo string, r
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+// 20201026 卢传敏新增根据返回报文,更新位置信息
|
|
|
+/**
|
|
|
+ * rack_id 盒子编号
|
|
|
+ * tubes 报文中返回的 位置和样本条码
|
|
|
+ */
|
|
|
+func (this *ConverseService) UpdatePosition(rack_id string ,tubes []Tube){
|
|
|
+ // 根据返回的报文中的盒子标识,获取盒子类型
|
|
|
+ sql := "select RowNum,ColumnNum from bank_box where Barcode ='"+rack_id+"'"
|
|
|
+ var box Box
|
|
|
+ this.DBE.SQL(sql).Get(&box)
|
|
|
+ RowNum := box.RowNum
|
|
|
+ ColumnNum := box.ColumnNum
|
|
|
+ glog.Info("冻存盒的行数:",RowNum,";冻存盒的列数:",ColumnNum)
|
|
|
+ for i:=0;i<len(tubes);i++ {
|
|
|
+ no := tubes[i].No
|
|
|
+ id := tubes[i].Id
|
|
|
+ glog.Info("样本在盒子中的位置:",no,";样本条码: ",id)
|
|
|
+ //计算管子在盒子中的坐标
|
|
|
+ box_x := (no/RowNum)+1
|
|
|
+ box_y := no-(RowNum*box_x)
|
|
|
+ glog.Info("管子在盒子中的位置坐标为:",box_y,":",box_x)
|
|
|
+ var position = utils.NumberToLetter(box_x)+utils.ToStr(box_y)
|
|
|
+ sql ="update bank_sample set Position = '"+utils.ToStr(box_y)+":"+utils.ToStr(box_x)+"' ,PositionInfo = concat(PositionInfo,'-"+position+"' ) where barcode ='"+id+"' "
|
|
|
+ //执行sql 更新位置和坐标信息
|
|
|
+ this.DBE.Exec(sql)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
//获取当前操作样本的id, 正常和异常的
|
|
|
-func (this *ConverseService) getOperaSampleIdsStr(applyType, parentId int, resp string, entity ResponseEntity) (actualIds string, abnormalIds string) {
|
|
|
+func (this *ConverseService) getOperaSampleIdsStr(applyType, parentId int, resp string, entity ResponseEntity) (actualIds string, abnormalIds string,) {
|
|
|
|
|
|
//获取出入库单中所有样本信息
|
|
|
var list []Bank_Apply_Detail
|