parent
c2a0fade4b
commit
68609b09fa
@ -0,0 +1,117 @@
|
||||
/**
|
||||
* Copyright 2023 eSunny Info. Tech Ltd. All rights reserved.
|
||||
*
|
||||
* @Package: com.chint.plm.costbomreport
|
||||
* @author: cyh
|
||||
* @date: 2023年12月26日 上午11:21:45
|
||||
*/
|
||||
package com.chint.plm.costbomreport;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author cyh
|
||||
*
|
||||
*/
|
||||
public class BomCostBean {
|
||||
|
||||
private String bomMaterial;// BOM物料编码zt2_BOMMaterial
|
||||
private String objectDesc;// BOM属性bl_rev_object_desc
|
||||
private String unit;// BOM属性bl_item_zt2_unit
|
||||
private String blQuantity;// BOM属性bl_quantity
|
||||
// private Boolean isDesign;// BOM物料编码
|
||||
private String utilization;
|
||||
private String itemId;
|
||||
public String getItemId() {
|
||||
return itemId;
|
||||
}
|
||||
|
||||
public void setItemId(String itemId) {
|
||||
this.itemId = itemId;
|
||||
}
|
||||
|
||||
public String getUtilization() {
|
||||
return utilization;
|
||||
}
|
||||
|
||||
public void setUtilization(String utilization) {
|
||||
this.utilization = utilization;
|
||||
}
|
||||
|
||||
public void addQuantity(String addQty) {
|
||||
blQuantity = new BigDecimal(addQty).add(new BigDecimal(blQuantity)).setScale(2, BigDecimal.ROUND_HALF_UP)
|
||||
.toString();
|
||||
}
|
||||
|
||||
public BomCostBean(String bomMaterial, String objectDesc, String unit, String blQuantity) {
|
||||
super();
|
||||
this.bomMaterial = bomMaterial;
|
||||
this.objectDesc = objectDesc;
|
||||
this.unit = unit;
|
||||
this.blQuantity = blQuantity;
|
||||
// this.isDesign = isDesign;
|
||||
}
|
||||
|
||||
public BomCostBean(String bomMaterial) {
|
||||
super();
|
||||
this.bomMaterial = bomMaterial;
|
||||
}
|
||||
|
||||
public String getBomMaterial() {
|
||||
return bomMaterial;
|
||||
}
|
||||
|
||||
public void setBomMaterial(String bomMaterial) {
|
||||
this.bomMaterial = bomMaterial;
|
||||
}
|
||||
|
||||
public String getObjectDesc() {
|
||||
return objectDesc;
|
||||
}
|
||||
|
||||
public void setObjectDesc(String objectDesc) {
|
||||
this.objectDesc = objectDesc;
|
||||
}
|
||||
|
||||
public String getUnit() {
|
||||
return unit;
|
||||
}
|
||||
|
||||
public void setUnit(String unit) {
|
||||
this.unit = unit;
|
||||
}
|
||||
|
||||
public String getBlQuantity() {
|
||||
return blQuantity;
|
||||
}
|
||||
|
||||
public void setBlQuantity(String blQuantity) {
|
||||
this.blQuantity = blQuantity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(bomMaterial);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
BomCostBean other = (BomCostBean) obj;
|
||||
return Objects.equals(bomMaterial, other.bomMaterial);
|
||||
}
|
||||
|
||||
// public Boolean getIsDesign() {
|
||||
// return isDesign;
|
||||
// }
|
||||
//
|
||||
// public void setIsDesign(Boolean isDesign) {
|
||||
// this.isDesign = isDesign;
|
||||
// }
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
/**
|
||||
* Copyright 2023 eSunny Info. Tech Ltd. All rights reserved.
|
||||
*
|
||||
* @Package: com.chint.plm.costbomreport
|
||||
* @author: cyh
|
||||
* @date: 2023年12月26日 上午11:14:48
|
||||
*/
|
||||
package com.chint.plm.costbomreport;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.chint.plm.getGCTH.AutoKTBean;
|
||||
import com.chint.plm.getGCTH.AutoKTOp;
|
||||
import com.connor.chint.sap2.KCommand;
|
||||
import com.connor.chint.sap2.util.BomToSapUtil;
|
||||
import com.connor.chint.sap2.util.ChintPreferenceUtil;
|
||||
import com.connor.chint.sap2.util.SAPUtil;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponentBOMLine;
|
||||
import com.teamcenter.rac.kernel.TCComponentBOMWindow;
|
||||
import com.teamcenter.rac.kernel.TCComponentBOMWindowType;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
import com.teamcenter.rac.util.MessageBox;
|
||||
import com.teamcenter.services.rac.cad._2007_01.StructureManagement.ExpandPSData;
|
||||
|
||||
/**
|
||||
* @author cyh
|
||||
*
|
||||
*/
|
||||
public class BomCostReportCmd extends KCommand {
|
||||
|
||||
public BomCostReportCmd(AbstractAIFApplication app, String commandId, String actionInfo) {
|
||||
super(app, commandId, actionInfo);
|
||||
TCSession session = (TCSession) app.getSession();
|
||||
// String groupID = "";
|
||||
try {
|
||||
// groupID = SAPUtil.getGroupID(session);
|
||||
InterfaceAIFComponent targetComponent = app.getTargetComponent();
|
||||
String type = targetComponent.getType();
|
||||
if (!type.equals("ZT2_Design3DRevision")) {
|
||||
MessageBox.post("请选择图纸版本对象", "", MessageBox.ERROR);
|
||||
return;
|
||||
}
|
||||
new BomCostReportOp(app, actionInfo, (TCComponent) targetComponent).executeOperation();
|
||||
|
||||
} catch (Exception e1) {
|
||||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,349 @@
|
||||
/**
|
||||
* Copyright 2023 eSunny Info. Tech Ltd. All rights reserved.
|
||||
*
|
||||
* @Package: com.chint.plm.costbomreport
|
||||
* @author: cyh
|
||||
* @date: 2023年12月26日 上午11:33:52
|
||||
*/
|
||||
package com.chint.plm.costbomreport;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.swing.filechooser.FileSystemView;
|
||||
|
||||
import org.apache.poi.xssf.usermodel.XSSFRow;
|
||||
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
|
||||
import com.chint.plm.getGCTH.AutoKTBean;
|
||||
import com.connor.chint.sap2.sap.SAPXBController;
|
||||
import com.connor.chint.sap2.sap.YCLMaterialBean;
|
||||
import com.connor.chint.sap2.util.BomToSapUtil;
|
||||
import com.connor.chint.sap2.util.KUtil;
|
||||
import com.connor.chint.sap2.util.MyProgressBarCompent;
|
||||
import com.connor.chint.sap2.util.SAPUtil;
|
||||
import com.connor.chint.sap2.util.SqlUtil;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aif.AbstractAIFOperation;
|
||||
import com.teamcenter.rac.kernel.TCComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponentBOMLine;
|
||||
import com.teamcenter.rac.kernel.TCComponentBOMWindow;
|
||||
import com.teamcenter.rac.kernel.TCComponentBOMWindowType;
|
||||
import com.teamcenter.rac.kernel.TCComponentItem;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemType;
|
||||
import com.teamcenter.rac.kernel.TCComponentUser;
|
||||
import com.teamcenter.rac.kernel.TCException;
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
import com.teamcenter.rac.util.MessageBox;
|
||||
import com.teamcenter.services.rac.cad._2007_01.StructureManagement.ExpandPSData;
|
||||
|
||||
/**
|
||||
* 遍历BOM导出 物料、图纸、原材料信息
|
||||
* @author cyh
|
||||
*
|
||||
*/
|
||||
public class BomCostReportOp extends AbstractAIFOperation {
|
||||
|
||||
private AbstractAIFApplication app;
|
||||
private TCSession session;
|
||||
private TCComponent target;
|
||||
|
||||
public BomCostReportOp(AbstractAIFApplication app, String actionInfo, TCComponent target) {
|
||||
this.app = app;
|
||||
this.session = (TCSession) app.getSession();
|
||||
this.target = target;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executeOperation() throws Exception {
|
||||
// 自制件有子件削层,外购自己 、 自制件无子件原材料展开 、 物料:标准件
|
||||
MyProgressBarCompent my = new MyProgressBarCompent("", "BOM报表导出中......");
|
||||
try {
|
||||
List<BomCostBean> designList = new ArrayList<>();
|
||||
List<BomCostBean> rawmList = new ArrayList<>();
|
||||
List<BomCostBean> standList = new ArrayList<>();
|
||||
// 外购不展开,自制削层、原材料展开
|
||||
TCComponentBOMWindowType bomWinType = (TCComponentBOMWindowType) session.getTypeComponent("BOMWindow");
|
||||
TCComponentBOMWindow win = bomWinType.create(null);
|
||||
TCComponentItemRevision rev = (TCComponentItemRevision) target;
|
||||
win.setWindowTopLine(rev.getItem(), rev, null, null);
|
||||
TCComponentBOMLine bomline = win.getTopBOMLine();
|
||||
Map<String, ExpandPSData[]> allBomMap = BomToSapUtil.getBomLineTreeNodeSOA(bomline);
|
||||
// 数据集模板 CHINT_M046_CB excel
|
||||
StringBuffer errMessage = new StringBuffer("");
|
||||
String strs[] = session.getPreferenceService().getStringValues("database_tc");
|
||||
if (SqlUtil.getTCDataConnection(strs) == null) {
|
||||
MessageBox.post("数据库连接失败,请检查首选项<database_tc> ", "", MessageBox.INFORMATION);
|
||||
}
|
||||
getAllBomCost(allBomMap, bomline, 1, designList, rawmList, standList, errMessage);
|
||||
System.out.println("standList====>" + standList.size());
|
||||
File tempFile = BomToSapUtil.getFile(session, "CHINT_M046_CB", "MSExcelX");
|
||||
String excelName = rev.getProperty("item_id") + "_" + rev.getProperty("object_name") + "_"
|
||||
+ rev.getProperty("item_revision_id") + "_" + "报价BOM.xlsx";
|
||||
Collections.sort(designList, new Comparator<BomCostBean>() {
|
||||
|
||||
@Override
|
||||
public int compare(BomCostBean o1, BomCostBean o2) {
|
||||
return o1.getItemId().compareTo(o2.getItemId());
|
||||
}
|
||||
});
|
||||
String path = outputExcel(excelName, tempFile, designList, rawmList, standList);
|
||||
|
||||
my.setVisible(false);
|
||||
MessageBox.post("BOM报表导出完成,路径:" + path, "", MessageBox.INFORMATION);
|
||||
Runtime.getRuntime().exec("cmd /c start " + path);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
SqlUtil.freeAll();
|
||||
my.setVisible(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param excelName
|
||||
* @param tempFile
|
||||
* @param standList
|
||||
* @param rawmList
|
||||
* @param designList
|
||||
* @throws Exception
|
||||
* @function
|
||||
*/
|
||||
private String outputExcel(String excelName, File tempFile, List<BomCostBean> designList,
|
||||
List<BomCostBean> rawmList, List<BomCostBean> standList) throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
FileInputStream in = new FileInputStream(tempFile);
|
||||
XSSFWorkbook wb = new XSSFWorkbook(in);
|
||||
in.close();
|
||||
|
||||
XSSFSheet sheetAt = wb.getSheetAt(0);
|
||||
int i = 1;
|
||||
for (BomCostBean detailsBean : designList) {
|
||||
// 导出excel设置值
|
||||
XSSFRow row1 = BomToSapUtil.getRow(sheetAt, i + 1);
|
||||
BomToSapUtil.setCellValue(row1.getCell(0), 0, row1, i + "");// 序号
|
||||
BomToSapUtil.setCellValue(row1.getCell(1), 1, row1, detailsBean.getBomMaterial());// 批次号
|
||||
BomToSapUtil.setCellValue(row1.getCell(2), 2, row1, detailsBean.getObjectDesc());// 父物料编码
|
||||
BomToSapUtil.setCellValue(row1.getCell(3), 3, row1, detailsBean.getUnit());// WBS
|
||||
BomToSapUtil.setCellValue(row1.getCell(4), 4, row1, detailsBean.getBlQuantity());// SAP状态
|
||||
BomToSapUtil.setCellValue(row1.getCell(8), 8, row1, detailsBean.getUtilization());// 具体信息
|
||||
i = i + 1;
|
||||
}
|
||||
for (BomCostBean detailsBean : rawmList) {
|
||||
// 导出excel设置值
|
||||
XSSFRow row1 = BomToSapUtil.getRow(sheetAt, i + 1);
|
||||
BomToSapUtil.setCellValue(row1.getCell(0), 0, row1, i + "");// 序号
|
||||
BomToSapUtil.setCellValue(row1.getCell(1), 1, row1, detailsBean.getBomMaterial());// 批次号
|
||||
BomToSapUtil.setCellValue(row1.getCell(2), 2, row1, detailsBean.getObjectDesc());// 父物料编码
|
||||
BomToSapUtil.setCellValue(row1.getCell(3), 3, row1, detailsBean.getUnit());// WBS
|
||||
BomToSapUtil.setCellValue(row1.getCell(4), 4, row1, detailsBean.getBlQuantity());// SAP状态
|
||||
BomToSapUtil.setCellValue(row1.getCell(8), 8, row1, detailsBean.getUtilization());// 具体信息
|
||||
i = i + 1;
|
||||
}
|
||||
for (BomCostBean detailsBean : standList) {
|
||||
// 导出excel设置值
|
||||
XSSFRow row1 = BomToSapUtil.getRow(sheetAt, i + 1);
|
||||
BomToSapUtil.setCellValue(row1.getCell(0), 0, row1, i + "");// 序号
|
||||
BomToSapUtil.setCellValue(row1.getCell(1), 1, row1, detailsBean.getBomMaterial());// 批次号
|
||||
BomToSapUtil.setCellValue(row1.getCell(2), 2, row1, detailsBean.getObjectDesc());// 父物料编码
|
||||
BomToSapUtil.setCellValue(row1.getCell(3), 3, row1, detailsBean.getUnit());// WBS
|
||||
BomToSapUtil.setCellValue(row1.getCell(4), 4, row1, detailsBean.getBlQuantity());// SAP状态
|
||||
BomToSapUtil.setCellValue(row1.getCell(8), 8, row1, detailsBean.getUtilization());// 具体信息
|
||||
i = i + 1;
|
||||
}
|
||||
// 桌面
|
||||
File desktopDir = FileSystemView.getFileSystemView().getHomeDirectory();
|
||||
String desktopPath = desktopDir.getAbsolutePath();
|
||||
// 文件保存到桌面,名称:结果导出时间戳
|
||||
File file2 = new File(desktopPath + File.separator + excelName);
|
||||
FileOutputStream os = new FileOutputStream(file2);
|
||||
wb.write(os);
|
||||
os.flush();
|
||||
os.close();
|
||||
|
||||
return desktopPath + File.separator + excelName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param allBomMap
|
||||
* @param bomline
|
||||
* @param standList 标准件
|
||||
* @param rawmList 原材料
|
||||
* @param designList 图纸
|
||||
* @throws TCException
|
||||
* @function 遍历BOM获取COST
|
||||
*/
|
||||
private void getAllBomCost(Map<String, ExpandPSData[]> allBomMap, TCComponentBOMLine bomline, double len,
|
||||
List<BomCostBean> designList, List<BomCostBean> rawmList, List<BomCostBean> standList,
|
||||
StringBuffer errMessage) throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
ExpandPSData[] expandPSDatas = allBomMap.get(bomline.getUid());
|
||||
|
||||
for (ExpandPSData expandPSData : expandPSDatas) {
|
||||
TCComponentBOMLine childLine = expandPSData.bomLine;
|
||||
TCComponentItemRevision itemRevOfBOMLine = expandPSData.itemRevOfBOMLine;
|
||||
String qty = childLine.getProperty("bl_quantity");
|
||||
String type = itemRevOfBOMLine.getType();
|
||||
if (type.equals("ZT2_Design3DRevision")) {
|
||||
String ztSource = itemRevOfBOMLine.getProperty("zt2_Source");
|
||||
ExpandPSData[] childPSDatas = allBomMap.get(childLine.getUid());
|
||||
// 自制且没有子件 原材料展开
|
||||
if (ztSource.equals("自制")) {
|
||||
// 自制有子件 削层 展开 rev.getProperty("zt2_MaterialMark").trim();
|
||||
if (childPSDatas == null || childPSDatas.length == 0) {
|
||||
String materialMark = itemRevOfBOMLine.getProperty("zt2_MaterialMark").trim();
|
||||
if (materialMark != null && !materialMark.isEmpty()) {
|
||||
// 展开
|
||||
expandRawMatnr(materialMark, childLine, rawmList, len, errMessage);
|
||||
} else {
|
||||
// 获取物料representation_for
|
||||
TCComponent material = itemRevOfBOMLine.getRelatedComponent("representation_for");
|
||||
if (material != null) {
|
||||
String materialNo = material.getProperty("zt2_MaterialNo");
|
||||
addToBeans(designList, materialNo, childLine, qty, len, null, material);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
getAllBomCost(allBomMap, childLine, len * Double.parseDouble(qty), designList, rawmList,
|
||||
standList, errMessage);
|
||||
}
|
||||
|
||||
} else if (ztSource.equals("外购")) {
|
||||
// 外购不展开
|
||||
TCComponent material = itemRevOfBOMLine.getRelatedComponent("representation_for");
|
||||
if (material != null) {
|
||||
String materialNo = material.getProperty("zt2_MaterialNo");
|
||||
addToBeans(designList, materialNo, childLine, qty, len, null, material);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 标准件
|
||||
String materialNo = itemRevOfBOMLine.getProperty("zt2_MaterialNo");
|
||||
addToBeans(standList, materialNo, childLine, qty, len, null, null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param materialMark
|
||||
* @param len
|
||||
* @param qty
|
||||
* @param rawmList
|
||||
* @param childLine
|
||||
* @param errMessage
|
||||
* @throws SQLException
|
||||
* @throws TCException
|
||||
* @function
|
||||
*/
|
||||
private void expandRawMatnr(String materialMark, TCComponentBOMLine childLine, List<BomCostBean> rawmList,
|
||||
double len, StringBuffer errMessage) throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
ResultSet rs = SqlUtil.read(new Object[] { materialMark },
|
||||
SAPXBController.SQL_MATERIAL_QUERY.replaceAll("CHINT_M007_MATERIAL", "CHINT_M043_MATERIAL"));
|
||||
TCComponentItemRevision comp = null;
|
||||
String materialno = ""; // 物料编码
|
||||
String materialutilization = "";// 利用率
|
||||
String materialunit = "";// 单位
|
||||
if (rs.next()) {
|
||||
materialno = rs.getString(1);
|
||||
materialutilization = rs.getString(2);
|
||||
materialunit = rs.getString(3);
|
||||
TCComponentItemType itemType = (TCComponentItemType) session.getTypeService().getTypeComponent("Item");
|
||||
TCComponentItem item = itemType.find(materialno);
|
||||
if (item != null) {
|
||||
comp = item.getLatestItemRevision();
|
||||
} else {
|
||||
errMessage.append("tc中查询不到[ID]为[" + materialno + "]的原材料;");
|
||||
}
|
||||
} else {
|
||||
errMessage.append("查询不到[材料标记]为[" + materialMark + "]的原材料;");
|
||||
return;
|
||||
}
|
||||
SqlUtil.free();
|
||||
String qty = getZYSAPMENGE2(materialutilization, childLine.getItemRevision(), childLine, errMessage);
|
||||
addToBeans(rawmList, materialno, childLine, qty, len, materialutilization, comp);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param designList
|
||||
* @param materialNo
|
||||
* @param childLine
|
||||
* @param qty
|
||||
* @param len
|
||||
* @param materialutilization
|
||||
* @param comp
|
||||
* @throws TCException
|
||||
* @function
|
||||
*/
|
||||
private void addToBeans(List<BomCostBean> designList, String materialNo, TCComponentBOMLine childLine, String qty,
|
||||
double len, String materialutilization, TCComponent comp) throws TCException {
|
||||
// TODO Auto-generated method stub
|
||||
int indexOf = designList.indexOf(new BomCostBean(materialNo));
|
||||
if (len != 1) {
|
||||
qty = String.valueOf(Double.valueOf(qty) * len);
|
||||
}
|
||||
if (indexOf > -1) {
|
||||
BomCostBean bomCostBean = designList.get(indexOf);
|
||||
bomCostBean.addQuantity(qty);
|
||||
} else {
|
||||
String objectDesc = childLine.getProperty("bl_rev_object_desc");// bl_item_zt2_unit bl_quantity
|
||||
if (comp != null) {
|
||||
objectDesc = comp.getProperty("object_desc");
|
||||
}
|
||||
String itemId = childLine.getItemRevision().getProperty("item_id");
|
||||
String unit = childLine.getProperty("bl_item_zt2_unit");
|
||||
BomCostBean bomCostBean = new BomCostBean(materialNo, objectDesc, unit, qty);
|
||||
bomCostBean.setItemId(itemId);
|
||||
designList.add(bomCostBean);
|
||||
if (materialutilization != null) {
|
||||
bomCostBean.setUtilization(materialutilization);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getZYSAPMENGE2(String lylStr, TCComponentItemRevision design, TCComponentBOMLine line,
|
||||
StringBuffer errMessage) throws Exception {
|
||||
double lyl = -1;
|
||||
if (!KUtil.isEmpty(lylStr)) {
|
||||
try {
|
||||
lyl = Double.parseDouble(lylStr);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
lyl = 0.85;
|
||||
}
|
||||
String zt2_TYJNo = line.getProperty("ZT2_TYSpecifications");
|
||||
if (!KUtil.isEmpty(zt2_TYJNo)) {
|
||||
String weight = line.getProperty("ZT2_TYWeight");
|
||||
if (KUtil.isEmpty(weight)) {
|
||||
errMessage.append("未填写通用件重量;");
|
||||
return "0";
|
||||
}
|
||||
Double dw = Double.parseDouble(weight);
|
||||
return String.format("%.3f", dw / lyl);
|
||||
} else {
|
||||
double dw = design.getDoubleProperty("zt2_DesignWeight");
|
||||
return String.format("%.3f", dw / lyl);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Copyright 2023 eSunny Info. Tech Ltd. All rights reserved.
|
||||
*
|
||||
* @Package: com.chint.plm.costbomreport
|
||||
* @author: cyh
|
||||
* @date: 2023Äê12ÔÂ26ÈÕ ÏÂÎç1:41:26
|
||||
*/
|
||||
package com.chint.plm.costbomreport;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author cyh
|
||||
*
|
||||
*/
|
||||
public class Test {
|
||||
|
||||
public static void main(String[] args) {
|
||||
BomCostBean bean = new BomCostBean("123", "222", "33", "22");
|
||||
|
||||
List<BomCostBean> list = new ArrayList<>();
|
||||
list.add(bean);
|
||||
System.out.println(list.indexOf(new BomCostBean("123")));
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in new issue