|
|
@@ -209,7 +209,7 @@ func (this *ConverseService) HandleTaskDetail(taskType int, entity *RequestEntit
|
|
|
case 2: //冻存盒出库
|
|
|
handleRackRetrieve(entity, detail)
|
|
|
break
|
|
|
- case 3, 8: //冻存管
|
|
|
+ case 3, 8: //冻存管入库
|
|
|
handleTubeStore(entity, detail)
|
|
|
break
|
|
|
case 4: // 冻存管出库
|
|
|
@@ -350,19 +350,19 @@ label:
|
|
|
|
|
|
//处理冻存管出库任务信息
|
|
|
func handleTubeRetrieve(entity *RequestEntity, detail *Sample_Storage_Task) {
|
|
|
- var one Single
|
|
|
- var exist bool
|
|
|
+ var one OutSingle
|
|
|
+ //var exist bool
|
|
|
if entity.Data.Task_data != nil {
|
|
|
- one = entity.Data.Task_data.(Single)
|
|
|
- exist = true
|
|
|
+ one = entity.Data.Task_data.(OutSingle)
|
|
|
+ //exist = true
|
|
|
}
|
|
|
|
|
|
- if !exist {
|
|
|
- //one.Target.Cu = CU
|
|
|
- one.Target.Cu = detail.Cu
|
|
|
- one.Target.Ee = EE
|
|
|
- one.Target.Pos = POS
|
|
|
- }
|
|
|
+ //if !exist {
|
|
|
+ // //one.Target.Cu = CU
|
|
|
+ // one.Target.Cu = detail.Cu
|
|
|
+ // one.Target.Ee = EE
|
|
|
+ // one.Target.Pos = POS
|
|
|
+ //}
|
|
|
var tube Tube
|
|
|
tube.Id = detail.BarCode
|
|
|
one.Tubes = append(one.Tubes, tube)
|
|
|
@@ -422,7 +422,7 @@ func (this *ConverseService) StatusModifyWithDetail(task_id string) error {
|
|
|
|
|
|
//修改任务表状态码
|
|
|
func (this *ConverseService) TaskStatusModify(statusCode int, task_id string) error {
|
|
|
- sql := "UPDATE " + TABLE_TAST + " SET statuscode = '" + strconv.Itoa(statusCode) + "' WHERE task_id = '" + task_id + "'"
|
|
|
+ sql := "UPDATE " + TABLE_TAST + " SET statuscode = '" + strconv.Itoa(statusCode) + "', exception='' WHERE task_id = '" + task_id + "'"
|
|
|
_, err := this.DBE.Exec(sql)
|
|
|
return err
|
|
|
}
|
|
|
@@ -580,6 +580,7 @@ func (this *ConverseService) GetApplyMain(entryNo string) Bank_Apply_Main {
|
|
|
func (this *ConverseService) ModifySampleStatusByApplyMainInfo(entryNo string, resp string, entity ResponseEntity) {
|
|
|
|
|
|
applyMain := this.GetApplyMain(entryNo)
|
|
|
+ fmt.Println("resp:", resp)
|
|
|
|
|
|
var operaIds, abnormalIds, taskType string
|
|
|
if applyMain.ApplyType == TASK_TUBE_STORING && strings.Contains(resp, "_storing") {
|
|
|
@@ -613,14 +614,18 @@ func (this *ConverseService) ModifySampleStatusByApplyMainInfo(entryNo string, r
|
|
|
taskType = "tube_retrieving"
|
|
|
operaIds, abnormalIds = this.getAllSampleIdsFromResEntity(entity)
|
|
|
} else {
|
|
|
+
|
|
|
+
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- fmt.Println("resp:", resp)
|
|
|
// 此处判断,如果是冻存盒整盒入库,需要更新位置信息 盒 冻存盒当前的 所在的冻存架的id
|
|
|
if resp == "rack_storing" {
|
|
|
this.UpdateBoxInfo(entity)
|
|
|
} else if resp == "rack_retrieving" {
|
|
|
+ fmt.Println("出库")
|
|
|
+ //rack_retrieving
|
|
|
+ //rack_retrieving
|
|
|
// 冻存盒出库任务完成以后,需要清空冻存盒中的冻存架信息,同时清空
|
|
|
this.UpdateBoxInfoCK(entity)
|
|
|
}
|
|
|
@@ -700,7 +705,7 @@ func (this *ConverseService) UpdateBoxInfoCK(entity ResponseEntity) (err error)
|
|
|
|
|
|
// 更新盒所在的冻存架的信息 计算位置信息,并更新
|
|
|
// 临时处理逻辑,默认 pos 为 盒子的 XStation
|
|
|
- _, err = this.DBE.Exec("update bank_box set XStation =null,YStation =null , where Barcode ='" + boxBarcode + "' ")
|
|
|
+ _, err = this.DBE.Exec("update bank_box set shelfId=null,XStation =null,YStation =null where Barcode ='" + boxBarcode + "' ")
|
|
|
// 更新 当前冰箱冻存盒容量 信息
|
|
|
_, err = this.DBE.Exec(" update bank_currboxcapacity set `A" + utils.ToStr(Pos) + "`= -2 where shelfId =" + utils.ToStr(shelf.Id) + "")
|
|
|
|
|
|
@@ -711,7 +716,7 @@ func (this *ConverseService) UpdateBoxInfoCK(entity ResponseEntity) (err error)
|
|
|
/**
|
|
|
修改detail 信息
|
|
|
*/
|
|
|
-func (this *ConverseService) UpdateDetail(BarCode string, entity ResponseEntity, parentId int) {
|
|
|
+func (this *ConverseService) UpdateDetail(BarCode string, entity ResponseEntity, parentId int,rack_id string ) {
|
|
|
|
|
|
glog.Info("修改detail:",entity)
|
|
|
|
|
|
@@ -723,15 +728,22 @@ func (this *ConverseService) UpdateDetail(BarCode string, entity ResponseEntity,
|
|
|
Ltu := entity.Data.Actual_data[i].Target.Ltu //
|
|
|
Unit := entity.Data.Actual_data[i].Target.Unit
|
|
|
Group := entity.Data.Actual_data[i].Target.Group
|
|
|
- sql := "select b.id EquipmentId,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)
|
|
|
- equipmentid = strconv.Itoa(shelf.EquipmentId)
|
|
|
- ShelfId = strconv.Itoa(shelf.Id)
|
|
|
- sql = "Update bank_apply_detail Set EquipmentId=" + equipmentid + ",ShelfId=" + ShelfId + " where BarCode='" + BarCode + "' and ParentId=" + strconv.Itoa(parentId)
|
|
|
- this.DBE.Exec(sql)
|
|
|
- sql = "update bank_sample set EquipmentId=" + equipmentid + ",ShelfId=" + ShelfId + " where barcode ='" + BarCode + "' "
|
|
|
- this.DBE.Exec(sql)
|
|
|
+
|
|
|
+
|
|
|
+ //当 检测到数据 与当前操作盒子的数据一直时,更新 detail 和sample 信息
|
|
|
+ if entity.Data.Actual_data[i].Rack_id == rack_id{
|
|
|
+ sql := "select b.id EquipmentId,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)
|
|
|
+ equipmentid = strconv.Itoa(shelf.EquipmentId)
|
|
|
+ ShelfId = strconv.Itoa(shelf.Id)
|
|
|
+ sql = "Update bank_apply_detail Set EquipmentId=" + equipmentid + ",ShelfId=" + ShelfId + " where BarCode='" + BarCode + "' and ParentId=" + strconv.Itoa(parentId)
|
|
|
+ this.DBE.Exec(sql)
|
|
|
+ sql = "update bank_sample set EquipmentId=" + equipmentid + ",ShelfId=" + ShelfId + " where barcode ='" + BarCode + "' "
|
|
|
+ this.DBE.Exec(sql)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -768,7 +780,7 @@ func (this *ConverseService) UpdatePosition(rack_id string, tubes []Tube, entity
|
|
|
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)
|
|
|
- this.UpdateDetail(id, entity, parentId)
|
|
|
+ this.UpdateDetail(id, entity, parentId,rack_id)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1074,3 +1086,15 @@ func RecordDeviceData(list []List_Data) {
|
|
|
svc := GetConverseService(utils.DBE)
|
|
|
svc.InsertEntity(data)
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+// 更新异常信息
|
|
|
+func (s *ConverseService)SaveErrInfo(err ,taskid string){
|
|
|
+ // 任务发送失败,,,修改任务状态,,,,提示任务执行失败
|
|
|
+ // 请求发送失败
|
|
|
+
|
|
|
+ svc := GetConverseService(utils.DBE)
|
|
|
+
|
|
|
+ svc.SaveTaskExcepMsg(err, taskid)
|
|
|
+ svc.SaveSampleExcepMsg(err, taskid)
|
|
|
+}
|