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

initparam 添加 数据库保存月数

parent 6f4472f1
......@@ -7,6 +7,8 @@ using FObjBase;
using FLY.Thick.Base.IService;
using FLY.Thick.Base.OBJ_INTERFACE;
using FLY.Thick.Base.Common;
using Newtonsoft.Json;
namespace FLY.Thick.Base.Client
{
public class InitParamServiceClient : FObj, IInitParamService
......@@ -165,6 +167,10 @@ namespace FLY.Thick.Base.Client
/// </summary>
public bool HasHold { get; set; }
/// <summary>
/// 数据库保存的月数
/// </summary>
public int DBKeepMonth { get; set; }
#endregion
#region INotifyPropertyChanged 成员
......@@ -204,15 +210,16 @@ namespace FLY.Thick.Base.Client
hvelocity2 = HVelocity2,
hasProfileSample = HasProfileSample,
hasHold = HasHold
hasHold = HasHold,
dBKeepMonth = DBKeepMonth
};
string json = JsonConvert.SerializeObject(p);
//获取所有数据,设置推送
CurrObjSys.SetValueEx(
mConn, mServerID, ID,
INITPARAM_OBJ_INTERFACE.SET_PARAMS,
p.ToBytes());
Misc.Converter.StringToBytes(json));
}
public override void Dispose()
{
......@@ -238,10 +245,10 @@ namespace FLY.Thick.Base.Client
{
case INITPARAM_OBJ_INTERFACE.GET_PARAMS:
{
INITPARAM_OBJ_INTERFACE.Pack_Params p = new INITPARAM_OBJ_INTERFACE.Pack_Params();
if (!p.TryParse(infodata))
return;
string json = Misc.Converter.BytesToString(infodata);
var p = JsonConvert.DeserializeObject<INITPARAM_OBJ_INTERFACE.Pack_Params>(json);
PosLength = p.poslength;
AutoOrgInterval = p.auto_org_interval;
PosOfGrid = p.posOfGrid;
......@@ -272,6 +279,7 @@ namespace FLY.Thick.Base.Client
HasProfileSample = p.hasProfileSample;
HasHold = p.hasHold;
DBKeepMonth = p.dBKeepMonth;
} break;
}
......
......@@ -122,6 +122,11 @@ namespace FLY.Thick.Base.IService
#endregion
/// <summary>
/// 数据库保存的月数
/// </summary>
int DBKeepMonth { get; set; }
void Apply();
}
......
......@@ -10,7 +10,7 @@ namespace FLY.Thick.Base.OBJ_INTERFACE
public class INITPARAM_OBJ_INTERFACE
{
#region Pack
public class Pack_Params : IPack
public class Pack_Params
{
public int poslength;
......@@ -47,131 +47,7 @@ namespace FLY.Thick.Base.OBJ_INTERFACE
public bool hasProfileSample;
public bool hasHold;
#region IPack 成员
public byte[] ToBytes()
{
List<byte> buf = new List<byte>();
buf.AddRange(BitConverter.GetBytes(poslength));
buf.AddRange(BitConverter.GetBytes(adlag));
buf.AddRange(BitConverter.GetBytes(auto_org_interval));
buf.AddRange(BitConverter.GetBytes(posOfGrid));
buf.AddRange(BitConverter.GetBytes(encoder1_mmpp));
buf.AddRange(BitConverter.GetBytes(speed1scale));
buf.AddRange(BitConverter.GetBytes((int)filmVSrc));
buf.AddRange(BitConverter.GetBytes(filmVThreshold));
buf.AddRange(BitConverter.GetBytes(encoder2_mmpp));
buf.AddRange(BitConverter.GetBytes(encoder2_comp));
buf.AddRange(BitConverter.GetBytes(mmOfR));
buf.AddRange(BitConverter.GetBytes((int)data_valid_src));
buf.AddRange(BitConverter.GetBytes(autof1f3));
buf.AddRange(BitConverter.GetBytes(restartDelay));
buf.AddRange(BitConverter.GetBytes(vscan));
buf.AddRange(BitConverter.GetBytes(vjog));
buf.AddRange(BitConverter.GetBytes(vaccuracy));
buf.AddRange(BitConverter.GetBytes(svelocity));
buf.AddRange(BitConverter.GetBytes(atime));
buf.AddRange(BitConverter.GetBytes(dtime));
buf.AddRange(BitConverter.GetBytes(hvelocity1));
buf.AddRange(BitConverter.GetBytes(hvelocity2));
buf.AddRange(BitConverter.GetBytes(hasProfileSample));
buf.AddRange(BitConverter.GetBytes(hasHold));
return buf.ToArray();
}
public bool TryParse(byte[] value)
{
int cnt = 4 * 4 + 8 * 2;
if (value.Length <cnt)
return false;
int idx = 0;
poslength = BitConverter.ToInt32(value, idx);
idx += 4;
adlag = BitConverter.ToInt32(value, idx);
idx += 4;
auto_org_interval = BitConverter.ToInt32(value, idx);
idx += 4;
posOfGrid = BitConverter.ToInt32(value, idx);
idx += 4;
encoder1_mmpp = BitConverter.ToDouble(value, idx);
idx += 8;
speed1scale = BitConverter.ToDouble(value, idx);
idx += 8;
cnt += 4 + 4 + 8 + 4 + 8 + 4;
if (value.Length < cnt)
return false;
filmVSrc = (FilmVSRC)BitConverter.ToInt32(value, idx);
idx += 4;
filmVThreshold = BitConverter.ToInt32(value, idx);
idx += 4;
encoder2_mmpp = BitConverter.ToDouble(value, idx);
idx += 8;
encoder2_comp = BitConverter.ToSingle(value, idx);
idx += 4;
mmOfR = BitConverter.ToDouble(value, idx);
idx += 8;
data_valid_src = (DATAVALIDSRC)BitConverter.ToInt32(value, idx);
idx += 4;
cnt += 1 + 4;
if (value.Length < cnt)
return false;
autof1f3 = BitConverter.ToBoolean(value, idx);
idx++;
restartDelay = BitConverter.ToInt32(value, idx);
idx += 4;
cnt += 4 * 8;
if (value.Length < cnt)
return false;
vscan = BitConverter.ToUInt32(value, idx);
idx += 4;
vjog = BitConverter.ToUInt32(value, idx);
idx += 4;
vaccuracy = BitConverter.ToUInt32(value, idx);
idx += 4;
svelocity = BitConverter.ToUInt32(value, idx);
idx += 4;
atime = BitConverter.ToUInt32(value, idx);
idx += 4;
dtime = BitConverter.ToUInt32(value, idx);
idx += 4;
hvelocity1 = BitConverter.ToUInt32(value, idx);
idx += 4;
hvelocity2 = BitConverter.ToUInt32(value, idx);
idx += 4;
cnt += 2;
if (value.Length < cnt)
return false;
hasProfileSample = BitConverter.ToBoolean(value, idx);
idx++;
hasHold = BitConverter.ToBoolean(value, idx);
idx++;
return true;
}
#endregion
public int dBKeepMonth;
}
#endregion
......
......@@ -6,6 +6,7 @@ using FObjBase;
using FLY.Thick.Base.OBJ_INTERFACE;
using FLY.Thick.Base.Common;
using FLY.Thick.Base.IService;
using Newtonsoft.Json;
namespace FLY.Thick.Base.Server.OBJProxy
{
......@@ -74,9 +75,11 @@ namespace FLY.Thick.Base.Server.OBJProxy
hasProfileSample = mInitparam.HasProfileSample,
hasHold = mInitparam.HasHold
hasHold = mInitparam.HasHold,
dBKeepMonth = mInitparam.DBKeepMonth
};
infodata = p.ToBytes();
string json = JsonConvert.SerializeObject(p);
infodata = Misc.Converter.StringToBytes(json);
} break;
default:
infodata = null;
......@@ -89,10 +92,10 @@ namespace FLY.Thick.Base.Server.OBJProxy
{
case INITPARAM_OBJ_INTERFACE.SET_PARAMS:
{
INITPARAM_OBJ_INTERFACE.Pack_Params p = new INITPARAM_OBJ_INTERFACE.Pack_Params();
if (!p.TryParse(infodata))
break;
string json = Misc.Converter.BytesToString(infodata);
var p = JsonConvert.DeserializeObject<INITPARAM_OBJ_INTERFACE.Pack_Params>(json);
mInitparam.PosLength = p.poslength;
mInitparam.ADLag = p.adlag;
mInitparam.AutoOrgInterval = p.auto_org_interval;
......@@ -118,6 +121,7 @@ namespace FLY.Thick.Base.Server.OBJProxy
mInitparam.HasProfileSample = p.hasProfileSample;
mInitparam.HasHold = p.hasHold;
mInitparam.DBKeepMonth = p.dBKeepMonth;
mInitparam.Apply();
} break;
}
......
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