刘磊
2025-04-19 823752496e2a4cdb6a1fb36227cd15b8b7135336
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using AngleSharp.Dom;
using Mapster;
using Masuit.Tools;
using SqlSugar;
using System.Collections.Generic;
using System.Drawing.Printing;
using System.Linq.Expressions;
using WIDESEA.Common;
using WIDESEA_Common;
using WIDESEA_Core;
 
namespace WIDESEA_StorageBasicService;
 
public class Dt_CheckResultService : ServiceBase<Dt_CheckResult, IDt_CheckResultRepository>, IDt_CheckResultService
{
    public Dt_CheckResultService(IDt_CheckResultRepository BaseDal) : base(BaseDal)
    {
    }
 
    public static string ZY_CheckResultInterface = "http://172.21.1.117/barcode/Webservice/WebService_ZY/Service_EQP.asmx";
 
    public WebResponseContent HandUploadData(int id)
    {
        WebResponseContent content = new WebResponseContent();
        try
        {
            Dt_CheckResult checkResult = BaseDal.QueryFirst(x => x.ID == id);
            if (checkResult != null)
            {
                string ipaddress = ZY_CheckResultInterface + "/ReportToSCE";
 
                var dic = checkResult.ToDictionary();
                dic.Remove("ID");
                dic.Remove("IsUploadMES");
 
                RequestReportToSCE_ZY Info = new RequestReportToSCE_ZY { s_eqptno = "CL", s_source = JsonConvert.SerializeObject(dic) };
 
                var infos = Info.ToDictionary();
 
                var responStr = HttpsClient.PostXml(ipaddress, infos);
 
                Basic_ZY result = XMLSerializationTool.DeserializeXmlToObject<Basic_ZY>(responStr);
 
                if (result.FLAG != "S") throw new Exception($"上传信息失败:智粤接口返回失败:{result.ERROR}");
 
                checkResult.IsUploadMES = true;
                if (BaseDal.UpdateData(checkResult))
                {
                    content.OK();
                }
                else
                {
                    content.Error();
                }
            }
            return content;
        }
        catch (Exception ex)
        {
            return content.Error(ex.Message);
        }
    }
}