parent
04aff3093f
commit
fc7596dfae
@ -0,0 +1,94 @@
|
|||||||
|
package com.langtech.plm.modifyEffectiveTime;
|
||||||
|
|
||||||
|
import org.jdesktop.swingx.JXDatePicker;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import javax.swing.table.TableCellEditor;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.EventObject;
|
||||||
|
|
||||||
|
public class DatePickerEditor extends AbstractCellEditor implements TableCellEditor {
|
||||||
|
|
||||||
|
private JXDatePicker datePicker;
|
||||||
|
private JTable table;
|
||||||
|
private int row;
|
||||||
|
private int column;
|
||||||
|
|
||||||
|
public DatePickerEditor() {
|
||||||
|
datePicker = new JXDatePicker();
|
||||||
|
// 设置日期格式
|
||||||
|
datePicker.setFormats(new SimpleDateFormat("yyyy-MM-dd"));
|
||||||
|
datePicker.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
fireEditingStopped();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
|
||||||
|
this.table = table;
|
||||||
|
this.row = row;
|
||||||
|
this.column = column;
|
||||||
|
|
||||||
|
System.out.println("getTableCellEditorComponent: "+value);
|
||||||
|
if (value instanceof Date) {
|
||||||
|
datePicker.setDate((Date) value);
|
||||||
|
} else {
|
||||||
|
datePicker.setDate(null);
|
||||||
|
}
|
||||||
|
return datePicker;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getCellEditorValue() {
|
||||||
|
try {
|
||||||
|
// 获取用户输入的文本
|
||||||
|
String text = datePicker.getEditor().getText();
|
||||||
|
|
||||||
|
if (text.trim().isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 尝试将输入解析为日期
|
||||||
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
format.setLenient(false); // 严格解析日期格式
|
||||||
|
return format.parse(text);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 如果解析失败,打印错误信息并返回当前日期选择器的值
|
||||||
|
System.err.println("Invalid date format: " + e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 返回日期选择器当前的值
|
||||||
|
return datePicker.getDate();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCellEditable(EventObject anEvent) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean stopCellEditing() {
|
||||||
|
System.out.println("stopCellEditing: " + datePicker.getDate());
|
||||||
|
fireEditingStopped();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldSelectCell(EventObject anEvent) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cancelCellEditing() {
|
||||||
|
super.cancelCellEditing();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,265 @@
|
|||||||
|
package com.langtech.plm.modifyEffectiveTime;
|
||||||
|
|
||||||
|
import java.awt.BorderLayout;
|
||||||
|
import java.awt.Component;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.FlowLayout;
|
||||||
|
import java.awt.Font;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.swing.BorderFactory;
|
||||||
|
import javax.swing.JButton;
|
||||||
|
import javax.swing.JFrame;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JScrollPane;
|
||||||
|
import javax.swing.JTable;
|
||||||
|
import javax.swing.SwingConstants;
|
||||||
|
import javax.swing.border.EmptyBorder;
|
||||||
|
import javax.swing.table.DefaultTableCellRenderer;
|
||||||
|
import javax.swing.table.DefaultTableModel;
|
||||||
|
import javax.swing.table.TableCellEditor;
|
||||||
|
import javax.swing.table.TableCellRenderer;
|
||||||
|
import javax.swing.table.TableColumnModel;
|
||||||
|
|
||||||
|
import org.jdesktop.swingx.JXDatePicker;
|
||||||
|
|
||||||
|
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||||
|
import com.teamcenter.rac.kernel.TCSession;
|
||||||
|
import com.teamcenter.rac.kernel.TCUserService;
|
||||||
|
import com.teamcenter.rac.util.MessageBox;
|
||||||
|
|
||||||
|
public class ModifyEffectiveTimeDialog extends JFrame implements Runnable {
|
||||||
|
private JTable table;
|
||||||
|
|
||||||
|
private JButton okButton;
|
||||||
|
private boolean flag;
|
||||||
|
|
||||||
|
private final String title;
|
||||||
|
private final String[] columnNames;
|
||||||
|
private Object[][] data;
|
||||||
|
private int[] dateIndex;
|
||||||
|
private boolean pass;
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public ModifyEffectiveTimeDialog(String title, Object... args) {
|
||||||
|
this.title = title;
|
||||||
|
this.columnNames = (String[]) args[0];
|
||||||
|
this.data = (Object[][]) args[1];
|
||||||
|
this.dateIndex = (int[]) args[2];
|
||||||
|
this.pass = (boolean) args[3];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
initUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWithHeight(int with, int height) {
|
||||||
|
this.setSize(with, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initUI() {
|
||||||
|
this.setTitle(title);
|
||||||
|
// 初始化所有信息
|
||||||
|
initializationComponent();
|
||||||
|
|
||||||
|
// 添加内容到JFrame 并设置它的位置
|
||||||
|
JPanel bottomPanel = getBottomPanel();
|
||||||
|
// 创建表格和滚动条
|
||||||
|
JPanel tableScrollPane = createTable();
|
||||||
|
tableScrollPane.setPreferredSize(new Dimension(700, 200)); // 设置滚动条的大小
|
||||||
|
|
||||||
|
this.getContentPane().add(tableScrollPane, BorderLayout.CENTER);
|
||||||
|
this.getContentPane().add(bottomPanel, BorderLayout.SOUTH);
|
||||||
|
// 设置窗口居中
|
||||||
|
this.setLocationRelativeTo(null);
|
||||||
|
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||||
|
// 设置可见性
|
||||||
|
this.setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initializationComponent() {
|
||||||
|
okButton = new JButton("应用");
|
||||||
|
okButton.setEnabled(pass);
|
||||||
|
}
|
||||||
|
|
||||||
|
public JPanel createTable() {
|
||||||
|
JPanel panel = new JPanel(new BorderLayout(10, 10));
|
||||||
|
panel.setBorder(new EmptyBorder(20, 20, 10, 20));
|
||||||
|
|
||||||
|
// 创建 DefaultTableModel 实例
|
||||||
|
DefaultTableModel model = new DefaultTableModel(data, columnNames) {
|
||||||
|
@Override
|
||||||
|
public boolean isCellEditable(int row, int column) {
|
||||||
|
if (column == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<?> getColumnClass(int columnIndex) {
|
||||||
|
if (columnIndex == 1) {
|
||||||
|
return Date.class;
|
||||||
|
}
|
||||||
|
return super.getColumnClass(columnIndex);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
table = new JTable(model);
|
||||||
|
|
||||||
|
// 设置行高
|
||||||
|
table.setRowHeight(25); // 设置行高为30像素
|
||||||
|
table.setFont(new Font("微软雅黑", Font.PLAIN, 12));
|
||||||
|
// 禁用列重排序
|
||||||
|
table.getTableHeader().setReorderingAllowed(false);
|
||||||
|
// 禁用自动调整列宽
|
||||||
|
// table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
|
||||||
|
// 设置表格填满视口高度
|
||||||
|
// table.setFillsViewportHeight(true);
|
||||||
|
|
||||||
|
// 设置列宽
|
||||||
|
TableColumnModel columnModel = table.getColumnModel();
|
||||||
|
columnModel.getColumn(0).setPreferredWidth(300);
|
||||||
|
columnModel.getColumn(1).setPreferredWidth(143);
|
||||||
|
|
||||||
|
table.removeColumn(columnModel.getColumn(columnModel.getColumnCount() - 1));
|
||||||
|
|
||||||
|
// 自定义渲染器,使所有列居中对齐
|
||||||
|
DefaultTableCellRenderer centerRenderer = new DefaultTableCellRenderer() {
|
||||||
|
@Override
|
||||||
|
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
|
||||||
|
boolean hasFocus, int row, int column) {
|
||||||
|
Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
|
||||||
|
((JLabel) c).setHorizontalAlignment(SwingConstants.CENTER); // 设置文本居中对齐
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 应用居中对齐渲染器
|
||||||
|
for (int i = 0; i < columnModel.getColumnCount(); i++) {
|
||||||
|
columnModel.getColumn(i).setCellRenderer(centerRenderer);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 自定义渲染器
|
||||||
|
TableCellRenderer dateRenderer = (JTable table, Object value, boolean isSelected, boolean hasFocus, int row,
|
||||||
|
int column) -> {
|
||||||
|
JXDatePicker datePicker = new JXDatePicker();
|
||||||
|
if (value instanceof Date) {
|
||||||
|
datePicker.setFormats(new SimpleDateFormat("yyyy-MM-dd"));
|
||||||
|
datePicker.setDate((Date) value);
|
||||||
|
}
|
||||||
|
return datePicker;
|
||||||
|
};
|
||||||
|
// 自定义编辑器
|
||||||
|
TableCellEditor dateEditor = new DatePickerEditor();
|
||||||
|
|
||||||
|
// 为 IssueDate 和 MaterialDeliveryTime 列设置日期选择器
|
||||||
|
for (int index : dateIndex) {
|
||||||
|
// 设置渲染器和编辑器
|
||||||
|
table.getColumnModel().getColumn(index).setCellRenderer(dateRenderer);
|
||||||
|
table.getColumnModel().getColumn(index).setCellEditor(dateEditor);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建 JScrollPane 并设置水平滚动条始终可见
|
||||||
|
JScrollPane scrollPane = new JScrollPane(table);
|
||||||
|
// scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
|
||||||
|
|
||||||
|
// 添加表格到中心区域
|
||||||
|
panel.add(scrollPane, BorderLayout.CENTER);
|
||||||
|
return panel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JPanel getBottomPanel() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
JPanel bottomPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 70, 10));
|
||||||
|
bottomPanel.setBorder(BorderFactory.createEmptyBorder(-10, 0, 10, 0));
|
||||||
|
bottomPanel.add(this.okButton);
|
||||||
|
// 添加监听
|
||||||
|
okButton.addActionListener(e -> {
|
||||||
|
flag = true;
|
||||||
|
List<String[]> tableData = getTableData();
|
||||||
|
if (tableData != null) {
|
||||||
|
tableData.forEach(rowData -> {
|
||||||
|
System.out.println(Arrays.toString(rowData));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flag) {
|
||||||
|
MessageBox.post("修改成功! ", "Info", MessageBox.INFORMATION);
|
||||||
|
this.dispose(); // 关闭窗口
|
||||||
|
} else {
|
||||||
|
MessageBox.post("生效时间不允许超出两行", "Error", MessageBox.ERROR);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return bottomPanel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String[]> getTableData() {
|
||||||
|
DefaultTableModel model = (DefaultTableModel) table.getModel();
|
||||||
|
int rowCount = model.getRowCount();
|
||||||
|
int columnCount = model.getColumnCount();
|
||||||
|
|
||||||
|
List<String[]> tableData = new ArrayList<>();
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
for (int row = 0; row < rowCount; row++) {
|
||||||
|
Object obj = model.getValueAt(row, 1);
|
||||||
|
if (obj instanceof Date && obj != null) {
|
||||||
|
count++;
|
||||||
|
if (count == 3) {
|
||||||
|
flag = false;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setByPass(true);
|
||||||
|
try {
|
||||||
|
for (int row = 0; row < rowCount; row++) {
|
||||||
|
String name = (String) model.getValueAt(row, 0);
|
||||||
|
Object obj = model.getValueAt(row, 1);
|
||||||
|
System.out.println("name: " + name + " || date: " + obj);
|
||||||
|
TCComponentItemRevision rev = (TCComponentItemRevision) model.getValueAt(row, 2);
|
||||||
|
rev.setDateProperty("ly6_deadline", (Date) obj);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO: handle exception
|
||||||
|
e.printStackTrace();
|
||||||
|
MessageBox.post(e.getMessage(), "Error", MessageBox.ERROR);
|
||||||
|
}
|
||||||
|
setByPass(false);
|
||||||
|
return tableData;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public void setByPass(boolean pass) {
|
||||||
|
TCUserService userservice = null;
|
||||||
|
if (userservice == null) {
|
||||||
|
userservice = ((TCSession) AIFUtility.getCurrentApplication().getSession()).getUserService();
|
||||||
|
}
|
||||||
|
Object[] obj = new Object[1];
|
||||||
|
obj[0] = "origin";
|
||||||
|
try {
|
||||||
|
if (pass) {
|
||||||
|
userservice.call("CONNOR_open_bypass", obj);
|
||||||
|
System.out.println("旁路已开启");
|
||||||
|
} else {
|
||||||
|
userservice.call("CONNOR_close_bypass", obj);
|
||||||
|
System.out.println("旁路已关闭");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,165 @@
|
|||||||
|
package com.langtech.plm.modifyEffectiveTime;
|
||||||
|
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.core.commands.AbstractHandler;
|
||||||
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
|
import org.eclipse.core.commands.ExecutionException;
|
||||||
|
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||||
|
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
|
||||||
|
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
||||||
|
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||||
|
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.TCException;
|
||||||
|
import com.teamcenter.rac.kernel.TCPreferenceService;
|
||||||
|
import com.teamcenter.rac.kernel.TCSession;
|
||||||
|
import com.teamcenter.rac.util.MessageBox;
|
||||||
|
|
||||||
|
public class ModifyEffectiveTimeHandler extends AbstractHandler {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||||
|
AbstractAIFApplication app = AIFUtility.getCurrentApplication();
|
||||||
|
TCSession session = (TCSession) app.getSession();
|
||||||
|
|
||||||
|
TCPreferenceService preferenceService = session.getPreferenceService();
|
||||||
|
String[] preValues = preferenceService.getStringValues("LY__FormulaDeadLine_Config");
|
||||||
|
if ((preValues != null && preValues.length < 3) || preValues == null) {
|
||||||
|
MessageBox.post("LY__FormulaDeadLine_Config配置错误", "Error", MessageBox.ERROR);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] types = preValues[0].split(";");
|
||||||
|
String[] childTypes = preValues[1].split(";");
|
||||||
|
String[] permissionPeo = preValues[2].split(";");
|
||||||
|
|
||||||
|
TCComponent targetComponent = (TCComponent)app.getTargetComponent();
|
||||||
|
|
||||||
|
String targetType = "";
|
||||||
|
try {
|
||||||
|
if(targetComponent instanceof TCComponentItemRevision) {
|
||||||
|
targetType = targetComponent.getType();
|
||||||
|
}else if(targetComponent instanceof TCComponentBOMLine) {
|
||||||
|
targetType = ((TCComponentBOMLine) targetComponent).getItemRevision().getType();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
boolean isExist = false;
|
||||||
|
System.out.println("当前类型:" + targetType);
|
||||||
|
for (String type : types) {
|
||||||
|
System.out.println("当前配置类型:" + type);
|
||||||
|
if (type.equals(targetType)) {
|
||||||
|
isExist = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!isExist) {
|
||||||
|
MessageBox.post("请选择指定类型的牌号版本执行修改配方生效日期功能", "Error", MessageBox.ERROR);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean pass = false;
|
||||||
|
String userName = session.getUserName();
|
||||||
|
System.out.println("当前用户:" + userName);
|
||||||
|
for (String name : permissionPeo) {
|
||||||
|
System.out.println("当前配置用户:" + name);
|
||||||
|
if (userName.equals(name)) {
|
||||||
|
pass = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Object[][] data = null;
|
||||||
|
try {
|
||||||
|
List<TCComponentItemRevision> revList = getChildBom(session, targetComponent, childTypes);
|
||||||
|
data = new Object[revList.size()][];
|
||||||
|
|
||||||
|
for (int i = 0; i < revList.size(); i++) {
|
||||||
|
TCComponentItemRevision tempRev = revList.get(i);
|
||||||
|
Object[] tempData = new Object[3];
|
||||||
|
tempData[0] = tempRev.getProperty("object_string");
|
||||||
|
tempData[1] = parseDate(tempRev.getProperty("ly6_deadline"));
|
||||||
|
tempData[2] = tempRev;
|
||||||
|
|
||||||
|
data[i] = tempData;
|
||||||
|
}
|
||||||
|
} catch (TCException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 表格列标题
|
||||||
|
String[] columnNames = new String[] { "对象", "生效时间", "TCComponent" };
|
||||||
|
int[] dateIndex = new int[] { 1 };
|
||||||
|
ModifyEffectiveTimeDialog dialog = new ModifyEffectiveTimeDialog("修改配方生效时间", columnNames, data, dateIndex,
|
||||||
|
pass);
|
||||||
|
dialog.setWithHeight(500, 300);
|
||||||
|
|
||||||
|
new Thread(dialog).start();
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TCComponentItemRevision> getChildBom(TCSession session, TCComponent targetComponent,
|
||||||
|
String[] childTypes) throws TCException {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
TCComponentBOMLine topLine = null;
|
||||||
|
if (targetComponent instanceof TCComponentItemRevision) {
|
||||||
|
TCComponentItemRevision rev = (TCComponentItemRevision) targetComponent;
|
||||||
|
TCComponentBOMWindowType winType = (TCComponentBOMWindowType) session.getTypeComponent("BOMWindow");
|
||||||
|
TCComponentBOMWindow view = winType.create(null);
|
||||||
|
topLine = view.setWindowTopLine(rev.getItem(), rev, null, null);
|
||||||
|
} else if (targetComponent instanceof TCComponentBOMLine) {
|
||||||
|
topLine = ((TCComponentBOMLine) targetComponent);
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean hasChildren = topLine.hasChildren();
|
||||||
|
List<TCComponentItemRevision> revList = new ArrayList<TCComponentItemRevision>();
|
||||||
|
if (!hasChildren) {
|
||||||
|
return revList;
|
||||||
|
}
|
||||||
|
|
||||||
|
String revType = "";
|
||||||
|
AIFComponentContext[] childrena = topLine.getChildren();
|
||||||
|
for (AIFComponentContext children : childrena) {
|
||||||
|
TCComponentBOMLine component = (TCComponentBOMLine) children.getComponent();
|
||||||
|
TCComponentItemRevision itemRevision = component.getItemRevision();
|
||||||
|
// revType = itemRevision.getProperty("object_type");
|
||||||
|
revType = itemRevision.getType();
|
||||||
|
System.out.println("子类对象类型getType()获取的值:" + revType);
|
||||||
|
for (String type : childTypes) {
|
||||||
|
System.out.println("子类配置对象类型:" + type);
|
||||||
|
if (revType.equals(type)) {
|
||||||
|
revList.add(itemRevision);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return revList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date parseDate(String dateString) {
|
||||||
|
if (dateString == null || dateString.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
try {
|
||||||
|
return sdf.parse(dateString);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in new issue