Example #1
0
 /// <summary>
 /// 记录标签值
 /// </summary>
 /// <param name="tagSetting">标签配置信息</param>
 /// <param name="tagValue">标签值</param>
 private void TagValueRecord(FmsAssetTagSetting tagSetting, string tagValue)
 {
     lock (lockRecord)
     {
         try
         {
             EventLogger.Log($"======开始写入【{tagSetting.TAG_VALUE_NAME}】Record=====");
             FmsSamplingRecord record = new FmsSamplingRecord
             {
                 PKNO             = CBaseData.NewGuid(),
                 ASSET_CODE       = tagSetting.ASSET_CODE,
                 TAG_SETTING_PKNO = tagSetting.PKNO,
                 TAG_VALUE_NAME   = tagSetting.TAG_VALUE_NAME,
                 TAG_VALUE        = tagValue,
                 SAMPLING_TIME    = DateTime.Now,
                 CREATION_DATE    = DateTime.Now,
                 CREATED_BY       = CBaseData.LoginName,
                 REMARK           = "",
             };
             ws.UseService(s => s.AddFmsSamplingRecord(record));
             EventLogger.Log($"======完成写入【{tagSetting.TAG_VALUE_NAME}】Record=====");
         }
         catch (Exception ex)
         {
             EventLogger.Log($"!!!!!!写入【{tagSetting.TAG_VALUE_NAME}】Record失败,原因:{ex.Message}!!!!!!");
         }
     }
 }
Example #2
0
        private void Timer5_Elapsed(object sender, ElapsedEventArgs e)
        {
            this.timer5.Enabled = false;

            WcfClient <IFMSService> ws = new WcfClient <IFMSService>();

            //try
            //{
            lock (objLock)
            {
                FmsSamplingRecord record = new FmsSamplingRecord()
                {
                    PKNO             = CBaseData.NewGuid(),
                    ASSET_CODE       = "A20002",
                    SAMPLING_TIME    = DateTime.Now,
                    TAG_SETTING_PKNO = "fe0e40d4bb57424088c1876bba50f229",
                    TAG_VALUE_NAME   = "测试",
                    TAG_VALUE        = (new Random()).Next(100).ToString(),
                    CREATED_BY       = CBaseData.LoginName,
                    CREATION_DATE    = DateTime.Now,
                    REMARK           = "",
                };
                ws.UseService(s => s.AddFmsSamplingRecord(record));
            }
            //}
            //catch (Exception ex)
            //{
            //    Console.WriteLine(ex.Message);
            //}
            Console.WriteLine($"3Thread Write{iWriteTest2++}");
            this.timer5.Enabled = true;
        }
Example #3
0
 /// <summary>
 /// 根据关键字段的值获取记录
 /// </summary>
 /// <param name="Id">关键字段的值</param>
 /// <returns>符合查询条件的记录</returns>
 public FmsSamplingRecord GetFmsSamplingRecordById(string Id)
 {
     using (IFmsSamplingRecordBLL FmsSamplingRecordBLL = BLLContainer.Resolve <IFmsSamplingRecordBLL>())
     {
         FmsSamplingRecord model = FmsSamplingRecordBLL.GetFirstOrDefault(Id);
         return(model);
     }
 }
Example #4
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="mFmsSamplingRecord">模型</param>
 /// <returns>是否成功</returns>
 public bool UpdateFmsSamplingRecord(FmsSamplingRecord mFmsSamplingRecord)
 {
     if (mFmsSamplingRecord == null)
     {
         return(false);
     }
     using (IFmsSamplingRecordBLL FmsSamplingRecordBLL = BLLContainer.Resolve <IFmsSamplingRecordBLL>())
     {
         return(FmsSamplingRecordBLL.Update(mFmsSamplingRecord));
     }
 }
Example #5
0
 /// <summary>
 /// 按照关键字段删除
 /// </summary>
 /// <param name="Id">关键字段</param>
 /// <returns>是否成功</returns>
 public bool DelFmsSamplingRecord(string Id)
 {
     using (IFmsSamplingRecordBLL FmsSamplingRecordBLL = BLLContainer.Resolve <IFmsSamplingRecordBLL>())
     {
         try
         {
             FmsSamplingRecord item = FmsSamplingRecordBLL.GetFirstOrDefault(Id);
             return(FmsSamplingRecordBLL.Delete(item));
         }
         catch { return(false); }
     }
 }
Example #6
0
 /// <summary>
 /// 按照关键字段删除
 /// </summary>
 /// <param name="Ids">关键字段数组</param>
 /// <returns>是否成功</returns>
 public bool DelFmsSamplingRecords(string[] Ids)
 {
     using (IFmsSamplingRecordBLL FmsSamplingRecordBLL = BLLContainer.Resolve <IFmsSamplingRecordBLL>())
     {
         try
         {
             List <FmsSamplingRecord> entitys = new List <FmsSamplingRecord>();
             foreach (string id in Ids)
             {
                 FmsSamplingRecord item = FmsSamplingRecordBLL.GetFirstOrDefault(id);
                 entitys.Add(item);
             }
             return(FmsSamplingRecordBLL.Delete(entitys));
         }
         catch { return(false); }
     }
 }