|
@@ -17,6 +17,7 @@ import (
|
|
// 电销工单生成
|
|
// 电销工单生成
|
|
func rderAcceptance() {
|
|
func rderAcceptance() {
|
|
sql := fmt.Sprintf(`select * from order_acceptance where is_clue=2 and is_delete=1 order by propose_time `)
|
|
sql := fmt.Sprintf(`select * from order_acceptance where is_clue=2 and is_delete=1 order by propose_time `)
|
|
|
|
+ //sql := fmt.Sprintf(`select * from order_acceptance where is_clue=2 and is_delete=1 and id = 255 order by propose_time `)
|
|
data := WorkOrder.SelectBySql(sql)
|
|
data := WorkOrder.SelectBySql(sql)
|
|
if data != nil && len(*data) > 0 {
|
|
if data != nil && len(*data) > 0 {
|
|
for _, v := range *data {
|
|
for _, v := range *data {
|
|
@@ -184,16 +185,24 @@ func AddOrderWork(acceptanceData map[string]interface{}, userData map[string]int
|
|
"two_type": two_type,
|
|
"two_type": two_type,
|
|
"department_no": gconv.String(personMap["deptId"]),
|
|
"department_no": gconv.String(personMap["deptId"]),
|
|
"department_name": gconv.String(personMap["deptName"]),
|
|
"department_name": gconv.String(personMap["deptName"]),
|
|
|
|
+ "update_time": nowTime,
|
|
}
|
|
}
|
|
ok3 := WorkOrder.Insert("order_work", orderWorkMap)
|
|
ok3 := WorkOrder.Insert("order_work", orderWorkMap)
|
|
if ok3 > 0 {
|
|
if ok3 > 0 {
|
|
|
|
+ status := 2
|
|
|
|
+ if WorkOrder.Count("order_work", map[string]interface{}{
|
|
|
|
+ "status": 1,
|
|
|
|
+ "acceptance_no": gconv.String(acceptanceData["acceptance_no"]),
|
|
|
|
+ }) > 0 {
|
|
|
|
+ status = 1
|
|
|
|
+ }
|
|
WorkOrder.Update("order_acceptance", map[string]interface{}{
|
|
WorkOrder.Update("order_acceptance", map[string]interface{}{
|
|
"id": acceptanceData["id"],
|
|
"id": acceptanceData["id"],
|
|
}, map[string]interface{}{
|
|
}, map[string]interface{}{
|
|
- "is_clue": 3,
|
|
|
|
|
|
+ "is_clue": 3,
|
|
|
|
+ "status": status,
|
|
|
|
+ "over_time": nowTime,
|
|
})
|
|
})
|
|
- //发送邮件
|
|
|
|
-
|
|
|
|
//日志添加
|
|
//日志添加
|
|
approvalRecordMap := map[string]interface{}{
|
|
approvalRecordMap := map[string]interface{}{
|
|
"work_order_no": work_order_no,
|
|
"work_order_no": work_order_no,
|
|
@@ -214,12 +223,11 @@ func AddOrderWork(acceptanceData map[string]interface{}, userData map[string]int
|
|
gconv.String(personMap["name"]),
|
|
gconv.String(personMap["name"]),
|
|
gconv.String(acceptanceData["creator_name"]),
|
|
gconv.String(acceptanceData["creator_name"]),
|
|
nowTime,
|
|
nowTime,
|
|
- gconv.String(acceptanceData["acceptance_no"]),
|
|
|
|
|
|
+ work_order_no,
|
|
phone,
|
|
phone,
|
|
company)
|
|
company)
|
|
return true
|
|
return true
|
|
}
|
|
}
|
|
-
|
|
|
|
return false
|
|
return false
|
|
}
|
|
}
|
|
|
|
|
|
@@ -320,7 +328,7 @@ func FindPosition(positionId int64, trailstatus string, full bool) (bool, map[st
|
|
b.seat_number
|
|
b.seat_number
|
|
FROM
|
|
FROM
|
|
dwd_d_crm_department_level_succbi a
|
|
dwd_d_crm_department_level_succbi a
|
|
- INNER JOIN dwd_f_crm_personnel_management b ON a.resign = 0
|
|
|
|
|
|
+ INNER JOIN dwd_f_crm_personnel_management b ON a.resign = 0 and b.resign = 0
|
|
AND a.ent_id = 25917
|
|
AND a.ent_id = 25917
|
|
AND a.dept_name LIKE "%电销部%"
|
|
AND a.dept_name LIKE "%电销部%"
|
|
AND a.position_id = b.position_id`)
|
|
AND a.position_id = b.position_id`)
|
|
@@ -330,7 +338,7 @@ FROM
|
|
b.seat_number
|
|
b.seat_number
|
|
FROM
|
|
FROM
|
|
dwd_d_crm_department_level_succbi a
|
|
dwd_d_crm_department_level_succbi a
|
|
- INNER JOIN dwd_f_crm_personnel_management b ON a.resign = 0
|
|
|
|
|
|
+ INNER JOIN dwd_f_crm_personnel_management b ON a.resign = 0 and b.resign = 0
|
|
AND a.ent_id = 25917
|
|
AND a.ent_id = 25917
|
|
AND a.resign = 0
|
|
AND a.resign = 0
|
|
AND a.dept_name LIKE "%销售三部"
|
|
AND a.dept_name LIKE "%销售三部"
|