刘磊
2025-11-17 efbeb93b3d454f06d65dbcc68ad828cc95bc9404
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
using AngleSharp.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Common;
using WIDESEA_Common.MES.Request;
using WIDESEA_Core;
using WIDESEA_Core.Const;
using WIDESEA_Core.Helper;
using WIDESEAWCS_BasicInfoService;
using WIDESEAWCS_Model.Models;
 
namespace WIDESEA_StoragIntegrationServices
{
    /// <summary>
    /// 车身绑定工单(焊装直通涂装)
    /// </summary>
    public partial class MESService
    {
        public WebResponseContent bindWorkOrder(string stationCode)
        {
            WebResponseContent content = new WebResponseContent();
            try
            {
                var configs = _configService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_MESIPAddress);
                var wmsBase = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.MESIPAddress)?.ConfigValue;
                var ipAddress = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.bindWorkOrder)?.ConfigValue;
                if (wmsBase == null || ipAddress == null)
                {
                    throw new InvalidOperationException("WMS IP 未配置");
                }
                var wmsIpAddress = wmsBase + ipAddress;
 
                var stationInfo = _stationManagerRepository.QueryFirst(x => x.stationChildCode == stationCode);
 
                BindWorkOrder passPoint = new BindWorkOrder()
                {
                    unionKey = Guid.NewGuid().ToString(),
                    stationCode = stationInfo.stationChildCode,
                    messageTime = DateTime.Now.ToString(),
                    plantCode = "1022",
                    pvi = "",
                    workOrderNo = "",
                    workOrderType = "",
                    workshopCode = ""
                };
 
                var MESrespon = HttpHelper.Post(wmsIpAddress, passPoint.ToJson());
 
                return content;
            }
            catch (Exception ex)
            {
                return content.Error(ex.Message);
            }
        }
    }
}