|
@@ -391,7 +391,7 @@ func (this *ConverseService) StatusModifyWithDetail(task_id string) error {
|
|
|
status := SUCCESS
|
|
status := SUCCESS
|
|
|
// 关联查询申请详情表,申请主表中指定申请单下执行状态不为success的申请详情数量
|
|
// 关联查询申请详情表,申请主表中指定申请单下执行状态不为success的申请详情数量
|
|
|
|
|
|
|
|
- sql :="SELECT count(*) FROM `"+TABLE_APPLY_DETAIL+"` a JOIN `"+TABLE_SAMPLE_APPLY+"` b ON a.parentid = b.Id WHERE ( a.parentid = b.Id and b.entryno = '"+task_id+"' and a.taskstatus <> "+strconv.Itoa(SUCCESS)+")"
|
|
|
|
|
|
|
+ sql := "SELECT count(*) FROM `" + TABLE_APPLY_DETAIL + "` a JOIN `" + TABLE_SAMPLE_APPLY + "` b ON a.parentid = b.Id WHERE ( a.parentid = b.Id and b.entryno = '" + task_id + "' and a.taskstatus <> " + strconv.Itoa(SUCCESS) + ")"
|
|
|
|
|
|
|
|
//total, err := this.DBE.Table(TABLE_APPLY_DETAIL ).Join("", TABLE_SAMPLE_APPLY ,"a.parentid = b.Id").Where(" a.parentid = b.Id and b.entryno = '" + task_id + "' and a.taskstatus <> " + strconv.Itoa(SUCCESS)).Count()
|
|
//total, err := this.DBE.Table(TABLE_APPLY_DETAIL ).Join("", TABLE_SAMPLE_APPLY ,"a.parentid = b.Id").Where(" a.parentid = b.Id and b.entryno = '" + task_id + "' and a.taskstatus <> " + strconv.Itoa(SUCCESS)).Count()
|
|
|
//if err != nil && err != sql.ErrNoRows {
|
|
//if err != nil && err != sql.ErrNoRows {
|
|
@@ -403,7 +403,7 @@ func (this *ConverseService) StatusModifyWithDetail(task_id string) error {
|
|
|
this.DBE.SQL(sql).Get(&total)
|
|
this.DBE.SQL(sql).Get(&total)
|
|
|
|
|
|
|
|
//total ,_ := result.RowsAffected()
|
|
//total ,_ := result.RowsAffected()
|
|
|
- fmt.Println("数量:",total)
|
|
|
|
|
|
|
+ fmt.Println("数量:", total)
|
|
|
|
|
|
|
|
// 存在未执行成功的子任务
|
|
// 存在未执行成功的子任务
|
|
|
if total > 0 {
|
|
if total > 0 {
|
|
@@ -597,15 +597,14 @@ func (this *ConverseService) ModifySampleStatusByApplyMainInfo(entryNo string, r
|
|
|
var tubes = entity.Data.Actual_data[0].Tubes
|
|
var tubes = entity.Data.Actual_data[0].Tubes
|
|
|
fmt.Println("样本位置信息:", tubes)
|
|
fmt.Println("样本位置信息:", tubes)
|
|
|
//新增方法 更新位置信息
|
|
//新增方法 更新位置信息
|
|
|
- defer this.UpdatePosition(Rack_id, tubes)
|
|
|
|
|
-
|
|
|
|
|
|
|
+ defer this.UpdatePosition(Rack_id, tubes, entity, applyMain.Id)
|
|
|
|
|
|
|
|
} else if applyMain.ApplyType == TASK_TUBE_RETREIVING && strings.Contains(resp, "_storing") {
|
|
} else if applyMain.ApplyType == TASK_TUBE_RETREIVING && strings.Contains(resp, "_storing") {
|
|
|
fmt.Println("开始入库2")
|
|
fmt.Println("开始入库2")
|
|
|
//lite设备 部分管子出库
|
|
//lite设备 部分管子出库
|
|
|
taskType = "tube_retrieving"
|
|
taskType = "tube_retrieving"
|
|
|
operaIds, abnormalIds = this.getOperaSampleIdsStr(applyMain.ApplyType, applyMain.Id, resp, entity)
|
|
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*/ {
|
|
|
|
|
|
|
+ } else if applyMain.ApplyType == TASK_TUBE_RETREIVING && strings.Contains(resp, "_retrieving") /*resp == "rack_retrieving"*/ /*&& entity.Data.Is_end*/ {
|
|
|
fmt.Println("开始入库3")
|
|
fmt.Println("开始入库3")
|
|
|
//lite设备 整盒出库
|
|
//lite设备 整盒出库
|
|
|
taskType = "tube_retrieving"
|
|
taskType = "tube_retrieving"
|
|
@@ -614,11 +613,11 @@ func (this *ConverseService) ModifySampleStatusByApplyMainInfo(entryNo string, r
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- fmt.Println("resp:",resp)
|
|
|
|
|
|
|
+ fmt.Println("resp:", resp)
|
|
|
// 此处判断,如果是冻存盒整盒入库,需要更新位置信息 盒 冻存盒当前的 所在的冻存架的id
|
|
// 此处判断,如果是冻存盒整盒入库,需要更新位置信息 盒 冻存盒当前的 所在的冻存架的id
|
|
|
- if resp == "rack_storing"{
|
|
|
|
|
|
|
+ if resp == "rack_storing" {
|
|
|
this.UpdateBoxInfo(entity)
|
|
this.UpdateBoxInfo(entity)
|
|
|
- }else if resp == "rack_retrieving"{
|
|
|
|
|
|
|
+ } else if resp == "rack_retrieving" {
|
|
|
// 冻存盒出库任务完成以后,需要清空冻存盒中的冻存架信息,同时清空
|
|
// 冻存盒出库任务完成以后,需要清空冻存盒中的冻存架信息,同时清空
|
|
|
this.UpdateBoxInfoCK(entity)
|
|
this.UpdateBoxInfoCK(entity)
|
|
|
}
|
|
}
|
|
@@ -632,48 +631,49 @@ func (this *ConverseService) ModifySampleStatusByApplyMainInfo(entryNo string, r
|
|
|
|
|
|
|
|
//2021/01/09 by 卢传敏
|
|
//2021/01/09 by 卢传敏
|
|
|
// 根据入库返回报文,更新 冻存盒的信息盒
|
|
// 根据入库返回报文,更新 冻存盒的信息盒
|
|
|
-func (this *ConverseService) UpdateBoxInfo( entity ResponseEntity )(err error){
|
|
|
|
|
|
|
+func (this *ConverseService) UpdateBoxInfo(entity ResponseEntity) (err error) {
|
|
|
//1. 获取当前返回的 冻存架信息,
|
|
//1. 获取当前返回的 冻存架信息,
|
|
|
var shelf Shelf
|
|
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 //
|
|
|
|
|
|
|
+ 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
|
|
Unit := entity.Data.Actual_data[i].Target.Unit
|
|
|
Pos := entity.Data.Actual_data[i].Target.Pos
|
|
Pos := entity.Data.Actual_data[i].Target.Pos
|
|
|
Group := entity.Data.Actual_data[i].Target.Group
|
|
Group := entity.Data.Actual_data[i].Target.Group
|
|
|
|
|
|
|
|
- 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 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)+"'"
|
|
|
|
|
|
|
+ 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)
|
|
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)+" where boxBarcode ='"+boxBarcode+"' ")
|
|
|
|
|
|
|
+ _, 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 Barcode ='" + boxBarcode + "' ")
|
|
|
// 更新 当前冰箱冻存盒容量 信息
|
|
// 更新 当前冰箱冻存盒容量 信息
|
|
|
- _,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) + "")
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
return err
|
|
return err
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
//2021/01/09 by 卢传敏
|
|
//2021/01/09 by 卢传敏
|
|
|
// 根据出库返回报文,更新 冻存盒的信息盒
|
|
// 根据出库返回报文,更新 冻存盒的信息盒
|
|
|
-func (this *ConverseService) UpdateBoxInfoCK( entity ResponseEntity )(err error){
|
|
|
|
|
|
|
+func (this *ConverseService) UpdateBoxInfoCK(entity ResponseEntity) (err error) {
|
|
|
//1. 获取当前返回的 冻存架信息,
|
|
//1. 获取当前返回的 冻存架信息,
|
|
|
var shelf Shelf
|
|
var shelf Shelf
|
|
|
|
|
|
|
|
// 循环处理返回的数据,如果出现多盒存入的分批处理
|
|
// 循环处理返回的数据,如果出现多盒存入的分批处理
|
|
|
|
|
|
|
|
- for i := range entity.Data.Actual_data{
|
|
|
|
|
- boxBarcode := entity.Data.Actual_data[i].Rack_id // 冻存盒编号
|
|
|
|
|
|
|
+ for i := range entity.Data.Actual_data {
|
|
|
|
|
+ boxBarcode := entity.Data.Actual_data[i].Rack_id // 冻存盒编号
|
|
|
//Cu := entity.Data.Actual_data[i].Target.Cu // 设备编号
|
|
//Cu := entity.Data.Actual_data[i].Target.Cu // 设备编号
|
|
|
//Ltu := entity.Data.Actual_data[i].Target.Ltu //
|
|
//Ltu := entity.Data.Actual_data[i].Target.Ltu //
|
|
|
//Unit := entity.Data.Actual_data[i].Target.Unit
|
|
//Unit := entity.Data.Actual_data[i].Target.Unit
|
|
@@ -686,28 +686,46 @@ func (this *ConverseService) UpdateBoxInfoCK( entity ResponseEntity )(err error)
|
|
|
// "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.Unit ='"+utils.ToStr(Unit) +"' and a.Group ='"+utils.ToStr(Group)+"'"
|
|
|
|
|
|
|
|
//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 =null,YStation =null , where boxBarcode ='"+boxBarcode+"' ")
|
|
|
|
|
|
|
+ _, err = this.DBE.Exec("update bank_box set 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)+"" )
|
|
|
|
|
|
|
+ _, err = this.DBE.Exec(" update bank_currboxcapacity set `A" + utils.ToStr(Pos) + "`= -2 where shelfId =" + utils.ToStr(shelf.Id) + "")
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
return err
|
|
return err
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+func (this *ConverseService) UpdateDetail(BarCode string, entity ResponseEntity, parentId int) {
|
|
|
|
|
+ var shelf Shelf
|
|
|
|
|
+ var equipmentid string
|
|
|
|
|
+ var ShelfId string
|
|
|
|
|
+ for i := range entity.Data.Actual_data {
|
|
|
|
|
+ Cu := entity.Data.Actual_data[i].Target.Cu // 设备编号
|
|
|
|
|
+ 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)
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
// 20201026 卢传敏新增根据返回报文,更新位置信息
|
|
// 20201026 卢传敏新增根据返回报文,更新位置信息
|
|
|
/**
|
|
/**
|
|
|
* rack_id 盒子编号
|
|
* rack_id 盒子编号
|
|
|
* tubes 报文中返回的 位置和样本条码
|
|
* tubes 报文中返回的 位置和样本条码
|
|
|
*/
|
|
*/
|
|
|
-func (this *ConverseService) UpdatePosition(rack_id string, tubes []Tube) {
|
|
|
|
|
|
|
+func (this *ConverseService) UpdatePosition(rack_id string, tubes []Tube, entity ResponseEntity, parentId int) {
|
|
|
// 根据返回的报文中的盒子标识,获取盒子类型
|
|
// 根据返回的报文中的盒子标识,获取盒子类型
|
|
|
sql := "select RowNum,ColumnNum from bank_box where Barcode ='" + rack_id + "'"
|
|
sql := "select RowNum,ColumnNum from bank_box where Barcode ='" + rack_id + "'"
|
|
|
var box Box
|
|
var box Box
|
|
@@ -735,6 +753,7 @@ func (this *ConverseService) UpdatePosition(rack_id string, tubes []Tube) {
|
|
|
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 = "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 更新位置和坐标信息
|
|
//执行sql 更新位置和坐标信息
|
|
|
this.DBE.Exec(sql)
|
|
this.DBE.Exec(sql)
|
|
|
|
|
+ this.UpdateDetail(id, entity, parentId)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|