private void Dsiplay(int rcpid) { try { Manager.IRcp.LoadRcp(rcpid); Recipes rcp = Manager.IRcp.GetRcp(); CameraRecipe camrcp = Manager.IRcp.GetCameraRcp(); ScanRecipe scanrcp = Manager.IRcp.GetScanRcp(); ControlRecipe ctrlrcp = Manager.IRcp.GetControlRcp(); if (rcp != null) { txtRcpId.Text = rcp.RecipeId.ToString(); txtRcpName.Text = rcp.Name; ndpVersion.Value = rcp.Version; DisplayCamera(camrcp); DisplayScan(scanrcp); DisplayControl(ctrlrcp); isChange = false; } } catch (Exception ex) { Dialogs.Show(ex); } }
public ScanRecipe GetScanRecipe(int userid) { ScanRecipe rect = null; try { ISqlMapper mapper = Mapper.Instance(); rect = (ScanRecipe)mapper.QueryForObject("SelectScanRecipe", userid); } catch (Exception ex) { Logger.Error(ex); } return(rect); }
public bool Update(ScanRecipe obj) { bool rect = false; try { ISqlMapper mapper = Mapper.Instance(); mapper.Update("UpdateScanRecipe", obj); rect = true; } catch (Exception ex) { Logger.Error(ex); } return(rect); }
private ScanRecipe Form2ScanPara() { ScanRecipe rcp = new ScanRecipe(); rcp.RecipeId = DataUtility.ParseInt(txtRcpId.Text); rcp.ZeroX = DataUtility.ParseFloat(txtZeroX.Text); rcp.ZeroY = DataUtility.ParseFloat(txtZeroY.Text); rcp.SpeedX = DataUtility.ParseFloat(txtSpeedX.Text); rcp.SpeedY = DataUtility.ParseFloat(txtSpeedY.Text); rcp.SwathRows = DataUtility.ParseInt(txtSwathRows.Text); rcp.SwathColumns = DataUtility.ParseInt(txtSwathColumn.Text); rcp.SwathWidth = DataUtility.ParseFloat(txtSwathWidth.Text); rcp.SwathHeight = DataUtility.ParseFloat(txtSwathHeight.Text); rcp.ScanZPostion = DataUtility.ParseFloat(txtZStatPos.Text); return(rcp); }
private void DisplayScan(ScanRecipe rcp) { if (rcp == null) { return; } txtZeroX.Text = rcp.ZeroX.ToString(); txtZeroY.Text = rcp.ZeroY.ToString(); txtSpeedX.Text = rcp.SpeedX.ToString(); txtSpeedY.Text = rcp.SpeedY.ToString(); txtSwathRows.Text = rcp.SwathRows.ToString(); txtSwathColumn.Text = rcp.SwathColumns.ToString(); txtSwathWidth.Text = rcp.SwathWidth.ToString(); txtSwathHeight.Text = rcp.SwathHeight.ToString(); txtZStatPos.Text = rcp.ScanZPostion.ToString(); }
public bool UpdateRecipe(Recipes rcp, CameraRecipe camrcp, ScanRecipe scanrcp, ControlRecipe ctrlrcp) { bool rect = false; try { RecipesDao dao = new RecipesDao(); rect = dao.Update(rcp); CameraRecipeDao camdao = new CameraRecipeDao(); if (camdao.GetCameraRecipe(rcp.RecipeId) == null) { rect = camdao.Insert(camrcp); } else { rect = camdao.Update(camrcp); } ScanRecipeDao scandao = new ScanRecipeDao(); if (scandao.GetScanRecipe(rcp.RecipeId) == null) { rect = scandao.Insert(scanrcp); } else { rect = scandao.Update(scanrcp); } ControlRecipeDao ctrldao = new ControlRecipeDao(); if (ctrldao.GetControlRecipe(ctrlrcp.RecipeId) == null) { rect = ctrldao.Insert(ctrlrcp); } else { rect = ctrldao.Update(ctrlrcp); } } catch (Exception ex) { LogHelper.AppLoger.Error(ex); } return(rect); }
private void NewRecipe() { try { DBCtrl.DAO.RecipesDao dao = new DBCtrl.DAO.RecipesDao(); int maxid = dao.MaxRecipeId(); txtRcpId.Text = maxid.ToString(); ndpVersion.Value = 1; txtRcpName.Text = ""; CameraRecipe camrcp = new CameraRecipe(); DisplayCamera(camrcp); ScanRecipe scanrcp = new ScanRecipe(); DisplayScan(scanrcp); ControlRecipe ctrlrcp = new ControlRecipe(); DisplayControl(ctrlrcp); } catch (Exception ex) { Dialogs.Show(ex); } }
public bool AddRecipe(Recipes rcp, CameraRecipe camrcp, ScanRecipe scanrcp, ControlRecipe ctrlrcp) { bool rect = false; try { RecipesDao dao = new RecipesDao(); rect = dao.Insert(rcp); CameraRecipeDao camdao = new CameraRecipeDao(); rect = camdao.Insert(camrcp); ScanRecipeDao scandao = new ScanRecipeDao(); rect = scandao.Insert(scanrcp); ControlRecipeDao ctrldao = new ControlRecipeDao(); rect = ctrldao.Insert(ctrlrcp); } catch (Exception ex) { LogHelper.AppLoger.Error(ex); } return(rect); }
public void LoadRcp(int rcp_id) { try { RecipesDao dao = new RecipesDao(); _curRcp = dao.GetRecipe(rcp_id); CameraRecipeDao camdao = new CameraRecipeDao(); _curCameraRcp = camdao.GetCameraRecipe(rcp_id); ScanRecipeDao scandao = new ScanRecipeDao(); _curScanRcp = scandao.GetScanRecipe(rcp_id); ControlRecipeDao ctrldao = new ControlRecipeDao(); _curControlRcp = ctrldao.GetControlRecipe(rcp_id); RecipeId = _curRcp.RecipeId; RecipeName = _curRcp.Name; IsChangeRcp = true; } catch (Exception ex) { LogHelper.AppLoger.Error(ex); } }
private void AutoProcFun() { DateTime startTmr = DateTime.Now; long jobId = 0; try { bool isSetRect = false; MessageBody msgBody = new MessageBody(); //check rcp JobStart(ref jobId); scanRcp = Manager.IRcp.GetScanRcp(); camRcp = Manager.IRcp.GetCameraRcp(); ctrlRcp = Manager.IRcp.GetControlRcp(); //set change flage IsChangeCamRcp = Manager.IRcp.IsChangeRcp; IsChangeCtrlRcp = Manager.IRcp.IsChangeRcp; IsChangeScanRcp = Manager.IRcp.IsChangeRcp; Manager.IRcp.IsChangeRcp = false; //after set is false //start sacn start_z_pos = scanRcp.ScanZPostion; msgBody.type = MsgType.Information; msgBody.msg = "开始扫描"; ThrowMessage(msgBody); //Manager.ICamCtrl.EndAcquisition(); //1. auto focus isSetRect = AutoFocus(); if (!isSetRect) { LogHelper.AppLoger.Error("auto focus failed."); msgBody.type = MsgType.Error; msgBody.msg = "自动聚焦失败"; //ThrowMessage(msgBody); } //Manager.ICamCtrl.EndAcquisition(); //2. run start pos. float x = scanRcp.ZeroX == 0 ? -2.5f : scanRcp.ZeroX; float y = scanRcp.ZeroY == 0 ? -10f : scanRcp.ZeroY; isSetRect = MoveAxisPos(x, y); if (!isSetRect) { LogHelper.AppLoger.Error("move start pos failed. abort move"); msgBody.type = MsgType.Error; msgBody.msg = "运动到起始位置异常,Abort"; ThrowMessage(msgBody); } //auto focus faild move z to targer pos if (!isSetRect) { Manager.IMotorCtrl.Move(3, start_z_pos); Thread.Sleep(20); if (!IsOnPosZ(start_z_pos)) { LogHelper.AppLoger.ErrorFormat("failed to move z pos.{0}", start_z_pos); } } //set follow z //SetFollowZ();暂时屏蔽,20181213,顾叶俊 //3. set camer rcp isSetRect = SetCamRcp(); if (!isSetRect) { LogHelper.AppLoger.Error("Set camera rcp failed."); msgBody.type = MsgType.Error; msgBody.msg = "设置相机参数失败"; ThrowMessage(msgBody); } //4. set devic rcp isSetRect = SetMoveRcp(); if (!isSetRect) { LogHelper.AppLoger.Error("Set move rcp failed."); msgBody.type = MsgType.Error; msgBody.msg = "设置控制参数失败"; ThrowMessage(msgBody); } //5. set trigger para isSetRect = SetTriggerRcp(); if (!isSetRect) { LogHelper.AppLoger.Error("Set trigger rcp failed."); msgBody.type = MsgType.Error; msgBody.msg = "设置触发板参数失败"; ThrowMessage(msgBody); } //6. scan glass ScanFun(); //send to camera ctrl grab end Manager.ICamCtrl.IsGrabEnd = true; Manager.IMotorCtrl.SetOcaOff(); //6.end sacn ,move to home ThrowStat(EnumStat.HomePos); //7.move z to trigger while (true) { if (Manager.ICamCtrl.CurrentSwathCount == 0) { break; } else { Thread.Sleep(100); } } ////send to camera ctrl grab end //Manager.ICamCtrl.ReSetSwatchId(); //if (scan_cnt==0) //{ // start_z_pos = start_z_pos - 0.012f; //} //else if(scan_cnt==1) //{ // start_z_pos = start_z_pos + 0.024f; //} //else //{ // start_z_pos = scanRcp.ScanZPostion; //} SystemStatus.Instance.ZStackID = "Z" + start_z_pos; BatchId = "Z" + start_z_pos; //float tmz = 6.8f; Manager.IMotorCtrl.Move(3, start_z_pos); if (!IsOnPosZ(start_z_pos)) { LogHelper.AppLoger.ErrorFormat("failed to move z pos.{0}", start_z_pos); } TimeSpan ustT = DateTime.Now - startTmr; msgBody.type = MsgType.Information; //msgBody.msg = string.Format("结束扫描,扫描用时:{0} 毫秒", ustT.TotalMilliseconds); msgBody.msg = "扫描结束"; ThrowMessage(msgBody); ThrowStat(EnumStat.ScanFinish); } catch (Exception ex) { LogHelper.AppLoger.Error(ex); } finally { TimeSpan ustT = DateTime.Now - startTmr; if (ustT.TotalMilliseconds > 10) { LogHelper.AppLoger.DebugFormat("Auto proc fun use time {0} mil sec", ustT.TotalMilliseconds); } //IsScan = false; scan_cnt++; if (scan_cnt >= scanRcp.SwathColumns) { IsScan = false; Move2LoadPort(); MessageBody msgBody = new MessageBody(); msgBody.type = MsgType.Information; msgBody.msg = "整体扫描结束"; ThrowMessage(msgBody); ThrowStat(EnumStat.ScanFinish); scan_cnt = 0; } else { //send to camera ctrl grab end Manager.ICamCtrl.ResetSwatchId(); } JobEnd(jobId); Thread.Sleep(2000); evt_Auto.Set(); } }