|
@@ -212,6 +212,11 @@ func (c *TaskReportMgr) ToWord(taskinfo T_data_task) (path string, err error) {
|
|
|
//生成报告数据
|
|
|
var file *xlsx.File
|
|
|
file = xlsx.NewFile()
|
|
|
+ sheet_fcda, err := file.AddSheet("虚端子关系")
|
|
|
+ if err != nil {
|
|
|
+ logger.Logger.Error(err)
|
|
|
+ return "", err
|
|
|
+ }
|
|
|
sheet_c, err := file.AddSheet("测控装置")
|
|
|
if err != nil {
|
|
|
logger.Logger.Error(err)
|
|
@@ -313,6 +318,36 @@ func (c *TaskReportMgr) ToWord(taskinfo T_data_task) (path string, err error) {
|
|
|
rowInd = rowInd + 1
|
|
|
}
|
|
|
}
|
|
|
+ result = nil
|
|
|
+ iedResultMap = nil
|
|
|
+ //生成端子关系检查结果
|
|
|
+ checkAreaRe := new(CheckAreaMgr)
|
|
|
+ result, err = checkAreaRe.GetCheckResult(taskinfo.ScdId)
|
|
|
+ if err != nil {
|
|
|
+ logger.Logger.Error(err)
|
|
|
+ return "", err
|
|
|
+ }
|
|
|
+ c.setCaption(sheet_fcda, fmt.Sprintf("%s-端子校验结果", scdName), 6)
|
|
|
+ lastIedName := ""
|
|
|
+ cellNo := 1
|
|
|
+ for _, row := range result {
|
|
|
+ nowIedName := fmt.Sprintf("%s:%s", tools.IsEmpty(row["ied_name"]), tools.IsEmpty(row["ied_desc"]))
|
|
|
+ if lastIedName == "" || lastIedName != nowIedName {
|
|
|
+ lastIedName = nowIedName
|
|
|
+ c.setCaption(sheet_fcda, lastIedName, 6)
|
|
|
+ c.addCellValue(sheet_fcda, []string{"序号", "外部IED", "发送信号", "本IED", "接收信号", "结论"})
|
|
|
+ cellNo = 1
|
|
|
+ }
|
|
|
+ c.addCellValue(sheet_fcda, []string{
|
|
|
+ fmt.Sprintf("%d", cellNo),
|
|
|
+ fmt.Sprintf("%s:%s", tools.IsEmpty(row["out_ied_name"]), tools.IsEmpty(row["out_ied_desc"])),
|
|
|
+ fmt.Sprintf("%s\n%s", tools.IsEmpty(row["out_fcda_desc"]), tools.IsEmpty(row["out_fcda_addr"])),
|
|
|
+ fmt.Sprintf("%s:%s", tools.IsEmpty(row["ied_name"]), tools.IsEmpty(row["ied_desc"])),
|
|
|
+ fmt.Sprintf("%s\n%s", tools.IsEmpty(row["fcda_desc"]), tools.IsEmpty(row["fcda_addr"])),
|
|
|
+ tools.IsEmpty(row["error_type_desc"]),
|
|
|
+ })
|
|
|
+ cellNo = cellNo + 1
|
|
|
+ }
|
|
|
err = file.Save(reportFN)
|
|
|
if err != nil {
|
|
|
logger.Logger.Error(err)
|
|
@@ -321,10 +356,14 @@ func (c *TaskReportMgr) ToWord(taskinfo T_data_task) (path string, err error) {
|
|
|
return reportFN[1:], err
|
|
|
}
|
|
|
|
|
|
-func (c *TaskReportMgr) setCaption(sheet *xlsx.Sheet, caption string) *xlsx.Cell {
|
|
|
+func (c *TaskReportMgr) setCaption(sheet *xlsx.Sheet, caption string, margeNum ...int) *xlsx.Cell {
|
|
|
row := sheet.AddRow()
|
|
|
cell := row.AddCell()
|
|
|
- cell.HMerge = 5 //合并单元格数
|
|
|
+ if len(margeNum) > 0 {
|
|
|
+ cell.HMerge = margeNum[0]
|
|
|
+ } else {
|
|
|
+ cell.HMerge = 5 //合并单元格数
|
|
|
+ }
|
|
|
cell.Value = caption
|
|
|
style := xlsx.NewStyle()
|
|
|
style.Alignment.Horizontal = "center"
|
|
@@ -337,5 +376,9 @@ func (c *TaskReportMgr) addCellValue(sheet *xlsx.Sheet, vs []string) {
|
|
|
for _, r := range vs {
|
|
|
cell := row.AddCell()
|
|
|
cell.Value = r
|
|
|
+ style := xlsx.NewStyle()
|
|
|
+ style.Alignment.Horizontal = "left"
|
|
|
+ style.Alignment.WrapText = true
|
|
|
+ cell.SetStyle(style)
|
|
|
}
|
|
|
}
|