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); } } } }