|
@@ -419,7 +419,11 @@ func handleQueryTube(entity *RequestEntity, detail *Sample_Storage_Task) {
|
|
|
* @return
|
|
* @return
|
|
|
**/
|
|
**/
|
|
|
func handleArrange (entity *RequestEntity, detail *Sample_Storage_Task) {
|
|
func handleArrange (entity *RequestEntity, detail *Sample_Storage_Task) {
|
|
|
|
|
+ var ones []Arrange
|
|
|
|
|
|
|
|
|
|
+ if entity.Data.Task_data != nil {
|
|
|
|
|
+ ones = entity.Data.Task_data.([]Arrange)
|
|
|
|
|
+ }
|
|
|
if entity.Data.Operation_mode == "" {
|
|
if entity.Data.Operation_mode == "" {
|
|
|
entity.Data.Operation_mode = detail.OperaMode
|
|
entity.Data.Operation_mode = detail.OperaMode
|
|
|
}
|
|
}
|
|
@@ -435,20 +439,15 @@ func handleArrange (entity *RequestEntity, detail *Sample_Storage_Task) {
|
|
|
Logic_id: 0,
|
|
Logic_id: 0,
|
|
|
Position: position,
|
|
Position: position,
|
|
|
}
|
|
}
|
|
|
- var ones []Arrange
|
|
|
|
|
- ones = append(ones,one )
|
|
|
|
|
- /*var one Arrange
|
|
|
|
|
- one.Logic_id = 0 // 当前逻辑分区设置为 0
|
|
|
|
|
- one.Position.Cu = detail.Cu
|
|
|
|
|
- one.Position.Ltu = detail.Ltu
|
|
|
|
|
- one.Position.Group = detail.Group
|
|
|
|
|
- one.Position.Unit = detail.Unit
|
|
|
|
|
- one.Position.Pos = detail.Pos*/
|
|
|
|
|
|
|
|
|
|
|
|
+ ones = append(ones,one )
|
|
|
|
|
+ entity.Data.Operation_mode = detail.OperaMode
|
|
|
|
|
+ entity.Data.Initiator = "genepoint"
|
|
|
|
|
+ entity.Data.Name = "库内整理"
|
|
|
entity.Data.Task_data = ones
|
|
entity.Data.Task_data = ones
|
|
|
}
|
|
}
|
|
|
// 查询申请单详情下状态,存在一条子任务失败的情况,则整个申请单状态为失败
|
|
// 查询申请单详情下状态,存在一条子任务失败的情况,则整个申请单状态为失败
|
|
|
-func (this *ConverseService) StatusModifyWithDetail(task_id string) error {
|
|
|
|
|
|
|
+func (this *ConverseService) StatusModifyWithDetail(task_id string,res ResponseEntity) error {
|
|
|
status := SUCCESS
|
|
status := SUCCESS
|
|
|
// 关联查询申请详情表,申请主表中指定申请单下执行状态不为success的申请详情数量
|
|
// 关联查询申请详情表,申请主表中指定申请单下执行状态不为success的申请详情数量
|
|
|
|
|
|
|
@@ -471,6 +470,10 @@ func (this *ConverseService) StatusModifyWithDetail(task_id string) error {
|
|
|
status = FAILED
|
|
status = FAILED
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if res.Data.Type =="abnormal_end"{
|
|
|
|
|
+ status = EXCEPTION
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 更新任务状态
|
|
// 更新任务状态
|
|
|
//updTaskSql := "UPDATE " + TABLE_TAST + " SET statuscode = '" + strconv.Itoa(status) + "' WHERE task_id = '" + task_id + "'"
|
|
//updTaskSql := "UPDATE " + TABLE_TAST + " SET statuscode = '" + strconv.Itoa(status) + "' WHERE task_id = '" + task_id + "'"
|
|
|
//_, err = this.DBE.Exec(updTaskSql)
|
|
//_, err = this.DBE.Exec(updTaskSql)
|
|
@@ -733,6 +736,7 @@ func (this *ConverseService) ModifySampleStatusByApplyMainInfo(entryNo string, r
|
|
|
func (this *ConverseService) UpdateBoxInfo(entity ResponseEntity,parentId int) (err error) {
|
|
func (this *ConverseService) UpdateBoxInfo(entity ResponseEntity,parentId int) (err error) {
|
|
|
//1. 获取当前返回的 冻存架信息,
|
|
//1. 获取当前返回的 冻存架信息,
|
|
|
var shelf Shelf
|
|
var shelf Shelf
|
|
|
|
|
+ var equipment Bank_Equipment
|
|
|
|
|
|
|
|
glog.Info("entity.Data.Actual_data::", entity.Data.Actual_data)
|
|
glog.Info("entity.Data.Actual_data::", entity.Data.Actual_data)
|
|
|
|
|
|
|
@@ -752,15 +756,39 @@ func (this *ConverseService) UpdateBoxInfo(entity ResponseEntity,parentId int) (
|
|
|
|
|
|
|
|
fmt.Println("保存返回的冻存盒位置信息:cu:", Cu, ",Ltu", Ltu, ",Unit", Unit, ",Group", Group, ",Pos", Pos)
|
|
fmt.Println("保存返回的冻存盒位置信息:cu:", Cu, ",Ltu", Ltu, ",Unit", Unit, ",Group", Group, ",Pos", Pos)
|
|
|
|
|
|
|
|
- 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) + "'"
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // 判断是否是冷库,如果是冷库的话,查询容器架子信息时不需要组装 unit
|
|
|
|
|
+ lengSql := " select * from bank_equipment where cu = '" + utils.ToStr(Cu) + "' and Ltu = '" + utils.ToStr(Ltu) + "' "
|
|
|
|
|
+ this.DBE.SQL(lengSql).Get(&equipment)
|
|
|
|
|
+
|
|
|
|
|
+ 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.Group ='" + utils.ToStr(Group) + "'"
|
|
|
|
|
+ // 冷库设备
|
|
|
|
|
+ YStation:=" "
|
|
|
|
|
+ if equipment.Ltu == 0 {
|
|
|
|
|
+ sql += " and a.Unit ='" + utils.ToStr(Unit) + "' "
|
|
|
|
|
+ YStation = " , YStation =1 "
|
|
|
|
|
+ fmt.Println("保存返回的冻存盒位置信息:YStation1:1 ", YStation)
|
|
|
|
|
+ }else{
|
|
|
|
|
+ YStation = " , YStation = "+ utils.ToStr(Unit)
|
|
|
|
|
+ fmt.Println("保存返回的冻存盒位置信息:cYStation1:2 ", YStation)
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
this.DBE.SQL(sql).Get(&shelf)
|
|
this.DBE.SQL(sql).Get(&shelf)
|
|
|
fmt.Println("冻存架信息:", shelf.Id, shelf.XStation, shelf.YStation)
|
|
fmt.Println("冻存架信息:", shelf.Id, shelf.XStation, shelf.YStation)
|
|
|
|
|
|
|
|
// 更新盒所在的冻存架的信息 计算位置信息,并更新
|
|
// 更新盒所在的冻存架的信息 计算位置信息,并更新
|
|
|
// 临时处理逻辑,默认 pos 为 盒子的 XStation
|
|
// 临时处理逻辑,默认 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) + ",IsLocked = 0 where Barcode ='" + boxBarcode + "' ")
|
|
|
|
|
|
|
+ pos := equipment.Code + "-" + utils.NumberToLetter(shelf.YStation) + utils.ToStr(shelf.XStation) + "-" +
|
|
|
|
|
+ "" + utils.NumberToLetter( Unit ) + utils.ToStr(utils.ToStr(Pos))
|
|
|
|
|
+
|
|
|
|
|
+ possql := "update bank_box set XStation ='" + utils.ToStr(Pos) + "' "+YStation+"," +
|
|
|
|
|
+ " EquipmentId ='" + com.ToStr(shelf.EquipmentId) + "'," +
|
|
|
|
|
+ " shelfId =" + utils.ToStr(shelf.Id) + ",IsLocked = 0 ," +
|
|
|
|
|
+ " Position ='"+pos+"'" +
|
|
|
|
|
+ " where Barcode ='" + boxBarcode + "' "
|
|
|
|
|
+ // 冷库设备
|
|
|
|
|
+ _, err = this.DBE.Exec(possql)
|
|
|
// 更新 当前冰箱冻存盒容量 信息
|
|
// 更新 当前冰箱冻存盒容量 信息
|
|
|
_, err = this.DBE.Exec(" update bank_currboxcapacity set `A" + utils.ToStr(Pos) + "`= -1 where shelfId =" + utils.ToStr(shelf.Id) + "")
|
|
_, err = this.DBE.Exec(" update bank_currboxcapacity set `A" + utils.ToStr(Pos) + "`= -1 where shelfId =" + utils.ToStr(shelf.Id) + "")
|
|
|
|
|
|
|
@@ -833,7 +861,7 @@ func (this *ConverseService) UpdateBoxInfoCK(entity ResponseEntity,parentId int)
|
|
|
|
|
|
|
|
// 更新盒所在的冻存架的信息 计算位置信息,并更新
|
|
// 更新盒所在的冻存架的信息 计算位置信息,并更新
|
|
|
// 临时处理逻辑,默认 pos 为 盒子的 XStation
|
|
// 临时处理逻辑,默认 pos 为 盒子的 XStation
|
|
|
- _, err = this.DBE.Exec("update bank_box set EquipmentId=null,shelfId=null,XStation =null,YStation =null,IsLocked = 0 where Barcode ='" + boxBarcode + "' ")
|
|
|
|
|
|
|
+ _, err = this.DBE.Exec("update bank_box set EquipmentId=null,shelfId=null,XStation =null,YStation =null,IsLocked = 0,Position =null where Barcode ='" + boxBarcode + "' ")
|
|
|
// 更新 当前冰箱冻存盒容量 信息
|
|
// 更新 当前冰箱冻存盒容量 信息
|
|
|
_, err = this.DBE.Exec(" update bank_currboxcapacity set `A" + utils.ToStr(Pos) + "`= -2 where shelfId =" + utils.ToStr(shelf.Id) + "")
|
|
_, err = this.DBE.Exec(" update bank_currboxcapacity set `A" + utils.ToStr(Pos) + "`= -2 where shelfId =" + utils.ToStr(shelf.Id) + "")
|
|
|
updatesql := "UPDATE " + TABLE_DETAIL + " SET taskstatus = '" + strconv.Itoa(SUCCESS) + "' WHERE parentid = '" + strconv.Itoa(parentId) + "'"
|
|
updatesql := "UPDATE " + TABLE_DETAIL + " SET taskstatus = '" + strconv.Itoa(SUCCESS) + "' WHERE parentid = '" + strconv.Itoa(parentId) + "'"
|
|
@@ -880,6 +908,7 @@ func (this *ConverseService) UpdateDetail(BarCode string, entity ResponseEntity,
|
|
|
glog.Info("修改detail:", entity)
|
|
glog.Info("修改detail:", entity)
|
|
|
|
|
|
|
|
var shelf Shelf
|
|
var shelf Shelf
|
|
|
|
|
+ var equipment Bank_Equipment
|
|
|
var equipmentid string
|
|
var equipmentid string
|
|
|
var ShelfId string
|
|
var ShelfId string
|
|
|
for i := range entity.Data.Actual_data {
|
|
for i := range entity.Data.Actual_data {
|
|
@@ -890,8 +919,25 @@ func (this *ConverseService) UpdateDetail(BarCode string, entity ResponseEntity,
|
|
|
|
|
|
|
|
//当 检测到数据 与当前操作盒子的数据一直时,更新 detail 和sample 信息
|
|
//当 检测到数据 与当前操作盒子的数据一直时,更新 detail 和sample 信息
|
|
|
if entity.Data.Actual_data[i].Target.Rack_id == rack_id {
|
|
if entity.Data.Actual_data[i].Target.Rack_id == rack_id {
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ fmt.Println("保存返回的冻存盒位置信息:cu:", Cu, ",Ltu", Ltu, ",Unit", Unit, ",Group", Group )
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ // 判断是否是冷库,如果是冷库的话,查询容器架子信息时不需要组装 unit
|
|
|
|
|
+ lengSql := " select * from bank_equipment where cu = '" + utils.ToStr(Cu) + "' and Ltu = '" + utils.ToStr(Ltu) + "' "
|
|
|
|
|
+ this.DBE.SQL(lengSql).Get(&equipment)
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
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) + "' " +
|
|
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) + "'"
|
|
|
|
|
|
|
+ "and a.Ltu = '" + utils.ToStr(Ltu) + "' and a.Group ='" + utils.ToStr(Group) + "'"
|
|
|
|
|
+ // 冷库设备
|
|
|
|
|
+ if equipment.Ltu ==0 {
|
|
|
|
|
+ sql += " and a.Unit ='" + utils.ToStr(Unit) + "' "
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
this.DBE.SQL(sql).Get(&shelf)
|
|
this.DBE.SQL(sql).Get(&shelf)
|
|
|
equipmentid = strconv.Itoa(shelf.EquipmentId)
|
|
equipmentid = strconv.Itoa(shelf.EquipmentId)
|
|
|
ShelfId = strconv.Itoa(shelf.Id)
|
|
ShelfId = strconv.Itoa(shelf.Id)
|
|
@@ -951,7 +997,7 @@ func (this *ConverseService) UpdatePosition(rack_id string, tubes []Tube, entity
|
|
|
position := equipmentInfo.Code + "-" + utils.NumberToLetter(shelf.YStation) + utils.ToStr(shelf.XStation) + "-" +
|
|
position := equipmentInfo.Code + "-" + utils.NumberToLetter(shelf.YStation) + utils.ToStr(shelf.XStation) + "-" +
|
|
|
"" + utils.NumberToLetter(box.YStation) + utils.ToStr(box.XStation) + "-" + utils.NumberToLetter(box_x) + utils.ToStr(box_y)
|
|
"" + utils.NumberToLetter(box.YStation) + utils.ToStr(box.XStation) + "-" + utils.NumberToLetter(box_x) + utils.ToStr(box_y)
|
|
|
sql = "update bank_sample set BoxId = '" + utils.ToStr(box.Id) + "',Position = '" + utils.ToStr(box_y) + ";" +
|
|
sql = "update bank_sample set BoxId = '" + utils.ToStr(box.Id) + "',Position = '" + utils.ToStr(box_y) + ";" +
|
|
|
- "" + utils.ToStr(box_x) + "',PositionInfo = '"+position+"' where barcode ='" + id + "' "
|
|
|
|
|
|
|
+ "" + utils.ToStr(box_x) + "',PositionInfo = '"+position+"' , unit = '"+ utils.ToStr( entity.Data.Actual_data[i].Target.Unit)+"' where barcode ='" + id + "' "
|
|
|
//执行sql 更新位置和坐标信息
|
|
//执行sql 更新位置和坐标信息
|
|
|
this.DBE.Exec(sql)
|
|
this.DBE.Exec(sql)
|
|
|
|
|
|
|
@@ -1205,6 +1251,8 @@ func (s *ConverseService) GetReason(cause Cause, equipmentName string) string {
|
|
|
break
|
|
break
|
|
|
case 8:
|
|
case 8:
|
|
|
reasonStr = "半自动设备在不配置转运机器人的情况下,一个存管任务只允许操作一台设备;"
|
|
reasonStr = "半自动设备在不配置转运机器人的情况下,一个存管任务只允许操作一台设备;"
|
|
|
|
|
+ default:
|
|
|
|
|
+ reasonStr = cause.Msg
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if cause.Cu != 0 {
|
|
if cause.Cu != 0 {
|