|
@@ -30,6 +30,16 @@ func (e *OperationLog) GetPage(c *dto.OperationLogGetPageReq, list *[]model.Oper
|
|
|
cDto.Paginate(c.GetPageSize(), c.GetPageIndex()),
|
|
|
actions.Permission(data.TableName(), p),
|
|
|
).
|
|
|
+ Preload("OptUserObj").
|
|
|
+ Preload("ObjectUserObj").
|
|
|
+ Preload("ObjectCustomerObj").
|
|
|
+ Preload("OptCustomerObj").
|
|
|
+ Preload("CompanyObj").
|
|
|
+ Preload("CurrentEnterpriseObj").
|
|
|
+ Preload("CurrentStationObj").
|
|
|
+ Preload("CurrentStoreObj").
|
|
|
+ Preload("CurrentTruckObj").
|
|
|
+ Preload("CurrentAddressObj").
|
|
|
Find(list).Limit(-1).Offset(-1).
|
|
|
Count(count).Error
|
|
|
if err != nil {
|
|
@@ -174,6 +184,18 @@ func (e *OperationLog) Insert(c *dto.OperationLogInsertReq, p *actions.DataPermi
|
|
|
// 1、通过高频ID查询气瓶内编码
|
|
|
var gasCylinder model.GasCylinder
|
|
|
err = tx.Where("uid = ?", chipUid).First(&gasCylinder).Error
|
|
|
+ if err != nil {
|
|
|
+ tx.Rollback()
|
|
|
+ e.Log.Errorf("获取气瓶信息失败: %s", err)
|
|
|
+ return errors.New("获取气瓶信息失败")
|
|
|
+ }
|
|
|
+ var truckUserCarInfo model.TruckUserCarInfo
|
|
|
+ err = tx.Where("prov_user_id = ?", user.ProvUserId).First(&truckUserCarInfo).Error
|
|
|
+ if err != nil {
|
|
|
+ tx.Rollback()
|
|
|
+ e.Log.Errorf("获取车辆信息失败: %s", err)
|
|
|
+ return errors.New("获取车辆信息失败")
|
|
|
+ }
|
|
|
operationLog := model.OperationLog{
|
|
|
ProvOperationLog: model.ProvOperationLog{
|
|
|
InnerCode: gasCylinder.InnerCode,
|
|
@@ -182,6 +204,8 @@ func (e *OperationLog) Insert(c *dto.OperationLogInsertReq, p *actions.DataPermi
|
|
|
CompanyId: user.ProvUser.CmpCode,
|
|
|
CurrentEnterprise: user.ProvUser.CmpCode,
|
|
|
CurrentStore: user.ProvUser.CmpCode,
|
|
|
+ CurrentTruck: user.ProvUserId,
|
|
|
+ CurrentMotor: truckUserCarInfo.CarNo,
|
|
|
OptTime: time.Now().Format("2006-01-02 15:04:05"),
|
|
|
},
|
|
|
ControlBy: cModel.ControlBy{
|
|
@@ -269,6 +293,9 @@ func InsertOperationLogByOptType26Or36(tx *gorm.DB, OptType string, chipUid stri
|
|
|
// 1、通过高频ID查询气瓶内编码
|
|
|
var gasCylinder model.GasCylinder
|
|
|
err = tx.Where("uid = ?", chipUid).First(&gasCylinder).Error
|
|
|
+ if err != nil {
|
|
|
+ return errors.New("获取气瓶信息失败")
|
|
|
+ }
|
|
|
|
|
|
operationLog := model.OperationLog{
|
|
|
ProvOperationLog: model.ProvOperationLog{
|
|
@@ -352,7 +379,7 @@ func (e *OperationLog) ListByUid(InnerCode string, list *[]model.OperationLog) e
|
|
|
Preload("CurrentStoreObj").
|
|
|
Preload("CurrentTruckObj").
|
|
|
Preload("CurrentAddressObj").
|
|
|
- Find(list).Error
|
|
|
+ Find(list).Order("opt_time").Error
|
|
|
if err != nil {
|
|
|
e.Log.Errorf("db error: %s", err)
|
|
|
return global.GetFailedErr
|