|
@@ -756,6 +756,12 @@ func (c *DataController) Device_Sensor_Data_ChartShow_PDF() {
|
|
|
T_snid := c.GetString("T_snid")
|
|
|
Time_start := c.GetString("Time_start")
|
|
|
Time_end := c.GetString("Time_end")
|
|
|
+ T_forwarding_unit := c.GetString("T_forwarding_unit")
|
|
|
+ T_consignee_unit := c.GetString("T_consignee_unit")
|
|
|
+ T_remark := c.GetString("T_remark")
|
|
|
+ T_temp_show, _ := c.GetInt("T_temp_show")
|
|
|
+ T_Humidity_show, _ := c.GetInt("T_Humidity_show")
|
|
|
+
|
|
|
// 获取图片信息
|
|
|
//f, _, err := c.GetFile("file")
|
|
|
//if err != nil {
|
|
@@ -867,7 +873,7 @@ func (c *DataController) Device_Sensor_Data_ChartShow_PDF() {
|
|
|
pdf.SetY(y)
|
|
|
pdf.Text(title)
|
|
|
|
|
|
- y += 40
|
|
|
+ y += 35
|
|
|
pdf.SetFont("wts", "", 18)
|
|
|
pdf.SetXY(10, y)
|
|
|
pdf.Text("记录概要信息")
|
|
@@ -885,35 +891,86 @@ func (c *DataController) Device_Sensor_Data_ChartShow_PDF() {
|
|
|
}
|
|
|
pdf.SetFont("wts", "", 10)
|
|
|
pdf.SetXY(10, y)
|
|
|
- pdf.Text(fmt.Sprintf("记录开始时间: %s", s_time))
|
|
|
+ pdf.Text(fmt.Sprintf("记录开始时间:%s", s_time))
|
|
|
|
|
|
pdf.SetXY(240, y)
|
|
|
- pdf.Text(fmt.Sprintf("记录结束时间: %s", e_time))
|
|
|
+ pdf.Text(fmt.Sprintf("记录结束时间:%s", e_time))
|
|
|
|
|
|
sTime, _ := lib.TimeStrToTime(s_time)
|
|
|
eTime, _ := lib.TimeStrToTime(e_time)
|
|
|
pdf.SetXY(470, y)
|
|
|
- pdf.Text(fmt.Sprintf("记录总时间: %.2f", eTime.Sub(sTime).Minutes()))
|
|
|
+ pdf.Text(fmt.Sprintf("记录总时间:%.0f分钟", eTime.Sub(sTime).Minutes()))
|
|
|
|
|
|
- y += 18
|
|
|
- pdf.SetXY(10, y)
|
|
|
- pdf.Text(fmt.Sprintf("最高温度: %.2f℃,%s", maxTemp, maxTempTime))
|
|
|
+ if T_temp_show == 1 {
|
|
|
+ y += 15
|
|
|
+ pdf.SetXY(10, y)
|
|
|
+ pdf.Text(fmt.Sprintf("最高温度:%.1f℃,%s", lib.RoundToDecimal(float64(maxTemp), 1), maxTempTime))
|
|
|
|
|
|
- pdf.SetXY(240, y)
|
|
|
- pdf.Text(fmt.Sprintf("最低温度: %.2f℃,%s", minTemp, minTempTime))
|
|
|
+ pdf.SetXY(240, y)
|
|
|
+ pdf.Text(fmt.Sprintf("最低温度:%.1f℃,%s", lib.RoundToDecimal(float64(minTemp), 1), minTempTime))
|
|
|
|
|
|
- pdf.SetXY(470, y)
|
|
|
- pdf.Text(fmt.Sprintf("平均温度: %.2f℃", avgTemp))
|
|
|
+ pdf.SetXY(470, y)
|
|
|
+ pdf.Text(fmt.Sprintf("平均温度:%.1f℃", lib.RoundToDecimal(float64(avgTemp), 1)))
|
|
|
+ }
|
|
|
|
|
|
- y += 18
|
|
|
+ if T_Humidity_show == 1 {
|
|
|
+ y += 15
|
|
|
+ pdf.SetXY(10, y)
|
|
|
+ pdf.Text(fmt.Sprintf("最高湿度:%.1f%%RH,%s", lib.RoundToDecimal(float64(maxHumidity), 1), maxHumidityTime))
|
|
|
+
|
|
|
+ pdf.SetXY(240, y)
|
|
|
+ pdf.Text(fmt.Sprintf("最低湿度:%.1f%%RH,%s", lib.RoundToDecimal(float64(minHumidity), 1), minHumidityTime))
|
|
|
+
|
|
|
+ pdf.SetXY(470, y)
|
|
|
+ pdf.Text(fmt.Sprintf("平均湿度:%.1f%%RH", lib.RoundToDecimal(float64(avgHumidity), 1)))
|
|
|
+ }
|
|
|
+
|
|
|
+ y += 15
|
|
|
pdf.SetXY(10, y)
|
|
|
- pdf.Text(fmt.Sprintf("最高湿度: %.2f%%RH,%s", maxHumidity, maxHumidityTime))
|
|
|
+ T_forwarding_unit_temp := []rune(T_forwarding_unit)
|
|
|
+ if len(T_forwarding_unit_temp) > 34 {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "发货单位长度超过限制(34个字符)"}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if len(T_forwarding_unit_temp) > 17 {
|
|
|
+ pdf.Text(fmt.Sprintf("发货单位:%s", string(T_forwarding_unit_temp[0:17])))
|
|
|
+ pdf.SetXY(60, y+15)
|
|
|
+ pdf.Text(fmt.Sprintf("%s", string(T_forwarding_unit_temp[17:])))
|
|
|
+ } else {
|
|
|
+ pdf.Text(fmt.Sprintf("发货单位:%s", string(T_forwarding_unit_temp)))
|
|
|
+ }
|
|
|
|
|
|
pdf.SetXY(240, y)
|
|
|
- pdf.Text(fmt.Sprintf("最低湿度: %.2f%%RH,%s", minHumidity, minHumidityTime))
|
|
|
+ T_consignee_unit_temp := []rune(T_consignee_unit)
|
|
|
+ if len(T_consignee_unit_temp) > 34 {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "收货单位长度超过限制(34个字符)"}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if len(T_consignee_unit_temp) > 17 {
|
|
|
+ pdf.Text(fmt.Sprintf("收货单位:%s", string(T_consignee_unit_temp[0:17])))
|
|
|
+ pdf.SetXY(290, y+15)
|
|
|
+ pdf.Text(fmt.Sprintf("%s", string(T_consignee_unit_temp[17:])))
|
|
|
+ } else {
|
|
|
+ pdf.Text(fmt.Sprintf("收货单位:%s", string(T_consignee_unit_temp)))
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
pdf.SetXY(470, y)
|
|
|
- pdf.Text(fmt.Sprintf("平均湿度: %.2f%%RH", avgHumidity))
|
|
|
+ T_remark_temp := []rune(T_remark)
|
|
|
+ if len(T_remark_temp) > 34 {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "备注长度超过限制(16个字符)"}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if len(T_remark) > 8 {
|
|
|
+ pdf.Text(fmt.Sprintf("备注:%s", string(T_remark_temp[0:8])))
|
|
|
+ pdf.SetXY(500, y+15)
|
|
|
+ pdf.Text(fmt.Sprintf("%s", string(T_remark_temp[8:])))
|
|
|
+ } else {
|
|
|
+ pdf.Text(fmt.Sprintf("备注: %s", string(T_remark_temp)))
|
|
|
+ }
|
|
|
|
|
|
y += 40
|
|
|
pdf.SetFont("wts", "", 18)
|