|
|
@ -94,7 +94,7 @@ public class KjController {
|
|
|
|
AIFComponentContext[] childFolders = xmzxFolder.getChildren();
|
|
|
|
AIFComponentContext[] childFolders = xmzxFolder.getChildren();
|
|
|
|
TCComponentFolder bztFolder = null;
|
|
|
|
TCComponentFolder bztFolder = null;
|
|
|
|
TCComponentFolder dcsjFolder = null;
|
|
|
|
TCComponentFolder dcsjFolder = null;
|
|
|
|
for(AIFComponentContext context:childFolders) {
|
|
|
|
for(AIFComponentContext context : childFolders) {
|
|
|
|
InterfaceAIFComponent c = context.getComponent();
|
|
|
|
InterfaceAIFComponent c = context.getComponent();
|
|
|
|
if(c instanceof TCComponentFolder) {
|
|
|
|
if(c instanceof TCComponentFolder) {
|
|
|
|
String cName = c.getProperty("object_name");
|
|
|
|
String cName = c.getProperty("object_name");
|
|
|
@ -117,7 +117,7 @@ public class KjController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
TCComponentItem dcsjItem = null;;
|
|
|
|
TCComponentItem dcsjItem = null;;
|
|
|
|
if(dcsjFolder!=null) {
|
|
|
|
if(dcsjFolder != null) {
|
|
|
|
AIFComponentContext[] children = dcsjFolder.getChildren();
|
|
|
|
AIFComponentContext[] children = dcsjFolder.getChildren();
|
|
|
|
for(AIFComponentContext cont : children) {
|
|
|
|
for(AIFComponentContext cont : children) {
|
|
|
|
InterfaceAIFComponent component = cont.getComponent();
|
|
|
|
InterfaceAIFComponent component = cont.getComponent();
|
|
|
@ -127,7 +127,7 @@ public class KjController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(dcsjItem==null) {
|
|
|
|
if(dcsjItem == null) {
|
|
|
|
errBuff.append("当前项目中未创建物主材采购单,不允许创建框架BOM.\n");
|
|
|
|
errBuff.append("当前项目中未创建物主材采购单,不允许创建框架BOM.\n");
|
|
|
|
flag = false;
|
|
|
|
flag = false;
|
|
|
|
}else {
|
|
|
|
}else {
|
|
|
@ -140,7 +140,7 @@ public class KjController {
|
|
|
|
errBuff.append("当前项目中主材采购单BOM视图版本未发布,不允许创建框架BOM.\n");flag = false;
|
|
|
|
errBuff.append("当前项目中主材采购单BOM视图版本未发布,不允许创建框架BOM.\n");flag = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(tqqgdItem==null) {
|
|
|
|
if(tqqgdItem == null) {
|
|
|
|
errBuff.append("当前项目中未创建物料提前请购单,不允许创建框架BOM.\n");flag = false;
|
|
|
|
errBuff.append("当前项目中未创建物料提前请购单,不允许创建框架BOM.\n");flag = false;
|
|
|
|
}else {
|
|
|
|
}else {
|
|
|
|
TCComponentItemRevision latestItemRevision = tqqgdItem.getLatestItemRevision();
|
|
|
|
TCComponentItemRevision latestItemRevision = tqqgdItem.getLatestItemRevision();
|
|
|
@ -155,7 +155,7 @@ public class KjController {
|
|
|
|
OkHttpClient client = new OkHttpClient();
|
|
|
|
OkHttpClient client = new OkHttpClient();
|
|
|
|
String preference = ChintPreferenceUtil.getPreference("CHINT_PIUrl", session);
|
|
|
|
String preference = ChintPreferenceUtil.getPreference("CHINT_PIUrl", session);
|
|
|
|
Request request = new Request.Builder()
|
|
|
|
Request request = new Request.Builder()
|
|
|
|
.url(preference+"/api/open/task/getTaskInfo/"+projectId)
|
|
|
|
.url(preference + "/api/open/task/getTaskInfo/" + projectId)
|
|
|
|
.build();
|
|
|
|
.build();
|
|
|
|
Response response = client.newCall(request).execute();
|
|
|
|
Response response = client.newCall(request).execute();
|
|
|
|
String string = response.body().string();
|
|
|
|
String string = response.body().string();
|
|
|
@ -177,7 +177,7 @@ public class KjController {
|
|
|
|
System.out.println(idName.toString());
|
|
|
|
System.out.println(idName.toString());
|
|
|
|
List<CBean> beanList = kjBean.cbeans;
|
|
|
|
List<CBean> beanList = kjBean.cbeans;
|
|
|
|
// ZT2_Requisition
|
|
|
|
// ZT2_Requisition
|
|
|
|
for(CBean bean:beanList) {
|
|
|
|
for(CBean bean : beanList) {
|
|
|
|
String piName = bean.piName;
|
|
|
|
String piName = bean.piName;
|
|
|
|
String folderName = bean.folderName;
|
|
|
|
String folderName = bean.folderName;
|
|
|
|
if(idName.containsKey(piName)) {
|
|
|
|
if(idName.containsKey(piName)) {
|
|
|
@ -253,10 +253,19 @@ public class KjController {
|
|
|
|
//遍历获取BOM新ID
|
|
|
|
//遍历获取BOM新ID
|
|
|
|
List<TCComponentBOMLine> useLines = new ArrayList<TCComponentBOMLine>();
|
|
|
|
List<TCComponentBOMLine> useLines = new ArrayList<TCComponentBOMLine>();
|
|
|
|
createId(kjBomLine, bomLineTreeNodeSOA, builder, ccomponentitemtype, findMap, useLines, 1);
|
|
|
|
createId(kjBomLine, bomLineTreeNodeSOA, builder, ccomponentitemtype, findMap, useLines, 1);
|
|
|
|
System.out.println(kjIdMap.toString());
|
|
|
|
System.out.println("kjIdMap==>" + kjIdMap.toString());
|
|
|
|
|
|
|
|
System.out.println("builder==>" + builder.toString());
|
|
|
|
|
|
|
|
|
|
|
|
if(builder.length() > 0) {
|
|
|
|
if(builder.length() > 0) {
|
|
|
|
// MessageBox.post(builder.toString(), "提示",2);
|
|
|
|
// MessageBox.post(builder.toString(), "提示",2);
|
|
|
|
|
|
|
|
String[] msgs = builder.toString().split(";");
|
|
|
|
|
|
|
|
builder.setLength(0);
|
|
|
|
|
|
|
|
for(int i = 0; i < msgs.length; i++) {
|
|
|
|
|
|
|
|
builder.append(msgs[i]).append(";");
|
|
|
|
|
|
|
|
if(i % 4 == 3) {
|
|
|
|
|
|
|
|
builder.append("\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
Object[] options = { "是", "否" };
|
|
|
|
Object[] options = { "是", "否" };
|
|
|
|
comp.setVisible(false);
|
|
|
|
comp.setVisible(false);
|
|
|
|
builder.append("是否要继续生成.");
|
|
|
|
builder.append("是否要继续生成.");
|
|
|
@ -272,33 +281,41 @@ public class KjController {
|
|
|
|
//开始克隆BOM
|
|
|
|
//开始克隆BOM
|
|
|
|
cloneOrUpdate(session, kjBomLine, copyLines, useLines);
|
|
|
|
cloneOrUpdate(session, kjBomLine, copyLines, useLines);
|
|
|
|
//添加到文件夹
|
|
|
|
//添加到文件夹
|
|
|
|
|
|
|
|
System.out.println("oldkjIdMap==>" + oldkjIdMap.toString());
|
|
|
|
for(TCComponentItemRevision rev : oldkjIdMap.keySet()) {
|
|
|
|
for(TCComponentItemRevision rev : oldkjIdMap.keySet()) {
|
|
|
|
TCComponentItem find = oldkjIdMap.get(rev);
|
|
|
|
TCComponentItem find = oldkjIdMap.get(rev);
|
|
|
|
String id = find.getProperty("item_id");
|
|
|
|
String id = find.getProperty("item_id");
|
|
|
|
String[] split = id.split("-");
|
|
|
|
String[] split = id.split("-");
|
|
|
|
System.out.println("id==>" + id);
|
|
|
|
System.out.println("id1==>" + id);
|
|
|
|
if(fMap.containsKey(split[0])) {
|
|
|
|
if(fMap.containsKey(split[0])) {
|
|
|
|
TCComponentFolder tcComponentFolder = fMap.get(split[0]);
|
|
|
|
TCComponentFolder tcComponentFolder = fMap.get(split[0]);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
tcComponentFolder.add("contents", find);
|
|
|
|
tcComponentFolder.add("contents", find);
|
|
|
|
}catch(Exception e) {
|
|
|
|
}catch(Exception e) {
|
|
|
|
|
|
|
|
if(!e.getMessage().contains("存在于目标文件夹中"))
|
|
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
System.out.println("nameUser==>"+nameUser.toString());
|
|
|
|
System.out.println("nameUser==>" + nameUser.toString());
|
|
|
|
System.out.println("fMap==>"+nameUser.toString());
|
|
|
|
System.out.println("fMap==>" + fMap.toString());
|
|
|
|
for(TCComponentItemRevision rev:kjIdMap.keySet()) {
|
|
|
|
for(TCComponentItemRevision rev : kjIdMap.keySet()) {
|
|
|
|
String id = kjIdMap.get(rev);
|
|
|
|
String id = kjIdMap.get(rev);
|
|
|
|
TCComponentItem find = ccomponentitemtype.findItems(id)[0];
|
|
|
|
TCComponentItem[] finds = ccomponentitemtype.findItems(id);
|
|
|
|
|
|
|
|
if(finds == null || finds.length == 0) {
|
|
|
|
|
|
|
|
System.out.println(id + "对象未找到");
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
TCComponentItem find = finds[0];
|
|
|
|
String[] split = id.split("-");
|
|
|
|
String[] split = id.split("-");
|
|
|
|
System.out.println("id==>"+split[0]);
|
|
|
|
System.out.println("id2==>" + split[0]);
|
|
|
|
if(fMap.containsKey(split[0])) {
|
|
|
|
if(fMap.containsKey(split[0])) {
|
|
|
|
TCComponentFolder tcComponentFolder = fMap.get(split[0]);
|
|
|
|
TCComponentFolder tcComponentFolder = fMap.get(split[0]);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
tcComponentFolder.add("contents", find);
|
|
|
|
tcComponentFolder.add("contents", find);
|
|
|
|
}catch(Exception e) {
|
|
|
|
}catch(Exception e) {
|
|
|
|
|
|
|
|
if(!e.getMessage().contains("存在于目标文件夹中"))
|
|
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(nameUser.containsKey(split[0])) {
|
|
|
|
if(nameUser.containsKey(split[0])) {
|
|
|
@ -325,9 +342,14 @@ public class KjController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
TCComponentBOMLine newTopline = window.setWindowTopLine(find, find.getLatestItemRevision(),null, null);
|
|
|
|
TCComponentBOMLine newTopline = window.setWindowTopLine(find, find.getLatestItemRevision(),null, null);
|
|
|
|
//如果存在已经有的框架BOM对象,遍历BOM然后替换再进行下面操作
|
|
|
|
//如果存在已经有的框架BOM对象,遍历BOM然后替换再进行下面操作
|
|
|
|
System.out.println(byqCCPFromProject.toString());
|
|
|
|
System.out.println("byqCCPFromProject==>" + byqCCPFromProject.toString());
|
|
|
|
if(byqCCPFromProject.size()>0) {
|
|
|
|
if(byqCCPFromProject.size()>0) {
|
|
|
|
find.getLatestItemRevision().add("representation_for", byqCCPFromProject);
|
|
|
|
try {
|
|
|
|
|
|
|
|
find.getLatestItemRevision().add("representation_for", byqCCPFromProject);
|
|
|
|
|
|
|
|
}catch(Exception e) {
|
|
|
|
|
|
|
|
if(!e.getMessage().contains("存在于目标文件夹中"))
|
|
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
List<ClassProperty> propList = new ArrayList<ClassProperty>();
|
|
|
|
List<ClassProperty> propList = new ArrayList<ClassProperty>();
|
|
|
|
sendToClass(find.getUid(), "ICM230101", objectToJson(propList));
|
|
|
|
sendToClass(find.getUid(), "ICM230101", objectToJson(propList));
|
|
|
@ -346,12 +368,14 @@ public class KjController {
|
|
|
|
TCComponentBOMLine qgdBomline = window2.setWindowTopLine(tqqgdItem, tqqgdItem.getLatestItemRevision(), null, null);
|
|
|
|
TCComponentBOMLine qgdBomline = window2.setWindowTopLine(tqqgdItem, tqqgdItem.getLatestItemRevision(), null, null);
|
|
|
|
AIFComponentContext[] children = qgdBomline.getChildren();
|
|
|
|
AIFComponentContext[] children = qgdBomline.getChildren();
|
|
|
|
//遍历物料提前请购单 根据备注添加BOM到对应位置
|
|
|
|
//遍历物料提前请购单 根据备注添加BOM到对应位置
|
|
|
|
|
|
|
|
//TODO lidy20240710创建框架BOM中功能中的从提前请购组件BOM中抓取成分搭建进生成的框架BOM,
|
|
|
|
|
|
|
|
//需要将抓取的物料明细在复制后增加注释信息BOM行属性:数据来源:bl_occ_zt2_wlsource,写入“提前请购单”
|
|
|
|
for(int i = 0; i < children.length; i++) {
|
|
|
|
for(int i = 0; i < children.length; i++) {
|
|
|
|
TCComponentBOMLine wlLine = (TCComponentBOMLine) children[i].getComponent();
|
|
|
|
TCComponentBOMLine wlLine = (TCComponentBOMLine) children[i].getComponent();
|
|
|
|
TCComponentItem item = wlLine.getItem();
|
|
|
|
TCComponentItem item = wlLine.getItem();
|
|
|
|
if(item.getType().equals("ZT2_MainMat")) {
|
|
|
|
if(item.getType().equals("ZT2_MainMat")) {
|
|
|
|
AIFComponentContext[] children2 = wlLine.getChildren();
|
|
|
|
AIFComponentContext[] children2 = wlLine.getChildren();
|
|
|
|
for(AIFComponentContext c2:children2) {
|
|
|
|
for(AIFComponentContext c2 : children2) {
|
|
|
|
TCComponentBOMLine wlLine2 = (TCComponentBOMLine) c2.getComponent();
|
|
|
|
TCComponentBOMLine wlLine2 = (TCComponentBOMLine) c2.getComponent();
|
|
|
|
String object_name = wlLine2.getProperty("ZT2_Remark");
|
|
|
|
String object_name = wlLine2.getProperty("ZT2_Remark");
|
|
|
|
String objName = wlLine2.getItem().getProperty("object_name");
|
|
|
|
String objName = wlLine2.getItem().getProperty("object_name");
|
|
|
@ -359,16 +383,23 @@ public class KjController {
|
|
|
|
System.out.println(objName + "gg");
|
|
|
|
System.out.println(objName + "gg");
|
|
|
|
if(!object_name.equals("") && bomBeans.contains(new BomBean(object_name))) {
|
|
|
|
if(!object_name.equals("") && bomBeans.contains(new BomBean(object_name))) {
|
|
|
|
BomBean bomBean = bomBeans.get(bomBeans.indexOf(new BomBean(object_name)));
|
|
|
|
BomBean bomBean = bomBeans.get(bomBeans.indexOf(new BomBean(object_name)));
|
|
|
|
bomBean.bomLine.add(wlLine2, false);
|
|
|
|
if(checkSource(bomBean.bomLine, wlLine2))
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
bomBean.bomLine.add(wlLine2, false).setProperty("bl_occ_zt2_wlsource", "提前请购单");
|
|
|
|
bomBean.bomLine.save();
|
|
|
|
bomBean.bomLine.save();
|
|
|
|
}else if(object_name.equals("") && objName.contains("硅钢条料")) {
|
|
|
|
}else if(object_name.equals("") && objName.contains("硅钢条料")) {
|
|
|
|
if(bomBeans.contains(new BomBean("硅钢片"))) {
|
|
|
|
if(bomBeans.contains(new BomBean("硅钢片"))) {
|
|
|
|
BomBean bomBean = bomBeans.get(bomBeans.indexOf(new BomBean("硅钢片")));
|
|
|
|
BomBean bomBean = bomBeans.get(bomBeans.indexOf(new BomBean("硅钢片")));
|
|
|
|
bomBean.bomLine.add(wlLine2, false);
|
|
|
|
if(checkSource(bomBean.bomLine, wlLine2))
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
bomBean.bomLine.add(wlLine2, false).setProperty("bl_occ_zt2_wlsource", "提前请购单");
|
|
|
|
bomBean.bomLine.save();
|
|
|
|
bomBean.bomLine.save();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}else {
|
|
|
|
}else {
|
|
|
|
|
|
|
|
if(checkSource(newTopline, wlLine2))
|
|
|
|
|
|
|
|
continue;
|
|
|
|
TCComponentBOMLine add = newTopline.add(wlLine2, false);
|
|
|
|
TCComponentBOMLine add = newTopline.add(wlLine2, false);
|
|
|
|
|
|
|
|
add.setProperty("bl_occ_zt2_wlsource", "提前请购单");
|
|
|
|
System.out.println(add);
|
|
|
|
System.out.println(add);
|
|
|
|
newTopline.save();
|
|
|
|
newTopline.save();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -379,17 +410,24 @@ public class KjController {
|
|
|
|
String objName = wlLine.getItem().getProperty("object_name");
|
|
|
|
String objName = wlLine.getItem().getProperty("object_name");
|
|
|
|
if(!object_name.equals("") && bomBeans.contains(new BomBean(object_name))) {
|
|
|
|
if(!object_name.equals("") && bomBeans.contains(new BomBean(object_name))) {
|
|
|
|
BomBean bomBean = bomBeans.get(bomBeans.indexOf(new BomBean(object_name)));
|
|
|
|
BomBean bomBean = bomBeans.get(bomBeans.indexOf(new BomBean(object_name)));
|
|
|
|
bomBean.bomLine.add(wlLine, false);
|
|
|
|
if(checkSource(bomBean.bomLine, wlLine))
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
bomBean.bomLine.add(wlLine, false).setProperty("bl_occ_zt2_wlsource", "提前请购单");
|
|
|
|
bomBean.bomLine.save();
|
|
|
|
bomBean.bomLine.save();
|
|
|
|
}else if(object_name.equals("") && objName.equals("硅钢条料")) {
|
|
|
|
}else if(object_name.equals("") && objName.equals("硅钢条料")) {
|
|
|
|
if(bomBeans.contains(new BomBean("硅钢片"))) {
|
|
|
|
if(bomBeans.contains(new BomBean("硅钢片"))) {
|
|
|
|
BomBean bomBean = bomBeans.get(bomBeans.indexOf(new BomBean("硅钢片")));
|
|
|
|
BomBean bomBean = bomBeans.get(bomBeans.indexOf(new BomBean("硅钢片")));
|
|
|
|
bomBean.bomLine.add(wlLine, false);
|
|
|
|
if(checkSource(bomBean.bomLine, wlLine))
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
bomBean.bomLine.add(wlLine, false).setProperty("bl_occ_zt2_wlsource", "提前请购单");
|
|
|
|
bomBean.bomLine.save();
|
|
|
|
bomBean.bomLine.save();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
|
|
|
|
if(checkSource(newTopline, wlLine))
|
|
|
|
|
|
|
|
continue;
|
|
|
|
TCComponentBOMLine add = newTopline.add(wlLine, false);
|
|
|
|
TCComponentBOMLine add = newTopline.add(wlLine, false);
|
|
|
|
|
|
|
|
add.setProperty("bl_occ_zt2_wlsource", "提前请购单");
|
|
|
|
System.out.println(add);
|
|
|
|
System.out.println(add);
|
|
|
|
newTopline.save();
|
|
|
|
newTopline.save();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -410,14 +448,14 @@ public class KjController {
|
|
|
|
TCAccessControlService accessControlService = session.getTCAccessControlService();
|
|
|
|
TCAccessControlService accessControlService = session.getTCAccessControlService();
|
|
|
|
TCComponentUser user = session.getUser();
|
|
|
|
TCComponentUser user = session.getUser();
|
|
|
|
accessControlService.grantPrivilege(dataset, user, new String[]{"WRITE","READ"});
|
|
|
|
accessControlService.grantPrivilege(dataset, user, new String[]{"WRITE","READ"});
|
|
|
|
KUtil.setByPass(false);
|
|
|
|
// KUtil.setByPass(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("deprecation")
|
|
|
|
@SuppressWarnings("deprecation")
|
|
|
|
private void updateKjBom(Map<String, TCComponentItem> findMap, Map<String, ExpandPSData[]> bomLineTreeNodeSOA, String uid) throws Exception {
|
|
|
|
private void updateKjBom(Map<String, TCComponentItem> findMap, Map<String, ExpandPSData[]> bomLineTreeNodeSOA, String uid) throws Exception {
|
|
|
|
// Auto-generated method stub
|
|
|
|
// Auto-generated method stub
|
|
|
|
ExpandPSData[] expandPSDatas = bomLineTreeNodeSOA.get(uid);
|
|
|
|
ExpandPSData[] expandPSDatas = bomLineTreeNodeSOA.get(uid);
|
|
|
|
for(ExpandPSData expandPSData:expandPSDatas) {
|
|
|
|
for(ExpandPSData expandPSData : expandPSDatas) {
|
|
|
|
TCComponentBOMLine bomLine = expandPSData.bomLine;
|
|
|
|
TCComponentBOMLine bomLine = expandPSData.bomLine;
|
|
|
|
TCComponentItemRevision itemRevOfBOMLine = expandPSData.itemRevOfBOMLine;
|
|
|
|
TCComponentItemRevision itemRevOfBOMLine = expandPSData.itemRevOfBOMLine;
|
|
|
|
String itemId = itemRevOfBOMLine.getProperty("item_id");
|
|
|
|
String itemId = itemRevOfBOMLine.getProperty("item_id");
|
|
|
@ -529,21 +567,22 @@ public class KjController {
|
|
|
|
if(cRev.getType().contains("ZT2_Design3D")) {
|
|
|
|
if(cRev.getType().contains("ZT2_Design3D")) {
|
|
|
|
String item_id = cRev.getProperty("item_id");
|
|
|
|
String item_id = cRev.getProperty("item_id");
|
|
|
|
String replaceAll = item_id.replaceAll(kjBs, projectDh);
|
|
|
|
String replaceAll = item_id.replaceAll(kjBs, projectDh);
|
|
|
|
if(type == 0) {
|
|
|
|
/*if(type == 0) {
|
|
|
|
useLines.add(cLine);
|
|
|
|
useLines.add(cLine);
|
|
|
|
|
|
|
|
oldkjIdMap.put(cRev, cLine.getItem());
|
|
|
|
createId(cLine, bomLineTreeNodeSOA, builder, ccomponentitemtype, findMap, useLines, 0);
|
|
|
|
createId(cLine, bomLineTreeNodeSOA, builder, ccomponentitemtype, findMap, useLines, 0);
|
|
|
|
}else {
|
|
|
|
}else {
|
|
|
|
TCComponentItem[] finds = ccomponentitemtype.findItems(replaceAll);
|
|
|
|
}*/
|
|
|
|
if(finds != null && finds.length > 0) {
|
|
|
|
TCComponentItem[] finds = ccomponentitemtype.findItems(replaceAll);
|
|
|
|
builder.append("µ±Ç°IDÒѾ´æÔÚ:").append(replaceAll).append("\n");
|
|
|
|
if(finds != null && finds.length > 0) {
|
|
|
|
findMap.put(item_id, finds[0]);
|
|
|
|
builder.append("当前ID已经存在:").append(replaceAll).append(";");
|
|
|
|
useLines.add(cLine);
|
|
|
|
findMap.put(item_id, finds[0]);
|
|
|
|
oldkjIdMap.put(cRev, finds[0]);
|
|
|
|
useLines.add(cLine);
|
|
|
|
createId(cLine, bomLineTreeNodeSOA, builder, ccomponentitemtype, findMap, useLines, 0);
|
|
|
|
oldkjIdMap.put(cRev, finds[0]);
|
|
|
|
}else {
|
|
|
|
createId(cLine, bomLineTreeNodeSOA, builder, ccomponentitemtype, findMap, useLines, 0);
|
|
|
|
kjIdMap.put(cRev, replaceAll);
|
|
|
|
}else {
|
|
|
|
createId(cLine, bomLineTreeNodeSOA, builder, ccomponentitemtype, findMap, useLines, 1);
|
|
|
|
kjIdMap.put(cRev, replaceAll);
|
|
|
|
}
|
|
|
|
createId(cLine, bomLineTreeNodeSOA, builder, ccomponentitemtype, findMap, useLines, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}else {
|
|
|
|
}else {
|
|
|
|
copyLines.add(cLine);
|
|
|
|
copyLines.add(cLine);
|
|
|
@ -552,7 +591,7 @@ public class KjController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//批量复制
|
|
|
|
//批量复制
|
|
|
|
private void cloneOrUpdate(TCSession session, TCComponentBOMLine puid,
|
|
|
|
private void cloneOrUpdate(TCSession session, TCComponentBOMLine parentLine,
|
|
|
|
List<TCComponentBOMLine> bomLines, List<TCComponentBOMLine> useLines) {
|
|
|
|
List<TCComponentBOMLine> bomLines, List<TCComponentBOMLine> useLines) {
|
|
|
|
com.teamcenter.services.rac.structuremanagement.StructureService service =
|
|
|
|
com.teamcenter.services.rac.structuremanagement.StructureService service =
|
|
|
|
com.teamcenter.services.rac.structuremanagement.StructureService.getService(session);
|
|
|
|
com.teamcenter.services.rac.structuremanagement.StructureService.getService(session);
|
|
|
@ -571,17 +610,19 @@ public class KjController {
|
|
|
|
projectInfo.assign = false;
|
|
|
|
projectInfo.assign = false;
|
|
|
|
projectInfo.validate = false;
|
|
|
|
projectInfo.validate = false;
|
|
|
|
infos[0].projects = projectInfo;
|
|
|
|
infos[0].projects = projectInfo;
|
|
|
|
TCComponentRevisionRule revisionRule = puid.window().getRevisionRule();
|
|
|
|
TCComponentRevisionRule revisionRule = parentLine.window().getRevisionRule();
|
|
|
|
infos[0].revRule = revisionRule;
|
|
|
|
infos[0].revRule = revisionRule;
|
|
|
|
TCComponentItemRevision[] revs = new TCComponentItemRevision[] { puid.getItemRevision() };
|
|
|
|
TCComponentItemRevision[] revs = new TCComponentItemRevision[] { parentLine.getItemRevision() };
|
|
|
|
infos[0].topItemRevs = revs;
|
|
|
|
infos[0].topItemRevs = revs;
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println("Save class Partial bomLine -- " + bomLines.size());
|
|
|
|
System.out.println("Save class Partial bomLine -- " + bomLines.size());
|
|
|
|
|
|
|
|
|
|
|
|
List<CloneStructureSaveAsIn> saveList = new ArrayList<CloneStructureSaveAsIn>();
|
|
|
|
List<CloneStructureSaveAsIn> saveList = new ArrayList<CloneStructureSaveAsIn>();
|
|
|
|
for(TCComponentBOMLine subLine : bomLines) {
|
|
|
|
for(TCComponentBOMLine subLine : bomLines) {
|
|
|
|
CloneStructureSaveAsIn dataMap = null;
|
|
|
|
// for(int i = 0; i < bomLines.size(); i++) {
|
|
|
|
|
|
|
|
// TCComponentBOMLine subLine = bomLines.get(i);
|
|
|
|
TCComponentItem item = subLine.getItem();
|
|
|
|
TCComponentItem item = subLine.getItem();
|
|
|
|
|
|
|
|
CloneStructureSaveAsIn dataMap = null;
|
|
|
|
if(item.getType().equals("ZT2_Design3D")) {
|
|
|
|
if(item.getType().equals("ZT2_Design3D")) {
|
|
|
|
// subLine.replace
|
|
|
|
// subLine.replace
|
|
|
|
dataMap = getDataMap(subLine, 0, session);
|
|
|
|
dataMap = getDataMap(subLine, 0, session);
|
|
|
@ -600,7 +641,7 @@ public class KjController {
|
|
|
|
infos[0].dataMap = array;
|
|
|
|
infos[0].dataMap = array;
|
|
|
|
naming.autogen = true;
|
|
|
|
naming.autogen = true;
|
|
|
|
infos[0].defaultName = naming;
|
|
|
|
infos[0].defaultName = naming;
|
|
|
|
infos[0].topLines = new TCComponentBOMLine[] { puid };
|
|
|
|
infos[0].topLines = new TCComponentBOMLine[] { parentLine };
|
|
|
|
// TCComponentBOMLine.get
|
|
|
|
// TCComponentBOMLine.get
|
|
|
|
// puid.getr
|
|
|
|
// puid.getr
|
|
|
|
} catch (Exception e1) {
|
|
|
|
} catch (Exception e1) {
|
|
|
@ -620,26 +661,26 @@ public class KjController {
|
|
|
|
System.out.println("Save class Partial Error -- " + cloneStructure.serviceData.sizeOfUpdatedObjects());
|
|
|
|
System.out.println("Save class Partial Error -- " + cloneStructure.serviceData.sizeOfUpdatedObjects());
|
|
|
|
if(cloneStructure.serviceData.sizeOfUpdatedObjects()>0) {
|
|
|
|
if(cloneStructure.serviceData.sizeOfUpdatedObjects()>0) {
|
|
|
|
TCComponent updatedObject = cloneStructure.serviceData.getUpdatedObject(0);
|
|
|
|
TCComponent updatedObject = cloneStructure.serviceData.getUpdatedObject(0);
|
|
|
|
System.out.println(session.componentToString(updatedObject));
|
|
|
|
System.out.println(session.componentToString(updatedObject) + " >> " + updatedObject);
|
|
|
|
}
|
|
|
|
|
|
|
|
for(int i = 0; i < cloneStructure.serviceData.sizeOfCreatedObjects(); i++) {
|
|
|
|
|
|
|
|
TCComponent plainObject = cloneStructure.serviceData.getCreatedObject(i);
|
|
|
|
|
|
|
|
System.out.println(session.componentToString(plainObject));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for(int i = 0; i < cloneStructure.serviceData.sizeOfPlainObjects(); i++) {
|
|
|
|
|
|
|
|
TCComponent plainObject = cloneStructure.serviceData.getPlainObject(i);
|
|
|
|
|
|
|
|
System.out.println(session.componentToString(plainObject));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// for(int i = 0; i < cloneStructure.serviceData.sizeOfCreatedObjects(); i++) {
|
|
|
|
|
|
|
|
// TCComponent plainObject = cloneStructure.serviceData.getCreatedObject(i);
|
|
|
|
|
|
|
|
// System.out.println(session.componentToString(plainObject));
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// for(int i = 0; i < cloneStructure.serviceData.sizeOfPlainObjects(); i++) {
|
|
|
|
|
|
|
|
// TCComponent plainObject = cloneStructure.serviceData.getPlainObject(i);
|
|
|
|
|
|
|
|
// System.out.println(session.componentToString(plainObject));
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
// Auto-generated catch block
|
|
|
|
// Auto-generated catch block
|
|
|
|
e.printStackTrace();
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private CloneStructureSaveAsIn getDataMap(TCComponentBOMLine child, int type, TCSession session) throws Exception {
|
|
|
|
private CloneStructureSaveAsIn getDataMap(TCComponentBOMLine child, int type, TCSession session) throws Exception {
|
|
|
|
TCComponentItemRevision rev = child.getItemRevision();
|
|
|
|
TCComponentItemRevision rev = child.getItemRevision();
|
|
|
|
com.teamcenter.services.rac.structuremanagement._2014_10.Structure.CloneStructureSaveAsIn dataMap =
|
|
|
|
CloneStructureSaveAsIn dataMap = new CloneStructureSaveAsIn();
|
|
|
|
new com.teamcenter.services.rac.structuremanagement._2014_10.Structure.CloneStructureSaveAsIn();
|
|
|
|
|
|
|
|
Map<String, String[]> newItemRevinfo = new HashMap<>();
|
|
|
|
Map<String, String[]> newItemRevinfo = new HashMap<>();
|
|
|
|
dataMap.cloneOperationType = type;
|
|
|
|
dataMap.cloneOperationType = type;
|
|
|
|
// dataMap.newItemRevinfo =
|
|
|
|
// dataMap.newItemRevinfo =
|
|
|
@ -687,4 +728,21 @@ public class KjController {
|
|
|
|
dataMap.newItemRevinfo = newItemRevinfo;
|
|
|
|
dataMap.newItemRevinfo = newItemRevinfo;
|
|
|
|
return dataMap;
|
|
|
|
return dataMap;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 源BOM里的内容,在新BOM里的要粘贴到的BOM里面有,并且新BOM里写了提前请购单,那么这个物料就不需要复制到新BOM里
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param parent 目标父级
|
|
|
|
|
|
|
|
* @param target 源对象
|
|
|
|
|
|
|
|
* @return 新BOM里已有则返回true
|
|
|
|
|
|
|
|
* @throws Exception
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
private boolean checkSource(TCComponentBOMLine parent, TCComponentBOMLine target) throws Exception {
|
|
|
|
|
|
|
|
String id = target.getProperty("bl_item_item_id");
|
|
|
|
|
|
|
|
for(AIFComponentContext c : parent.getChildren()) {
|
|
|
|
|
|
|
|
TCComponentBOMLine child = (TCComponentBOMLine) c.getComponent();
|
|
|
|
|
|
|
|
if(child.getProperty("bl_item_item_id").equals(id) && child.getProperty("bl_occ_zt2_wlsource").equals("提前请购单"))
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|