|
@@ -52,9 +52,9 @@ func (c *TaskDataController) TaskData_List() {
|
|
|
T_id := c.GetString("T_id")
|
|
|
|
|
|
T_task_id := c.GetString("T_task_id")
|
|
|
- Task_r, err := NatsServer.Read_Task(T_task_id)
|
|
|
+ Task_r, err := Task.Read_Task(T_task_id)
|
|
|
if err != nil {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_task_id 错误!"}
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "获取任务信息失败!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
@@ -96,44 +96,110 @@ func (c *TaskDataController) TaskData_Temperature_Pdf() {
|
|
|
Time_start := c.GetString("Time_start")
|
|
|
Time_end := c.GetString("Time_end")
|
|
|
T_snid := c.GetString("T_snid")
|
|
|
-
|
|
|
T_task_id := c.GetString("T_task_id")
|
|
|
- Task_r, err := NatsServer.Read_Task(T_task_id)
|
|
|
+
|
|
|
+ err := c.TaskData_Pdf(Time_start, Time_end, T_task_id, T_snid, Task.Temperature)
|
|
|
if err != nil {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_task_id 错误!"}
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: err.Error()}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
|
- if Task_r.T_collection_state == 2 {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "数据采集中,请稍后!"}
|
|
|
+}
|
|
|
+func (c *TaskDataController) TaskData_Humidity_Pdf() {
|
|
|
+
|
|
|
+ Time_start := c.GetString("Time_start")
|
|
|
+ Time_end := c.GetString("Time_end")
|
|
|
+ T_snid := c.GetString("T_snid")
|
|
|
+ T_task_id := c.GetString("T_task_id")
|
|
|
+ err := c.TaskData_Pdf(Time_start, Time_end, T_task_id, T_snid, Task.Humidity)
|
|
|
+ if err != nil {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: err.Error()}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+}
|
|
|
+func (c *TaskDataController) TaskData_Pdf(Time_start, Time_end, T_task_id, T_snid, T_type string) (err error) {
|
|
|
+
|
|
|
+ Time_start_b := Time_start
|
|
|
+ Time_end_b := Time_end
|
|
|
+
|
|
|
+ Task_r, err := Task.Read_Task(T_task_id)
|
|
|
+ if err != nil {
|
|
|
+ return errors.New("获取任务信息失败!")
|
|
|
+ }
|
|
|
+ if Task_r.T_collection_state == 2 {
|
|
|
+ return errors.New("数据采集中,请稍后!")
|
|
|
+ }
|
|
|
user, err := NatsServer.Read_User(Task_r.T_uuid)
|
|
|
var T_snid_list []string
|
|
|
if len(T_snid) > 0 {
|
|
|
T_snid_list = strings.Split(strings.Trim(T_snid, "|"), "|")
|
|
|
}
|
|
|
|
|
|
+ pdf := &gopdf.GoPdf{}
|
|
|
+ pdf.Start(gopdf.Config{PageSize: gopdf.Rect{W: 595.28, H: 841.89}}) //595.28, 841.89 = A4
|
|
|
+
|
|
|
+ err = pdf.AddTTFFont("wts", "static/fonts/MiSans-Medium.ttf")
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ err = pdf.SetFont("wts", "", 10)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
dataMap := make(map[string]string)
|
|
|
timeMap := make(map[string]bool)
|
|
|
- //classList := Task.Read_TaskData_ById_ClassList(Task_r.T_task_id)
|
|
|
- //for _, i2 := range classList {
|
|
|
- // T_snid_list = append(T_snid_list, fmt.Sprintf("%s,%s", i2.T_sn, i2.T_id))
|
|
|
- //}
|
|
|
+ idWidthMap := make(map[string]float64)
|
|
|
+ dataListMap := make(map[string][]Task.TaskData_)
|
|
|
+ T_snid_list1 := []string{}
|
|
|
+ T_snid_list2 := []string{}
|
|
|
+
|
|
|
for _, v := range T_snid_list {
|
|
|
sn_id := strings.Split(v, ",")
|
|
|
if len(sn_id) == 2 {
|
|
|
List, _ := Task.Read_TaskData_ById_List(Task_r.T_task_id, sn_id[0], sn_id[1], Time_start, Time_end, 0, 9999)
|
|
|
-
|
|
|
+ if len(List) == 0 {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ idw, _ := pdf.MeasureTextWidth(sn_id[1])
|
|
|
+ if !lib.IsNumeric(sn_id[1]) {
|
|
|
+ //IsNotNumeric = true
|
|
|
+ T_snid_list1 = append(T_snid_list1, v)
|
|
|
+ if len(Task_r.T_BindDeviceDataStartTime) > 0 {
|
|
|
+ Time_start = Task_r.T_BindDeviceDataStartTime
|
|
|
+ }
|
|
|
+ if len(Task_r.T_BindDeviceDataEndTime) > 0 {
|
|
|
+ Time_end = Task_r.T_BindDeviceDataEndTime
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ T_snid_list2 = append(T_snid_list2, v)
|
|
|
+ }
|
|
|
+ if idw > 20 {
|
|
|
+ idWidthMap[sn_id[1]] = idw + 12
|
|
|
+ } else {
|
|
|
+ idWidthMap[sn_id[1]] = 30.3
|
|
|
+ }
|
|
|
+ sort.Slice(List, func(i, j int) bool {
|
|
|
+ return List[i].T_time < List[j].T_time
|
|
|
+ })
|
|
|
+ dataListMap[sn_id[1]] = List
|
|
|
for _, data := range List {
|
|
|
k := fmt.Sprintf("%s,%s", data.T_time, data.T_id)
|
|
|
- dataMap[k] = fmt.Sprintf("%.1f", data.T_t)
|
|
|
+ if T_type == Task.Temperature {
|
|
|
+ dataMap[k] = fmt.Sprintf("%.1f", data.T_t)
|
|
|
+ }
|
|
|
+ if T_type == Task.Humidity {
|
|
|
+ dataMap[k] = fmt.Sprintf("%.1f", data.T_rh)
|
|
|
+ }
|
|
|
if _, ok := timeMap[data.T_time]; !ok {
|
|
|
timeMap[data.T_time] = true
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ Time_start = Time_start_b
|
|
|
+ Time_end = Time_end_b
|
|
|
}
|
|
|
|
|
|
var timeList []string
|
|
@@ -144,13 +210,6 @@ func (c *TaskDataController) TaskData_Temperature_Pdf() {
|
|
|
return timeList[i] < timeList[j]
|
|
|
})
|
|
|
|
|
|
- pdf := &gopdf.GoPdf{}
|
|
|
- pdf.Start(gopdf.Config{PageSize: gopdf.Rect{W: 595.28, H: 841.89}}) //595.28, 841.89 = A4
|
|
|
-
|
|
|
- err = pdf.AddTTFFont("wts", "static/fonts/MiSans-Medium.ttf")
|
|
|
- if err != nil {
|
|
|
- return
|
|
|
- }
|
|
|
err = pdf.SetFont("wts", "", 15)
|
|
|
if err != nil {
|
|
|
return
|
|
@@ -171,12 +230,23 @@ func (c *TaskDataController) TaskData_Temperature_Pdf() {
|
|
|
pdf.Text(name)
|
|
|
|
|
|
y += 20
|
|
|
- title := Task_r.T_name + "温度验证数据"
|
|
|
+ T_type_name := ""
|
|
|
+ if T_type == Task.Temperature {
|
|
|
+ T_type_name = "温度"
|
|
|
+ }
|
|
|
+ if T_type == Task.Humidity {
|
|
|
+ T_type_name = "湿度"
|
|
|
+ }
|
|
|
+ title := Task_r.T_name + T_type_name + "验证数据"
|
|
|
textw, _ = pdf.MeasureTextWidth(title)
|
|
|
pdf.SetX((595 / 2) - (textw / 2))
|
|
|
pdf.SetY(y)
|
|
|
pdf.Text(title)
|
|
|
|
|
|
+ err = pdf.SetFont("wts", "", 12)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
if len(timeList) > 0 {
|
|
|
y += 20
|
|
|
timeStr := fmt.Sprintf("%s - %s", timeList[0], timeList[len(timeList)-1])
|
|
@@ -194,189 +264,116 @@ func (c *TaskDataController) TaskData_Temperature_Pdf() {
|
|
|
y += 20
|
|
|
var x float64 = 10
|
|
|
var w float64 = 120
|
|
|
+ sort.Slice(T_snid_list1, func(i, j int) bool {
|
|
|
+ return extractSecondElement(T_snid_list1[i]) < extractSecondElement(T_snid_list1[j])
|
|
|
+ })
|
|
|
+ for _, v := range T_snid_list1 {
|
|
|
+ sn_id := strings.Split(v, ",")
|
|
|
+ id := sn_id[1]
|
|
|
+ dataList2, _ := dataListMap[id]
|
|
|
|
|
|
- chunks := chunkBy(T_snid_list, 15)
|
|
|
- for _, list := range chunks {
|
|
|
- x = 10
|
|
|
- w = 120
|
|
|
- lib.RectFillColor(pdf, "时间", 12, x, y, w, 20, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)
|
|
|
- x += w
|
|
|
- w = 30
|
|
|
- for _, v2 := range list {
|
|
|
- sn_id2 := strings.Split(v2, ",")
|
|
|
- id2 := sn_id2[1]
|
|
|
- lib.RectFillColor(pdf, id2, 12, x, y, w, 20, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)
|
|
|
- x += w
|
|
|
+ err = pdf.SetFont("wts", "", 15)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
}
|
|
|
+ var textH float64 = 20 // if text height is 25px.
|
|
|
y += 20
|
|
|
+ pdf.SetNewY(y, textH)
|
|
|
+ y = pdf.GetY()
|
|
|
+ if y > 790 {
|
|
|
+ pdf.AddPage()
|
|
|
+ y = 20
|
|
|
+ }
|
|
|
|
|
|
- for _, t := range timeList {
|
|
|
+ textw, _ = pdf.MeasureTextWidth(id)
|
|
|
+ pdf.SetX((595 / 2) - (textw / 2))
|
|
|
+ pdf.SetY(y)
|
|
|
+ pdf.Text(id)
|
|
|
+ y += 10
|
|
|
+
|
|
|
+ err = pdf.SetFont("wts", "", 10)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ pdf.SetNewY(y, textH)
|
|
|
+ y = pdf.GetY()
|
|
|
+ if y < 790 {
|
|
|
x = 10
|
|
|
- var textH float64 = 20 // if text height is 25px.
|
|
|
- pdf.SetNewY(y, textH)
|
|
|
- y = pdf.GetY()
|
|
|
- if y == 20 {
|
|
|
- w = 120
|
|
|
+ for i := 0; i < 4; i++ {
|
|
|
+ w = 113.8
|
|
|
lib.RectFillColor(pdf, "时间", 12, x, y, w, 20, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)
|
|
|
x += w
|
|
|
w = 30
|
|
|
- for _, v2 := range list {
|
|
|
- sn_id2 := strings.Split(v2, ",")
|
|
|
- id2 := sn_id2[1]
|
|
|
- lib.RectFillColor(pdf, id2, 12, x, y, w, 20, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)
|
|
|
- x += w
|
|
|
- }
|
|
|
- y += 20
|
|
|
- x = 10
|
|
|
+ lib.RectFillColor(pdf, T_type_name, 12, x, y, w, 20, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)
|
|
|
+ x += w
|
|
|
}
|
|
|
- w = 120
|
|
|
- lib.RectFillColor(pdf, t, 12, x, y, w, 20, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)
|
|
|
- x += w
|
|
|
- w = 30
|
|
|
- for _, v := range list {
|
|
|
- sn_id := strings.Split(v, ",")
|
|
|
- id := sn_id[1]
|
|
|
- t_t := dataMap[fmt.Sprintf("%s,%s", t, id)]
|
|
|
- lib.RectFillColor(pdf, t_t, 12, x, y, w, 20, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)
|
|
|
+ y += 20
|
|
|
+ } else {
|
|
|
+ pdf.AddPage()
|
|
|
+ y = 20
|
|
|
+ x = 10
|
|
|
+ for i := 0; i < 4; i++ {
|
|
|
+ w = 113.8
|
|
|
+ lib.RectFillColor(pdf, "时间", 12, x, y, w, 20, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)
|
|
|
+ x += w
|
|
|
+ w = 30
|
|
|
+ lib.RectFillColor(pdf, T_type_name, 12, x, y, w, 20, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)
|
|
|
x += w
|
|
|
}
|
|
|
y += 20
|
|
|
-
|
|
|
}
|
|
|
- y += 20
|
|
|
- }
|
|
|
- filename := time.Now().Format("20060102150405") + ".pdf"
|
|
|
- timeStr := "ofile/温度" + filename
|
|
|
-
|
|
|
- err = pdf.WritePdf(timeStr)
|
|
|
- if err != nil {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: err.Error()}
|
|
|
- c.ServeJSON()
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- defer func() {
|
|
|
- //删除目录
|
|
|
- os.Remove(timeStr)
|
|
|
- }()
|
|
|
+ for i := 0; i < len(dataList2); i++ {
|
|
|
+ temp := i % 4
|
|
|
+ x = 10 + 143.8*float64(temp)
|
|
|
+ w = 113.8
|
|
|
|
|
|
- c.Ctx.Output.Download(timeStr)
|
|
|
-
|
|
|
-}
|
|
|
-func (c *TaskDataController) TaskData_Humidity_Pdf() {
|
|
|
-
|
|
|
- Time_start := c.GetString("Time_start")
|
|
|
- Time_end := c.GetString("Time_end")
|
|
|
- T_snid := c.GetString("T_snid")
|
|
|
-
|
|
|
- T_task_id := c.GetString("T_task_id")
|
|
|
- Task_r, err := NatsServer.Read_Task(T_task_id)
|
|
|
- if err != nil {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_task_id 错误!"}
|
|
|
- c.ServeJSON()
|
|
|
- return
|
|
|
- }
|
|
|
- if Task_r.T_collection_state == 2 {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "数据采集中,请稍后!"}
|
|
|
- c.ServeJSON()
|
|
|
- return
|
|
|
- }
|
|
|
- user, err := NatsServer.Read_User(Task_r.T_uuid)
|
|
|
- var T_snid_list []string
|
|
|
- if len(T_snid) > 0 {
|
|
|
- T_snid_list = strings.Split(strings.Trim(T_snid, "|"), "|")
|
|
|
- }
|
|
|
-
|
|
|
- dataMap := make(map[string]string)
|
|
|
- timeMap := make(map[string]bool)
|
|
|
- //classList := Task.Read_TaskData_ById_ClassList(Task_r.T_task_id)
|
|
|
- //for _, i2 := range classList {
|
|
|
- // T_snid_list = append(T_snid_list, fmt.Sprintf("%s,%s", i2.T_sn, i2.T_id))
|
|
|
- //}
|
|
|
- for _, v := range T_snid_list {
|
|
|
- sn_id := strings.Split(v, ",")
|
|
|
- if len(sn_id) == 2 {
|
|
|
- List, _ := Task.Read_TaskData_ById_List(Task_r.T_task_id, sn_id[0], sn_id[1], Time_start, Time_end, 0, 9999)
|
|
|
-
|
|
|
- for _, data := range List {
|
|
|
- k := fmt.Sprintf("%s,%s", data.T_time, data.T_id)
|
|
|
- dataMap[k] = fmt.Sprintf("%.1f", data.T_rh)
|
|
|
- if _, ok := timeMap[data.T_time]; !ok {
|
|
|
- timeMap[data.T_time] = true
|
|
|
+ lib.RectFillColor(pdf, dataList2[i].T_time, 12, x, y, w, 20, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)
|
|
|
+ x += w
|
|
|
+ w = 30
|
|
|
+ if T_type == Task.Temperature {
|
|
|
+ lib.RectFillColor(pdf, fmt.Sprintf("%.1f", dataList2[i].T_t), 12, x, y, w, 20, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)
|
|
|
+ }
|
|
|
+ if T_type == Task.Humidity {
|
|
|
+ lib.RectFillColor(pdf, fmt.Sprintf("%.1f", dataList2[i].T_rh), 12, x, y, w, 20, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)
|
|
|
+ }
|
|
|
+ if temp == 3 {
|
|
|
+ y += 20
|
|
|
+ pdf.SetNewY(y, textH)
|
|
|
+ y = pdf.GetY()
|
|
|
+ // 每页添加表头
|
|
|
+ if y == 20 {
|
|
|
+ x = 10
|
|
|
+ for k := 0; k < 4; k++ {
|
|
|
+ w = 113.8
|
|
|
+ lib.RectFillColor(pdf, "时间", 12, x, y, w, 20, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)
|
|
|
+ x += w
|
|
|
+ w = 30
|
|
|
+ lib.RectFillColor(pdf, T_type_name, 12, x, y, w, 20, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)
|
|
|
+ x += w
|
|
|
+ }
|
|
|
+ y += 20
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+ y += 25
|
|
|
|
|
|
- var timeList []string
|
|
|
- for k, _ := range timeMap {
|
|
|
- timeList = append(timeList, k)
|
|
|
- }
|
|
|
- sort.Slice(timeList, func(i, j int) bool {
|
|
|
- return timeList[i] < timeList[j]
|
|
|
- })
|
|
|
-
|
|
|
- pdf := &gopdf.GoPdf{}
|
|
|
- pdf.Start(gopdf.Config{PageSize: gopdf.Rect{W: 595.28, H: 841.89}}) //595.28, 841.89 = A4
|
|
|
-
|
|
|
- err = pdf.AddTTFFont("wts", "static/fonts/MiSans-Medium.ttf")
|
|
|
- if err != nil {
|
|
|
- return
|
|
|
- }
|
|
|
- err = pdf.SetFont("wts", "", 15)
|
|
|
- if err != nil {
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- pdf.SetGrayFill(0.5)
|
|
|
-
|
|
|
- pdf.SetMargins(0, 20, 0, 20)
|
|
|
- pdf.AddPage()
|
|
|
- imgH, _ := gopdf.ImageHolderByPath("./ofile/logo.jpg")
|
|
|
- err = pdf.ImageByHolder(imgH, 10, 10, &gopdf.Rect{W: 93, H: 32})
|
|
|
- name := user.T_name
|
|
|
-
|
|
|
- var y float64 = 40
|
|
|
- textw, _ := pdf.MeasureTextWidth(name)
|
|
|
- pdf.SetX((595 / 2) - (textw / 2))
|
|
|
- pdf.SetY(y)
|
|
|
- pdf.Text(name)
|
|
|
-
|
|
|
- y += 20
|
|
|
- title := Task_r.T_name + "湿度验证数据"
|
|
|
- textw, _ = pdf.MeasureTextWidth(title)
|
|
|
- pdf.SetX((595 / 2) - (textw / 2))
|
|
|
- pdf.SetY(y)
|
|
|
- pdf.Text(title)
|
|
|
-
|
|
|
- if len(timeList) > 0 {
|
|
|
- y += 20
|
|
|
- timeStr := fmt.Sprintf("%s - %s", timeList[0], timeList[len(timeList)-1])
|
|
|
- textw, _ = pdf.MeasureTextWidth(timeStr)
|
|
|
- pdf.SetX((595 / 2) - (textw / 2))
|
|
|
- pdf.SetY(y)
|
|
|
- pdf.Text(timeStr)
|
|
|
- }
|
|
|
-
|
|
|
- err = pdf.SetFont("wts", "", 10)
|
|
|
- if err != nil {
|
|
|
- return
|
|
|
}
|
|
|
|
|
|
y += 20
|
|
|
- var x float64 = 10
|
|
|
- var w float64 = 120
|
|
|
-
|
|
|
- chunks := chunkBy(T_snid_list, 15)
|
|
|
+ sort.Slice(T_snid_list2, func(i, j int) bool {
|
|
|
+ return extractSecondElement(T_snid_list2[i]) < extractSecondElement(T_snid_list2[j])
|
|
|
+ })
|
|
|
+ chunks := splitData(T_snid_list2, 454.5, idWidthMap)
|
|
|
for _, list := range chunks {
|
|
|
x = 10
|
|
|
- w = 120
|
|
|
+ w = 120.7
|
|
|
lib.RectFillColor(pdf, "时间", 12, x, y, w, 20, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)
|
|
|
x += w
|
|
|
- w = 30
|
|
|
+ w = 30.3
|
|
|
for _, v2 := range list {
|
|
|
sn_id2 := strings.Split(v2, ",")
|
|
|
id2 := sn_id2[1]
|
|
|
+ w = idWidthMap[id2]
|
|
|
lib.RectFillColor(pdf, id2, 12, x, y, w, 20, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)
|
|
|
x += w
|
|
|
}
|
|
@@ -388,28 +385,30 @@ func (c *TaskDataController) TaskData_Humidity_Pdf() {
|
|
|
pdf.SetNewY(y, textH)
|
|
|
y = pdf.GetY()
|
|
|
if y == 20 {
|
|
|
- w = 120
|
|
|
+ w = 120.7
|
|
|
lib.RectFillColor(pdf, "时间", 12, x, y, w, 20, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)
|
|
|
x += w
|
|
|
- w = 30
|
|
|
+ w = 30.3
|
|
|
for _, v2 := range list {
|
|
|
sn_id2 := strings.Split(v2, ",")
|
|
|
id2 := sn_id2[1]
|
|
|
+ w = idWidthMap[id2]
|
|
|
lib.RectFillColor(pdf, id2, 12, x, y, w, 20, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)
|
|
|
x += w
|
|
|
}
|
|
|
y += 20
|
|
|
x = 10
|
|
|
}
|
|
|
- w = 120
|
|
|
+ w = 120.7
|
|
|
lib.RectFillColor(pdf, t, 12, x, y, w, 20, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)
|
|
|
x += w
|
|
|
- w = 30
|
|
|
+ w = 30.3
|
|
|
for _, v := range list {
|
|
|
sn_id := strings.Split(v, ",")
|
|
|
id := sn_id[1]
|
|
|
- t_t := dataMap[fmt.Sprintf("%s,%s", t, id)]
|
|
|
- lib.RectFillColor(pdf, t_t, 12, x, y, w, 20, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)
|
|
|
+ data := dataMap[fmt.Sprintf("%s,%s", t, id)]
|
|
|
+ w = idWidthMap[id]
|
|
|
+ lib.RectFillColor(pdf, data, 12, x, y, w, 20, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)
|
|
|
x += w
|
|
|
}
|
|
|
y += 20
|
|
@@ -418,12 +417,10 @@ func (c *TaskDataController) TaskData_Humidity_Pdf() {
|
|
|
y += 20
|
|
|
}
|
|
|
filename := time.Now().Format("20060102150405") + ".pdf"
|
|
|
- timeStr := "ofile/湿度" + filename
|
|
|
+ timeStr := "ofile/" + T_type_name + filename
|
|
|
|
|
|
err = pdf.WritePdf(timeStr)
|
|
|
if err != nil {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: err.Error()}
|
|
|
- c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -433,9 +430,17 @@ func (c *TaskDataController) TaskData_Humidity_Pdf() {
|
|
|
}()
|
|
|
|
|
|
c.Ctx.Output.Download(timeStr)
|
|
|
-
|
|
|
+ return nil
|
|
|
}
|
|
|
|
|
|
+// Function to extract the second element after splitting by comma
|
|
|
+func extractSecondElement(s string) string {
|
|
|
+ parts := strings.Split(s, ",")
|
|
|
+ if len(parts) >= 2 {
|
|
|
+ return parts[1]
|
|
|
+ }
|
|
|
+ return s // return original string if splitting doesn't give expected parts
|
|
|
+}
|
|
|
func chunkBy[T any](list []T, size int) [][]T {
|
|
|
var chunks [][]T
|
|
|
for size < len(list) {
|
|
@@ -443,6 +448,34 @@ func chunkBy[T any](list []T, size int) [][]T {
|
|
|
}
|
|
|
return append(chunks, list)
|
|
|
}
|
|
|
+func splitData(data []string, threshold float64, idWidthMap map[string]float64) [][]string {
|
|
|
+ var result [][]string
|
|
|
+ var currentBatch []string
|
|
|
+ var currentSum float64
|
|
|
+
|
|
|
+ for _, item := range data {
|
|
|
+ sn_id := strings.Split(item, ",")
|
|
|
+ if len(sn_id) == 2 {
|
|
|
+ wd := idWidthMap[sn_id[1]]
|
|
|
+ if currentSum+wd > threshold+0.1 {
|
|
|
+ // 当前批次超过阈值,切分
|
|
|
+ result = append(result, currentBatch)
|
|
|
+ // 重置当前批次和当前总和
|
|
|
+ currentBatch = []string{}
|
|
|
+ currentSum = 0
|
|
|
+ }
|
|
|
+ currentBatch = append(currentBatch, item)
|
|
|
+ currentSum += wd
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 添加最后一批
|
|
|
+ if len(currentBatch) > 0 {
|
|
|
+ result = append(result, currentBatch)
|
|
|
+ }
|
|
|
+
|
|
|
+ return result
|
|
|
+}
|
|
|
|
|
|
// 列表 -
|
|
|
func (c *TaskDataController) TaskDataClass_List() {
|
|
@@ -455,9 +488,9 @@ func (c *TaskDataController) TaskDataClass_List() {
|
|
|
page_z = conf.Page_size
|
|
|
}
|
|
|
T_task_id := c.GetString("T_task_id")
|
|
|
- Task_r, err := NatsServer.Read_Task(T_task_id)
|
|
|
+ Task_r, err := Task.Read_Task(T_task_id)
|
|
|
if err != nil {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_task_id 错误!"}
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "获取任务信息失败!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
@@ -480,9 +513,9 @@ func (c *TaskDataController) TaskDataClass_Edit() {
|
|
|
T_task_id := c.GetString("T_task_id")
|
|
|
T_sn := c.GetString("T_sn")
|
|
|
T_id := c.GetString("T_id")
|
|
|
- Task_r, err := NatsServer.Read_Task(T_task_id)
|
|
|
+ Task_r, err := Task.Read_Task(T_task_id)
|
|
|
if err != nil {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_task_id 错误!"}
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "获取任务信息失败!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
@@ -511,7 +544,7 @@ func (c *TaskDataController) TaskDataClass_Edit() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- System.Add_UserLogs_T(T_uuid, "本地版-任务分裂", "修改分类数据"+Task_r.T_name, Task_r.T_task_id+"|"+T_sn+"|"+T_id)
|
|
|
+ System.Add_UserLogs_T(T_uuid, "本地版-任务分类", "修改分类数据"+Task_r.T_name, Task_r.T_task_id+"|"+T_sn+"|"+T_id)
|
|
|
|
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
|
c.ServeJSON()
|
|
@@ -523,9 +556,9 @@ func (c *TaskDataController) TaskDataClass_Del() {
|
|
|
|
|
|
T_task_id := c.GetString("T_task_id")
|
|
|
T_sn := c.GetString("T_sn")
|
|
|
- Task_r, err := NatsServer.Read_Task(T_task_id)
|
|
|
+ Task_r, err := Task.Read_Task(T_task_id)
|
|
|
if err != nil {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_task_id 错误!"}
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "获取任务信息失败!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
@@ -550,9 +583,9 @@ func (c *TaskDataController) TaskData_AddS() {
|
|
|
T_uuid, _ := lib.GetAdminT_Uuid(c.Ctx.GetCookie("User_tokey"), c.GetString("User_tokey"))
|
|
|
|
|
|
T_task_id := c.GetString("T_task_id")
|
|
|
- Task_r, err := NatsServer.Read_Task(T_task_id)
|
|
|
+ Task_r, err := Task.Read_Task(T_task_id)
|
|
|
if err != nil {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_task_id 错误!"}
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "获取任务信息失败!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
@@ -570,6 +603,8 @@ func (c *TaskDataController) TaskData_AddS() {
|
|
|
println(len(T_Data_list), "len(T_Data_list)")
|
|
|
var T_Data_list_x = 0
|
|
|
|
|
|
+ Task.UpdateAUTO_INCREMENT(conf.Local_AliasName, Task_r.T_task_id)
|
|
|
+
|
|
|
snMaps := make(map[string]string)
|
|
|
|
|
|
for _, v := range T_Data_list {
|
|
@@ -649,12 +684,13 @@ func (c *TaskDataController) TaskData_AddS_Excel() {
|
|
|
T_uuid, _ := lib.GetAdminT_Uuid(c.Ctx.GetCookie("User_tokey"), c.GetString("User_tokey"))
|
|
|
|
|
|
T_task_id := c.GetString("T_task_id")
|
|
|
- Task_r, err := NatsServer.Read_Task(T_task_id)
|
|
|
+ Task_r, err := Task.Read_Task(T_task_id)
|
|
|
if err != nil {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_task_id 错误!"}
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "获取任务信息失败!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
|
+ Task.UpdateAUTO_INCREMENT(conf.Local_AliasName, Task_r.T_task_id)
|
|
|
|
|
|
// 获取上传的文件
|
|
|
file, _, err := c.GetFile("file")
|
|
@@ -808,12 +844,13 @@ func (c *TaskDataController) TaskData_Add() {
|
|
|
}
|
|
|
|
|
|
T_task_id := c.GetString("T_task_id")
|
|
|
- Task_r, err := NatsServer.Read_Task(T_task_id)
|
|
|
+ Task_r, err := Task.Read_Task(T_task_id)
|
|
|
if err != nil {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_task_id 错误!"}
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "获取任务信息失败!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
|
+ Task.UpdateAUTO_INCREMENT(conf.Local_AliasName, Task_r.T_task_id)
|
|
|
|
|
|
sn, err := Task.Read_TaskData_ByT_id(Task_r.T_task_id, T_id)
|
|
|
if err != nil && !errors.Is(err, orm.ErrNoRows) {
|
|
@@ -886,9 +923,9 @@ func (c *TaskDataController) TaskData_Up() {
|
|
|
T_time := c.GetString("T_time")
|
|
|
|
|
|
T_task_id := c.GetString("T_task_id")
|
|
|
- Task_r, err := NatsServer.Read_Task(T_task_id)
|
|
|
+ Task_r, err := Task.Read_Task(T_task_id)
|
|
|
if err != nil {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_task_id 错误!"}
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "获取任务信息失败!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
@@ -920,9 +957,9 @@ func (c *TaskDataController) TaskData_Del() {
|
|
|
}
|
|
|
|
|
|
T_task_id := c.GetString("T_task_id")
|
|
|
- Task_r, err := NatsServer.Read_Task(T_task_id)
|
|
|
+ Task_r, err := Task.Read_Task(T_task_id)
|
|
|
if err != nil {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_task_id 错误!"}
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "获取任务信息失败!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
@@ -948,9 +985,9 @@ func (c *TaskDataController) TaskData_Del_t_id() {
|
|
|
Id := c.GetString("Id")
|
|
|
|
|
|
T_task_id := c.GetString("T_task_id")
|
|
|
- Task_r, err := NatsServer.Read_Task(T_task_id)
|
|
|
+ Task_r, err := Task.Read_Task(T_task_id)
|
|
|
if err != nil {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_task_id 错误!"}
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "获取任务信息失败!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
@@ -981,9 +1018,9 @@ func (c *TaskDataController) Export_Data_Excel() {
|
|
|
//}
|
|
|
|
|
|
T_task_id := c.GetString("T_task_id")
|
|
|
- Task_r, err := NatsServer.Read_Task(T_task_id)
|
|
|
+ Task_r, err := Task.Read_Task(T_task_id)
|
|
|
if err != nil {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_task_id 错误!"}
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "获取任务信息失败!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
@@ -1055,14 +1092,14 @@ func (c *TaskDataController) Export_Data_Excel() {
|
|
|
|
|
|
func (c *TaskDataController) Check() {
|
|
|
T_task_id := c.GetString("T_task_id")
|
|
|
- Task_r, err := NatsServer.Read_Task(T_task_id)
|
|
|
+ Task_r, err := Task.Read_Task(T_task_id)
|
|
|
if Task_r.T_collection_state == 2 {
|
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "数据采集中,请稍后!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
|
if err != nil {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_task_id 错误!"}
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "获取任务信息失败!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
@@ -1147,14 +1184,14 @@ func (c *TaskDataController) Check() {
|
|
|
|
|
|
func (c *TaskDataController) Check_Asyn() {
|
|
|
T_task_id := c.GetString("T_task_id")
|
|
|
- Task_r, err := NatsServer.Read_Task(T_task_id)
|
|
|
+ Task_r, err := Task.Read_Task(T_task_id)
|
|
|
if Task_r.T_collection_state == 2 {
|
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "数据采集中,请稍后!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
|
if err != nil {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_task_id 错误!"}
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "获取任务信息失败!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
@@ -1268,9 +1305,9 @@ func (c *TaskDataController) TaskData_Import_TaskData() {
|
|
|
T_uuid, _ := lib.GetAdminT_Uuid(c.Ctx.GetCookie("User_tokey"), c.GetString("User_tokey"))
|
|
|
|
|
|
T_task_id := c.GetString("T_task_id")
|
|
|
- _, err := NatsServer.Read_Task(T_task_id)
|
|
|
+ _, err := Task.Read_Task(T_task_id)
|
|
|
if err != nil {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_task_id 错误!"}
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "获取任务信息失败!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
@@ -1325,9 +1362,9 @@ func (c *TaskDataController) TaskData_Up_TaskData() {
|
|
|
|
|
|
T_task_id := c.GetString("T_task_id")
|
|
|
|
|
|
- Task_r, err := NatsServer.Read_Task(T_task_id)
|
|
|
+ Task_r, err := Task.Read_Task(T_task_id)
|
|
|
if err != nil {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_task_id 错误!"}
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "获取任务信息失败!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
@@ -1393,9 +1430,9 @@ func (c *TaskDataController) TaskData_Up_TaskData_Back() {
|
|
|
|
|
|
T_task_id := c.GetString("T_task_id")
|
|
|
|
|
|
- Task_r, err := NatsServer.Read_Task(T_task_id)
|
|
|
+ Task_r, err := Task.Read_Task(T_task_id)
|
|
|
if err != nil {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_task_id 错误!"}
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "获取任务信息失败!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
@@ -1406,6 +1443,13 @@ func (c *TaskDataController) TaskData_Up_TaskData_Back() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ exist := Task.CheckTableExist(conf.Local_AliasName, T_task_id)
|
|
|
+ if !exist {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "本地数据不存在!"}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
// 采集中
|
|
|
Task_r.T_delivery_state = 2
|
|
|
err = NatsServer.Update_Task(Task_r)
|
|
@@ -1464,9 +1508,9 @@ func (c *TaskDataController) CopyFromPosition() {
|
|
|
SN_List := strings.Split(strings.Trim(c.GetString("SN_List"), "|"), "|")
|
|
|
|
|
|
T_task_id := c.GetString("T_task_id")
|
|
|
- Task_r, err := NatsServer.Read_Task(T_task_id)
|
|
|
+ Task_r, err := Task.Read_Task(T_task_id)
|
|
|
if err != nil {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_task_id 错误!"}
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "获取任务信息失败!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
@@ -1528,9 +1572,9 @@ func (c *TaskDataController) RepairSensorData() {
|
|
|
SN_List := strings.Split(strings.Trim(c.GetString("SN_List"), "|"), "|")
|
|
|
|
|
|
T_task_id := c.GetString("T_task_id")
|
|
|
- Task_r, err := NatsServer.Read_Task(T_task_id)
|
|
|
+ Task_r, err := Task.Read_Task(T_task_id)
|
|
|
if err != nil {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_task_id 错误!"}
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "获取任务信息失败!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
@@ -1618,9 +1662,9 @@ func (c *TaskDataController) DataSensorDataTrend() {
|
|
|
SN_List := strings.Split(strings.Trim(c.GetString("SN_List"), "|"), "|")
|
|
|
|
|
|
T_task_id := c.GetString("T_task_id")
|
|
|
- Task_r, err := NatsServer.Read_Task(T_task_id)
|
|
|
+ Task_r, err := Task.Read_Task(T_task_id)
|
|
|
if err != nil {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_task_id 错误!"}
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "获取任务信息失败!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
@@ -1707,9 +1751,9 @@ func (c *TaskDataController) UpdateRand() {
|
|
|
SN_List := strings.Split(strings.Trim(c.GetString("SN_List"), "|"), "|")
|
|
|
|
|
|
T_task_id := c.GetString("T_task_id")
|
|
|
- Task_r, err := NatsServer.Read_Task(T_task_id)
|
|
|
+ Task_r, err := Task.Read_Task(T_task_id)
|
|
|
if err != nil {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_task_id 错误!"}
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "获取任务信息失败!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
@@ -1766,9 +1810,9 @@ func (c *TaskDataController) UpdateFix() {
|
|
|
SN_List := strings.Split(strings.Trim(c.GetString("SN_List"), "|"), "|")
|
|
|
|
|
|
T_task_id := c.GetString("T_task_id")
|
|
|
- Task_r, err := NatsServer.Read_Task(T_task_id)
|
|
|
+ Task_r, err := Task.Read_Task(T_task_id)
|
|
|
if err != nil {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_task_id 错误!"}
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "获取任务信息失败!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
@@ -1822,9 +1866,9 @@ func (c *TaskDataController) DataSensorDataSmooth() {
|
|
|
SN_List := strings.Split(strings.Trim(c.GetString("SN_List"), "|"), "|")
|
|
|
|
|
|
T_task_id := c.GetString("T_task_id")
|
|
|
- Task_r, err := NatsServer.Read_Task(T_task_id)
|
|
|
+ Task_r, err := Task.Read_Task(T_task_id)
|
|
|
if err != nil {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_task_id 错误!"}
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "获取任务信息失败!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
@@ -1921,9 +1965,9 @@ func (c *TaskDataController) CopyFromPositionAverageSN() {
|
|
|
return
|
|
|
}
|
|
|
T_task_id := c.GetString("T_task_id")
|
|
|
- Task_r, err := NatsServer.Read_Task(T_task_id)
|
|
|
+ Task_r, err := Task.Read_Task(T_task_id)
|
|
|
if err != nil {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_task_id 错误!"}
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "获取任务信息失败!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
@@ -2031,9 +2075,9 @@ func (c *TaskDataController) CopyFromPositionSN() {
|
|
|
return
|
|
|
}
|
|
|
T_task_id := c.GetString("T_task_id")
|
|
|
- Task_r, err := NatsServer.Read_Task(T_task_id)
|
|
|
+ Task_r, err := Task.Read_Task(T_task_id)
|
|
|
if err != nil {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_task_id 错误!"}
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "获取任务信息失败!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
@@ -2075,9 +2119,9 @@ func (c *TaskDataController) DataRemoveDuplicates() {
|
|
|
T_uuid, _ := lib.GetAdminT_Uuid(c.Ctx.GetCookie("User_tokey"), c.GetString("User_tokey"))
|
|
|
|
|
|
T_task_id := c.GetString("T_task_id")
|
|
|
- Task_r, err := NatsServer.Read_Task(T_task_id)
|
|
|
+ Task_r, err := Task.Read_Task(T_task_id)
|
|
|
if err != nil {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_task_id 错误!"}
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "获取任务信息失败!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
@@ -2131,9 +2175,9 @@ func (c *TaskDataController) DataSkewingInterval() {
|
|
|
SN_List := strings.Split(strings.Trim(c.GetString("SN_List"), "|"), "|")
|
|
|
|
|
|
T_task_id := c.GetString("T_task_id")
|
|
|
- Task_r, err := NatsServer.Read_Task(T_task_id)
|
|
|
+ Task_r, err := Task.Read_Task(T_task_id)
|
|
|
if err != nil {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_task_id 错误!"}
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "获取任务信息失败!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
@@ -2222,9 +2266,9 @@ func (c *TaskDataController) DataGeometricScale() {
|
|
|
SN_List := strings.Split(strings.Trim(c.GetString("SN_List"), "|"), "|")
|
|
|
|
|
|
T_task_id := c.GetString("T_task_id")
|
|
|
- Task_r, err := NatsServer.Read_Task(T_task_id)
|
|
|
+ Task_r, err := Task.Read_Task(T_task_id)
|
|
|
if err != nil {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_task_id 错误!"}
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "获取任务信息失败!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
@@ -2283,9 +2327,9 @@ func (c *TaskDataController) DataBatchDelete() {
|
|
|
SN_List := strings.Split(strings.Trim(c.GetString("SN_List"), "|"), "|")
|
|
|
|
|
|
T_task_id := c.GetString("T_task_id")
|
|
|
- Task_r, err := NatsServer.Read_Task(T_task_id)
|
|
|
+ Task_r, err := Task.Read_Task(T_task_id)
|
|
|
if err != nil {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_task_id 错误!"}
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "获取任务信息失败!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
@@ -2325,9 +2369,9 @@ func (c *TaskDataController) TaskDataCopy_List() {
|
|
|
}
|
|
|
|
|
|
T_task_id := c.GetString("T_task_id")
|
|
|
- Task_r, err := NatsServer.Read_Task(T_task_id)
|
|
|
+ Task_r, err := Task.Read_Task(T_task_id)
|
|
|
if err != nil {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_task_id 错误!"}
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "获取任务信息失败!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
@@ -2355,9 +2399,9 @@ func (c *TaskDataController) TaskDataCopy_List() {
|
|
|
func (c *TaskDataController) TaskDataCopy_Add() {
|
|
|
|
|
|
T_task_id := c.GetString("T_task_id")
|
|
|
- Task_r, err := NatsServer.Read_Task(T_task_id)
|
|
|
+ Task_r, err := Task.Read_Task(T_task_id)
|
|
|
if err != nil {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_task_id 错误!"}
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "获取任务信息失败!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
@@ -2418,9 +2462,9 @@ func (c *TaskDataController) TaskDataCopy_Del() {
|
|
|
func (c *TaskDataController) TaskDataCopy_Recover() {
|
|
|
T_task_id := c.GetString("T_task_id")
|
|
|
T_copy_id := c.GetString("T_copy_id")
|
|
|
- Task_r, err := NatsServer.Read_Task(T_task_id)
|
|
|
+ Task_r, err := Task.Read_Task(T_task_id)
|
|
|
if err != nil {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_task_id 错误!"}
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "获取任务信息失败!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
@@ -2490,9 +2534,9 @@ func (c *TaskDataController) TaskData_JPG() {
|
|
|
|
|
|
T_task_id := c.GetString("T_task_id")
|
|
|
SN_List := c.GetString("SN_List")
|
|
|
- Task_r, err := NatsServer.Read_Task(T_task_id)
|
|
|
+ Task_r, err := Task.Read_Task(T_task_id)
|
|
|
if err != nil {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_task_id 错误!"}
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "获取任务信息失败!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
@@ -2656,9 +2700,9 @@ func (c *TaskDataController) Certificate_List() {
|
|
|
if page_z < 1 {
|
|
|
page_z = conf.Page_size
|
|
|
}
|
|
|
- Task_r, err := NatsServer.Read_Task(T_task_id)
|
|
|
+ Task_r, err := Task.Read_Task(T_task_id)
|
|
|
if err != nil {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_task_id 错误!"}
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "获取任务信息失败!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|