luchm 5 лет назад
Родитель
Сommit
f5d2891a0a

+ 28 - 4
src/dashoo.cn/genepoint_srv/business/converseService/converseService.go

@@ -397,6 +397,21 @@ func (this *ConverseService) SampleApplyStatusModify(statusCode int, entryNo str
 	return err
 }
 
+//2020/12/18新增  根据当前任务报文返回状态批量更新当前任务下所有的样本状态
+func (this *ConverseService)SampleApplyDetailStatusModify(statusCode int , entryNo string) error {
+
+	//获取出入库单Id
+	getId := "SELECT id FROM " + TABLE_SAMPLE_APPLY + " WHERE entryno = '" + entryNo + "'"
+	var idList []Id
+	err := this.DBE.SQL(getId).Find(&idList)
+	//批量更新全部成功或失败的任务样本状态
+	sql:= "UPDATE " + TABLE_APPLY_DETAIL + " SET taskstatus = '" + strconv.Itoa(statusCode) + "' WHERE parentid = '" + strconv.Itoa(idList[0].Id) + "'"
+	_,err = this.DBE.Exec(sql)
+
+	return  err
+}
+
+
 ////批量更新全部成功或失败的任务样本状态
 //func (this *ConverseService)SampleApplyDetailStatusBatchModify(statusCode int , entryNo string) error {
 //
@@ -576,11 +591,19 @@ func (this *ConverseService) UpdatePosition(rack_id string ,tubes []Tube){
 		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 box_x,box_y int
+
+		if no%RowNum ==0{// 如果 取余数为0 则 证明该数是能被  10 整除的数  为该行 最后一个孔位
+			box_y =10
+			box_x = no/RowNum
+		}else{
+			box_y =no%RowNum
+			box_x = (no/RowNum)+1
+		}
+
+		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 ="update bank_sample set Position = '"+utils.ToStr(box_y)+";"+utils.ToStr(box_x)+"' ,PositionInfo  = concat( REVERSE(SUBSTR(REVERSE(PositionInfo) FROM INSTR(REVERSE(PositionInfo),'-')+1)),'-"+position+"' ) where barcode ='"+id+"' "
 		//执行sql 更新位置和坐标信息
 		this.DBE.Exec(sql)
 	}
@@ -889,3 +912,4 @@ func RecordDeviceData(list []List_Data) {
 	svc := GetConverseService(utils.DBE)
 	svc.InsertEntity(data)
 }
+

+ 7 - 0
src/dashoo.cn/genepoint_srv/controllers/converse/converse.go

@@ -81,6 +81,13 @@ func (this *ConverseController) StatusModify(statusCode int, task_id string) err
 		return err
 	}
 
+	// 2020/12/18 卢传敏新增,修复多条报文返回的问题,同时处理 任务中样本的状态和任务状态不一致的问题
+	// 根据任务报文返回的执行状态 修改出入库单中的 样本的任务状态
+	err = svc.SampleApplyDetailStatusModify(statusCode, task_id)
+	if err != nil {
+		return err
+	}
+
 	//if statusCode == SUCCESS || statusCode == REJECT {
 	//	svc.SampleApplyDetailStatusBatchModify(statusCode,task_id)
 	//}