1
This commit is contained in:
commit
b37d04a1e6
3
.gitignore
vendored
3
.gitignore
vendored
@ -1110,3 +1110,6 @@ newFront/c#前端/.vs/
|
||||
/newFront/c#前端/.vs/SWS.CAD/FileContentIndex/f03e1583-e8e0-43b7-9dbb-a1896ce4b92d.vsidx
|
||||
/newFront/c#前端/.vs/SWS.CAD/FileContentIndex/f2e37380-e651-406b-9320-af642620eee9.vsidx
|
||||
/SWSDBSchemeUpgradeTool/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
|
||||
/Learun.Framework.Module/Learun.Db/Learun.DataBase.EF.Oracle/obj/Debug/Learun.DataBase.Oracle.csproj.AssemblyReference.cache
|
||||
/Learun.Framework.Module/Learun.Db/Learun.DataBase.EF.Sqlserver/obj/Debug/Learun.DataBase.SqlServer.csproj.AssemblyReference.cache
|
||||
/Learun.Framework.Module/Learun.Db/Learun.DataBase.MySql/obj/Debug/Learun.DataBase.MySqlEx.csproj.AssemblyReference.cache
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -48,36 +48,117 @@ namespace Learun.Application.Web.AppApi
|
||||
|
||||
/// <summary>
|
||||
/// 找到某一个预分配箱子 附近的某一个箱子
|
||||
/// <param name="curPanelId"/>
|
||||
/// <param name="frameLists"/>
|
||||
/// <param name="allPanel"/>
|
||||
/// <param name="allPanelProps">所有柜子的属性</param>
|
||||
/// <param name="IOTypeOnCable">Digital,4-20mA,10v,pt100,pulse</param>
|
||||
/// <param name="PreAssignPanelID"/>
|
||||
/// </summary>
|
||||
|
||||
private ec_PanelEntity FindPanelNearby(List<FrameBll.FrameList> frameLists, List<ec_PanelEntity> allPanel, List<ec_enginedata_propertyEntity> allPanelProps
|
||||
, string IOTypeOnCable)
|
||||
private ec_PanelEntity FindPanelNearby(string curPanelId, List<FrameBll.FrameList> frameLists, List<ec_PanelEntity> allPanel,
|
||||
Dictionary<string, List<ec_enginedata_propertyEntity>> allPanelProps, string IOTypeOnCable)
|
||||
{
|
||||
double GetPanelXYDistance2Target(string panelId, double targetX, double targetY)
|
||||
{
|
||||
var nearPanel = allPanel.FirstOrDefault(x => x.PanelID == panelId);
|
||||
var nearPanelProps = allPanelProps[nearPanel.EngineerDataID];
|
||||
var X = nearPanelProps.FirstOrDefault(x => x.PropertyName == GlobalObject.propName_Frame)?.PropertyValue;
|
||||
X = X.Split(new string[] { GlobalObject.enum_separator }, StringSplitOptions.None)[0];//插件端对于下拉列表 都是 name || nameEN
|
||||
var validFrme2 = frameLists.FirstOrDefault(f => f.Num == X);
|
||||
if (validFrme2 == null)
|
||||
{
|
||||
return -1;//无效的肋位号导致的
|
||||
}
|
||||
|
||||
|
||||
var XValue = validFrme2.Value;
|
||||
|
||||
if (XValue < 400)//null也没事
|
||||
{
|
||||
// 小于400,我几乎可以认为此时肋位号用的是m这个单位。因为如果用的是mm,400mm的肋位号似乎也太小了。
|
||||
XValue = 1000 * XValue; // 转成mm
|
||||
}
|
||||
if (double.TryParse(nearPanelProps.FirstOrDefault(x => x.PropertyName == GlobalObject.propName_FrameOff)?.PropertyValue,
|
||||
out double XOffValue))
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;//无效的x off导致的
|
||||
}
|
||||
if (double.TryParse(nearPanelProps.FirstOrDefault(x => x.PropertyName == GlobalObject.propName_YOff)?.PropertyValue,
|
||||
, out double YOffValue))
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;//无效的y off导致的
|
||||
}
|
||||
|
||||
var distance = Math.Sqrt(Math.Pow(targetX - XValue - XOffValue, 2) + Math.Pow(targetY - YOffValue, 2));
|
||||
return distance;
|
||||
}
|
||||
var curPanel = allPanel.FirstOrDefault(x => x.PanelID == curPanelId);
|
||||
var curPanelProps = allPanelProps[curPanel.EngineerDataID];
|
||||
//当前预分配的箱子的位置
|
||||
var AssignPanelX = allPanelProps.FirstOrDefault(x => x.PropertyName == GlobalObject.propName_Frame)?.PropertyValue;
|
||||
var AssignPanelX = curPanelProps.FirstOrDefault(x => x.PropertyName == GlobalObject.propName_Frame)?.PropertyValue;
|
||||
AssignPanelX = AssignPanelX.Split(new string[] { GlobalObject.enum_separator }, StringSplitOptions.None)[0];//插件端对于下拉列表 都是 name || nameEN
|
||||
var AssignPanelXValue = frameLists.FirstOrDefault(X => X.Num == AssignPanelX)?.Value;
|
||||
var validFrme = frameLists.FirstOrDefault(X => X.Num == AssignPanelX);
|
||||
if (validFrme == null)
|
||||
{
|
||||
return null;//无效的肋位号导致的
|
||||
}
|
||||
|
||||
|
||||
var AssignPanelXValue = validFrme.Value;
|
||||
|
||||
if (AssignPanelXValue < 400)//null也没事
|
||||
{
|
||||
// 小于400,我几乎可以认为此时肋位号用的是m这个单位。因为如果用的是mm,400mm的肋位号似乎也太小了。
|
||||
AssignPanelXValue = 1000 * AssignPanelXValue; // 转成mm
|
||||
}
|
||||
var AssignPanelXOff = allPanelProps.FirstOrDefault(x => x.PropertyName == GlobalObject.propName_FrameOff)?.PropertyValue;
|
||||
|
||||
var AssignPanelY = allPanelProps.FirstOrDefault(x => x.PropertyName == GlobalObject.propName_YOff)?.PropertyValue;
|
||||
|
||||
foreach (var panel in allPanel)
|
||||
if (double.TryParse(curPanelProps.FirstOrDefault(x => x.PropertyName == GlobalObject.propName_FrameOff)?.PropertyValue,
|
||||
out double AssignPanelXOffValue))
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;//无效的x off导致的
|
||||
}
|
||||
if (double.TryParse(curPanelProps.FirstOrDefault(x => x.PropertyName == GlobalObject.propName_YOff)?.PropertyValue,
|
||||
, out double AssignPanelYValue))
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;//无效的y off导致的
|
||||
}
|
||||
double minDistance = 0.1; ec_PanelEntity nearestPanel = null;
|
||||
foreach (var panel in allPanel.Where(x => x.PanelID != curPanelId))
|
||||
{
|
||||
#region io
|
||||
|
||||
#endregion
|
||||
#region distance
|
||||
//拿到每一个的xy属性
|
||||
//然后和预分配箱子进行对比
|
||||
//这也太耗时了把
|
||||
}
|
||||
//然后排序一次
|
||||
var DISTANCE = GetPanelXYDistance2Target(panel.PanelID, AssignPanelXValue + AssignPanelXOffValue, AssignPanelYValue);
|
||||
|
||||
if (0.1 == minDistance && DISTANCE > 0)
|
||||
{
|
||||
minDistance = DISTANCE; nearestPanel = panel;
|
||||
}
|
||||
else if (DISTANCE < minDistance && DISTANCE > 0)
|
||||
{
|
||||
minDistance = DISTANCE; nearestPanel = panel;
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
//根据电缆上的信号,去找匹配的排序第一位(已经按照距离排序过)的箱子
|
||||
switch (IOTypeOnCable.ToUpper())
|
||||
{
|
||||
@ -87,7 +168,7 @@ namespace Learun.Application.Web.AppApi
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return null;
|
||||
return nearestPanel;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -282,6 +363,8 @@ namespace Learun.Application.Web.AppApi
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ICache redisObj = CacheFactory.CaChe();
|
||||
/// <summary>
|
||||
/// 自动分配通道(点表信号自动分配)。
|
||||
///
|
||||
@ -334,15 +417,21 @@ namespace Learun.Application.Web.AppApi
|
||||
if (AcceptNearbyPanel)//允许进行
|
||||
{
|
||||
//有不匹配的,但是用户允许继续
|
||||
//在之后的自动分配过程中会自动寻找匹配的采集箱,原则上从就近的开始找,如果没有匹配的采集箱,则提示“未找到具有XX类型的采集箱,请新增后再次分配,是否取消自动分配进程?”
|
||||
//如果选是,则在之后的自动分配过程中会自动寻找匹配的采集箱,原则上从就近的开始找,如果没有匹配的采集箱,则提示“未找到具有XX类型的采集箱,请新增后再次分配,是否取消自动分配进程?”
|
||||
bool nearbyFound = false;
|
||||
foreach (var cable in cablesNotMatchIO)
|
||||
{
|
||||
var nearPanel = FindPanelNearby(allFrames, allPanel, allPanelProp[cable.ToPanel.EngineerDataID], cable.PreAssignIOType);
|
||||
var nearPanel = FindPanelNearby(cable.PanelID, allFrames, allPanel, allPanelProp, cable.PreAssignIOType);
|
||||
if (nearPanel == null)
|
||||
{
|
||||
nearbyFound = false;
|
||||
//必要的数据存入redis,以便后续步骤使用
|
||||
redisObj.Remove("IOModule_AutoAssign2Ch_" + projId, CacheId.IOModule_AutoAssign2Ch);
|
||||
redisObj.Write<List<ec_CableEntity>>("IOModule_AutoAssign2Ch_" + projId, cablesNeedAssigned, CacheId.IOModule_AutoAssign2Ch);
|
||||
return Fail($"在附近未找到具有{cable.PreAssignIOType}类型的采集箱,请新增后再次分配,是否取消自动分配进程?");
|
||||
//之后插件端进行选择。
|
||||
//如果不想新增,则选择否,继续自动分配,没有分配到的信号在备注上填写由于何种原因没有被分配,弹出未被分配的信号列表供查看。
|
||||
//也就是这里要等所有循环结束后才能return结果,而不是目前一个nearByFound = false时就退出了。
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -355,7 +444,7 @@ namespace Learun.Application.Web.AppApi
|
||||
}
|
||||
else
|
||||
{
|
||||
//不继续自动分配,中断进程,等添加完正确的模块后再继续自动分配
|
||||
//如果选否,则不继续自动分配,中断进程,等添加完正确的模块后再继续自动分配
|
||||
var cableNamesNotMatched = string.Join(",", cablesNotMatchIO.Select(x => x.TagNumber).ToList());
|
||||
var panelIOMissing = new List<string>();
|
||||
foreach (ec_CableEntity cableNotMatchIO in cablesNotMatchIO)
|
||||
@ -373,7 +462,6 @@ namespace Learun.Application.Web.AppApi
|
||||
|
||||
}
|
||||
//必要的数据存入redis,以便后续步骤使用
|
||||
ICache redisObj = CacheFactory.CaChe();
|
||||
redisObj.Remove("IOModule_AutoAssign2Ch_" + projId, CacheId.IOModule_AutoAssign2Ch);
|
||||
redisObj.Write<List<ec_CableEntity>>("IOModule_AutoAssign2Ch_" + projId, cablesNeedAssigned, CacheId.IOModule_AutoAssign2Ch);
|
||||
|
||||
@ -385,18 +473,36 @@ namespace Learun.Application.Web.AppApi
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// 根据step1的初步采集箱判断情况,来进行分配预览。
|
||||
/// </summary>
|
||||
/// <param name="projId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public IHttpActionResult AutoAssignCable2Channel_step2(string projId)
|
||||
{
|
||||
ICache redisObj = CacheFactory.CaChe();
|
||||
var cablesNeedAssigned = redisObj.Read<List<ec_CableEntity>>("IOModule_AutoAssign2Ch_" + projId, CacheId.IOModule_AutoAssign2Ch);
|
||||
|
||||
//#region 1.2
|
||||
//#region 1.2 开始自动分配(不保存到数据库)
|
||||
#region 先分组 1.2.2
|
||||
cablesNeedAssigned = cablesNeedAssigned.OrderBy(x => new { x.PanelID, x.PreAssignIOType, x.System }).ToList();
|
||||
var cablesGrouped = cablesNeedAssigned.OrderBy(x => x.PanelID).ThenBy(x => x.PreAssignIOType).ThenBy(x => x.System).ToList();
|
||||
|
||||
foreach (var item in cablesNeedAssigned)
|
||||
{
|
||||
if (item.Sets == null || item.Sets.Count() == 0)
|
||||
{
|
||||
//也归类到未成功
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var set in item.Sets)
|
||||
{
|
||||
set.ConnectionInfo = $"采集箱:{item.ToPanel.TagNumber}/模块(端子排):{"test_ts"}/通道:{"test_ch"}";
|
||||
set.AssignedTerms = set.Wires.Select(x => x.PreAssignChannelTermNo).ToList();// new List<string>() { "test_term1", "test_term2" };//假数据
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//var curPanel = new ec_PanelEntity();
|
||||
//curPanel = panelsNeed.FirstOrDefault(x => x.PanelID == cablesNeedAssigned[0].PanelID);//先定位到第一个电缆所在的箱子
|
||||
//curPanel.strips = stripsNeed.Where(x => x.PanelID == curPanel.PanelID).ToList();
|
||||
@ -430,7 +536,22 @@ namespace Learun.Application.Web.AppApi
|
||||
|
||||
//}
|
||||
//#endregion
|
||||
return Success("自动关联完成");
|
||||
return Success(cablesNeedAssigned);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据step2的预分配结果,进行实际的分配,修改数据库。
|
||||
/// </summary>
|
||||
/// <param name="projId"></param>
|
||||
/// <param name="cables">传入有效的cable即可,未成功分配的cable不需要</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public IHttpActionResult AutoAssignCable2Channel_step3(string projId, [FromBody] List<ec_CableEntity> cables)
|
||||
{
|
||||
//大原则:同一根电缆的信号不能跨采集箱,跨模块可以。
|
||||
return Success(cables);
|
||||
|
||||
|
||||
}
|
||||
|
@ -631,13 +631,10 @@ namespace Learun.Application.Web.AppApi
|
||||
//每个位号的属性信息
|
||||
foreach (var tag in objectType.tags)
|
||||
{
|
||||
if (string.IsNullOrEmpty(tag.CreateUserID))
|
||||
if (userDict.TryGetValue(tag.CreateUserID, out string createUserName))
|
||||
{
|
||||
tag.CreateUserName = string.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
tag.CreateUserName = userDict[tag.CreateUserID];// allUser.FirstOrDefault(x => x.F_UserId == item.CreateUserID)?.F_RealName;
|
||||
tag.CreateUserName = createUserName;// allUser.FirstOrDefault(x => x.F_UserId == item.CreateUserID)?.F_RealName;
|
||||
|
||||
}
|
||||
|
||||
tag.EngineDataProperty = tagPropDictByTag[tag.EngineDataID];// tagPropAll.Where(x => x.EngineDataID == tag.EngineDataID).ToList();
|
||||
|
@ -81,7 +81,29 @@ namespace Learun.Application.Web.AppApi
|
||||
{
|
||||
var tagProps = propAll.FindAll(x => x.EngineDataID == pointTag.EngineDataID);
|
||||
var Prop_Frame = tagProps.FirstOrDefault(x => x.PropertyName == GlobalObject.propName_Frame)?.PropertyValue;
|
||||
if (Prop_Frame != null)
|
||||
{
|
||||
Prop_Frame = Prop_Frame.Split(new string[] { GlobalObject.enum_separator }, StringSplitOptions.None)[0];//插件端对于下拉列表 都是 name || nameEN
|
||||
|
||||
}
|
||||
|
||||
var matchedFrame = frameLists.FirstOrDefault(X => X.Num == Prop_Frame);
|
||||
if (matchedFrame == null)
|
||||
{
|
||||
//没有
|
||||
//无效的基点
|
||||
var layoutTagInvalid = new layoutTagInfoBrief()
|
||||
{
|
||||
|
||||
EngineDataID = pointTag.EngineDataID,
|
||||
FileId = "",
|
||||
PixelOnDwg = pointsOnDwg.FirstOrDefault(x => x.EngineDataID == pointTag.EngineDataID)?.PixelCode,
|
||||
TagNumber = pointTag.TagNumber,
|
||||
area = "ERR"
|
||||
};
|
||||
res.Add(layoutTagInvalid);
|
||||
continue;
|
||||
}
|
||||
var xValue = frameLists.FirstOrDefault(X => X.Num == Prop_Frame).Value;
|
||||
if (xValue < 400)
|
||||
{
|
||||
@ -126,26 +148,28 @@ namespace Learun.Application.Web.AppApi
|
||||
|
||||
//这里要考虑下拉列表 带 ||的问题
|
||||
List<string> matchedTagIds = new List<string>();
|
||||
if (keyProp == GlobalObject.propName_System)
|
||||
{
|
||||
//if (keyProp == GlobalObject.propName_System)
|
||||
//{
|
||||
//#task 9536
|
||||
// 筛选出所有以 "a||" 或 "b||" 开头的元素
|
||||
var validSystems = keyValue.Split().ToList();
|
||||
var validSystems = keyValue.Split(';').ToList();
|
||||
matchedTagIds = propAll.Where(item =>
|
||||
item.PropertyName == keyProp &&
|
||||
validSystems.Any(prefix => item.PropertyValue == prefix) || validSystems.Any(prefix => item.PropertyValue.StartsWith(prefix + GlobalObject.enum_separator))
|
||||
).Select(X => X.EngineDataID).Distinct().ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
matchedTagIds = propAll.Where(x => x.PropertyName == keyProp
|
||||
&& (x.PropertyValue == keyValue || x.PropertyValue.StartsWith(keyValue + GlobalObject.enum_separator))).
|
||||
Select(X => X.EngineDataID).Distinct().ToList();
|
||||
}
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// matchedTagIds = propAll.Where(x => x.PropertyName == keyProp
|
||||
// && (x.PropertyValue == keyValue || x.PropertyValue.StartsWith(keyValue + GlobalObject.enum_separator))).
|
||||
// Select(X => X.EngineDataID).Distinct().ToList();
|
||||
//}
|
||||
|
||||
|
||||
//有效范围的设备
|
||||
var matchedTags = SqlSugarHelper.Db.Queryable<ec_enginedataEntity>().AS(tagTbName).
|
||||
InnerJoin<ec_objecttypeEntity>((a, b) => a.ObjectTypeID == b.ObjectTypeID).AS<ec_objecttypeEntity>(typeTbName).
|
||||
|
||||
Where(a => matchedTagIds.Contains(a.EngineDataID)
|
||||
&& a.ObjectTypeID != pointType.ObjectTypeID)
|
||||
.Select((a, b) => new { a.EngineDataID, a.TagNumber, a.ObjectTypeID, b.DefaultLayoutLibFileID })
|
||||
@ -164,9 +188,26 @@ namespace Learun.Application.Web.AppApi
|
||||
|
||||
foreach (var matchPointTagId in matchPointTagIds)
|
||||
{
|
||||
var tagInfo = matchedTags.FirstOrDefault(X => X.EngineDataID == matchPointTagId);
|
||||
var tagProps = EquipPropAll.Where(x => x.EngineDataID == matchPointTagId).ToList();
|
||||
var Prop_Frame = tagProps.FirstOrDefault(x => x.PropertyName == GlobalObject.propName_Frame)?.PropertyValue;
|
||||
if (Prop_Frame != null)
|
||||
{
|
||||
Prop_Frame = Prop_Frame.Split(new string[] { GlobalObject.enum_separator }, StringSplitOptions.None)[0];//插件端对于下拉列表 都是 name || nameEN
|
||||
}
|
||||
var matchedFrame = frameLists.FirstOrDefault(X => X.Num == Prop_Frame);
|
||||
if (matchedFrame == null)
|
||||
{
|
||||
var layoutTagInfoInvalid = new layoutTagInfoBrief()
|
||||
{
|
||||
EngineDataID = matchPointTagId,
|
||||
PixelOnDwg = "",
|
||||
TagNumber = tagInfo.TagNumber,
|
||||
area = "ERR",
|
||||
};
|
||||
basePoint.Tags.Add(layoutTagInfoInvalid);
|
||||
continue;
|
||||
}
|
||||
var xValue = frameLists.FirstOrDefault(X => X.Num == Prop_Frame).Value;
|
||||
if (xValue < 400)
|
||||
{
|
||||
@ -176,7 +217,7 @@ namespace Learun.Application.Web.AppApi
|
||||
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 tagInfo = matchedTags.FirstOrDefault(X => X.EngineDataID == matchPointTagId);
|
||||
|
||||
var systemProp = tagProps.FirstOrDefault(x => x.PropertyName == GlobalObject.propName_System)?.PropertyValue;
|
||||
var tagProp = tagProps.FirstOrDefault(x => x.PropertyName == GlobalObject.propName_Tag)?.PropertyValue;
|
||||
#region 判断是否满足特定条件
|
||||
@ -243,13 +284,13 @@ namespace Learun.Application.Web.AppApi
|
||||
var lastDashPos = tagInfo.TagNumber.LastIndexOf('-');//最后一个'-'的位置
|
||||
if (lastDashPos > 0 && lastDashPos < tagInfo.TagNumber.Length - 1)
|
||||
{
|
||||
TagNumber_Upper = tagInfo.TagNumber.Substring(0, lastDashPos);
|
||||
TagNumber_Lower = tagInfo.TagNumber.Substring(lastDashPos + 1);
|
||||
TagNumber_Upper = tagInfo.TagNumber.Substring(lastDashPos + 1);//tag
|
||||
TagNumber_Lower = tagInfo.TagNumber.Substring(0, lastDashPos);//system
|
||||
}
|
||||
else
|
||||
{
|
||||
TagNumber_Upper = tagInfo.TagNumber;
|
||||
TagNumber_Lower = "";
|
||||
TagNumber_Upper = tagInfo.TagNumber;//tag
|
||||
TagNumber_Lower = ""; //system
|
||||
}
|
||||
#endregion
|
||||
var layoutTagInfo = new layoutTagInfoBrief()
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -254,8 +254,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
Where(x => panels.Select(xx => xx.EngineerDataID).Contains(x.EngineDataID)).ToList().ToDictionary(x => x.EngineDataID);
|
||||
var FromRels = new Dictionary<string, string>();//key是cable,value是from设备的id
|
||||
var allpropOnFrom = new List<ec_enginedata_propertyEntity>();
|
||||
if (needProp)
|
||||
{
|
||||
|
||||
var relTypeObj = SqlSugarHelper.Db.Queryable<ec_reltypeEntity>().AS(relTypeTable).ToList().
|
||||
FirstOrDefault(x => x.RelType == enum_RelType.设备_电缆);
|
||||
|
||||
@ -266,7 +265,8 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
|
||||
//设备上的属性
|
||||
//电缆在2,因为1.2.2里用于取的是from端的设备(设备在1,电缆在2)
|
||||
|
||||
if (needProp)
|
||||
{
|
||||
allpropOnFrom = SqlSugarHelper.Db.Queryable<ec_enginedata_propertyEntity>().AS(propTable).
|
||||
Where(x => FromRels.Values.Contains(x.EngineDataID)).ToList();
|
||||
|
||||
@ -284,23 +284,29 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
|
||||
|
||||
cable.TagNumber = tags[cable.EngineerDataID]?.TagNumber;
|
||||
var panelObj = panelDict[cable.PanelID];
|
||||
if (panelObj == null)
|
||||
ec_PanelEntity panelObj;
|
||||
if (panelDict.TryGetValue(cable.PanelID, out panelObj))
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;//分配就已经不合理了
|
||||
}
|
||||
else if (panelObj != null)
|
||||
{
|
||||
|
||||
panelObj.TagNumber = panelTags[panelObj.EngineerDataID]?.TagNumber;
|
||||
|
||||
//1.2.2 系统属性从电缆的from端上的设备中取设备的系统
|
||||
var panelId = FromRels[cable.EngineerDataID];
|
||||
if (needProp)
|
||||
{
|
||||
var panelProps = allPropOnFromDict[panelId];
|
||||
cable.System = panelProps[GlobalObject.propName_System]?.PropertyValue;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
cable.ToPanel = panelObj;//暂用一下topanel属性,相当于电缆预分配的采集箱背后的Panel对象。
|
||||
|
||||
var IOsOnPanel = panelObj.allowedIOTypes.Split(',').ToList();
|
||||
|
@ -152,6 +152,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public ec_PanelEntity ToPanel { set; get; }
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -160,6 +160,11 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public bool DeleteFlg { set; get; } = false;
|
||||
|
||||
#region 预分配后的结果
|
||||
public List<string> AssignedTerms;
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
public ec_CableSetEntity()
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -4,3 +4,9 @@ C:\repo\CODE\009\Server\Learun.Framework.Module\Learun.Cache\Learun.Cache.Base\o
|
||||
C:\repo\CODE\009\Server\Learun.Framework.Module\Learun.Cache\Learun.Cache.Base\obj\Release\Learun.Cache.Base.csproj.CoreCompileInputs.cache
|
||||
C:\repo\CODE\009\Server\Learun.Framework.Module\Learun.Cache\Learun.Cache.Base\obj\Release\Learun.Cache.Base.dll
|
||||
C:\repo\CODE\009\Server\Learun.Framework.Module\Learun.Cache\Learun.Cache.Base\obj\Release\Learun.Cache.Base.pdb
|
||||
C:\repo\CODE\009_DI-Elec\Learun.Framework.Module\Learun.Cache\Learun.Cache.Base\bin\Release\Learun.Cache.Base.dll
|
||||
C:\repo\CODE\009_DI-Elec\Learun.Framework.Module\Learun.Cache\Learun.Cache.Base\bin\Release\Learun.Cache.Base.pdb
|
||||
C:\repo\CODE\009_DI-Elec\Learun.Framework.Module\Learun.Cache\Learun.Cache.Base\obj\Release\Learun.Cache.Base.csproj.AssemblyReference.cache
|
||||
C:\repo\CODE\009_DI-Elec\Learun.Framework.Module\Learun.Cache\Learun.Cache.Base\obj\Release\Learun.Cache.Base.csproj.CoreCompileInputs.cache
|
||||
C:\repo\CODE\009_DI-Elec\Learun.Framework.Module\Learun.Cache\Learun.Cache.Base\obj\Release\Learun.Cache.Base.dll
|
||||
C:\repo\CODE\009_DI-Elec\Learun.Framework.Module\Learun.Cache\Learun.Cache.Base\obj\Release\Learun.Cache.Base.pdb
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -10,6 +10,9 @@ using SWS.CAD.Views.Dialog;
|
||||
using Prism.Services.Dialogs;
|
||||
using SWS.Commons;
|
||||
using SWS.Model;
|
||||
using System.Windows;
|
||||
using SWS.Service;
|
||||
using Unity;
|
||||
|
||||
namespace SWS.CAD.ViewModels
|
||||
{
|
||||
@ -30,6 +33,11 @@ namespace SWS.CAD.ViewModels
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
IOModuleService _iOModuleService;
|
||||
public DialogCablePreAssignPreviewViewModel()
|
||||
{
|
||||
_iOModuleService = GlobalObject.container.Resolve<IOModuleService>();
|
||||
}
|
||||
|
||||
public string Title => "";
|
||||
|
||||
@ -52,10 +60,69 @@ namespace SWS.CAD.ViewModels
|
||||
_PreAssignCables = parameters.GetValue<ObservableCollection<PreAssignCable>>(GlobalObject.dialogPar.para1.ToString());
|
||||
}
|
||||
|
||||
public override void ExecuteOKCommandAsync(object parameter)
|
||||
public override async void ExecuteOKCommandAsync(object parameter)
|
||||
{
|
||||
bool isShowDialog = false;
|
||||
List<string> cableids = new List<string>();
|
||||
foreach (var preAssignCable in PreAssignCables)
|
||||
{
|
||||
if (preAssignCable.IsChecked)
|
||||
{
|
||||
cableids.Add(preAssignCable.CableId);
|
||||
}
|
||||
}
|
||||
if (cableids != null && cableids.Count() > 0)
|
||||
{
|
||||
bool AcceptNearbyPanel;
|
||||
MessageBoxResult result = System.Windows.MessageBox.Show($"遇到I/O类型不合适的采集箱,是否需要自动更换就近的采集箱", "KunHengCAD", MessageBoxButton.YesNo, MessageBoxImage.Question);
|
||||
if (result == MessageBoxResult.Yes)
|
||||
{
|
||||
AcceptNearbyPanel = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
AcceptNearbyPanel = false;
|
||||
}
|
||||
|
||||
if (PreAssignCables.Any(p => p.IsChecked == true))
|
||||
var ResHttp = await _iOModuleService.AutoAssignCable2channel_step1(cableids, AcceptNearbyPanel) as learunHttpRes<object>;
|
||||
if (ResHttp.code == 200)
|
||||
{
|
||||
isShowDialog = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (AcceptNearbyPanel)
|
||||
{
|
||||
result = System.Windows.MessageBox.Show($"{ResHttp.info}", "KunHengCAD", MessageBoxButton.YesNo, MessageBoxImage.Question);
|
||||
if (result == MessageBoxResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
isShowDialog = true;
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var info = ResHttp.info;
|
||||
// 找到第一个句号的位置
|
||||
int firstPeriodIndex = info.IndexOf('。');
|
||||
if (firstPeriodIndex >= 0)
|
||||
{
|
||||
// 从第一个句号后开始找第二个句号
|
||||
int secondPeriodIndex = info.IndexOf('。', firstPeriodIndex + 1);
|
||||
if (secondPeriodIndex >= 0)
|
||||
{
|
||||
// 截取到第二个句号(包括句号)
|
||||
info = info.Substring(0, secondPeriodIndex + 1);
|
||||
}
|
||||
}
|
||||
System.Windows.MessageBox.Show($"{info}", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return;
|
||||
}
|
||||
}
|
||||
if (isShowDialog)
|
||||
{
|
||||
//打开窗体
|
||||
IDialogParameters para = new Prism.Services.Dialogs.DialogParameters();
|
||||
@ -72,10 +139,16 @@ namespace SWS.CAD.ViewModels
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
System.Windows.MessageBox.Show("未勾选预分配电缆", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return;
|
||||
}
|
||||
|
||||
//返回的结果
|
||||
IDialogParameters res = new Prism.Services.Dialogs.DialogParameters();
|
||||
//IDialogParameters res = new Prism.Services.Dialogs.DialogParameters();
|
||||
//res.Add(GlobalObject.dialogPar.para1.ToString(), SelectedStripParametersInfo);
|
||||
RequestClose.Invoke(new DialogResult(ButtonResult.Yes, res));
|
||||
//RequestClose.Invoke(new DialogResult(ButtonResult.Yes, res));
|
||||
}
|
||||
public override void ExecuteCloseCommand(object parameter)
|
||||
{
|
||||
@ -119,7 +192,7 @@ namespace SWS.CAD.ViewModels
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(parameter.ToString().Equals("清空"))
|
||||
if (parameter.ToString().Equals("清空"))
|
||||
{
|
||||
foreach (var item in PreAssignCables)
|
||||
{
|
||||
@ -133,9 +206,18 @@ namespace SWS.CAD.ViewModels
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class PreAssignCable: DialogBase
|
||||
public class PreAssignCable : DialogBase
|
||||
{
|
||||
#region 页面渲染字段
|
||||
private string _CableId;
|
||||
|
||||
public string CableId
|
||||
{
|
||||
get { return _CableId; }
|
||||
set { _CableId = value; }
|
||||
}
|
||||
|
||||
|
||||
private int _Index;
|
||||
/// <summary>
|
||||
/// 序号
|
||||
@ -152,7 +234,9 @@ namespace SWS.CAD.ViewModels
|
||||
public bool IsChecked
|
||||
{
|
||||
get { return _IsChecked; }
|
||||
set { _IsChecked = value;
|
||||
set
|
||||
{
|
||||
_IsChecked = value;
|
||||
RaisePropertyChanged(nameof(IsChecked));
|
||||
}
|
||||
}
|
||||
@ -200,10 +284,11 @@ namespace SWS.CAD.ViewModels
|
||||
}
|
||||
public PreAssignCable(ec_Cable ec_Cable)
|
||||
{
|
||||
CableId = ec_Cable.CableID;
|
||||
TagNumber = ec_Cable.TagNumber;
|
||||
PreAssignIOType = ec_Cable.PreAssignIOType;
|
||||
CableClass =ec_Cable.CableClass.Equals("homerun") ? "是":"否";
|
||||
ToPanel_TagNumber = ec_Cable.ToPanel!=null?ec_Cable.ToPanel.TagNumber:null;
|
||||
CableClass = ec_Cable.CableClass.Equals("homerun") ? "是" : "否";
|
||||
ToPanel_TagNumber = ec_Cable.ToPanel != null ? ec_Cable.ToPanel.TagNumber : null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
@ -7,17 +7,51 @@ using Telerik.Windows.Controls;
|
||||
using Prism.Services.Dialogs;
|
||||
using SWS.Commons;
|
||||
using SWS.Model;
|
||||
using SWS.Service;
|
||||
using Unity;
|
||||
using System.Linq;
|
||||
using Telerik.Windows.Controls.MaskedInput.Tokens.Numeric;
|
||||
|
||||
namespace SWS.CAD.ViewModels
|
||||
{
|
||||
public class DialogCablePreAssignResultViewModel : DialogBase, IDialogAware
|
||||
{
|
||||
#region 字段
|
||||
private ObservableCollection<PreAssignCable> _PreAssignCables = new ObservableCollection<PreAssignCable>();
|
||||
private ObservableCollection<PreAllocationResult> _PreAllocationResultls = new ObservableCollection<PreAllocationResult>();
|
||||
/// <summary>
|
||||
/// 端子排参数信息列表
|
||||
/// 预分配结果表格源
|
||||
/// </summary>
|
||||
public ObservableCollection<PreAssignCable> PreAssignCables
|
||||
public ObservableCollection<PreAllocationResult> PreAllocationResultls
|
||||
{
|
||||
get { return _PreAllocationResultls; }
|
||||
set
|
||||
{
|
||||
_PreAllocationResultls = value;
|
||||
RaisePropertyChanged(nameof(PreAllocationResultls));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private string _SuccessOrFailure = "分配成功";
|
||||
/// <summary>
|
||||
/// 选择成功还是选择失败
|
||||
/// </summary>
|
||||
public string SuccessOrFailure
|
||||
{
|
||||
get { return _SuccessOrFailure; }
|
||||
set
|
||||
{
|
||||
_SuccessOrFailure = value;
|
||||
RaisePropertyChanged(nameof(SuccessOrFailure));
|
||||
UpdataPreAssignCables();
|
||||
}
|
||||
}
|
||||
|
||||
private ObservableCollection<ec_Cable> _PreAssignCables = new ObservableCollection<ec_Cable>();
|
||||
/// <summary>
|
||||
/// 左侧预分配电缆列表
|
||||
/// </summary>
|
||||
public ObservableCollection<ec_Cable> PreAssignCables
|
||||
{
|
||||
get { return _PreAssignCables; }
|
||||
set
|
||||
@ -27,90 +61,28 @@ namespace SWS.CAD.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
private StripParametersInfo _SelectedStripParametersInfo;
|
||||
private ec_Cable _SelectedPreAssignCable;
|
||||
/// <summary>
|
||||
/// 当前选中的信号类型
|
||||
/// 选择的预分配电缆
|
||||
/// </summary>
|
||||
public StripParametersInfo SelectedStripParametersInfo
|
||||
public ec_Cable SelectedPreAssignCable
|
||||
{
|
||||
get { return _SelectedStripParametersInfo; }
|
||||
get { return _SelectedPreAssignCable; }
|
||||
set
|
||||
{
|
||||
_SelectedStripParametersInfo = value;
|
||||
RaisePropertyChanged(nameof(SelectedStripParametersInfo));
|
||||
}
|
||||
}
|
||||
private bool _IsReadOnly;
|
||||
/// <summary>
|
||||
/// 是否可编辑
|
||||
/// </summary>
|
||||
public bool IsReadOnly
|
||||
{
|
||||
get { return _IsReadOnly; }
|
||||
set
|
||||
{
|
||||
_IsReadOnly = value;
|
||||
RaisePropertyChanged(nameof(IsReadOnly));
|
||||
}
|
||||
}
|
||||
|
||||
#region 表格下拉列表
|
||||
private List<string> _TermNamingType_ls = new List<string>() { "数字", "字母" };
|
||||
/// <summary>
|
||||
/// 端子编号类型
|
||||
/// </summary>
|
||||
public List<string> TermNamingType_ls
|
||||
{
|
||||
get { return _TermNamingType_ls; }
|
||||
set
|
||||
{
|
||||
_TermNamingType_ls = value;
|
||||
RaisePropertyChanged(nameof(TermNamingType_ls));
|
||||
}
|
||||
}
|
||||
private List<string> _TermNamingRule_ls = new List<string>() { "按端子排全局编号", "按通道内端子编号", "按通道编号" };
|
||||
/// <summary>
|
||||
/// 端子编号规则
|
||||
/// </summary>
|
||||
public List<string> TermNamingRule_ls
|
||||
{
|
||||
get { return _TermNamingRule_ls; }
|
||||
set
|
||||
{
|
||||
_TermNamingRule_ls = value;
|
||||
RaisePropertyChanged(nameof(TermNamingRule_ls));
|
||||
}
|
||||
}
|
||||
private List<string> _TermNamePrefix_ls = new List<string>() { "通道编号", "+,-,s", "无" };
|
||||
/// <summary>
|
||||
/// 端子前缀
|
||||
/// </summary>
|
||||
public List<string> TermNamePrefix_ls
|
||||
{
|
||||
get { return _TermNamePrefix_ls; }
|
||||
set
|
||||
{
|
||||
_TermNamePrefix_ls = value;
|
||||
RaisePropertyChanged(nameof(TermNamePrefix_ls));
|
||||
}
|
||||
}
|
||||
private List<string> _TermNameSuffix_ls = new List<string>() { "通道编号", "+,-,s", "无" };
|
||||
/// <summary>
|
||||
/// 端子后缀
|
||||
/// </summary>
|
||||
public List<string> TermNameSuffix_ls
|
||||
{
|
||||
get { return _TermNameSuffix_ls; }
|
||||
set
|
||||
{
|
||||
_TermNameSuffix_ls = value;
|
||||
RaisePropertyChanged(nameof(TermNameSuffix_ls));
|
||||
_SelectedPreAssignCable = value;
|
||||
RaisePropertyChanged(nameof(SelectedPreAssignCable));
|
||||
UpdataPreAllocationResultls(_SelectedPreAssignCable);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
IOModuleService _iOModuleService;
|
||||
public DialogCablePreAssignResultViewModel()
|
||||
{
|
||||
_iOModuleService = GlobalObject.container.Resolve<IOModuleService>();
|
||||
}
|
||||
public string Title => "";
|
||||
|
||||
public event Action<IDialogResult> RequestClose;
|
||||
@ -124,18 +96,31 @@ namespace SWS.CAD.ViewModels
|
||||
|
||||
}
|
||||
|
||||
private List<ec_Cable> CablePreAssigns;
|
||||
//全部预分配电缆
|
||||
private List<ec_Cable> AllPreAssignCables;
|
||||
public async void OnDialogOpened(IDialogParameters parameters)
|
||||
{
|
||||
//title = parameters.GetValue<string>(GlobalObject.dialogPar.title.ToString());
|
||||
title = "信号预分配结果";
|
||||
_PreAssignCables = parameters.GetValue<ObservableCollection<PreAssignCable>>(GlobalObject.dialogPar.para1.ToString());
|
||||
_IsReadOnly = parameters.GetValue<bool>(GlobalObject.dialogPar.para2.ToString());
|
||||
AllPreAssignCables = await _iOModuleService.AutoAssignCable2channel_step2();
|
||||
UpdataPreAssignCables();
|
||||
}
|
||||
|
||||
public override void ExecuteOKCommandAsync(object para)
|
||||
public override async void ExecuteOKCommandAsync(object para)
|
||||
{
|
||||
var Cables = new List<ec_Cable>();
|
||||
if (AllPreAssignCables != null)
|
||||
{
|
||||
foreach (var PreAssignCable in AllPreAssignCables)
|
||||
{
|
||||
if (PreAssignCable.Sets != null && !string.IsNullOrEmpty(PreAssignCable.Sets.FirstOrDefault().ConnectionInfo))
|
||||
{
|
||||
Cables.Add(PreAssignCable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var resHttp = await _iOModuleService.AutoAssignCable2channel_step3(Cables);
|
||||
//返回结果
|
||||
IDialogParameters res = new Prism.Services.Dialogs.DialogParameters();
|
||||
//res.Add(GlobalObject.dialogPar.para1.ToString(), SelectedStripParametersInfo);
|
||||
@ -156,6 +141,61 @@ namespace SWS.CAD.ViewModels
|
||||
}
|
||||
|
||||
#region 方法
|
||||
/// <summary>
|
||||
/// 修改预分配电缆列表,成功或者失败的电缆列表
|
||||
/// </summary>
|
||||
public void UpdataPreAssignCables()
|
||||
{
|
||||
PreAssignCables = new ObservableCollection<ec_Cable>();
|
||||
if (AllPreAssignCables != null)
|
||||
{
|
||||
if (SuccessOrFailure.Equals("分配成功"))
|
||||
{
|
||||
foreach (var PreAssignCable in AllPreAssignCables)
|
||||
{
|
||||
if (PreAssignCable.Sets != null && !string.IsNullOrEmpty(PreAssignCable.Sets.FirstOrDefault().ConnectionInfo))
|
||||
{
|
||||
PreAssignCables.Add(PreAssignCable);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var PreAssignCable in AllPreAssignCables)
|
||||
{
|
||||
if (PreAssignCable.Sets == null || string.IsNullOrEmpty(PreAssignCable.Sets.FirstOrDefault().ConnectionInfo))
|
||||
{
|
||||
PreAssignCables.Add(PreAssignCable);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 修改表格显示数据
|
||||
/// </summary>
|
||||
public void UpdataPreAllocationResultls(ec_Cable cable)
|
||||
{
|
||||
|
||||
PreAllocationResultls = new ObservableCollection<PreAllocationResult>();
|
||||
if (cable == null) return;
|
||||
if (cable.Sets != null)
|
||||
{
|
||||
foreach (var Set in cable.Sets)
|
||||
{
|
||||
PreAllocationResult preAllocationResult = new PreAllocationResult();
|
||||
preAllocationResult.CablePair = Set.CableSetName;
|
||||
preAllocationResult.IOType = cable.PreAssignIOType;
|
||||
preAllocationResult.ToPanel_TagNumber = cable.ToPanel == null ? "" : cable.ToPanel.TagNumber;
|
||||
preAllocationResult.Panel_TagNumber = string.IsNullOrEmpty(Set.ConnectionInfo) ? "" : Set.ConnectionInfo.Split('/')[0].Split(':')[1].Trim();
|
||||
preAllocationResult.StripName = string.IsNullOrEmpty(Set.ConnectionInfo) ? "" : Set.ConnectionInfo.Split('/')[1].Split(':')[1].Trim();
|
||||
preAllocationResult.Terms = new ObservableCollection<ec_PanelStripTerm>(Set.AssignedTerms);
|
||||
PreAllocationResultls.Add(preAllocationResult);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public ICommand EditEndCmd => new DelegateCommand(EditEnd);
|
||||
/// <summary>
|
||||
/// 编辑结束事件
|
||||
@ -168,7 +208,73 @@ namespace SWS.CAD.ViewModels
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
/// <summary>
|
||||
/// 预分配结果类
|
||||
/// </summary>
|
||||
public class PreAllocationResult : DialogBase
|
||||
{
|
||||
private string _CablePair;
|
||||
/// <summary>
|
||||
/// 电缆对
|
||||
/// </summary>
|
||||
public string CablePair
|
||||
{
|
||||
get { return _CablePair; }
|
||||
set { _CablePair = value; }
|
||||
}
|
||||
|
||||
private string _IOType;
|
||||
/// <summary>
|
||||
/// IO类型
|
||||
/// </summary>
|
||||
public string IOType
|
||||
{
|
||||
get { return _IOType; }
|
||||
set { _IOType = value; }
|
||||
}
|
||||
|
||||
|
||||
private string _ToPanel_TagNumber;
|
||||
/// <summary>
|
||||
/// 预分配的系统柜
|
||||
/// </summary>
|
||||
public string ToPanel_TagNumber
|
||||
{
|
||||
get { return _ToPanel_TagNumber; }
|
||||
set { _ToPanel_TagNumber = value; }
|
||||
}
|
||||
|
||||
private string _Panel_TagNumber;
|
||||
/// <summary>
|
||||
/// 实际分配的系统柜
|
||||
/// </summary>
|
||||
public string Panel_TagNumber
|
||||
{
|
||||
get { return _Panel_TagNumber; }
|
||||
set { _Panel_TagNumber = value; }
|
||||
}
|
||||
|
||||
private string _StripName;
|
||||
/// <summary>
|
||||
/// 实际分配的端子排
|
||||
/// </summary>
|
||||
public string StripName
|
||||
{
|
||||
get { return _StripName; }
|
||||
set { _StripName = value; }
|
||||
}
|
||||
|
||||
private ObservableCollection<ec_PanelStripTerm> _Terms;
|
||||
/// <summary>
|
||||
/// 实际端子
|
||||
/// </summary>
|
||||
public ObservableCollection<ec_PanelStripTerm> Terms
|
||||
{
|
||||
get { return _Terms; }
|
||||
set { _Terms = value; }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2706,12 +2706,17 @@ namespace SWS.CAD.ViewModels
|
||||
//获取到所有预分配的电缆并设置到页面渲染对象中
|
||||
IsBusy = true;
|
||||
List<ec_Cable> CablePreAssigns = await _iOModuleService.GetCablePreAssignPreview();
|
||||
if (CablePreAssigns==null)
|
||||
{
|
||||
CablePreAssigns = new List<ec_Cable>();
|
||||
}
|
||||
var PreAssignCables = new ObservableCollection<PreAssignCable>();
|
||||
int index = 0;
|
||||
|
||||
foreach (var CablePreAssign in CablePreAssigns)
|
||||
{
|
||||
index++;
|
||||
PreAssignCables.Add(new PreAssignCable(CablePreAssign) { Index = index });
|
||||
PreAssignCables.Add(new PreAssignCable(CablePreAssign) { Index = index ,IsChecked=true});
|
||||
}
|
||||
IsBusy = false;
|
||||
//打开窗体
|
||||
|
@ -6,6 +6,7 @@
|
||||
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
|
||||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:local="clr-namespace:SWS.CAD.Views.CustomControl"
|
||||
xmlns:cvt="clr-namespace:SWS.Commons.Helper.Converter;assembly=SWS.Commons"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<UserControl.Resources>
|
||||
@ -13,6 +14,41 @@
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/SWS.CAD;component/Views/Style/CustomStyles.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<!-- 转换器 -->
|
||||
<cvt:RadioButtonValueConverter x:Key="RadioButtonValueCvt" />
|
||||
|
||||
<!-- 使用ItemsControl垂直显示多个值 -->
|
||||
<DataTemplate x:Key="CellTemplate2">
|
||||
<ItemsControl ItemsSource="{Binding Terms}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Vertical"/>
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border BorderBrush="#cccccc" BorderThickness="0,0,0,1" Padding="0"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||
<TextBlock Text="{Binding Term_No}" TextAlignment="Center" Padding="4,2" />
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</DataTemplate>
|
||||
<DataTemplate x:Key="CellEditTemplate2">
|
||||
<ItemsControl ItemsSource="{Binding Terms}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Vertical"/>
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBox Text="{Binding Term_No}" TextAlignment="Center" Padding="4,2" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</DataTemplate>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<StackPanel Background="#5d6b99">
|
||||
@ -23,22 +59,55 @@
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Row="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="10"/>
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0">
|
||||
<Grid Width="400" Height="300" Background="White">
|
||||
|
||||
</Grid>
|
||||
<TextBlock Text="分配成功" Foreground="White" FontSize="12" Margin="0 0 0 10"/>
|
||||
<StackPanel >
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<RadioButton IsChecked="{Binding SuccessOrFailure, Converter={StaticResource RadioButtonValueCvt},ConverterParameter=分配成功}" Content="分配成功" Foreground="White" GroupName="RadioButton1"/>
|
||||
<RadioButton IsChecked="{Binding SuccessOrFailure, Converter={StaticResource RadioButtonValueCvt},ConverterParameter=分配失败}" Content="分配失败" Foreground="White" GroupName="RadioButton1"/>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="2">
|
||||
<Grid Width="400" Height="300" Background="White">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<GroupBox Margin="5,0,5,5"
|
||||
Foreground="White"
|
||||
VerticalAlignment="Bottom"
|
||||
Header="预分配电缆列表">
|
||||
<ListBox x:Name="treeView1" Width="120" Height="490" Background="White"
|
||||
ItemsSource="{Binding PreAssignCables,Mode=TwoWay}" SelectedItem="{Binding SelectedPreAssignCable,Mode=TwoWay}"
|
||||
Margin="5" telerik:StyleManager.Theme="Office_Blue"
|
||||
|
||||
>
|
||||
<ListBox.ItemTemplate>
|
||||
<HierarchicalDataTemplate ItemsSource="{Binding PreAssignCables,Mode=TwoWay}">
|
||||
<TextBlock Text="{Binding TagNumber}">
|
||||
</TextBlock>
|
||||
</HierarchicalDataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</GroupBox>
|
||||
<GroupBox Margin="5,0,5,5"
|
||||
Foreground="White"
|
||||
Header="预分配信息">
|
||||
<Grid Width="450" Height="500" Background="White">
|
||||
<telerik:RadGridView x:Name="RadGridView1" SelectionMode="Single" Width="auto" Height="660"
|
||||
AutoGenerateColumns="False" IsFilteringAllowed="False"
|
||||
IsReadOnly="False" RowIndicatorVisibility="Collapsed"
|
||||
ShowGroupPanel="False" telerik:StyleManager.Theme="Office_Blue"
|
||||
ItemsSource="{Binding PreAllocationResultls}" SelectedItem="{Binding SelectedChannelInfo, Mode=TwoWay}"
|
||||
>
|
||||
<telerik:RadGridView.Columns>
|
||||
<telerik:GridViewDataColumn Header="电缆对" DataMemberBinding="{Binding CablePair}" IsReadOnly="True"/>
|
||||
<telerik:GridViewDataColumn Header="IO类型" DataMemberBinding="{Binding IOType}" IsReadOnly="True"/>
|
||||
<telerik:GridViewDataColumn Header="预分配箱子" DataMemberBinding="{Binding ToPanel_TagNumber}" IsReadOnly="True"/>
|
||||
<telerik:GridViewDataColumn Header="实际分配箱子" DataMemberBinding="{Binding Panel_TagNumber}" IsReadOnly="True"/>
|
||||
<telerik:GridViewDataColumn Header="实际分配端子排" DataMemberBinding="{Binding StripName}" IsReadOnly="True"/>
|
||||
<telerik:GridViewDataColumn Header="实际分配端子"
|
||||
DataMemberBinding="{Binding Terms}"
|
||||
Width="*" IsReadOnly="True"
|
||||
CellTemplate="{StaticResource CellTemplate2}" CellEditTemplate="{StaticResource CellEditTemplate2}"/>
|
||||
</telerik:RadGridView.Columns>
|
||||
</telerik:RadGridView>
|
||||
</Grid>
|
||||
<TextBlock Text="分配失败" Foreground="White" FontSize="12" Margin="0 0 0 10"/>
|
||||
</GroupBox>
|
||||
</StackPanel>
|
||||
<TextBlock Text="{Binding SuccessOrFailure}" Foreground="White" FontSize="12" Margin="0 0 0 10"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<Grid Grid.Row="1">
|
||||
|
@ -117,6 +117,9 @@ namespace SWS.Model
|
||||
/// 删除标记
|
||||
/// </summary>
|
||||
public bool DeleteFlg { set; get; } = false;
|
||||
|
||||
public List<ec_PanelStripTerm> AssignedTerms { set; get; }
|
||||
|
||||
#endregion
|
||||
|
||||
public ec_CableSet()
|
||||
|
@ -333,6 +333,46 @@ namespace SWS.Service
|
||||
return null;
|
||||
}
|
||||
|
||||
public async Task<object> AutoAssignCable2channel_step1(List<string> CableIds ,bool AcceptNearbyPanel)
|
||||
{
|
||||
var res = await this.PostBodyAsync<object,List<string>>($"IOModuleApi/AutoAssignCable2Channel_step1?projId={GlobalObject.curProject?.ProjectId}&AcceptNearbyPanel={AcceptNearbyPanel}", CableIds);
|
||||
//if (res.code == 200)
|
||||
//{
|
||||
// return res.data;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
//}
|
||||
return res;
|
||||
}
|
||||
|
||||
public async Task<List<ec_Cable>> AutoAssignCable2channel_step2()
|
||||
{
|
||||
var res = await this.PostBodyAsync<List<ec_Cable>, object>($"IOModuleApi/AutoAssignCable2Channel_step2?projId={GlobalObject.curProject?.ProjectId}", null);
|
||||
if (res.code == 200)
|
||||
{
|
||||
return res.data;
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public async Task<List<ec_Cable>> AutoAssignCable2channel_step3(List<ec_Cable> CableIds)
|
||||
{
|
||||
var res = await this.PostBodyAsync<List<ec_Cable>, object>($"IOModuleApi/AutoAssignCable2Channel_step3?projId={GlobalObject.curProject?.ProjectId}", CableIds);
|
||||
if (res.code == 200)
|
||||
{
|
||||
return res.data;
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// SaveConnections 专用
|
||||
/// </summary>
|
||||
@ -341,5 +381,7 @@ namespace SWS.Service
|
||||
public string ID { get; set; }
|
||||
public List<ec_WireTerminal> Conns { get; set; }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user