123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- using Cksoft.Data;
- using Cksoft.Data.Repository;
- using Cksoft.Unity;
- using Cksoft.Unity.Log4NetConfig;
- using DllEapDal.OFILM;
- using DllEapEntity.OFILM;
- using Microsoft.AspNetCore.Mvc;
- using Microsoft.Extensions.Configuration;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- namespace WebApplet.Controllers
- {
- [Route("eap/api/[controller]/[action]")]
- public class MachineMaterialMstController : ControllerBase
- {
- //public IActionResult Index()
- //{
- // return View();
- //}
- public IConfiguration Configuration { get; set; }
- public MachineMaterialMstController(IConfiguration configuration)
- {
- Configuration = configuration;
- }
- [HttpPost]
- public EapResponse Upload([FromBody] EapMacUploadModel uploadInfo)
- {
- var res = new EapResponse { Code = 1, Msg = string.Empty };
- string errorinfo = string.Empty;
- if (uploadInfo == null || uploadInfo.Files == null || uploadInfo.Files.Count() <= 0)
- {
- res.Code = -1;
- res.Msg = "上传内容为空";
- return res;
- }
- var service = new MachineMaterialService();
- if (service.UploadTrans(uploadInfo, ref errorinfo) < 0)
- {
- res.Code = -1;
- res.Msg = errorinfo;
- return res;
- }
- res.Msg = errorinfo;
- return res;
- }
- [HttpPost]
- public EapResponse UploadLHA([FromBody] LHAMachineModel uploadInfo)
- {
- LogHelper<MachineMaterialService>.LogError($"准备", "LHA数据采集", string.Empty);
- var res = new EapResponse { Code = 1, Msg = string.Empty };
- string errorinfo = string.Empty;
- if (uploadInfo == null || uploadInfo.Postbondviews == null || uploadInfo.Postbondviews.Count() <= 0)
- {
- res.Code = -1;
- res.Msg = "上传内容为空";
- return res;
- }
- var service = new MachineMaterialService();
- if (service.UploadTableTrans(uploadInfo, ref errorinfo) < 0)
- {
- res.Code = -1;
- res.Msg = errorinfo;
- return res;
- }
- return res;
- }
- public string GetPostbondViewMaxTime(string macCode)
- {
- using (IDatabase db = DbFactory.Base("eap"))
- {
- var dal = new CodelinkDal(db);
- string errorinfo = "";
- return dal.GetPostbondView(macCode, ref errorinfo);
- }
- }
- [HttpGet]
- public IEnumerable<MachineMaterialMst> Get(string filter)
- {
- using (IDatabase db = DbFactory.Base("eapslave"))
- {
- var dal = new MachineMaterialMstDal(db);
- string errorinfo = "";
- return dal.Get(filter,ref errorinfo);
- }
- }
- }
- }
|