Ver Fonte

add:冷藏车自动填写

zoie há 5 dias atrás
pai
commit
de64907328
2 ficheiros alterados com 125 adições e 0 exclusões
  1. 121 0
      controllers/TaskData.go
  2. 4 0
      routers/TaskData.go

+ 121 - 0
controllers/TaskData.go

@@ -2913,6 +2913,10 @@ func (c *TaskDataController) ListJson() {
 		"冷藏库外部环境测点最低温",
 		"冷藏库内部最高温",
 		"冷藏库内部最低温",
+		"冷藏车外部环境测点最高温",
+		"冷藏车外部环境测点最低温",
+		"冷藏车内部最高温",
+		"冷藏车内部最低温",
 	}
 
 	c.Data["json"] = mySlice
@@ -4929,3 +4933,120 @@ func (c *TaskDataController) A冷藏库内部最高温() {
 	// Close the connection
 	c.Ctx.ResponseWriter.WriteHeader(http.StatusOK)
 }
+
+func (c *TaskDataController) A冷藏车外部环境测点最高温() {
+
+	T_task_id := c.GetString("T_task_id") //  v26nplogbwt1
+	println("T_task_id:", T_task_id)
+	c.Ctx.ResponseWriter.Header().Set("Content-Type", "text/event-stream")
+	c.Ctx.ResponseWriter.Header().Set("Cache-Control", "no-cache")
+	c.Ctx.ResponseWriter.Header().Set("Connection", "keep-alive")
+
+	Task_r, err := Task.Read_Task(T_task_id)
+	if err != nil {
+		lib.SseWriteJSON(c.Ctx.ResponseWriter, lib.JSONSSE{State: 2, Msg: "获取任务信息失败!"})
+		return
+	}
+
+	冷藏车外部环境测点 := c.GetString("冷藏车外部环境测点") //  v26nplogbwt1
+	if len(冷藏车外部环境测点) == 0 {
+		lib.SseWriteJSON(c.Ctx.ResponseWriter, lib.JSONSSE{State: 2, Msg: "获取 冷藏车外部环境测点 失败!"})
+		return
+	}
+
+	现场测试开始时间 := c.GetString("现场测试开始时间") //  v26nplogbwt1
+	if len(现场测试开始时间) == 0 {
+		lib.SseWriteJSON(c.Ctx.ResponseWriter, lib.JSONSSE{State: 2, Msg: "获取 现场测试开始时间 失败!"})
+		return
+	}
+	现场测试结束时间 := c.GetString("现场测试结束时间") //  v26nplogbwt1
+	if len(现场测试开始时间) == 0 {
+		lib.SseWriteJSON(c.Ctx.ResponseWriter, lib.JSONSSE{State: 2, Msg: "获取 现场测试结束时间 失败!"})
+		return
+	}
+
+	_, maxT := Task.Read_TaskData_T_Min_Max(Task_r.T_task_id, 冷藏车外部环境测点, "", 现场测试开始时间, 现场测试结束时间)
+
+	lib.SseWriteJSON(c.Ctx.ResponseWriter, lib.JSONSSE{State: 1, Msg: fmt.Sprintf("%.1f", math.Ceil(float64(maxT*10))/10)})
+
+	// Close the connection
+	c.Ctx.ResponseWriter.WriteHeader(http.StatusOK)
+}
+func (c *TaskDataController) A冷藏车外部环境测点最低温() {
+
+	T_task_id := c.GetString("T_task_id") //  v26nplogbwt1
+	println("T_task_id:", T_task_id)
+	c.Ctx.ResponseWriter.Header().Set("Content-Type", "text/event-stream")
+	c.Ctx.ResponseWriter.Header().Set("Cache-Control", "no-cache")
+	c.Ctx.ResponseWriter.Header().Set("Connection", "keep-alive")
+
+	Task_r, err := Task.Read_Task(T_task_id)
+	if err != nil {
+		lib.SseWriteJSON(c.Ctx.ResponseWriter, lib.JSONSSE{State: 2, Msg: "获取任务信息失败!"})
+		return
+	}
+
+	冷藏车外部环境测点 := c.GetString("冷藏车外部环境测点") //  v26nplogbwt1
+	if len(冷藏车外部环境测点) == 0 {
+		lib.SseWriteJSON(c.Ctx.ResponseWriter, lib.JSONSSE{State: 2, Msg: "获取 冷藏车外部环境测点 失败!"})
+		return
+	}
+
+	现场测试开始时间 := c.GetString("现场测试开始时间") //  v26nplogbwt1
+	if len(现场测试开始时间) == 0 {
+		lib.SseWriteJSON(c.Ctx.ResponseWriter, lib.JSONSSE{State: 2, Msg: "获取 现场测试开始时间 失败!"})
+		return
+	}
+	现场测试结束时间 := c.GetString("现场测试结束时间") //  v26nplogbwt1
+	if len(现场测试开始时间) == 0 {
+		lib.SseWriteJSON(c.Ctx.ResponseWriter, lib.JSONSSE{State: 2, Msg: "获取 现场测试结束时间 失败!"})
+		return
+	}
+
+	minT, _ := Task.Read_TaskData_T_Min_Max(Task_r.T_task_id, 冷藏车外部环境测点, "", 现场测试开始时间, 现场测试结束时间)
+
+	lib.SseWriteJSON(c.Ctx.ResponseWriter, lib.JSONSSE{State: 1, Msg: fmt.Sprintf("%.1f", math.Ceil(float64(minT*10))/10)})
+
+	// Close the connection
+	c.Ctx.ResponseWriter.WriteHeader(http.StatusOK)
+}
+
+func (c *TaskDataController) A冷藏车内部最低温() {
+
+	T_task_id := c.GetString("T_task_id") //  v26nplogbwt1
+	println("T_task_id:", T_task_id)
+	c.Ctx.ResponseWriter.Header().Set("Content-Type", "text/event-stream")
+	c.Ctx.ResponseWriter.Header().Set("Cache-Control", "no-cache")
+	c.Ctx.ResponseWriter.Header().Set("Connection", "keep-alive")
+
+	温度控制范围最小值 := c.GetString("温度控制范围最小值") //  v26nplogbwt1
+	if len(温度控制范围最小值) == 0 {
+		lib.SseWriteJSON(c.Ctx.ResponseWriter, lib.JSONSSE{State: 2, Msg: "获取 温度控制范围最小值 失败!"})
+		return
+	}
+
+	lib.SseWriteJSON(c.Ctx.ResponseWriter, lib.JSONSSE{State: 1, Msg: 温度控制范围最小值})
+
+	// Close the connection
+	c.Ctx.ResponseWriter.WriteHeader(http.StatusOK)
+}
+
+func (c *TaskDataController) A冷藏车内部最高温() {
+
+	T_task_id := c.GetString("T_task_id") //  v26nplogbwt1
+	println("T_task_id:", T_task_id)
+	c.Ctx.ResponseWriter.Header().Set("Content-Type", "text/event-stream")
+	c.Ctx.ResponseWriter.Header().Set("Cache-Control", "no-cache")
+	c.Ctx.ResponseWriter.Header().Set("Connection", "keep-alive")
+
+	温度控制范围最高值 := c.GetString("温度控制范围最高值") //  v26nplogbwt1
+	if len(温度控制范围最高值) == 0 {
+		lib.SseWriteJSON(c.Ctx.ResponseWriter, lib.JSONSSE{State: 2, Msg: "获取 温度控制范围最高值 失败!"})
+		return
+	}
+
+	lib.SseWriteJSON(c.Ctx.ResponseWriter, lib.JSONSSE{State: 1, Msg: 温度控制范围最高值})
+
+	// Close the connection
+	c.Ctx.ResponseWriter.WriteHeader(http.StatusOK)
+}

+ 4 - 0
routers/TaskData.go

@@ -132,5 +132,9 @@ func init() {
 	beego.Router("/TaskDataContent/SSE_冷藏库外部环境测点最低温", &controllers.TaskDataController{}, "*:A冷藏库外部环境测点最低温")
 	beego.Router("/TaskDataContent/SSE_冷藏库内部最高温", &controllers.TaskDataController{}, "*:A冷藏库内部最高温")
 	beego.Router("/TaskDataContent/SSE_冷藏库内部最低温", &controllers.TaskDataController{}, "*:A冷藏库内部最低温")
+	beego.Router("/TaskDataContent/SSE_冷藏车外部环境测点最高温", &controllers.TaskDataController{}, "*:A冷藏车外部环境测点最高温")
+	beego.Router("/TaskDataContent/SSE_冷藏车外部环境测点最低温", &controllers.TaskDataController{}, "*:A冷藏车外部环境测点最低温")
+	beego.Router("/TaskDataContent/SSE_冷藏车内部最高温", &controllers.TaskDataController{}, "*:A冷藏车内部最高温")
+	beego.Router("/TaskDataContent/SSE_冷藏车内部最低温", &controllers.TaskDataController{}, "*:A冷藏车内部最低温")
 
 }