Merge branch 'master' of https://gitea.mjm-staging.developers-homelab.net/BIMS/BIMS
This commit is contained in:
		
						commit
						7ae883a1b6
					
				@ -509,7 +509,7 @@
 | 
			
		||||
                    {
 | 
			
		||||
                        "data": null,
 | 
			
		||||
                        "render": function (data, type, row, meta){
 | 
			
		||||
                            return '<button bg-guid="'+row.building_tag+'" ms-guid="'+row.main_system_tag+'" ss-guid="'+row.sub_system_tag+'" class="btn btn-primary edit-btn">修改</button> <button class="btn btn-danger del-btn">刪除</button>';
 | 
			
		||||
                            return '<button bg-guid="'+row.building_tag+'" ms-guid="'+row.main_system_tag+'" ss-guid="'+row.sub_system_tag+'" class="btn btn-primary edit-btn">修改</button> <button class="btn btn-danger del-btn" bg-guid="'+row.building_tag+'" ms-guid="'+row.main_system_tag+'" ss-guid="'+row.sub_system_tag+'" >刪除</button>';
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                ],
 | 
			
		||||
 | 
			
		||||
@ -23,7 +23,7 @@
 | 
			
		||||
                    <th>#</th>
 | 
			
		||||
                    <th>角色</th>
 | 
			
		||||
                    <th>功能類型</th>
 | 
			
		||||
                    <th>區域</th>
 | 
			
		||||
                    <th>棟別</th>
 | 
			
		||||
                    <th>功能名稱</th>
 | 
			
		||||
                    <th>功能細項名稱</th>
 | 
			
		||||
                    <th>建立時間</th>
 | 
			
		||||
 | 
			
		||||
@ -107,7 +107,7 @@ namespace FrontendWebApi.ApiControllers
 | 
			
		||||
 | 
			
		||||
        [HttpPost]
 | 
			
		||||
        [Route("api/EmergencyContact/PDF")]
 | 
			
		||||
        public async Task<ActionResult<ApiResult<string>>> ExportPDF(export post)
 | 
			
		||||
        public async Task<ActionResult<ApiResult<string>>> ExportPDF([FromBody] export post)
 | 
			
		||||
        {
 | 
			
		||||
            //var grouping = JsonConvert.DeserializeObject<export>(post);
 | 
			
		||||
            ApiResult<string> apiResult = new ApiResult<string>();
 | 
			
		||||
@ -182,7 +182,7 @@ namespace FrontendWebApi.ApiControllers
 | 
			
		||||
 | 
			
		||||
        [HttpPost]
 | 
			
		||||
        [Route("api/EmergencyContact/Excel")]
 | 
			
		||||
        public async Task<ActionResult<ApiResult<string>>> ExportExcel(export post)
 | 
			
		||||
        public async Task<ActionResult<ApiResult<string>>> ExportExcel([FromBody]  export post)
 | 
			
		||||
        {
 | 
			
		||||
            //var guid = Guid.NewGuid().ToString();
 | 
			
		||||
            ApiResult<string> apiResult = new ApiResult<string>();
 | 
			
		||||
 | 
			
		||||
@ -766,7 +766,157 @@ namespace FrontendWebApi.ApiControllers
 | 
			
		||||
            Response.Headers.Add("Access-Control-Expose-Headers", "Content-Disposition");
 | 
			
		||||
            return File(ms, "application/vnd.ms-excel", "電表報表.xlsx");
 | 
			
		||||
        }
 | 
			
		||||
        [HttpPost]
 | 
			
		||||
        [Route("api/ExportWaterList")]
 | 
			
		||||
        public FileResult OpeExportExcelWater([FromBody] HydroMeterInput input)
 | 
			
		||||
        {
 | 
			
		||||
 | 
			
		||||
            var result = this.WaterList(input).Result.Value.Data.ToList();
 | 
			
		||||
 | 
			
		||||
            var workbook = new XSSFWorkbook();
 | 
			
		||||
            #region excel設定
 | 
			
		||||
            IFont font12 = workbook.CreateFont();
 | 
			
		||||
            font12.FontName = "新細明體";
 | 
			
		||||
            font12.FontHeightInPoints = 12;
 | 
			
		||||
            ICellStyle style12 = workbook.CreateCellStyle();
 | 
			
		||||
            style12.SetFont(font12);
 | 
			
		||||
            style12.Alignment = HorizontalAlignment.Center;
 | 
			
		||||
            style12.VerticalAlignment = VerticalAlignment.Center;
 | 
			
		||||
            IFont font12Times = workbook.CreateFont();
 | 
			
		||||
            font12Times.FontName = "Times New Roman";
 | 
			
		||||
            font12Times.FontHeightInPoints = 12;
 | 
			
		||||
            IFont font18 = workbook.CreateFont();
 | 
			
		||||
            font18.FontName = "新細明體";
 | 
			
		||||
            font18.FontHeightInPoints = 18;
 | 
			
		||||
            font18.IsBold = true;
 | 
			
		||||
            ICellStyle styleTitle18 = workbook.CreateCellStyle();
 | 
			
		||||
            styleTitle18.SetFont(font18);
 | 
			
		||||
            styleTitle18.Alignment = HorizontalAlignment.Center;
 | 
			
		||||
            styleTitle18.VerticalAlignment = VerticalAlignment.Center;
 | 
			
		||||
            ICellStyle styleLeft12 = workbook.CreateCellStyle();
 | 
			
		||||
            styleLeft12.SetFont(font12);
 | 
			
		||||
            styleLeft12.Alignment = HorizontalAlignment.Left;
 | 
			
		||||
            styleLeft12.VerticalAlignment = VerticalAlignment.Center;
 | 
			
		||||
            ICellStyle styleLine12 = workbook.CreateCellStyle();
 | 
			
		||||
            styleLine12.SetFont(font12);
 | 
			
		||||
            styleLine12.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
 | 
			
		||||
            styleLine12.VerticalAlignment = VerticalAlignment.Center;
 | 
			
		||||
            styleLine12.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
 | 
			
		||||
            styleLine12.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
 | 
			
		||||
            styleLine12.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
 | 
			
		||||
            styleLine12.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
 | 
			
		||||
            ICellStyle stylein12 = workbook.CreateCellStyle();
 | 
			
		||||
            stylein12.SetFont(font12Times);
 | 
			
		||||
            stylein12.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Left;
 | 
			
		||||
            stylein12.VerticalAlignment = VerticalAlignment.Center;
 | 
			
		||||
            stylein12.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
 | 
			
		||||
            stylein12.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
 | 
			
		||||
            stylein12.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
 | 
			
		||||
            stylein12.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
 | 
			
		||||
            stylein12.WrapText = true;
 | 
			
		||||
            #endregion
 | 
			
		||||
 | 
			
		||||
            var sheet = workbook.CreateSheet("電表報表");
 | 
			
		||||
            int RowPosition = 0;
 | 
			
		||||
            if (result.Count > 0)
 | 
			
		||||
            {
 | 
			
		||||
                #region set cell
 | 
			
		||||
                IRow row = sheet.CreateRow(RowPosition);
 | 
			
		||||
                sheet.SetColumnWidth(0, 4 * 160 * 12);
 | 
			
		||||
                sheet.SetColumnWidth(1, 4 * 160 * 12);
 | 
			
		||||
                sheet.SetColumnWidth(2, 4 * 160 * 12);
 | 
			
		||||
 | 
			
		||||
                int i = 0;
 | 
			
		||||
                ICell cell = row.CreateCell(i++);
 | 
			
		||||
                cell.SetCellValue("東別");
 | 
			
		||||
                cell.CellStyle = styleLine12;
 | 
			
		||||
                cell = row.CreateCell(i++);
 | 
			
		||||
                cell.SetCellValue("樓層");
 | 
			
		||||
                cell.CellStyle = styleLine12;
 | 
			
		||||
                cell = row.CreateCell(i++);
 | 
			
		||||
                cell.SetCellValue("設備");
 | 
			
		||||
                cell.CellStyle = styleLine12;
 | 
			
		||||
 | 
			
		||||
                foreach (var rr in result.FirstOrDefault().rawData)
 | 
			
		||||
                {
 | 
			
		||||
                    cell = row.CreateCell(i++);
 | 
			
		||||
                    cell.SetCellValue(rr.timeStamp);
 | 
			
		||||
                    cell.CellStyle = styleLine12;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                cell = row.CreateCell(i++);
 | 
			
		||||
                cell.SetCellValue("小計");
 | 
			
		||||
                cell.CellStyle = styleLine12;
 | 
			
		||||
                cell = row.CreateCell(i++);
 | 
			
		||||
                cell.SetCellValue("單價");
 | 
			
		||||
                cell.CellStyle = styleLine12;
 | 
			
		||||
                cell = row.CreateCell(i++);
 | 
			
		||||
                cell.SetCellValue("金額總計");
 | 
			
		||||
                cell.CellStyle = styleLine12;
 | 
			
		||||
                #endregion
 | 
			
		||||
 | 
			
		||||
                foreach (var r in result)
 | 
			
		||||
                {
 | 
			
		||||
                    RowPosition += 1;
 | 
			
		||||
                    int k = 3;
 | 
			
		||||
                    row = sheet.CreateRow(RowPosition);
 | 
			
		||||
                    for (int j = 0; j <= i; j++)
 | 
			
		||||
                    {
 | 
			
		||||
                        cell = row.CreateCell(j);
 | 
			
		||||
                        if (j == 0)
 | 
			
		||||
                        {
 | 
			
		||||
                            cell.SetCellValue(r.building_name);
 | 
			
		||||
                        }
 | 
			
		||||
                        if (j == 1)
 | 
			
		||||
                        {
 | 
			
		||||
                            cell.SetCellValue(r.floor_tag);
 | 
			
		||||
                        }
 | 
			
		||||
                        if (j == 2)
 | 
			
		||||
                        {
 | 
			
		||||
                            cell.SetCellValue(r.device_serial_tag);
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        if (j == 3)
 | 
			
		||||
                        {
 | 
			
		||||
                            foreach (var rr in r.rawData)
 | 
			
		||||
                            {
 | 
			
		||||
                                cell.SetCellValue(rr.avg_rawdata.ToString());
 | 
			
		||||
                                j++;
 | 
			
		||||
                                k++;
 | 
			
		||||
                                cell = row.CreateCell(j);
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        if (j == k)
 | 
			
		||||
                        {
 | 
			
		||||
                            cell.SetCellValue(r.total);
 | 
			
		||||
                        }
 | 
			
		||||
                        if (j == k + 1)
 | 
			
		||||
                        {
 | 
			
		||||
                            cell.SetCellValue(r.price);
 | 
			
		||||
                        }
 | 
			
		||||
                        if (j == k + 2)
 | 
			
		||||
                        {
 | 
			
		||||
                            cell.SetCellValue(r.total_price);
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        cell.CellStyle = style12;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            var ms = new NpoiMemoryStream
 | 
			
		||||
            {
 | 
			
		||||
                AllowClose = false
 | 
			
		||||
            };
 | 
			
		||||
            workbook.Write(ms);
 | 
			
		||||
            ms.Flush();
 | 
			
		||||
            ms.Seek(0, SeekOrigin.Begin);
 | 
			
		||||
 | 
			
		||||
            Response.Headers.Add("Access-Control-Expose-Headers", "Content-Disposition");
 | 
			
		||||
 | 
			
		||||
            return File(ms, "application/vnd.ms-excel", "水表報表.xlsx");
 | 
			
		||||
        }
 | 
			
		||||
        public static int GetDayInMonth(string yearMonth)
 | 
			
		||||
        {
 | 
			
		||||
            List<string> datesList = new List<string>();
 | 
			
		||||
 | 
			
		||||
@ -32,8 +32,6 @@
 | 
			
		||||
                        </div>
 | 
			
		||||
                        <div class="pr-3 row col">
 | 
			
		||||
                            <div class="frame-wrap" id="groupinglist">
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
                        <div class="card border mb-g w-100 mb-5" id="emergency_setting_card">
 | 
			
		||||
@ -201,8 +199,7 @@
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        //選擇組別
 | 
			
		||||
        function SelectGrouping(grouping, e)
 | 
			
		||||
        {
 | 
			
		||||
        function SelectGrouping(grouping, e) {
 | 
			
		||||
            if ($(e).hasClass("btn-outline-success")) {
 | 
			
		||||
                $(e).removeClass("btn-outline-success").addClass("btn-success");
 | 
			
		||||
                selectgroupidlist.push(grouping);
 | 
			
		||||
@ -218,8 +215,7 @@
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        //全選所有組別
 | 
			
		||||
        function Allgroupingselect()
 | 
			
		||||
        {
 | 
			
		||||
        function Allgroupingselect() {
 | 
			
		||||
            if (Allgroupingbool) {
 | 
			
		||||
                $('#groupinglist').find(".btn-success").removeClass("btn-success").addClass("btn-outline-success");
 | 
			
		||||
                selectgroupidlist = [];
 | 
			
		||||
@ -249,7 +245,27 @@
 | 
			
		||||
                    disaster: $('#Disasterlist').find('.btn-success').html(),
 | 
			
		||||
                    groupidlist: selectgroupidlist
 | 
			
		||||
                }
 | 
			
		||||
                window.location = "/EmergencyContact/ExportPDF?post=" + JSON.stringify(send_data);
 | 
			
		||||
 | 
			
		||||
                var url = "/api/EmergencyContact/PDF";
 | 
			
		||||
                $.ajax({
 | 
			
		||||
                    method: "POST",
 | 
			
		||||
                    contentType:"application/json; chatset='utf-8'",
 | 
			
		||||
                    headers: { "Authorization": "Bearer " + localStorage.getItem('JWT-Authorization') },
 | 
			
		||||
                    url: url,
 | 
			
		||||
                    data: JSON.stringify(send_data),
 | 
			
		||||
                    success: (res, text, xhr) => {
 | 
			
		||||
                        if (res.code == "9999") {
 | 
			
		||||
                            toast_error(res.msg);
 | 
			
		||||
                            return;
 | 
			
		||||
                        }
 | 
			
		||||
                        if(res.data && res.code == "0000"){
 | 
			
		||||
                            window.open(location.origin + "/" + res.data)
 | 
			
		||||
                        } else {
 | 
			
		||||
                            toast_error("系統發生錯誤,請再重新嘗試");
 | 
			
		||||
                        }
 | 
			
		||||
                        
 | 
			
		||||
                    }
 | 
			
		||||
                })
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -269,7 +285,25 @@
 | 
			
		||||
                    disaster: $('#Disasterlist').find('.btn-success').html(),
 | 
			
		||||
                    groupidlist: selectgroupidlist
 | 
			
		||||
                }
 | 
			
		||||
                window.location = "/EmergencyContact/ExportExcel?post=" + JSON.stringify(send_data);
 | 
			
		||||
                var url = "/api/EmergencyContact/Excel";
 | 
			
		||||
                $.ajax({
 | 
			
		||||
                    method: "POST",
 | 
			
		||||
                    contentType: "application/json; chatset='utf-8'",
 | 
			
		||||
                    headers: { "Authorization": "Bearer " + localStorage.getItem('JWT-Authorization') },
 | 
			
		||||
                    url: url,
 | 
			
		||||
                    data: JSON.stringify(send_data),
 | 
			
		||||
                    success: (res, text, xhr) => {
 | 
			
		||||
                        if (res.code == "9999") {
 | 
			
		||||
                            toast_error(res.msg);
 | 
			
		||||
                            return;
 | 
			
		||||
                        }
 | 
			
		||||
                        if(res.data && res.code == "0000"){
 | 
			
		||||
                            window.open(location.origin + "/" + res.data)
 | 
			
		||||
                        } else {
 | 
			
		||||
                            toast_error("系統發生錯誤,請再重新嘗試");
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                })
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_131117.pdf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_131117.pdf
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_131124.pdf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_131124.pdf
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_131732.pdf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_131732.pdf
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_131814.pdf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_131814.pdf
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_131831.pdf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_131831.pdf
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_131933.pdf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_131933.pdf
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_131944.pdf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_131944.pdf
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_131948.pdf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_131948.pdf
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_132239.xlsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_132239.xlsx
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_132246.xlsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_132246.xlsx
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_132319.xlsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_132319.xlsx
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_132328.pdf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								FrontendWebApi/wwwroot/excel/緊急應變_聯絡清單_20230725_132328.pdf
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
		Loading…
	
		Reference in New Issue
	
	Block a user