| | |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.Math; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.Text; |
| | | using Quartz; |
| | | using SqlSugar; |
| | | using StackExchange.Profiling.Internal; |
| | | using System; |
| | | using System.Collections.Generic; |
| | |
| | | { |
| | | RequestInbound(conveyorLine); //䏿¥¼C,Båºä¸å¡ |
| | | } |
| | | |
| | | if (conveyorLine.DeviceCode == "1003") |
| | | { |
| | | _taskService.RequestWMSTask3("FK240711D2",1, "R02-002-027-011-01"); |
| | | } |
| | | if (conveyorLine.DeviceCode == "1004") |
| | | { |
| | | RequestInbound3(conveyorLine); //䏿¥¼C,Båºä¸å¡ |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | public void RequestInbound(CommonConveyorLine conveyorLine) |
| | | { |
| | | //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"); //夿巷é |
| | | 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_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 RequestInbound3(CommonConveyorLine conveyorLine) |
| | | { |
| | | ProcessConveyorEvent(conveyorLine, "PLC_WCS_A._02_PLC_EVENT", "PLC_WCS_A._02_PLC_LPN", "R02-003-043-011-01", "WCS_PLC_A._02_WCS_TO");// å¤ç A21 ç«å°äºä»¶å
¥åº |
| | | 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-003-042-011-01", "WCS_PLC_A._03_WCS_TO");// å¤ç A22 ç«å°äºä»¶ å
¥æ |
| | | //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"); //ç¨äºåå
¥è¾é线æ¡ç ä¿¡æ¯ï¼ç¨äºåºåº |
| | | //ConveyorLineInFinish(conveyorLine,"R01-002-044-001-01"); //ç¨äºåå
¥è¾é线æ¡ç ä¿¡æ¯ï¼ç¨äºåºåº |
| | | } |
| | | |
| | | public void ConveyorLineInFinish(CommonConveyorLine conveyorLine,string SCAddress) |
| | |
| | | { |
| | | if ((_taskService.ToPlatform(barcode)).Status) |
| | | { |
| | | // åå
¥å»å2å·å åæº |
| | | bool result = conveyorLine.Communicator.Write(writeTag, (byte)1); //åææå»å |
| | | if (result) |
| | | { |
| | | WriteLog.GetLog("PLCæ¥å¿").Write("åå
¥å»åï¼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("åå
¥å»åï¼3", "å»å"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | //ç¨äºå¤ææ¯å¦è¡¥ç©ºæ |
| | | //æ°çå··é夿 |
| | | 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 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) |
| | | { |
| | | |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | |
| | | } |
| | | } |
| | | |
| | | //ç¨äºå¤ææ¯å¦åºç©ºæ |
| | | //ç¨äºå¤ææ¯å¦åºç©ºæ Dåº |
| | | private void CheckForEmptyPallet2(CommonConveyorLine conveyorLine, string eventTag, string barcodeTag, string plcput, string Loc) |
| | | { |
| | | Byte events = conveyorLine.Communicator.Read<Byte>(eventTag); // 读åäºä»¶ |
| | |
| | | if (eventStatus == 1) |
| | | { |
| | | WriteLog.GetLog("PLCå
¥åºç«å°æ¥å¿").Write($"读åå°è¾é线ç³è¯·å
¥åºä¿¡æ¯EVENT为ï¼{eventStatus}ï¼ç«å°ç¼å·ä¸ºï¼{taskCode}", "ç«å°ä¿¡æ¯"); |
| | | string barcode = conveyorLine.Communicator.Read<string>(barcodeTag); |
| | | if(barcode == "1") |
| | | 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-011-01") |
| | | /*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) |