| | |
| | | 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; |
| | |
| | | |
| | | public Task Execute(IJobExecutionContext context) |
| | | { |
| | | |
| | | |
| | | try |
| | | { |
| | | CommonConveyorLine conveyorLine = (CommonConveyorLine)context.JobDetail.JobDataMap.Get("JobParams"); |
| | | if ( conveyorLine != null ) |
| | | if (conveyorLine != null) |
| | | { |
| | | WriteLog.GetLog("Jobæ¥å¿è¿è¡").Write(conveyorLine.DeviceCode + "è¿è¡æ¥å¿ï¼å¼å§æ¶é´" + DateTime.Now, "Jobæ¥å¿è¿è¡"); |
| | | if (conveyorLine.DeviceCode == "1002") |
| | | { |
| | | RequestInbound(conveyorLine); //䏿¥¼C,Båºä¸å¡ |
| | | } |
| | | /*if (conveyorLine.DeviceCode == "1003") |
| | | if (conveyorLine.DeviceCode == "1003") |
| | | { |
| | | _taskService.RequestWMSTask3("FK240711D2",1, "R02-002-027-011-01"); |
| | | }*/ |
| | | RequestInbound2(conveyorLine); |
| | | } |
| | | if (conveyorLine.DeviceCode == "1004") |
| | | { |
| | | RequestInbound3(conveyorLine); //䏿¥¼C,Båºä¸å¡ |
| | |
| | | |
| | | |
| | | } |
| | | WriteLog.GetLog("Jobæ¥å¿è¿è¡").Write(conveyorLine.DeviceCode+"è¿è¡æ¥å¿ï¼ç»ææ¶é´"+DateTime.Now, "Jobæ¥å¿è¿è¡"); |
| | | WriteLog.GetLog("Jobæ¥å¿è¿è¡").Write(conveyorLine.DeviceCode + "è¿è¡æ¥å¿ï¼ç»ææ¶é´" + DateTime.Now, "Jobæ¥å¿è¿è¡"); |
| | | //RequestInNextAddress(conveyorLine); |
| | | |
| | | |
| | |
| | | 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 |
| | | } |
| | |
| | | public void RequestInbound2(CommonConveyorLine conveyorLine) |
| | | { |
| | | //顶楼楼è¾éçº¿å¤æ |
| | | //HandleEvent(conveyorLine, "PLC_WCS_D._05_PLC_EVENT", "PLC_WCS_D._05_PLC_LPN", "WCS_PLC_D._05_WCS_TO"); //夿å
¥åºå··é |
| | | //ProcessConveyorEvent(conveyorLine, "PLC_WCS_D._01_PLC_EVENT", "PLC_WCS_D._01_PLC_LPN", "R02-003-027-011-01", "WCS_PLC_D._05_WCS_TO");// å¤ç 1å··é ç«å°äºä»¶å
¥ç©º |
| | | //ProcessConveyorEvent(conveyorLine, "PLC_WCS_D._03_PLC_EVENT", "PLC_WCS_D._03_PLC_LPN", "R01-003-041-011-01", "WCS_PLC_D._05_WCS_TO");// å¤ç 2å··é ç«å°äºä»¶ å
¥ç©º |
| | | |
| | | ConveyorLineInFinish(conveyorLine, "R02-002-027-011-01"); //åå
¥è¾é线å»å |
| | | 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"); //åææåºåº è¯»åæ¡ç éåºåºåºåº |
| | |
| | | { |
| | | 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 ç«å°äºä»¶ å
¥æ |
| | | |
| | | //ConveyorLineInFinish(conveyorLine,"R01-002-044-001-01"); //ç¨äºåå
¥è¾é线æ¡ç ä¿¡æ¯ï¼ç¨äºåºåº |
| | | 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) |
| | | public void ConveyorLineInFinish(CommonConveyorLine conveyorLine, string SCAddress) |
| | | { |
| | | DeviceProDTO? deviceProDTO2 = GetDeviceProDTO(conveyorLine,SCAddress, "R_StackerCraneLowered"); //读åè¾é线 âå åæºæ¾ä¸â ä¿¡å· |
| | | if ( deviceProDTO2 != null ) |
| | | 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) |
| | | if (task != null && task.TaskType == (int)TaskOutboundTypeEnum.Outbound) |
| | | { |
| | | byte PLCtypeTo = 1; |
| | | if (task.TargetAddress == "R02-002-027-011-01") |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | //è·åè¾é线å®ä¾ |
| | | public DeviceProDTO? GetDeviceProDTO(CommonConveyorLine conveyorLine, string SCAddress, string Interactivet) |
| | |
| | | /// <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) |
| | | { |
| | | try |
| | | { |
| | |
| | | if (events == 1) |
| | | { |
| | | string barcode = conveyorLine.Communicator.Read<string>(barcodeTag); // è¯»åæ¡ç |
| | | if(barcode != "1" || barcode != "0") |
| | | if (barcode != "1" || barcode != "0") |
| | | { |
| | | if ((_taskService.ToPlatform(barcode)).Status) |
| | | { |
| | | if(conveyorLine.Communicator.Read<string>("PLC_WCS_B._01_PLC_LPN")=="") |
| | | if (conveyorLine.Communicator.Read<string>("PLC_WCS_B._01_PLC_LPN") == "") |
| | | { |
| | | // åå
¥å»å2å·å åæº |
| | | bool result = conveyorLine.Communicator.Write(writeTag, (byte)3); //åææå»å |
| | |
| | | if (barcode != "1" || barcode != "0") |
| | | { |
| | | WebResponseContent content = _taskService.ToPlatform(barcode); |
| | | if(content != null) |
| | | if (content != null) |
| | | { |
| | | if (content.Status) |
| | | { |
| | | if(content.Data != null) |
| | | if (content.Data != null) |
| | | { |
| | | if (content.Data.ToString() == "1") |
| | | { |
| | |
| | | else if (content.Data.ToString() == "3") |
| | | { |
| | | |
| | | if (conveyorLine.Communicator.Read<string>("PLC_WCS_B._01_PLC_LPN") == "") |
| | | if (conveyorLine.Communicator.Read<string>("PLC_WCS_B._01_PLC_LPN") == "") |
| | | { |
| | | // åå
¥å»å2å·å åæº |
| | | bool result = conveyorLine.Communicator.Write(writeTag, (byte)3); //åå
¥å»å为çå··é |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | //ç¨äºå¤ææ¯å¦è¡¥ç©ºæ Aåº |
| | | private void CheckForEmptyPallet(CommonConveyorLine conveyorLine,string eventTag, string barcodeTag,string plcput,string Loc) |
| | | private void CheckForEmptyPallet(CommonConveyorLine conveyorLine, string eventTag, string barcodeTag, string plcput, string Loc) |
| | | { |
| | | |
| | | try |
| | |
| | | if (events == 1) //1为空ï¼0为æ |
| | | { |
| | | string barcode = conveyorLine.Communicator.Read<string>(barcodeTag); // è¯»åæ¡ç |
| | | if(barcode == "") |
| | | if (barcode == "") |
| | | { |
| | | WriteLog.GetLog("PLCæ¥å¿åºåºæ¥å¿").Write($"读åå°åºåºå£è¡¥ç©ºæä¿¡å·ï¼{events}", "éè¦ç©ºæ"); |
| | | // çæå åæºå空æä»»å¡ |
| | | byte plcputts = conveyorLine.Communicator.Read<byte>(plcput); |
| | | byte plcputts = conveyorLine.Communicator.Read<byte>(plcput); |
| | | if (plcputts != 1) |
| | | { |
| | | if ((_taskService.RequestWMSTask2("", Loc)).Status) |
| | |
| | | WriteLog.GetLog("PLCæ¥å¿åºåºæ¥å¿").Write($"读åå°åææåºåºä¿¡æ¯ï¼æ¡ç ä¿¡æ¯ï¼{barcode}", "åææåºåº"); |
| | | |
| | | byte outCount = conveyorLine.Communicator.Read<byte>(plcput); |
| | | if ((_taskService.RequestWMSTask3(barcode, outCount,Loc)).Status) |
| | | if ((_taskService.RequestWMSTask3(barcode, outCount, Loc)).Status) |
| | | { |
| | | //åå
¥è¾é线æ¸
é¤ä¿¡æ¯ |
| | | WriteLog.GetLog("PLCæ¥å¿åºåºæ¥å¿").Write($"å·²çæåææåºåºä»»å¡ï¼æ¡ç ä¿¡æ¯ï¼{barcode}", "åææåºåº"); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | //ç¨äºå¤æå
¥åºç«å° |
| | | private void ProcessConveyorEvent(CommonConveyorLine conveyorLine, string eventTag, string barcodeTag, string taskCode,string writeTag) |
| | | private void ProcessConveyorEvent(CommonConveyorLine conveyorLine, string eventTag, string barcodeTag, string taskCode, string writeTag) |
| | | { |
| | | byte eventStatus = conveyorLine.Communicator.Read<byte>(eventTag); |
| | | if (eventStatus == 1) |
| | |
| | | }*/ |
| | | // æ¿åæçæ¡ç ç³è¯·å
¥åºä¿¡æ¯ |
| | | WebResponseContent content = _taskService.RequestWMSTask(barcode, taskCode); // ç³è¯·å
¥åºï¼çæå åæºä»»å¡ |
| | | if (content !=null) |
| | | if (content != null) |
| | | { |
| | | if (content.Status) |
| | | { |
| | |
| | | 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 byte GetLine(CommonConveyorLine conveyorLine, string DeviceProDataBlock) |
| | | { |
| | | return conveyorLine.Communicator.Read<byte>(DeviceProDataBlock); |