private void Plc_OnPLCDataReported(Xindeco.Device.Model.PLCData plcData) { if (plcData.Command == Xindeco.Device.Model.PLCRequest.OPEN_RFID) { StartInventory(); } else if (plcData.Command == Xindeco.Device.Model.PLCRequest.ASK_RESULT) { switch (mInventoryResult) { case 1: //正常 StopInventory(); mPlc.SendCommand(Xindeco.Device.Model.PLCResponse.RIGHT); break; case 3: //异常 StopInventory(); mPlc.SendCommand(Xindeco.Device.Model.PLCResponse.ERROR); break; default: break; } } }
public void setInventoryRe(bool ok) { if (mPLCType == PLC_TYPE.PLC_BJ) { if (ok) { //ok mModbus.WriteDO(1, true); } else { mModbus.WriteDO(2, true); } } if (mPLCType == PLC_TYPE.PLC_XD) { if (ok) { mPlc.SendCommand(Xindeco.Device.Model.PLCResponse.RIGHT); } else { mPlc.SendCommand(Xindeco.Device.Model.PLCResponse.ERROR); } } if (mPLCType == PLC_TYPE.PLC_DLX) { mPlc.SendCommand(Xindeco.Device.Model.PLCResponse.RIGHT); } }
private void button1_Click(object sender, EventArgs e) { try { plc.SendCommand((PLCResponse)5); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public void openMachineCommon() { try { if (plc != null) { plc.SendCommand((PLCResponse)5); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
void closeMachine() { try { PLCController plc = new PLCController(getPort()); if (plc.Connect()) { plc.SendCommand((PLCResponse)6); plc.Disconnect(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }