|
@@ -76,12 +76,12 @@ func (e *WaybillTask) Get(c *dto.WeianGetWaybillDataReq, task *model.WaybillTask
|
|
}
|
|
}
|
|
|
|
|
|
err = e.Orm.Model(&data).
|
|
err = e.Orm.Model(&data).
|
|
- Where("waybill_no = ?", c.WaybillNo).
|
|
|
|
|
|
+ Where("waybill_no = ?", waybill.WaybillNo).
|
|
Preload("CoolerBox").
|
|
Preload("CoolerBox").
|
|
First(task).Error
|
|
First(task).Error
|
|
if err != nil {
|
|
if err != nil {
|
|
e.Log.Errorf("db error: %s", err)
|
|
e.Log.Errorf("db error: %s", err)
|
|
- return global.GetFailedErr
|
|
|
|
|
|
+ return errors.New("获取运单任务信息失败")
|
|
}
|
|
}
|
|
// 获取公司秘钥
|
|
// 获取公司秘钥
|
|
var company model.SysDept
|
|
var company model.SysDept
|
|
@@ -211,7 +211,7 @@ func (e *WaybillTask) GetLocus(c *dto.WaybillGetLocusReq) ([]nats_server.DeviceD
|
|
var taskList []model.WaybillTask
|
|
var taskList []model.WaybillTask
|
|
locusList := make([]nats_server.DeviceData_R2, 0)
|
|
locusList := make([]nats_server.DeviceData_R2, 0)
|
|
|
|
|
|
- err = e.Orm.Model(&waybill).Where("waybill_no = ?", c.WaybillNo).First(&waybill).Error
|
|
|
|
|
|
+ err = e.Orm.Model(&waybill).Where("waybill_no = ? or order_no = ?", c.WaybillNo, c.WaybillNo).First(&waybill).Error
|
|
if err != nil {
|
|
if err != nil {
|
|
e.Log.Errorf("db error: %s", err)
|
|
e.Log.Errorf("db error: %s", err)
|
|
return locusList, errors.New("获取运单信息失败")
|
|
return locusList, errors.New("获取运单信息失败")
|
|
@@ -225,13 +225,11 @@ func (e *WaybillTask) GetLocus(c *dto.WaybillGetLocusReq) ([]nats_server.DeviceD
|
|
}
|
|
}
|
|
|
|
|
|
err = e.Orm.Model(&data).
|
|
err = e.Orm.Model(&data).
|
|
- Scopes(
|
|
|
|
- cDto.MakeCondition(c.GetNeedSearch()),
|
|
|
|
- ).
|
|
|
|
|
|
+ Where("waybill_no = ?", waybill.WaybillNo).
|
|
Find(&taskList).Error
|
|
Find(&taskList).Error
|
|
if err != nil {
|
|
if err != nil {
|
|
e.Log.Errorf("db error: %s", err)
|
|
e.Log.Errorf("db error: %s", err)
|
|
- return locusList, global.GetFailedErr
|
|
|
|
|
|
+ return locusList, errors.New("获取运单任务信息失败")
|
|
}
|
|
}
|
|
|
|
|
|
for i := 0; i < len(taskList); i++ {
|
|
for i := 0; i < len(taskList); i++ {
|
|
@@ -242,7 +240,7 @@ func (e *WaybillTask) GetLocus(c *dto.WaybillGetLocusReq) ([]nats_server.DeviceD
|
|
dataList, _, err := nats_server.Cold_ReadDeviceDataListBy_T_snidForLocus(T_snid, taskList[i].StartTime.String(), taskList[i].EndTime.String(), 0, 9999)
|
|
dataList, _, err := nats_server.Cold_ReadDeviceDataListBy_T_snidForLocus(T_snid, taskList[i].StartTime.String(), taskList[i].EndTime.String(), 0, 9999)
|
|
if err != nil {
|
|
if err != nil {
|
|
e.Log.Errorf("nats 获取轨迹信息失败: %s", err)
|
|
e.Log.Errorf("nats 获取轨迹信息失败: %s", err)
|
|
- return locusList, global.GetFailedErr
|
|
|
|
|
|
+ return locusList, errors.New("获取运单轨迹信息失败")
|
|
}
|
|
}
|
|
|
|
|
|
// 倒序
|
|
// 倒序
|