Commit de1008db authored by shyWang's avatar shyWang

PDM前端改造

转试图问题处理
parent 96c8753d
...@@ -3,6 +3,7 @@ package com.yonde.part.controller; ...@@ -3,6 +3,7 @@ package com.yonde.part.controller;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.yonde.basedata.controller.AbstractBaseController; import com.yonde.basedata.controller.AbstractBaseController;
import com.yonde.basedata.entity.api.ApiResult; import com.yonde.basedata.entity.api.ApiResult;
import com.yonde.basedata.exception.DxBusinessException;
import com.yonde.basedata.search.BaseSearchCondition; import com.yonde.basedata.search.BaseSearchCondition;
import com.yonde.common.ObjectsUtil; import com.yonde.common.ObjectsUtil;
import com.yonde.part.service.DxPartService; import com.yonde.part.service.DxPartService;
...@@ -190,6 +191,7 @@ public class DxPartController extends AbstractBaseController { ...@@ -190,6 +191,7 @@ public class DxPartController extends AbstractBaseController {
DxPartService.convertViewAll(id); DxPartService.convertViewAll(id);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return ApiResult.error("501", "视图转换失败:请先检入BOM数据!", new DxBusinessException("501", e.getLocalizedMessage()));
} }
return ApiResult.ok("转视图成功"); return ApiResult.ok("转视图成功");
} }
......
...@@ -560,20 +560,20 @@ public class DxPartService implements RemoteAccess, Serializable { ...@@ -560,20 +560,20 @@ public class DxPartService implements RemoteAccess, Serializable {
WTPart ppart = PartUtil.getLatestViewPart(partById.getNumber(),"Planning"); WTPart ppart = PartUtil.getLatestViewPart(partById.getNumber(),"Planning");
ArrayList<WTPart> list = new ArrayList<WTPart>(); ArrayList<WTPart> list = new ArrayList<WTPart>();
if(ppart==null){ if(ppart==null){
WTPartConfigSpec partConfigSpec = WTPartConfigSpec
.newWTPartConfigSpec(WTPartStandardConfigSpec.newWTPartStandardConfigSpec(ViewHelper.service.getView("Design"), null));
PartUtil.getAllChildByView(partById,partConfigSpec,list);
ppart = (WTPart) ViewHelper.service.newBranchForView(partById, "Planning"); ppart = (WTPart) ViewHelper.service.newBranchForView(partById, "Planning");
ppart.setContainer(partById.getContainer()); ppart.setContainer(partById.getContainer());
CommonUtil.setFolder("/Default/PBOM/PBOM零部件", partById.getContainerReference(), ppart); CommonUtil.setFolder("/Default/PBOM/PBOM零部件", partById.getContainerReference(), ppart);
PersistenceHelper.manager.save(ppart); PersistenceHelper.manager.save(ppart);
} }
WTPartConfigSpec partConfigSpec = WTPartConfigSpec
.newWTPartConfigSpec(WTPartStandardConfigSpec.newWTPartStandardConfigSpec(ViewHelper.service.getView("Design"), null));
PartUtil.getAllChildByView(partById,partConfigSpec,list);
logger.error("converViewAll====" + list.size());
for(WTPart tempPart : list){ for(WTPart tempPart : list){
WTPart p2 = PartUtil.getLatestViewPart(tempPart.getNumber(),"Planning"); WTPart p2 = PartUtil.getLatestViewPart(tempPart.getNumber(),"Planning");
if(p2==null){ if(p2==null){
p2 = (WTPart) ViewHelper.service.newBranchForView(tempPart, "Planning"); p2 = (WTPart) ViewHelper.service.newBranchForView(tempPart, "Planning");
p2.setContainer(partById.getContainer()); p2.setContainer(tempPart.getContainer());
CommonUtil.setFolder("/Default/PBOM/PBOM零部件", tempPart.getContainerReference(), p2); CommonUtil.setFolder("/Default/PBOM/PBOM零部件", tempPart.getContainerReference(), p2);
PersistenceHelper.manager.save(p2); PersistenceHelper.manager.save(p2);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment