瀏覽代碼

冰排添加备注,修改冰排冷冻时间时同步修改冰排记录时间

huangyan 1 月之前
父節點
當前提交
dbab83a8d8

+ 15 - 5
app/admin/controller/waybill.go

@@ -610,7 +610,7 @@ func (e WaybillController) Audit(c *gin.Context) {
 		e.Error(500, err, err.Error())
 		return
 	}
-	e.OK(req.GetId(), "修改成功")
+	e.OK(req.GetId(), "审核成功")
 }
 
 // AdminAudit 管理员审核订单
@@ -622,7 +622,7 @@ func (e WaybillController) Audit(c *gin.Context) {
 // @Param data body dto.WaybillAdmin true "body"
 // @Success 200 {string} string	"{"code": 200, "message": "添加成功"}"
 // @Success 200 {string} string	"{"code": -1, "message": "添加失败"}"
-// @Router /api/waybill/audit [put]
+// @Router /api/waybill/adminaudit [put]
 // @Security Bearer
 func (e WaybillController) AdminAudit(c *gin.Context) {
 	s := service.Waybill{}
@@ -638,14 +638,24 @@ func (e WaybillController) AdminAudit(c *gin.Context) {
 		return
 	}
 	p := actions.GetPermissionFromContext(c)
-
+	var userObj model.SysUser
+	userSvc := service.SysUser{}
+	err = userSvc.Get(&dto.SysUserGetReq{Id: p.UserId}, nil, &userObj)
+	if err != nil {
+		e.Error(500, err, err.Error())
+		return
+	}
+	if userObj.Type != model.SysUserTypeSys {
+		e.Error(500, err, err.Error())
+		return
+	}
 	req.SetUpdateBy(user.GetUserId(c))
 	err = s.AdminAudit(&req, p)
 	if err != nil {
 		e.Error(500, err, err.Error())
 		return
 	}
-	e.OK(req.GetId(), "修改成功")
+	e.OK(req.GetId(), "审核成功")
 }
 
 // Delivery 派单
@@ -779,7 +789,7 @@ func (e WaybillController) Receipt(c *gin.Context) {
 		e.Error(500, err, err.Error())
 		return
 	}
-	e.OK(req.WaybillNo, "签收成功")
+	e.OK(req.WaybillNo, "提交成功")
 }
 
 // CustomerReceipt 客户签收

+ 1 - 0
app/admin/model/ice_raft.go

@@ -60,6 +60,7 @@ func GetIceRaftRecordStatus(s string) string {
 type IceRaftRecord struct {
 	model2.Model
 	IceRaftId      int           `json:"iceRaftId" gorm:"size:128;comment:冰排id"`
+	Label          string        `json:"label" gorm:"size:128;comment:标签"`                     // 标签
 	Status         string        `json:"status" gorm:"size:4;not null;default:'2';comment:状态"` // 0未入库 1-冷冻中 2-待使用 3-使用中 4已结束
 	InStorageTime  model2.Time   `json:"inStorageTime"  gorm:"size:128;comment:入库时间"`          // 入库时间
 	OutStorageTime model2.Time   `json:"outStorageTime"  gorm:"size:128;comment:出库时间"`         // 出库时间

+ 1 - 0
app/admin/router/waybill.go

@@ -25,6 +25,7 @@ func registerWaybillRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddle
 		r.POST("/delivery", cont.Delivery)
 		r.PUT("", cont.Update)
 		r.DELETE("", cont.Delete)
+		r.PUT("/adminaudit", cont.AdminAudit)          //管理员审核订单
 		r.POST("/receipt", cont.Receipt)               // 签收
 		r.GET("/customer", cont.GetCustomerPage)       // 客户下单列表
 		r.POST("/customer", cont.CustomerInsert)       // 客户下单

+ 2 - 0
app/admin/service/dto/ice_raft.go

@@ -72,6 +72,7 @@ func (s *IceRaftInsertReq) GetId() interface{} {
 
 type IceRaftUpdateReq struct {
 	Id               int     `json:"id" comment:"编码"`                   // 编码
+	Label            string  `json:"label" gorm:"size:128;comment:标签"`  // 标签
 	Code             string  `json:"code" vd:"len($)>0;msg:'冰排编号不能为空'"` // 冰排名称
 	Status           string  `json:"status"`                            // 1-停用 2-正常
 	FreezeClaim      float32 `json:"freezeClaim"`                       // 冷冻要求 单位小时
@@ -85,6 +86,7 @@ func (s *IceRaftUpdateReq) Generate(model *model.IceRaft) {
 	model.Code = s.Code
 	model.Status = s.Status
 	model.FreezeClaim = s.FreezeClaim
+	model.Label = s.Label
 	if s.ControlBy.UpdateBy != 0 {
 		model.UpdateBy = s.UpdateBy
 	}

+ 10 - 0
app/admin/service/ice_raft.go

@@ -235,6 +235,15 @@ func (e *IceRaft) Update(c *dto.IceRaftUpdateReq, p *actions.DataPermission) err
 		return global.UpdateFailedErr
 	}
 
+	var iceRaftRecordModel model.IceRaftRecord
+	iceRaftRecordModel.Id = iceRaftModel.IceRaftRecordId
+	iceRaftRecordModel.FreezeClaim = iceRaftModel.FreezeClaim
+	iceRaftRecordModel.Label = iceRaftModel.Label
+	err = tx.Updates(&iceRaftRecordModel).Error
+	if err != nil {
+		e.Log.Errorf("db error: %s", err)
+		return errors.New("修改冰排记录失败")
+	}
 	c.Id = iceRaftModel.Id
 	return nil
 }
@@ -351,6 +360,7 @@ func (e *IceRaft) InStorage(c *dto.IceRaftInStorageReq, p *actions.DataPermissio
 			IceLockerId:   iceLockerModel.Id,
 			IceRaftId:     iceRaftModel.Id,
 			Status:        model.IceRaftRecordStatusFreezing,
+			Label:         iceRaftModel.Label,
 			InStorageTime: model2.Time(time.Now()),
 			FreezeClaim:   iceRaftModel.FreezeClaim,
 			DeptBy: model2.DeptBy{