Admin
5 天以前 bd6818fc9d40f343547bafca0743658f3c0379dc
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
85
86
87
88
89
using HslCommunication;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using WIDESEA_Common;
using WIDESEA_Common.Tools;
using WIDESEA_Core.Utilities;
using WIDESEA_Entity.DomainModels;
using WIDESEA_Services;
using WIDESEA_Services.IRepositories;
using WIDESEA_Services.Repositories;
using WIDESEA_Services.Services;
using WIDESEA_WCS.WCSClient;
 
namespace WIDESEA_WCS.Jobs.ConveyorLine.InboundArea
{
    public partial class InboundAreaDispatch
    {
        public static void CheckBarcodeAction(IDt_TaskWCSinfoRepository taskWCSinfoRepository, PLCClient client, string station)
        {
            //读取设备正常
            try
            {
                int taskNumber = int.Parse(client.ReadValue(CLineInfoDBName.R_Line_TaskNumber.ToString(), station).ToString());
                Dt_TaskWCSinfo wcsInfo = null;
                if (station == "30301")
                {
                    wcsInfo = taskWCSinfoRepository.FindFirst(x =>
                                (x.wcstask_type == TaskType.TaskType_Empty_Pallet_Inbound.ToString() || x.wcstask_type == TaskType.TaskType_Box_Pallet_Inbound.ToString())
                                && x.wcstask_state == TaskState.TaskState_ConveyorLineExecuting.ToString() && x.wcstask_taskNumber == taskNumber);
                    if (wcsInfo == null)
                    {
                        //继续看下是不是测量回库的任务
                        wcsInfo = taskWCSinfoRepository.FindFirst(x =>
                                 x.wcstask_type == TaskType.TaskType_Box_Pallet_Measure_Back.ToString() &&
                                 x.wcstask_state == TaskState.TaskState_Measure_Back_Line_Executing.ToString() &&
                                 x.wcstask_taskNumber == taskNumber);
                    }
                }
                else
                {
                    wcsInfo = taskWCSinfoRepository.FindFirst(x => x.wcstask_state == TaskState.TaskState_Measure_Out_Line_Executing.ToString() &&
                                 x.wcstask_type == TaskType.TaskType_Box_Pallet_Measure_Out.ToString() &&
                                 x.wcstask_taskNumber == taskNumber);//  
                }
 
                if (wcsInfo != null)
                {
                    //读取RFID值
                    string rfidResult = client.ReadValue(CLineInfoDBName.R_Line_RFID_OK.ToString(), station).ToString();
                    if (wcsInfo.wcstask_barcode != rfidResult.ToString())
                    {
                        string str = string.Empty;
                        //说明托盘不一致,需要在前端进行提示
                        //Console.WriteLine($"::Wanring::检测入库任务在托盘检验站台,入库托盘号:【{wcsInfo.wcstask_barcode}】,与RFID读取到的【{rfidResult1.Content}】,不一致!!");
                        //把情报告诉WMS
                        WebResponseContent content = WMSApi.PostRFIDNoMatch(wcsInfo.wcstask_barcode, rfidResult, wcsInfo.wcstask_taskNumber.ToString(), station);
                        if (content.Status)
                            str = $"{DateTime.Now}检查托盘信息上报WMS成功,站台:{station},托盘号:{wcsInfo.wcstask_barcode},RFID:{rfidResult}";
                        else
                            str = $"{DateTime.Now}检查托盘信息上报WMS失败,站台:{station},托盘号:{wcsInfo.wcstask_barcode},RFID:{rfidResult},错误:{content.Message}";
 
                        WriteLog.Info(station).Write(str, station);
                    }
                    else
                    {
                        string str = $"{DateTime.Now}检查托盘成功,站台:{station},托盘号:{wcsInfo.wcstask_barcode},RFID:{rfidResult}";
                        WriteLog.Info(station).Write(str, station);
                    }
 
                    //说明一致,通知线体继续往前走
                    bool goOn = client.WriteValue(CLineInfoDBName.W_Line_RFID_Done.ToString(), station, 1);
                    if (goOn)
                    {
                        wcsInfo.wcstask_backUp_1 = "checked";
                        taskWCSinfoRepository.Update(wcsInfo, true);
                    }
                }
 
            }
            catch (Exception ex)
            {
                WriteLog.Info(station).Write($"托盘确认调度失败:{ex.Message}", station);
            }
        }
    }
 
}