private void button20_Click(object sender, EventArgs e) { PortPLCInfo plcInfo = transferService.GetPLC_PortData(comboBox1.Text); if (plcInfo.LoadPosition1) { transferService.PLC_ReportPortWaitIn(plcInfo, "TestGetPortData"); } }
private void button25_Click(object sender, EventArgs e) { PortPLCInfo portPLCInfo = new PortPLCInfo(); portPLCInfo.CassetteID = textBox1.Text; portPLCInfo.BoxID = textBox2.Text; portPLCInfo.EQ_ID = comboBox3.Text; BCApp.SCApplication.TransferService.PLC_ReportPortWaitIn(portPLCInfo, "S6F11 Demo"); }
public void PublishPortInfo(string portID, PortPLCInfo portPLCInfo) { if (portPLCInfo == null) { return; } string hash_field = portID; byte[] arrayByte = convert2PortInfo(portID, portPLCInfo); app.getNatsManager().PublishAsync (string.Format(SCAppConstants.NATS_SUBJECT_Port_INFO_0, portID), arrayByte); }
public static byte[] convert2PortInfo(string portID, PortPLCInfo portPLCInfo) { ProtocolFormat.OHTMessage.PORT_INFO port_info = new PORT_INFO(); port_info.IsAutoMode = portPLCInfo.IsAutoMode; port_info.OpAutoMode = portPLCInfo.OpAutoMode; port_info.OpManualMode = portPLCInfo.OpManualMode; port_info.OpError = portPLCInfo.OpError; port_info.IsInputMode = portPLCInfo.IsInputMode; port_info.IsOutputMode = portPLCInfo.IsOutputMode; port_info.IsModeChangable = portPLCInfo.IsModeChangable; port_info.IsAGVMode = portPLCInfo.IsAGVMode; port_info.IsMGVMode = portPLCInfo.IsMGVMode; port_info.PortWaitIn = portPLCInfo.PortWaitIn; port_info.PortWaitOut = portPLCInfo.PortWaitOut; port_info.IsReadyToLoad = portPLCInfo.IsReadyToLoad; port_info.IsReadyToUnload = portPLCInfo.IsReadyToUnload; port_info.LoadPosition1 = portPLCInfo.LoadPosition1; port_info.LoadPosition2 = portPLCInfo.LoadPosition2; port_info.LoadPosition3 = portPLCInfo.LoadPosition3; port_info.LoadPosition4 = portPLCInfo.LoadPosition4; port_info.LoadPosition5 = portPLCInfo.LoadPosition5; port_info.LoadPosition7 = portPLCInfo.LoadPosition7; port_info.LoadPosition6 = portPLCInfo.LoadPosition6; port_info.IsCSTPresence = portPLCInfo.IsCSTPresence; port_info.AGVPortReady = portPLCInfo.AGVPortReady; port_info.CanOpenBox = portPLCInfo.CanOpenBox; port_info.IsBoxOpen = portPLCInfo.IsBoxOpen; port_info.BCRReadDone = portPLCInfo.BCRReadDone; port_info.CSTPresenceMismatch = portPLCInfo.CSTPresenceMismatch; port_info.IsTransferComplete = portPLCInfo.IsTransferComplete; port_info.CstRemoveCheck = portPLCInfo.CstRemoveCheck; port_info.ErrorCode = portPLCInfo.ErrorCode; port_info.BoxID = portPLCInfo.BoxID ?? ""; port_info.CassetteID = portPLCInfo.CassetteID ?? ""; port_info.PortID = portID ?? ""; port_info.LoadPositionBOX1 = portPLCInfo.LoadPositionBOX1 ?? ""; port_info.LoadPositionBOX2 = portPLCInfo.LoadPositionBOX2 ?? ""; port_info.LoadPositionBOX3 = portPLCInfo.LoadPositionBOX3 ?? ""; port_info.LoadPositionBOX4 = portPLCInfo.LoadPositionBOX4 ?? ""; port_info.LoadPositionBOX5 = portPLCInfo.LoadPositionBOX5 ?? ""; port_info.FireAlarm = portPLCInfo.FireAlarm; byte[] arrayByte = new byte[port_info.CalculateSize()]; port_info.WriteTo(new Google.Protobuf.CodedOutputStream(arrayByte)); return(arrayByte); }
private void timer1_Tick(object sender, EventArgs e) { portData = transferService.GetPLC_PortData(comboBox1.Text); #region dataGridView2 dataGridView2.Rows[0].Cells[2].Value = portData.OpAutoMode.ToString(); dataGridView2.Rows[1].Cells[2].Value = portData.IsAutoMode.ToString(); dataGridView2.Rows[2].Cells[2].Value = portData.OpError.ToString(); dataGridView2.Rows[3].Cells[2].Value = portData.ErrorCode.ToString(); //dataGridView2.Rows[4].Cells[2].Value = 流向說明; dataGridView2.Rows[5].Cells[2].Value = portData.IsModeChangable.ToString(); dataGridView2.Rows[6].Cells[2].Value = portData.IsInputMode.ToString(); dataGridView2.Rows[7].Cells[2].Value = portData.IsOutputMode.ToString(); //dataGridView2.Rows[8].Cells[2].Value = 投出入說明; dataGridView2.Rows[9].Cells[2].Value = portData.IsReadyToLoad.ToString(); dataGridView2.Rows[10].Cells[2].Value = portData.IsReadyToUnload.ToString(); //dataGridView2.Rows[11].Cells[2].Value = 等待說明; dataGridView2.Rows[12].Cells[2].Value = portData.PortWaitIn.ToString(); dataGridView2.Rows[13].Cells[2].Value = portData.PortWaitOut.ToString(); //dataGridView2.Rows[14].Cells[2].Value = 等待說明; dataGridView2.Rows[15].Cells[2].Value = portData.cim_on.ToString(); dataGridView2.Rows[16].Cells[2].Value = portData.preLoadOK.ToString(); #endregion #region dataGridView3 dataGridView3.Rows[0].Cells[2].Value = portData.CstRemoveCheck.ToString(); //dataGridView3.Rows[1].Cells[2].Value = portData.IsAutoMode.ToString(); dataGridView3.Rows[2].Cells[2].Value = portData.BCRReadDone.ToString(); dataGridView3.Rows[3].Cells[2].Value = portData.BoxID.ToString(); //dataGridView3.Rows[4].Cells[2].Value = ""; dataGridView3.Rows[5].Cells[2].Value = portData.LoadPosition1.ToString(); dataGridView3.Rows[5].Cells[3].Value = portData.LoadPositionBOX1.ToString(); dataGridView3.Rows[6].Cells[2].Value = portData.LoadPosition2.ToString(); dataGridView3.Rows[6].Cells[3].Value = portData.LoadPositionBOX2.ToString(); dataGridView3.Rows[7].Cells[2].Value = portData.LoadPosition3.ToString(); dataGridView3.Rows[7].Cells[3].Value = portData.LoadPositionBOX3.ToString(); dataGridView3.Rows[8].Cells[2].Value = portData.LoadPosition4.ToString(); dataGridView3.Rows[8].Cells[3].Value = portData.LoadPositionBOX4.ToString(); dataGridView3.Rows[9].Cells[2].Value = portData.LoadPosition5.ToString(); dataGridView3.Rows[9].Cells[3].Value = portData.LoadPositionBOX5.ToString(); dataGridView3.Rows[10].Cells[2].Value = portData.LoadPosition6.ToString(); dataGridView3.Rows[11].Cells[2].Value = portData.LoadPosition7.ToString(); #endregion #region dataGridView4 dataGridView4.Rows[0].Cells[2].Value = transferService.GetAGV_StationStatus(comboBox1.Text); dataGridView4.Rows[1].Cells[2].Value = transferService.GetAGV_AutoPortType(comboBox1.Text); dataGridView4.Rows[2].Cells[2].Value = portData.IsAGVMode.ToString(); dataGridView4.Rows[3].Cells[2].Value = portData.IsMGVMode.ToString(); //dataGridView4.Rows[4].Cells[2].Value = dataGridView4.Rows[5].Cells[2].Value = portData.AGVPortReady.ToString(); dataGridView4.Rows[6].Cells[2].Value = portData.CSTPresenceMismatch.ToString(); //dataGridView4.Rows[7].Cells[2].Value = dataGridView4.Rows[8].Cells[2].Value = portData.CanOpenBox.ToString(); dataGridView4.Rows[9].Cells[2].Value = portData.IsBoxOpen.ToString(); //dataGridView4.Rows[10].Cells[2].Value = dataGridView4.Rows[11].Cells[2].Value = portData.CassetteID.ToString(); dataGridView4.Rows[12].Cells[2].Value = portData.IsCSTPresence.ToString(); #endregion #region 待刪除 //label2.Text = // "Port狀態:\n" // + "運轉狀態_RUN: " + portData.OpAutoMode.ToString() + "\n" // + "自動模式_IsAutoMode: " + portData.IsAutoMode.ToString() + "\n" // + "異常狀態_ErrorBit: " + portData.OpError.ToString() + "\n" // + "異常代碼_ErrorCode: " + portData.ErrorCode.ToString() + "\n" // ; //label3.Text = "搬送資訊:" + "\n" // + "是否能切換流向_IsModeChangable: " + portData.IsModeChangable.ToString() + "\n" // + "流向:AGV 往 OHT_IsInputMode: " + portData.IsInputMode.ToString() + "\n" // + "流向:OHT 往 AGV_IsOutputMode: " + portData.IsOutputMode.ToString() + "\n" // + "\n" // + "AGV Port是否能投入 BOX_IsReadyToLoad: " + portData.IsReadyToLoad.ToString() + "\n" // + "AGV Port是否能投入 BOX_IsReadyToUnload: " + portData.IsReadyToUnload.ToString() + "\n" // + "\n" // + "等待 OHT 搬走_PortWaitIn: " + portData.PortWaitIn.ToString() + "\n" // + "等待從 AGV Port搬走_PortWaitOut: " + portData.PortWaitOut.ToString() + "\n" // + "\n" // + "帳移除_Remove: " + portData.CstRemoveCheck.ToString() + "\n" // + "\n" // + "CassetteID: " + portData.CassetteID.ToString() + "\n" // + "是否有卡匣_IsCSTPresence: " + portData.IsCSTPresence.ToString() + "\n" // + "\n" // + "BCR讀取狀態_BCRReadDone: " + portData.BCRReadDone.ToString() + "\n" // + "\n" // + "BoxID: " + portData.BoxID.ToString() + "\n" // + "BOX位置1_LoadPosition1: " + portData.LoadPosition1.ToString() + " BOXID: " + portData.LoadPositionBOX1.ToString() + "\n" // + "BOX位置2_LoadPosition2: " + portData.LoadPosition2.ToString() + " BOXID: " + portData.LoadPositionBOX2.ToString() + "\n" // + "BOX位置3_LoadPosition3: " + portData.LoadPosition3.ToString() + " BOXID: " + portData.LoadPositionBOX3.ToString() + "\n" // + "BOX位置4_LoadPosition4: " + portData.LoadPosition4.ToString() + " BOXID: " + portData.LoadPositionBOX4.ToString() + "\n" // + "BOX位置5_LoadPosition5: " + portData.LoadPosition5.ToString() + " BOXID: " + portData.LoadPositionBOX5.ToString() + "\n" // + "BOX位置6_LoadPosition6: " + portData.LoadPosition6.ToString() + "\n" // + "BOX位置7_LoadPosition7: " + portData.LoadPosition7.ToString() + "\n" // ; //label4.Text = // "AGV Port 專有訊號:\n" // + "開啟自動補退 BOX 功能_openAGV_Station: " + transferService.GetAGV_StationStatus(comboBox1.Text) + "\n" // + "AGV模式_IsAGVMode: " + portData.IsAGVMode.ToString() + "\n" // + "\n" // + "AGVPortReady: " + portData.AGVPortReady.ToString() + "\n" // + "AGVPortMismatch: " + portData.CSTPresenceMismatch.ToString() + "\n" // + "\n" // + "是否能開蓋: " + portData.CanOpenBox.ToString() + "\n" // + "開蓋狀態: " + portData.IsBoxOpen.ToString() + "\n" // + "\n" // ; #endregion label6.Text = "關聯實際狀態: " + transferService.agvZone_ConnectedRealAGVPortRunDown.ToString(); label11.Text = "單取單放狀態: " + transferService.oneInoneOutMethodUse.ToString(); if (transferService.isAGVZone(comboBox3.Text)) { label7.Text = "強制讓貨先出去: " + transferService.portINIData[comboBox3.Text].forceRejectAGVCTrigger.ToString(); } else { label7.Text = "AGV Zone 名稱輸入錯誤"; } label8.Text = "ST01: " + transferService.agvcTriggerResult_ST01; label9.Text = "ST02: " + transferService.agvcTriggerResult_ST02; label10.Text = "ST03: " + transferService.agvcTriggerResult_ST03; dataGridView5.DataSource = BCApp.SCApplication.VehicleBLL.cache.loadVhs().Select(data => new { data.VEHICLE_ID , data.HAS_CST , data.BOX_ID , data.CST_ID , data.ACT_STATUS , data.MCS_CMD , data.CMD_CST_ID } ).ToList(); TimeSpan timeOut = DateTime.Now - openTime; if (timeOut.Minutes > 5) { timer1.Enabled = false; this.Close(); } }
private void timer1_Tick(object sender, EventArgs e) { portData = BCApp.SCApplication.TransferService.GetPLC_PortData(comboBox1.Text); #region dataGridView2 dataGridView2.Rows[0].Cells[2].Value = portData.OpAutoMode.ToString(); dataGridView2.Rows[1].Cells[2].Value = portData.IsAutoMode.ToString(); dataGridView2.Rows[2].Cells[2].Value = portData.OpError.ToString(); dataGridView2.Rows[3].Cells[2].Value = portData.ErrorCode.ToString(); //dataGridView2.Rows[4].Cells[2].Value = 流向說明; dataGridView2.Rows[5].Cells[2].Value = portData.IsModeChangable.ToString(); dataGridView2.Rows[6].Cells[2].Value = portData.IsInputMode.ToString(); dataGridView2.Rows[7].Cells[2].Value = portData.IsOutputMode.ToString(); //dataGridView2.Rows[8].Cells[2].Value = 投出入說明; dataGridView2.Rows[9].Cells[2].Value = portData.IsReadyToLoad.ToString(); dataGridView2.Rows[10].Cells[2].Value = portData.IsReadyToUnload.ToString(); //dataGridView2.Rows[11].Cells[2].Value = 等待說明; dataGridView2.Rows[12].Cells[2].Value = portData.PortWaitIn.ToString(); dataGridView2.Rows[13].Cells[2].Value = portData.PortWaitOut.ToString(); #endregion #region dataGridView3 dataGridView3.Rows[0].Cells[2].Value = portData.CstRemoveCheck.ToString(); //dataGridView3.Rows[1].Cells[2].Value = portData.IsAutoMode.ToString(); dataGridView3.Rows[2].Cells[2].Value = portData.BCRReadDone.ToString(); dataGridView3.Rows[3].Cells[2].Value = portData.BoxID.ToString(); //dataGridView3.Rows[4].Cells[2].Value = ""; dataGridView3.Rows[5].Cells[2].Value = portData.LoadPosition1.ToString(); dataGridView3.Rows[5].Cells[3].Value = portData.LoadPositionBOX1.ToString(); dataGridView3.Rows[6].Cells[2].Value = portData.LoadPosition2.ToString(); dataGridView3.Rows[6].Cells[3].Value = portData.LoadPositionBOX2.ToString(); dataGridView3.Rows[7].Cells[2].Value = portData.LoadPosition3.ToString(); dataGridView3.Rows[7].Cells[3].Value = portData.LoadPositionBOX3.ToString(); dataGridView3.Rows[8].Cells[2].Value = portData.LoadPosition4.ToString(); dataGridView3.Rows[8].Cells[3].Value = portData.LoadPositionBOX4.ToString(); dataGridView3.Rows[9].Cells[2].Value = portData.LoadPosition5.ToString(); dataGridView3.Rows[9].Cells[3].Value = portData.LoadPositionBOX5.ToString(); dataGridView3.Rows[10].Cells[2].Value = portData.LoadPosition6.ToString(); dataGridView3.Rows[11].Cells[2].Value = portData.LoadPosition7.ToString(); #endregion #region dataGridView4 dataGridView4.Rows[0].Cells[2].Value = BCApp.SCApplication.TransferService.GetAGV_StationStatus(comboBox1.Text); dataGridView4.Rows[1].Cells[2].Value = BCApp.SCApplication.TransferService.GetAGV_AutoPortType(comboBox1.Text); dataGridView4.Rows[2].Cells[2].Value = portData.IsAGVMode.ToString(); dataGridView4.Rows[3].Cells[2].Value = portData.IsMGVMode.ToString(); //dataGridView4.Rows[4].Cells[2].Value = dataGridView4.Rows[5].Cells[2].Value = portData.AGVPortReady.ToString(); dataGridView4.Rows[6].Cells[2].Value = portData.CSTPresenceMismatch.ToString(); //dataGridView4.Rows[7].Cells[2].Value = dataGridView4.Rows[8].Cells[2].Value = portData.CanOpenBox.ToString(); dataGridView4.Rows[9].Cells[2].Value = portData.IsBoxOpen.ToString(); //dataGridView4.Rows[10].Cells[2].Value = dataGridView4.Rows[11].Cells[2].Value = portData.CassetteID.ToString(); dataGridView4.Rows[12].Cells[2].Value = portData.IsCSTPresence.ToString(); #endregion #region 待刪除 //label2.Text = // "Port狀態:\n" // + "運轉狀態_RUN: " + portData.OpAutoMode.ToString() + "\n" // + "自動模式_IsAutoMode: " + portData.IsAutoMode.ToString() + "\n" // + "異常狀態_ErrorBit: " + portData.OpError.ToString() + "\n" // + "異常代碼_ErrorCode: " + portData.ErrorCode.ToString() + "\n" // ; //label3.Text = "搬送資訊:" + "\n" // + "是否能切換流向_IsModeChangable: " + portData.IsModeChangable.ToString() + "\n" // + "流向:AGV 往 OHT_IsInputMode: " + portData.IsInputMode.ToString() + "\n" // + "流向:OHT 往 AGV_IsOutputMode: " + portData.IsOutputMode.ToString() + "\n" // + "\n" // + "AGV Port是否能投入 BOX_IsReadyToLoad: " + portData.IsReadyToLoad.ToString() + "\n" // + "AGV Port是否能投入 BOX_IsReadyToUnload: " + portData.IsReadyToUnload.ToString() + "\n" // + "\n" // + "等待 OHT 搬走_PortWaitIn: " + portData.PortWaitIn.ToString() + "\n" // + "等待從 AGV Port搬走_PortWaitOut: " + portData.PortWaitOut.ToString() + "\n" // + "\n" // + "帳移除_Remove: " + portData.CstRemoveCheck.ToString() + "\n" // + "\n" // + "CassetteID: " + portData.CassetteID.ToString() + "\n" // + "是否有卡匣_IsCSTPresence: " + portData.IsCSTPresence.ToString() + "\n" // + "\n" // + "BCR讀取狀態_BCRReadDone: " + portData.BCRReadDone.ToString() + "\n" // + "\n" // + "BoxID: " + portData.BoxID.ToString() + "\n" // + "BOX位置1_LoadPosition1: " + portData.LoadPosition1.ToString() + " BOXID: " + portData.LoadPositionBOX1.ToString() + "\n" // + "BOX位置2_LoadPosition2: " + portData.LoadPosition2.ToString() + " BOXID: " + portData.LoadPositionBOX2.ToString() + "\n" // + "BOX位置3_LoadPosition3: " + portData.LoadPosition3.ToString() + " BOXID: " + portData.LoadPositionBOX3.ToString() + "\n" // + "BOX位置4_LoadPosition4: " + portData.LoadPosition4.ToString() + " BOXID: " + portData.LoadPositionBOX4.ToString() + "\n" // + "BOX位置5_LoadPosition5: " + portData.LoadPosition5.ToString() + " BOXID: " + portData.LoadPositionBOX5.ToString() + "\n" // + "BOX位置6_LoadPosition6: " + portData.LoadPosition6.ToString() + "\n" // + "BOX位置7_LoadPosition7: " + portData.LoadPosition7.ToString() + "\n" // ; //label4.Text = // "AGV Port 專有訊號:\n" // + "開啟自動補退 BOX 功能_openAGV_Station: " + BCApp.SCApplication.TransferService.GetAGV_StationStatus(comboBox1.Text) + "\n" // + "AGV模式_IsAGVMode: " + portData.IsAGVMode.ToString() + "\n" // + "\n" // + "AGVPortReady: " + portData.AGVPortReady.ToString() + "\n" // + "AGVPortMismatch: " + portData.CSTPresenceMismatch.ToString() + "\n" // + "\n" // + "是否能開蓋: " + portData.CanOpenBox.ToString() + "\n" // + "開蓋狀態: " + portData.IsBoxOpen.ToString() + "\n" // + "\n" // ; #endregion //BCApp.SCApplication.getNatsManager().PublishAsync // (string.Format(sc.App.SCAppConstants.NATS_SUBJECT_Port_INFO_0, vh.VEHICLE_ID.Trim()), vh_Serialize); }