//保存修改按钮事件 private void btn_Save_Click(object sender, RoutedEventArgs e) { try { if (xiugai_position.Text == "") { MessageBox.Show("请选择库位"); return; } if (Convert.ToInt32(xiugai_position.Text) > 80 || Convert.ToInt32(xiugai_position.Text) < 1) { MessageBox.Show("请选择正确的库位"); return; } if (Convert.ToInt32(xiugai_position.Text) == 44 || Convert.ToInt32(xiugai_position.Text) == 45) { MessageBox.Show("该库位为禁用库位,请选择其他库位"); return; } int position = Convert.ToInt32(xiugai_position.Text); int TrayStyle = xiugai_traystyle.SelectedIndex; DataBaseHandle db = new DataBaseHandle(); SqlConnection con = new SqlConnection(); db.SaveKuweiArray(con, position, TrayStyle); db.UpdateKuweiArray(con); Get_db_CargoInfo(); } catch (Exception ex) { MessageBox.Show("用户非法输入,请输入数字" + ex.ToString()); } }
//手动操作AGV时收到消息的处理方法 private void HandOperate() { if (package.Head == 10004) { MainWindow.whUIHandle.WH_OPER_STATE = "已收到出库指令"; LogInfoHelp.GetInstance().WriteInfoToLogFile("已收到出库指令", LogInfoHelp.LOG_TYPE.LOG_INFO); return; } if (package.Head == 20004) { if (package.InlibMatchingID == 1) { MainWindow.whUIHandle.WH_OPER_STATE = "已收到入库指令"; LogInfoHelp.GetInstance().WriteInfoToLogFile("已收到入库指令", LogInfoHelp.LOG_TYPE.LOG_INFO); } else { MainWindow.whUIHandle.WH_OPER_STATE = "入库托盘匹配不成功"; MessageBox.Show("入库托盘匹配不成功,请选择正确的托盘类型,或者检查托盘RFID码是否正确,否则RFID读写器可能出现异常"); LogInfoHelp.GetInstance().WriteInfoToLogFile("入库托盘匹配不成功", LogInfoHelp.LOG_TYPE.LOG_ERROR); } return; } if (package.Head == 30004) { MainWindow.whUIHandle.WH_OPER_STATE = "已收到侧边出库指令"; LogInfoHelp.GetInstance().WriteInfoToLogFile("已收到侧边出库指令", LogInfoHelp.LOG_TYPE.LOG_INFO); return; } if (package.Head == 10005) { if (package.OutlibMatchingID == 2) { MainWindow.whUIHandle.WH_OPER_STATE = "出库托盘匹配不成功"; MessageBox.Show("出库托盘匹配不成功,请检查MES系统的托盘位置和立库实际的托盘位置是否一致,否则RFID读写器可能出现异常"); LogInfoHelp.GetInstance().WriteInfoToLogFile("出库托盘匹配不成功", LogInfoHelp.LOG_TYPE.LOG_ERROR); } MainWindow.whUIHandle.WH_OPER_STATE = "已出库"; LogInfoHelp.GetInstance().WriteInfoToLogFile("已出库", LogInfoHelp.LOG_TYPE.LOG_INFO); DataBaseHandle db = new DataBaseHandle(); SqlConnection con = new SqlConnection(); db.SaveKuweiArray(con, MainWindow.whHandInfo.Position, 0); //更新库位表中的库位信息 db.UpdateKuweiArray(con); MainWindow.WHOperState = 0; //一个动作完成后,将手动动作置为默认 return; } if (package.Head == 20005) { MainWindow.whUIHandle.WH_OPER_STATE = "已入库"; LogInfoHelp.GetInstance().WriteInfoToLogFile("已入库", LogInfoHelp.LOG_TYPE.LOG_INFO); DataBaseHandle db = new DataBaseHandle(); SqlConnection con = new SqlConnection(); db.SaveKuweiArray(con, MainWindow.whHandInfo.Position, MainWindow.whHandInfo.TrayStyle); //更新库位表中的库位信息 db.UpdateKuweiArray(con); MainWindow.WHOperState = 0; //一个动作完成后,将手动动作置为默认 return; } if (package.Head == 30005) { if (package.OutlibMatchingID == 1) { MainWindow.whUIHandle.WH_OPER_STATE = "已侧边出库"; LogInfoHelp.GetInstance().WriteInfoToLogFile("已侧边出库", LogInfoHelp.LOG_TYPE.LOG_INFO); DataBaseHandle db = new DataBaseHandle(); SqlConnection con = new SqlConnection(); db.SaveKuweiArray(con, MainWindow.whHandInfo.Position, 0); //更新库位表中的库位信息 db.UpdateKuweiArray(con); MainWindow.WHOperState = 0; //一个动作完成后,将手动动作置为默认 return; } else if (package.OutlibMatchingID == 2) { MainWindow.whUIHandle.WH_OPER_STATE = "侧边托盘匹配不成功"; MessageBox.Show("侧边出库托盘匹配不成功,请检查MES系统的托盘位置和立库实际的托盘位置是否一致,否则RFID读写器可能出现异常"); LogInfoHelp.GetInstance().WriteInfoToLogFile("侧边托盘匹配不成功", LogInfoHelp.LOG_TYPE.LOG_ERROR); } } }