/// <summary> 获取上传协议 /// </summary> /// <param name="dr">数据行</param> /// <param name="dbName">帐套</param> /// <returns></returns> private static FileProtocol GetProtocol(DataRow dr, string dbName) { if (!htTable.ContainsKey(dr.Table.TableName)) { return null; } var fp = new FileProtocol {StationId = GlobalStaticObj_Server.Instance.StationID}; //根据表名得到子消息ID if (htTable[dr.Table.TableName] is ProtocolValue) { fp.SubMessageId = (htTable[dr.Table.TableName] as ProtocolValue).MessageId; } else { fp.SubMessageId = htTable[dr.Table.TableName].ToString(); } fp.TimeSpan = TimeHelper.GetTimeInMillis(); //Json对象 var json = JsonHelper.DataTableToJson(dr, fp.StationId, dbName,true); json = BaseCodeHelper.EnCode(json); fp.Json = json; return fp; }
/// <summary> 附件数据处理 /// </summary> /// <param name="protocol"></param> public static void Deal(FileProtocol protocol) { }
/// <summary> 写入错误日志 /// </summary> /// <param name="protocol">上传文件协议</param> public static void WriteErrorLog(FileProtocol protocol) { string msg = string.Empty; if (htTable.ContainsKey(protocol.SubMessageId)) { string tableName = string.Empty; //表名: foreach (DictionaryEntry de in htTable) { if (de.Value.ToString() == protocol.SubMessageId) { tableName = de.Key.ToString(); break; } } msg += "表名:" + tableName + "\r\n"; } msg += "标识:" + protocol.StationId + protocol.SerialNumber + protocol.TimeSpan + "\r\n"; msg += "时间:" + TimeHelper.MillisToTime(protocol.TimeSpan) + "\r\n"; msg += "服务站ID:" + protocol.StationId + "\r\n"; msg += "内容:" + ProtocolTranslator.SerilizeMessage(protocol); //写错误日志 Log.writeCloudLog(msg); }