系統監控 合併處理
This commit is contained in:
commit
32114fbb34
@ -72,6 +72,7 @@
|
||||
strHtml += `<button id="floItemBtn${floObj.full_name}" type="button" class="btn btn-primary waves-effect waves-themed mr-5">${floObj.full_name}</button>`
|
||||
|
||||
$.each(floObj.device_list, (index2, devObj) => {
|
||||
console.log(">>>> url: " + baseImgUrl + " , img: " + varPathImg + ", icon: " + devObj.device_master_icon);
|
||||
strHtml += `<div name="devItem" data-id="${devObj.device_guid}" data-number="${devObj.device_number}" class="mr-5 cur-poi">
|
||||
<span class="status status-success d-inline-block">
|
||||
<img src="${baseImgUrl + varPathImg + devObj.device_master_icon}" class="profile-image rounded-circle" onerror="defDev(this)" alt="...">
|
||||
@ -87,25 +88,10 @@
|
||||
}
|
||||
|
||||
function drawStateTabBlo() {
|
||||
let strHtml = `<table class="table table-bordered table-striped text-center m-0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>電壓 V</td>
|
||||
<td>113</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>電流 A</td>
|
||||
<td>8</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>功率 W</td>
|
||||
<td>203</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>今日用電 kWh</td>
|
||||
<td>58</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
let strHtml = `<table class="table table-bordered table-striped text-center m-0" id="iframemodal">
|
||||
<div class="modal-body">
|
||||
<iframe src="http://localhost:8080/ord?station:%7Cslot:/TPE/B1/EE/E4/R2F/NA/WHT/N1|view:?fullScreen=true" width="100%" height="100%"></iframe>
|
||||
</div>
|
||||
</table>`
|
||||
return strHtml;
|
||||
}
|
||||
@ -154,45 +140,8 @@
|
||||
}
|
||||
|
||||
function drawErrRecTabBlo() {
|
||||
let strHtml = `<table class="table table-bordered table-striped text-center m-0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>設備編號</td>
|
||||
<td>B01-B2-19F-CR-001</td>
|
||||
<td>3D 座標</td>
|
||||
<td>113</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>設備名稱</td>
|
||||
<td>A區迴路001</td>
|
||||
<td>forge dbid</td>
|
||||
<td>101</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>廠牌</td>
|
||||
<td>飛利浦 Philip</td>
|
||||
<td>IP</td>
|
||||
<td>192.168.1.105</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>型號</td>
|
||||
<td>BH065</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>原廠文件</td>
|
||||
<td><a href="#">2022使用手冊.pdf</a></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>型號</td>
|
||||
<td>BH065</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
let strHtml = `<table id="errRecTable" class="table table-bordered table-striped text-center m-0 w-100">
|
||||
|
||||
</table>`
|
||||
return strHtml;
|
||||
}
|
||||
@ -236,16 +185,16 @@
|
||||
|
||||
</div>
|
||||
</div>`,
|
||||
group: "device",
|
||||
group:"device",
|
||||
onShow: function (tooltipEle, oriEle) {
|
||||
var tab = new YT.Tab({ tabName: "cardTab" })
|
||||
//基本資料tab block
|
||||
$("#info").append(drawInfoTabBlo(devGuid))
|
||||
loadOpeRecTable();
|
||||
//loadErrRecTable2($(oriEle).data("number"));
|
||||
loadErrRecTable();
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
function loadOpeRecTable() {
|
||||
let url = "https://api.npoint.io/31e717774a0f5822cc7b";
|
||||
@ -286,6 +235,87 @@
|
||||
|
||||
opeRecTable = new YourTeam.JqDataTables.getTableByAjax(url, tag, null, columns, column_defs, callback, null, null, null, null, null, "tpi");
|
||||
}
|
||||
|
||||
function loadErrRecTable() {
|
||||
let tag = "#errRecTable";
|
||||
let datas;
|
||||
//getOneDeviceAlarmTop10ByBaja(_devicePath, callback);
|
||||
|
||||
let column_defs = [
|
||||
{ "targets": [0], "width": "8%", "sortable": true },
|
||||
{ "targets": [1], "width": "8%", "sortable": true },
|
||||
{ "targets": [2], "width": "7%", "sortable": true },
|
||||
{ "targets": [3], "width": "7%", "sortable": true },
|
||||
];
|
||||
|
||||
let columns = [
|
||||
{
|
||||
"title": "異常ID",
|
||||
"data": "uuid",
|
||||
},
|
||||
{
|
||||
"title": "異常原因",
|
||||
"data": "msgText",
|
||||
},
|
||||
{
|
||||
"title": "ACK確認",
|
||||
"data": "ackState",
|
||||
},
|
||||
{
|
||||
"title": "發生/賦歸時間",
|
||||
"data": "timestamp",
|
||||
},
|
||||
|
||||
];
|
||||
|
||||
//let callback = function (result) {
|
||||
// datas = result;
|
||||
//}
|
||||
let result = '{"count": 2,"data":[{ "uuid": "43dc7846-bd96-4be2-ab35-f11aec729c60","msgText": "","ackState": "1","timestamp": "2022-Nov-16 10:30:24.951 AM UTC+08:00"},{"uuid": "7c309846-d862-4a8b-803b-cdc8e0efa092","msgText": "","ackState": "1","timestamp": "2022-Nov-16 10:00:24.893 AM UTC+08:00"}]}';
|
||||
let json_object = JSON.parse(result);
|
||||
datas = json_object['data'];
|
||||
errRecTable = new YourTeam.JqDataTables.getTableByStatic(tag, datas, columns, column_defs);
|
||||
}
|
||||
|
||||
//function loadErrRecTable2(allPath) {
|
||||
// if (allPath != undefined && allPath != null) {
|
||||
// let _pathArr = allPath.split("_");//TPE_B1_ELEV_EL_R2F_NA_ELEV1_N1
|
||||
// let _devicePath = _pathArr[0] + "_" + _pathArr[1] + "_" + _pathArr[2] + "_" + _pathArr[3] + "_" + _pathArr[4] + "_" + _pathArr[5];
|
||||
// //getOneDeviceAlarmTop10ByBaja(_devicePath, callback);
|
||||
// console.log("devicePath: " + _devicePath);
|
||||
// let result = '{"count": 2,"0": { "uuid": "43dc7846-bd96-4be2-ab35-f11aec729c60","timestamp": "2022-Nov-16 10:30:24.951 AM UTC+08:00","sourceName": "TPE_B1_ELEV_EL_R2F_NA_ELEV1_N1_TRIP","sourceState": "1","msgText": "","ackState": "1","normalTime": "1970-Jan-1 08:00:00.000 AM UTC+08:00"},"1": {"uuid": "7c309846-d862-4a8b-803b-cdc8e0efa092","timestamp": "2022-Nov-16 10:00:24.893 AM UTC+08:00","sourceName": "TPE_B1_ELEV_EL_R2F_NA_ELEV1_N1_TRIP","sourceState": "0","msgText": "","ackState": "1","normalTime": "2022-Nov-16 10:15:24.939 AM UTC+08:00"}}';
|
||||
// let result_Json = JSON.parse(result)
|
||||
// var eachTable = $('.each-table tbody');
|
||||
|
||||
// for (var i = 0; i < result_Json['count']; i++)
|
||||
// {
|
||||
// item = result_Json[i.toString()];
|
||||
// eachTable.append(
|
||||
// '<tr>' +
|
||||
// '<td>' + item.uuid + '</td>' +
|
||||
// '<td>' + item.msgText + '</td>' +
|
||||
// '<td>' + (item.ackState = 1 ? item.normalTime : '未確認') + '</td>' +
|
||||
// '<td>' + item.timestamp + '</td>' +
|
||||
// '</tr>');
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
// let callback = function (result) {
|
||||
// var eachTable = $('.each-table tbody');
|
||||
// $.each(result, function (index, element) {
|
||||
// eachTable.append(
|
||||
// '<tr>' +
|
||||
// '<td>' + element[index].uuid + '</td>' +
|
||||
// '<td>' + element[index].msgText + '</td>' +
|
||||
// '<td>' + (element[index].ackState = 1 ? element[index].normalTime : '未確認') + '</td>' +
|
||||
// '<td>' + element[index].timestamp + '</td>' +
|
||||
// '</tr>');
|
||||
// });
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
@ -2064,6 +2064,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
||||
<script src="js/style.js"></script>
|
||||
<script src="js/site.js"></script>
|
||||
<script src="js/init.js"></script>
|
||||
<script src="js/n4js/alarmbaja.js"></script>
|
||||
<script>
|
||||
|
||||
var jwt = localStorage.getItem("JWT-Authorization");
|
||||
|
@ -51,18 +51,22 @@ function getOneDeviceAlarmTop10ByBaja(devicePath, callback) {
|
||||
var _result = "";
|
||||
var _ss = "";
|
||||
var _index = 0;
|
||||
|
||||
//{ "count":2,"data": [{ "time": "2022/11/14 15:00:00", "errId": "0001", "ackCheck": "未確認", "errReason": "燈泡故障" }, { "time": "2022/11/14 15:00:00", "errId": "0002", "ackCheck": "未確認", "errReason": "燈泡故障" }]}
|
||||
require(['baja!'], function (baja) {
|
||||
baja.Ord.make("local:|foxs:|alarm:|bql:select top 10 timestamp, ackState, alarmData, alarmData.sourceName, sourceState, uuid, alarmData.msgText, normalTime where alarmData.sourceName like '%" + devicePath + "%' order by timestamp desc").get()
|
||||
.then(function (table) {
|
||||
return table.cursor({
|
||||
each: function (record) {
|
||||
_ss += ', "' + _index + '": {"uuid":"' + record.get('uuid') + '", "timestamp":"' + record.get('timestamp') + '", "sourceName":"' + record.get('alarmData').get('sourceName') + '", "sourceState":"' + record.get('sourceState') + '", "msgText":"' + record.get('alarmData').get('msgText') + '", "ackState":"' + record.get('ackState') + '", "normalTime":"' + record.get('normalTime') + '"}';
|
||||
if (_index == 0)
|
||||
_ss += '{"uuid":"' + record.get('uuid') + '", "msgText":"' + record.get('alarmData').get('msgText') + '", "ackState":"' + record.get('ackState') + '", "timestamp":"' + record.get('timestamp') + '"}';
|
||||
else
|
||||
_ss += ',{"uuid":"' + record.get('uuid') + '", "msgText":"' + record.get('alarmData').get('msgText') + '", "ackState":"' + record.get('ackState') + '", "timestamp":"' + record.get('timestamp') + '"}';
|
||||
_index++;
|
||||
},
|
||||
after: function () {
|
||||
_result += '{' + '"count": ' + _index;
|
||||
_result += _ss;
|
||||
_result += '{' + '"count": ' + _index +', data:[';
|
||||
|
||||
_result += _ss+']';
|
||||
_result += '}';
|
||||
if (typeof callback === 'function') {
|
||||
callback(_result);
|
||||
|
@ -58,35 +58,35 @@ function fnInitJqDataTablesNoData(tag, dataSet = null, columns = null, columnDef
|
||||
"columns": columns,
|
||||
"aoColumnDefs": columnDefs,
|
||||
"stateSave": true,
|
||||
"pagingType": "full_numbers_custom",
|
||||
"pagingType": "simple",
|
||||
"destroy": false,
|
||||
"initComplete": initComplete,
|
||||
"drawCallback": fnDrawCallBack,
|
||||
"rowsGroup": rowsGroup,
|
||||
"rowGroup": rowGroup,
|
||||
//"rowsGroup": rowsGroup,
|
||||
//"rowGroup": rowGroup,
|
||||
"retrieve": true,
|
||||
"responsive": {
|
||||
details: {
|
||||
//"responsive": {
|
||||
// details: {
|
||||
|
||||
target: '.dt-mobile-btn',
|
||||
type: "column",
|
||||
renderer: function (api, rowIdx, columns) {
|
||||
var data = $.map(columns, function (col, i) {
|
||||
return col.hidden ?
|
||||
'<tr data-dt-row="' + col.rowIndex + '" data-dt-column="' + col.columnIndex + '">' +
|
||||
'<td>' + col.title + ':' + '</td> ' +
|
||||
'<td>' + col.data + '</td>' +
|
||||
'</tr>' :
|
||||
'';
|
||||
}).join('');
|
||||
// target: '.dt-mobile-btn',
|
||||
// type: "column",
|
||||
// renderer: function (api, rowIdx, columns) {
|
||||
// var data = $.map(columns, function (col, i) {
|
||||
// return col.hidden ?
|
||||
// '<tr data-dt-row="' + col.rowIndex + '" data-dt-column="' + col.columnIndex + '">' +
|
||||
// '<td>' + col.title + ':' + '</td> ' +
|
||||
// '<td>' + col.data + '</td>' +
|
||||
// '</tr>' :
|
||||
// '';
|
||||
// }).join('');
|
||||
|
||||
return data ?
|
||||
$('<table/>').append(data) :
|
||||
false;
|
||||
},
|
||||
// return data ?
|
||||
// $('<table/>').append(data) :
|
||||
// false;
|
||||
// },
|
||||
|
||||
},
|
||||
},
|
||||
// },
|
||||
//},
|
||||
|
||||
}
|
||||
|
||||
|
@ -6,19 +6,22 @@ using Microsoft.AspNetCore.Mvc.Filters;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using NPOI.HPSF;
|
||||
using NPOI.HSSF.UserModel;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using NPOI.SS.UserModel;
|
||||
using NPOI.Util;
|
||||
using NPOI.XSSF.UserModel;
|
||||
using NPOI.Util;
|
||||
using Org.BouncyCastle.Crypto.Agreement.JPake;
|
||||
using Repository.BackendRepository.Interface;
|
||||
using Repository.FrontendRepository.Interface;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Image = System.Drawing.Image;
|
||||
|
||||
namespace FrontendWebApi.ApiControllers
|
||||
{
|
||||
@ -226,6 +229,7 @@ namespace FrontendWebApi.ApiControllers
|
||||
/// <returns></returns>
|
||||
public FileResult OpeExportExcel([FromQuery] byte? work_type)
|
||||
{
|
||||
var j = 1;//row
|
||||
var workbook = new XSSFWorkbook();
|
||||
#region excel設定
|
||||
IFont font12 = workbook.CreateFont();
|
||||
@ -366,9 +370,11 @@ namespace FrontendWebApi.ApiControllers
|
||||
{
|
||||
var sqlString = $@"select opr.*, concat(d.device_floor_tag, ' ', d.device_last_name, ' ', d.device_serial_tag) as device_name, ui.full_name as user_full_name
|
||||
from operation_record opr
|
||||
left join device d on opr.fix_do_code = d.device_number
|
||||
left join device d on opr.fix_do_code = d.device_number and d.deleted = 0 and d.device_area_tag = SUBSTRING_INDEX(opr.fix_do_code, '_', 1)
|
||||
and d.device_building_tag = SUBSTRING_INDEX(opr.fix_do_code, '_', 2) and d.device_floor_tag = SUBSTRING_INDEX(opr.fix_do_code, '_', 5)
|
||||
and d.device_system_tag = opr.device_system_category_layer2 and d.device_name_tag = opr.device_system_category_layer3
|
||||
left join userinfo ui on opr.work_person_id = ui.userinfo_guid
|
||||
where opr.deleted = 0 and opr.work_type = 1";
|
||||
where opr.deleted = 0 and opr.work_type = 1;";
|
||||
var sheet = workbook.CreateSheet("廠商資料");
|
||||
var operation_record = backendRepository.GetAllAsync<Operation_Record>(sqlString, null);
|
||||
List<Operation_Record_File> operation_record_file = new List<Operation_Record_File>();
|
||||
@ -464,7 +470,53 @@ namespace FrontendWebApi.ApiControllers
|
||||
}
|
||||
if (i == 7)
|
||||
{
|
||||
cell.SetCellValue(or.finish_time); // image
|
||||
var imageNames = or.lorf.Count > 0 ? or.lorf.Select(x => x.save_file_name).ToList() : null;
|
||||
if (imageNames != null)
|
||||
{
|
||||
//insert image process
|
||||
var dy1 = 10;
|
||||
var dx1 = 10;
|
||||
|
||||
//image column
|
||||
sheet.SetColumnWidth(i, 16 * imageNames.Count * 256); //width: picture width(16:100), image total, per character(256)
|
||||
foreach (var ins in imageNames)
|
||||
{
|
||||
//image initial
|
||||
var extName = ins.Split('.')[1].ToUpper().Equals("JPG") ? "PNG" : ins.Split('.')[1].ToUpper();
|
||||
var fullPath = Path.Combine(operationFileSaveAsPath, ins);
|
||||
var img = Image.FromFile(fullPath);
|
||||
|
||||
//compress image
|
||||
decimal sizeRatio = ((decimal)img.Height / img.Width);
|
||||
int thumbWidth = 100;
|
||||
int thumbHeight = decimal.ToInt32(sizeRatio * thumbWidth);
|
||||
var thumbStream = img.GetThumbnailImage(thumbWidth, thumbHeight, () => false, IntPtr.Zero);
|
||||
var memoryStream = new MemoryStream();
|
||||
thumbStream.Save(memoryStream, ImageFormat.Jpeg);
|
||||
|
||||
//setting pictureType enum
|
||||
int format = 0;
|
||||
var drawing = (XSSFDrawing)sheet.CreateDrawingPatriarch();
|
||||
format = Convert.ToInt32(Enum.Parse(typeof(PictureType), extName));
|
||||
|
||||
//set picture size and location
|
||||
if (format != 0)
|
||||
{
|
||||
var pictureIds = workbook.AddPicture(memoryStream.ToArray(), format);
|
||||
XSSFClientAnchor anchor = new XSSFClientAnchor(XSSFShape.EMU_PER_PIXEL * dx1, XSSFShape.EMU_PER_PIXEL * dy1, 0, 0, i, j, 0, 0);
|
||||
anchor.AnchorType = AnchorType.DontMoveAndResize;
|
||||
var picture = (XSSFPicture)drawing.CreatePicture(anchor, pictureIds);
|
||||
var size = picture.GetImageDimension();
|
||||
row.HeightInPoints = size.Height;
|
||||
picture.Resize();
|
||||
|
||||
//add 105 each new pic
|
||||
dx1 += 105;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
j++;
|
||||
}
|
||||
if (i == 8)
|
||||
{
|
||||
@ -484,11 +536,13 @@ namespace FrontendWebApi.ApiControllers
|
||||
{
|
||||
var sqlString = $@"select opr.*, concat(d.device_floor_tag, ' ', d.device_last_name, ' ', d.device_serial_tag) as device_name, ui.full_name as user_full_name
|
||||
from operation_record opr
|
||||
left join device d on opr.fix_do_code = d.device_number
|
||||
left join userinfo ui on opr.work_person_id = ui.id
|
||||
left join device d on opr.fix_do_code = d.device_number and d.deleted = 0 and d.device_area_tag = SUBSTRING_INDEX(opr.fix_do_code, '_', 1)
|
||||
and d.device_building_tag = SUBSTRING_INDEX(opr.fix_do_code, '_', 2) and d.device_floor_tag = SUBSTRING_INDEX(opr.fix_do_code, '_', 5)
|
||||
and d.device_system_tag = opr.device_system_category_layer2 and d.device_name_tag = opr.device_system_category_layer3
|
||||
left join userinfo ui on opr.work_person_id = ui.userinfo_guid
|
||||
where opr.deleted = 0 and opr.work_type = 2";
|
||||
var sheet = workbook.CreateSheet("廠商資料");
|
||||
var operation_record = backendRepository.GetAllAsync<Operation_Record>(sqlString, null);
|
||||
var operation_record = backendRepository.GetAllAsync<Operation_Record>(sqlString);
|
||||
List<Operation_Record_File> operation_record_file = new List<Operation_Record_File>();
|
||||
|
||||
if (operation_record.Result.Count > 0)
|
||||
@ -548,13 +602,13 @@ namespace FrontendWebApi.ApiControllers
|
||||
cell = row.CreateCell(10);
|
||||
cell.SetCellValue("建立時間");
|
||||
cell.CellStyle = styleLine12;
|
||||
var j = 0;//row
|
||||
|
||||
#endregion
|
||||
foreach (var or in operation_record.Result)
|
||||
{
|
||||
RowPosition += 1;
|
||||
row = sheet.CreateRow(RowPosition);
|
||||
for (var i = 0; i < 10; i++)//column
|
||||
for (var i = 0; i < 11; i++)//column
|
||||
{
|
||||
cell = row.CreateCell(i);
|
||||
if (i == 0)
|
||||
@ -565,9 +619,10 @@ namespace FrontendWebApi.ApiControllers
|
||||
{
|
||||
cell.SetCellValue(or.location);
|
||||
}
|
||||
if (i == 1)
|
||||
if (i == 2)
|
||||
{
|
||||
cell.SetCellValue(or.error_code);
|
||||
sheet.AutoSizeColumn(i);
|
||||
}
|
||||
if (i == 3)
|
||||
{
|
||||
@ -587,31 +642,61 @@ namespace FrontendWebApi.ApiControllers
|
||||
}
|
||||
if (i == 7)
|
||||
{
|
||||
cell.SetCellValue(or.start_time);
|
||||
cell.SetCellValue(or.start_time.ToString("yyyy/MM/dd HH:mm:ss"));
|
||||
}
|
||||
if (i == 8)//image
|
||||
{
|
||||
var image = or.lorf.FirstOrDefault().save_file_name;
|
||||
var extName = "JPG"; //image.Split('.')[1];
|
||||
var fullPath = Path.Combine(operationFileSaveAsPath, "image1.jpg");
|
||||
var imageByte = System.IO.File.ReadAllBytes(fullPath);
|
||||
var imageNames = or.lorf.Count > 0 ? or.lorf.Select(x => x.save_file_name).ToList() : null;
|
||||
if (imageNames != null)
|
||||
{
|
||||
//insert image process
|
||||
var dy1 = 10;
|
||||
var dx1 = 10;
|
||||
|
||||
//image column
|
||||
sheet.SetColumnWidth(i, 16 * imageNames.Count * 256); //width: picture width(16:100), image total, per character(256)
|
||||
foreach (var ins in imageNames)
|
||||
{
|
||||
//image initial
|
||||
var extName = ins.Split('.')[1].ToUpper().Equals("JPG") ? "PNG" : ins.Split('.')[1].ToUpper();
|
||||
var fullPath = Path.Combine(operationFileSaveAsPath, ins);
|
||||
var img = Image.FromFile(fullPath);
|
||||
|
||||
//compress image
|
||||
decimal sizeRatio = ((decimal)img.Height / img.Width);
|
||||
int thumbWidth = 100;
|
||||
int thumbHeight = decimal.ToInt32(sizeRatio * thumbWidth);
|
||||
var thumbStream = img.GetThumbnailImage(thumbWidth, thumbHeight, () => false, IntPtr.Zero);
|
||||
var memoryStream = new MemoryStream();
|
||||
thumbStream.Save(memoryStream, ImageFormat.Jpeg);
|
||||
|
||||
//setting pictureType enum
|
||||
int format = 0;
|
||||
var drawing = sheet.CreateDrawingPatriarch();
|
||||
var drawing = (XSSFDrawing)sheet.CreateDrawingPatriarch();
|
||||
format = Convert.ToInt32(Enum.Parse(typeof(PictureType), extName));
|
||||
|
||||
//set picture size and location
|
||||
if (format != 0)
|
||||
{
|
||||
var pictureIds = workbook.AddPicture(imageByte, format);
|
||||
XSSFClientAnchor anchor = new XSSFClientAnchor();
|
||||
anchor.Col1 = i;
|
||||
anchor.Row1 = j;
|
||||
var picture = drawing.CreatePicture(anchor, pictureIds);
|
||||
var pictureIds = workbook.AddPicture(memoryStream.ToArray(), format);
|
||||
XSSFClientAnchor anchor = new XSSFClientAnchor(XSSFShape.EMU_PER_PIXEL * dx1, XSSFShape.EMU_PER_PIXEL * dy1, 0, 0, i, j, 0, 0);
|
||||
anchor.AnchorType = AnchorType.DontMoveAndResize;
|
||||
var picture = (XSSFPicture)drawing.CreatePicture(anchor, pictureIds);
|
||||
var size = picture.GetImageDimension();
|
||||
row.HeightInPoints = size.Height;
|
||||
picture.Resize();
|
||||
|
||||
//add 105 each new pic
|
||||
dx1 += 105;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
j++;
|
||||
}
|
||||
if (i == 9)
|
||||
{
|
||||
cell.SetCellValue(or.finish_time);
|
||||
cell.SetCellValue(or.finish_time.ToString("yyyy/MM/dd HH:mm:ss"));
|
||||
}
|
||||
if (i == 10)
|
||||
{
|
||||
@ -619,7 +704,7 @@ namespace FrontendWebApi.ApiControllers
|
||||
}
|
||||
|
||||
cell.CellStyle = style12;
|
||||
j++;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -633,7 +718,7 @@ namespace FrontendWebApi.ApiControllers
|
||||
ms.Flush();
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
return File(ms, "application/vnd.ms-excel", "廠商資料.xlsx");
|
||||
return File(ms, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "廠商資料.xlsx");
|
||||
}
|
||||
|
||||
#region 廠商
|
||||
|
Loading…
Reference in New Issue
Block a user