/// <summary> /// 开料尺寸 /// </summary> public virtual string ElecCuttingSize(EactConfig.ConfigData configData, double matchJiajuValue, Snap.Orientation topOrientation = null) { double blankstock = configData.PQBlankStock; if (Entry.Edition == 1) { return(string.Format("{0}x{1}x{2}", KL_SIZE_LEN , KL_SIZE_WIDTH , KL_SIZE_HEIGHT )); } Snap.Geom.Box3d elecBox; if (topOrientation == null) { elecBox = GetBox3d(); } else { elecBox = _body.AcsToWcsBox3d(topOrientation); } if (configData.Edition == 5) { var x = (int)Math.Ceiling(Math.Round(Math.Abs(elecBox.MaxX - elecBox.MinX), 4) + (configData.FZXBlankStock * 2)); var y = (int)Math.Ceiling(Math.Round(Math.Abs(elecBox.MaxY - elecBox.MinY), 4) + (configData.FZYBlankStock * 2)); var z = (int)Math.Ceiling(Math.Round(Math.Abs(elecBox.MaxZ - elecBox.MinZ), 4) + (configData.FZZBlankStock * 2)); if (configData.IsFZX5Integral && x % 5 != 0) { x = x - (x % 5) + 5; } if (configData.IsFZY5Integral && y % 5 != 0) { y = y - (y % 5) + 5; } if (configData.IsFZZ5Integral && z % 5 != 0) { z = z - (z % 5) + 5; } return(string.Format("{0}x{1}x{2}", x, y, z)); } else { var z = (int)Math.Ceiling(Math.Round(Math.Abs(elecBox.MaxZ - elecBox.MinZ), 4) + (matchJiajuValue)); if (z % 5 != 0) { z = z - (z % 5) + 5; } return(string.Format("{0}x{1}x{2}", (int)Math.Ceiling(Math.Round(Math.Abs(elecBox.MaxX - elecBox.MinX), 4) + (blankstock * 2)) , (int)Math.Ceiling(Math.Round(Math.Abs(elecBox.MaxY - elecBox.MinY), 4) + (blankstock * 2)) , z )); } }
public override string ElecCuttingSize(EactConfig.ConfigData configData, double matchJiajuValue, Snap.Orientation topOrientation = null) { var str = _body.GetAttrValue("UP_ELECTRODE_SPECIFICATION"); var strs = str.Split('X').ToList(); if (strs.Count >= 3) { return(string.Format("{0}x{1}x{2}", strs[0].Trim() , strs[1].Trim() , strs[2].Trim() )); } return(base.ElecCuttingSize(configData, matchJiajuValue, topOrientation)); }
public static void FtpUpload(string type, ElecManage.MouldInfo steelInfo, string fileName, string partName, EactConfig.ConfigData ConfigData) { string sToPath = string.Format("{0}/{1}/{2}", type, steelInfo.MODEL_NUMBER, partName); var extension = Path.GetExtension(fileName).ToUpper(); switch (ConfigData.FtpPathType) { case 1: { if (extension.Contains("STP") || extension.Contains("TXT") || extension.Contains("PDF")) { } else { sToPath = string.Format("{0}/{1}", type, steelInfo.MODEL_NUMBER, partName); } break; } case 2: { sToPath = string.Format("{0}/{1}", type, steelInfo.MODEL_NUMBER, partName); break; } } if ((ConfigData.Edition == (int)EACTEdition.HTUP || ConfigData.Edition == (int)EACTEdition.YC) && extension.Contains("PDF")) { sToPath = string.Format("{0}/{1}", type, steelInfo.MODEL_NUMBER, partName); } if (ConfigData.Edition == (int)EACTEdition.HTUP && type == FtpTypeConst.CNC && !string.IsNullOrEmpty(ConfigData.FileLocalDir) ) { var tempPath = sToPath.Split('/').ToList(); if (tempPath.Count > 0) { tempPath = tempPath.Skip(1).Take(tempPath.Count - 1).ToList(); } var path = Path.Combine(ConfigData.FileLocalDir, string.Join(@"\", tempPath.ToArray())); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } File.Copy(fileName, Path.Combine(path, Path.GetFileName(fileName)), true); } else { var EACTFTP = FlieFTP.Entry.GetFtp(ConfigData.FTP.Address, "", ConfigData.FTP.User, ConfigData.FTP.Pass, false); if (!EACTFTP.DirectoryExist(sToPath)) { EACTFTP.MakeDirPath(sToPath); } EACTFTP.NextDirectory(sToPath); EACTFTP.UpLoadFile(fileName); } }
public static string GetConnStr(EactConfig.ConfigData data) { var connStr = string.Format("Data Source={0};Initial Catalog={1};User ID={2};Password={3}", data.DataBaseInfo.IP, data.DataBaseInfo.Name, data.DataBaseInfo.User, data.DataBaseInfo.Pass); return(connStr); }
static void InitDatabase(EactConfig.ConfigData data) { var connStr = CommonInterface.DatabaseHelper.GetConnStr(data); DataAccess.Entry.Instance.Init(connStr); }
/// <summary> /// 获取取点信息 /// </summary> public static GetPointInfo GetCMMPointInfo(List <PointData> points, ElecManage.Electrode elec, EactConfig.ConfigData configData) { var info = new GetPointInfo(); var elecInfo = elec.GetElectrodeInfo(); info.basestationh = Math.Round(elecInfo.BasestationH, 4); info.sizex = elecInfo.X; info.sizey = elecInfo.Y; info.sizez = elecInfo.Z; var box = elec.ElecBody.Box; info.boxMaxX = Math.Round(box.MaxXYZ.X, 4); info.boxMaxY = Math.Round(box.MaxXYZ.Y, 4); info.boxMaxZ = Math.Round(box.MaxXYZ.Z, 4); info.boxMinX = Math.Round(box.MinXYZ.X, 4); info.boxMinY = Math.Round(box.MinXYZ.Y, 4); info.boxMinZ = Math.Round(box.MinXYZ.Z, 4); info.headh = Math.Round(elecInfo.HEADPULLUPH, 4); info.partname = elecInfo.Elec_Name; info.cornor = ((int)elec.GetCMMQuadrantType(configData.QuadrantType)) + 1; var MODEL_NUMBER = elecInfo.EACT_MODELNO; info.mouldname = MODEL_NUMBER; var trans = Snap.Geom.Transform.CreateTranslation(); if (elec.BaseFace != null) { var midPoint = elec.BaseFace.GetCenterPoint(); trans = Snap.Geom.Transform.CreateTranslation(new Snap.Position() - midPoint); } //TODO 电极取点的象限角 points.ForEach(u => { var pointInfo = new CMM.GetPointInfo.PointInfo(); u.Position = u.Position.Copy(trans); pointInfo.pointname = u.PointName; pointInfo.arrow = u.Arrow; pointInfo.TIP = string.Format("A{0}B{1}", u.A, u.B); pointInfo.a = u.A; pointInfo.b = u.B; pointInfo.type = (int)u.PointType; pointInfo.x = System.Math.Round(u.Position.X, 4); pointInfo.y = System.Math.Round(u.Position.Y, 4); pointInfo.z = System.Math.Round(u.Position.Z, 4); pointInfo.i = System.Math.Round(u.Vector.X, 4); pointInfo.j = System.Math.Round(u.Vector.Y, 4); pointInfo.k = System.Math.Round(u.Vector.Z, 4); info.pointlist.Add(pointInfo); }); return(info); }