public static DesignBody CreateCircle(Frame frame, double diameter, IPart part) { Plane plane = Plane.Create(frame); List<ITrimmedCurve> profile = new List<ITrimmedCurve>(); Circle circle = Circle.Create(frame, diameter / 2); profile.Add(CurveSegment.Create(circle)); Body body = null; try { body = Body.CreatePlanarBody(plane, profile); } catch { Debug.Assert(false, "Exception thrown creating body"); } if (body == null) { Debug.Fail("Profile was not connected, not closed, or not in order."); return null; } if (part == null) part = Window.ActiveWindow.ActiveContext.ActivePart; DesignBody desBodyMaster = DesignBody.Create(part.Master, "Circle", body); desBodyMaster.Transform(part.TransformToMaster); return desBodyMaster; }
public void RemoveQueryPart(IPart part) { for(int i=0,size=parts.Length;i<size;i++){ if(parts[i].Equals(part)){ parts[i] = null; } } }
public static DesignBody CreateCable(ITrimmedCurve iTrimmedCurve, double diameter, IPart part) { Body body = CreateCable(iTrimmedCurve, diameter); if (part == null) part = Window.ActiveWindow.ActiveContext.ActivePart; DesignBody desBodyMaster = DesignBody.Create(part.Master, "Sweep", body); desBodyMaster.Transform(part.TransformToMaster); return desBodyMaster; }
public EntityPartPresenter(IPart part, IEntityPartView partView) { _part = part; _partView = partView; _fieldViews= new ObservableCollection<IFieldView>(); part.Fields.Run(x => _fieldViews.Add(x.BuildFieldView())); _sendCommand = new DelegateCommand<object>(x => { _partView.SwitchToViewMode(); InEditingMode = false; }, x => InEditingMode); _cancelCommand = new DelegateCommand<object>(x => { _partView.SwitchToViewMode(); InEditingMode = false; }, x => InEditingMode); }
public void StartWork() { TeamLeader leader = (TeamLeader)Workers.FirstOrDefault(f => f.IsTeam == true); for (int i = 0; i < ListWork.Count; i++) { Worker w = leader[leader.GetWorkerID()]; IPart p = GetWork(); if (p != null) { ListWork.IndexOf(p); } } }
public void AddAlreadyExistingPartThrowsInvalidOperationException( string deviceTypeString, string deviceMake, string partTypeString) { Type deviceType = this.partAssembly.GetTypes().First(x => x.Name == deviceTypeString); IRepairable deviceInstance = (IRepairable)Activator.CreateInstance(deviceType, deviceMake); Type partType = this.partAssembly.GetTypes().First(x => x.Name == partTypeString); IPart part = (IPart)Activator.CreateInstance(partType, "processor", 350.97m, false); deviceInstance.AddPart(part); Assert.Throws <InvalidOperationException>(() => deviceInstance.AddPart(part)); }
public bool AddCollider(IPart part, IPart other) { if (!mAllowOverlapRecords.TryGetValue(part, out var set)) { set = new HashSet <IPart>(); mAllowOverlapRecords.Add(part, set); } if (set.Add(other)) { DebugUtility.Log(LoggerTags.Project, "Add Collider : {0}, {1}, Frame ({2})", ((Part)part).GetComponentInfo(), ((Part)other).GetComponentInfo(), Time.frameCount); return(true); } return(false); }
public void InitToGetTheNearestPointInPart(IPart part, int AncestorLevelSequence, IM2MStructure M2MS, IPosition point) { this.AncestorLevelSequence = AncestorLevelSequence; this.M2MS = M2MS; currentPart = part; comparePoint = point; nearestDistanceSquare = float.MaxValue; upperBound = float.MaxValue; lowerBound = 0; leftBound = 0; rightBound = float.MaxValue; }
public Command(IPart id, IPart hostID, IPart target, IPart order, IPart data, Timestamp timestamp) { _executeValidation = Validate; ID = id; HostID = hostID; Target = target; Order = order; Data = data; Timestamp = timestamp; ErrorState = ErrorState.Unchecked(); SetUpStateToValidationMap(); SetupPartCollection(ID, HostID, Target, Order, Data); }
private IPart[] GetAttachedPart(IPart part) { List <IPart> parts = new List <IPart>(); foreach (IPort p in part.Ports) { if (p.AttachedPort != null) { parts.Add(p.AttachedPort.Part); } } return(parts.ToArray()); }
public override bool FireEvent(Event E) { if (E.ID == "ObjectCreated") { if (bCreated) { return(true); } bCreated = true; string Title = LegendaryDogsDogBuilder.Titles.GetRandomElement(); if (Title == "Good") { Title = LegendaryDogsDogBuilder.BuildGoodTitle(); VeryGoodText = Title.ToLower(); } ParentObject.DisplayName = LegendaryDogsDogBuilder.BuildName(ParentObject.DisplayName, Title); AddModifiers(); } else if (E.ID == "BeforeDeathRemoval" && this.GoodFactionPenalty > 0) { GameObject gameObjectParameter = E.GetGameObjectParameter("Killer"); if (gameObjectParameter != null && (gameObjectParameter.IsPlayer() || gameObjectParameter.IsPlayerLed())) { Popup.Show("You murdered a " + VeryGoodText + " dog. You are cursed."); } } else if (E.ID == "AfterLookedAt" && ParentObject.DisplayName.Contains("Loveable")) { GameObject Looker = E.GetGameObjectParameter("Looker"); if (Looker == null) { Looker = XRLCore.Core.Game.Player.Body; } if (!Looker.HasEffect("Lovesick")) { if (Looker.IsPlayer()) { Popup.Show("You feel your heart beating in your chest after seeing how loveable " + ParentObject.DisplayNameOnly + " is."); } else { IPart.AddPlayerMessage(Looker.The + Looker.DisplayNameOnly + Looker.Is + " visibly struck by how loveable " + ParentObject.DisplayNameOnly + " is."); } Looker.ApplyEffect(new Lovesick(100, ParentObject)); } } return(base.FireEvent(E)); }
public bool GasCheck() { if (!Ability.ToggleState) { return(false); } if (!IsReady(UseCharge: true)) { IPart.AddPlayerMessage(ParentObject.The + ParentObject.DisplayNameOnly + " sputters and stalls."); Ability.ToggleState = false; } return(Ability.ToggleState); }
public static int CalculateTime(Worker[] workers, IPart part) { if (workers.Length == 0) { throw new Exception("Количество рабочих равняется нулю!"); } int TimeForConstruction = part.GetTimeForConstruction - workers.Length + 1; if (TimeForConstruction < 1) { TimeForConstruction = 1; } return(TimeForConstruction); }
static void Main(string[] args) { List <IPart> all = new List <IPart>(); IWorker allWorkers = new Team(); IPart basement = null; IPart walls = null; IPart walls2 = null; IPart house = null; IPart door = null; IPart roof = null; while (!all.Contains(house)) { if (!all.Contains(basement)) { basement = new Basement(); all.Add(basement); } if (!all.Contains(walls)) { walls = new Walls(); all.Add(walls); } if (!all.Contains(walls2)) { walls2 = new Walls(); all.Add(walls2); } if (!all.Contains(door)) { door = new Door(); all.Add(door); } if (!all.Contains(roof)) { roof = new Roof(); all.Add(roof); } else { house = new House(); all.Add(house); } } foreach (var item in all.Reverse <IPart>()) { Console.WriteLine(item.Create()); } Console.ReadLine(); }
public IPart CreatePart(string partType, string model, double weight, decimal price, int additionalParameter) { Type type = Assembly .GetCallingAssembly() .GetTypes() .First(t => t.Name.Contains(partType)); Object[] args = { model, weight, price, additionalParameter }; IPart part = (IPart)Activator.CreateInstance(type, args); return(part); }
public void Seed_OptionsNoText_Null() { TiledTextLayerPartSeeder seeder = new TiledTextLayerPartSeeder(); seeder.SetSeedOptions(_seedOptions); seeder.Configure(new TiledTextLayerPartSeederOptions { MaxFragmentCount = 3 }); IPart part = seeder.GetPart(_item, "fr.net.fusisoft.comment", _factory); Assert.Null(part); }
public void OnPartSeparation(IPart other) { var robot = this.robot; if (robot == null) { return; } if (this.isKinematicReady) { robot.physicsSystem.RemoveMotionCollider(this, other); } }
public void Seed_InvalidOptions_Null() { TiledTextLayerPartSeeder seeder = new TiledTextLayerPartSeeder(); seeder.SetSeedOptions(_seedOptions); seeder.Configure(new TiledTextLayerPartSeederOptions { MaxFragmentCount = 0 }); IPart part = seeder.GetPart(_item, null, _factory); Assert.Null(part); }
public Form_MainIPart(FileInfo _fileInfo, IPart _iPart) : base(_fileInfo, _iPart) { InitializeComponent(); if (LicenseManager.UsageMode == LicenseUsageMode.Runtime) { if (!this.iPartViewer1.MergeMenuStripWith(base.MenuStrip1)) { throw new Exception(); } } }
public IPart Parse(byte[] source, string attachmentDirectory) { IPart part = null; if (this.IsValidMultipart(source)) { return(this.ParseMultipart(source, attachmentDirectory)); } if (this.IsValidSimplePart(source)) { part = this.ParseSimplePart(source, attachmentDirectory); } return(part); }
public List <IDesignBody> GatherAllVisibleBodies(IPart part, Window window) { List <IDesignBody> allBodies = new List <IDesignBody>(); var tempList = new List <IDesignBody>(); tempList.AddRange(part.GetDescendants <IDesignBody>()); foreach (IDesignBody body in tempList) { if (CheckIfVisible(body, window)) { allBodies.Add(body); } } return(allBodies); }
public IPart CreatePart(string partType, string model, double weight, decimal price, int additionalParameter) { Type type = Assembly.GetCallingAssembly() .GetTypes() .FirstOrDefault(t => t.Name == partType + PartNameSuffix); if (type == null) { throw new ArgumentNullException("This Part type does not exist!"); } IPart part = (IPart)Activator.CreateInstance(type, model, weight, price, additionalParameter); return(part); }
public IPart CreatePart(string partType, string model, double weight, decimal price, int additionalParameter) { Type type = Assembly.GetCallingAssembly() .GetTypes() .FirstOrDefault(t => t.Name == partType + PartNameSuffix); var constructorInfo = type.GetConstructors(); IPart part = (IPart)Activator.CreateInstance(type, model, weight, price, additionalParameter); return(part); }
public IPositionSet ApproximateSearchKNearestNeighbor(IPosition targetPoint, int k) { KNearestPointSList = new SortedList <float, IPosition>(); KNearestPointSList.Capacity = k; IPart targetPart = null; int targetPartLevelSequence = SearchTheTargetPart(targetPoint, ref targetPart); GetOnePointAndDetermineNearestPointIsChanged = SearchKNearestPointInComparedPointSet; DiffuseFromOriginByPartInSpecialLevel(targetPoint, targetPartLevelSequence); return(new PositionSetEdit_ImplementByICollectionTemplate(KNearestPointSList.Values)); }
public static DesignBody CreateBlock(Point point1, Point point2, IPart part) { List <Point> points = new List <Point>(); points.Add(point1); points.Add(Point.Create(point2.X, point1.Y, point1.Z)); points.Add(Point.Create(point2.X, point2.Y, point1.Z)); points.Add(Point.Create(point1.X, point2.Y, point1.Z)); return(CreatePolygon( points, Plane.Create(Frame.Create(point1, Direction.DirX, Direction.DirY)), point2.Z - point1.Z, part)); }
public void Register(IPart part) { if (part is IConsumer) { _consumers.Add((IConsumer)part); } if (part is IGenerator) { _generators.Add((IGenerator)part); } if (part is IStorer) { _storers.Add((IStorer)part); } }
public static IKsJackDescription KsJackDescription(this IPart part) { var attribute = typeof(IKsJackDescription).GetCustomAttributes(typeof(GuidAttribute), true).Cast <GuidAttribute>().FirstOrDefault(); if (attribute == null) { return(null); } var iidKsJackDescription = new Guid(attribute.Value); part.Activate((uint)CLSCTX.CLSCTX_INPROC_SERVER, ref iidKsJackDescription, out var instancePtr); return(instancePtr as IKsJackDescription); }
void Decompress(IPart part) { using (MemoryStream sourceStream = new MemoryStream(part.OriginalData)) { using (MemoryStream resultStream = new MemoryStream()) { using (Stream gZipStream = new GZipStream(sourceStream, CompressionMode.Decompress)) { gZipStream.CopyTo(resultStream, part.Count); } part.ResultData = resultStream.ToArray(); } } _manager.WritePartOfFile(part); }
private void OnGetQueryPart(ILevel level, int levelSequence, IPart part) { lock (layers) { PositionSetEdit_ImplementByICollectionTemplate partSet = new PositionSetEdit_ImplementByICollectionTemplate(); partSet.AddPosition(part); Layer_M2MPartSetInSpecificLevel layer = new Layer_M2MPartSetInSpecificLevel(level, partSet); layer.MainColor = Color.FromArgb(255, 0, 0); layer.Active = true; layers.Add(layer); } flowControlerForm.BeginInvoke(Update); flowControlerForm.SuspendAndRecordWorkerThread(); }
public static DesignBody CreateBlock(Point point1, Point point2, IPart part) { List<Point> points = new List<Point>(); points.Add(point1); points.Add(Point.Create(point2.X, point1.Y, point1.Z)); points.Add(Point.Create(point2.X, point2.Y, point1.Z)); points.Add(Point.Create(point1.X, point2.Y, point1.Z)); return CreatePolygon( points, Plane.Create(Frame.Create(point1, Direction.DirX, Direction.DirY)), point2.Z - point1.Z, part); }
public void Work(House obj) { IPart workSection = FindWhatToDo(obj); if (workSection == null) { obj.houseIsBuilt = true; Console.WriteLine("Не нужен"); } else { DoYourWork(workSection); Console.WriteLine("Работает весь день"); } }
public void PartConstructorWorksCorrectlyWithTwoParameters( string partTypeString, string partName, decimal partCost) { Type partType = this.partAssembly.GetTypes().First(x => x.Name == partTypeString); IPart partInstance = (IPart)Activator.CreateInstance(partType, partName, partCost); this.GetMultiplier(partType, partInstance); Assert.AreEqual(partName, partInstance.Name); Assert.AreEqual(partCost * this.partCostMultiplier, partInstance.Cost); Assert.AreEqual(false, partInstance.IsBroken); }
protected BevelGear(IPart parent, GearData gearData, GearData conjugateGearData, ToothProfile toothProfile, double helicalAngle, double bevelAngle, double bevelKneeRatio, double depth) : base(parent, gearData, conjugateGearData, toothProfile, helicalAngle, depth) { BevelAngle = bevelAngle; BevelKneeRatio = bevelKneeRatio; StartPoint = Point.Create(0, 0, XOffset); EndPoint = StartPoint - Vector.Create(0, 0, Depth * Math.Cos(Alpha)); StartFrame = Frame.Create(StartPoint, Direction.DirX, -Direction.DirY); EndFrame = Frame.Create(EndPoint, Direction.DirX, -Direction.DirY); StartDiameter = GearData.PitchDiameter; EndDiameter = StartDiameter - 2 * Depth * Math.Sin(Alpha); StartCone = Cone.Create(StartFrame, StartDiameter / 2, Math.PI / 2 - Alpha); EndCone = Cone.Create(EndFrame, EndDiameter / 2, Math.PI / 2 - Alpha); }
public IPart CreatePart(string partType, string model, double weight, decimal price, int additionalParameter) { partType += "Part"; Assembly assembly = Assembly.GetCallingAssembly(); Type type = assembly.GetTypes().FirstOrDefault(t => t.Name == partType); if (type == null) { throw new InvalidOperationException("Invalid part type!"); } IPart part = (IPart)Activator.CreateInstance(type, model, weight, price, additionalParameter); return(part); }
public void PlaySong(GameObject player) { acegiak_Song song = ChooseSong(player); List <UnityEngine.GameObject> GOs = new List <UnityEngine.GameObject>(); foreach (string voice in SoundName.Split(';')) { string[] bits = voice.Split(':'); UnityEngine.GameObject gameObject; gameObject = new UnityEngine.GameObject(); gameObject.transform.position = new Vector3(0f, 0f, 1f); gameObject.name = "MusicPlayer"; gameObject.AddComponent <acegiak_AudioSequencer>(); UnityEngine.Object.DontDestroyOnLoad(gameObject); acegiak_AudioSequencer component = gameObject.GetComponent <acegiak_AudioSequencer>(); if (bits.Length > 1) { component.Read(bits[0], song.Notes, bits[1]); } else { component.Read(bits[0], song.Notes, String.Empty); } GOs.Add(gameObject); } foreach (UnityEngine.GameObject GO in GOs) { GO.GetComponent <acegiak_AudioSequencer>().Play(); } IPart.AddPlayerMessage((player.IsPlayer()?"You play":player.The + player.DisplayNameOnly + player.GetVerb("play")) + " " + song.Name + " on " + ParentObject.the + ParentObject.DisplayNameOnly); if (song.Effect != null) { //IPart.AddPlayerMessage("Effect:"+song.Effect); try{ Effect effect = Activator.CreateInstance(Type.GetType(song.Effect)) as Effect; //effect.Duration = Stat.Rnd2.Next(100); //IPart.AddPlayerMessage("Effect:"+effect.DisplayName); player.ApplyEffect(effect); }catch (Exception E) { Debug.Log("CAVES OF CHORDS COULD NOT LOAD PLAYER EFFECT: " + song.Effect); } } player.FireEvent(Event.New("PlayedSong", "Object", ParentObject)); }
public PartDialogWindow(IPart part) { this.InitializeComponent(); this.wiringDiagram.Wiring = part.Wiring; this.wiringDiagram.Refresh(); this.textBlock_Name.Text = part.Name; if (part.Notches == null) { this.textBlock_Notch.Text = "--"; } else { this.textBlock_Notch.Text = ""; foreach (int notch in part.Notches) { this.textBlock_Notch.Text += Util.IntToChar(notch); } } }
/// <summary> /// GetValue /// </summary> /// <param name="session"></param> /// <param name="product"></param> /// <param name="mb"></param> /// <param name="delivery"></param> /// <param name="part"></param> /// <param name="testLog"></param> /// <param name="name"></param> /// <param name="spliter"></param> /// <returns></returns> public static string GetValue(Session session, IProduct product, IMB mb, Delivery delivery, IPart part, TestLog testLog, string name, char spliter) { string ret = null; int index = name.IndexOf(spliter); if (index < 1) { throw new Exception("wrong method name : " + name); } string objName = name.Substring(0, index); string objMethod = name.Substring(index + 1).Trim(); if (resolveTestLog(testLog, objName, objMethod, true, out ret)) { return ret; } return getValueInner(session, product, mb, delivery, part, name, spliter, true); }
public override void AfterInit(IPart part, EventArgs e) { this.CostAccountantPart = part; IUFCard card = (IUFCard)part.GetUFControlByName(part.TopLevelContainer, "Card0"); IUFButton btnNavS = new UFWebButtonAdapter(); btnNavS.Text = ("自动分配"); btnNavS.ID = ("btnNavS"); btnNavS.AutoPostBack = (true); this.btnRefresh.Text = ("刷新"); this.btnRefresh.ID = ("btnRefresh"); this.btnRefresh.AutoPostBack = (true); this.btnRefresh.Visible = (false); card.Controls.Add(btnNavS); card.Controls.Add(this.btnRefresh); UIPlugHelper.Layout(card, btnNavS, 2, 0); btnNavS.Click += (new EventHandler(this.btnNavS_Click)); this.btnRefresh.Click += new EventHandler(this.btnRefresh_Click); IUFCard carddataGrid = (IUFCard)part.GetUFControlByName(part.TopLevelContainer, "Card4"); IUFDataGrid dataGrid = (IUFDataGrid)part.GetUFControlByName(carddataGrid, "DataGrid5"); dataGrid.Columns[7].Point = 4; }
public override void AfterInit(IPart Part, EventArgs e) { part = Part; _strongPart = Part as UFIDA.U9.SPR.SalePriceListBListUI.SalePriceListBListUIFormWebPart; // Card0 // 3 IUFCard card0 = (IUFCard)part.GetUFControlByName(part.TopLevelContainer, "Card0"); if (card0 != null) { IUFButton btn2DMS = new UFWebButtonAdapter(); btn2DMS.Text = "下发DMS"; btn2DMS.ID = "btn2DMS"; btn2DMS.AutoPostBack = true; btn2DMS.Click += new EventHandler(btn2DMS_Click); card0.Controls.Add(btn2DMS); HBHCommon.HBHCommonUI.UICommonHelper.Layout(card0, btn2DMS, 8, 0); // 确认对话框 UFIDA.U9.UI.PDHelper.PDFormMessage.ShowDelConfirmDialog(_strongPart.Page, "确认同步DMS?", "确认同步DMS", btn2DMS); } }
private string GetVenderCodeValue(IPart part) { IList<PartInfo> part_infos = part.Attributes; if (part_infos != null) { foreach (PartInfo part_info in part_infos) { if (part_info.InfoType.Equals("VendorCode")) { return part_info.InfoValue; } } } return ""; }
private void checkBindToAnotherProductForMB(IProduct thisProduct, IPart newPart) { IProductRepository ipr = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>(); IBOMPart bomPart = (IBOMPart)newPart; /* IList<IProduct> lstProduct = ipr.GetProductListByPCBID(bomPart.MatchedSn); if (lstProduct != null) { foreach (var product in lstProduct) { if (product.ProId != thisProduct.ProId) { List<string> erpara = new List<string>(); erpara.Add("SN"); erpara.Add(bomPart.MatchedSn); erpara.Add(product.ProId); var ex = new FisException("CHK009", erpara); ex.stopWF = false; throw ex; } } }*/ }
private bool CheckBomNodeType(IPart part, IList<CheckItemTypeRuleDef> lstChkItemRule) { if (lstChkItemRule == null || lstChkItemRule.Count == 0) { return false; } // Regex Regex1 = new Regex(pattern); string pattern; foreach (CheckItemTypeRuleDef chk in lstChkItemRule) { pattern = chk.BomNodeType; if (part.BOMNodeType == chk.BomNodeType || Regex.IsMatch(part.BOMNodeType,pattern)) { return true; } } return false; }
/// <summary> /// /// </summary> /// <param name="session"></param> /// <param name="product"></param> /// <param name="mb"></param> /// <param name="delivery"></param> /// <param name="part"></param> /// <param name="name"></param> /// <param name="spliter"></param> /// <returns></returns> public static string GetValue(Session session, IProduct product, IMB mb, Delivery delivery, IPart part, string name, char spliter) { int index = name.IndexOf(spliter); if (index < 1) { throw new Exception("wrong method name : " + name); } string objName = name.Substring(0, index).ToUpper(); string objMethod = name.Substring(index + 1).Trim(); if (objName == "PRODUCTINFO") { if (product == null) { throw new FisException("CQCHK0006", new List<string> { "ProductInfo" }); } return product.ProductInfoes .Where(x => x.InfoType == objMethod) .Select(y => y.InfoValue).FirstOrDefault(); } if (objName == "MODELINFO") { if (product == null) { throw new FisException("CQCHK0006", new List<string> { "Product" }); } return product.ModelObj.Attributes .Where(x => x.Name == objMethod) .Select(y => y.Value).FirstOrDefault(); } if (objName == "FAMILYINFO") { if (product == null) { throw new FisException("CQCHK0006", new List<string> { "Product" }); } string family = product.Family; IList<FamilyInfoDef> familyInfoList = familyRep.GetExistFamilyInfo(new FamilyInfoDef { family = family, name = objMethod }); if (familyInfoList == null || familyInfoList.Count == 0) { throw new FisException("CHK1036", new List<string> { family, objMethod }); } return familyInfoList[0].value; } if (objName == "PRODUCT") { if (product == null) { throw new FisException("CQCHK0006", new List<string> { "Product" }); } string value = (string)product.GetProperty(objMethod); if (string.IsNullOrEmpty(value)) { throw new FisException("not exists property name:" + name); } return value; } if (objName == "PCB") { if (mb == null) { throw new FisException("CQCHK0006", new List<string> { "PCB" }); } string value = (string)mb.GetProperty(objMethod); if (string.IsNullOrEmpty(value)) { throw new FisException("not exists property name:" + name); } return value; } if (objName == "PCBINFO") { if (mb == null) { throw new FisException("CQCHK0006", new List<string> { "PCB" }); } return mb.MBInfos .Where(x => x.InfoType == objMethod) .Select(y => y.InfoValue).FirstOrDefault(); } if (objName == "DELIVERY") { if (delivery == null) { throw new FisException("CQCHK0006", new List<string> { "Delivery" }); } string value = (string)delivery.GetProperty(objMethod); if (string.IsNullOrEmpty(value)) { throw new FisException("not exists property name:" + name); } return value; } if (objName == "DELIVERYINFO") { if (delivery == null) { throw new FisException("CQCHK0006", new List<string> { "Delivery" }); } return delivery.DeliveryInfoes .Where(x => x.InfoType == objMethod) .Select(y => y.InfoValue).FirstOrDefault(); } if (objName == "PART") { if (part == null) { throw new FisException("CQCHK0006", new List<string> { "Part" }); } string value = (string)part.GetProperty(objMethod); if (string.IsNullOrEmpty(value)) { throw new FisException("not exists property name:" + name); } return value; } if (objName == "PARTINFO") { if (part == null) { throw new FisException("CQCHK0006", new List<string> { "Part" }); } return part.Attributes .Where(x => x.InfoType == objMethod) .Select(y => y.InfoValue).FirstOrDefault(); } throw new Exception("not support resolve name:" + name); }
protected HypoidGear(IPart parent, GearData gearData, GearData conjugateGearData, ToothProfile toothProfile, double helicalAngle, double hypoidAngle, double hypoidOffset, double hypoidKneeRatio, double depth) : base(parent, gearData, conjugateGearData, toothProfile, helicalAngle, depth) { HypoidAngle = hypoidAngle; HypoidOffset = hypoidOffset; HypoidKneeRatio = hypoidKneeRatio; TangentLine = Line.Create(Point.Origin, Direction.DirZ).CreateTransformedCopy(TransformToTangent.Inverse); Debug.Assert(Accuracy.LengthIsZero(TangentLine.Origin.Y)); A = TangentLine.Origin.Vector.Magnitude; Point pointA = Point.Create(A, 0, 0); Point p0 = TangentLine.Origin; Point p1 = TangentLine.Evaluate(1).Point; p0 = Plane.PlaneYZ.ProjectPoint(p0).Point; p1 = Plane.PlaneYZ.ProjectPoint(p1).Point; B = A * (p1.Z - p0.Z) / (p1.Y - p0.Y); Depth = TangentLine.Evaluate(Depth).Point.Z; HypoidOffset = TangentLine.Evaluate(HypoidOffset).Point.Z; StartZ = HypoidOffset; EndZ = HypoidOffset + Depth; StartPoint = Point.Create(0, 0, StartZ); EndPoint = Point.Create(0, 0, EndZ); StartFrame = Frame.Create(StartPoint, Direction.DirX, -Direction.DirY); EndFrame = Frame.Create(EndPoint, Direction.DirX, -Direction.DirY); StartDiameter = GetHyperbolicRadius(StartZ) * 2; EndDiameter = GetHyperbolicRadius(EndZ) * 2; StartCone = GetConeAtParameter(StartZ); EndCone = GetConeAtParameter(EndZ); StartPlane = Plane.Create(StartFrame); EndPlane = Plane.Create(EndFrame); }
public static Gear Create(IPart parent, GearData gearData, GearData conjugateGearData, ToothProfile toothProfile, double helicalAngle, double screwAngle, double depth) { Gear gear = new StraightGear(parent, gearData, conjugateGearData, toothProfile, helicalAngle, screwAngle, depth); BuildGear(gear); return gear; }
public static Gear Create(IPart parent, GearData gearData, GearData conjugateGearData, ToothProfile toothProfile, double helicalAngle, double hypoidAngle, double hypoidOffset, double hypoidKneeRatio, double depth) { Gear gear = new HypoidGear(parent, gearData, conjugateGearData, toothProfile, helicalAngle, hypoidAngle, hypoidOffset, hypoidKneeRatio, depth); BuildGear(gear); return gear; }
/// <summary> /// constructure /// </summary> /// <param name="session">session object</param> /// <param name="modelName"> model name</param> /// <param name="moNo">MO Id</param> /// <param name="dnNo">Delivery No</param> /// <param name="partNo">Part No</param> /// <param name="customer">Customer</param> public PrintUtility(Session session, string modelName, string moNo, string dnNo, string partNo, string customer) { _session = session; _product =session.GetValue(Session.SessionKeys.Product) as Product; _mb = session.GetValue(Session.SessionKeys.MB) as MB; if (_product != null) { _customer = _product.Customer; if (string.IsNullOrEmpty(modelName) || modelName == _product.Model) { modelName = _product.Model; _model = _product.ModelObj; } if (string.IsNullOrEmpty(moNo)) { moNo = _product.MO; } if (string.IsNullOrEmpty(dnNo)) { dnNo = _product.DeliveryNo; } //if (!string.IsNullOrEmpty(dnNo)) // _delivery = dnRep.Find(dnNo); } else if (_mb != null) { _customer = _mb.Customer; if (string.IsNullOrEmpty(modelName) && !string.IsNullOrEmpty(_mb.MB1397)) { modelName = _mb.MB1397; _model = _mb.Model1397Obj; } if (string.IsNullOrEmpty(moNo)) { moNo = _mb.SMTMO; } if (string.IsNullOrEmpty(dnNo)) { dnNo = _mb.DeliveryNo; } //if (!string.IsNullOrEmpty(dnNo)) // _delivery = dnRep.Find(dnNo); if (string.IsNullOrEmpty(partNo)) { partNo = _mb.Model; } } _moNo = moNo; _modelName= modelName; _dnNo = dnNo; _partNo = partNo; if(string.IsNullOrEmpty(_customer)) { _customer = customer; } if(!string.IsNullOrEmpty(partNo)) { _part =partRep.Find(partNo); } if (_model == null && !string.IsNullOrEmpty(_modelName)) { _model= modelRep.Find(_modelName); } if (_delivery == null && !string.IsNullOrEmpty(_dnNo)) { _delivery = dnRep.Find(_dnNo); } }
private bool checkPart(IPart part, string name, string value) { bool ret = false; switch (name.ToUpper()) { case "PARTNO": ret = Regex.IsMatch(part.PN, value); break; case "DESCR": ret = Regex.IsMatch(part.Descr, value); break; case "BOMNODETYPE": ret = Regex.IsMatch(part.BOMNodeType, value); break; case "PARTTYPE": ret = Regex.IsMatch(part.Type, value); break; case "CUSTPARTNO": ret = Regex.IsMatch(part.CustPn, value); break; default: break; } return ret; }
/// <summary> /// /// </summary> /// <param name="session"></param> /// <param name="product"></param> /// <param name="mb"></param> /// <param name="delivery"></param> /// <param name="part"></param> /// <param name="name"></param> /// <param name="spliter"></param> /// <returns></returns> public static string GetValue(Session session, IProduct product, IMB mb, Delivery delivery, IPart part, string name, char spliter) { int index = name.IndexOf(spliter); if (index < 1) { throw new Exception("wrong method name : " + name); } string objName = name.Substring(0, index).ToUpper(); string objMethod = name.Substring(index + 1).Trim(); if (objName == GlobalConstName.ResolveValue.PRODUCTINFO) { if (product == null) { throw new FisException("CQCHK0006", new List<string> { "Product" }); } return product.ProductInfoes .Where(x => x.InfoType == objMethod) .Select(y => y.InfoValue).FirstOrDefault(); } if (objName == GlobalConstName.ResolveValue.PRODUCTATTR) { if (product == null) { throw new FisException("CQCHK0006", new List<string> { "Product" }); } if (product.ProductAttributes == null || !product.ProductAttributes.Any(x => x.AttributeName == objMethod)) { throw new FisException("CHK1036", new List<string> { product.ProId, name }); } return product.ProductAttributes .Where(x => x.AttributeName == objMethod) .Select(y => y.AttributeValue).FirstOrDefault().Trim(); } if (objName == GlobalConstName.ResolveValue.MODEL) { if (product == null) { throw new FisException("CQCHK0006", new List<string> { "Product" }); } if (product.ModelObj == null) { throw new FisException("CQCHK0006", new List<string> { "Product.ModelObj" }); } object value = product.ModelObj.GetProperty(objMethod); if (value == null) { return null; } return value.ToString().Trim(); } if (objName == GlobalConstName.ResolveValue.MODELINFO) { if (product == null) { throw new FisException("CQCHK0006", new List<string> { "Product" }); } if (product.ModelObj == null) { throw new FisException("CQCHK0006", new List<string> { "Product.ModelObj" }); } return product.ModelObj.Attributes .Where(x => x.Name == objMethod) .Select(y => y.Value).FirstOrDefault(); } if (objName == GlobalConstName.ResolveValue.FAMILYINFO) { if (product == null) { throw new FisException("CQCHK0006", new List<string> { "Product" }); } string family = product.Family; //IFamilyRepository familyRep = RepositoryFactory.GetInstance().GetRepository<IFamilyRepository>(); IList<FamilyInfoDef> familyInfoList = familyRep.GetExistFamilyInfo(new FamilyInfoDef { family = family, name = objMethod }); if (familyInfoList == null || familyInfoList.Count == 0) { throw new FisException("CHK1036", new List<string> { family, objMethod }); } return familyInfoList[0].value; } if (objName == GlobalConstName.ResolveValue.PRODUCT) { if (product == null) { throw new FisException("CQCHK0006", new List<string> { "Product" }); } object value = product.GetProperty(objMethod); if (value==null) { throw new FisException("not exists property name:" + name); } return value.ToString(); } #region disable for ICI HTC case //if (objName == GlobalConstName.ResolveValue.IMGOSVER) //{ // if (product == null) // { // throw new FisException("CQCHK0006", new List<string> { "Product" }); // } // if (product.ModelObj == null || // string.IsNullOrEmpty(product.ModelObj.OSCode) || // product.ModelObj.LastEffectiveOSVer == null) // { // throw new FisException("CQCHK0006", new List<string> { "No setup ImgOSVer" }); // } // object value = product.ModelObj.LastEffectiveOSVer.GetField(objMethod); // if (value == null) // { // throw new FisException("not exists field name:" + name); // } // return value.ToString().Trim(); //} #endregion if (objName == GlobalConstName.ResolveValue.PCB) { if (mb == null) { throw new FisException("CQCHK0006", new List<string> { "PCB" }); } object value = mb.GetProperty(objMethod); if (value == null) { throw new FisException("not exists property name:" + name); } return value.ToString(); } if (objName == GlobalConstName.ResolveValue.PCBINFO) { if (mb == null) { throw new FisException("CQCHK0006", new List<string> { "PCB" }); } return mb.MBInfos .Where(x => x.InfoType == objMethod) .Select(y => y.InfoValue).FirstOrDefault(); } if (objName == GlobalConstName.ResolveValue.DELIVERY) { if (delivery == null) { throw new FisException("CQCHK0006", new List<string> { "Delivery" }); } object value = delivery.GetProperty(objMethod); if (value == null) { throw new FisException("not exists property name:" + name); } return value.ToString(); } if (objName == GlobalConstName.ResolveValue.DELIVERYINFO) { if (delivery == null) { throw new FisException("CQCHK0006", new List<string> { "Delivery" }); } return delivery.DeliveryInfoes .Where(x => x.InfoType == objMethod) .Select(y => y.InfoValue).FirstOrDefault(); } if (objName == GlobalConstName.ResolveValue.PART) { if (part == null) { throw new FisException("CQCHK0006", new List<string> { "Delivery" }); } object value = part.GetProperty(objMethod); if (value==null) { throw new FisException("not exists property name:" + name); } return value.ToString(); } if (objName == GlobalConstName.ResolveValue.PARTINFO) { if (part == null) { throw new FisException("CQCHK0006", new List<string> { "Delivery" }); } return part.Attributes .Where(x => x.InfoType == objMethod) .Select(y => y.InfoValue).FirstOrDefault(); } if (objName == GlobalConstName.ResolveValue.SESSION) { if (session == null) { throw new FisException("CQCHK0006", new List<string> { "Session" }); } object value = session.GetValue(objMethod); if (value == null) { throw new FisException("not exists session key name:" + name); } return value.ToString().Trim(); } if (objName == GlobalConstName.ResolveValue.DATETIME) { DateTime now = DateTime.Now; return now.ToString(objMethod); } if (objName == GlobalConstName.ResolveValue.CONSTANT) { return objMethod; } throw new Exception("not support resolve name:" + name); }
private void checkBindToThisProductForMB(IProduct thisProduct, IPart newPart) { IBOMPart bomPart = (IBOMPart)newPart; /* string newPartSn = bomPart.MatchedSn; if (string.Compare(thisProduct.PCBID, newPartSn, true) == 0) { List<string> erpara = new List<string>(); erpara.Add("SN"); erpara.Add(newPartSn); var ex = new FisException("CHK083", erpara); ex.stopWF = false; throw ex; }*/ }
public static Gear Create(IPart parent, GearData gearData, GearData conjugateGearData, ToothProfile toothProfile, double helicalAngle, double bevelAngle, double bevelKneeRatio, double depth) { Gear gear = new BevelGear(parent, gearData, conjugateGearData, toothProfile, helicalAngle, bevelAngle, bevelKneeRatio, depth); BuildGear(gear); return gear; }
protected Gear(IPart parent, GearData gearData, GearData conjugateGearData, ToothProfile toothProfile, double helicalAngle, double depth) { Parent = parent; GearData = gearData; ConjugateGearData = conjugateGearData; ToothProfile = toothProfile; HelicalAngle = helicalAngle; Depth = depth; Period = ToothProfile.GetProfile(); Window activeWindow = Window.ActiveWindow; string name = String.Format(Resources.GearPartNameFormat, GearData.Pitch * activeWindow.Units.Length.ConversionFactor, activeWindow.Units.Length.Symbol, GearData.NumberOfTeeth, GearData.PressureAngle * 180 / Math.PI); Part = Part.Create(Parent.Master.Document, name); Component = Component.Create(parent.Master, Part); Component.Transform(parent.TransformToMaster); GearLayer = NoteHelper.CreateOrGetLayer(Part.Document, Resources.GearLayerName, System.Drawing.Color.LightSteelBlue); PitchCircleLayer = NoteHelper.CreateOrGetLayer(Part.Document, Resources.PitchCircleLayerName, System.Drawing.Color.SteelBlue); PitchCircleLayer.SetVisible(null, false); VisualizationLayer = NoteHelper.CreateOrGetLayer(Part.Document, Resources.VisualizationBodyLayerName, System.Drawing.Color.SteelBlue); AlignmentPart = Part.Create(Part.Document, Resources.AlignmentPlanePartName); AlignmentComponent = Component.Create(Part, AlignmentPart); AlignmentDesBodies = new List<DesignBody>(); AlignmentLayer = NoteHelper.CreateOrGetLayer(Part.Document, Resources.AlignmentPlaneLayerName, System.Drawing.Color.AliceBlue); AlignmentLayer.SetVisible(null, false); }
//ITC-1122-0165 Tong.Zhi-Yong 2010-03-02 private void checkBindToThisProduct(IProduct thisProduct, IPart newPart) { IList<IProductPart> parts = thisProduct.ProductParts; IBOMPart bomPart = (IBOMPart)newPart; //string newPartSn;// = bomPart.MatchedSn; string newPartPn = bomPart.PN; if (parts != null) { foreach (var productPart in parts) { //if (string.Compare(productPart.Value, newPartSn, true) == 0 && string.Compare(productPart.PartID, newPartPn, true) == 0) { List<string> erpara = new List<string>(); erpara.Add("SN"); //erpara.Add(newPartSn); var ex = new FisException("CHK083", erpara); ex.stopWF = false; throw ex; } } } }
private int getMaxQty(IList<QtyParts> qty_parts,IPart part) { int ret = 0; if (qty_parts != null && part != null) { foreach (QtyParts qty_part in qty_parts) { Boolean is_equal = false; if (qty_part.Parts != null) { foreach (IPart apart in qty_part.Parts) { if (apart.PN.Trim().Equals(part.PN.Trim())) { is_equal = true; } } } if (is_equal) { if (ret < qty_part.Qty) { ret = qty_part.Qty; } } } } return ret; }
/// <summary> /// Resolve UPS Parameter Name/Value /// </summary> /// <param name="srcData"></param> /// <param name="session"></param> /// <param name="product"></param> /// <param name="dn"></param> /// <param name="part"></param> /// <param name="hpPOInfo"></param> /// <param name="spliter"></param> /// <returns></returns> public static string replaceUPSParameter(string[] srcData, Session session, IProduct product, Delivery dn, IPart part, UPSHPPOInfo hpPOInfo, char spliter) { int index = 0; foreach (string value in srcData) { if (value.Contains(spliter)) { string s = GetValue(hpPOInfo, value, spliter); if (string.IsNullOrEmpty(s)) { s = ResolveValue.GetValue(session, product, null, dn, part, value, spliter); } if (string.IsNullOrEmpty(s)) { throw new FisException("CQCHK0006", new List<string> { value }); } srcData[index] = s; } index++; } return string.Join(",", srcData); }
protected StraightGear(IPart parent, GearData gearData, GearData conjugateGearData, ToothProfile toothProfile, double helicalAngle, double screwAngle, double depth) : base(parent, gearData, conjugateGearData, toothProfile, helicalAngle, depth) { StartPoint = Point.Origin + Vector.Create(0, 0, Depth / 2); ; EndPoint = StartPoint + Vector.Create(0, 0, -Depth); StartFrame = Frame.Create(StartPoint, Direction.DirX, Direction.DirY); EndFrame = Frame.Create(EndPoint, StartFrame.DirX, -StartFrame.DirY); StartPlane = Plane.Create(StartFrame); EndPlane = Plane.Create(EndFrame); ScrewAngle = screwAngle; }
private void combineCDSI(Session session,IProduct product, IPart part, string checkItemType, string avPartNo ) { var prodRep = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>(); string AST1 = ""; CdsiastInfo cdi = new CdsiastInfo(); cdi.tp = "ASSET_TAG"; cdi.snoId = product.ProId; IList<CdsiastInfo> cdsiastInfoList = prodRep.GetCdsiastInfoList(cdi); if (cdsiastInfoList != null && cdsiastInfoList.Count > 0) { AST1 = cdsiastInfoList[0].sno; } string AST2 = ""; CdsiastInfo cdi2 = new CdsiastInfo(); cdi2.tp = "ASSET_TAG2"; cdi2.snoId = product.ProId; IList<CdsiastInfo> cdsiastInfoList2 = prodRep.GetCdsiastInfoList(cdi2); if (cdsiastInfoList2 != null && cdsiastInfoList2.Count > 0) { AST2 = cdsiastInfoList2[0].sno; } if ((AST1 == "") && (AST2 == "")) { List<string> errpara = new List<string>(); throw new FisException("CHK203", errpara); } else { //不为空则存入 //保存product和Asset SN的绑定关系 if (AST1 != "") { IProductPart assetTag1 = new ProductPart(); assetTag1.ProductID = product.ProId; assetTag1.PartID = part.PN; assetTag1.PartType = part.Descr; assetTag1.Iecpn = ""; assetTag1.CustomerPn = avPartNo; assetTag1.PartSn = AST1; assetTag1.Station = this.Station; assetTag1.Editor = this.Editor; assetTag1.Cdt = DateTime.Now; assetTag1.Udt = DateTime.Now; assetTag1.BomNodeType = part.BOMNodeType; assetTag1.CheckItemType = checkItemType; product.AddPart(assetTag1); prodRep.Update(product, session.UnitOfWork); } if (AST2 != "") { IProductPart assetTag2 = new ProductPart(); assetTag2.ProductID = product.ProId; assetTag2.PartID = part.PN; assetTag2.PartType = part.Descr; assetTag2.Iecpn = ""; assetTag2.CustomerPn = avPartNo; assetTag2.PartSn = AST2; assetTag2.Station = this.Station; assetTag2.Editor = this.Editor; assetTag2.Cdt = DateTime.Now; assetTag2.Udt = DateTime.Now; assetTag2.BomNodeType = part.BOMNodeType; assetTag2.CheckItemType = checkItemType; product.AddPart(assetTag2); prodRep.Update(product, session.UnitOfWork); } session.AddValue("AST1", AST1); session.AddValue("AST2", AST2); //2012-5-2 string ASTinfo = ""; if (!string.IsNullOrEmpty(AST1) && !string.IsNullOrEmpty(AST2)) { ASTinfo += AST1 + ", " + AST2; } else if (!string.IsNullOrEmpty(AST1) && string.IsNullOrEmpty(AST2)) { ASTinfo = AST1; } else if (string.IsNullOrEmpty(AST1) && !string.IsNullOrEmpty(AST2)) { ASTinfo = AST2; } session.AddValue("ASTInfo", ASTinfo); } }
private Boolean PartCompare(IList<IPart> parts, IPart part) { if (part != null && parts != null) { foreach (var apart in parts) { if (part.PN.Trim().Equals(apart.PN.Trim())) { return true; } } } return false; }
public void AddAlterPart(IPart part) { _alterParts.Add(part); }