Pārlūkot izejas kodu

update: 空库数据显示黑色

zoie 1 gadu atpakaļ
vecāks
revīzija
b7166c26fa
2 mainītis faili ar 4 papildinājumiem un 2 dzēšanām
  1. 2 2
      controllers/Data.go
  2. 2 0
      models/Device/DeviceData.go

+ 2 - 2
controllers/Data.go

@@ -386,14 +386,14 @@ func (c *DataController) Device_Sensor_Data_Excel() {
 		if v.T_ist == 1 {
 			f.SetCellValue("Sheet1", fmt.Sprintf("C%d", line), v.T_t)
 			f.SetCellValue("Sheet1", fmt.Sprintf("E%d", line), strconv.FormatFloat(float64(v.T_tl), 'f', 2, 64)+"~"+strconv.FormatFloat(float64(v.T_tu), 'f', 2, 64))
-			if v.T_t < v.T_tl || v.T_t > v.T_tu {
+			if (v.T_t < v.T_tl || v.T_t > v.T_tu) && v.T_free == 0 {
 				f.SetCellStyle("Sheet1", fmt.Sprintf("A%d", line), fmt.Sprintf("G%d", line), headStyleLower)
 			}
 		}
 		if v.T_ish == 1 {
 			f.SetCellValue("Sheet1", fmt.Sprintf("D%d", line), v.T_rh)
 			f.SetCellValue("Sheet1", fmt.Sprintf("F%d", line), strconv.FormatFloat(float64(v.T_rhl), 'f', 2, 64)+"~"+strconv.FormatFloat(float64(v.T_rhu), 'f', 2, 64))
-			if v.T_rh < v.T_rhl || v.T_rh > v.T_rhu {
+			if v.T_rh < v.T_rhl || v.T_rh > v.T_rhu && v.T_free == 0 {
 				f.SetCellStyle("Sheet1", fmt.Sprintf("A%d", line), fmt.Sprintf("G%d", line), headStyleUpper)
 			}
 		}

+ 2 - 0
models/Device/DeviceData.go

@@ -55,6 +55,7 @@ type DeviceData_R struct {
 	T_sp     int     // 传感器参数id
 	T_ist    int     // 温度   1开启   2关闭
 	T_ish    int     // 湿度   1开启   2关闭
+	T_free   int     // 空库
 	T_remark string  // 备注
 }
 
@@ -125,6 +126,7 @@ func DeviceData_ToDeviceData_R(d Device, r DeviceData_) (t DeviceData_R) {
 	t.T_tu = sp.T_Tupper
 	t.T_rhl = sp.T_RHlower
 	t.T_rhu = sp.T_RHupper
+	t.T_free = sp.T_free
 	if sp.T_free == 1 {
 		t.T_remark = "空库"
 	} else {