-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSImportAction.java
More file actions
104 lines (84 loc) · 3.14 KB
/
Copy pathSImportAction.java
File metadata and controls
104 lines (84 loc) · 3.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
package nc.ui.so.commission.ace.action;
import java.awt.event.ActionEvent;
import javax.swing.JComponent;
import javax.swing.SwingUtilities;
import nc.funcnode.ui.AbstractFunclet;
import nc.itf.trade.excelimport.IImportableEditor;
import nc.itf.trade.excelimport.ImportableInfo;
import nc.ui.pub.beans.MessageDialog;
import nc.ui.pubapp.uif2app.model.BillManageModel;
import nc.ui.pubapp.uif2app.view.ShowUpableBillForm;
import nc.ui.scmbd.excelimport.util.ImportInfoTrans;
import nc.ui.trade.excelimport.DataImporter;
import nc.ui.trade.excelimport.ExcelImportInfo;
import nc.ui.trade.excelimport.ExcelImporter;
import nc.ui.trade.excelimport.ImportProgressDlg;
import nc.ui.uif2.editor.IBillCardPanelEditor;
import nc.ui.uif2.excelimport.DefaultUIF2ImportableEditor;
import nc.ui.uif2.excelimport.ImportAction;
import nc.vo.scmbd.excelimport.TransFieldType;
import org.flexdock.util.SwingUtility;
public class SImportAction extends ImportAction {
private static final long serialVersionUID = -8420536946163359804L;
// 下面几个变量对应XML中的property
private IImportableEditor importableEditor;
private BillManageModel model;
private ShowUpableBillForm billForm;
public SImportAction() {}
@Override
public void doAction(ActionEvent e) throws Exception {
// 获取上级面板
final JComponent parent = billForm.getModel().getContext().getEntranceUI();
ImportableInfo info = new ImportableInfo();
if ((info != null) && (!info.isImportable())) {
MessageDialog.showErrorDlg(parent, "Error","check ImportAction.class");
return;
}
// 这两行执行选择excel文件的对话框,读入excel数据
final ExcelImporter i = new ExcelImporter();
final ExcelImportInfo importInfo = i.importFromExcel(parent,
importableEditor.getInputItems());
if (importInfo == null) {
return;
}
// 可在此处插入语句,对excel读进来的数据(ExcelImportInfo)进行处理
// 将excel读入的参照字段的编码或名称,翻译成主键
new ImportInfoTrans().transRefDoc(importInfo,
getIBillCardPanelEditor(),TransFieldType.TransByCodeAndName);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
DataImporter importer = new DataImporter(importableEditor,
importInfo, i.getLogFileName());
ImportProgressDlg dlg = new ImportProgressDlg(parent, importer);
dlg.setModal(false);
SwingUtility.centerOnScreen(dlg);
dlg.setVisible(true);
dlg.start();
dlg.setFunclet((AbstractFunclet) billForm.getModel()
.getContext().getEntranceUI());
}
});
}
public IImportableEditor getImportableEditor() {
return importableEditor;
}
public void setImportableEditor(IImportableEditor importableEditor) {
this.importableEditor = importableEditor;
}
public BillManageModel getModel() {
return model;
}
public void setModel(BillManageModel model) {
this.model = model;
}
public ShowUpableBillForm getBillForm() {
return billForm;
}
public void setBillForm(ShowUpableBillForm billForm) {
this.billForm = billForm;
}
private IBillCardPanelEditor getIBillCardPanelEditor() {
return ((DefaultUIF2ImportableEditor) this.getImportableEditor())
.getBillcardPanelEditor();
}
}