|
@@ -194,8 +194,11 @@ func (e *Waybill) GetCustomerPage(c *dto.WaybillGetCustomerPageReq, list *[]mode
|
|
|
func (e *Waybill) Get(d *dto.WaybillGetReq, waybillModel *model.Waybill, p *actions.DataPermission) error {
|
|
|
err := e.Orm.
|
|
|
Scopes(actions.Permission(waybillModel.TableName(), p)).
|
|
|
- Preload("User").
|
|
|
- First(waybillModel, d.GetId()).Error
|
|
|
+ Where("waybill_no = ?", d.WaybillNo).
|
|
|
+ Preload("PrintUser").
|
|
|
+ Preload("CoolerBox").
|
|
|
+ Preload("Dept").
|
|
|
+ First(waybillModel).Error
|
|
|
if err != nil {
|
|
|
e.Log.Errorf("db error: %s", err)
|
|
|
if errors.Is(err, gorm.ErrRecordNotFound) {
|
|
@@ -1873,7 +1876,6 @@ func (e *Waybill) StopRecord(c *dto.WaybillStopRecordReq, p *actions.DataPermiss
|
|
|
return err
|
|
|
}
|
|
|
|
|
|
- // 保温箱配送 不需要中转
|
|
|
if waybillModel.Status == model.WaybillStatusVanning {
|
|
|
// 查询保温箱信息
|
|
|
var coolerBox = model.CoolerBox{}
|
|
@@ -1908,6 +1910,9 @@ func (e *Waybill) StopRecord(c *dto.WaybillStopRecordReq, p *actions.DataPermiss
|
|
|
e.Log.Errorf("db error: %s", err)
|
|
|
return errors.New(fmt.Sprintf("查询运单任务信息失败:%s", err))
|
|
|
}
|
|
|
+ if task.StartTime.Local().After(c.StartTime.Local()) {
|
|
|
+ return errors.New(fmt.Sprintf("停止时间不能早于任务开始时间%s", task.StartTime.String()))
|
|
|
+ }
|
|
|
// 未出箱 停止记录
|
|
|
if time.Time(task.EndTime).IsZero() {
|
|
|
task.EndTime = c.StartTime
|
|
@@ -1978,6 +1983,9 @@ func (e *Waybill) StopRecord(c *dto.WaybillStopRecordReq, p *actions.DataPermiss
|
|
|
e.Log.Errorf("db error: %s", err)
|
|
|
return errors.New(fmt.Sprintf("查询运单任务信息失败:%s", err))
|
|
|
}
|
|
|
+ if task.StartTime.Local().After(c.StartTime.Local()) {
|
|
|
+ return errors.New(fmt.Sprintf("停止时间不能早于任务开始时间%s", task.StartTime.String()))
|
|
|
+ }
|
|
|
// 未下车 停止记录
|
|
|
if time.Time(task.EndTime).IsZero() {
|
|
|
task.EndTime = c.StartTime
|
|
@@ -2047,6 +2055,9 @@ func (e *Waybill) StopRecord(c *dto.WaybillStopRecordReq, p *actions.DataPermiss
|
|
|
e.Log.Errorf("db error: %s", err)
|
|
|
return errors.New(fmt.Sprintf("查询运单任务信息失败:%s", err))
|
|
|
}
|
|
|
+ if task.StartTime.Local().After(c.StartTime.Local()) {
|
|
|
+ return errors.New(fmt.Sprintf("停止时间不能早于任务开始时间%s", task.StartTime.String()))
|
|
|
+ }
|
|
|
// 未出库 停止记录
|
|
|
if time.Time(task.EndTime).IsZero() {
|
|
|
task.EndTime = c.StartTime
|
|
@@ -2357,7 +2368,10 @@ func (e *Waybill) GetTwoDeviceSensorData(c *dto.WaybillGetByWaybillNoReq) ([]nat
|
|
|
}
|
|
|
|
|
|
// 未签收,不返回数据
|
|
|
- if waybill.Status != model.WaybillStatusReceipt {
|
|
|
+ if waybill.Status != model.WaybillStatusReceipt &&
|
|
|
+ waybill.Status != model.WaybillStatusTruckOut &&
|
|
|
+ waybill.Status != model.WaybillStatusStorageOut &&
|
|
|
+ waybill.Status != model.WaybillStatusVanningOut {
|
|
|
return dataList, deviceDataPdf, waybillPDF, nil
|
|
|
}
|
|
|
|
|
@@ -2523,7 +2537,12 @@ func DeviceSensorDataListToDeviceDataPdfList(T_name, T_sn string, list []nats_se
|
|
|
key := item.T_time
|
|
|
if _, ok := resultMap[key]; !ok {
|
|
|
pdf.T_time = item.T_time
|
|
|
- pdf.T_name = T_name
|
|
|
+ T_name_s := []rune(T_name)
|
|
|
+ if len(T_name_s) > 8 {
|
|
|
+ pdf.T_name = string(T_name_s[:8]) + "..."
|
|
|
+ } else {
|
|
|
+ pdf.T_name = T_name
|
|
|
+ }
|
|
|
pdf.T_sn = T_sn
|
|
|
resultMap[key] = pdf
|
|
|
}
|