/// <summary> /// 设置通用组态信息 /// </summary> /// <param name="list">通用组态列表</param> /// <param name="type">控制器类型</param> /// <returns>是否成功</returns> public bool SetGeneralConfigSetup(List <LinkageConfigGeneral> list, ControllerType type) { if (!IsConnected) { return(false); } List <NTP> ntpList = new List <NTP>(); foreach (var item in list) { NTP ntp = NTPBuildRequest.GetSetGeneralConfigRequest(item, type); if (ntp != null) { ntpList.Add(ntp); } } return(SerialClient.ExecuteSetTask(ntpList, type)); }
/// <summary> /// 设置控制器信息 /// </summary> /// <param name="model">控制器信息</param> /// <param name="type">控制器类型</param> /// <returns>是否成功</returns> public bool SetMachineSetup(ControllerModel model, ControllerType type) { if (!IsConnected) { return(false); } List <NTP> ntpList = new List <NTP>(); //器件 int deviceCount = 0; foreach (var loop in model.Loops) { deviceCount = loop.DeviceAmount; List <DeviceInfo8053> list = loop.GetDevices <DeviceInfo8053>(); foreach (var item in list) { NTP ntp = NTPBuildRequest.GetSetDeviceInfoRequest(item, deviceCount, type); if (ntp != null) { ntpList.Add(ntp); } } } //标准组态 foreach (var standard in model.StandardConfig) { NTP ntp = NTPBuildRequest.GetSetStandardConfigRequest(standard, type); if (ntp != null) { ntpList.Add(ntp); } } //混合组态 foreach (var mixed in model.MixedConfig) { NTP ntp = NTPBuildRequest.GetSetMixedConfigRequest(mixed, type); if (ntp != null) { ntpList.Add(ntp); } } //通用组态 foreach (var general in model.GeneralConfig) { NTP ntp = NTPBuildRequest.GetSetGeneralConfigRequest(general, type); if (ntp != null) { ntpList.Add(ntp); } } //手控盘 foreach (var manual in model.ControlBoard) { NTP ntp = NTPBuildRequest.GetSetManualBoardRequest(manual, type); if (ntp != null) { ntpList.Add(ntp); } } return(SerialClient.ExecuteSetTask(ntpList, type)); }