fix(ysr): 优化 BOM 对比逻辑

- 新增打印变更前后数量的调试信息- 增加对数量未变化的项的判断,避免不必要的处理
- 修改参数名称,提高代码可读性
- 修正获取数量属性的方法,使用字符串转 double
main
熊朝柱 3 weeks ago
parent f450ac2435
commit 043173fdbb

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

@ -1245,6 +1245,11 @@ public class YSR8_ECN1RevisionMasterForm extends AbstractRendering {
// } // }
//新增的逻辑 //新增的逻辑
double[] ds = getBOMLineQuantity(beforeMap.get(key),afterMap.get(key)); 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]); resultMap.put(afterMap.get(key), ds[1] - ds[0]);
} }
} }
@ -1378,22 +1383,24 @@ public class YSR8_ECN1RevisionMasterForm extends AbstractRendering {
/** /**
* bomlineQuantity * bomlineQuantity
* @param tcComponentBOMLine * @param beforeBOMLine
* @param tcComponentBOMLine2 * @param afterBOMLine2
* @return * @return
* @throws TCException * @throws TCException
*/ */
private double[] getBOMLineQuantity(TCComponentBOMLine tcComponentBOMLine, TCComponentBOMLine tcComponentBOMLine2) throws TCException { private double[] getBOMLineQuantity(TCComponentBOMLine beforeBOMLine, TCComponentBOMLine afterBOMLine2) throws TCException {
System.out.println("getBOMLineQuantity开始执行···"); System.out.println("getBOMLineQuantity开始执行···");
if (tcComponentBOMLine == null || tcComponentBOMLine2 == null) { if (beforeBOMLine == null || afterBOMLine2 == null) {
System.out.println("getBOMLineQuantity入参异常为null"); System.out.println("getBOMLineQuantity入参异常为null");
return null; return null;
} }
String targetName = tcComponentBOMLine.getItem().getStringProperty("object_string"); String targetName = beforeBOMLine.getItem().getStringProperty("object_string");
double bl_quantity1 = tcComponentBOMLine.getDoubleProperty("bl_quantity"); String bl_quantity1 = beforeBOMLine.getStringProperty("bl_quantity");
double bl_quantity2 = tcComponentBOMLine2.getDoubleProperty("bl_quantity"); String bl_quantity2 = afterBOMLine2afterBOMLine2.getStringProperty("bl_quantity");
double bl1 = Double.parseDouble(bl_quantity1);
double bl2 = Double.parseDouble(bl_quantity2);
System.out.println(targetName+"对应的bomline前后数量对比=【"+bl_quantity1+":"+bl_quantity2+"】"); System.out.println(targetName+"对应的bomline前后数量对比=【"+bl_quantity1+":"+bl_quantity2+"】");
double[] re = {bl_quantity1,bl_quantity2}; double[] re = {bl1, bl2};
return re; return re;
} }

Loading…
Cancel
Save