cdk
2025-11-27 53c7de340f55ab0c917a03d54d883b4a8082f42d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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);
        }
    }
}