|
|
@ -8,7 +8,6 @@
|
|
|
|
package com.chint.plm.createbomdifference;
|
|
|
|
package com.chint.plm.createbomdifference;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.Locale;
|
|
|
|
import java.util.Locale;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.ResourceBundle;
|
|
|
|
import java.util.ResourceBundle;
|
|
|
@ -17,7 +16,6 @@ import com.chint.plm.createEcn.Util;
|
|
|
|
import com.connor.chint.sap2.util.BomToSapUtil;
|
|
|
|
import com.connor.chint.sap2.util.BomToSapUtil;
|
|
|
|
import com.connor.chint.yunpi.KCommand;
|
|
|
|
import com.connor.chint.yunpi.KCommand;
|
|
|
|
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
|
|
|
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
|
|
|
import com.teamcenter.rac.aif.kernel.AbstractAIFSession;
|
|
|
|
|
|
|
|
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
|
|
|
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
|
|
|
import com.teamcenter.rac.kernel.TCComponent;
|
|
|
|
import com.teamcenter.rac.kernel.TCComponent;
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentBOMLine;
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentBOMLine;
|
|
|
@ -26,7 +24,6 @@ import com.teamcenter.rac.kernel.TCComponentBOMWindowType;
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentItem;
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentItem;
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentRevisionRule;
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentRevisionRule;
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentRevisionRuleType;
|
|
|
|
|
|
|
|
import com.teamcenter.rac.kernel.TCException;
|
|
|
|
import com.teamcenter.rac.kernel.TCException;
|
|
|
|
import com.teamcenter.rac.kernel.TCSession;
|
|
|
|
import com.teamcenter.rac.kernel.TCSession;
|
|
|
|
import com.teamcenter.rac.util.MessageBox;
|
|
|
|
import com.teamcenter.rac.util.MessageBox;
|
|
|
@ -75,8 +72,8 @@ public class ExtractDiffComd extends KCommand {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
readChangeDesign(oldComponents, newComponents, tar);
|
|
|
|
readChangeDesign(oldComponents, newComponents, tar);
|
|
|
|
MessageBox.post(resource.getString("SUCC_CHANGE"), "", 2);
|
|
|
|
MessageBox.post(resource.getString("SUCC_CHANGE"), "", 2);
|
|
|
|
} catch (TCException e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
// Auto-generated catch block
|
|
|
|
e.printStackTrace();
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -92,7 +89,7 @@ public class ExtractDiffComd extends KCommand {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private void readChangeDesign(TCComponent[] oldComponents, TCComponent[] newComponents, TCComponent tar)
|
|
|
|
private void readChangeDesign(TCComponent[] oldComponents, TCComponent[] newComponents, TCComponent tar)
|
|
|
|
throws TCException {
|
|
|
|
throws TCException {
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
// Auto-generated method stub
|
|
|
|
Map<TCComponentItem, ChangeDesignBean> itemChangeMap = new HashMap<>();
|
|
|
|
Map<TCComponentItem, ChangeDesignBean> itemChangeMap = new HashMap<>();
|
|
|
|
for (TCComponent oldComponent : oldComponents) {
|
|
|
|
for (TCComponent oldComponent : oldComponents) {
|
|
|
|
if (oldComponent.getType().equals(ZT_DESIGN3D)) {
|
|
|
|
if (oldComponent.getType().equals(ZT_DESIGN3D)) {
|
|
|
@ -162,21 +159,41 @@ public class ExtractDiffComd extends KCommand {
|
|
|
|
PBomBean pBomBeanOld = materialOld.get(materialNo);
|
|
|
|
PBomBean pBomBeanOld = materialOld.get(materialNo);
|
|
|
|
PBomBean pBomBeanNew = materialNew.get(materialNo);
|
|
|
|
PBomBean pBomBeanNew = materialNew.get(materialNo);
|
|
|
|
// 有P物料获取P没有遍历EBOM
|
|
|
|
// 有P物料获取P没有遍历EBOM
|
|
|
|
|
|
|
|
/*
|
|
|
|
TCComponent oldMaterial = pBomBeanOld.getpMaterial() == null ? pBomBeanOld.geteMaterial()
|
|
|
|
TCComponent oldMaterial = pBomBeanOld.getpMaterial() == null ? pBomBeanOld.geteMaterial()
|
|
|
|
: pBomBeanOld.getpMaterial();
|
|
|
|
: pBomBeanOld.getpMaterial();
|
|
|
|
TCComponent newMaterial = pBomBeanNew.getpMaterial() == null ? pBomBeanNew.geteMaterial()
|
|
|
|
TCComponent newMaterial = pBomBeanNew.getpMaterial() == null ? pBomBeanNew.geteMaterial()
|
|
|
|
: pBomBeanNew.getpMaterial();
|
|
|
|
: pBomBeanNew.getpMaterial();
|
|
|
|
// 全展开之后比较单层物料编码的数量
|
|
|
|
*/
|
|
|
|
// 旧的bom修改版本规则
|
|
|
|
//TODO 20240201修改为遍历PBOM和EBOM
|
|
|
|
TCComponentBOMLine oldBomLine = sendToStructureManager((TCComponentItemRevision) oldMaterial,
|
|
|
|
TCComponent oldMaterial = pBomBeanOld.getpMaterial();
|
|
|
|
Util.REVISION_RULE_ANY);
|
|
|
|
if(oldMaterial != null) {
|
|
|
|
TCComponentBOMLine newBomLine = sendToStructureManager((TCComponentItemRevision) newMaterial, null);
|
|
|
|
TCComponent newMaterial = pBomBeanNew.getpMaterial();
|
|
|
|
// BOM全展开
|
|
|
|
// 全展开之后比较单层物料编码的数量
|
|
|
|
Map<String, ExpandPSData[]> oldBomMap = BomToSapUtil.getBomLineTreeNodeSOA(oldBomLine);
|
|
|
|
// 旧的bom修改版本规则
|
|
|
|
Map<String, ExpandPSData[]> newBomMap = BomToSapUtil.getBomLineTreeNodeSOA(newBomLine);
|
|
|
|
TCComponentBOMLine oldBomLine = sendToStructureManager((TCComponentItemRevision) oldMaterial, Util.REVISION_RULE_ANY);
|
|
|
|
addChangeBom(oldBomMap, oldBomLine, newBomMap, newBomLine, tar);
|
|
|
|
TCComponentBOMLine newBomLine = sendToStructureManager((TCComponentItemRevision) newMaterial, null);
|
|
|
|
System.out.println("oldBomMap===>" + oldBomMap.toString());
|
|
|
|
// BOM全展开
|
|
|
|
System.out.println("newBomMap===>" + newBomMap.toString());
|
|
|
|
Map<String, ExpandPSData[]> oldBomMap = BomToSapUtil.getBomLineTreeNodeSOA(oldBomLine);
|
|
|
|
|
|
|
|
Map<String, ExpandPSData[]> newBomMap = BomToSapUtil.getBomLineTreeNodeSOA(newBomLine);
|
|
|
|
|
|
|
|
addChangeBom(oldBomMap, oldBomLine, newBomMap, newBomLine, tar);
|
|
|
|
|
|
|
|
System.out.println("oldBomMap===>" + oldBomMap.toString());
|
|
|
|
|
|
|
|
System.out.println("newBomMap===>" + newBomMap.toString());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
oldMaterial = pBomBeanOld.geteMaterial();
|
|
|
|
|
|
|
|
if(oldMaterial != null) {
|
|
|
|
|
|
|
|
TCComponent newMaterial = pBomBeanNew.geteMaterial();
|
|
|
|
|
|
|
|
// 全展开之后比较单层物料编码的数量
|
|
|
|
|
|
|
|
// 旧的bom修改版本规则
|
|
|
|
|
|
|
|
TCComponentBOMLine oldBomLine = sendToStructureManager((TCComponentItemRevision) oldMaterial, Util.REVISION_RULE_ANY);
|
|
|
|
|
|
|
|
TCComponentBOMLine newBomLine = sendToStructureManager((TCComponentItemRevision) newMaterial, null);
|
|
|
|
|
|
|
|
// BOM全展开
|
|
|
|
|
|
|
|
Map<String, ExpandPSData[]> oldBomMap = BomToSapUtil.getBomLineTreeNodeSOA(oldBomLine);
|
|
|
|
|
|
|
|
Map<String, ExpandPSData[]> newBomMap = BomToSapUtil.getBomLineTreeNodeSOA(newBomLine);
|
|
|
|
|
|
|
|
addChangeBom(oldBomMap, oldBomLine, newBomMap, newBomLine, tar);
|
|
|
|
|
|
|
|
System.out.println("oldBomMap===>" + oldBomMap.toString());
|
|
|
|
|
|
|
|
System.out.println("newBomMap===>" + newBomMap.toString());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
System.out.println("itemChangeMap===>" + itemChangeMap.toString());
|
|
|
|
System.out.println("itemChangeMap===>" + itemChangeMap.toString());
|
|
|
@ -196,7 +213,7 @@ public class ExtractDiffComd extends KCommand {
|
|
|
|
private void addChangeBom(Map<String, ExpandPSData[]> oldBomMap, TCComponentBOMLine oldBomLine,
|
|
|
|
private void addChangeBom(Map<String, ExpandPSData[]> oldBomMap, TCComponentBOMLine oldBomLine,
|
|
|
|
Map<String, ExpandPSData[]> newBomMap, TCComponentBOMLine newBomLine, TCComponent changeTag)
|
|
|
|
Map<String, ExpandPSData[]> newBomMap, TCComponentBOMLine newBomLine, TCComponent changeTag)
|
|
|
|
throws TCException {
|
|
|
|
throws TCException {
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
// Auto-generated method stub
|
|
|
|
String oldUid = oldBomLine.getUid();
|
|
|
|
String oldUid = oldBomLine.getUid();
|
|
|
|
ExpandPSData[] expandPSDatasOld = oldBomMap.get(oldUid);
|
|
|
|
ExpandPSData[] expandPSDatasOld = oldBomMap.get(oldUid);
|
|
|
|
ExpandPSData[] expandPSDatasNew = newBomMap.get(newBomLine.getUid());
|
|
|
|
ExpandPSData[] expandPSDatasNew = newBomMap.get(newBomLine.getUid());
|
|
|
@ -292,7 +309,7 @@ public class ExtractDiffComd extends KCommand {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return bomWindow.setWindowTopLine(null, tcComponentItemRev, null, null);
|
|
|
|
return bomWindow.setWindowTopLine(null, tcComponentItemRev, null, null);
|
|
|
|
} catch (TCException e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
e.printStackTrace();
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -306,13 +323,12 @@ public class ExtractDiffComd extends KCommand {
|
|
|
|
* @function
|
|
|
|
* @function
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private Map<String, PBomBean> getMaterialByDesign(TCComponentItemRevision designRev) throws TCException {
|
|
|
|
private Map<String, PBomBean> getMaterialByDesign(TCComponentItemRevision designRev) throws TCException {
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
// Auto-generated method stub
|
|
|
|
Map<String, PBomBean> pbomMap = new HashMap<>();
|
|
|
|
Map<String, PBomBean> pbomMap = new HashMap<>();
|
|
|
|
// 图纸下物料
|
|
|
|
// 图纸下物料
|
|
|
|
TCComponent[] represents = designRev.getReferenceListProperty(REPRESENTATION_FOR);
|
|
|
|
TCComponent[] represents = designRev.getReferenceListProperty(REPRESENTATION_FOR);
|
|
|
|
for (TCComponent represent : represents) {
|
|
|
|
for (TCComponent represent : represents) {
|
|
|
|
String[] matnrProps = represent
|
|
|
|
String[] matnrProps = represent.getProperties(new String[] { Util.ZT_MATERIAL_NO, Util.ZT_PROP_PBOM, Util.ITEM_REVIISON_ID });
|
|
|
|
.getProperties(new String[] { Util.ZT_MATERIAL_NO, Util.ZT_PROP_PBOM, Util.ITEM_REVIISON_ID });
|
|
|
|
|
|
|
|
String materialNo = matnrProps[0];// material.getProperty(Util.ZT_MATERIAL_NO);
|
|
|
|
String materialNo = matnrProps[0];// material.getProperty(Util.ZT_MATERIAL_NO);
|
|
|
|
if (pbomMap.containsKey(materialNo)) {
|
|
|
|
if (pbomMap.containsKey(materialNo)) {
|
|
|
|
PBomBean pBomBean = pbomMap.get(materialNo);
|
|
|
|
PBomBean pBomBean = pbomMap.get(materialNo);
|
|
|
@ -322,8 +338,7 @@ public class ExtractDiffComd extends KCommand {
|
|
|
|
if (matnrProps[1].equals(Util.ZT_VAL_PBOM) && matnrProps[2].compareTo(pBomBean.getpRevision()) > 0) {
|
|
|
|
if (matnrProps[1].equals(Util.ZT_VAL_PBOM) && matnrProps[2].compareTo(pBomBean.getpRevision()) > 0) {
|
|
|
|
pBomBean.setpMaterial(represent);
|
|
|
|
pBomBean.setpMaterial(represent);
|
|
|
|
pBomBean.setpRevision(matnrProps[2]);
|
|
|
|
pBomBean.setpRevision(matnrProps[2]);
|
|
|
|
} else if (!matnrProps[1].equals(Util.ZT_VAL_PBOM)
|
|
|
|
} else if (!matnrProps[1].equals(Util.ZT_VAL_PBOM) && matnrProps[2].compareTo(pBomBean.geteRevision()) > 0) {
|
|
|
|
&& matnrProps[2].compareTo(pBomBean.geteRevision()) > 0) {
|
|
|
|
|
|
|
|
pBomBean.seteMaterial(represent);
|
|
|
|
pBomBean.seteMaterial(represent);
|
|
|
|
pBomBean.seteRevision(matnrProps[2]);
|
|
|
|
pBomBean.seteRevision(matnrProps[2]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|