Compare commits
2 Commits
ea7e6c9a8d
...
66926b393c
Author | SHA1 | Date |
---|---|---|
|
66926b393c | 4 years ago |
|
8a5a879792 | 4 years ago |
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,24 @@
|
|||||||
|
package com.connor.dfl.plm.dfl044;
|
||||||
|
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
|
||||||
|
import com.teamcenter.rac.aif.common.actions.AbstractAIFAction;
|
||||||
|
|
||||||
|
public class Dfl044Action extends AbstractAIFAction {
|
||||||
|
|
||||||
|
private AbstractAIFUIApplication app;
|
||||||
|
|
||||||
|
public Dfl044Action(AbstractAIFUIApplication app, String string) {
|
||||||
|
super(app,string);
|
||||||
|
this.app=app;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
new Dfl044Command(app).executeModal();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.connor.dfl.plm.dfl044;
|
||||||
|
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFCommand;
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
|
||||||
|
import com.teamcenter.rac.kernel.TCSession;
|
||||||
|
|
||||||
|
public class Dfl044Command extends AbstractAIFCommand {
|
||||||
|
|
||||||
|
private TCSession session;
|
||||||
|
|
||||||
|
public Dfl044Command(AbstractAIFUIApplication app) {
|
||||||
|
this.session=(TCSession)app.getSession();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void executeModal() throws Exception {
|
||||||
|
new Thread(new Dfl044Dialog(session)).start();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,296 @@
|
|||||||
|
package com.connor.dfl.plm.dfl044;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Component;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.FlowLayout;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
import java.awt.event.MouseAdapter;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.time.Year;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.MissingResourceException;
|
||||||
|
|
||||||
|
import javax.swing.JButton;
|
||||||
|
import javax.swing.JComboBox;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JScrollPane;
|
||||||
|
import javax.swing.JTable;
|
||||||
|
import javax.swing.JTextArea;
|
||||||
|
import javax.swing.JTextField;
|
||||||
|
import javax.swing.table.DefaultTableModel;
|
||||||
|
import javax.swing.table.TableCellRenderer;
|
||||||
|
import javax.swing.table.TableRowSorter;
|
||||||
|
|
||||||
|
import org.jacorb.idl.runtime.int_token;
|
||||||
|
|
||||||
|
import com.connor.dfl.plm.dfl042.ERPTransferStatusbean;
|
||||||
|
import com.connor.dfl.plm.util.DataBaseControl;
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFDialog;
|
||||||
|
import com.teamcenter.rac.aif.commands.open.OpenCommand;
|
||||||
|
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponent;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentGroup;
|
||||||
|
import com.teamcenter.rac.kernel.TCException;
|
||||||
|
import com.teamcenter.rac.kernel.TCPreferenceService;
|
||||||
|
import com.teamcenter.rac.kernel.TCSession;
|
||||||
|
import com.teamcenter.rac.util.ButtonLayout;
|
||||||
|
import com.teamcenter.rac.util.MessageBox;
|
||||||
|
import com.teamcenter.rac.util.PropertyLayout;
|
||||||
|
import com.teamcenter.rac.util.Registry;
|
||||||
|
import com.teamcenter.soaictstubs.stringSeq_tHolder;
|
||||||
|
|
||||||
|
import sun.awt.www.content.audio.x_aiff;
|
||||||
|
|
||||||
|
public class Dfl044Dialog extends AbstractAIFDialog {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 6130114042631785757L;
|
||||||
|
private static final int width=800;
|
||||||
|
DefaultTableModel model;
|
||||||
|
private TCSession session;
|
||||||
|
private JButton qryBtn2;
|
||||||
|
private JTextField idField;
|
||||||
|
private JTextField useridField;
|
||||||
|
private JComboBox<String> zt_combobox; //账套选择下拉框
|
||||||
|
private JLabel StockwriteLabel=new JLabel("");//库存显示文本框
|
||||||
|
private JLabel PricewriteLabel=new JLabel("");//价格显示文本框
|
||||||
|
private HashMap<String, String> account_set = new HashMap();
|
||||||
|
private StringBuilder sb = new StringBuilder("select sum(img10) from ");
|
||||||
|
private StringBuilder numsSb = new StringBuilder("select ccc23a from ");
|
||||||
|
private String sql2 = "";
|
||||||
|
private String zhangtao = ""; //SQL语句中的账套
|
||||||
|
private String zhangtao1 = ""; //SQL语句中的账套
|
||||||
|
private String cangku = "";//SQL语句中的仓库号
|
||||||
|
private String cangku1 = "";
|
||||||
|
private String group = "";
|
||||||
|
private JComboBox<String> zhangTBox;
|
||||||
|
private DataBaseControl2 data;
|
||||||
|
public Dfl044Dialog(TCSession session) {
|
||||||
|
super(false);
|
||||||
|
this.session=session;
|
||||||
|
//this.service = session.getPreferenceService();
|
||||||
|
this.data = new DataBaseControl2(session,"DFL2_ERP_SQL_Connect");
|
||||||
|
String[] BOMZT = session.getPreferenceService().getStringValues("DFL2_ZHANGTAO_WAREHOUSE");
|
||||||
|
|
||||||
|
if (BOMZT == null || BOMZT.length <= 0 ) {
|
||||||
|
MessageBox.post("首选项DFL2_ZHANGTAO_WAREHOUSE未配置,请联系管理员!!",
|
||||||
|
"错误", MessageBox.ERROR);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
TCComponentGroup group = session.getCurrentGroup();
|
||||||
|
try {
|
||||||
|
String group_name = group.getStringProperty("display_name");
|
||||||
|
System.out.println("11.04group_name=============="+group_name);
|
||||||
|
if(group_name.contains(".")) {
|
||||||
|
String[] names = group_name.split("\\.");
|
||||||
|
if(names != null && names.length >=2) {
|
||||||
|
for (int i = 0; i < BOMZT.length; i++) {
|
||||||
|
if(BOMZT[i].contains(";")) {
|
||||||
|
String[] zts = BOMZT[i].split(";");
|
||||||
|
if(names[names.length-2].equals(zts[0])) {
|
||||||
|
this.zhangtao = zts[1];
|
||||||
|
System.out.println("11.04账套======"+zhangtao);
|
||||||
|
this.cangku = zts[2];
|
||||||
|
System.out.println("11.04仓库======"+cangku);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (TCException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
//显示窗口
|
||||||
|
initUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
private void initUI() {
|
||||||
|
this.setTitle("仓库库存和价格查询");
|
||||||
|
this.setLayout(new FlowLayout(FlowLayout.CENTER,2,3));
|
||||||
|
this.setPreferredSize(new Dimension(width, 150));
|
||||||
|
this.setLocation(2, 5);
|
||||||
|
model = new DefaultTableModel() {
|
||||||
|
private static final long serialVersionUID = 6905817304437097181L;
|
||||||
|
public boolean isCellEditable(int row, int column) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
JPanel qryPanel=new JPanel(new PropertyLayout());
|
||||||
|
|
||||||
|
JLabel idLabel=new JLabel("请在右边框中输入零件号");
|
||||||
|
JLabel ztLabel=new JLabel("选择账套");
|
||||||
|
zhangTBox = new JComboBox<String>();
|
||||||
|
JLabel useridLabel=new JLabel(" 零件号:");
|
||||||
|
JLabel StockLabel=new JLabel("库存量:");
|
||||||
|
JLabel PriceLabel=new JLabel(" 单 价:");
|
||||||
|
useridField = new JTextField(10);
|
||||||
|
//new下拉框对象
|
||||||
|
zt_combobox = new JComboBox();
|
||||||
|
zt_combobox.addItem(" ");
|
||||||
|
String[] BOMZT = session.getPreferenceService().getStringValues("DFL2_ZHANGTAO_WAREHOUSE");
|
||||||
|
|
||||||
|
for(int i = 0 ;i<BOMZT.length;i++) {
|
||||||
|
String s2 = BOMZT[i].split(";")[2];
|
||||||
|
String s1 = BOMZT[i].split(";")[1];
|
||||||
|
String s0 = BOMZT[i].split(";")[0];
|
||||||
|
account_set.put(s1, s0);
|
||||||
|
zt_combobox.addItem(s0+":"+s1);
|
||||||
|
}
|
||||||
|
//获取下拉框的值
|
||||||
|
|
||||||
|
qryBtn2=new JButton("查询");
|
||||||
|
qryPanel.add("1.1.center.top",idLabel);//添加零件id文本
|
||||||
|
qryPanel.add("1.2.center.top",useridLabel);//添加品名文本
|
||||||
|
qryPanel.add("1.3.center.top",useridField);//添加品名写入框
|
||||||
|
qryPanel.add("1.4.center.top",ztLabel);//查询按钮
|
||||||
|
qryPanel.add("1.5.center.top",zt_combobox);//查询按钮
|
||||||
|
qryPanel.add("1.6.center.top",qryBtn2);//查询按钮
|
||||||
|
qryPanel.add("2.1.center.top",StockLabel);//添加库存文本框
|
||||||
|
qryPanel.add("2.2.center.top",StockwriteLabel);//添加库存写入框
|
||||||
|
qryPanel.add("2.3.center.top",PriceLabel);//添加价格文本框
|
||||||
|
qryPanel.add("2.4.center.top",PricewriteLabel);//添加品名写入框
|
||||||
|
|
||||||
|
JPanel southPanel = new JPanel(new FlowLayout());
|
||||||
|
|
||||||
|
JButton celBtn = new JButton("取消");
|
||||||
|
celBtn.addActionListener(new ActionListener() {
|
||||||
|
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
disposeDialog();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
southPanel.add(celBtn);
|
||||||
|
JPanel rootPanel=new JPanel(new ButtonLayout());
|
||||||
|
|
||||||
|
qryBtn2.addActionListener(new ActionListener() {
|
||||||
|
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
//下拉值对比
|
||||||
|
getdropdown();
|
||||||
|
StockwriteLabel.setText(StockResult());
|
||||||
|
PricewriteLabel.setText(PriceResult(useridField.getText()));
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.add(qryPanel);
|
||||||
|
this.add(rootPanel);
|
||||||
|
this.setResizable(false);
|
||||||
|
this.setAlwaysOnTop(false);
|
||||||
|
this.showDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
//返回库存数量
|
||||||
|
public String StockResult() {
|
||||||
|
String Stock = null;
|
||||||
|
String Select = null; //选择下拉的值
|
||||||
|
|
||||||
|
String userid = useridField.getText();//获取零件号
|
||||||
|
Select = (String) zt_combobox.getSelectedItem();//获取账套文本框的值
|
||||||
|
System.out.println("11.05选择的下拉值库存======="+Select);
|
||||||
|
//sql语句拼接账套
|
||||||
|
if("".equals(Select) || " ".equals(Select) || "null".equals(Select)) {
|
||||||
|
sb.append(zhangtao+".img_file where img01='");
|
||||||
|
//如果零件号不为空,则拼接
|
||||||
|
if(!("".equals(userid.trim()))) {
|
||||||
|
sb.append(userid+"' and img02='"+cangku+"' and img02<>'Z1'");
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
sb.append(zhangtao1+".img_file where img01='");
|
||||||
|
//如果零件号不为空,则拼接
|
||||||
|
if(!("".equals(userid.trim()))) {
|
||||||
|
sb.append(userid+"' and img02='"+cangku1+"' and img02<>'Z1'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sql2 = sb.toString();
|
||||||
|
System.out.println("sql===================="+sql2);
|
||||||
|
Stock = getRecords(sql2);
|
||||||
|
System.out.println("11.04Stock==================="+Stock);
|
||||||
|
return Stock;
|
||||||
|
}
|
||||||
|
//返回单价
|
||||||
|
public String PriceResult(String userid) {
|
||||||
|
String Price = null;
|
||||||
|
String Select = null; //选择下拉的值
|
||||||
|
|
||||||
|
//如果零件号不为空,则拼接
|
||||||
|
Select = (String) zt_combobox.getSelectedItem();
|
||||||
|
System.out.println("11.05选择的下拉值单价======="+Select);
|
||||||
|
if(!("".equals(userid.trim()))) {
|
||||||
|
if("".equals(Select) || " ".equals(Select) || "null".equals(Select)) {
|
||||||
|
numsSb.append(zhangtao + ".ccc_file inner join "+zhangtao+".ccz_file on ccz01=ccc02 and ccz02=ccc03 where ccc01='"+userid+"'");
|
||||||
|
}else {
|
||||||
|
numsSb.append(zhangtao1 + ".ccc_file inner join "+zhangtao1+".ccz_file on ccz01=ccc02 and ccz02=ccc03 where ccc01='"+userid+"'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String numsSql = numsSb.toString();
|
||||||
|
System.out.println("numsSql===================="+numsSql);
|
||||||
|
Price = getRecords(numsSql);
|
||||||
|
System.out.println("11.04Price==================="+Price);
|
||||||
|
return Price;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询信息获取数据库记录
|
||||||
|
* @return table的dataVector
|
||||||
|
*/
|
||||||
|
private String getRecords(String sql){
|
||||||
|
String result =null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
result = data.getRecord(sql);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
System.out.println("11.04获得的结果======"+result);
|
||||||
|
if(result == null ) {
|
||||||
|
MessageBox.post("数据库中未查找到相应的数据!! 该零件没有库存或单价!!",
|
||||||
|
"错误", MessageBox.ERROR);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
private void getdropdown () {
|
||||||
|
String[] BOMZT = session.getPreferenceService().getStringValues("DFL2_ZHANGTAO_WAREHOUSE");
|
||||||
|
String combobox = (String) zt_combobox.getSelectedItem();
|
||||||
|
boolean flag = true;
|
||||||
|
for (int i = 0; i < BOMZT.length; i++) {
|
||||||
|
String s2 = BOMZT[i].split(";")[2];
|
||||||
|
String s1 = BOMZT[i].split(";")[1];
|
||||||
|
String s0 = BOMZT[i].split(";")[0];
|
||||||
|
|
||||||
|
cangku1 = s2;
|
||||||
|
System.out.println("11.05-cangku1====="+cangku1);
|
||||||
|
zhangtao1 = s1;
|
||||||
|
System.out.println("11.05-zhangtao1====="+zhangtao1);
|
||||||
|
group = s0;
|
||||||
|
System.out.println("11.05-group====="+group);
|
||||||
|
//判断选中的是否和首选项中的一致,是就跳出循环,不再赋值
|
||||||
|
if(combobox.equals(s0+":"+s1)) {
|
||||||
|
flag = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
package com.connor.dfl.plm.dfl044;
|
||||||
|
|
||||||
|
import org.eclipse.core.commands.AbstractHandler;
|
||||||
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
|
import org.eclipse.core.commands.ExecutionException;
|
||||||
|
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
|
||||||
|
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||||
|
|
||||||
|
public class Dfl044Handler extends AbstractHandler {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||||
|
AbstractAIFUIApplication app = AIFUtility.getCurrentApplication();
|
||||||
|
new Thread(new Dfl044Action(app,"")).start();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
package com.connor.dfl.plm.dfl044;
|
||||||
|
|
||||||
|
import javax.swing.JTextField;
|
||||||
|
|
||||||
|
public class ERPStockandPrice {
|
||||||
|
private Integer ID; //ID
|
||||||
|
private String fun; //Àà±ð
|
||||||
|
private String item_id;//Æ·ºÅ
|
||||||
|
private String zhangtao;//ÕËÌ×
|
||||||
|
private String User_id;//Óû§id
|
||||||
|
|
||||||
|
public Integer getID() {
|
||||||
|
return ID;
|
||||||
|
}
|
||||||
|
public void setID(Integer ID) {
|
||||||
|
this.ID = ID;
|
||||||
|
}
|
||||||
|
public String getfun() {
|
||||||
|
return fun;
|
||||||
|
}
|
||||||
|
public void setfun(String fun) {
|
||||||
|
this.fun = fun;
|
||||||
|
}
|
||||||
|
public String getitem_id() {
|
||||||
|
return item_id;
|
||||||
|
}
|
||||||
|
public void setitem_id(String item_id) {
|
||||||
|
this.item_id = item_id;
|
||||||
|
}
|
||||||
|
public String getzhangtao() {
|
||||||
|
return zhangtao;
|
||||||
|
}
|
||||||
|
public void setzhangtao(String zhangtao) {
|
||||||
|
this.zhangtao = zhangtao;
|
||||||
|
}
|
||||||
|
public String getUser_id() {
|
||||||
|
return User_id;
|
||||||
|
}
|
||||||
|
public void setUser_id(String User_id) {
|
||||||
|
this.User_id = User_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
package com.connor.dfl.plm.dfl045;
|
||||||
|
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
|
||||||
|
import com.teamcenter.rac.aif.common.actions.AbstractAIFAction;
|
||||||
|
|
||||||
|
public class Dfl045Action extends AbstractAIFAction {
|
||||||
|
|
||||||
|
private AbstractAIFUIApplication app;
|
||||||
|
|
||||||
|
public Dfl045Action(AbstractAIFUIApplication app, String string) {
|
||||||
|
super(app,string);
|
||||||
|
this.app=app;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
new Dfl045Command(app).executeModal();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.connor.dfl.plm.dfl045;
|
||||||
|
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFCommand;
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
|
||||||
|
import com.teamcenter.rac.kernel.TCSession;
|
||||||
|
|
||||||
|
public class Dfl045Command extends AbstractAIFCommand {
|
||||||
|
|
||||||
|
private TCSession session;
|
||||||
|
|
||||||
|
public Dfl045Command(AbstractAIFUIApplication app) {
|
||||||
|
this.session=(TCSession)app.getSession();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void executeModal() throws Exception {
|
||||||
|
new Thread(new Dfl045Dialog(session)).start();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,229 @@
|
|||||||
|
package com.connor.dfl.plm.dfl045;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Component;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.FlowLayout;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
import java.awt.event.MouseAdapter;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
|
import java.io.File;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.time.Year;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.MissingResourceException;
|
||||||
|
|
||||||
|
import javax.swing.JButton;
|
||||||
|
import javax.swing.JComboBox;
|
||||||
|
import javax.swing.JFileChooser;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JScrollPane;
|
||||||
|
import javax.swing.JTable;
|
||||||
|
import javax.swing.JTextArea;
|
||||||
|
import javax.swing.JTextField;
|
||||||
|
import javax.swing.filechooser.FileSystemView;
|
||||||
|
import javax.swing.table.DefaultTableModel;
|
||||||
|
import javax.swing.table.TableCellRenderer;
|
||||||
|
import javax.swing.table.TableRowSorter;
|
||||||
|
|
||||||
|
import org.jacorb.idl.runtime.int_token;
|
||||||
|
|
||||||
|
import com.connor.dfl.plm.dfl025.Dfl025Operation;
|
||||||
|
import com.connor.dfl.plm.dfl028.Dfl028AIFDialog;
|
||||||
|
import com.connor.dfl.plm.dfl040.DateChooser;
|
||||||
|
import com.connor.dfl.plm.dfl042.ERPTransferStatusbean;
|
||||||
|
import com.connor.dfl.plm.util.DataBaseControl;
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFDialog;
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
|
||||||
|
import com.teamcenter.rac.aif.commands.open.OpenCommand;
|
||||||
|
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponent;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentGroup;
|
||||||
|
import com.teamcenter.rac.kernel.TCException;
|
||||||
|
import com.teamcenter.rac.kernel.TCPreferenceService;
|
||||||
|
import com.teamcenter.rac.kernel.TCSession;
|
||||||
|
import com.teamcenter.rac.util.ButtonLayout;
|
||||||
|
import com.teamcenter.rac.util.MessageBox;
|
||||||
|
import com.teamcenter.rac.util.PropertyLayout;
|
||||||
|
import com.teamcenter.rac.util.Registry;
|
||||||
|
import com.teamcenter.soaictstubs.stringSeq_tHolder;
|
||||||
|
|
||||||
|
import sun.awt.www.content.audio.x_aiff;
|
||||||
|
|
||||||
|
public class Dfl045Dialog extends AbstractAIFDialog {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 6130114042631785757L;
|
||||||
|
private static final int width=800;
|
||||||
|
DefaultTableModel model;
|
||||||
|
private AbstractAIFUIApplication app;
|
||||||
|
private TCSession session;
|
||||||
|
private JFileChooser jFileChooser;
|
||||||
|
private JButton bowBtn = new JButton("浏览");
|
||||||
|
private JButton qryBtn = new JButton("导出");
|
||||||
|
private JButton celBtn = new JButton("取消");
|
||||||
|
private JLabel StarttimeLabel = new JLabel("流程统计开始时间:");//文本
|
||||||
|
private JLabel endtimeLabel=new JLabel("流程统计结束时间:"); //文本
|
||||||
|
private JLabel exportLabel=new JLabel("导出目录:"); //文本
|
||||||
|
private JTextField starttimeField; //开始时间框
|
||||||
|
private JTextField endtimeField; //结束时间框
|
||||||
|
private JTextField jtf = new JTextField(15); //浏览文件路径
|
||||||
|
|
||||||
|
private HashMap<String, String> account_set = new HashMap();
|
||||||
|
private String starttime = ""; //SQL语句中的账套
|
||||||
|
private String endtime = "";//SQL语句中的仓库号
|
||||||
|
//private DataBaseControl2 data;
|
||||||
|
public Dfl045Dialog(TCSession session) {
|
||||||
|
super(false);
|
||||||
|
this.app = app;
|
||||||
|
this.session=session;
|
||||||
|
//this.service = session.getPreferenceService();
|
||||||
|
//this.data = new DataBaseControl2(session,"DFL2_ERP_SQL_Connect");
|
||||||
|
String[] BOMZT = session.getPreferenceService().getStringValues("DFL2_ZHANGTAO_WAREHOUSE");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
//显示窗口
|
||||||
|
initUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
private void initUI() {
|
||||||
|
//设置整体界面
|
||||||
|
this.setTitle("导出流程报表");
|
||||||
|
this.setLayout(new FlowLayout(FlowLayout.CENTER,2,3));
|
||||||
|
this.setPreferredSize(new Dimension(width, 150));
|
||||||
|
this.setLocation(2, 5);
|
||||||
|
model = new DefaultTableModel() {
|
||||||
|
private static final long serialVersionUID = 6905817304437097181L;
|
||||||
|
public boolean isCellEditable(int row, int column) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
//定义容器
|
||||||
|
JPanel qryPanel=new JPanel(new PropertyLayout());
|
||||||
|
//设置控件
|
||||||
|
FileSystemView fsv = FileSystemView.getFileSystemView();
|
||||||
|
String deskPath = fsv.getHomeDirectory().getPath();
|
||||||
|
this.jtf.setText(deskPath);
|
||||||
|
|
||||||
|
// 初始化日期控件
|
||||||
|
Date date = new Date();
|
||||||
|
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
String time = df.format(date);
|
||||||
|
|
||||||
|
//设置时间选择框
|
||||||
|
starttimeField = new JTextField(15);
|
||||||
|
starttimeField.setText(time);
|
||||||
|
|
||||||
|
endtimeField = new JTextField(15);
|
||||||
|
endtimeField.setText(time);
|
||||||
|
//初始化赋值
|
||||||
|
jFileChooser = new JFileChooser();
|
||||||
|
this.jFileChooser.setCurrentDirectory(new File(deskPath));// 文件选择器的初始目录定为当前用户桌面
|
||||||
|
this.jFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
|
||||||
|
// 注册日期面板
|
||||||
|
DateChooser dateChooser1 = DateChooser.getInstance("yyyy-M-d");
|
||||||
|
|
||||||
|
DateChooser dateChooser2 = DateChooser.getInstance("yyyy-M-d");
|
||||||
|
|
||||||
|
dateChooser1.register(starttimeField);
|
||||||
|
dateChooser2.register(endtimeField);
|
||||||
|
|
||||||
|
|
||||||
|
qryPanel.add("1.1.center.top",StarttimeLabel);//添加开始时间文本框
|
||||||
|
qryPanel.add("1.2.center.top",starttimeField);//添加开始时间框
|
||||||
|
qryPanel.add("2.1.center.top",endtimeLabel);//添加结束时间文本框
|
||||||
|
qryPanel.add("2.2.center.top",endtimeField);//添加结束时间框
|
||||||
|
qryPanel.add("3.1.center.top",exportLabel);//导出目录文本框
|
||||||
|
qryPanel.add("3.2.center.top",jtf);//导出目录选择框
|
||||||
|
qryPanel.add("3.3.center.top",bowBtn);//浏览按钮
|
||||||
|
qryPanel.add("3.4.center.top",qryBtn);//导出按钮
|
||||||
|
qryPanel.add("3.5.center.top",celBtn);//取消按钮
|
||||||
|
//JPanel southPanel = new JPanel(new FlowLayout());
|
||||||
|
//浏览按钮监听事件
|
||||||
|
bowBtn.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent arg0) {
|
||||||
|
selectFileButtonEvent();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//导出按钮监听事件
|
||||||
|
qryBtn.addActionListener(new ActionListener() {
|
||||||
|
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
//下拉值对比
|
||||||
|
okEvent();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//取消按钮监听事件
|
||||||
|
celBtn.addActionListener(new ActionListener() {
|
||||||
|
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
disposeDialog();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//southPanel.add(celBtn);
|
||||||
|
JPanel rootPanel=new JPanel(new ButtonLayout());
|
||||||
|
|
||||||
|
this.add(qryPanel);
|
||||||
|
this.add(rootPanel);
|
||||||
|
this.setResizable(false);
|
||||||
|
this.setAlwaysOnTop(false);
|
||||||
|
this.showDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void okEvent() {
|
||||||
|
try {
|
||||||
|
String path = jtf.getText();
|
||||||
|
if("".equals(path) || " ".equals(path)) {
|
||||||
|
MessageBox.post("请选择要导出的路径!!",
|
||||||
|
"提示", MessageBox.INFORMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
System.out.println("ok");
|
||||||
|
starttime = starttimeField.getText()+" 00:00";
|
||||||
|
endtime = endtimeField.getText()+" 00:00";
|
||||||
|
Dfl045Operation operation = new Dfl045Operation(session,starttime,endtime,path);
|
||||||
|
session.queueOperation(operation);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
this.disposeDialog();
|
||||||
|
this.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//获取文件选择路径
|
||||||
|
public void selectFileButtonEvent() {
|
||||||
|
int state = jFileChooser.showOpenDialog(null);// 此句是打开文件选择器界面的触发语句
|
||||||
|
if (state == 1) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
File f = jFileChooser.getSelectedFile();// f为选择到的目录
|
||||||
|
jtf.setText(f.getAbsolutePath());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询信息获取数据库记录
|
||||||
|
* @return table的dataVector
|
||||||
|
*/
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
package com.connor.dfl.plm.dfl045;
|
||||||
|
|
||||||
|
import org.eclipse.core.commands.AbstractHandler;
|
||||||
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
|
import org.eclipse.core.commands.ExecutionException;
|
||||||
|
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
|
||||||
|
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||||
|
|
||||||
|
public class Dfl045Handler extends AbstractHandler {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||||
|
AbstractAIFUIApplication app = AIFUtility.getCurrentApplication();
|
||||||
|
new Thread(new Dfl045Action(app,"")).start();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,77 @@
|
|||||||
|
package com.connor.dfl.plm.dfl046;
|
||||||
|
|
||||||
|
public class AutoCreateBean {
|
||||||
|
|
||||||
|
private String item_id;//品号
|
||||||
|
private String name;//名称
|
||||||
|
private String spec;//规格
|
||||||
|
private String unit;//单位
|
||||||
|
private String design_num;//设计用量
|
||||||
|
private String brand;//品牌
|
||||||
|
private String weihao;//编号
|
||||||
|
private String importance;//重要度
|
||||||
|
private String num;//序号
|
||||||
|
private int level;//等级
|
||||||
|
public String getItem_id() {
|
||||||
|
return item_id;
|
||||||
|
}
|
||||||
|
public void setItem_id(String item_id) {
|
||||||
|
this.item_id = item_id;
|
||||||
|
}
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
public String getSpec() {
|
||||||
|
return spec;
|
||||||
|
}
|
||||||
|
public void setSpec(String spec) {
|
||||||
|
this.spec = spec;
|
||||||
|
}
|
||||||
|
public String getUnit() {
|
||||||
|
return unit;
|
||||||
|
}
|
||||||
|
public void setUnit(String unit) {
|
||||||
|
this.unit = unit;
|
||||||
|
}
|
||||||
|
public String getDesign_num() {
|
||||||
|
return design_num;
|
||||||
|
}
|
||||||
|
public void setDesign_num(String design_num) {
|
||||||
|
this.design_num = design_num;
|
||||||
|
}
|
||||||
|
public String getBrand() {
|
||||||
|
return brand;
|
||||||
|
}
|
||||||
|
public void setBrand(String brand) {
|
||||||
|
this.brand = brand;
|
||||||
|
}
|
||||||
|
public int getLevel() {
|
||||||
|
return level;
|
||||||
|
}
|
||||||
|
public void setLevel(int level) {
|
||||||
|
this.level = level;
|
||||||
|
}
|
||||||
|
public String getWeihao() {
|
||||||
|
return weihao;
|
||||||
|
}
|
||||||
|
public void setWeihao(String weihao) {
|
||||||
|
this.weihao = weihao;
|
||||||
|
}
|
||||||
|
public String getImportance() {
|
||||||
|
return importance;
|
||||||
|
}
|
||||||
|
public void setImportance(String importance) {
|
||||||
|
this.importance = importance;
|
||||||
|
}
|
||||||
|
public String getNum() {
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
public void setNum(String num) {
|
||||||
|
this.num = num;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,52 @@
|
|||||||
|
package com.connor.dfl.plm.dfl046;
|
||||||
|
|
||||||
|
import org.eclipse.core.commands.AbstractHandler;
|
||||||
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
|
import org.eclipse.core.commands.ExecutionException;
|
||||||
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
|
import org.eclipse.ui.handlers.HandlerUtil;
|
||||||
|
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||||
|
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentBOMLine;
|
||||||
|
import com.teamcenter.rac.kernel.TCSession;
|
||||||
|
import com.teamcenter.rac.pse.common.BOMLineNode;
|
||||||
|
import com.teamcenter.rac.pse.common.BOMTreeTableModel;
|
||||||
|
import com.teamcenter.rac.pse.operations.ExpandBelowOperation;
|
||||||
|
import com.teamcenter.rac.psebase.AbstractBOMLineViewerApplication;
|
||||||
|
import com.teamcenter.rac.psebase.common.AbstractViewableTreeTable;
|
||||||
|
import com.teamcenter.rac.util.AdapterUtil;
|
||||||
|
import com.teamcenter.rac.util.MessageBox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Our sample handler extends AbstractHandler, an IHandler base class.
|
||||||
|
* @see org.eclipse.core.commands.IHandler
|
||||||
|
* @see org.eclipse.core.commands.AbstractHandler
|
||||||
|
*/
|
||||||
|
public class BOMExportHandler extends AbstractHandler {
|
||||||
|
/**
|
||||||
|
* The constructor.
|
||||||
|
*/
|
||||||
|
public BOMExportHandler() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the command has been executed, so extract extract the needed information
|
||||||
|
* from the application context.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||||
|
|
||||||
|
AbstractAIFApplication app=AIFUtility.getCurrentApplication();
|
||||||
|
//DL2_VehicleRevision DL2_EBOM
|
||||||
|
if(app.getTargetComponent() instanceof TCComponentBOMLine){
|
||||||
|
TCSession session=(TCSession) app.getSession();
|
||||||
|
test operation=new test(app, session);
|
||||||
|
session.queueOperation(operation);
|
||||||
|
}else{
|
||||||
|
MessageBox.post("ÇëÑ¡ÔñBOMLine","",2);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
package com.connor.dfl.plm.dfl046;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
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.TCComponentBOMViewRevision;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentBOMWindow;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentBOMWindowType;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentContextList;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentQuery;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentQueryType;
|
||||||
|
import com.teamcenter.rac.kernel.TCException;
|
||||||
|
import com.teamcenter.rac.kernel.TCPreferenceService;
|
||||||
|
import com.teamcenter.rac.kernel.TCQueryClause;
|
||||||
|
import com.teamcenter.rac.kernel.TCSession;
|
||||||
|
import com.teamcenter.rac.kernel.TCTextService;
|
||||||
|
import com.teamcenter.rac.kernel.TCTypeService;
|
||||||
|
import com.teamcenter.rac.kernel.TCUserService;
|
||||||
|
import com.teamcenter.rac.util.MessageBox;
|
||||||
|
|
||||||
|
public class ChangeDbomUtil {
|
||||||
|
public static TCPreferenceService service;
|
||||||
|
public static TCSession session;
|
||||||
|
public static TCUserService userservice;;
|
||||||
|
|
||||||
|
static {
|
||||||
|
if (session == null) {
|
||||||
|
session = (TCSession) (AIFUtility.getCurrentApplication()
|
||||||
|
.getSession());
|
||||||
|
}
|
||||||
|
if (service == null)
|
||||||
|
service = session.getPreferenceService();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setByPass(boolean val) throws TCException {
|
||||||
|
if (userservice == null) {
|
||||||
|
userservice = session.getUserService();
|
||||||
|
}
|
||||||
|
Object[] obj = new Object[1];
|
||||||
|
obj[0] = "origin";
|
||||||
|
if (val) {
|
||||||
|
// userservice.call("ORIGIN_set_bypass", obj);
|
||||||
|
userservice.call("Connor_set_bypass", obj);
|
||||||
|
} else {
|
||||||
|
// userservice.call("ORIGIN_close_bypass", obj);
|
||||||
|
userservice.call("Connor_close_bypass", obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Loading…
Reference in new issue