/// <summary> /// 将part绑定到Product/MB的默认实现,即直接绑定至owner /// </summary> /// <param name="part">part</param> /// <param name="owner">owner</param> public virtual void BindTo(IProductPart part, IPartOwner owner) { PartCheck checkSetting = this.GetPartCheckSettingData(part.ValueType); if (checkSetting == null) { string msg = string.Format("PartCheck data of {0} type does not exist.", part.PartType); Exception ex = new Exception(msg); throw ex; } part = ProductPart.PartSpecialDeal(part); if (checkSetting.NeedSave == 1) { owner.AddPart(part); } }
public void BindTo(PartUnit part, IPartOwner owner, string station, string editor, string key, Nullable<bool> needCommonSaveRule, Nullable<bool> needSaveRule) { #if DEBUG ISaveModule saver = (ISaveModule)GetInstance(_saveModule, typeof(ISaveModule)); #else ISaveModule saver = PartSpecialCodeContainer.GetInstance.GetSaveModule(_saveModule); #endif if (saver != null) { bool saveFlag = true; if (needSaveRule.HasValue) { saveFlag = needSaveRule.Value; } if (saveFlag) { saver.Save(part, owner, station, key); } } bool commonSaveFlag = _needCommonsave; if (needCommonSaveRule.HasValue) { commonSaveFlag = needCommonSaveRule.Value; } if (commonSaveFlag) { IProductPart newPart = new ProductPart(); newPart.PartSn = part.Sn; //sn newPart.PartID = part.Pn; //pn newPart.BomNodeType = part.Type; //BomNodeType newPart.PartType = part.ValueType; //part.Type newPart.CheckItemType = part.ItemType; //CheckItemType newPart.CustomerPn = part.CustPn ?? string.Empty; newPart.Iecpn = part.IECPn ?? string.Empty; newPart.Station = station; newPart.Editor = editor; owner.AddPart(newPart); } }