private bool UpdateState() { bool flag = false; XmlDocument xmlHeartDoc = new XmlDocument(); responseXML rHeart = new responseXML(); string MediaSql = ""; ServerForm.DeleteFolder(ServerForm.sHeartSourceFilePath);//删除原有XML发送文件的文件夹下的XML string frdStateName = ""; List <Device> lDev = new List <Device>(); try { lDev = GetEBRDTStateFromDataBase("Full"); frdStateName = "10" + SingletonInfo.GetInstance().CurrentResourcecode + BBSHelper.GetSequenceCodes(); string xmlEBMStateFileName = "\\EBDB_" + frdStateName + ".xml"; xmlHeartDoc = rHeart.DeviceStateResponse(lDev, frdStateName); TarXml.AudioResponseXml.CreateXML(xmlHeartDoc, ServerForm.sHeartSourceFilePath + xmlEBMStateFileName); ServerForm.mainFrm.GenerateSignatureFile(ServerForm.sHeartSourceFilePath, frdStateName); ServerForm.tar.CreatTar(ServerForm.sHeartSourceFilePath, ServerForm.sSendTarPath, frdStateName);//使用新TAR string sHeartBeatTarName = ServerForm.sSendTarPath + "\\" + "EBDT_" + frdStateName + ".tar"; string result = SendTar.SendTarOrder.sendHelper.AddPostQueue(SingletonInfo.GetInstance().SendTarAddress, sHeartBeatTarName); if (result == "1") { flag = true; } } catch (Exception ex) { throw new Exception("终端状态变更:" + ex.Message); } return(flag); }
private bool UpdateState(string TimingTerminalState) { bool flag = false; XmlDocument xmlHeartDoc = new XmlDocument(); responseXML rHeart = new responseXML(); rHeart.SourceAreaCode = ServerForm.strSourceAreaCode; rHeart.SourceType = ServerForm.strSourceType; rHeart.SourceName = ServerForm.strSourceName; rHeart.SourceID = ServerForm.strSourceID; rHeart.sHBRONO = ServerForm.strHBRONO; string MediaSql = ""; string strSRV_ID = ""; string strSRV_CODE = ""; ServerForm.DeleteFolder(ServerForm.sHeartSourceFilePath);//删除原有XML发送文件的文件夹下的XML string frdStateName = ""; List <Device> lDev = new List <Device>(); try { // MediaSql = "select SRV.SRV_ID,SRV.SRV_CODE,SRV_GOOGLE, SRV_PHYSICAL_CODE,srv_detail FROM SRV left join Srvtype on SRV.DeviceTypeId= Srvtype .srv_id where Srvtype.srv_id=1"; MediaSql = "select SRV.SRV_ID,SRV.SRV_CODE,SRV_GOOGLE, SRV_PHYSICAL_CODE,srv_detail,SRV_LOGICAL_CODE_GB,SRV_MFT_DATE,updateDate,SRV_RMT_STATUS FROM SRV left join Srvtype on SRV.DeviceTypeId= Srvtype .srv_id where Srvtype.srv_id=1"; DataTable dtMedia = mainForm.dba.getQueryInfoBySQL(MediaSql); if (dtMedia != null && dtMedia.Rows.Count > 0) { if (dtMedia.Rows.Count > 100) { int mod = dtMedia.Rows.Count / 100 + 1; for (int i = 0; i < mod; i++) { for (int idtM = 0; idtM < dtMedia.Rows.Count; idtM++) { Device DV = new Device(); DV.SRV_ID = dtMedia.Rows[idtM][0].ToString(); strSRV_CODE = dtMedia.Rows[idtM][1].ToString(); DV.DeviceID = dtMedia.Rows[idtM]["SRV_LOGICAL_CODE_GB"].ToString();//修改于20180819 把资源码换成23位 DV.DeviceName = dtMedia.Rows[idtM][4].ToString(); DV.Latitude = dtMedia.Rows[idtM][2].ToString().Split(',')[0]; DV.Longitude = dtMedia.Rows[idtM][2].ToString().Split(',')[1]; DV.Srv_Mft_Date = dtMedia.Rows[idtM]["SRV_MFT_DATE"].ToString(); DV.UpdateDate = dtMedia.Rows[idtM]["updateDate"].ToString(); DV.DeviceState = TimingTerminalState; lDev.Add(DV); } Random rdState = new Random(); frdStateName = "10" + rHeart.sHBRONO + GetSequenceCodes(); string xmlEBMStateFileName = "\\EBDB_" + frdStateName + ".xml"; xmlHeartDoc = rHeart.DeviceStateResponse(lDev, frdStateName); TarXml.AudioResponseXml.CreateXML(xmlHeartDoc, ServerForm.sHeartSourceFilePath + xmlEBMStateFileName); ServerForm.mainFrm.GenerateSignatureFile(ServerForm.sHeartSourceFilePath, frdStateName); ServerForm.tar.CreatTar(ServerForm.sHeartSourceFilePath, ServerForm.sSendTarPath, frdStateName);//使用新TAR string sHeartBeatTarName = ServerForm.sSendTarPath + "\\" + "EBDT_" + frdStateName + ".tar"; string result = SendTar.SendTarOrder.sendHelper.AddPostQueue(ServerForm.sZJPostUrlAddress, sHeartBeatTarName); if (result == "1") { flag = true; } } } else { for (int idtM = 0; idtM < dtMedia.Rows.Count; idtM++) { Device DV = new Device(); DV.SRV_ID = dtMedia.Rows[idtM][0].ToString(); strSRV_CODE = dtMedia.Rows[idtM][1].ToString(); DV.DeviceID = dtMedia.Rows[idtM]["SRV_LOGICAL_CODE_GB"].ToString(); DV.DeviceName = dtMedia.Rows[idtM][4].ToString(); DV.Latitude = dtMedia.Rows[idtM][2].ToString().Split(',')[0]; DV.Longitude = dtMedia.Rows[idtM][2].ToString().Split(',')[1]; DV.Srv_Mft_Date = dtMedia.Rows[idtM]["SRV_MFT_DATE"].ToString(); DV.UpdateDate = dtMedia.Rows[idtM]["updateDate"].ToString(); DV.DeviceState = TimingTerminalState; lDev.Add(DV); } frdStateName = "10" + rHeart.sHBRONO + GetSequenceCodes(); string xmlEBMStateFileName = "\\EBDB_" + frdStateName + ".xml"; xmlHeartDoc = rHeart.DeviceStateResponse(lDev, frdStateName); TarXml.AudioResponseXml.CreateXML(xmlHeartDoc, ServerForm.sHeartSourceFilePath + xmlEBMStateFileName); ServerForm.mainFrm.GenerateSignatureFile(ServerForm.sHeartSourceFilePath, frdStateName); ServerForm.tar.CreatTar(ServerForm.sHeartSourceFilePath, ServerForm.sSendTarPath, frdStateName);//使用新TAR string sHeartBeatTarName = ServerForm.sSendTarPath + "\\" + "EBDT_" + frdStateName + ".tar"; string result = SendTar.SendTarOrder.sendHelper.AddPostQueue(ServerForm.sZJPostUrlAddress, sHeartBeatTarName); if (result == "1") { flag = true; } } } else { Random rdState = new Random(); frdStateName = "10" + rHeart.sHBRONO + GetSequenceCodes(); string xmlEBMStateFileName = "\\EBDB_" + frdStateName + ".xml"; xmlHeartDoc = rHeart.DeviceStateResponse(lDev, frdStateName); TarXml.AudioResponseXml.CreateXML(xmlHeartDoc, ServerForm.sHeartSourceFilePath + xmlEBMStateFileName); ServerForm.mainFrm.GenerateSignatureFile(ServerForm.sHeartSourceFilePath, frdStateName); ServerForm.tar.CreatTar(ServerForm.sHeartSourceFilePath, ServerForm.sSendTarPath, frdStateName);//使用新TAR string sHeartBeatTarName = ServerForm.sSendTarPath + "\\" + "EBDT_" + frdStateName + ".tar"; string result = SendTar.SendTarOrder.sendHelper.AddPostQueue(ServerForm.sZJPostUrlAddress, sHeartBeatTarName); if (result == "1") { flag = true; } } } catch (Exception ex) { throw new Exception("终端状态变更:" + ex.Message); } return(flag); }