using MES.Service.service.Kingdee;
|
using MES.Service.service.Warehouse;
|
using Microsoft.AspNetCore.Mvc;
|
using NewPdaSqlServer.entity;
|
using NewPdaSqlServer.util;
|
using System.Dynamic;
|
|
|
namespace NewPdaSqlServer.Controllers.Warehouse;
|
|
|
[ApiController]
|
[Route("api/[controller]")]
|
public class MesSuppScController : ControllerBase
|
{
|
private readonly MesSuppScManager kc = new();
|
private readonly string METHOD = "POST";
|
private readonly string TableName = "MES_SUPPSCORE";
|
private readonly string URL = "http://localhost:10054/api/ErpKc/";
|
|
|
//
|
[HttpPost("Save")]
|
public async Task<ResponseResult> Save()
|
{
|
try
|
{
|
// 从远端读取并保存
|
var ok = await Task.Run(() => kc.FetchAndSaveFromUrl());
|
if (!ok)
|
throw new Exception("保存失败:无数据或插入数据库失败");
|
|
return new ResponseResult
|
{
|
status = 0,
|
message = "OK",
|
data = (object)null
|
};
|
}
|
catch (Exception ex)
|
{
|
return ResponseResult.ResponseError(ex);
|
}
|
}
|
}
|