| | |
| | | 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; |
| | |
| | | { |
| | | CommonConveyorLine conveyorLine = (CommonConveyorLine)context.JobDetail.JobDataMap.Get("JobParams"); |
| | | |
| | | RequestInbound(conveyorLine); //æ£æµå
¥æå£ä¿¡æ¯ |
| | | RequestInNextAddress(conveyorLine); |
| | | if( conveyorLine != null ) |
| | | { |
| | | RequestInbound(conveyorLine); //夿巷éå»åªä¸ªå··é |
| | | } |
| | | //RequestInNextAddress(conveyorLine); |
| | | |
| | | |
| | | } |
| | |
| | | /// <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楼è¾éçº¿å¤æ |
| | | HandleEvent(conveyorLine, "PLC_WCS_B._03_PLC_EVENT", "PLC_WCS_B._03_PLC_LPN", "WCS_PLC_B._03_WCS_TO"); //夿巷é |
| | | HandleEvent(conveyorLine, "PLC_WCS_C._02_PLC_EVENT", "PLC_WCS_C._02_PLC_LPN", "WCS_PLC_C._02_WCS_TO"); //夿巷é |
| | | CheckForEmptyPallet(conveyorLine, "PLC_WCS_B._01_PLC_EVENT"); //夿æ¯å¦å空æ |
| | | CheckForEmptyPallet(conveyorLine, "PLC_WCS_C._01_PLC_EVENT"); //夿æ¯å¦å空æ |
| | | ProcessConveyorEvent(conveyorLine, "PLC_WCS_B._01_PLC_EVENT", "PLC_WCS_B._01_PLC_LPN", "R02-003-027-001-01");// å¤ç B ç«å°äºä»¶ //夿è¾é线å°è¾¾ä¿¡å· |
| | | ProcessConveyorEvent(conveyorLine, "PLC_WCS_C._03_PLC_EVENT", "PLC_WCS_C._03_PLC_LPN", "R01-003-041-001-01");// å¤ç C ç«å°äºä»¶ //夿è¾é线å°è¾¾ä¿¡å· |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 夿åºåºç«å°æ¯å¦éè¦ç©ºæ |
| | |
| | | /// <param name="writeTag"></param> |
| | | private void HandleEvent(CommonConveyorLine conveyorLine,string eventTag, string barcodeTag, string writeTag) |
| | | { |
| | | int events = conveyorLine.Communicator.Read<int>(eventTag); // 读åäºä»¶ |
| | | if (events == 1) |
| | | try |
| | | { |
| | | string barcode = conveyorLine.Communicator.Read<string>(barcodeTag); // è¯»åæ¡ç |
| | | if ((_taskService.ToPlatform(barcode)).Status) |
| | | byte events = conveyorLine.Communicator.Read<byte>(eventTag); // 读åäºä»¶ |
| | | if (events == 1) |
| | | { |
| | | // åå
¥å»å1å·å åæº |
| | | bool result = conveyorLine.Communicator.Write(writeTag, 1); |
| | | if (result) |
| | | string barcode = conveyorLine.Communicator.Read<string>(barcodeTag); // è¯»åæ¡ç |
| | | if ((_taskService.ToPlatform(barcode)).Status) |
| | | { |
| | | WriteLog.GetLog("PLCæ¥å¿").Write("åå
¥å»åï¼1", "å»å"); |
| | | // åå
¥å»å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) |
| | | /*else |
| | | { |
| | | WriteLog.GetLog("PLCæ¥å¿").Write("åå
¥å»åï¼2", "å»å"); |
| | | } |
| | | // åå
¥å»å2å·å åæº |
| | | *//*bool result = conveyorLine.Communicator.Write(writeTag, 2); |
| | | if (result) |
| | | { |
| | | WriteLog.GetLog("PLCæ¥å¿").Write("åå
¥å»åï¼2", "å»å"); |
| | | }*//* |
| | | |
| | | WriteLog.GetLog("PLCæ¥å¿").Write("å
¥åºå¤±è´¥", "å
¥åºç»ç"); |
| | | }*/ |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | throw; |
| | | } |
| | | } |
| | | |
| | | //ç¨äºå¤ææ¯å¦è¡¥ç©ºæ |
| | | private void CheckForEmptyPallet(CommonConveyorLine conveyorLine,string eventTag) |
| | | { |
| | | int events = conveyorLine.Communicator.Read<int>(eventTag); // 读åäºä»¶ |
| | | |
| | | Byte events = conveyorLine.Communicator.Read<Byte>(eventTag); // 读åäºä»¶ |
| | | if (events == 0) |
| | | { |
| | | WriteLog.GetLog("PLCæ¥å¿").Write($"读åå°åºåºå£è¡¥ç©ºæä¿¡å·ï¼{events}", "éè¦ç©ºæ"); |
| | | // çæå åæºå空æä»»å¡ |
| | | if ((_taskService.RequestWMSTask2(conveyorLine.DeviceCode)).Status) |
| | | { |
| | | WriteLog.GetLog("PLCæ¥å¿").Write($"å·²çæç©ºæåºåºä»»å¡ï¼{events}", "éè¦ç©ºæ"); |
| | | } |
| | | else |
| | | { |
| | | WriteLog.GetLog("PLCæ¥å¿").Write($"æªçæç©ºæåºåºä»»å¡ï¼{events}", "éè¦ç©ºæ"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //ç¨äºå¤æå
¥åºç«å° |
| | | private void ProcessConveyorEvent(CommonConveyorLine conveyorLine, string eventTag, string barcodeTag, string stationId, string taskCode) |
| | | private void ProcessConveyorEvent(CommonConveyorLine conveyorLine, string eventTag, string barcodeTag, string taskCode) |
| | | { |
| | | int eventStatus = conveyorLine.Communicator.Read<int>(eventTag); |
| | | byte eventStatus = conveyorLine.Communicator.Read<byte>(eventTag); |
| | | if (eventStatus == 1) |
| | | { |
| | | string barcode = conveyorLine.Communicator.Read<string>(barcodeTag); |
| | |
| | | { |
| | | // æ¿åæçæ¡ç ç³è¯·å
¥åºä¿¡æ¯ |
| | | WebResponseContent content = _taskService.RequestWMSTask(barcode, taskCode); // ç³è¯·å
¥åºï¼çæå åæºä»»å¡ |
| | | if (content.Status) |
| | | if (content !=null) |
| | | { |
| | | WriteLog.GetLog("PLCå
¥åºç«å°æ¥å¿").Write($"ç³è¯·å
¥åºæåï¼ç«å°ç¼å·ä¸ºï¼{stationId}", "ç«å°ä¿¡æ¯"); |
| | | } |
| | | else |
| | | { |
| | | WriteLog.GetLog("PLCå
¥åºç«å°æ¥å¿").Write($"ç³è¯·å
¥åºå¤±è´¥ï¼ç«å°ç¼å·ä¸ºï¼{stationId}", "ç«å°ä¿¡æ¯"); |
| | | 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}", "ç«å°ä¿¡æ¯"); |
| | | } |
| | | } |
| | | } |