陈勇
2026-04-06 9de6c7c6d835ba5161d64114d154bfc7676244a1
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
using StackExchange.Profiling.Internal;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime;
using System.Runtime.ConstrainedExecution;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Common.MES;
using WIDESEA_Core;
using WIDESEA_DTO;
using WIDESEA_StorageBasicRepository;
 
namespace WIDESEA_StoragIntegrationServices
{
    public partial class WCSService
    {
        /// <summary>
        /// 涂总精排点
        /// </summary>
        /// <param name="json"></param>
        /// <returns></returns>
        public WebResponseContent Queue(RequestTaskDto json)
        {
            WebResponseContent content = new WebResponseContent();
            try
            {
                //查找对应的PVI码车身信息
                var carinfo = _carBodyInfoRepository.QueryFirst(x => x.RFID == json.PVI);
                if (carinfo == null) throw new Exception($"{json.PVI}车身信息未找到");
                VINRespon respon = new VINRespon();
                if (!string.IsNullOrEmpty(carinfo.VIN))
                {
                    respon = new VINRespon
                    {
                        VIN = carinfo.VIN,
                        Color = carinfo.carBodyCharacteristic,
                        SkyLight = carinfo.skylightCharacteristic,
                        VechicleModel = carinfo.vehicleCharacteristic,
                    };
                    return content.OK(data: respon);
                }
 
                var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == json.Position);
                if (station == null) throw new Exception("站台未找到");
 
                //涂总工单绑定
                WebResponseContent webResponse = _mesService.bindWorkOrder("EL01RB01", json.PVI);
                if (!webResponse.Status) throw new Exception($"绑定失败:{webResponse.msg},请求信息:{json.ToJson()}");
 
                //过点信息
                WebResponseContent content1 = _mesService.PassPoint(json);
                if (!content1.Status) throw new Exception($"过点失败:{content1.msg},请求信息:{json.ToJson()}");
 
                //获取VIN号
                WebResponseContent responseContent = _mesService.getCharacteristic(json);
 
                if (!responseContent.Status) throw new Exception($"BDC请求车辆特征信息:{responseContent.msg},请求信息:{json.ToJson()}");
 
                respon = new VINRespon
                {
                    VIN = responseContent.Data.ToString().Substring(35, 17),
                    Color = carinfo.carBodyCharacteristic,
                    SkyLight = carinfo.skylightCharacteristic,
                    VechicleModel = carinfo.vehicleCharacteristic,
                };
 
                var mesLock = _mesLockInfoRepository.QueryFirst(x => x.carBodyID == carinfo.Id);
                if (mesLock != null)
                {
                    mesLock.LockStatue = 2;
                    _mesLockInfoRepository.UpdateData(mesLock);
                }
 
                content.OK(data: respon);
            }
            catch (Exception ex)
            {
                content.Error(ex.Message);
            }
            return content;
        }
    }
}