|  | @@ -55,6 +55,8 @@ namespace NB_IOT_TCP_HP_SOCKET
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          public static TcpServer server = new TcpServer();// 接收数据
 | 
	
		
			
				|  |  |          public static TcpServer monitor = new TcpServer();// 监听
 | 
	
		
			
				|  |  | +        // 设备历史记录
 | 
	
		
			
				|  |  | +        private static Dictionary<string, List<HistoryRecord>> meterHis = new Dictionary<string, List<HistoryRecord>>();
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          private delegate void ShowMsg(string msg, ListBox lb);
 | 
	
		
			
				|  |  |          private ShowMsg AddMsgDelegate;
 | 
	
	
		
			
				|  | @@ -928,6 +930,7 @@ namespace NB_IOT_TCP_HP_SOCKET
 | 
	
		
			
				|  |  |                          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                          InsourcingData insourcingData = new InsourcingData();
 | 
	
		
			
				|  |  | +                        insourcingData.SourceNumber = psp.SourceNumber;
 | 
	
		
			
				|  |  |                          insourcingData.Data = psp.Data;
 | 
	
		
			
				|  |  |                          insourcingData.ConnId = clientInfo.ConnId;
 | 
	
		
			
				|  |  |                          insourcingData.DT = dt;
 | 
	
	
		
			
				|  | @@ -1308,7 +1311,12 @@ namespace NB_IOT_TCP_HP_SOCKET
 | 
	
		
			
				|  |  |                              // 抄表数据包
 | 
	
		
			
				|  |  |                              else if ("1".Equals(insourcingData.DataType))
 | 
	
		
			
				|  |  |                              {
 | 
	
		
			
				|  |  | +                                string sourceNumber = insourcingData.SourceNumber;
 | 
	
		
			
				|  |  |                                  List<HistoryRecord> list = new List<HistoryRecord>();
 | 
	
		
			
				|  |  | +                                if (meterHis.ContainsKey(sourceNumber)) 
 | 
	
		
			
				|  |  | +                                {
 | 
	
		
			
				|  |  | +                                    list = meterHis[sourceNumber];
 | 
	
		
			
				|  |  | +                                }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                                  // 获取配置的上报抄表数据的数据信息CONF/DataCellConfig.xml中CD_CellMonitor节点,根据传输设备中的设备协议参数关联取那些字段
 | 
	
		
			
				|  |  |                                  CellMonitorDeviceType cellMonitorDeviceType = new CellMonitorDeviceType(insourcingData.AgreementParam);
 | 
	
	
		
			
				|  | @@ -1346,12 +1354,15 @@ namespace NB_IOT_TCP_HP_SOCKET
 | 
	
		
			
				|  |  |                                      {
 | 
	
		
			
				|  |  |                                          list.AddRange(item);
 | 
	
		
			
				|  |  |                                      }
 | 
	
		
			
				|  |  | +                                    meterHis[sourceNumber] = list;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                                  }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -                                // 保存抄表数据
 | 
	
		
			
				|  |  | -                                //ProtocolAnalysisTools.SaveRecord(list);
 | 
	
		
			
				|  |  | -                                ProtocolAnalysisTools.SaveRecordNew(list);
 | 
	
		
			
				|  |  | +                                if (cm.IsEnd)
 | 
	
		
			
				|  |  | +                                {
 | 
	
		
			
				|  |  | +                                    // 保存抄表数据
 | 
	
		
			
				|  |  | +                                    //ProtocolAnalysisTools.SaveRecord(list);
 | 
	
		
			
				|  |  | +                                    ProtocolAnalysisTools.SaveRecordNew(meterHis[sourceNumber]);
 | 
	
		
			
				|  |  | +                                }
 | 
	
		
			
				|  |  |                              }
 | 
	
		
			
				|  |  |                          }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -1389,7 +1400,8 @@ namespace NB_IOT_TCP_HP_SOCKET
 | 
	
		
			
				|  |  |                                  List<HistoryRecord> item = this.UpdateHistoryData(insourcingData.Recordtime, null, dt, _analogData, _switchData);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                                  // 保存抄表数据
 | 
	
		
			
				|  |  | -                                ProtocolAnalysisTools.SaveRecord(item);
 | 
	
		
			
				|  |  | +                                // ProtocolAnalysisTools.SaveRecord(item);
 | 
	
		
			
				|  |  | +                                ProtocolAnalysisTools.SaveRecordNew(item);
 | 
	
		
			
				|  |  |                              }
 | 
	
		
			
				|  |  |                          }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -1817,7 +1829,7 @@ namespace NB_IOT_TCP_HP_SOCKET
 | 
	
		
			
				|  |  |          public string AgreementParam { get; set; } // 设备协议参数
 | 
	
		
			
				|  |  |          public DateTime Recordtime { get; set; } // 数据接收时间
 | 
	
		
			
				|  |  |          public DataTable DT { get; set; } // 传输设备对应的设备信息及通讯设备信息
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +        public string SourceNumber { get; set; } // 源地址
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 |