Commit aec000a7 authored by 潘栩锋's avatar 潘栩锋 🚴

Merge remote-tracking branch 'remotes/origin/dev7.0' into dev7.0-calender

parents 3b109214 65f73b68
......@@ -84,7 +84,7 @@ namespace FlyADBase
this.PropertyChanged += new PropertyChangedEventHandler(FlyAD7_PropertyChanged);
PollModule.Current.Poll_Config(PollModule.POLL_CONFIG.ADD, new PollModule.PollHandler(OnPoll));
//每隔一个小时
//每隔一个小时,改变剩下时间
PollModule.Current.Poll_Config(PollModule.POLL_CONFIG.ADD, () =>
{
if (!IsConnected)
......@@ -125,6 +125,20 @@ namespace FlyADBase
}
}, TimeSpan.FromSeconds(1));
//每隔1秒发送一次 GetIO
PollModule.Current.Poll_Config(PollModule.POLL_CONFIG.ADD, () =>
{
if (!IsConnected)
return;
//FLYIO
CurrObjSys.GetValueEx(
conn,
FLYAD7_OBJ_INTERFACE.FLYIO_OBJ_INTERFACE.ID,
ID,
FLYAD7_OBJ_INTERFACE.FLYIO_OBJ_INTERFACE.GET_IO);
}, TimeSpan.FromSeconds(1));
constructor2();
}
......@@ -365,6 +379,8 @@ namespace FlyADBase
ID,
FLYAD7_OBJ_INTERFACE.FLYIO_OBJ_INTERFACE.GET_IO);
NotifyPropertyChanged(nameof(Pos1LCShift));//写入到AD盒
......@@ -1817,19 +1833,33 @@ namespace FlyADBase
this.jsonDbPath = jsonDbPath;
this.PropertyChanged -= FlyAD7_PropertyChanged2;
//不需要设置到 AD盒
bShieldSetValueEx = true;
bool ret = FlyAD7JsonDb.Load(jsonDbPath, this);
//还没连到 AD盒前, 有比较正常的 默认值,不需要设置到AD盒
PosOfGrid = Backup_PosOfGrid;
MotorType = Backup_MotorType;
Ratio01 = Backup_Ratio01;
Ratio02 = Backup_Ratio02;
PosOffset = Backup_PosOffset;
JogVelocity = Backup_JogVelocity;
bShieldSetValueEx = false;
this.PropertyChanged += FlyAD7_PropertyChanged2;
return ret;
}
/// <summary>
/// 属性改变,自动保存
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void FlyAD7_PropertyChanged2(object sender, PropertyChangedEventArgs e)
{
if (propertyName_save.Contains(e.PropertyName))
......
......@@ -24,8 +24,21 @@ namespace FLY.OBJComponents.Client
/// <summary>
/// 当前 INotifyPropertyChanged 对象 引发了 PropertyChanged, 是由于 接收到数据导致的
/// </summary>
public bool IsInPushValue { get;protected set; }
public bool IsInPushValue { get; protected set; }
/// <summary>
/// 同步完成
/// </summary>
public bool IsSynced { get; private set; }
/// <summary>
/// 缓存 发出 GetAllData指令,到收到回复 之间时段的 全部推送
/// </summary>
List<Dictionary<string, Dictionary<string, object>>> pushDataList = new List<Dictionary<string, Dictionary<string, object>>>();
/// <summary>
/// Add 函数, 添加的 objname, 必须等全部 都返回。 只要 addObjNameList.Count() 不为0, 也是要缓存 推送的
/// </summary>
List<string> addObjNameList = new List<string>();
public SyncPropServiceClient(UInt32 serverID, Dictionary<string, INotifyPropertyChanged> objnames)
{
......@@ -62,6 +75,11 @@ namespace FLY.OBJComponents.Client
ObjNames.Add(objname, obj);
//向服务器,只获取这个对象的数据
//暂停接收推送。。。。
IsSynced = false;
addObjNameList.Add(objname);
string json = JsonConvert.SerializeObject(objname);
FObjBase.FObjSys.Current.CallFunctionEx(mConn, mServerID, ID, SYNCPROP_OBJ_INTERFACE.CALL_GET_DATA,
Misc.Converter.StringToBytes(json));
......@@ -74,7 +92,8 @@ namespace FLY.OBJComponents.Client
void Data_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
PropertyInfo property = sender.GetType().GetProperty(e.PropertyName);
if (!property.CanWrite) {
if (!property.CanWrite)
{
return;
}
......@@ -124,7 +143,10 @@ namespace FLY.OBJComponents.Client
public override void ConnectNotify(IFConn from)
{
mConn = from;
IsSynced = false;
pushDataList.Clear();
if (from.IsConnected)
{
CurrObjSys.CallFunctionEx(mConn, mServerID, ID,
......@@ -134,8 +156,11 @@ namespace FLY.OBJComponents.Client
CurrObjSys.SenseConfigEx(mConn, mServerID, ID,
0xffffffff, SENSE_CONFIG.ADD);
}
}
public override void PushInfo(IFConn from, uint srcid, ushort infoid, byte[] infodata)
{
switch (infoid)
......@@ -144,17 +169,26 @@ namespace FLY.OBJComponents.Client
{
string json = Misc.Converter.BytesToString(infodata);
Dictionary<string, Dictionary<string, object>> DsDso = JsonConvert.DeserializeObject<Dictionary<string, Dictionary<string, object>>>(json);
if (!IsSynced)
{
//还没同步完成,先缓存
pushDataList.Add(DsDso);
return;
}
IsInPushValue = true;
foreach (var Dso in DsDso)
{
INotifyPropertyChanged obj = ObjNames[Dso.Key] as INotifyPropertyChanged;
INotifyPropertyChanged obj = ObjNames[Dso.Key];
obj.PropertyChanged -= Data_PropertyChanged;
foreach (var dv in Dso.Value)
{
PropertiesManager_JSON.SetValue(obj, dv.Key, dv.Value);
}
obj.PropertyChanged += Data_PropertyChanged;
}
IsInPushValue = false;
......@@ -162,12 +196,65 @@ namespace FLY.OBJComponents.Client
break;
}
}
/// <summary>
/// 处理全部 缓存的推送数据
/// </summary>
void DealPushDataList()
{
IsInPushValue = true;
for (int i = 0; i < pushDataList.Count(); i++)
{
var DsDso = pushDataList[i];
foreach (var Dso in DsDso)
{
INotifyPropertyChanged obj = ObjNames[Dso.Key];
obj.PropertyChanged -= Data_PropertyChanged;
foreach (var dv in Dso.Value)
{
PropertiesManager_JSON.SetValue(obj, dv.Key, dv.Value);
}
obj.PropertyChanged += Data_PropertyChanged;
}
}
IsInPushValue = false;
pushDataList.Clear();
}
public override void PushCallFunction(IFConn from, uint srcid, uint magic, ushort funcid, byte[] retdata, object AsyncDelegate, object AsyncState)
{
switch (funcid)
{
case SYNCPROP_OBJ_INTERFACE.CALL_GET_ALL_DATA:
{
//这个可能是大包来的,很慢,需要记录中途全部 push
string json = Misc.Converter.BytesToString(retdata);
//log.Debug("GetAllData:" +json);
Dictionary<string, Dictionary<string, object>> DsDso = JsonConvert.DeserializeObject<Dictionary<string, Dictionary<string, object>>>(json);
IsInPushValue = true;
foreach (var Dso in DsDso)
{
if (ObjNames.ContainsKey(Dso.Key))
{
INotifyPropertyChanged obj = ObjNames[Dso.Key] as INotifyPropertyChanged;
obj.PropertyChanged -= Data_PropertyChanged;
foreach (var dv in Dso.Value)
{
PropertiesManager_JSON.SetValue(obj, dv.Key, dv.Value);
}
obj.PropertyChanged += Data_PropertyChanged;
}
}
IsInPushValue = false;
//完成同步
IsSynced = true;
//处理之前的推送事件
DealPushDataList();
}
break;
case SYNCPROP_OBJ_INTERFACE.CALL_GET_DATA:
{
string json = Misc.Converter.BytesToString(retdata);
Dictionary<string, Dictionary<string, object>> DsDso = JsonConvert.DeserializeObject<Dictionary<string, Dictionary<string, object>>>(json);
......@@ -184,12 +271,23 @@ namespace FLY.OBJComponents.Client
}
obj.PropertyChanged += Data_PropertyChanged;
}
addObjNameList.Remove(Dso.Key);
}
IsInPushValue = false;
//全部接收完!!!
if (addObjNameList.Count() == 0)
{
//完成同步
IsSynced = true;
//处理之前的推送事件
DealPushDataList();
}
}
break;
}
}
}
}
......@@ -188,6 +188,10 @@ namespace FLY.Thick.Base.UI
/// </summary>
public bool Enable { get; set; }
/// <summary>
/// 单一材料
/// </summary>
public bool IsOneMaterial { get; set; }
/// <summary>
/// 边界拐点检测,找到的边界更加精确
/// </summary>
......@@ -271,6 +275,8 @@ namespace FLY.Thick.Base.UI
chart1 = chart;
Misc.BindingOperations.SetBinding(BorderSearchService, nameof(BorderSearchService.Enable), this, nameof(Enable));
Misc.BindingOperations.SetBinding(BorderSearchService, nameof(BorderSearchService.IsOneMaterial), this, nameof(IsOneMaterial));
Misc.BindingOperations.SetBinding(BorderSearchService, nameof(BorderSearchService.IsBreakDetect),this, nameof(IsBreakDetect));
Misc.BindingOperations.SetBinding(BorderSearchService, nameof(BorderSearchService.Valid), ()=> {
Valid = new Range(BorderSearchService.Valid);
......@@ -297,7 +303,7 @@ namespace FLY.Thick.Base.UI
}
private void MInitParamService_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
if (e.PropertyName == "PosLength")
if (e.PropertyName == nameof(InitParamService.PosLength))
{
UpdateX();
}
......@@ -306,12 +312,12 @@ namespace FLY.Thick.Base.UI
private void MBorderSearchService_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
if (e.PropertyName == "UpdateTime")
if (e.PropertyName == nameof(BorderSearch.UpdateTime))
{
getView();
}
else if ((e.PropertyName == "TempAD") ||
(e.PropertyName == "TempRange"))
else if ((e.PropertyName == nameof(BorderSearch.TempAD)) ||
(e.PropertyName == nameof(BorderSearch.TempRange)))
{
chart1.Invalidate();
}
......@@ -350,6 +356,7 @@ namespace FLY.Thick.Base.UI
return;
BorderSearchService.Enable = Enable;
BorderSearchService.IsOneMaterial = IsOneMaterial;
BorderSearchService.IsBreakDetect = IsBreakDetect;
BorderSearchService.Valid = Valid.ToStruct();
BorderSearchService.TempADBySet = TempADBySet;
......
......@@ -525,9 +525,16 @@ namespace FLY.Thick.Base.UI
return;
SeriesInfos[0].Datas.AddRange(reponse.OrgDatas[0].Select(ad => Misc.MyBase.ISVALIDATA(ad) ? ad : double.NaN));
var list = SeriesInfos[0].Datas.Where((d) =>
{
if (double.IsNaN(d))
return false;
else
return true;
});
//设置Y轴范围
int max = (int)SeriesInfos[0].Datas.Max();
int min = (int)SeriesInfos[0].Datas.Min();
int max = (int)list.Max();
int min = (int)list.Min();
//扩大3倍显示
int range = max - min;
if (range == 0)
......
......@@ -40,20 +40,28 @@
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=15}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=14}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=13}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=12}" Style="{StaticResource IOStyle}"/>
<Grid>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=12}" Style="{StaticResource IOStyle}"/>
<TextBlock Text="13" Style="{StaticResource IOTextStyle}"/>
</Grid>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="4,0">
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=11}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=10}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=9}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=8}" Style="{StaticResource IOStyle}"/>
<Grid>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=8}" Style="{StaticResource IOStyle}"/>
<TextBlock Text="9" Style="{StaticResource IOTextStyle}"/>
</Grid>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="4,0">
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=7}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=6}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=5}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=4}" Style="{StaticResource IOStyle}"/>
<Grid>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=4}" Style="{StaticResource IOStyle}"/>
<TextBlock Text="5" Style="{StaticResource IOTextStyle}"/>
</Grid>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="4,0">
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=3}" Style="{StaticResource IOStyle}"/>
......@@ -76,7 +84,10 @@
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=7}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=6}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=5}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=4}" Style="{StaticResource IOStyle}"/>
<Grid>
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=4}" Style="{StaticResource IOStyle}"/>
<TextBlock Text="5" Style="{StaticResource IOTextStyle}"/>
</Grid>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="4,0">
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=3}" Style="{StaticResource IOStyle}"/>
......
......@@ -38,7 +38,10 @@
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=15}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=14}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=13}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=12}" Style="{StaticResource IOStyle}"/>
<Grid>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=12}" Style="{StaticResource IOStyle}"/>
<TextBlock Text="13" Style="{StaticResource IOTextStyle}"/>
</Grid>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="4,0">
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=11}" Style="{StaticResource IOStyle}"/>
......@@ -46,14 +49,17 @@
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=9}" Style="{StaticResource IOStyle}"/>
<Grid>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=8}" Style="{StaticResource IOStyle}"/>
<TextBlock Text="8" Style="{StaticResource IOTextStyle}"/>
<TextBlock Text="9" Style="{StaticResource IOTextStyle}"/>
</Grid>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="4,0">
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=7}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=6}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=5}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=4}" Style="{StaticResource IOStyle}"/>
<Grid>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=4}" Style="{StaticResource IOStyle}"/>
<TextBlock Text="5" Style="{StaticResource IOTextStyle}"/>
</Grid>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="4,0">
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=3}" Style="{StaticResource IOStyle}"/>
......@@ -76,7 +82,10 @@
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=7}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=6}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=5}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=4}" Style="{StaticResource IOStyle}"/>
<Grid>
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=4}" Style="{StaticResource IOStyle}"/>
<TextBlock Text="5" Style="{StaticResource IOTextStyle}"/>
</Grid>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="4,0">
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=3}" Style="{StaticResource IOStyle}"/>
......
......@@ -96,15 +96,15 @@ namespace FLY.Thick.Base.Common
#endregion
#region 输出口
/// <summary>
/// 变频器正转 VF0 是松下的变频器牌子
/// </summary>
[Description("变频器正转")]
public int OutNo_VF0_Forw { get; protected set; } = 1 - 1;
/// <summary>
/// 变频器反转 VF0 是松下的变频器牌子
/// </summary>
[Description("变频器反转")]
public int OutNo_VF0_Backw { get; protected set; } = 2 - 1;
public int OutNo_VF0_Backw { get; protected set; } = 1 - 1;
/// <summary>
/// 变频器正转 VF0 是松下的变频器牌子
/// </summary>
[Description("变频器正转")]
public int OutNo_VF0_Forw { get; protected set; } = 2 - 1;
/// <summary>
/// 变频器减速 VF0 是松下的变频器牌子
/// </summary>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment