完善工单处理及添加工单列表
This commit is contained in:
parent
1ad8901568
commit
ceefbcb794
@ -261,6 +261,7 @@ func UnityWorkOrder(c *gin.Context) {
|
|||||||
err error
|
err error
|
||||||
workOrderId string
|
workOrderId string
|
||||||
workOrderInfo process.WorkOrderInfo
|
workOrderInfo process.WorkOrderInfo
|
||||||
|
userInfo system.SysUser
|
||||||
)
|
)
|
||||||
|
|
||||||
workOrderId = c.DefaultQuery("work_oroder_id", "")
|
workOrderId = c.DefaultQuery("work_oroder_id", "")
|
||||||
@ -295,13 +296,23 @@ func UnityWorkOrder(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取当前用户信息
|
||||||
|
err = tx.Model(&userInfo).
|
||||||
|
Where("user_id = ?", tools.GetUserId(c)).
|
||||||
|
Find(&userInfo).Error
|
||||||
|
if err != nil {
|
||||||
|
tx.Rollback()
|
||||||
|
app.Error(c, -1, err, fmt.Sprintf("当前用户查询失败,%v", err.Error()))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// 写入历史
|
// 写入历史
|
||||||
tx.Create(&process.CirculationHistory{
|
tx.Create(&process.CirculationHistory{
|
||||||
Title: workOrderInfo.Title,
|
Title: workOrderInfo.Title,
|
||||||
WorkOrder: workOrderInfo.Id,
|
WorkOrder: workOrderInfo.Id,
|
||||||
State: "结束工单",
|
State: "结束工单",
|
||||||
Circulation: "结束",
|
Circulation: "结束",
|
||||||
Processor: c.GetString("nickname"),
|
Processor: userInfo.NickName,
|
||||||
ProcessorId: tools.GetUserId(c),
|
ProcessorId: tools.GetUserId(c),
|
||||||
Remarks: "手动结束工单。",
|
Remarks: "手动结束工单。",
|
||||||
})
|
})
|
||||||
@ -320,6 +331,7 @@ func InversionWorkOrder(c *gin.Context) {
|
|||||||
stateValue []byte
|
stateValue []byte
|
||||||
currentState map[string]interface{}
|
currentState map[string]interface{}
|
||||||
userInfo system.SysUser
|
userInfo system.SysUser
|
||||||
|
currentUserInfo system.SysUser
|
||||||
params struct {
|
params struct {
|
||||||
WorkOrderId int `json:"work_order_id"`
|
WorkOrderId int `json:"work_order_id"`
|
||||||
NodeId string `json:"node_id"`
|
NodeId string `json:"node_id"`
|
||||||
@ -328,6 +340,15 @@ func InversionWorkOrder(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// 获取当前用户信息
|
||||||
|
err = orm.Eloquent.Model(¤tUserInfo).
|
||||||
|
Where("user_id = ?", tools.GetUserId(c)).
|
||||||
|
Find(¤tUserInfo).Error
|
||||||
|
if err != nil {
|
||||||
|
app.Error(c, -1, err, fmt.Sprintf("当前用户查询失败,%v", err.Error()))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
err = c.ShouldBind(¶ms)
|
err = c.ShouldBind(¶ms)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
app.Error(c, -1, err, "")
|
app.Error(c, -1, err, "")
|
||||||
@ -391,7 +412,7 @@ func InversionWorkOrder(c *gin.Context) {
|
|||||||
WorkOrder: workOrderInfo.Id,
|
WorkOrder: workOrderInfo.Id,
|
||||||
State: currentState["label"].(string),
|
State: currentState["label"].(string),
|
||||||
Circulation: "转交",
|
Circulation: "转交",
|
||||||
Processor: c.GetString("nickname"),
|
Processor: currentUserInfo.NickName,
|
||||||
ProcessorId: tools.GetUserId(c),
|
ProcessorId: tools.GetUserId(c),
|
||||||
Remarks: fmt.Sprintf("此阶段负责人已转交给《%v》", userInfo.NickName),
|
Remarks: fmt.Sprintf("此阶段负责人已转交给《%v》", userInfo.NickName),
|
||||||
})
|
})
|
||||||
|
@ -21,8 +21,8 @@ func GetPrincipal(processor []int, processMethod string) (principals string, err
|
|||||||
switch processMethod {
|
switch processMethod {
|
||||||
case "person":
|
case "person":
|
||||||
err = orm.Eloquent.Model(&system.SysUser{}).
|
err = orm.Eloquent.Model(&system.SysUser{}).
|
||||||
Where("id in (?)", processor).
|
Where("user_id in (?)", processor).
|
||||||
Pluck("nickname", &principalList).Error
|
Pluck("nick_name", &principalList).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,9 @@ import (
|
|||||||
"ferry/global/orm"
|
"ferry/global/orm"
|
||||||
"ferry/models/base"
|
"ferry/models/base"
|
||||||
"ferry/models/process"
|
"ferry/models/process"
|
||||||
|
"ferry/models/system"
|
||||||
"ferry/tools"
|
"ferry/tools"
|
||||||
|
"ferry/tools/app"
|
||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
"time"
|
"time"
|
||||||
@ -330,6 +332,7 @@ func (h *Handle) HandleWorkOrder(
|
|||||||
relatedPersonValue []byte
|
relatedPersonValue []byte
|
||||||
parallelStatusOk bool
|
parallelStatusOk bool
|
||||||
processInfo process.Info
|
processInfo process.Info
|
||||||
|
currentUserInfo system.SysUser
|
||||||
)
|
)
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
@ -616,6 +619,15 @@ func (h *Handle) HandleWorkOrder(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取当前用户信息
|
||||||
|
err = orm.Eloquent.Model(¤tUserInfo).
|
||||||
|
Where("user_id = ?", tools.GetUserId(c)).
|
||||||
|
Find(¤tUserInfo).Error
|
||||||
|
if err != nil {
|
||||||
|
app.Error(c, -1, err, fmt.Sprintf("当前用户查询失败,%v", err.Error()))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
cirHistoryData = process.CirculationHistory{
|
cirHistoryData = process.CirculationHistory{
|
||||||
Model: base.Model{},
|
Model: base.Model{},
|
||||||
Title: h.workOrderDetails.Title,
|
Title: h.workOrderDetails.Title,
|
||||||
@ -624,7 +636,7 @@ func (h *Handle) HandleWorkOrder(
|
|||||||
Source: h.stateValue["id"].(string),
|
Source: h.stateValue["id"].(string),
|
||||||
Target: h.targetStateValue["id"].(string),
|
Target: h.targetStateValue["id"].(string),
|
||||||
Circulation: circulationValue,
|
Circulation: circulationValue,
|
||||||
Processor: c.GetString("nickname"),
|
Processor: currentUserInfo.NickName,
|
||||||
ProcessorId: tools.GetUserId(c),
|
ProcessorId: tools.GetUserId(c),
|
||||||
CostDuration: costDurationValue,
|
CostDuration: costDurationValue,
|
||||||
}
|
}
|
||||||
@ -643,7 +655,7 @@ func (h *Handle) HandleWorkOrder(
|
|||||||
WorkOrder: h.workOrderDetails.Id,
|
WorkOrder: h.workOrderDetails.Id,
|
||||||
State: h.targetStateValue["label"].(string),
|
State: h.targetStateValue["label"].(string),
|
||||||
Source: h.targetStateValue["id"].(string),
|
Source: h.targetStateValue["id"].(string),
|
||||||
Processor: c.GetString("nickname"),
|
Processor: currentUserInfo.NickName,
|
||||||
ProcessorId: tools.GetUserId(c),
|
ProcessorId: tools.GetUserId(c),
|
||||||
Circulation: "结束",
|
Circulation: "结束",
|
||||||
}).Error
|
}).Error
|
||||||
|
@ -32,7 +32,7 @@ func WorkOrderList(c *gin.Context, classify int) (result interface{}, err error)
|
|||||||
title := c.DefaultQuery("title", "")
|
title := c.DefaultQuery("title", "")
|
||||||
db := orm.Eloquent.Model(&process.WorkOrderInfo{}).Where("title like ?", fmt.Sprintf("%%%v%%", title))
|
db := orm.Eloquent.Model(&process.WorkOrderInfo{}).Where("title like ?", fmt.Sprintf("%%%v%%", title))
|
||||||
|
|
||||||
err = orm.Eloquent.Model(&system.SysUser{}).Where("id = ?", tools.GetUserId(c)).Find(&userInfo).Error
|
err = orm.Eloquent.Model(&system.SysUser{}).Where("user_id = ?", tools.GetUserId(c)).Find(&userInfo).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user