feat:完善项目

This commit is contained in:
henry
2021-11-19 18:21:12 +08:00
parent c5f4a5d281
commit 83a2d64ee6
10 changed files with 191 additions and 32 deletions

View File

@ -455,7 +455,7 @@ func (c *Instance) Examine(id uint64, status int, remark string, isAssist int, p
mWorkInstance := model.NewWorkInstance()
mWorkInstance.ID = id
isExist, err := model2.FirstField(mWorkInstance.WorkInstance, []string{"id", "kind", "schedule", "status"})
isExist, err := model2.FirstField(mWorkInstance.WorkInstance, []string{"id", "kind", "schedule", "is_assist", "status"})
if err != nil {
return err
@ -490,12 +490,18 @@ func (c *Instance) Examine(id uint64, status int, remark string, isAssist int, p
mWorkProgress.Status = _status
mWorkProgress.Remark = remark
if mWorkProgress.Remark == "" {
mWorkProgress.Remark = "审批通过"
}
if err = model2.Create(mWorkProgress.WorkProgress, tx); err != nil {
return err
}
workUpdates := map[string]interface{}{
"status": model2.WorkInstanceStatusForComplete, "updated_at": time.Now(),
}
// 上一流程
// TODO获取上一流程代码写的不好后期优化考虑
lastWorkSchedule := new(model.WorkScheduleInfo)
// 下一流程
nextScheduleInfo := new(model.WorkScheduleInfo)
@ -503,8 +509,13 @@ func (c *Instance) Examine(id uint64, status int, remark string, isAssist int, p
if _status == model2.WorkProgressStatusForRefuse {
goto FINISH
}
// 上一流程信息
if lastWorkSchedule, err = mWorkSchedule.LastSchedule(); err != nil {
return err
}
//
// 下一流程信息
if nextScheduleInfo, err = mWorkSchedule.NextSchedule(model2.WorkInstanceAssist(isAssist) == model2.WorkInstanceAssistForYes); err != nil {
if nextScheduleInfo, err = mWorkSchedule.NextSchedule(mWorkInstance.IsAssist == model2.WorkInstanceAssistForYes); err != nil {
return err
}
// 无下一流程,工单直接完成
@ -514,7 +525,8 @@ func (c *Instance) Examine(id uint64, status int, remark string, isAssist int, p
workUpdates["status"] = model2.WorkInstanceStatusForOngoing
workUpdates["schedule"] = nextScheduleInfo.ID
if nextScheduleInfo.IsNextStage {
// 当前阶段无上一流程才会更新
if lastWorkSchedule == nil {
workUpdates["is_assist"] = isAssist
}
FINISH:

View File

@ -39,10 +39,10 @@ func (c *Repair) List(orderNo, equipmentCode, equipmentTitle string, page, pageS
where = append(where, model2.NewWhereLike("r.order_no", orderNo))
}
if equipmentCode != "" {
where = append(where, model2.NewWhereLike("w.code", equipmentCode))
where = append(where, model2.NewWhereLike("e.code", equipmentCode))
}
if equipmentTitle != "" {
where = append(where, model2.NewWhereLike("w.title", equipmentTitle))
where = append(where, model2.NewWhereLike("e.title", equipmentTitle))
}
var count int64
@ -55,11 +55,11 @@ func (c *Repair) List(orderNo, equipmentCode, equipmentTitle string, page, pageS
for _, v := range out {
list = append(list, &RepairInfo{
CommonIDString: basic.CommonIDString{v.GetEncodeID()},
CommonIDString: basic.CommonIDString{ID: v.GetEncodeID()},
WorkRepairInfo: v,
})
}
return &basic.PageDataResponse{Data: nil, Count: 0}, nil
return &basic.PageDataResponse{Data: list, Count: count}, nil
}
// Detail 详细信息
@ -80,7 +80,7 @@ func (c *Repair) Detail(id uint64) (*RepairDetailInfo, error) {
}
return &RepairDetailInfo{
RepairInfo: &RepairInfo{
CommonIDString: basic.CommonIDString{repair.GetEncodeID()},
CommonIDString: basic.CommonIDString{ID: repair.GetEncodeID()},
WorkRepairInfo: repair,
},
Details: details,
@ -211,7 +211,7 @@ func (c *Repair) Evaluate(id uint64, score float64) error {
if isExist, err = model2.FirstField(mManageSupplierEvaluate.ManageSupplierEvaluate, []string{"id"},
model2.NewWhere("id", v)); err != nil {
return err
} else if !isExist {
} else if isExist {
if err = model2.Updates(mManageSupplierEvaluate.ManageSupplierEvaluate, updates, tx); err != nil {
return err
}
@ -222,7 +222,7 @@ func (c *Repair) Evaluate(id uint64, score float64) error {
if score == 1 {
data.Praise = 1
} else if score == 2 {
data.Middle = 2
data.Middle = 1
} else {
data.Negative = 1
}
@ -237,6 +237,13 @@ func (c *Repair) Evaluate(id uint64, score float64) error {
})
}
// Delete 删除操作
func (c *Repair) Delete(id uint64) error {
mWorkRepair := model.NewWorkRepair()
mWorkRepair.ID = id
return model2.Delete(mWorkRepair.WorkRepair)
}
func NewRepair() RepairHandle {
return func(session *service.Session) *Repair {
return &Repair{session}