private void RFIDReader_HandDataBack(object sender, DataEventArgs e) { //查询是否当前用户领走的工具 string[] rfids = e.Data?.Split(';'); if (rfids == null || rfids.Length == 0) { return; } var state = ToolStates.FirstOrDefault(p => p.Code == ToolStateCode.Normal); if (state == null) { return; } foreach (var rfid in rfids) { //判断是否存在于归还列表 if (!ExistRFID(rfid)) { continue; } ToolRecord rcd = ToolRecords.First(p => p.Tool.RFID == rfid); //设置正常状态 rcd.IsReturn = true; rcd.ReturnStateId = state.Id; rcd.ReturnStateCode = state.Code; rcd.ReturnStateName = state.Name; } }
public static void SetToolState(ToolStates state = ToolStates.Default, MT_Tools tool = MT_Tools.Off, ushort toolPhase = 0) { ToolStates previousState = ToolState; if (ToolState != state) { if (state != ToolStates.ToolActive && state != ToolStates.Aligning) { UIMoreTools.m_activeToolMenu = null; } if (ToolState == ToolStates.ToolActive) { if (MT_Tool == MT_Tools.MoveTo) { m_moveToPanel.Visible(false); } } } ToolState = state; m_toolsMode = tool; m_alignToolPhase = toolPhase; if (state == ToolStates.ToolActive || state == ToolStates.Aligning || previousState == ToolStates.ToolActive || previousState == ToolStates.Aligning) { UIMoreTools.UpdateMoreTools(); } m_debugPanel?.UpdatePanel(); }
public bool StartTool(ToolStates newToolState, MT_Tools mode) { if (ToolState == ToolStates.Cloning || ToolState == ToolStates.RightDraggingClone) { StopCloning(); } if (ToolState != ToolStates.Default && ToolState != ToolStates.Aligning && ToolState != ToolStates.ToolActive) { return(false); } if (!Action.HasSelection()) { return(false); } SetToolState(newToolState, mode, 1); UIMoreTools.CheckCloseMenu(); return(true); }