/// <summary> /// 更新一条KitLoc的记录数据 /// </summary> /// <param name="Object">FAFloatLocationDef item,string family,string pType,string pdLine</param> public void UpdateKitLoc(FAFloatLocationDef item, string itemId) { FisException ex; List<string> paraError = new List<string>(); try { IProductRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository>(); UnitOfWork uow = new UnitOfWork(); //当前信息是否存在 FAFloatLocationInfo fAFloatLocations = itemRepository.GetFAFloatLocationInfo(int.Parse(itemId)); if (fAFloatLocations == null) { //要更新的原始数据已被删除 ex = new FisException("DMT082", paraError); throw ex; } FAFloatLocationInfo lstFAFloatLocationInfo = itemRepository.GetFAFloatLocation(item.family, item.partType, item.pdLine); //判断非当前记录和要更新的数据是否有重复 //if (lstFAFloatLocationInfo.id != int.Parse(itemId)) if (lstFAFloatLocationInfo != null && lstFAFloatLocationInfo.id != int.Parse(itemId)) { //要更新的数据已经存在于其他记录 ex = new FisException("DMT079", paraError); throw ex; } FAFloatLocationInfo fAFloatLocation = new FAFloatLocationInfo(); fAFloatLocation.family = item.family; fAFloatLocation.partType = item.partType; fAFloatLocation.pdLine = item.pdLine; fAFloatLocation.location = item.location; fAFloatLocation.editor = item.editor; fAFloatLocation.cdt = DateTime.Now; fAFloatLocation.udt = DateTime.Now; itemRepository.UpdateFAFloatLocationInfoDefered(uow, fAFloatLocation, int.Parse(itemId)); uow.Commit(); } catch (Exception) { throw; } }
/// <summary> /// "删除一条记录 /// </summary> /// <param name="?">FAFloatLocationDef item</param> public void DeleteKitLoc(FAFloatLocationDef item) { try { FAFloatLocationInfo fAFloatLocation = new FAFloatLocationInfo(); IProductRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository>(); UnitOfWork uow = new UnitOfWork(); itemRepository.DeleteFAFloatLocationInfoDefered(uow, item.id); uow.Commit(); } catch (Exception) { throw; } }
/// <summary> /// 保存一条KitLoc的记录数据(Add) /// </summary> /// <param name="Object"> FAFloatLocationDef item</param> public void AddKitLoc(FAFloatLocationDef item) { FisException ex; List<string> paraError = new List<string>(); try { IProductRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository>(); UnitOfWork uow = new UnitOfWork(); FAFloatLocationInfo fAFloatLocationInfo = itemRepository.GetFAFloatLocation(item.family, item.partType, item.pdLine); if (fAFloatLocationInfo != null) { //要添加的数据已经存在 ex = new FisException("DMT079", paraError); throw ex; } FAFloatLocationInfo fAFloatLocation = new FAFloatLocationInfo(); fAFloatLocation.family = item.family; fAFloatLocation.partType = item.partType; fAFloatLocation.pdLine = item.pdLine; fAFloatLocation.location = item.location; fAFloatLocation.editor = item.editor; fAFloatLocation.cdt = DateTime.Now; fAFloatLocation.udt = DateTime.Now; itemRepository.AddFAFloatLocationInfoDefered(uow, fAFloatLocation); uow.Commit(); } catch (Exception) { throw; } }