MachineMaterialMstController.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. using Cksoft.Data;
  2. using Cksoft.Data.Repository;
  3. using Cksoft.Unity;
  4. using Cksoft.Unity.Log4NetConfig;
  5. using DllEapDal.OFILM;
  6. using DllEapEntity.OFILM;
  7. using Microsoft.AspNetCore.Mvc;
  8. using Microsoft.Extensions.Configuration;
  9. using System;
  10. using System.Collections.Generic;
  11. using System.Linq;
  12. using System.Text;
  13. namespace DllEapBll.OFILM
  14. {
  15. [Route("eap/api/[controller]/[action]")]
  16. public class MachineMaterialMstController : ControllerBase
  17. {
  18. public IConfiguration Configuration { get; set; }
  19. public MachineMaterialMstController(IConfiguration configuration)
  20. {
  21. Configuration = configuration;
  22. }
  23. [HttpPost]
  24. public EapResponse Upload([FromBody] EapMacUploadModel uploadInfo)
  25. {
  26. var res = new EapResponse { Code = 1, Msg = string.Empty };
  27. string errorinfo = string.Empty;
  28. if (uploadInfo == null || uploadInfo.Files == null || uploadInfo.Files.Count() <= 0)
  29. {
  30. res.Code = -1;
  31. res.Msg = "上传内容为空";
  32. return res;
  33. }
  34. var service = new MachineMaterialService();
  35. if (service.UploadTrans(uploadInfo, ref errorinfo) < 0)
  36. {
  37. res.Code = -1;
  38. res.Msg = errorinfo;
  39. return res;
  40. }
  41. return res;
  42. }
  43. [HttpPost]
  44. public EapResponse UploadLHA([FromBody] LHAMachineModel uploadInfo)
  45. {
  46. LogHelper<MachineMaterialService>.LogError($"准备", "LHA数据采集", string.Empty);
  47. var res = new EapResponse { Code = 1, Msg = string.Empty };
  48. string errorinfo = string.Empty;
  49. if (uploadInfo == null || uploadInfo.Postbondviews == null || uploadInfo.Postbondviews.Count() <= 0)
  50. {
  51. res.Code = -1;
  52. res.Msg = "上传内容为空";
  53. return res;
  54. }
  55. var service = new MachineMaterialService();
  56. if (service.UploadTableTrans(uploadInfo, ref errorinfo) < 0)
  57. {
  58. res.Code = -1;
  59. res.Msg = errorinfo;
  60. return res;
  61. }
  62. return res;
  63. }
  64. public string GetPostbondViewMaxTime(string macCode)
  65. {
  66. using (IDatabase db = DbFactory.Base("eap"))
  67. {
  68. var dal = new CodelinkDal(db);
  69. string errorinfo = "";
  70. return dal.GetPostbondView(macCode,ref errorinfo);
  71. }
  72. }
  73. }
  74. }