|
@@ -12,6 +12,7 @@ import (
|
|
|
"github.com/beego/beego/v2/adapter/orm"
|
|
|
orm2 "github.com/beego/beego/v2/client/orm"
|
|
|
_ "github.com/go-sql-driver/mysql"
|
|
|
+ "log"
|
|
|
"strings"
|
|
|
"time"
|
|
|
)
|
|
@@ -224,12 +225,13 @@ type Task struct {
|
|
|
|
|
|
// 报告
|
|
|
T_reporting_start_time string `orm:"size(256);null"` // 验证报告开始时间 接收信息采集表的时间
|
|
|
- T_reporting_end_time string `orm:"size(256);null"` // 验证报告结束时间 负责人审核通过后最后一次上传时间
|
|
|
+ T_reporting_end_time string `orm:"size(256);null"` // 验证报告结束时间 负责人审核通过前最后一次上传时间
|
|
|
T_reporting_time_interval float64 `orm:"size(256);null"` // 时间间隔 单位分钟
|
|
|
T_reporting_overtime float64 `orm:"size(256);null"` // 验证报告超时时间 单位分钟
|
|
|
T_reporting_signature string `orm:"type(text)"` // 验证报告客户签字确认图片
|
|
|
T_reporting_return_times int `orm:"size(256);null"` // 验证报告退回次数
|
|
|
T_reporting_audit_record string `orm:"type(text);null"` // 验证报告审核记录
|
|
|
+ T_reporting_pass_time string `orm:"size(256);null"` // 验证报告负责人通过时间
|
|
|
|
|
|
CreateTime time.Time `orm:"column(create_time);type(timestamp);null;auto_now_add"` //auto_now_add 第一次保存时才设置时间
|
|
|
UpdateTime time.Time `orm:"column(update_time);type(timestamp);null;auto_now"` //auto_now 每次 model 保存时都会对时间自动更新
|
|
@@ -292,6 +294,9 @@ type Task_ struct {
|
|
|
InfoCollection InfoCollection.InfoCollection //信息采集
|
|
|
T_record string //
|
|
|
|
|
|
+ T_device_type string
|
|
|
+ T_verify_type string
|
|
|
+ T_reporting_pass_time string
|
|
|
}
|
|
|
|
|
|
type Task_Stat struct {
|
|
@@ -480,6 +485,10 @@ func TaskToTask_(T Task, userMap, adminMap map[string]string) (T_ Task_) {
|
|
|
T_.T_CalibrationExpirationTime = T.T_CalibrationExpirationTime
|
|
|
T_.T_record = T.T_record
|
|
|
|
|
|
+ T_.T_device_type = T.T_device_type
|
|
|
+ T_.T_verify_type = T.T_verify_type
|
|
|
+ T_.T_reporting_pass_time = T.T_reporting_pass_time
|
|
|
+
|
|
|
return T_
|
|
|
}
|
|
|
func TaskToTask_Stat(T Task, userMap, adminMap map[string]string) (T_ Task_Stat) {
|
|
@@ -803,7 +812,6 @@ func Read_UserTask_List(T_uuid string, T_name string, userMap, adminMap map[stri
|
|
|
offset = int64((page - 1) * page_z)
|
|
|
}
|
|
|
cond := orm.NewCondition()
|
|
|
- //cond1 := cond.And("T_name__icontains", T_name).And("T_State", 1)
|
|
|
cond1 := cond.And("T_name__icontains", T_name).And("T_Show", 1).And("T_State", 1)
|
|
|
if len(T_uuid) > 0 {
|
|
|
cond1 = cond1.And("T_uuid", T_uuid)
|
|
@@ -1107,3 +1115,32 @@ func Read_UserTask_StatisticalRanking(T_uuid, T_scheme string) []Task {
|
|
|
|
|
|
return r
|
|
|
}
|
|
|
+
|
|
|
+// 获取任务列表
|
|
|
+func Read_Task_List_For_ERP(T_reporting_pass_time string) ([]Task_, int) {
|
|
|
+
|
|
|
+ o := orm.NewOrm()
|
|
|
+
|
|
|
+ qs := o.QueryTable(new(Task))
|
|
|
+ var r []Task
|
|
|
+
|
|
|
+ cond := orm.NewCondition()
|
|
|
+ cond1 := cond.And("T_State", 1).And("T_reporting_state", TaskReportingStatePass)
|
|
|
+ if len(T_reporting_pass_time) > 0 {
|
|
|
+ start := T_reporting_pass_time + " 00:00:00"
|
|
|
+ end := T_reporting_pass_time + " 23:59:59"
|
|
|
+ log.Println("CreateTime_s:", start, end)
|
|
|
+ cond1 = cond1.And("T_reporting_pass_time__gte", start).And("T_reporting_pass_time__lte", end)
|
|
|
+ }
|
|
|
+
|
|
|
+ qs.SetCond((*orm2.Condition)(cond1)).OrderBy("-Id").All(&r)
|
|
|
+ cnt, _ := qs.SetCond((*orm2.Condition)(cond1)).Count()
|
|
|
+
|
|
|
+ // 转换
|
|
|
+ var TaskList []Task_
|
|
|
+ for _, v := range r {
|
|
|
+ TaskList = append(TaskList, TaskToTask_(v, map[string]string{}, map[string]string{}))
|
|
|
+ }
|
|
|
+
|
|
|
+ return TaskList, int(cnt)
|
|
|
+}
|