MacCurrentStatusDal.cs 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. //using Cksoft.Data;
  2. //using Cksoft.Data.Repository;
  3. //using Cksoft.Unity;
  4. //using Microsoft.Extensions.Logging;
  5. //using System;
  6. //using System.Collections.Generic;
  7. //using System.Text;
  8. //using System.Threading.Tasks;
  9. //namespace DllEapDal.OFILM.SyncTask
  10. //{
  11. // /// <summary>
  12. // /// 机台当前状态
  13. // /// </summary>
  14. // public class MacCurrentStatusDal
  15. // {
  16. // /// <summary>
  17. // /// 获取机台最新状态
  18. // /// </summary>
  19. // /// <returns></returns>
  20. // public async Task SyncMacLastStatus()
  21. // {
  22. // var logger = AppConfigurtaionServices.MyLog;
  23. // try
  24. // {
  25. // logger.LogError("开始计算机台当前状态");
  26. // var dateNow = DateTime.Now;
  27. // string errorinfo = string.Empty;
  28. // using (IDatabase db = DbFactory.Base("eap"))
  29. // {
  30. // db.BeginTrans();
  31. // var lastStatus = await db.FindListForConditionAsync<MacStatus01>(string.Empty, ref errorinfo);
  32. // // var macLastStatusList = new List<MacLastStatus>();
  33. // foreach (var item in lastStatus)
  34. // {
  35. // var tmp = new MacLastStatus
  36. // {
  37. // MacCode = item.MacCode,
  38. // Flen = Convert.ToInt32((dateNow - item.STime).TotalSeconds),
  39. // Shift = (int)shift,
  40. // StatusId = item.StatusID,
  41. // RecTime = Convert.ToDateTime(dateNow.ToString("yyyy-MM-dd HH:mm:ss")),
  42. // FDate = Convert.ToDateTime(date),
  43. // STime = item.STime,
  44. // RunRate = null
  45. // };
  46. // // db.Insert<MacLastStatus>(tmp);
  47. // db.InsertFor(tmp, string.Empty);
  48. // // macLastStatusList.Add(tmp);
  49. // }
  50. // //if (db.Insert<MacLastStatus>(macLastStatusList) < 0)
  51. // //{
  52. // // AppConfigurtaionServices.MyLog.LogError("机台最后状态插入数据库失败");
  53. // // return;
  54. // //}
  55. // db.Commit();
  56. // }
  57. // logger.LogError("计算机台最后状态完成");
  58. // }
  59. // catch (Exception ex)
  60. // {
  61. // logger.LogError("计算机台最后状态错误," + ex.ToString());
  62. // throw;
  63. // }
  64. // }
  65. // }
  66. //}