using ConsoleApp1;
|
using MES.Service.service.PLM;
|
using MES.Service.util;
|
using Microsoft.AspNetCore.Mvc;
|
using System.Dynamic;
|
using System.IO;
|
|
namespace MESApplication.Controllers.PLM;
|
|
|
[ApiController]
|
[Route("api/PLM")]
|
public class PLMController : ControllerBase
|
{
|
private readonly PLMManager m = new();
|
private readonly WarehouseDownloadDoc wdd = new();
|
|
//RetrieveDrawings 调取图纸
|
[HttpPost("RetrieveDrawings")]
|
public ResponseResult RetrieveDrawings(string ItemNo)
|
{
|
try
|
{
|
dynamic resultInfos = new ExpandoObject();
|
resultInfos = m.RetrieveDrawings(ItemNo);
|
|
return new ResponseResult
|
{
|
status = 0,
|
message = "OK",
|
data = resultInfos
|
};
|
}
|
catch (Exception ex)
|
{
|
return ResponseResult.ResponseError(ex);
|
}
|
}
|
|
//RetrieveDrawings 调取图纸
|
[HttpPost("OpenDrawings")]
|
public IActionResult OpenDrawings(string fileId,string fName)
|
{
|
try
|
{
|
var resultInfos = wdd.SendRequest("Download", fileId);
|
|
return File(resultInfos, "application/octet-stream", fName);
|
}
|
catch (Exception ex)
|
{
|
return StatusCode(500, new ResponseResult
|
{
|
status = 1,
|
message = ex.Message,
|
data = null
|
});
|
}
|
}
|
}
|