|
|
@@ -25,7 +25,7 @@ func GetLimsReportPistonPumpUnitService(xormEngine *xorm.Engine) *LimsReportPist
|
|
|
/**
|
|
|
* 生成报告
|
|
|
*/
|
|
|
-func (s *LimsReportPistonPumpUnitService) DataToExcelReport(entrustMainEntity limsentrust.LimsEntrustMain, dateentryname string, createreportname string,tablename string, seqStr string, retUrl string, entrustId string, dataentryIds string) (reportUrl string, err error) {
|
|
|
+func (s *LimsReportPistonPumpUnitService) DataToExcelReport(entrustMainEntity limsentrust.LimsEntrustMain, dateentryname string, createreportname string,tablename string, seqStr string, seqStrJs string, retUrl string, entrustId string, dataentryIds string) (reportUrl string, err error) {
|
|
|
var reportList []LimsReportPistonPumpUnit
|
|
|
s.GetEntitysByOrderbyWhere(tablename, "DataEntryId in ("+dataentryIds+")", "DataEntryId", &reportList)
|
|
|
//模板下载到服务器
|
|
|
@@ -43,7 +43,7 @@ func (s *LimsReportPistonPumpUnitService) DataToExcelReport(entrustMainEntity li
|
|
|
|
|
|
pn := float64(reportList[0].MotorPower) // 电动机额定功率
|
|
|
qn := float64(reportList[0].Flow1) // 泵额定流量
|
|
|
- q := float64(reportList[0].TrafficRecord/3600) // 泵实际流量
|
|
|
+ q,_ := strconv.ParseFloat(fmt.Sprintf("%.3f", reportList[0].TrafficRecord/3600), 64) // 泵实际流量
|
|
|
pgr := float64(reportList[0].MotorPowerRecord) // 电机输入功率
|
|
|
c1 := float64(reportList[0].Inhalation/1000) // 泵吸入管道周长
|
|
|
d1 := float64(reportList[0].Imported/1000) // 壁厚
|
|
|
@@ -61,26 +61,26 @@ func (s *LimsReportPistonPumpUnitService) DataToExcelReport(entrustMainEntity li
|
|
|
v1 := 0.00
|
|
|
v2 := 0.00
|
|
|
v3 := 0.00
|
|
|
- if (math.Pow(c1/(2*math.Pi)-d3,2) != 0) { // 泵吸入点流速
|
|
|
- v1,err = strconv.ParseFloat(fmt.Sprintf("%.3f",q/math.Pow(c1/(2*math.Pi)-d1,2)), 64)
|
|
|
+ if (math.Pow(c1/(2*math.Pi)-d1,2) != 0) { // 泵吸入点流速
|
|
|
+ v1,err = strconv.ParseFloat(fmt.Sprintf("%.3f",q/(math.Pi*math.Pow(c1/(2*math.Pi)-d1,2))), 64)
|
|
|
} else {
|
|
|
v1 =0.00
|
|
|
}
|
|
|
if (math.Pow(c2/(2*math.Pi)-d2,2) != 0) { // 泵排出点流速
|
|
|
- v2,err = strconv.ParseFloat(fmt.Sprintf("%.3f",q/math.Pow(c1/(2*math.Pi)-d2,2)), 64)
|
|
|
+ v2,err = strconv.ParseFloat(fmt.Sprintf("%.3f",q/(math.Pi*math.Pow(c2/(2*math.Pi)-d2,2))), 64)
|
|
|
} else {
|
|
|
v2 =0.00
|
|
|
}
|
|
|
if (math.Pow(c3/(2*math.Pi)-d3,2) != 0) { // 泵节阀后流速
|
|
|
- v3,err = strconv.ParseFloat(fmt.Sprintf("%.3f",q/math.Pow(c1/(2*math.Pi)-d3,2)), 64)
|
|
|
+ v3,err = strconv.ParseFloat(fmt.Sprintf("%.3f",q/(math.Pi*math.Pow(c3/(2*math.Pi)-d3,2))), 64)
|
|
|
} else {
|
|
|
v3 =0.00
|
|
|
}
|
|
|
rho := 996.28
|
|
|
- h,err := strconv.ParseFloat(fmt.Sprintf("%.3f",p2-p1/(rho*g)+ z2-z1+(v2*v2-v1*v1)/(2*g)), 64) // 总扬程
|
|
|
- etag,err := strconv.ParseFloat(fmt.Sprintf("%.3f",rho*g*h*q*math.Pow(10,-3)/pgr), 64) // 泵机组效率
|
|
|
- h1,err := strconv.ParseFloat(fmt.Sprintf("%.3f",(p2-p1)/rho*g + z2 - z3 + (v2*v2+v3+v3)/2*g), 64) // 调节阀引起的扬程损失
|
|
|
- etasys,err := strconv.ParseFloat(fmt.Sprintf("%.3f",rho*g*(h-h1)*q*math.Pow(10,-3)/pgr),64)
|
|
|
+ h,err := strconv.ParseFloat(fmt.Sprintf("%.3f",(p2-p1)/(rho*g)+ z2-z1+(v2*v2-v1*v1)/(2*g)), 64) // 总扬程
|
|
|
+ etag,err := strconv.ParseFloat(fmt.Sprintf("%.3f",(rho*g*h*q*math.Pow(10,-3))/pgr*100), 64) // 泵机组效率
|
|
|
+ h1,err := strconv.ParseFloat(fmt.Sprintf("%.3f",(p2-p1)/(rho*g) + z2 - z3 + (v2*v2-v3*v3)/(2*g)), 64) // 调节阀引起的扬程损失
|
|
|
+ etasys,err := strconv.ParseFloat(fmt.Sprintf("%.3f",(rho*g*(h-h1)*q*math.Pow(10,-3))/pgr*100),64)
|
|
|
|
|
|
datamap["pn "] = pn
|
|
|
datamap["qn"] = qn
|
|
|
@@ -107,19 +107,19 @@ func (s *LimsReportPistonPumpUnitService) DataToExcelReport(entrustMainEntity li
|
|
|
datamap["etasys"] = etasys
|
|
|
|
|
|
if (etag >= limitval1) {
|
|
|
- datamap["result1"] = "合格"
|
|
|
+ datamap["res1"] = "合格"
|
|
|
} else {
|
|
|
- datamap["result1"] = "不合格"
|
|
|
+ datamap["res1"] = "不合格"
|
|
|
}
|
|
|
if (etasys >= limitval2) {
|
|
|
- datamap["result2"] = "合格"
|
|
|
+ datamap["res2"] = "合格"
|
|
|
} else {
|
|
|
- datamap["result2"] = "不合格"
|
|
|
+ datamap["res2"] = "不合格"
|
|
|
}
|
|
|
if (cosphi >= limitval3) {
|
|
|
- datamap["result3"] = "合格"
|
|
|
+ datamap["res3"] = "合格"
|
|
|
} else {
|
|
|
- datamap["result3"] = "不合格"
|
|
|
+ datamap["res3"] = "不合格"
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -128,13 +128,19 @@ func (s *LimsReportPistonPumpUnitService) DataToExcelReport(entrustMainEntity li
|
|
|
datamap["jcnum"] = reportList[0].CreateOn.Format("2006-01-02")
|
|
|
datamap["jcdate"] = reportList[0].CreateOn.Format("2006年01月02日")
|
|
|
datamap["spec"] = reportList[0].Model1
|
|
|
- //datamap["number"] = reportList[0].DeviceName
|
|
|
+ datamap["number"] = reportList[0].DeviceName
|
|
|
datamap["place"] = reportList[0].InstalPosition
|
|
|
- //datamap["instr"] = reportList[0].MonitoringInstrument
|
|
|
- datamap["evalva1"] = 78
|
|
|
- datamap["evalva2"] = 54
|
|
|
- datamap["limitval1"] = limitval1
|
|
|
- datamap["limitval2"] = limitval2
|
|
|
+ datamap["instr"] = reportList[0].Instruments
|
|
|
+ datamap["eva1"] = 78
|
|
|
+ datamap["eva2"] = 54
|
|
|
+ datamap["lim1"] = limitval1
|
|
|
+ datamap["lim2"] = limitval2
|
|
|
+
|
|
|
+ datamap["codejs"] = seqStrJs
|
|
|
+ datamap["Model2"] = reportList[0].Model2
|
|
|
+ datamap["Model1"] = reportList[0].Model1
|
|
|
+
|
|
|
+
|
|
|
reportUrl = svcActiviti.FillWordTemplate(datamap, templateUrl, fileName)
|
|
|
|
|
|
return reportUrl, err
|