| | |
| | | using AutoMapper; |
| | | using Newtonsoft.Json; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.Math; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.Text; |
| | | using OfficeOpenXml.Packaging.Ionic.Zip; |
| | | using Quartz; |
| | | using SqlSugar; |
| | | using StackExchange.Profiling.Internal; |
| | | using System; |
| | | using System.Collections.Generic; |
| | |
| | | using WIDESEAWCS_ITaskInfoService; |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_QuartzJob; |
| | | using WIDESEAWCS_QuartzJob.DeviceBase; |
| | | using WIDESEAWCS_QuartzJob.DTO; |
| | | using WIDESEAWCS_QuartzJob.Models; |
| | | using WIDESEAWCS_QuartzJob.Service; |
| | |
| | | |
| | | public Task Execute(IJobExecutionContext context) |
| | | { |
| | | |
| | | try |
| | | { |
| | | CommonConveyorLine conveyorLine = (CommonConveyorLine)context.JobDetail.JobDataMap.Get("JobParams"); |
| | | if (conveyorLine != null) |
| | | { |
| | | WriteLog.GetLog("Jobæ¥å¿è¿è¡").Write(conveyorLine.DeviceCode + "è¿è¡æ¥å¿ï¼å¼å§æ¶é´" + DateTime.Now, "Jobæ¥å¿è¿è¡"); |
| | | if (conveyorLine.DeviceCode == "1002") |
| | | { |
| | | RequestInbound(conveyorLine); //䏿¥¼C,Båºä¸å¡ |
| | | } |
| | | if (conveyorLine.DeviceCode == "1003") |
| | | { |
| | | RequestInbound2(conveyorLine); |
| | | } |
| | | if (conveyorLine.DeviceCode == "1004") |
| | | { |
| | | RequestInbound3(conveyorLine); //䏿¥¼C,Båºä¸å¡ |
| | | } |
| | | |
| | | RequestInbound(conveyorLine); //æ£æµå
¥æå£ä¿¡æ¯ |
| | | RequestInNextAddress(conveyorLine); |
| | | |
| | | |
| | | } |
| | | WriteLog.GetLog("Jobæ¥å¿è¿è¡").Write(conveyorLine.DeviceCode + "è¿è¡æ¥å¿ï¼ç»ææ¶é´" + DateTime.Now, "Jobæ¥å¿è¿è¡"); |
| | | //RequestInNextAddress(conveyorLine); |
| | | |
| | | |
| | | } |
| | |
| | | return Task.CompletedTask; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è¾é线请æ±å
¥åºå°åªä¸ªå··é |
| | | /// </summary> |
| | | /// <param name="conveyorLine">è¾é线å®ä¾å¯¹è±¡</param> |
| | | /// <param name="command">读åç请æ±ä¿¡æ¯</param> |
| | | /// <param name="childDeviceCode">å设å¤ç¼å·</param> |
| | | public void RequestInbound(CommonConveyorLine conveyorLine) |
| | | { |
| | | HandleEvent(conveyorLine, "PLC_WCS_B.03_EVENT", "PLC_WCS_B.03_PLC_LPN", "PLC_WCS_B.03_WCS_TO"); |
| | | HandleEvent(conveyorLine, "PLC_WCS_C.02_EVENT", "PLC_WCS_C.02_PLC_LPN", "PLC_WCS_C.02_WCS_TO"); |
| | | |
| | | |
| | | CheckForEmptyPallet(conveyorLine,"PLC_WCS_B.01_EVENT"); |
| | | CheckForEmptyPallet(conveyorLine,"PLC_WCS_C.01_EVENT"); |
| | | |
| | | // å¤ç B ç«å°äºä»¶ |
| | | ProcessConveyorEvent(conveyorLine, "PLC_WCS_B.01_EVENT", "PLC_WCS_B.01_PLC_LPN", "B1", "R01-003-027-001-01"); |
| | | |
| | | // å¤ç C ç«å°äºä»¶ |
| | | ProcessConveyorEvent(conveyorLine, "PLC_WCS_C.03_EVENT", "PLC_WCS_C.03_PLC_LPN", "C7", "R01-003-041-001-01"); |
| | | //1楼è¾éçº¿å¤æ |
| | | HandleEvent2(conveyorLine, "PLC_WCS_B._03_PLC_EVENT", "PLC_WCS_B._03_PLC_LPN", "WCS_PLC_B._03_WCS_TO"); //夿巷é |
| | | HandleEvent2(conveyorLine, "PLC_WCS_C._02_PLC_EVENT", "PLC_WCS_C._02_PLC_LPN", "WCS_PLC_C._02_WCS_TO"); //夿巷é |
| | | CheckForEmptyPallet(conveyorLine, "PLC_WCS_B._02_PLC_EVENT", "PLC_WCS_B._02_PLC_LPN", "PLC_WCS_B._02_PLC_PUT", "R02-002-027-001-01"); //夿æ¯å¦å空æåºåº |
| | | CheckForEmptyPallet(conveyorLine, "PLC_WCS_C._01_PLC_EVENT", "PLC_WCS_C._01_PLC_LPN", "PLC_WCS_C._01_PLC_PUT", "R01-002-041-001-01"); //夿æ¯å¦å空æåºåº |
| | | ProcessConveyorEvent(conveyorLine, "PLC_WCS_B._01_PLC_EVENT", "PLC_WCS_B._01_PLC_LPN", "R02-003-027-001-01", "WCS_PLC_B._03_WCS_TO");// å¤ç B |
| | | ProcessConveyorEvent(conveyorLine, "PLC_WCS_C._03_PLC_EVENT", "PLC_WCS_C._03_PLC_LPN", "R01-003-041-001-01", "WCS_PLC_C._02_WCS_TO");// å¤ç C |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 夿åºåºç«å°æ¯å¦éè¦ç©ºæ |
| | | /// </summary> |
| | | /// <param name="conveyorLine">è¾é线å®ä¾å¯¹è±¡</param> |
| | | /// <param name="command">读åç请æ±ä¿¡æ¯</param> |
| | | /// <param name="childDeviceCode">å设å¤ç¼å·</param> |
| | | public void ConveyorLineInFinish(CommonConveyorLine conveyorLine) |
| | | public void RequestInbound2(CommonConveyorLine conveyorLine) |
| | | { |
| | | |
| | | //顶楼楼è¾éçº¿å¤æ |
| | | |
| | | ProcessConveyorEvent(conveyorLine, "PLC_WCS_D._01_PLC_EVENT", "PLC_WCS_D._01_PLC_LPN", "R01-003-041-011-01", "WCS_PLC_D._01_WCS_TO");// å¤ç 1å··é ç«å°äºä»¶å
¥ç©º |
| | | ProcessConveyorEvent(conveyorLine, "PLC_WCS_D._03_PLC_EVENT", "PLC_WCS_D._03_PLC_LPN", "R02-003-027-011-01", "WCS_PLC_D._03_WCS_TO");// å¤ç 2å··é ç«å°äºä»¶ å
¥ç©º |
| | | |
| | | //ConveyorLineInFinish(conveyorLine, "R02-002-027-011-01"); //åå
¥è¾é线å»å |
| | | |
| | | //CheckForEmptyPallet2(conveyorLine, "PLC_WCS_D._02_PLC_EVENT", "PLC_WCS_D._02_PLC_LPN", "PLC_WCS_D._02_PLC_PUT", "R02-002-027-011-01"); //åææåºåº è¯»åæ¡ç éåºåºåºåº |
| | | //CheckForEmptyPallet2(conveyorLine, "PLC_WCS_D._04_PLC_EVENT", "PLC_WCS_D._04_PLC_LPN", "PLC_WCS_D._04_PLC_PUT", "R01-002-041-011-01"); //åææåºåº è¯»åæ¡ç éåºåºåºåº |
| | | } |
| | | |
| | | public void RequestInbound3(CommonConveyorLine conveyorLine) |
| | | { |
| | | ProcessConveyorEvent(conveyorLine, "PLC_WCS_A._02_PLC_EVENT", "PLC_WCS_A._02_PLC_LPN", "R01-002-043-001-01", "WCS_PLC_A._02_WCS_TO");// å¤ç A21 ç«å°äºä»¶å
¥åº |
| | | |
| | | ProcessConveyorEvent(conveyorLine, "PLC_WCS_A._03_PLC_EVENT", "PLC_WCS_A._03_PLC_LPN", "R01-002-042-001-01", "WCS_PLC_A._03_WCS_TO");// å¤ç A22 ç«å°äºä»¶ å
¥æ |
| | | } |
| | | |
| | | public void ConveyorLineInFinish(CommonConveyorLine conveyorLine, string SCAddress) |
| | | { |
| | | DeviceProDTO? deviceProDTO2 = GetDeviceProDTO(conveyorLine, SCAddress, "R_StackerCraneLowered"); //读åè¾é线 âå åæºæ¾ä¸â ä¿¡å· |
| | | if (deviceProDTO2 != null) |
| | | { |
| | | byte strsd = GetLine(conveyorLine, deviceProDTO2.DeviceChildCode); |
| | | if (strsd == 1) |
| | | { |
| | | Dt_Task task = _taskService.IngStackerCraneTask2(conveyorLine.DeviceCode); |
| | | if (task != null && task.TaskType == (int)TaskOutboundTypeEnum.Outbound) |
| | | { |
| | | byte PLCtypeTo = 1; |
| | | if (task.TargetAddress == "R02-002-027-011-01") |
| | | { |
| | | PLCtypeTo = 2; |
| | | } |
| | | DeviceProDTO? deviceProDTO3 = GetDeviceProDTO(conveyorLine, SCAddress, "W_PalletBarcode"); //åå
¥æ¡ç |
| | | DeviceProDTO? deviceProDTO4 = GetDeviceProDTO(conveyorLine, SCAddress, "W_PalletLayers"); //屿° |
| | | DeviceProDTO? deviceProDTO5 = GetDeviceProDTO(conveyorLine, SCAddress, "W_PalletType"); //ç±»å |
| | | DeviceProDTO? deviceProDTO6 = GetDeviceProDTO(conveyorLine, SCAddress, "W_Destination"); //ç±»å |
| | | if (deviceProDTO3 != null && deviceProDTO4 != null && deviceProDTO5 != null && deviceProDTO6 != null) |
| | | { |
| | | if (SetLinestring(conveyorLine, deviceProDTO3.DeviceProDataBlock, task.PalletCode) && SetLine(conveyorLine, deviceProDTO4.DeviceProDataBlock, (byte)task.PalletCodequantity) && SetLine(conveyorLine, deviceProDTO5.DeviceProDataBlock, PLCtypeTo) && SetLine(conveyorLine, deviceProDTO6.DeviceProDataBlock, (byte)task.PLCTo)) |
| | | { |
| | | |
| | | LogSignalStatus($"åå
¥æ¾è´§å®æä¿¡æ¯ï¼æçæ¡ç ï¼å±æ°ï¼ç±»åä¿¡æ¯æå", deviceProDTO2.DeviceChildCode); |
| | | |
| | | } |
| | | else |
| | | { |
| | | LogSignalStatus($"åå
¥æ¾è´§å®æä¿¡æ¯ï¼æçæ¡ç ï¼å±æ°ï¼ç±»åä¿¡æ¯å¤±è´¥", deviceProDTO2.DeviceChildCode); |
| | | |
| | | } |
| | | } |
| | | else |
| | | { |
| | | LogSignalStatus($"æªæ¾å°è¾é线å议信æ¯", task.TargetAddress); |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | //è·åè¾é线å®ä¾ |
| | | public DeviceProDTO? GetDeviceProDTO(CommonConveyorLine conveyorLine, string SCAddress, string Interactivet) |
| | | { |
| | | return conveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == SCAddress && x.DeviceProParamName == Interactivet); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ç¨äºå
¥åºå¤æå··é |
| | |
| | | /// <param name="eventTag"></param> |
| | | /// <param name="barcodeTag"></param> |
| | | /// <param name="writeTag"></param> |
| | | private void HandleEvent(CommonConveyorLine conveyorLine,string eventTag, string barcodeTag, string writeTag) |
| | | private void HandleEvent(CommonConveyorLine conveyorLine, string eventTag, string barcodeTag, string writeTag) |
| | | { |
| | | int events = conveyorLine.Communicator.Read<int>(eventTag); // 读åäºä»¶ |
| | | try |
| | | { |
| | | byte events = conveyorLine.Communicator.Read<byte>(eventTag); // 读åäºä»¶ |
| | | if (events == 1) |
| | | { |
| | | string barcode = conveyorLine.Communicator.Read<string>(barcodeTag); // è¯»åæ¡ç |
| | | if (barcode != "1" || barcode != "0") |
| | | { |
| | | if ((_taskService.ToPlatform(barcode)).Status) |
| | | { |
| | | if (conveyorLine.Communicator.Read<string>("PLC_WCS_B._01_PLC_LPN") == "") |
| | | { |
| | | // åå
¥å»å2å·å åæº |
| | | bool result = conveyorLine.Communicator.Write(writeTag, (byte)3); //åææå»å |
| | | if (result) |
| | | { |
| | | WriteLog.GetLog("PLCæ¥å¿").Write("åå
¥å»åï¼3", "å»å"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | if (barcode == "1") |
| | | { |
| | | // åå
¥å»å2å·å åæº |
| | | bool result = conveyorLine.Communicator.Write(writeTag, (byte)1); //空æå»å |
| | | if (result) |
| | | { |
| | | WriteLog.GetLog("PLCæ¥å¿").Write("空æå
¥åºï¼åå
¥å»åï¼1", "å»å"); |
| | | } |
| | | } |
| | | /*else |
| | | { |
| | | // åå
¥å»å1å·å åæº |
| | | bool result = conveyorLine.Communicator.Write(writeTag, (byte)1); |
| | | if (result) |
| | | { |
| | | WriteLog.GetLog("PLCæ¥å¿").Write("åå
¥å»åï¼2", "å»å"); |
| | | } |
| | | |
| | | WriteLog.GetLog("PLCæ¥å¿").Write("å
¥åºå¤±è´¥", "å
¥åºç»ç"); |
| | | }*/ |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | throw; |
| | | } |
| | | } |
| | | |
| | | //æ°çå··é夿 |
| | | private void HandleEvent2(CommonConveyorLine conveyorLine, string eventTag, string barcodeTag, string writeTag) |
| | | { |
| | | byte events = conveyorLine.Communicator.Read<byte>(eventTag); // 读åäºä»¶ |
| | | if (events == 1) |
| | | { |
| | | string barcode = conveyorLine.Communicator.Read<string>(barcodeTag).Trim(); // è¯»åæ¡ç |
| | | if (barcode != "1" || barcode != "0") |
| | | { |
| | | WebResponseContent content = _taskService.ToPlatform(barcode); |
| | | if (content != null) |
| | | { |
| | | if (content.Status) |
| | | { |
| | | if (content.Data != null) |
| | | { |
| | | if (content.Data.ToString() == "1") |
| | | { |
| | | if (conveyorLine.Communicator.Read<string>("PLC_WCS_C._03_PLC_LPN") == "") |
| | | { |
| | | // åå
¥å»å2å·å åæº |
| | | bool result = conveyorLine.Communicator.Write(writeTag, (byte)1); //åå
¥å»å为é¿å··é |
| | | if (result) |
| | | { |
| | | WriteLog.GetLog("PLCæ¥å¿").Write($"æ¡ç {barcode}ï¼åå
¥å»åï¼1", "å»å"); |
| | | } |
| | | } |
| | | } |
| | | else if (content.Data.ToString() == "3") |
| | | { |
| | | |
| | | if (conveyorLine.Communicator.Read<string>("PLC_WCS_B._01_PLC_LPN") == "") |
| | | { |
| | | // åå
¥å»å2å·å åæº |
| | | bool result = conveyorLine.Communicator.Write(writeTag, (byte)3); //åå
¥å»å为çå··é |
| | | if (result) |
| | | { |
| | | WriteLog.GetLog("PLCæ¥å¿").Write($"æ¡ç {barcode},åå
¥å»åï¼3", "å»å"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | WriteLog.GetLog("PLCæ¥å¿").Write($"失败信æ¯ï¼{content.Message}", "å»å失败信æ¯"); |
| | | } |
| | | } |
| | | } |
| | | else if (barcode == "1") |
| | | { |
| | | bool result = conveyorLine.Communicator.Write(writeTag, (byte)1); //空æå»å |
| | | if (result) |
| | | { |
| | | WriteLog.GetLog("PLCæ¥å¿").Write("空æå
¥åºï¼åå
¥å»åï¼1", "å»å"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | //ç¨äºå¤ææ¯å¦è¡¥ç©ºæ Aåº |
| | | private void CheckForEmptyPallet(CommonConveyorLine conveyorLine, string eventTag, string barcodeTag, string plcput, string Loc) |
| | | { |
| | | |
| | | try |
| | | { |
| | | Byte events = conveyorLine.Communicator.Read<Byte>(eventTag); // 读åäºä»¶ |
| | | if (events == 1) //1为空ï¼0为æ |
| | | { |
| | | string barcode = conveyorLine.Communicator.Read<string>(barcodeTag); // è¯»åæ¡ç |
| | | if (barcode == "") |
| | | { |
| | | WriteLog.GetLog("PLCæ¥å¿åºåºæ¥å¿").Write($"读åå°åºåºå£è¡¥ç©ºæä¿¡å·ï¼{events}", "éè¦ç©ºæ"); |
| | | // çæå åæºå空æä»»å¡ |
| | | byte plcputts = conveyorLine.Communicator.Read<byte>(plcput); |
| | | if (plcputts != 1) |
| | | { |
| | | if ((_taskService.RequestWMSTask2("", Loc)).Status) |
| | | { |
| | | WriteLog.GetLog("PLCæ¥å¿åºåºæ¥å¿").Write($"å·²çæç©ºæåºåºä»»å¡ï¼{events}", "éè¦ç©ºæ"); |
| | | } |
| | | else |
| | | { |
| | | WriteLog.GetLog("PLCæ¥å¿åºåºæ¥å¿").Write($"æªçæç©ºæåºåºä»»å¡ï¼{events}", "éè¦ç©ºæ"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | throw; |
| | | } |
| | | } |
| | | |
| | | //ç¨äºå¤ææ¯å¦åºç©ºæ Dåº |
| | | private void CheckForEmptyPallet2(CommonConveyorLine conveyorLine, string eventTag, string barcodeTag, string plcput, string Loc) |
| | | { |
| | | Byte events = conveyorLine.Communicator.Read<Byte>(eventTag); // 读åäºä»¶ |
| | | if (events == 1) //1为空ï¼0为æ |
| | | { |
| | | string barcode = conveyorLine.Communicator.Read<string>(barcodeTag); // è¯»åæ¡ç |
| | | if ((_taskService.ToPlatform(barcode)).Status) |
| | | if (barcode != "1" || barcode != "0") |
| | | { |
| | | // åå
¥å»å1å·å åæº |
| | | bool result = conveyorLine.Communicator.Write(writeTag, 1); |
| | | if (result) |
| | | { |
| | | WriteLog.GetLog("PLCæ¥å¿").Write("åå
¥å»åï¼1", "å»å"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | // åå
¥å»å2å·å åæº |
| | | bool result = conveyorLine.Communicator.Write(writeTag, 2); |
| | | if (result) |
| | | { |
| | | WriteLog.GetLog("PLCæ¥å¿").Write("åå
¥å»åï¼2", "å»å"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | WriteLog.GetLog("PLCæ¥å¿åºåºæ¥å¿").Write($"读åå°åææåºåºä¿¡æ¯ï¼æ¡ç ä¿¡æ¯ï¼{barcode}", "åææåºåº"); |
| | | |
| | | //ç¨äºå¤ææ¯å¦è¡¥ç©ºæ |
| | | private void CheckForEmptyPallet(CommonConveyorLine conveyorLine,string eventTag) |
| | | { |
| | | int events = conveyorLine.Communicator.Read<int>(eventTag); // 读åäºä»¶ |
| | | if (events == 0) |
| | | { |
| | | WriteLog.GetLog("PLCæ¥å¿").Write($"读åå°åºåºå£è¡¥ç©ºæä¿¡å·ï¼{events}", "éè¦ç©ºæ"); |
| | | // çæå åæºå空æä»»å¡ |
| | | } |
| | | } |
| | | |
| | | //ç¨äºå¤æå
¥åºç«å° |
| | | private void ProcessConveyorEvent(CommonConveyorLine conveyorLine, string eventTag, string barcodeTag, string stationId, string taskCode) |
| | | { |
| | | int eventStatus = conveyorLine.Communicator.Read<int>(eventTag); |
| | | if (eventStatus == 1) |
| | | { |
| | | string barcode = conveyorLine.Communicator.Read<string>(barcodeTag); |
| | | if (barcode != null) |
| | | { |
| | | // æ¿åæçæ¡ç ç³è¯·å
¥åºä¿¡æ¯ |
| | | WebResponseContent content = _taskService.RequestWMSTask(barcode, taskCode); // ç³è¯·å
¥åºï¼çæå åæºä»»å¡ |
| | | if (content.Status) |
| | | byte outCount = conveyorLine.Communicator.Read<byte>(plcput); |
| | | if ((_taskService.RequestWMSTask3(barcode, outCount, Loc)).Status) |
| | | { |
| | | WriteLog.GetLog("PLCå
¥åºç«å°æ¥å¿").Write($"ç³è¯·å
¥åºæåï¼ç«å°ç¼å·ä¸ºï¼{stationId}", "ç«å°ä¿¡æ¯"); |
| | | //åå
¥è¾é线æ¸
é¤ä¿¡æ¯ |
| | | WriteLog.GetLog("PLCæ¥å¿åºåºæ¥å¿").Write($"å·²çæåææåºåºä»»å¡ï¼æ¡ç ä¿¡æ¯ï¼{barcode}", "åææåºåº"); |
| | | } |
| | | else |
| | | { |
| | | WriteLog.GetLog("PLCå
¥åºç«å°æ¥å¿").Write($"ç³è¯·å
¥åºå¤±è´¥ï¼ç«å°ç¼å·ä¸ºï¼{stationId}", "ç«å°ä¿¡æ¯"); |
| | | WriteLog.GetLog("PLCæ¥å¿åºåºæ¥å¿").Write($"æªçæåææåºåºä»»å¡ï¼æ¡ç ä¿¡æ¯ï¼{barcode}", "åææåºåº"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | //ç¨äºå¤æå
¥åºç«å° |
| | | private void ProcessConveyorEvent(CommonConveyorLine conveyorLine, string eventTag, string barcodeTag, string taskCode, string writeTag) |
| | | { |
| | | byte eventStatus = conveyorLine.Communicator.Read<byte>(eventTag); |
| | | if (eventStatus == 1) |
| | | { |
| | | WriteLog.GetLog("PLCå
¥åºç«å°æ¥å¿").Write($"读åå°è¾é线ç³è¯·å
¥åºä¿¡æ¯EVENT为ï¼{eventStatus}ï¼ç«å°ç¼å·ä¸ºï¼{taskCode}", "ç«å°ä¿¡æ¯"); |
| | | string barcode = conveyorLine.Communicator.Read<string>(barcodeTag).Trim(); |
| | | /*if(barcode == "1") |
| | | { |
| | | string currentTime = DateTime.Now.ToString("HHmmss"); |
| | | barcode = "KTP" + currentTime; |
| | | |
| | | }*/ |
| | | if (barcode != null) |
| | | { |
| | | bool result = conveyorLine.Communicator.Write(writeTag, (byte)0); |
| | | /*if(taskCode== "R01-003-042-001-01") |
| | | { |
| | | if ((_taskService.ToPlatform(barcode)).Status) |
| | | { |
| | | WriteLog.GetLog("PLCå
¥åºç«å°æ¥å¿").Write($"ç»çæåï¼ç«å°ç¼å·ä¸ºï¼{taskCode}", "ç«å°ä¿¡æ¯"); |
| | | } |
| | | }*/ |
| | | // æ¿åæçæ¡ç ç³è¯·å
¥åºä¿¡æ¯ |
| | | WebResponseContent content = _taskService.RequestWMSTask(barcode, taskCode); // ç³è¯·å
¥åºï¼çæå åæºä»»å¡ |
| | | if (content != null) |
| | | { |
| | | if (content.Status) |
| | | { |
| | | WriteLog.GetLog("PLCå
¥åºç«å°æ¥å¿").Write($"ç³è¯·å
¥åºæåï¼ç«å°ç¼å·ä¸ºï¼{taskCode}", "ç«å°ä¿¡æ¯"); |
| | | } |
| | | else |
| | | { |
| | | WriteLog.GetLog("PLCå
¥åºç«å°æ¥å¿").Write($"ç³è¯·å
¥åºå¤±è´¥ï¼ç«å°ç¼å·ä¸ºï¼{taskCode}", "ç«å°ä¿¡æ¯"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | WriteLog.GetLog("PLCå
¥åºç«å°æ¥å¿").Write($"读åå°è¾é线信æ¯ä¸ºç©ºï¼ç«å°ç¼å·ä¸ºï¼{stationId}", "ç«å°ä¿¡æ¯"); |
| | | WriteLog.GetLog("PLCå
¥åºç«å°æ¥å¿").Write($"读åå°è¾é线信æ¯ä¸ºç©ºï¼ç«å°ç¼å·ä¸ºï¼{taskCode}", "ç«å°ä¿¡æ¯"); |
| | | } |
| | | } |
| | | else if (eventStatus == 6) |
| | | { |
| | | if (taskCode == "R02-003-027-011-01") |
| | | { |
| | | WebResponseContent content = _taskService.RequestWMSTask4(); |
| | | if (content != null) |
| | | { |
| | | if (content.Status) |
| | | { |
| | | if (content.Data != null) |
| | | { |
| | | if (content.Data.ToString() == "1") |
| | | { |
| | | if (conveyorLine.Communicator.Read<string>("PLC_WCS_D._01_PLC_LPN") == "") |
| | | { |
| | | if (conveyorLine.Communicator.Write(writeTag, (byte)1)) |
| | | { |
| | | WriteLog.GetLog("PLCå
¥åºç«å°æ¥å¿").Write($"åå
¥æåï¼å»åï¼1ï¼ç«å°ç¼å·ä¸ºï¼{taskCode}", "空æå
¥åºå»å"); |
| | | } |
| | | else |
| | | { |
| | | WriteLog.GetLog("PLCå
¥åºç«å°æ¥å¿").Write($"åå
¥å¤±è´¥ï¼å»åï¼1ï¼ç«å°ç¼å·ä¸ºï¼{taskCode}", "空æå
¥åºå»å"); |
| | | } |
| | | } |
| | | } |
| | | else if (content.Data.ToString() == "3") |
| | | { |
| | | |
| | | if (conveyorLine.Communicator.Read<string>("PLC_WCS_D._03_PLC_LPN") == "") |
| | | { |
| | | if (conveyorLine.Communicator.Write(writeTag, (byte)3)) |
| | | { |
| | | WriteLog.GetLog("PLCå
¥åºç«å°æ¥å¿").Write($"åå
¥æåï¼å»åï¼3ï¼ç«å°ç¼å·ä¸ºï¼{taskCode}", "空æå
¥åºå»å"); |
| | | } |
| | | else |
| | | { |
| | | WriteLog.GetLog("PLCå
¥åºç«å°æ¥å¿").Write($"åå
¥å¤±è´¥ï¼å»åï¼3ï¼ç«å°ç¼å·ä¸ºï¼{taskCode}", "空æå
¥åºå»å"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | else if (taskCode == "R01-003-041-011-01") |
| | | { |
| | | if (conveyorLine.Communicator.Read<string>("PLC_WCS_D._03_PLC_LPN") == "") |
| | | { |
| | | if (conveyorLine.Communicator.Write(writeTag, (byte)1)) |
| | | { |
| | | WriteLog.GetLog("PLCå
¥åºç«å°æ¥å¿").Write($"åå
¥æåï¼å»åï¼1ï¼ç«å°ç¼å·ä¸ºï¼{taskCode}", "空æå
¥åºå»å"); |
| | | } |
| | | else |
| | | { |
| | | WriteLog.GetLog("PLCå
¥åºç«å°æ¥å¿").Write($"åå
¥å¤±è´¥ï¼å»åï¼1ï¼ç«å°ç¼å·ä¸ºï¼{taskCode}", "空æå
¥åºå»å"); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | public bool SetLine(CommonConveyorLine conveyorLine, string DeviceProDataBlock, byte Pali) |
| | | { |
| | | return conveyorLine.Communicator.Write(DeviceProDataBlock, Pali); |
| | | } |
| | | public bool SetLinestring(CommonConveyorLine conveyorLine, string DeviceProDataBlock, string Pali) |
| | | { |
| | | return conveyorLine.Communicator.Write(DeviceProDataBlock, Pali); |
| | | } |
| | | |
| | | public byte GetLine(CommonConveyorLine conveyorLine, string DeviceProDataBlock) |
| | | { |
| | | return conveyorLine.Communicator.Read<byte>(DeviceProDataBlock); |
| | | } |
| | | private void LogSignalStatus(string message, string sourceAddress) |
| | | { |
| | | WriteLog.GetLog("å åæºä¸plc交äºä¿¡å·").Write($"ç«å°ç¼å·ï¼{sourceAddress},ä¿¡æ¯ï¼{message}", $"{sourceAddress}"); |
| | | } |
| | | } |
| | | } |