public void UpdateAndInsertLabeTypeRule(LabelTypeRuleDef item) { try { iILabelTypeRepository.UpdateAndInsertLabeTypeRule(item); } catch (Exception) { throw; } }
public void UpdateAndInsertLabeTypeRuleDefered(IUnitOfWork uow, LabelTypeRuleDef item) { try { iILabelTypeRepository.UpdateAndInsertLabeTypeRuleDefered(uow, item); } catch (Exception) { throw; } }
private bool CheckBomPart(IList<IBOMNode> BomParts, LabelTypeRuleDef rule, int Curlevel, IList<PartInfo> checkPartInfos ) { foreach (IBOMNode material in BomParts) { if (rule.BomLevel == Curlevel) { if (CheckThisLevelPart(material.Part, rule, checkPartInfos)) { return true; } } else if (rule.BomLevel < Curlevel) // over Bom level { return false; } else // go to next Bom Level check { if (CheckBomPart(material.Children, rule, Curlevel + 1, checkPartInfos)) { return true; } } } return false; }
private bool CheckThisLevelPart(IPart part, LabelTypeRuleDef rule, IList<PartInfo> checkPartInfos) { if (!string.IsNullOrEmpty(rule.BomNodeType) && rule.BomNodeType != part.BOMNodeType) { return false; } if (!string.IsNullOrEmpty(rule.PartNo) && !Regex.IsMatch(part.PN, rule.PartNo )) { return false; } if (!string.IsNullOrEmpty(rule.PartDescr) && !Regex.IsMatch(part.Descr, rule.PartDescr)) { return false; } if (!string.IsNullOrEmpty(rule.PartType) && !Regex.IsMatch(part.Type, rule.PartType)) { return false; } if (checkPartInfos.Count > 0) { return CheckThisLevelPartInfo(part.Attributes, checkPartInfos); } return true; }
private bool CheckBom(LabelTypeRuleDef rule, string model,ModelFromEnum modeFrom) { if (rule.BomLevel <= 0) return true; if( string.IsNullOrEmpty(rule.BomNodeType) && string.IsNullOrEmpty(rule.PartDescr) && string.IsNullOrEmpty(rule.PartNo) && string.IsNullOrEmpty(rule.PartType) && string.IsNullOrEmpty(rule.PartConstValue) ) { return true; } IList<PartInfo> checkPartInfos=new List<PartInfo>(); if (!string.IsNullOrEmpty(rule.PartConstValue)) { checkPartInfos = GetConstValue(rule.PartConstValue); } if (modeFrom == ModelFromEnum.PCB) // PCB 131 model { IPartRepository PartRep = RepositoryFactory.GetInstance().GetRepository<IPartRepository>(); IPart part = PartRep.Find(model); if (part == null) { return false; } return CheckThisLevelPart(part, rule, checkPartInfos); } else // for BOM { IBOMRepository BomRep = RepositoryFactory.GetInstance().GetRepository<IBOMRepository>(); IHierarchicalBOM Bom = BomRep.GetHierarchicalBOMByModel(model); if (Bom == null) { return false; } IList<IBOMNode> BomParts = Bom.FirstLevelNodes; return CheckBomPart(BomParts, rule, 1, checkPartInfos); } }
private bool CheckStation(LabelTypeRuleDef rule, string station) { if (!string.IsNullOrEmpty(rule.Station) && !Regex.IsMatch(station, rule.Station)) { return false; } return true; }
private bool CheckFamilyAndModel(LabelTypeRuleDef rule, string family, string model, Delivery delivery, IList<IMES.FisObject.Common.Model.ModelInfo> modelInfos) { if (!string.IsNullOrEmpty(rule.Family) && !Regex.IsMatch(family,rule.Family)) { return false; } if (!string.IsNullOrEmpty(rule.Model) && !Regex.IsMatch(model, rule.Model)) { return false; } IList<PartInfo> checkModelInfos = new List<PartInfo>(); if (!string.IsNullOrEmpty(rule.ModelConstValue)) { checkModelInfos = GetConstValue(rule.ModelConstValue); } if (checkModelInfos.Count > 0) { if ( modelInfos.Count == 0 || !CheckModelInfo(modelInfos, checkModelInfos) ) { return false; } } IList<PartInfo> checkDeliveryInfos = new List<PartInfo>(); if (!string.IsNullOrEmpty(rule.DeliveryConstValue)) { checkDeliveryInfos = GetConstValue(rule.DeliveryConstValue); } if (checkDeliveryInfos.Count > 0) { if ( delivery==null || !CheckDeliveryInfo(delivery.DeliveryInfoes, checkDeliveryInfos) ) { return false; } } return true; }
protected void btnSave_ServerClick(Object sender, EventArgs e) { LabelTypeRuleDef item = new LabelTypeRuleDef(); item.Station = this.txtStation.Value.Trim(); item.Family = this.txtFamily.Value.Trim(); item.Model = this.txtModel.Value.Trim(); item.BomLevel = Convert.ToInt32(this.txtBomLevel.Value.Trim()); item.BomNodeType = this.txtBomNodeType.Value.Trim(); item.PartNo = this.txtPartNo.Value.Trim(); item.PartDescr = this.txtPartDescr.Value.Trim(); item.PartType = this.txtPartType.Value.Trim(); item.Remark = this.txtRemark.Value.Trim(); item.Editor = this.HiddenUserName.Value; item.LabelType = this.hidLabelType.Value; item.ModelConstValue = this.hidModelConstValue.Value; item.DeliveryConstValue = this.hidDeliveryConstValue.Value; item.PartConstValue = this.hidPartConstValue.Value; try { iLabelTypeRuleMaintain.UpdateAndInsertLabeTypeRule(item); } catch (FisException ex) { showErrorMessage(ex.mErrmsg); return; } catch (Exception ex) { showErrorMessage(ex.Message); return; } string LabelType = Convert.ToString(item.LabelType); ShowList(); this.updatePanel.Update(); ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "saveUpdate", "AddUpdateComplete('" + LabelType + "');DealHideWait();", true); }