网页端 信号监测表导入

This commit is contained in:
xingheng 2025-09-01 13:24:47 +08:00
parent dccff57aaa
commit c1b44f26f1
25 changed files with 465 additions and 7893 deletions

4
.gitignore vendored
View File

@ -957,3 +957,7 @@ bin/release/
/Learun.Framework.Module/Learun.Db/Learun.DataBase.EF.Oracle/obj/Release/Learun.DataBase.Oracle.csproj.AssemblyReference.cache
/Learun.Framework.Module/Learun.Db/Learun.DataBase.EF.Sqlserver/obj/Release/Learun.DataBase.SqlServer.csproj.AssemblyReference.cache
/Learun.Framework.Module/Learun.Db/Learun.DataBase.MySql/obj/Release/Learun.DataBase.MySqlEx.csproj.AssemblyReference.cache
/Learun.Application.Web/bin/Learun.Application.Web.xml
/Learun.Application.Web/obj/Release/Package/PackageTmp/bin/Learun.Application.Web.dll
/Learun.Application.Web/obj/Release/Package/PackageTmp/bin/Learun.Application.Web.pdb
/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache

View File

@ -95,29 +95,29 @@ namespace Learun.Application.Web.AppApi
SqlSugarHelper.Db.BeginTran();
var dataitemTableName = ProjectSugar.TableName<ec_dataitemEntity>(projectId);
var itemcodes = new List<string>() { "自动化平台", "Be_Signal_Group", "Exten_Alarm_Group", "Alarm_Blocking_Group", "Maker", "Alarm" };
var itemcodes = new List<string>() { GlobalObject.dataitemName_SignalManage, GlobalObject.enumlist_signalGroup, "Exten_Alarm_Group", "Alarm_Blocking_Group", "Maker", "Alarm" };
#region
var items = SqlSugarHelper.Db.Queryable<ec_dataitemEntity>().AS(dataitemTableName).Where(x => itemcodes.Contains(x.DataItemCode)).ToList();
var upDataItem = items.FirstOrDefault(x => x.DataItemCode == "自动化平台");
var upDataItem = items.FirstOrDefault(x => x.DataItemCode == GlobalObject.dataitemName_SignalManage);
if (upDataItem == null)
{
upDataItem = new ec_dataitemEntity();
upDataItem.Create();//DataItemID
upDataItem.UpDataItemID = "0";
upDataItem.DataItemName = "自动化平台";
upDataItem.DataItemCode = "自动化平台";
upDataItem.DataItemName = GlobalObject.dataitemName_SignalManage;
upDataItem.DataItemCode = GlobalObject.dataitemName_SignalManage;
upDataItem.OrderID = 6;
upDataItem.IsEnabled = 1;
upDataItem.IsAllowEdit = 1;
SqlSugarHelper.Db.Insertable(upDataItem).AS(dataitemTableName).ExecuteCommand();
}
if (!items.Any(x => x.DataItemCode == "Be_Signal_Group"))
if (!items.Any(x => x.DataItemCode == GlobalObject.enumlist_signalGroup))
{
var item = new ec_dataitemEntity();
item.Create();
item.UpDataItemID = upDataItem.DataItemID;
item.DataItemName = "信号分组";
item.DataItemCode = "Be_Signal_Group";
item.DataItemCode = GlobalObject.enumlist_signalGroup;
item.OrderID = 1;
item.IsEnabled = 1;
item.IsAllowEdit = 1;
@ -172,7 +172,7 @@ namespace Learun.Application.Web.AppApi
SqlSugarHelper.Db.Insertable(item).AS(dataitemTableName).ExecuteCommand();
}
#endregion
if (itemCode == "Be_Signal_Group")
if (itemCode == GlobalObject.enumlist_signalGroup)
{
var tableName = ProjectSugar.TableName<ec_Wire_GroupEntity>(projectId);
//数据字典
@ -180,14 +180,14 @@ namespace Learun.Application.Web.AppApi
.Where(x => !string.IsNullOrEmpty(x.Signal_Group))
.GroupBy(x => x.Signal_Group).Select(x => x.Signal_Group).ToList();//这里可能为空的,因为现在虚拟点也在这里
var dataitemDetailTableName = ProjectSugar.TableName<ec_dataitemdetailEntity>(projectId);
var item = SqlSugarHelper.Db.Queryable<ec_dataitemEntity>().AS(dataitemTableName).First(x => x.DataItemCode == "Be_Signal_Group");
var item = SqlSugarHelper.Db.Queryable<ec_dataitemEntity>().AS(dataitemTableName).First(x => x.DataItemCode == GlobalObject.enumlist_signalGroup);
if (item == null)
{
item = new ec_dataitemEntity();
item.Create();
item.UpDataItemID = "0";
item.DataItemName = "信号分组";
item.DataItemCode = "Be_Signal_Group";
item.DataItemCode = GlobalObject.enumlist_signalGroup;
item.OrderID = 5;
item.IsEnabled = 1;
SqlSugarHelper.Db.Insertable(item).AS(dataitemTableName).ExecuteCommand();

View File

@ -109,14 +109,17 @@ namespace Learun.Application.Web.AppApi
if (xValue < 400)
{
// 小于400我几乎可以认为此时肋位号用的是m这个单位。因为如果用的是mm400mm的肋位号似乎也太小了。
xValue = 1000* xValue; // 转成mm
xValue = 1000 * xValue; // 转成mm
}
var Prop_FrameOff = tagProps.FirstOrDefault(x => x.PropertyName == GlobalObject.propName_FrameOff)?.PropertyValue;
var Prop_YOff = tagProps.FirstOrDefault(x => x.PropertyName == GlobalObject.propName_YOff)?.PropertyValue;
var DECK = tagProps.FirstOrDefault(x => x.PropertyName == "甲板号")?.PropertyValue;
var AREA = tagProps.FirstOrDefault(x => x.PropertyName == "区域")?.PropertyValue;
var BasePointProp_scale = tagProps.FirstOrDefault(x => x.PropertyName == "比例");
var layoutTag = new layoutTagInfoBrief()
{
EngineDataID = pointTag.EngineDataID,
FileId = "",
PixelOnDwg = pointsOnDwg.FirstOrDefault(x => x.EngineDataID == pointTag.EngineDataID)?.PixelCode,
@ -125,7 +128,8 @@ namespace Learun.Application.Web.AppApi
XOff = Prop_FrameOff,
YOff = Prop_YOff,
deck = DECK,
area = AREA
area = AREA,
Scale = BasePointProp_scale == null ? 1 : (double.TryParse(BasePointProp_scale.PropertyValue, out double scale) ? scale : 1)
};
@ -272,7 +276,8 @@ namespace Learun.Application.Web.AppApi
XOff = Prop_FrameOff,
YOff = Prop_YOff,
deck = basePoint.deck,
area = basePoint.area
area = basePoint.area,
Scale = basePoint.Scale
};
basePoint.Tags.Add(layoutTagInfo);
}

View File

@ -70,7 +70,48 @@ namespace Learun.Application.Web.AppApi
var res = new ec_Wire_GroupBLL(projId).GetList("{ProjectId:\"" + projId + "\"}", Assigned, false, true);
return Success(res);
}
/// <summary>
/// 获取信号组信息,用于输出点落实信息(暂时)
/// </summary>
/// <param name="projId"></param>
/// <returns></returns>
[HttpGet]
public IHttpActionResult GetGroupInfo(string projId)
{
var res = new List<signalGroup>();
var allSignal = new ec_Wire_GroupBLL(projId).GetList("{ProjectId:\"" + projId + "\"}", false);
var dataitemBll = new ec_dataitemBLL();
var group_codelist = dataitemBll.GetDetailList(GlobalObject.enumlist_signalGroup, "", projId).OrderBy(x => x.DataItemCode).ToList();
foreach (var x in group_codelist)
{
var group = new signalGroup();
group.Name = x.DataItemName;
group.Code = x.DataItemCode;
group.Id = x.DataItemDetailID;
group.Sub = allSignal.Where(X => X.Signal_Group == group.Code && X.InOrOut == "output").OrderBy(X => X.Group_Name).ToList();
if (group.Sub.Count > 0)
{
var approvedCount = group.Sub.Where(y => y.Status == WireGroupStatusEnum.Confirmed).Count();
if (approvedCount == 0)
{
group.status = signalGroupStatusEnum.;
}
else if (approvedCount == group.Sub.Count)
{
group.status = signalGroupStatusEnum.;
}
else
{
group.status = signalGroupStatusEnum.;
}
res.Add(group);
}
}
return Success(res);
}
/// <summary>
/// 批量保存(增、改、删)信号。
@ -251,7 +292,25 @@ namespace Learun.Application.Web.AppApi
return Fail(e.Message);
}
}
/// <summary>
/// 历史记录输出操作,时间节点主要分为送审前、送审后、施工图后
/// </summary>
/// <param name="projectId"></param>
/// <param name="start"></param>
/// <param name="end"></param>
/// <param name="delete"></param>
[HttpGet]
public void ExportChanges(string projectId, DateTime start, DateTime end, bool delete = false)
{
if (string.IsNullOrEmpty(projectId))
{
return; // 空时,无意义
}
var BLL = new ec_Wire_GroupBLL();
var bytes = BLL.ExportChanges(projectId, delete, start, end);//api export
var stream = new MemoryStream(bytes);
FileDownHelper.DownLoad(stream, $"信号变更记录{DateTime.Now.ToString("yyyyMMddHHmmss")}.xlsx");//自动化平台导出excel
}
/// <summary>
/// 成品导出xlsx
/// </summary>

View File

@ -351,14 +351,15 @@ namespace Learun.Application.Web.Areas.ZZDT_EC.Controllers
/// <summary>
/// 导入 监控系统表 不支持panel strip的修改只支持已有模块下的 signal和cable的关联
/// </summary>
/// <param name="keyValue"></param>
/// <param name="fileId">网页上上传的excel文件的guid号</param>
/// <param name="ProjId"></param>
/// <returns></returns>
public ActionResult IOModuleImportExcel(string keyValue, string ProjId)
[HttpPost]
public ActionResult IOModuleImportExcel(string fileId, string ProjId)
{
//MVC
//查询文件的真实路径
var file = new AnnexesFileBLL().GetByfolderIdEntity(keyValue);
var file = new AnnexesFileBLL().GetByfolderIdEntity(fileId);
if (string.IsNullOrWhiteSpace(file?.F_FilePath))
{
return Fail("找不到文件" + file?.F_FilePath);

View File

@ -49,8 +49,9 @@
<li id="lr_approve"><a><i></i>&nbsp;<span class="lrlg">审核</span></a></li>
<li id="lr_reopen"><a><i></i>&nbsp;<span class="lrlg">重现打开</span></a></li>
<li id="lr_groupmanager"><a><i></i>&nbsp;<span class="lrlg">信号模板管理</span></a></li>
<li id="lr_import"><a><i></i>&nbsp;<span class="lrlg">数据导入</span></a></li>
<li id="lr_export"><a><i></i>&nbsp;<span class="lrlg">监测系统表导出</span></a></li>
<li id="lr_import"><a><i></i>&nbsp;<span class="lrlg">信号数据导入</span></a></li>
@*<li id="lr_export"><a><i></i>&nbsp;<span class="lrlg">监测系统表导出</span></a></li>
<li id="lr_import_IO"><a><i></i>&nbsp;<span class="lrlg">监测系统表导入</span></a></li>*@
</ul>
</div>
</div>

View File

@ -184,21 +184,10 @@ var bootstrap = function ($, learun) {
});
//监测系统表导出 lr_export
$('#lr_export').on('click', function () {
learun.loading(true, "导出中...");
var iframeUrl = top.$.rootUrl + '/ZZDT_EC/ec_Wire_Group/IOModuleExportExcel?ProjId=' + ProjectId;
var body = document.getElementsByTagName("body")[0];
var downloadIframe = document.createElement("iframe");
downloadIframe.setAttribute("src", iframeUrl);
downloadIframe.setAttribute("style", "display:none;")
body.appendChild(downloadIframe);
learun.loading(false);
});
//数据导入
//信号数据导入
$('#lr_import').on('click', function () {
learun.layerForm({
id: 'form',//窗口id
@ -285,5 +274,7 @@ var bootstrap = function ($, learun) {
refreshGirdData = function () {
$('#gridtable').jfGridSet('reload');
};
page.init();
}

View File

@ -25,6 +25,10 @@
<a id="lr_delete" class="btn btn-default"><i class="fa fa-trash-o"></i>&nbsp;删除</a>
<a id="lr_namingconv" class="btn btn-default"><i class="fa fa-bars"></i>通道</a>
</div>
<div class=" btn-group btn-group-sm">
<a id="lr_export" class="btn btn-default"><i class="fa fa-arrow-circle-up"></i>监测系统表导出</a>
<a id="lr_import" class="btn btn-default"><i class="fa fa-arrow-circle-down"></i>监测系统表导入</a>
</div>
</div>
</div>
<div class="lr-layout-body" id="gridtable"></div>

View File

@ -80,6 +80,39 @@ var bootstrap = function ($, learun) {
});
}
});
//监测系统表导出 lr_export
$('#lr_export').on('click', function () {
learun.loading(true, "导出中...");
var iframeUrl = top.$.rootUrl + '/ZZDT_EC/ec_Wire_Group/IOModuleExportExcel?ProjId=' + ProjectId;
var body = document.getElementsByTagName("body")[0];
var downloadIframe = document.createElement("iframe");
downloadIframe.setAttribute("src", iframeUrl);
downloadIframe.setAttribute("style", "display:none;")
body.appendChild(downloadIframe);
learun.loading(false);
});
//监测数据表导入
$('#lr_import').on('click', function () {
var format = 'xlsx';
var uploadKeyValue = Guid.NewGuid().toString();
learun.layerForm({
id: 'import_IO',
title: '监测表数据导入',
url: top.$.rootUrl + '/LR_SystemModule/Annexes/UploadForm?keyVaule=' + uploadKeyValue + "&multiple=false" + "&format=" + format,
width: 600,
height: 400,
maxmin: true,
btn: ['确认'],
callBack: function (id) {
learun.layerClose('import_IO');
import_IO(uploadKeyValue);
}
});
});
},
initGird: function () {
$('#gridtable').jfGrid({
@ -106,5 +139,41 @@ var bootstrap = function ($, learun) {
refreshGirdData = function () {
$('#gridtable').jfGridSet('reload');
};
//监测数据表导入
function import_IO(fileId) {
var learun = top.learun;
learun.loading(true, "监测表数据导入中...");
$.ajax({
type: 'POST',
url: top.$.rootUrl + "/ZZDT_EC/ec_Wire_Group/IOModuleImportExcel?rdo=" + Math.random(),
data: {
fileId: fileId,
ProjId: ProjectId
},
traditional: true,
success: function (data) {
var data = JSON.parse(data);
if (data.code == '200') {
learun.alert.success(data.info);
} else {
learun.alert.error(data.info);
}
},
error: function (msg) {
learun.alert.error(msg);
},
complete: function (data) {
learun.loading(false);
if (!!thiscall) {
thiscall();
}
}
});
}
page.init();
}

View File

@ -63,26 +63,45 @@
<div class="lr-form-item-title">IMO编号</div>
<input id="IMONumber" type="text" class="form-control" autocomplete="off" />
</div>
<!-- 新增的时间选择控件 -->
<div class="col-xs-6 lr-form-item" data-table="ec_project">
<div class="lr-form-item-title">计划送审</div>
<input id="IO_predicted_issue" type="date" class="date-picker" autocomplete="off" />
</div>
<div class="col-xs-6 lr-form-item" data-table="ec_project">
<div class="lr-form-item-title">计划施工</div>
<input id="IO_predicted_construct" type="date" class="date-picker" autocomplete="off" />
</div>
<div class="col-xs-6 lr-form-item" data-table="ec_project">
<div class="lr-form-item-title">实际送审</div>
<input id="IO_real_issue" type="date" class="date-picker" autocomplete="off" />
</div>
<div class="col-xs-6 lr-form-item" data-table="ec_project">
<div class="lr-form-item-title">实际施工</div>
<input id="IO_real_construct" type="date" class="date-picker" autocomplete="off" />
</div>
<div class="col-xs-12 lr-form-item textarea" data-table="ec_project">
<div class="lr-form-item-title">项目更多描述一</div>
<textarea id="Describe1" class="form-control" style="height:100px;" autocomplete="off"></textarea>
<textarea id="Describe1" class="form-control" style="height:60px;" autocomplete="off"></textarea>
</div>
<div class="col-xs-12 lr-form-item textarea" data-table="ec_project">
<div class="lr-form-item-title">项目更多描述二</div>
<textarea id="Describe2" class="form-control" style="height:100px;" autocomplete="off"></textarea>
<textarea id="Describe2" class="form-control" style="height: 60px;" autocomplete="off"></textarea>
</div>
<div class="col-xs-12 lr-form-item textarea" data-table="ec_project">
<div class="lr-form-item-title">项目更多描述三</div>
<textarea id="Describe3" class="form-control" style="height:100px;" autocomplete="off"></textarea>
<textarea id="Describe3" class="form-control" style="height: 60px;" autocomplete="off"></textarea>
</div>
<div class="col-xs-12 lr-form-item textarea" data-table="ec_project">
<div class="lr-form-item-title">项目更多描述四</div>
<textarea id="Describe4" class="form-control" style="height:100px;" autocomplete="off"></textarea>
<textarea id="Describe4" class="form-control" style="height: 60px;" autocomplete="off"></textarea>
</div>
<div class="col-xs-12 lr-form-item textarea" data-table="ec_project">
<div class="lr-form-item-title">项目更多描述五</div>
<textarea id="Describe5" class="form-control" style="height:100px;" autocomplete="off"></textarea>
<textarea id="Describe5" class="form-control" style="height: 60px;" autocomplete="off"></textarea>
</div>
</div>

View File

@ -3433,6 +3433,7 @@
<Content Include="SQL\250307\Project\ec_archive_enginedata_3.sql" />
<Content Include="SQL\250307\Project\ec_archive_property_3.sql" />
<Content Include="SQL\250307\Project\ec_archive_rel_3.sql" />
<Content Include="SQL\250829\NoProject\ec_project.sql" />
<Content Include="SQL\250825\Project\DWG_PUBLISH.sql" />
<Content Include="SQL\250728\Project\ec_layoutFilterP.sql" />
<Content Include="SQL\250728\Project\ec_layoutFilter.sql" />
@ -3658,6 +3659,7 @@
<Folder Include="SQL\250328\NoProject\" />
<Folder Include="SQL\250728\NoProject\" />
<Folder Include="SQL\250825\NoProject\" />
<Folder Include="SQL\250829\Project\" />
<Folder Include="Views\PlotLayout\" />
<Folder Include="Views\Property\" />
</ItemGroup>

View File

@ -0,0 +1,5 @@
ALTER TABLE ec_project ADD `IO_predicted_issue` VARCHAR(50) NULL;
ALTER TABLE ec_project ADD `IO_predicted_issue` VARCHAR(50) NULL;
ALTER TABLE ec_project ADD `IO_predicted_issue` VARCHAR(50) NULL;
ALTER TABLE ec_project ADD `IO_predicted_issue` VARCHAR(50) NULL;

File diff suppressed because it is too large Load Diff

View File

@ -273,6 +273,7 @@
<Compile Include="ZZDT_EC\ec_operate_log\ec_operate_logService.cs" />
<Compile Include="ZZDT_EC\ec_operate_log\ec_operate_logIBLL.cs" />
<Compile Include="ZZDT_EC\ec_operate_log\ec_operate_logBLL.cs" />
<Compile Include="ZZDT_EC\ec_Wire_Group\signalGroup.cs" />
<Compile Include="ZZDT_EC\GlobalEnum.cs" />
<Compile Include="ZZDT_EC\GlobalObject.cs" />
<Compile Include="ZZDT_EC\ec_template_catalogue\ec_template_catalogueEntity.cs" />

View File

@ -40,6 +40,10 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
/// </summary>
public const string enum_separator = "||";
/// <summary>
/// 信号组别的数据字典
/// </summary>
public const string enumlist_signalGroup = "Be_Signal_Group";
/// <summary>
/// 图纸阶段
/// </summary>
public const string enumlist_DrawingStage = "Be_DrawingStage";

View File

@ -921,7 +921,8 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
{
SqlSugarHelper.Db.RollbackTran();
return ex.Message;
};
}
;
#endregion
}
@ -1015,7 +1016,8 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
{
SqlSugarHelper.Db.RollbackTran();
return ex.Message;
};
}
;
#endregion
}
@ -4314,27 +4316,27 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
redisObj.Remove(redisKeyDetail, projectId);
var tableName = ProjectSugar.TableName<ec_dataitemEntity>(projectId);
var detailTableName = ProjectSugar.TableName<ec_dataitemdetailEntity>(projectId);
var upDataItem = SqlSugarHelper.Db.Queryable<ec_dataitemEntity>().AS(tableName).First(x => x.DataItemCode == "自动化平台");
var upDataItem = SqlSugarHelper.Db.Queryable<ec_dataitemEntity>().AS(tableName).First(x => x.DataItemCode == GlobalObject.dataitemName_SignalManage);
if (upDataItem == null)
{
upDataItem = new ec_dataitemEntity();
upDataItem.Create();
upDataItem.UpDataItemID = "0";
upDataItem.DataItemName = "自动化平台";
upDataItem.DataItemCode = "自动化平台";
upDataItem.DataItemName = GlobalObject.dataitemName_SignalManage;
upDataItem.DataItemCode = GlobalObject.dataitemName_SignalManage;
upDataItem.OrderID = 6;
upDataItem.IsEnabled = 1;
upDataItem.IsAllowEdit = 1;
SqlSugarHelper.Db.Insertable(upDataItem).AS(tableName).ExecuteCommand();
}
var beSignalGroup = SqlSugarHelper.Db.Queryable<ec_dataitemEntity>().AS(tableName).First(x => x.DataItemCode == "Be_Signal_Group");
var beSignalGroup = SqlSugarHelper.Db.Queryable<ec_dataitemEntity>().AS(tableName).First(x => x.DataItemCode == GlobalObject.enumlist_signalGroup);
if (beSignalGroup == null)
{
beSignalGroup = new ec_dataitemEntity();
beSignalGroup.Create();
beSignalGroup.UpDataItemID = upDataItem.DataItemID;
beSignalGroup.DataItemName = "信号分组";
beSignalGroup.DataItemCode = "Be_Signal_Group";
beSignalGroup.DataItemCode = GlobalObject.enumlist_signalGroup;
beSignalGroup.OrderID = 1;
beSignalGroup.IsEnabled = 1;
beSignalGroup.IsAllowEdit = 1;
@ -4538,8 +4540,8 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
upDataItem = new ec_dataitemEntity();
upDataItem.Create();
upDataItem.UpDataItemID = "0";
upDataItem.DataItemName = "自动化平台";
upDataItem.DataItemCode = "自动化平台";
upDataItem.DataItemName = GlobalObject.dataitemName_SignalManage;
upDataItem.DataItemCode = GlobalObject.dataitemName_SignalManage;
upDataItem.OrderID = 6;
upDataItem.IsEnabled = 1;
upDataItem.IsAllowEdit = 1;
@ -4871,6 +4873,32 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
SqlSugarHelper.Db.Storageable(othersDetails).As(detailTableName).ExecuteCommand();
SqlSugarHelper.Db.Storageable(makerDetails).As(detailTableName).ExecuteCommand();
}
public byte[] ExportChanges(string projectId, bool delete, DateTime FromDate, DateTime ToDate)
{
byte[] bytes = null;
try
{
ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
using (var package = new ExcelPackage())
{
var sheet = package.Workbook.Worksheets.Add("ExportChanges");
sheet.Cells[1, 1].Value = "信号组名称";
bytes = package.GetAsByteArray();
}
}
catch (Exception ex)
{
log4net.LogManager.GetLogger("ERROR").Error("ec_Wire_GroupBLLExportExcel1462 1462信号点表导出" + ex.Message + ex.StackTrace);
bytes = System.Text.Encoding.UTF8.GetBytes(ex.Message + ex.StackTrace);
}
return bytes;
}
public byte[] ExportSignals(string projectId, bool delete, int version, string folderId, string FromDate = "", string ToDate = "")
{
var file = new AnnexesFileBLL().GetByfolderIdEntity(folderId);
@ -4893,8 +4921,8 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
var wiregroupid = signals.Select(x => x.Wire_Group_ID).Distinct().ToList();
//读取在某个时间段修改过属性的信号数据
var updateSignals = Db.Queryable<ec_wire_group_propertyhisEntity>().AS(wiregrouppropertyhisTableName)
.LeftJoin<ec_Wire_GroupEntity>((ewgpe,ewge)=>ewgpe.WireGroupID==ewge.Wire_Group_ID).AS<ec_Wire_GroupEntity>(tableName)
.WhereIF(string.IsNullOrEmpty(FromDate) && string.IsNullOrEmpty(ToDate), (ewgpe, ewge) => wiregroupid.Contains(ewgpe.WireGroupID) && SqlFunc.IsNull(ewgpe.OldPropertyValue,"")!=SqlFunc.IsNull(ewgpe.NewPropertyValue,""))//ALL
.LeftJoin<ec_Wire_GroupEntity>((ewgpe, ewge) => ewgpe.WireGroupID == ewge.Wire_Group_ID).AS<ec_Wire_GroupEntity>(tableName)
.WhereIF(string.IsNullOrEmpty(FromDate) && string.IsNullOrEmpty(ToDate), (ewgpe, ewge) => wiregroupid.Contains(ewgpe.WireGroupID) && SqlFunc.IsNull(ewgpe.OldPropertyValue, "") != SqlFunc.IsNull(ewgpe.NewPropertyValue, ""))//ALL
.WhereIF(!string.IsNullOrEmpty(FromDate) && string.IsNullOrEmpty(ToDate), (ewgpe, ewge) => wiregroupid.Contains(ewgpe.WireGroupID) && SqlFunc.IsNull(ewgpe.OldPropertyValue, "") != SqlFunc.IsNull(ewgpe.NewPropertyValue, "") && ewgpe.CreateTime > SqlFunc.ToDate(FromDate))//某个时间到现在
.WhereIF(string.IsNullOrEmpty(FromDate) && !string.IsNullOrEmpty(ToDate), (ewgpe, ewge) => wiregroupid.Contains(ewgpe.WireGroupID) && SqlFunc.IsNull(ewgpe.OldPropertyValue, "") != SqlFunc.IsNull(ewgpe.NewPropertyValue, "") && ewgpe.CreateTime < SqlFunc.ToDate(ToDate))//某个时间之前
.WhereIF(!string.IsNullOrEmpty(FromDate) && !string.IsNullOrEmpty(ToDate), (ewgpe, ewge) => wiregroupid.Contains(ewgpe.WireGroupID) && SqlFunc.IsNull(ewgpe.OldPropertyValue, "") != SqlFunc.IsNull(ewgpe.NewPropertyValue, "") && SqlFunc.Between(ewgpe.CreateTime, FromDate, ToDate))//一段时间内
@ -4906,7 +4934,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
.Select((ewgpe, ewge) => new ec_wire_group_propertyhisEntity()
{
WireGroupName = ewge.Group_Name,
PropertyName= ewgpe.PropertyName
PropertyName = ewgpe.PropertyName
})
.ToList();
//某个时间段删除的信号数据
@ -4926,7 +4954,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
var details = SqlSugarHelper.Db.Queryable<ec_dataitemdetailEntity>().AS(detailTableName)
.InnerJoin<ec_dataitemEntity>((a, b) => a.DataItemID == b.DataItemID).AS<ec_dataitemEntity>(itemTableName)
.Where((a, b) => groups.Contains(a.DataItemCode) && b.DataItemCode == "Be_Signal_Group" && !string.IsNullOrEmpty(a.DataItemCode)) //因为需要靠code的名字来生成worksheet所以不能为空
.Where((a, b) => groups.Contains(a.DataItemCode) && b.DataItemCode == GlobalObject.enumlist_signalGroup && !string.IsNullOrEmpty(a.DataItemCode)) //因为需要靠code的名字来生成worksheet所以不能为空
.OrderBy(a => a.DataItemCode)
.Select((a, b) => a).ToList();
@ -4973,7 +5001,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
case 3:
return ExportExcel8600SignalRow(file.F_FilePath, details, items);
case 4:
return ExoprtUpdatedExcel(projectId, file.F_FilePath, details, items, updateSignals, DelSignals,NewSignals, res);
return ExoprtUpdatedExcel(projectId, file.F_FilePath, details, items, updateSignals, DelSignals, NewSignals, res);
}
return null;
}
@ -5020,7 +5048,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
sheet.Cells[$"C{rowNumber}:Y{rowNumber}"].Style.Fill.PatternType = ExcelFillStyle.Solid;
sheet.Cells[$"C{rowNumber}:Y{rowNumber}"].Style.Fill.BackgroundColor.SetColor(System.Drawing.Color.Orange);
}
if (y.Status == WireGroupStatusEnum.New || y.Status==WireGroupStatusEnum.Used)
if (y.Status == WireGroupStatusEnum.New || y.Status == WireGroupStatusEnum.Used)
{
sheet.Cells[$"C{rowNumber}:Y{rowNumber}"].Style.Fill.PatternType = ExcelFillStyle.Solid;
sheet.Cells[$"C{rowNumber}:Y{rowNumber}"].Style.Fill.BackgroundColor.SetColor(System.Drawing.Color.LightBlue);
@ -5227,7 +5255,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
/// <param name="ProjId"></param>
/// <param name="lstWgphe"></param>
/// <returns></returns>
public byte[] ExoprtUpdatedExcel(string ProjId, string filePath, List<ec_dataitemdetailEntity> groups, List<ec_dataitemdetailEntity> codelists,List<ec_wire_group_propertyhisEntity> lstWgphe, List<ec_Wire_GroupEntity> lstWgeDel,List<ec_Wire_GroupEntity> lstWgeNew, bool AllowManualCableAssign = false)
public byte[] ExoprtUpdatedExcel(string ProjId, string filePath, List<ec_dataitemdetailEntity> groups, List<ec_dataitemdetailEntity> codelists, List<ec_wire_group_propertyhisEntity> lstWgphe, List<ec_Wire_GroupEntity> lstWgeDel, List<ec_Wire_GroupEntity> lstWgeNew, bool AllowManualCableAssign = false)
{
byte[] bytes = null;
try
@ -5409,7 +5437,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
{
sheet.Cells[$"Z{rowNumber}"].Value = "SHD";
}
if (lstWgphe.Exists(g => g.WireGroupName == y.Group_Name && (g.PropertyName == "SLD" || g.PropertyName=="SHD")))
if (lstWgphe.Exists(g => g.WireGroupName == y.Group_Name && (g.PropertyName == "SLD" || g.PropertyName == "SHD")))
{
// 设置背景颜色为黄色
sheet.Cells[$"Z{rowNumber}"].Style.Fill.PatternType = ExcelFillStyle.Solid;
@ -5656,7 +5684,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
});
});
var DelSheet = package.Workbook.Worksheets["删除点"];
int delNumber = 5;
if (DelSheet != null)

View File

@ -246,7 +246,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
///// </summary>
//public bool BCC { get; set; } = false;
/// <summary>
/// IO类型AI AO DI DO
/// input / output
/// </summary>
public string InOrOut { get; set; } = "";
/// <summary>

View File

@ -0,0 +1,44 @@
using Learun.Util;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel;
namespace Learun.Application.TwoDevelopment.ZZDT_EC
{
/// <summary>
/// 信号组别
/// </summary>
public class signalGroup
{
public signalGroup()
{
}
public string Name { get; set; }
public string NameEN { get; set; }
public string Code { get; set; }
public string Id { get; set; }
public signalGroupStatusEnum status { get; set; }
public List<ec_Wire_GroupEntity> Sub = new List<ec_Wire_GroupEntity>();
}
public enum signalGroupStatusEnum
{
/// <summary>
/// 待删除
/// </summary>
= 01,
/// <summary>
/// 新增的
/// </summary>
= 02,
/// <summary>
/// 已关联
/// </summary>
= 03
}
}

View File

@ -160,14 +160,14 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
var dataitemTableName = ProjectSugar.TableName<ec_dataitemEntity>(ProjectId);
var dataitemDetailTableName = ProjectSugar.TableName<ec_dataitemdetailEntity>(ProjectId);
var item = SqlSugarHelper.Db.Queryable<ec_dataitemEntity>().AS(dataitemTableName).First(x => x.DataItemCode == "Be_Signal_Group");
var item = SqlSugarHelper.Db.Queryable<ec_dataitemEntity>().AS(dataitemTableName).First(x => x.DataItemCode == GlobalObject.enumlist_signalGroup);
if (item == null)
{
item = new ec_dataitemEntity();
item.Create();
item.UpDataItemID = "0";
item.DataItemName = "信号分组";
item.DataItemCode = "Be_Signal_Group";
item.DataItemCode = GlobalObject.enumlist_signalGroup;
item.OrderID = 5;
item.IsEnabled = 1;
SqlSugarHelper.Db.Insertable(item).AS(dataitemTableName).ExecuteCommand();

View File

@ -26,6 +26,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
public string TagNumber_Upper { get; set; }
public string TagNumber_Lower { get; set; }
public string System { get; set; }
public double Scale { get; set; } = 1;
public string Tag { get; set; }
/// <summary>
/// 是否默认图标。默认图标就是<see cref="ec_objecttypeEntity.DefaultLayoutLibFileID"/>。(此时拆)

View File

@ -31,7 +31,9 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
static class IOModuleExportCol
{
public const int PanelId = 97;
public const int StripId = 98;
public const int ChId = 99;
/// <summary>
/// 系统柜
/// </summary>
@ -72,25 +74,29 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
public const int To_NameCN = 11;
/// <summary>
/// 信号名称
/// </summary>
public const int alarm_Name = 12;
/// <summary>
/// 报警点-英文
/// </summary>
public const int alarm_Serv = 12;
public const int alarm_Serv = 13;
/// <summary>
/// 报警点-中文
/// </summary>
public const int alarm_ServEN = 13;
public const int alarm_ServEN = 14;
/// <summary>
/// 信号类型
/// </summary>
public const int signalType = 14;
public const int signalType = 15;
/// <summary>
/// 传感器编号
/// </summary>
public const int Sensor = 15;
public const int Sensor = 16;
/// <summary>
/// 备注
/// </summary>
public const int Remark = 16;
public const int Remark = 17;
}
/// <summary>
@ -182,6 +188,9 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
foreach (var channel in panelStripCHs)//遍历端子排下的通道
{
sheet.Cells[curRow, IOModuleExportCol.PanelId].Value = panel.PanelID;
sheet.Cells[curRow, IOModuleExportCol.StripId].Value = panelStrip.StripID;
sheet.Cells[curRow, IOModuleExportCol.ChId].Value = channel.ChannelID;
sheet.Cells[curRow, IOModuleExportCol.PanelName].Value = tag.TagNumber;
sheet.Cells[curRow, IOModuleExportCol.IOType].Value = panelStrip.IO_TYPE;
sheet.Cells[curRow, IOModuleExportCol.StripName].Value = panelStrip.StripName + " | " + panelStrip.Panel_Strip_Seq;
@ -312,6 +321,8 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
var relId = Db.Queryable<ec_reltypeEntity>().AS(relTypeTb).ToList().First(x => x.RelType == ((int)enum_RelType._电缆).ToString());
var newWTCommits = new List<ec_WireTerminalEntity>();
var SignalCommits = new List<ec_Wire_GroupEntity>();
try
{
ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
@ -325,11 +336,14 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
for (int i = 2; i < sheet.Dimension.End.Row + 1; i++)
{
#region ch
var pId = sheet.Cells[i, IOModuleExportCol.PanelId].Value.ToString();
var sId = sheet.Cells[i, IOModuleExportCol.StripId].Value.ToString();
var chId = sheet.Cells[i, IOModuleExportCol.ChId].Value.ToString();
var panelName = sheet.Cells[i, IOModuleExportCol.PanelName].Value.ToString();
var strip_IOType = sheet.Cells[1, IOModuleExportCol.IOType].Value.ToString();
var stripName = sheet.Cells[1, IOModuleExportCol.StripName].Value.ToString();
var strip_IOType = sheet.Cells[i, IOModuleExportCol.IOType].Value.ToString();
var stripName = sheet.Cells[i, IOModuleExportCol.StripName].Value.ToString();
stripName = stripName.Substring(0, stripName.IndexOf('|')).Trim();
var chName = sheet.Cells[1, IOModuleExportCol.CH].Value.ToString();
var chName = sheet.Cells[i, IOModuleExportCol.CH].Value.ToString();
var tag = allEngineData.FirstOrDefault(x => x.TagNumber == panelName);
if (tag == null)
@ -341,34 +355,140 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
{
continue;
}
var strip = allStrips.FirstOrDefault(x => x.PanelID == panel.PanelID
&& x.StripName == stripName);
var strip = allStrips.FirstOrDefault(x => x.StripID == sId);
if (strip == null)
{
continue;
}
var ch = allCHs.FirstOrDefault(x => x.StripID == strip.StripID && x.ChannelName == chName);
var ch = allCHs.FirstOrDefault(x => x.StripID == strip.StripID && x.ChannelID == chId);
if (ch == null)
{
continue;
}
var terms = allterms.Where(x => x.ChannelID == chId).OrderBy(x => x.Term_Seq).ToList();
var existWTs = allWTs.Where(y => terms.Select(x => x.TermID).Contains(y.TermID)).ToList();
#endregion
#region update-signal
var signalWithCurrentCh = allSignals.FirstOrDefault(x => x.ChannelID == ch.ChannelID);
var cellSignalName = sheet.Cells[i, IOModuleExportCol.alarm_Name].Value?.ToString();
if (string.IsNullOrWhiteSpace(cellSignalName))
{
//没有信号关联
if (signalWithCurrentCh != null)
{
//取消关联
signalWithCurrentCh.ChannelID = "";
SqlSugarHelper.Db.Updateable(signalWithCurrentCh).AS(signalTb).ExecuteCommand();
}
}
else
{
var existWireGroup = allSignals.FirstOrDefault(x => x.Group_Name == cellSignalName);
if (existWireGroup == null)
{
sheet.Cells[i, IOModuleExportCol.alarm_Name].AddComment("不存在的IO信号。");
//新建?
continue;
}
else
{
if (signalWithCurrentCh != null)
{
//取消关联 避免一个ch同时关联多个信号
signalWithCurrentCh.ChannelID = "";
SqlSugarHelper.Db.Updateable(signalWithCurrentCh).AS(signalTb).ExecuteCommand();
}
//关联
existWireGroup.ChannelID = ch.ChannelID;
SignalCommits.Add(existWireGroup);
}
}
#endregion
#region update-Cable
var cableNo = sheet.Cells[i, IOModuleExportCol.CableNo].Value?.ToString();
var cable_Tag = allEngineData.FirstOrDefault(x => x.TagNumber.ToUpper() == cableNo.ToUpper());
var cable = allCables.FirstOrDefault(x => x.EngineerDataID == cable_Tag?.EngineDataID);
if (cable_Tag == null || cable == null) {
sheet.Cells[i, IOModuleExportCol.CableNo].AddComment("不存在的电缆。");
continue;
}
var set = sheet.Cells[i, IOModuleExportCol.CableSet].Value?.ToString();
var setObj = allSets.FirstOrDefault(x => x.CableSetName.ToUpper() == set.ToUpper()
&& x.CableID == cable.CableID);
if (setObj == null)
if (string.IsNullOrWhiteSpace(cableNo))
{
sheet.Cells[i, IOModuleExportCol.CableSet].AddComment("不存在的电缆对。");
//没有电缆
//取消关联
Db.Deleteable<ec_WireTerminalEntity>().AS(wtTb).
Where(x => existWTs.Select(y => y.ID).Contains(x.ID)).ExecuteCommand();
continue;
}
else
{
//有电缆 需要关联
var cable_Tag = allEngineData.FirstOrDefault(x => x.TagNumber.ToUpper() == cableNo?.ToUpper());
var cable = allCables.FirstOrDefault(x => x.EngineerDataID == cable_Tag?.EngineDataID);
if (cable_Tag == null)
{
sheet.Cells[i, IOModuleExportCol.CableNo].AddComment("不存在的电缆。");
//新建?
continue;
}
if (cable == null)
{
sheet.Cells[i, IOModuleExportCol.CableNo].AddComment("不存在的电缆配置。");
//新建?
continue;
}
var set = sheet.Cells[i, IOModuleExportCol.CableSet].Value?.ToString();
if (string.IsNullOrWhiteSpace(set))
{
//没有电缆对
//取消关联
Db.Deleteable<ec_WireTerminalEntity>().AS(wtTb).
Where(x => existWTs.Select(y => y.ID).Contains(x.ID)).ExecuteCommand();
continue;
}
var setObj = allSets.FirstOrDefault(x => x.CableSetName.ToUpper() == set.ToUpper() && x.CableID == cable.CableID);
if (setObj == null)
{
sheet.Cells[i, IOModuleExportCol.CableSet].AddComment("不存在的电缆对。");
continue;
}
//电缆 和 电缆对 都有效
var wiresObj = allWires.Where(x => x.CableSetID == setObj.CableSetID).OrderBy(x => x.SetLevel).ToList();
if (existWTs == null || existWTs.Count == 0)
{
//原来没有 现在有接
}
else
{
//原来有接 现在要换
//删除原来的接线
Db.Deleteable<ec_WireTerminalEntity>().AS(wtTb).
Where(x => existWTs.Select(y => y.ID).Contains(x.ID)).ExecuteCommand();
//避免电缆原来接到过其他term
var existWTsOnW = allWTs.Where(y => wiresObj.Select(x => x.WireID).Contains(y.WireID)).ToList();
Db.Deleteable<ec_WireTerminalEntity>().AS(wtTb).
Where(x => existWTsOnW.Select(y => y.ID).Contains(x.ID)).ExecuteCommand();
}
#region insertWT
var wtCount = Math.Min(wiresObj.Count, terms.Count);
for (int wtSeq = 0; wtSeq < wtCount; wtSeq++)
{
var newWT = new ec_WireTerminalEntity()
{
WireID = wiresObj[wtSeq].WireID,
TermID = terms[wtSeq].TermID,
};
newWT.Create();//网页导入 监测表
newWTCommits.Add(newWT);
}
#endregion
}
#endregion
//sheet.Cells[1, IOModuleExportCol.CableNo].Value = "电缆号";
//sheet.Cells[1, IOModuleExportCol.CableSpec].Value = "电缆线型";
@ -386,6 +506,16 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
}
}
;
if (newWTCommits.Count > 0)
{
Db.Insertable(newWTCommits).AS(wtTb).ExecuteCommand();
}
if (SignalCommits.Count > 0)
{
Db.Updateable(SignalCommits).AS(signalTb).ExecuteCommand();
}
}
catch (Exception ex)
{
@ -468,7 +598,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
/// </summary>
/// <param name="ProjectId">PROJ</param>
/// <param name="PanelChannelId">CH ID</param>
public void DeleteEntity(string ProjectId,string PanelChannelId)
public void DeleteEntity(string ProjectId, string PanelChannelId)
{
try
{

View File

@ -72,6 +72,22 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
/// <returns></returns>
public string FlagState { get; set; } = "";
/// <summary>
/// 计划送审时间io
/// </summary>
public string IO_predicted_issue { get; set; }
/// <summary>
/// 计划施工时间io
/// </summary>
public string IO_predicted_construct { get; set; }
/// <summary>
/// 实际送审时间io
/// </summary>
public string IO_real_issue { get; set; }
/// <summary>
/// 实际施工时间io
/// </summary>
public string IO_real_construct { get; set; }
/// <summary>
/// IMO编号
/// </summary>
/// <returns></returns>