商务合作:179001057@qq.com

Windchill8.0中checkOut,checkIn,undoCheckout

技术2022-05-12  1


某平台价值19860元的编程课程资料免费领取【点我领取】


背景描述:在Windchill中有些物件需要出庫才能修改其內容,在程式中如何實現? 代碼示例: //出庫方法 (此方法處理異常不完善還待修改) public WTProduct checkOut(WTProduct product) throws WTException, WTPropertyVetoException{ CheckoutLink link = null; if(!WorkInProgressHelper.isCheckedOut(product, SessionHelper.manager.getPrincipal()) && !FolderHelper.inPersonalCabinet(product) && !WorkInProgressHelper.isWorkingCopy(product)){ Folder folder = WorkInProgressHelper.service.getCheckoutFolder(); link = WorkInProgressHelper.service.checkout(product, folder, "Relation Product"); if(link != null) return (WTProduct)link.getWorkingCopy(); } return null; } //入庫方法 public WTProduct checkIn(WTProduct product) throws WTException, WTPropertyVetoException{ if(WorkInProgressHelper.isCheckedOut(product, SessionHelper.manager.getPrincipal())){ return (WTProduct)WorkInProgressHelper.service.checkin(product, "Relation Product"); }else{ return product; } } //復原出庫 public WTProduct undoCheckout(WTProduct product) throws WorkInProgressException, WTPropertyVetoException, PersistenceException, WTException{ if(WorkInProgressHelper.isCheckedOut(product, SessionHelper.manager.getPrincipal())){ return (WTProduct)WorkInProgressHelper.service.undoCheckout(product); }else{ return product; } }

最新回复(0)