|
|
@ -20,6 +20,7 @@ import java.util.GregorianCalendar;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.HashSet;
|
|
|
|
import java.util.HashSet;
|
|
|
|
import java.util.LinkedHashMap;
|
|
|
|
import java.util.LinkedHashMap;
|
|
|
|
|
|
|
|
import java.util.LinkedHashSet;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Set;
|
|
|
|
import java.util.Set;
|
|
|
@ -1229,41 +1230,63 @@ public class YSR8_ECN1RevisionMasterForm extends AbstractRendering {
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println("更改前的零部件BOMLineChild数量="+beforeMap.size());
|
|
|
|
System.out.println("更改前的零部件BOMLineChild数量="+beforeMap.size());
|
|
|
|
System.out.println("更改后的零部件BOMLineChild数量="+afterMap.size());
|
|
|
|
System.out.println("更改后的零部件BOMLineChild数量="+afterMap.size());
|
|
|
|
|
|
|
|
// Set<String> changeSet = new LinkedHashSet<String>();
|
|
|
|
|
|
|
|
Set<String> changeSet = getAllChange(beforeMap,afterMap);
|
|
|
|
for (Map.Entry<String, TCComponentBOMLine> beforeEntry : beforeMap.entrySet()) {
|
|
|
|
for (String key : changeSet) {
|
|
|
|
String key = beforeEntry.getKey();
|
|
|
|
TCComponentBOMLine beforeBomLine1 = beforeMap.get(key);
|
|
|
|
System.out.println("1_beforeMap ["+key+"] : ["+beforeMap.get(key)+"]");
|
|
|
|
TCComponentBOMLine afterBomLine1 = afterMap.get(key);
|
|
|
|
System.out.println("1_afterMap ["+key+"] : ["+afterMap.get(key)+"]");
|
|
|
|
if (beforeBomLine1 == null && afterBomLine1 == null) {
|
|
|
|
if (afterMap.containsKey(key)) {
|
|
|
|
continue;
|
|
|
|
System.out.println("1");
|
|
|
|
}else {
|
|
|
|
// Object compResult = TCUtil.compareBOMLineQuantity(beforeMap.get(key), afterMap.get(key));//原生方法:根据“安装位置限定”计算更改前后零部件的数量
|
|
|
|
|
|
|
|
// if (compResult instanceof double[]) {
|
|
|
|
|
|
|
|
// System.out.println("2");
|
|
|
|
|
|
|
|
// double[] ds = (double[]) compResult;
|
|
|
|
|
|
|
|
// resultMap.put(afterMap.get(key), ds[1] - ds[0]);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//新增的逻辑
|
|
|
|
//新增的逻辑
|
|
|
|
double[] ds = getBOMLineQuantity(beforeMap.get(key),afterMap.get(key));
|
|
|
|
double[] ds = getBOMLineQuantity(beforeBomLine1,afterBomLine1);
|
|
|
|
System.out.println("对象:["+beforeMap.get(key)+"]变更前的数量=["+ds[0]+"],变更后的数量=["+ds[1]+"]");
|
|
|
|
System.out.println("对象:["+beforeMap.get(key)+"]变更前的数量=["+ds[0]+"],变更后的数量=["+ds[1]+"]");
|
|
|
|
double changeNum = ds[1] - ds[0];
|
|
|
|
double changeNum = ds[1] - ds[0];
|
|
|
|
if (changeNum == 0) {
|
|
|
|
if (changeNum == 0) {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
resultMap.put(afterMap.get(key), ds[1] - ds[0]);
|
|
|
|
TCComponentBOMLine putBomLine = afterMap.get(key) == null ? beforeMap.get(key) : afterMap.get(key);
|
|
|
|
}
|
|
|
|
resultMap.put(putBomLine, ds[1] - ds[0]);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (Map.Entry<String, TCComponentBOMLine> afterEntry : afterMap.entrySet()) {
|
|
|
|
|
|
|
|
String key = afterEntry.getKey();
|
|
|
|
|
|
|
|
System.out.println("遍历afterMap "+key+":"+afterMap.get(key));
|
|
|
|
|
|
|
|
if (beforeMap.containsKey(key)) {
|
|
|
|
|
|
|
|
System.out.println("3");
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
System.out.println("4");
|
|
|
|
|
|
|
|
resultMap.put(afterMap.get(key), TCUtil.totalBOMLineQuantity(afterMap.get(key)));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// for (Map.Entry<String, TCComponentBOMLine> beforeEntry : beforeMap.entrySet()) {
|
|
|
|
|
|
|
|
// String key = beforeEntry.getKey();
|
|
|
|
|
|
|
|
// System.out.println("1_beforeMap ["+key+"] : ["+beforeMap.get(key)+"]");
|
|
|
|
|
|
|
|
// System.out.println("1_afterMap ["+key+"] : ["+afterMap.get(key)+"]");
|
|
|
|
|
|
|
|
// if (afterMap.containsKey(key)) {
|
|
|
|
|
|
|
|
// System.out.println("1");
|
|
|
|
|
|
|
|
//// Object compResult = TCUtil.compareBOMLineQuantity(beforeMap.get(key), afterMap.get(key));//原生方法:根据“安装位置限定”计算更改前后零部件的数量
|
|
|
|
|
|
|
|
//// if (compResult instanceof double[]) {
|
|
|
|
|
|
|
|
//// System.out.println("2");
|
|
|
|
|
|
|
|
//// double[] ds = (double[]) compResult;
|
|
|
|
|
|
|
|
//// resultMap.put(afterMap.get(key), ds[1] - ds[0]);
|
|
|
|
|
|
|
|
//// }
|
|
|
|
|
|
|
|
// //新增的逻辑
|
|
|
|
|
|
|
|
// double[] ds = getBOMLineQuantity(beforeMap.get(key),afterMap.get(key));
|
|
|
|
|
|
|
|
// System.out.println("对象:["+beforeMap.get(key)+"]变更前的数量=["+ds[0]+"],变更后的数量=["+ds[1]+"]");
|
|
|
|
|
|
|
|
// double changeNum = ds[1] - ds[0];
|
|
|
|
|
|
|
|
// if (changeNum == 0) {
|
|
|
|
|
|
|
|
// continue;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// resultMap.put(afterMap.get(key), ds[1] - ds[0]);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// for (Map.Entry<String, TCComponentBOMLine> afterEntry : afterMap.entrySet()) {
|
|
|
|
|
|
|
|
// String key = afterEntry.getKey();
|
|
|
|
|
|
|
|
// System.out.println("遍历afterMap "+key+":"+afterMap.get(key));
|
|
|
|
|
|
|
|
// if (beforeMap.containsKey(key)) {
|
|
|
|
|
|
|
|
// System.out.println("3");
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// System.out.println("4");
|
|
|
|
|
|
|
|
// resultMap.put(afterMap.get(key), TCUtil.totalBOMLineQuantity(afterMap.get(key)));
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
String ysr8_ReasonAnalysisVal = "";
|
|
|
|
String ysr8_ReasonAnalysisVal = "";
|
|
|
|
TCComponentItem ecn1Item = ecn1Revision.getItem();
|
|
|
|
TCComponentItem ecn1Item = ecn1Revision.getItem();
|
|
|
|
AIFComponentContext[] context2 = ecn1Item.whereReferencedByTypeRelation(new String[] { "YSR8_PRRevision" }, new String[] { "YSR8_ChangeForm" });
|
|
|
|
AIFComponentContext[] context2 = ecn1Item.whereReferencedByTypeRelation(new String[] { "YSR8_PRRevision" }, new String[] { "YSR8_ChangeForm" });
|
|
|
@ -1381,24 +1404,57 @@ public class YSR8_ECN1RevisionMasterForm extends AbstractRendering {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 将入参中的所有key加到set集合中,达到去重的目的
|
|
|
|
|
|
|
|
* @param beforeMap
|
|
|
|
|
|
|
|
* @param afterMap
|
|
|
|
|
|
|
|
* @return
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
private Set<String> getAllChange(Map<String, TCComponentBOMLine> beforeMap,
|
|
|
|
|
|
|
|
Map<String, TCComponentBOMLine> afterMap) {
|
|
|
|
|
|
|
|
Set<String> changeSet = new LinkedHashSet<String>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 将 beforeMap 的所有 key 添加进 set
|
|
|
|
|
|
|
|
if (beforeMap != null) {
|
|
|
|
|
|
|
|
changeSet.addAll(beforeMap.keySet());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 将 afterMap 的所有 key 添加进 set
|
|
|
|
|
|
|
|
if (afterMap != null) {
|
|
|
|
|
|
|
|
changeSet.addAll(afterMap.keySet());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return changeSet;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 获取两个bomline的Quantity数量,并返回一个数组
|
|
|
|
* 获取两个bomline的Quantity数量,并返回一个数组
|
|
|
|
* @param beforeBOMLine 前
|
|
|
|
* @param beforeBOMLine 前
|
|
|
|
* @param afterBOMLine2 后
|
|
|
|
* @param afterBOMLine 后
|
|
|
|
* @return
|
|
|
|
* @return
|
|
|
|
* @throws TCException
|
|
|
|
* @throws TCException
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private double[] getBOMLineQuantity(TCComponentBOMLine beforeBOMLine, TCComponentBOMLine afterBOMLine2) throws TCException {
|
|
|
|
private double[] getBOMLineQuantity(TCComponentBOMLine beforeBOMLine, TCComponentBOMLine afterBOMLine) throws TCException {
|
|
|
|
System.out.println("getBOMLineQuantity开始执行···");
|
|
|
|
System.out.println("getBOMLineQuantity开始执行···");
|
|
|
|
if (beforeBOMLine == null || afterBOMLine2 == null) {
|
|
|
|
double bl1 = 0;
|
|
|
|
|
|
|
|
double bl2 = 0;
|
|
|
|
|
|
|
|
String bl_quantity1 = null;
|
|
|
|
|
|
|
|
String bl_quantity2 = null;
|
|
|
|
|
|
|
|
String targetName = null;
|
|
|
|
|
|
|
|
if (beforeBOMLine == null && afterBOMLine == null) {
|
|
|
|
System.out.println("getBOMLineQuantity入参异常:为null");
|
|
|
|
System.out.println("getBOMLineQuantity入参异常:为null");
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String targetName = beforeBOMLine.getItem().getStringProperty("object_string");
|
|
|
|
if (beforeBOMLine != null) {
|
|
|
|
String bl_quantity1 = beforeBOMLine.getStringProperty("bl_quantity");
|
|
|
|
bl_quantity1 = beforeBOMLine.getStringProperty("bl_quantity");
|
|
|
|
String bl_quantity2 = afterBOMLine2afterBOMLine2.getStringProperty("bl_quantity");
|
|
|
|
bl1 = Double.parseDouble(bl_quantity1 == null ? "0" : bl_quantity1);
|
|
|
|
double bl1 = Double.parseDouble(bl_quantity1);
|
|
|
|
targetName = beforeBOMLine.getItem().getStringProperty("object_string");
|
|
|
|
double bl2 = Double.parseDouble(bl_quantity2);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (afterBOMLine != null) {
|
|
|
|
|
|
|
|
bl_quantity2 = afterBOMLine.getStringProperty("bl_quantity");
|
|
|
|
|
|
|
|
bl2 = Double.parseDouble(bl_quantity2 == null ? "0" : bl_quantity2);
|
|
|
|
|
|
|
|
targetName = afterBOMLine.getItem().getStringProperty("object_string");
|
|
|
|
|
|
|
|
}
|
|
|
|
System.out.println(targetName+"对应的bomline前后数量对比=【"+bl_quantity1+":"+bl_quantity2+"】");
|
|
|
|
System.out.println(targetName+"对应的bomline前后数量对比=【"+bl_quantity1+":"+bl_quantity2+"】");
|
|
|
|
double[] re = {bl1, bl2};
|
|
|
|
double[] re = {bl1, bl2};
|
|
|
|
return re;
|
|
|
|
return re;
|
|
|
|