Compare commits

...

2 Commits

Author SHA1 Message Date
郭宇航 66926b393c 11.23阶段性代码保存
4 years ago
郭宇航 8a5a879792 11.23
4 years ago

@ -92,7 +92,7 @@
</classpathentry>
<classpathentry kind="lib" path="lib/org.eclipse.osgi.services.nl_12000.2.0.jar"/>
<classpathentry kind="lib" path="lib/org.eclipse.osgi.services_3.7.100.v20180827-1536.jar"/>
<classpathentry kind="lib" path="lib/cn.com.origin.autocode_1.0.0.jar"/>
<classpathentry kind="lib" path="lib/cn.com.origin.autocodemanager_1.0.0.jar"/>
<classpathentry kind="lib" path="lib/cn.com.origin.autocode_1.0.0.jar" sourcepath="D:/eclipse/workspacejune24/6.21/com.connor.dfl.plm/lib/cn.com.origin.autocode_1.0.0.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

@ -232,6 +232,9 @@
<command name="创建标准Bom" id="com.connor.dfl.plm.dfl041.Dfl041Handler"/>
<command name="ERP队列" id="com.connor.dfl.plm.dfl042.Dfl042Handler"/>
<command name="自动填写作业编号" id="com.connor.dfl.plm.dfl043.Dfl043Handler"/>
<command name="查询零件库存和价格" id="com.connor.dfl.plm.dfl044.Dfl044Handler"/>
<command name="流程报表导出" id="com.connor.dfl.plm.dfl045.Dfl045Handler"/>
<command name="价格bom报表导出" id="com.connor.dfl.plm.dfl046.BOMExportHandler"/>
</extension>
<!--handlers-->
<extension point="org.eclipse.ui.handlers">
@ -447,6 +450,9 @@
<handler commandId="com.connor.dfl.plm.dfl041.Dfl041Handler" class="com.connor.dfl.plm.dfl041.Dfl041Handler"/>
<handler commandId="com.connor.dfl.plm.dfl042.Dfl042Handler" class="com.connor.dfl.plm.dfl042.Dfl042Handler"/>
<handler commandId="com.connor.dfl.plm.dfl043.Dfl043Handler" class="com.connor.dfl.plm.dfl043.Dfl043Handler"/>
<handler commandId="com.connor.dfl.plm.dfl044.Dfl044Handler" class="com.connor.dfl.plm.dfl044.Dfl044Handler"/>
<handler commandId="com.connor.dfl.plm.dfl045.Dfl045Handler" class="com.connor.dfl.plm.dfl045.Dfl045Handler"/>
<handler commandId="com.connor.dfl.plm.dfl046.BOMExportHandler" class="com.connor.dfl.plm.dfl046.BOMExportHandler"/>
<!--
<handler commandId="com.connor.dfl.plm.dfl030.Dfl030Handler" class="com.connor.dfl.plm.dfl030.Dfl030Handler"/>
@ -507,7 +513,19 @@
</and>
</visibleWhen>
</command>
<command commandId="com.connor.dfl.plm.dfl044.Dfl044Handler" id="com.connor.dfl.plm.dfl044.Dfl044Handler">
<visibleWhen>
<and>
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals value="com.connor.dfl.plm.dfl044.Dfl044Handler"/>
</iterate>
</not>
</with>
</and>
</visibleWhen>
</command>
</menu>
@ -681,6 +699,35 @@
</and>
</visibleWhen>
</command>
<command commandId="com.connor.dfl.plm.dfl046.BOMExportHandler" id="com.connor.dfl.plm.dfl046.BOMExportHandler">
<visibleWhen>
<and>
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals value="com.connor.dfl.plm.dfl046.BOMExportHandler"/>
</iterate>
</not>
</with>
</and>
</visibleWhen>
</command>
<command commandId="com.connor.dfl.plm.dfl045.Dfl045Handler" id="com.connor.dfl.plm.dfl045.Dfl045Handler">
<visibleWhen>
<and>
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals value="com.connor.dfl.plm.dfl045.Dfl045Handler"/>
</iterate>
</not>
</with>
</and>
</visibleWhen>
</command>
</menu>
@ -711,19 +758,7 @@
</command>
<command commandId="com.connor.dfl.plm.dfl021.Dfl021Handler" id="com.connor.dfl.plm.dfl021.Dfl021Handler">
<visibleWhen>
<and>
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals value="com.connor.dfl.plm.dfl021.Dfl021Handler"/>
</iterate>
</not>
</with>
</and>
</visibleWhen>
</command>
-->
<command commandId="com.connor.dfl.plm.dfl035.ShowMyViewHandler" mnemonic="S" id="com.connor.dfl.plm.dfl035.ShowMyViewHandler">
<visibleWhen>

@ -272,7 +272,7 @@ public class Dfl003AIFDialog extends AbstractAIFDialog {
e2.printStackTrace();
}
jtext1.setEnabled(false);
jtext2.setEnabled(false);
jtext2.setEnabled(true);
jcomname.setEnabled(false);
jp2.setLayout(null);
jl1.setBounds(20, 20, 30, 30);

@ -361,7 +361,9 @@ public class Dfl019Operation extends AbstractAIFOperation{
if("T2_outsourceRevision".equals(type) || "T2_OutBuyPartRevision".equals(type)
||"T2_VirtualRevision".equals(type) ||"T2_EquipmentRevision".equals(type)
||"T2_SystemSchemeRevision".equals(type)) {
if("T2_outsourceRevision".equals(type)||"T2_OutBuyPartRevision".equals(type) ) {
//判断是否有状态
if("T2_outsourceRevision".equals(type)||"T2_OutBuyPartRevision".equals(type)
) {
TCProperty tcProperty = rev.getTCProperty("release_status_list");
TCComponent[] targets = tcProperty.getReferenceValueArray();
String groupcode1 = rev.getStringProperty("t2_groupCode");
@ -373,6 +375,8 @@ public class Dfl019Operation extends AbstractAIFOperation{
"提示", MessageBox.WARNING);
return true;
}
if("T2_outsourceRevision".equals(type)||"T2_OutBuyPartRevision".equals(type)
) {
if(groupcode1.equals("")){
MessageBox.post(rev.getStringProperty("item_id")+"该物料没有分群码!!",
"提示", MessageBox.WARNING);
@ -384,6 +388,8 @@ public class Dfl019Operation extends AbstractAIFOperation{
return true;
}
}
}
}else {
MessageBox.post("该物料不允许传递ERP!!",
"提示", MessageBox.WARNING);
@ -830,6 +836,8 @@ public class Dfl019Operation extends AbstractAIFOperation{
String zong= tops + sss3SB.toString()+bottom;
System.out.println(zong);
String tempPath = System.getProperty("java.io.tmpdir");
System.out.println("10.20temp路径======="+tempPath);
//String path = "D:\\SENDTOERPLOG\\" + fileName + ".txt";
String path = tempPath + fileName + ".txt";
File file = new File(path);
if (!file.exists()) {
@ -872,6 +880,8 @@ public class Dfl019Operation extends AbstractAIFOperation{
String zong= tops + sss3SB.toString()+bottom;
System.out.println(zong);
String tempPath = System.getProperty("java.io.tmpdir");
System.out.println("10.20temp路径======="+tempPath);
//String path = "D:\\SENDTOERPLOG\\" + fileName + ".txt";
String path = tempPath + fileName + ".txt";
File file = new File(path);
if (!file.exists()) {

@ -178,6 +178,8 @@ public class Dfl020Operation extends AbstractAIFOperation{
if(comp[0] instanceof TCComponentItemRevision ) {
rev = (TCComponentItemRevision) comp[0];
String rve_id = rev.getStringProperty("current_revision_id");
System.out.println("11.17rve_id======"+rve_id);
}
if(comp[0] instanceof TCComponentBOMLine ) {
TCComponentBOMLine get_bom_line = (TCComponentBOMLine) comp[0];
@ -186,8 +188,10 @@ public class Dfl020Operation extends AbstractAIFOperation{
TCProperty tcProperty1 = rev.getTCProperty("release_status_list");
TCComponent[] targets1 = tcProperty1.getReferenceValueArray();
String item_type = rev.getType();
//限制没有发布状态的非虚拟件版本发起bom传递erp命令
// if(!("T2_VirtualRevision".equals(item_type))) {
//限制没有发布状态的设备虚拟件版本发起bom传递erp命令
// if("T2_VirtualRevision".equals(item_type)||"T2_EquipmentRevision".equals(item_type)) {
// if(targets1 == null || targets1.length <= 0) {
// MessageBox.post("您选中的版本对象没有发布状态","提示",MessageBox.INFORMATION);
// return;
@ -253,7 +257,7 @@ public class Dfl020Operation extends AbstractAIFOperation{
TCTypeService service = session.getTypeService();
TCComponentBOMWindowType winType = (TCComponentBOMWindowType) service.getTypeComponent("BOMWindow");
TCComponentBOMWindow view = winType.create(null);
TCComponentBOMLine line = view.setWindowTopLine(item,item.getLatestItemRevision(), null, null);
TCComponentBOMLine line = view.setWindowTopLine(item,rev, null, null);
AIFComponentContext[] childs = line.getChildren();
if(childs != null && childs.length > 0) {
createXMLFile(line,zhangtao);
@ -286,6 +290,8 @@ public class Dfl020Operation extends AbstractAIFOperation{
//List<FatherBomLineBean> list = new ArrayList<FatherBomLineBean>();
StringBuilder uidSB = new StringBuilder();
try {
getBOMValue(line,list);
if(list.size() <=0) {
@ -295,7 +301,7 @@ public class Dfl020Operation extends AbstractAIFOperation{
}
} catch (Exception e) {
// TODO: handle exception
MessageBox.post("BOM 传递失败请检查BOM行是否正确" ,"提示",MessageBox.INFORMATION);
MessageBox.post("BOM 传递失败请检查BOM行是否正确!" ,"提示",MessageBox.INFORMATION);
return;
}
//获取父 属性
@ -414,6 +420,8 @@ public class Dfl020Operation extends AbstractAIFOperation{
String fileName ="BOM"+ plmls;
String tempPath = System.getProperty("java.io.tmpdir");
System.out.println("10.20temp路径======="+tempPath);
//String path = "D:\\SENDTOERPLOG\\" + fileName + ".txt";
String path = tempPath + fileName + ".txt";
File file = new File(path);
@ -531,8 +539,13 @@ public class Dfl020Operation extends AbstractAIFOperation{
list.add(fatherBean);
for (int i = 0; i < childrens.length; i++)
{
TCComponentBOMLine z_line = (TCComponentBOMLine)childrens[i].getComponent();
TCComponentItem item = z_line.getItem();
// String idString = item.getStringProperty("item_id");
// System.out.println("11.17id======"+idString);
System.out.println("11.17z_line======="+z_line);
System.out.println("11.17list======="+list);
String type = item.getType();
System.out.println("type=============" + type);
if (!("T2_OutBuyPart".equals(type)) && !("T2_outsource".equals(type)))

@ -78,6 +78,7 @@ public class Dfl025Operation extends AbstractAIFOperation{
File file = ((TCComponentDataset)excel).getTcFiles()[0].getFmsFile();
SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");// 设置日期格式
String time = df.format(new Date());
System.out.println("11.12======"+lattetTime+"========"+EarlyTime);
String[] keys = new String[] {"创建时间晚于","创建时间早于"};
String[] values = new String[] {lattetTime,EarlyTime};
List<TCComponent> compList = queryObject("查找系统方案", keys, values);

@ -1,35 +1,51 @@
package com.connor.dfl.plm.dfl028;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Desktop;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.JTextField;
import javax.swing.filechooser.FileSystemView;
import org.jacorb.idl.runtime.int_token;
import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aif.AbstractAIFDialog;
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
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.TCComponentDataset;
import com.teamcenter.rac.kernel.TCComponentItem;
import com.teamcenter.rac.kernel.TCComponentItemRevision;
import com.teamcenter.rac.kernel.TCComponentRevisionRule;
import com.teamcenter.rac.kernel.TCComponentTcFile;
import com.teamcenter.rac.kernel.TCComponentUser;
import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.util.MessageBox;
@ -45,13 +61,26 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
private JFileChooser jFileChooser;
private JButton okBut = new JButton("下载");
private JButton celBut = new JButton("取消");
private List<File> fmsFilelist = new ArrayList<>();
private List<String> hzmlist = new ArrayList<>();
private List<String> namelist = new ArrayList<>();
private ArrayList<File> fmsFilelist = new ArrayList<>();
private ArrayList<String> hzmlist = new ArrayList<>();
private ArrayList<String> namelist = new ArrayList<>();
private FileInputStream fis;
private FileOutputStream fos;
private JPanel btnPanel1;
private JPanel btnPanel2;
private JPanel btnPanel3;
private String hzm;
private int iDataset=0;
private String datasetDir;
private Boolean outPartBool=false;
private JProgressBar bar;
private long fileSize=0;
private Boolean allCheck=false;
private List<String> noFileList=new ArrayList<String>();
private List<String> datasetList=new ArrayList<String>();
private Map<String, String> pathMap=new HashMap<String, String>();
private String pathString;
ExecutorService pool = Executors.newCachedThreadPool();
public Dfl028AIFDialog(AbstractAIFApplication arg0){
this.app = arg0;
this.session = (TCSession)app.getSession();
@ -62,18 +91,29 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
public void run() {
//显示窗口
init();
//启用查询按钮
// qryBtn.setEnabled(true);
}
//获取下载文件列表
private void getload(TCComponentDataset dataset){
private void getload(TCComponentDataset dataset,String path,List<String> list,String itemid){
try {
TCComponentTcFile[] file = dataset.getTcFiles();
if(file == null || file.length ==0){
MessageBox.post("数据集没有命名引用的文件,请检查!",
"WARNING",MessageBox.WARNING);
if(itemid.equals("sjj")) {
String noFileString=path+"_"+dataset.getStringProperty("object_name");
noFileList.add(noFileString);
}else {
AIFComponentContext[] itemRev = dataset.whereReferenced();
String items="";
for(AIFComponentContext context:itemRev) {
if(context.getComponent() instanceof TCComponentItemRevision) {
TCComponentItemRevision revision=(TCComponentItemRevision)context.getComponent();
items=revision.getStringProperty("item_id")+"_"+revision.getStringProperty("current_revision_id");
}
}
String noFileString=items+"_"+dataset.getStringProperty("object_name");
noFileList.add(noFileString);
}
return;
}else{
for(int i=0;i<file.length;i++){
@ -81,18 +121,24 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
continue;
}
//获取后缀名
String hzm = file[i].getTCProperty("file_ext").getStringValue();
hzm = file[i].getTCProperty("file_ext").getStringValue();
//获取文件名(带后缀)
if(list.contains(hzm)) {
String name = file[i].getTCProperty("original_file_name").getStringValue();
if(name.contains(".")){
//获取文件名(不带后缀)
name = name.substring(0, name.lastIndexOf("."));
}
String replace = name.replace("/", "-").replace("<", "-").
replace(">", "-").replace(":", "-").replace("|","-").
replace("\\","-").replace("*","-").replace("?","-");
//获取文件用户下载
File fmsFile = file[i].getFmsFile();
hzmlist.add(hzm);
namelist.add(name);
namelist.add(path+File.separator+replace);
fmsFilelist.add(fmsFile);
fileSize=fileSize+fmsFile.length();
}
}
}
} catch (TCException e) {
@ -102,10 +148,40 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
}
}
//获取文件后缀名
// private void gethzm(TCComponentDataset dataset) {
// try {
// //获取文件数组
// TCComponentTcFile[] file = dataset.getTcFiles();
// //判断数据集有没有命名引用的文件
// if(file == null || file.length ==0){
// MessageBox.post("数据集没有命名引用的文件,请检查!",
// "WARNING",MessageBox.WARNING);
// return;
// }else{
// //遍历循环文件数组
// for(int i=0;i<file.length;i++){
// //判断文件类型不是"ImanFile"
// if(!file[i].getType().equals("ImanFile")){
// continue;
// }
// //获取后缀名
// hzm = file[i].getTCProperty("file_ext").getStringValue();
// }
// }
// }catch (TCException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// MessageBox.post("发生错误:"+e.getMessage(),"错误",MessageBox.ERROR);
// }
// }
//文件下载到指定路径
private void downloadfile(String fpath){
try{
long hasReadByte = 0L;// 已经读取的字节个数
float result;
int progressSize = 0;
for(int i=0;i<hzmlist.size();i++){
//拼接输出文件名
String filename = namelist.get(i)+"."+hzmlist.get(i);
@ -119,11 +195,21 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
int len = 0;
while((len=fis.read(bs))!=-1){
fos.write(bs, 0, len);
hasReadByte = hasReadByte + len;
result = (float) ((double) hasReadByte / fileSize);
progressSize = Math.round(result * 100);
updateProgress(bar, progressSize);
}
if (progressSize <100) {
updateProgress(bar, progressSize);
}
if(progressSize==100) {
bar.setForeground(Color.blue);
}
if(fos!=null) fos.close();
if(fis!=null) fis.close();
}
MessageBox.post("下载成功","成功",MessageBox.INFORMATION);
}catch(Exception e){
e.printStackTrace();
MessageBox.post("下载失败:"+e.getMessage(),"错误",MessageBox.ERROR);
@ -131,6 +217,8 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
try {
fos.close();
fis.close();
MessageBox.post("下载完成","2",2);
this.dispose();
} catch (IOException e) {
// TODO Auto-generated catch block
@ -153,19 +241,54 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
//界面初始化
private void init(){
this.setLayout(new PropertyLayout());
this.setPreferredSize(new Dimension(550, 150));
this.setPreferredSize(new Dimension(650, 300));
FileSystemView fsv = FileSystemView.getFileSystemView();
String deskPath = fsv.getHomeDirectory().getPath();
//第一行:图纸类型
btnPanel1 = new JPanel();
JLabel drawingtype = new JLabel("图纸类型:");
JCheckBox checkBox1 = new JCheckBox("DWG");
JCheckBox checkBox2 = new JCheckBox("PDF");
JCheckBox checkBox3 = new JCheckBox("STP");
btnPanel1.add(checkBox1);
btnPanel1.add(checkBox2);
btnPanel1.add(checkBox3);
JCheckBox checkBox2 = new JCheckBox("idw");//new
JCheckBox checkBox3 = new JCheckBox("PDF");
JCheckBox checkBox4 = new JCheckBox("ipt");//new
JCheckBox checkBox5 = new JCheckBox("iam");//new
JCheckBox checkBox6 = new JCheckBox("STP");
JCheckBox checkBox7 = new JCheckBox("STEP");//new
//btnPanel1.add(drawingtype);
btnPanel1.add("1.1.left.top",drawingtype);
btnPanel1.add("1.2.left.top",checkBox1);
btnPanel1.add("1.3.left.top",checkBox2);
btnPanel1.add("1.4.left.top",checkBox3);
btnPanel1.add("1.5.left.top",checkBox4);
btnPanel1.add("1.6.left.top",checkBox5);
btnPanel1.add("1.7.left.top",checkBox6);
btnPanel1.add("1.8.left.top",checkBox7);
//第二行:零件类型
btnPanel2 = new JPanel();
JLabel itemtype = new JLabel("零件类型:");
JCheckBox checkBox11 = new JCheckBox("全部");
JCheckBox checkBox12 = new JCheckBox("外购件");
JCheckBox checkBox13 = new JCheckBox("外协件");
JCheckBox checkBox14 = new JCheckBox("虚拟件");
//btnPanel2.add(itemtype);
btnPanel2.add("1.1.left.top",itemtype);
btnPanel2.add("1.2.left.top",checkBox11);
btnPanel2.add("1.3.left.top",checkBox12);
btnPanel2.add("1.4.left.top",checkBox13);
btnPanel2.add("1.5.left.top",checkBox14);
//第三行附加条件
btnPanel3 = new JPanel();
JLabel additional = new JLabel("附加筛选:");
JCheckBox checkBox21 = new JCheckBox("外协件/外购件打包下载");
JCheckBox checkBox22 = new JCheckBox("仅下载已发布图纸");
//btnPanel3.add(additional);
btnPanel3.add("1.1.left.top",additional);
btnPanel3.add("1.2.left.top",checkBox21);
btnPanel3.add("1.3.left.top",checkBox22);
//第四行下载选项
jLabel = new JLabel("下载路径:");
jtf.setText(deskPath);
jButton = new JButton("...");
jButton = new JButton("浏览");
jFileChooser = new JFileChooser();
this.jFileChooser.setCurrentDirectory(new File(deskPath));
this.jFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
@ -176,7 +299,12 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
panel.add("2.1.left.top",okBut);
panel.add("2.2.left.top",celBut);
this.add("1.1.left.top",btnPanel1);
this.add("2.1.left.top",panel);
// this.add("2.1.left.top",itemtype);
this.add("2.1.left.top",btnPanel2);
// this.add("3.1.left.top",additional);
this.add("3.1.left.top",btnPanel3);
this.add("4.1.left.top",panel);
// this.add("5.1.left.top",paneljdt);
this.setResizable(false);
this.setBounds(5, 5, 5, 5);
this.centerToScreen();
@ -191,16 +319,106 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
okBut.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
datasetList.add("DWG");
datasetList.add("Tofflon_DWG");
datasetList.add("T2_DWG");
datasetList.add("AIDrawing");
datasetList.add("PDF");
datasetList.add("AIPart");
datasetList.add("AIAssembly");
datasetList.add("TAI2_TCAI115_AISTEP");
datasetList.add("TAI2_TCAI115_AISTEP");
Component[] jcbs = btnPanel2.getComponents();//将勾选的内容存入数组
Boolean btnpa2=false;
for(Component component : jcbs) {
if(component instanceof JCheckBox) {
JCheckBox checkBox=(JCheckBox)component;
if(checkBox.isSelected()) {
btnpa2=true;
}
}
}
Component[] jcbs2 = btnPanel1.getComponents();//将勾选的内容存入数组
Boolean btnpa1=false;
for(Component component : jcbs2) {
if(component instanceof JCheckBox) {
JCheckBox checkBox=(JCheckBox)component;
if(checkBox.isSelected()) {
btnpa1=true;
}
}
}
if(!btnpa1) {
MessageBox.post("请选择图纸类型","提示",2);
}
Boolean ljlxno=false;
for(int t=0;t<targets.length;t++) {
if(targets[t] instanceof TCComponentDataset) {
}else {
ljlxno=true;
}
}
if(!btnpa2 && ljlxno) {
MessageBox.post("请选择零件类型","提示",2);
}
// TODO Auto-generated method stub
if((btnpa2||!ljlxno)&&btnpa1) {
getTypes();
if(fmsFilelist.size()!=0) {
System.out.print("开始下载");
String fpath = jtf.getText();
final String fpath = jtf.getText();
if(fpath != null && (!fpath.trim().equals(""))){
// ProgressBarThread wait = new ProgressBarThread("下载", "下载中。。。");
// wait.start();
new Thread(new Runnable() {
@Override
public void run() {
JDialog dialog = new JDialog();
bar=new JProgressBar(0,100);
Container contentPane = dialog.getContentPane();
contentPane.setLayout(new GridLayout(2, 1));
JTextField text=new JTextField("下载中");
contentPane.add("1.1.center.top", text);
contentPane.add("2.1.center.top", bar);
dialog.setSize(300, 100);
dialog.setVisible(true);
dialog.setLocationRelativeTo(dialog.getParent());
downloadfile(fpath);
setVisible(false);
dialog.setVisible(false);
}
}).start();
// wait.setBool(true);// 关闭进度条
// wait.interrupt();
}else{
MessageBox.post("文件路径不能为空!", "警告", MessageBox.INFORMATION);
}
} else {
MessageBox.post("没有找到符合条件的图纸","提示",2);
}
if(noFileList.size()!=0) {
OutputStreamWriter outputStreamWriter;
try {
outputStreamWriter = new OutputStreamWriter(new FileOutputStream(pathString+File.separator+"部分数据集没有命名的引用.txt"));
BufferedWriter bWriter = new BufferedWriter(outputStreamWriter);
for(String liString:noFileList) {
bWriter.write(liString);
bWriter.newLine();
}
bWriter.close();
outputStreamWriter.close();
if(Desktop.isDesktopSupported()){
File worksheet = new File(pathString+File.separator+"部分数据集没有命名的引用.txt");
Desktop.getDesktop().open(worksheet); // or Desktop.getDesktop().edit(worksheet);
}
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
}
}
});
celBut.addActionListener(new ActionListener() {
@ -215,86 +433,291 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
this.centerToScreen();
this.showDialog();
}
//获取图纸类型
public void getTypes() {
List<String> list = new ArrayList<String>();
Component[] jcbs = btnPanel1.getComponents();//将勾选的内容存入数组
for(Component component : jcbs) {
if(component instanceof JCheckBox) {
JCheckBox jcb = (JCheckBox) component;
if(jcb.isSelected()) {
list.add(jcb.getText());
if("DWG".equals(jcb.getText())) {
list.add("T2_DWG");
list.add("DWG");
list.add("dwg");
}else if ("STP".equals(jcb.getText())) {
list.add("TAI2_TCAI115_AISTEP");
list.add("stp");
}else if("PDF".equals(jcb.getText())) {
list.add("pdf");
list.add("PDF");
}else if("idw".equals(jcb.getText())) {
list.add("idw");
}else if ("ipt".equals(jcb.getText())) {
list.add("ipt");
}else if ("iam".equals(jcb.getText())) {
list.add("iam");
}else if ("STEP".equals(jcb.getText())) {
list.add("STEP");
list.add("step");
}
}
}
if(list.size() <= 0) {
list.add("T2_DWG");
list.add("PDF");
list.add("TAI2_TCAI115_AISTEP");
}
try {
for (int i = 0; i < targets.length; i++) {
if(targets[i] instanceof TCComponentBOMLine){
List<String> itemlist = new ArrayList<String>();
//执行获取零件类型的方法
itemlist = getitemType();
//定义bom行
TCComponentBOMLine line = (TCComponentBOMLine) targets[i];
TCComponentItemRevision rev = line.getItemRevision();
String objName= rev.getStringProperty("object_name");
String replace = objName.replace("/", "-").replace("<", "-").
replace(">", "-").replace(":", "-").replace("|","-").
replace("\\","-").replace("*","-").replace("?","-");
String revtype = rev.getType();
String dataDir2 =jtf.getText()+File.separator+rev.getStringProperty("item_id")+"_"+
rev.getStringProperty("current_revision_id")+"_"+replace;//创建版本文件夹
File csFile=new File(dataDir2);
//数据版本创建自己的文件夹
String dataName = rev.getStringProperty("item_id")+"_"+ rev.getStringProperty("current_revision_id")+
"_"+replace;//文件名
pathString=dataDir2;
if(!csFile.exists()) {
csFile.mkdir();
}
System.out.println("cs"+rev.toString()+list.get(0));
String dataName2="";
//遍历视图 去找符合条件的 文件夹已经创建
getOutPart(rev,dataName,list);
String dataDir3 =jtf.getText()+File.separator+rev.getStringProperty("item_id")+"_"+
rev.getStringProperty("current_revision_id")+"_"+replace+File.separator+rev.getStringProperty("item_id")+"_"+
rev.getStringProperty("current_revision_id")+"_"+replace;//创建版本文件夹总成
File csFile2=new File(dataDir3);
if(!csFile2.exists()) {
csFile2.mkdir();
}
dataName2=dataName+File.separator+rev.getStringProperty("item_id")+"_"+ rev.getStringProperty("current_revision_id")+
"_"+replace;
TCComponent[] datasets = rev.getReferenceListProperty("IMAN_specification");
TCComponent[] datasets2 = rev.getReferenceListProperty("IMAN_Rendering");
for (int j = 0; j < datasets.length; j++) {
String type = datasets[j].getType();
if(list.contains(type)) {
TCComponentDataset dataset = (TCComponentDataset) datasets[j];
getload(dataset);
//获取数据集数组
TCComponentDataset dataset01 = null;
if(datasets[j] instanceof TCComponentDataset) {
dataset01 = (TCComponentDataset) datasets[j];
}else {
continue;
}
//执行获取后缀名的方法
// gethzm(dataset01);
//执行获取零件类型的方法
String type = dataset01.getType();
//判断list包含hzm字符串的值 且 itemlist包含revtype的值
if(itemlist.contains(revtype)||allCheck) {
if(datasetList.contains(type)) {
//获取数据集数据
TCComponentDataset dataset02 = (TCComponentDataset) datasets[j];
//执行getload方法
getload(dataset02,dataName,list,rev.getStringProperty("item_id"));
getload(dataset02,dataName2,list,rev.getStringProperty("item_id"));
}
}
}
for (int j = 0; j < datasets2.length; j++) {
String type = datasets2[j].getType();
if(list.contains(type)) {
//获取数据集数组
TCComponentDataset dataset02 = null;
if(datasets2[j] instanceof TCComponentDataset) {
dataset02 = (TCComponentDataset) datasets2[j];
}else {
continue;
}
//执行获取后缀名的方法
// gethzm(dataset02);
String type = dataset02.getType();
//判断是否为所需要的零件类型
if(itemlist.contains(revtype)||allCheck) {
if(datasetList.contains(type)) {
TCComponentDataset dataset = (TCComponentDataset) datasets2[j];
getload(dataset);
getload(dataset,dataName,list,rev.getStringProperty("item_id"));
getload(dataset,dataName2,list,rev.getStringProperty("item_id"));
}
}
}
}else if(targets[i] instanceof TCComponentItemRevision){
}
else if(targets[i] instanceof TCComponentItemRevision){
List<String> itemlist = new ArrayList<String>();
//执行获取零件类型的方法
itemlist = getitemType();
TCComponentItemRevision rev = (TCComponentItemRevision) targets[i];
String revtype = rev.getType();
String objName= rev.getStringProperty("object_name");
String replace = objName.replace("/", "-").replace("<", "-").
replace(">", "-").replace(":", "-").replace("|","-").
replace("\\","-").replace("*","-").replace("?","-");
String dataDir =jtf.getText()+File.separator+rev.getStringProperty("item_id")+"_"+
rev.getStringProperty("current_revision_id")+"_"+replace;//创建版本文件夹
File csFile=new File(dataDir);
//数据版本创建自己的文件夹
String dataName =rev.getStringProperty("item_id")+"_"+
rev.getStringProperty("current_revision_id")+"_"+replace;//文件名
String dataName2="";
pathString=dataDir;
if(!csFile.exists()) {
csFile.mkdir();
}
//遍历视图 去找符合条件的 文件夹已经创建
getOutPart(rev,dataName,list);
String dataDir3 =jtf.getText()+File.separator+rev.getStringProperty("item_id")+"_"+
rev.getStringProperty("current_revision_id")+"_"+replace+File.separator+rev.getStringProperty("item_id")+"_"+
rev.getStringProperty("current_revision_id")+"_"+replace;//创建版本文件夹总成
File csFile2=new File(dataDir3);
if(!csFile2.exists()) {
csFile2.mkdir();
}
dataName2 =dataName+File.separator+rev.getStringProperty("item_id")+"_"+
rev.getStringProperty("current_revision_id")+"_"+replace;//文件名
TCComponent[] datasets = rev.getReferenceListProperty("IMAN_specification");
TCComponent[] datasets2 = rev.getReferenceListProperty("IMAN_Rendering");
for (int j = 0; j < datasets.length; j++) {
String type = datasets[j].getType();
if(list.contains(type)) {
//获取数据集数组
TCComponentDataset dataset02 = null;
if(datasets[j] instanceof TCComponentDataset) {
dataset02 = (TCComponentDataset) datasets[j];
}else {
continue;
}
//执行获取后缀名的方法
// gethzm(dataset02);
String type = dataset02.getType();
//判断零件类型
if(itemlist.contains(revtype)||allCheck) {
if(datasetList.contains(type)) {
TCComponentDataset dataset = (TCComponentDataset) datasets[j];
System.out.println("下载文件");
getload(dataset);
getload(dataset,dataName,list,rev.getStringProperty("item_id"));
getload(dataset,dataName2,list,rev.getStringProperty("item_id"));
}
}
}
for (int j = 0; j < datasets2.length; j++) {
String type = datasets2[j].getType();
if(list.contains(type)) {
//获取数据集数组
TCComponentDataset dataset02 = null;
if(datasets2[j] instanceof TCComponentDataset) {
dataset02 = (TCComponentDataset) datasets2[j];
}else {
continue;
}
//执行获取后缀名的方法
// gethzm(dataset02);
String type = dataset02.getType();
//判断零件类型
if (itemlist.contains(revtype)||allCheck) {
if(datasetList.contains(type)) {
TCComponentDataset dataset = (TCComponentDataset) datasets2[j];
getload(dataset);
getload(dataset,dataName,list,rev.getStringProperty("item_id"));
getload(dataset,dataName2,list,rev.getStringProperty("item_id"));
}
}
}
}else if(targets[i] instanceof TCComponentDataset) {
TCComponentDataset dataset = (TCComponentDataset) targets[i];
getload(dataset);
String dataName="";
String objName = dataset.getStringProperty("object_name");
String replaceName = objName.replace("/", "-").replace("<", "-").
replace(">", "-").replace(":", "-").replace("|","-").
replace("\\","-").replace("*","-").replace("?","-");
if(iDataset==0) {
dataName=jtf.getText()+File.separator+replaceName;
datasetDir=replaceName;
pathString=dataName;
File csFile=new File(dataName);
if(!csFile.exists()) {
csFile.mkdir();
}
}
iDataset=1;
String type = dataset.getType();
// gethzm(dataset);
if(datasetList.contains(type)) {
getload(dataset,datasetDir,list,"sjj");
}
}else if(targets[i] instanceof TCComponentItem){
List<String> itemlist = new ArrayList<String>();
//执行获取零件类型的方法
itemlist = getitemType();
TCComponentItem item = (TCComponentItem) targets[i];
// item.getReleasedItemRevisions();
TCComponentItemRevision rev = item.getLatestItemRevision();
String revtype = rev.getType();
String objName= rev.getStringProperty("object_name");
String replace = objName.replace("/", "-").replace("<", "-").
replace(">", "-").replace(":", "-").replace("|","-").
replace("\\","-").replace("*","-").replace("?","-");
String dataDir2 =jtf.getText()+File.separator+rev.getStringProperty("item_id")+"_"+
rev.getStringProperty("current_revision_id")+"_"+replace;//创建版本文件夹
File csFile=new File(dataDir2);
//数据版本创建自己的文件夹
String dataName = rev.getStringProperty("item_id")+"_"+
rev.getStringProperty("current_revision_id")+"_"+replace;//文件名
pathString=dataDir2;
if(!csFile.exists()) {
csFile.mkdir();
}
String dataName2="";
//遍历视图 去找符合条件的 文件夹已经创建
getOutPart(rev,dataName,list);
String dataDir3 =jtf.getText()+File.separator+rev.getStringProperty("item_id")+"_"+
rev.getStringProperty("current_revision_id")+"_"+replace+File.separator+rev.getStringProperty("item_id")+"_"+
rev.getStringProperty("current_revision_id")+"_"+replace;//创建版本文件夹总成
File csFile2=new File(dataDir3);
if(!csFile2.exists()) {
csFile2.mkdir();
}
dataName2 =dataName+File.separator+rev.getStringProperty("item_id")+"_"+
rev.getStringProperty("current_revision_id")+"_"+replace;//文件名
TCComponent[] datasets = rev.getReferenceListProperty("IMAN_specification");
TCComponent[] datasets2 = rev.getReferenceListProperty("IMAN_Rendering");
for (int j = 0; j < datasets.length; j++) {
String type = datasets[j].getType();
if(list.contains(type)) {
//获取数据集数组
TCComponentDataset dataset02 = null;
if(datasets[j] instanceof TCComponentDataset) {
dataset02 = (TCComponentDataset) datasets[j];
}else {
continue;
}
//执行获取后缀名的方法
String type = dataset02.getType();
// gethzm(dataset02);
if(itemlist.contains(revtype)||allCheck) {
if(datasetList.contains(type)) {
TCComponentDataset dataset = (TCComponentDataset) datasets[j];
getload(dataset);
getload(dataset,dataName,list,rev.getStringProperty("item_id"));
getload(dataset,dataName2,list,rev.getStringProperty("item_id"));
}
}
}
for (int j = 0; j < datasets2.length; j++) {
String type = datasets2[j].getType();
if(list.contains(type)) {
//获取数据集数组
TCComponentDataset dataset02 = null;
if(datasets2[j] instanceof TCComponentDataset) {
dataset02 = (TCComponentDataset) datasets2[j];
}else {
continue;
}
//执行获取后缀名的方法
// gethzm(dataset02);
String type = dataset02.getType();
if(itemlist.contains(revtype)||allCheck) {
if(datasetList.contains(type)) {
TCComponentDataset dataset = (TCComponentDataset) datasets2[j];
getload(dataset);
getload(dataset, dataName,list,rev.getStringProperty("item_id"));
getload(dataset, dataName2,list,rev.getStringProperty("item_id"));
}
}
}
}else {
@ -304,7 +727,261 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
}
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
}
//获取零件类型
public List<String> getitemType() {
List<String> itemlist = new ArrayList<String>();
Component[] jcbs = btnPanel2.getComponents();//将勾选的内容存入数组
//遍历勾选的内容
for(Component component : jcbs) {
if(component instanceof JCheckBox) {
JCheckBox jcb = (JCheckBox) component;
//判断元素是否被选中
if(jcb.isSelected()) {
itemlist.add(jcb.getText());
itemlist.add(jcb.getText());
if("全部".equals(jcb.getText())) {
allCheck=true;
itemlist.add("T2_VirtualRevision");
itemlist.add("T2_OutBuyPartRevision");
itemlist.add("T2_outsourceRevision");
itemlist.add("T2_EquipmentRevision");
}else if ("外协件".equals(jcb.getText())) {
itemlist.add("T2_outsourceRevision");
}else if ("外购件".equals(jcb.getText())) {
itemlist.add("T2_OutBuyPartRevision");
}else if ("虚拟件".equals(jcb.getText())) {
itemlist.add("T2_VirtualRevision");
}
}
}
}
return itemlist;
}
public void getOutPart(TCComponentItemRevision rev ,String dir,List<String> list) throws TCException {
//设备获取完成了 获取子键 全部 全获取 外购 判断当前 外购子键不判断
TCComponentItem item = rev.getItem();
List<String> itemlist = new ArrayList<String>();
//执行获取零件类型的方法
itemlist = getitemType();
Boolean sxTj = getSxTj();
TCComponentBOMWindowType winType = (TCComponentBOMWindowType) session.getTypeService()
.getTypeComponent("BOMWindow");
TCComponentRevisionRule[] listAllRules = TCComponentRevisionRule.listAllRules(session);
TCComponentBOMWindow window = winType.create(null);
for(TCComponentRevisionRule rule:listAllRules) {
if(sxTj&&rule.toString().equals("Precise;Any Status;Latest Working")) {
window.setRevisionRule(rule);
}else if (!sxTj&&rule.toString().equals("Latest Working")) {
window.setRevisionRule(rule);
}
}
window.lock();
TCComponentBOMLine topLine = window.setWindowTopLine(
item, rev, null, null);
AIFComponentContext[] children2=new AIFComponentContext[4096];
children2=topLine.getChildren();
// AIFComponentContext[] children = topLine.getChildren();
for(int i=0;i<children2.length;i++) {
TCComponentBOMLine line=(TCComponentBOMLine)children2[i].getComponent();
getOutPartInBom(line,sxTj,0,itemlist,dir,list,0,dir);
}
// for(AIFComponentContext context:children2) {
// TCComponentBOMLine line=(TCComponentBOMLine)context.getComponent();
// //判断发布 版本规则 判断
//// TCComponentItemRevision revision = line.getItemRevision();
//// if(itemlist.contains(revision.getType())||allCheck) {//外协外购虚拟
// getOutPartInBom(line,sxTj,0,itemlist,dir,list,0,dir); //不论什么类型父级都要遍历下面所有的 选择的类型
//// }
// }
window.save();
window.unlock();
window.close();
}
// public TCComponentItemRevision findLatesStatus(TCComponentItemRevision rev) {
// TCComponentItemRevision latestRev=rev;
// try {
// TCComponentItem item = rev.getItem();
// TCComponent[] revList = item.getReferenceListProperty("revision_list");
// List<TCComponentItemRevision> listRev=new ArrayList<TCComponentItemRevision>();
// for(TCComponent revs:revList) {
// TCComponentItemRevision revision=(TCComponentItemRevision)revs;
// TCComponent[] status = revision.getReferenceListProperty("release_status_list");
// if(status.length!=0) {
// if(status[0].toString().equals("TCM 已发布")) {
// listRev.add(revision);
// }
// }
// }
//
// if(listRev.size()!=0) {
// latestRev=listRev.get(0);
// Date newDate=latestRev.getDateProperty("creation_date");
// for(TCComponentItemRevision revision:listRev) {
// Date date = revision.getDateProperty("creation_date");
// int datei = newDate.compareTo(date);
// if(datei<0) {
// newDate=date;
// latestRev=revision;
// }
// }
// }
// } catch (TCException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
// return latestRev;
// }
//遍历bom视图找出所有外协件 外购件 i判断是不是第一层外协外购
public void getOutPartInBom(TCComponentBOMLine bomLine,Boolean sxtj,int i,List<String> itemList,
String dir,List<String> list,int bomNum,String dirFs) throws TCException {
TCComponentItemRevision rev = bomLine.getItemRevision();
// if(sxtj) {
// rev=findLatesStatus(rev);
// }
String dirTop=dir;
// String revtype = rev.getStringProperty("object_type");
String revtype= rev.getType();//真实值
if((itemList.contains(revtype)&&bomNum==0)||allCheck||bomNum==1) {
Boolean l=revtype.equals("T2_OutBuyPartRevision")||revtype.equals("T2_outsourceRevision")||revtype.equals("ItemRevision");
if(outPartBool&&l) {
String dirString=jtf.getText()+File.separator+dir+File.separator+rev.getStringProperty("item_id")+"_"+
rev.getStringProperty("current_revision_id")+"_"+rev.getStringProperty("object_name");
dir=dir+File.separator+rev.getStringProperty("item_id")+"_"+
rev.getStringProperty("current_revision_id")+"_"+rev.getStringProperty("object_name");
dirTop=dir;
File csFile=new File(dirString);
if(!csFile.exists()) {
csFile.mkdir();
}
if(bomLine.getChildren().length!=0) {
dirString=dirString+File.separator+rev.getStringProperty("item_id")+"_"+
rev.getStringProperty("current_revision_id")+"_"+rev.getStringProperty("object_name");
dir=dir+File.separator+rev.getStringProperty("item_id")+"_"+
rev.getStringProperty("current_revision_id")+"_"+rev.getStringProperty("object_name");
File csFile2=new File(dirString);
if(!csFile2.exists()) {
csFile2.mkdir();
}
}
if(i==0 ) {
pathMap.put("1", dir);
if(bomLine.getChildren().length!=0) {
dirString=dirString+File.separator+rev.getStringProperty("item_id")+"_"+
rev.getStringProperty("current_revision_id")+"_"+rev.getStringProperty("object_name");
File csFile3=new File(dirString);
if(!csFile3.exists()) {
csFile3.mkdir();
}
dir=dir+File.separator+rev.getStringProperty("item_id")+"_"+
rev.getStringProperty("current_revision_id")+"_"+rev.getStringProperty("object_name");
}
}i++;
}
TCComponent[] datasets = rev.getReferenceListProperty("IMAN_specification");
TCComponent[] datasets2 = rev.getReferenceListProperty("IMAN_Rendering");
for (int j = 0; j < datasets.length; j++) {
//获取数据集数组
TCComponentDataset dataset01=null;
if(datasets[j] instanceof TCComponentDataset) {
dataset01 = (TCComponentDataset) datasets[j];
}
else {
continue;
}
// TCComponentDataset dataset01 = (TCComponentDataset) datasets[j];
//执行获取后缀名的方法
// gethzm(dataset01);
//执行获取零件类型的方法
String type = dataset01.getStringProperty("object_type");
//判断list包含hzm字符串的值 且 itemlist包含revtype的值
if(datasetList.contains(type)) {
//获取数据集数据
TCComponentDataset dataset02 = null;
if(datasets[j] instanceof TCComponentDataset) {
dataset02 = (TCComponentDataset) datasets[j];
}else {
continue;
}
//执行getload方法
getload(dataset02,dir,list,rev.getStringProperty("item_id"));
//复制一份到父级
if(!dir.equals(dirFs)) {
getload(dataset02,dirFs,list,rev.getStringProperty("item_id"));
}
if(!dir.equals(pathMap.get("1"))&& pathMap.get("1")!=null) {
getload(dataset02,pathMap.get("1"),list,rev.getStringProperty("item_id"));
}
}
}
for (int j = 0; j < datasets2.length; j++) {
//获取数据集数组
TCComponentDataset dataset02 = null;
if(datasets2[j] instanceof TCComponentDataset) {
dataset02 = (TCComponentDataset) datasets2[j];
}else {
continue;
}
//执行获取后缀名的方法
// gethzm(dataset02);
//判断是否为所需要的零件类型
String type = dataset02.getStringProperty("object_type");
if(datasetList.contains(type)) {
TCComponentDataset dataset = (TCComponentDataset) datasets2[j];
getload(dataset,dir,list,rev.getStringProperty("item_id"));
if(!dir.equals(dirFs)) {
getload(dataset,dirFs,list,rev.getStringProperty("item_id"));
}
if(!dir.equals(pathMap.get("1"))) {
getload(dataset02,pathMap.get("1"),list,rev.getStringProperty("item_id"));
}
}
}
AIFComponentContext[] children = bomLine.getChildren();
for(AIFComponentContext context:children) {
TCComponentBOMLine line=(TCComponentBOMLine)context.getComponent();
getOutPartInBom(line,sxtj,i,itemList,dirTop,list,1,dirFs);
}
} else {
AIFComponentContext[] children = bomLine.getChildren();
for(AIFComponentContext context:children) {
TCComponentBOMLine line=(TCComponentBOMLine)context.getComponent();
getOutPartInBom(line,sxtj,0,itemList,dirTop,list,0,dirFs);
}
}
}
private static void updateProgress(JProgressBar copyProgressBar, int progressSize) {
copyProgressBar.setString(progressSize + "%");
copyProgressBar.setValue(progressSize);
}
public Boolean getSxTj(){
List<String> tjlist = new ArrayList<String>();
Boolean statusBool=false;
Component[] jcbs = btnPanel3.getComponents();
for(Component component:jcbs) {
if(component instanceof JCheckBox) {
JCheckBox jcb = (JCheckBox) component;
if(jcb.isSelected()) {
tjlist.add(jcb.getText());
}
}
}
for(String s:tjlist) {
if(s.equals("仅下载已发布图纸")) {
statusBool=true;
}
if(s.equals("外协件/外购件打包下载")) {
outPartBool=true;
}
}
return statusBool;
}
}

@ -95,14 +95,14 @@ public class Dfl032Dialog extends AbstractAIFDialog{
@Override
public void run() {
ParseXMLUtil xml=new ParseXMLUtil();
File file=xml.getSXX("DFL_CLASS_Xml", session);
attrList =xml.parseXMLCode(file);
if(attrList == null || attrList.size() <= 0) {
MessageBox.post("首选项DFL_CLASS_Xml未配置请检查", "WARNING",
MessageBox.WARNING);
return;
}
// ParseXMLUtil xml=new ParseXMLUtil();
// File file=xml.getSXX("DFL_CLASS_Xml", session);
// attrList =xml.parseXMLCode(file);
// if(attrList == null || attrList.size() <= 0) {
// MessageBox.post("首选项DFL_CLASS_Xml未配置请检查", "WARNING",
// MessageBox.WARNING);
// return;
// }
InterfaceAIFComponent comp = app.getTargetComponent();
String compType = comp.getType();
System.out.println("compType=============="+compType);
@ -381,19 +381,19 @@ public class Dfl032Dialog extends AbstractAIFDialog{
classPropList.add(bean);
}
}
for (int i = 0; i < attrList.size(); i++) {
String classValue = attrList.get(i);
if(classValue.contains(";")) {
String[] classValues = classValue.split(";");
if(c.getId().equals(classValues[0])) {
attrName = new String [classValues.length -1];
for (int j = 0; j < attrName.length; j++) {
attrName[j] = classValues[j+1];
}
break;
}
}
}
// for (int i = 0; i < attrList.size(); i++) {
// String classValue = attrList.get(i);
// if(classValue.contains(";")) {
// String[] classValues = classValue.split(";");
// if(c.getId().equals(classValues[0])) {
// attrName = new String [classValues.length -1];
// for (int j = 0; j < attrName.length; j++) {
// attrName[j] = classValues[j+1];
// }
// break;
// }
// }
// }
String[] columnNames = new String[icsAttrS.length + 3];
columnNames[0] = "序号";
columnNames[1] = "品号";
@ -448,18 +448,18 @@ public class Dfl032Dialog extends AbstractAIFDialog{
model.setDataVector(cellData, columnNames);
//DefaultTableCellRenderer类可以绘制单元格的背景、字体颜色等功能
DefaultTableCellRenderer backGroundColor = new DefaultTableCellRenderer();
// DefaultTableCellRenderer backGroundColor = new DefaultTableCellRenderer();
//绘制部门列的背景为黄色
backGroundColor.setBackground(Color.yellow);
if(attrName != null && attrName.length > 0) {
for (int i = 0; i < attrName.length; i++) {
List<String> colList = Arrays.asList(columnNames);
if(colList.contains(attrName[i])) {
TableColumn tableColumn = qryTable.getColumn(attrName[i]);
tableColumn.setCellRenderer(backGroundColor);
}
}
}
// backGroundColor.setBackground(Color.yellow);
// if(attrName != null && attrName.length > 0) {
// for (int i = 0; i < attrName.length; i++) {
// List<String> colList = Arrays.asList(columnNames);
// if(colList.contains(attrName[i])) {
// TableColumn tableColumn = qryTable.getColumn(attrName[i]);
// tableColumn.setCellRenderer(backGroundColor);
// }
// }
// }
qryTable.getColumnModel().getColumn(0).setPreferredWidth(10);
qryTable.setDefaultRenderer(Object.class, new TableCellTextAreaRenderer());
JScrollPane scrollPane=new JScrollPane(qryTable);

@ -61,10 +61,12 @@ import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.jacorb.idl.runtime.int_token;
//import com.connor.dfl.plm.dfl038.MyComparator;
import com.connor.dfl.plm.util.DataBaseControl;
import com.connor.dfl.plm.util.ProgressBar;
import com.connor.dfl.plm.util.ProgressBarThread;
import com.lowagie.text.Row;
//import com.sun.javafx.image.IntPixelAccessor;
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentQuery;
@ -142,7 +144,7 @@ public class DFL038Jframe extends JFrame {
private JButton cancelButton;
private JPanel centerPanel1;
private String[] title = new String[] { "产品部门", "产品名称", "变更通知单号", "产品型号", "客户名称", "更改类型", "更改原因", "图纸更改类型", "责任部门",
private String[] title = new String[] { "产品部门", "产品名称", "变更通知单号", "产品型号", "客户名称", "申请人","更改类型", "更改原因", "图纸更改类型", "责任部门",
"责任人", "品号", "品名", "原版本", "现版本", "变更数量", "产品类型", "错误类型", "价格预告", "销售分类", "是否产生成本损失", "项目阶段", "料件领用分类",
"图纸发至", "项目编号", "通知紧急程度", "申请时间", "账套", "流程阶段" };
@ -480,7 +482,7 @@ public class DFL038Jframe extends JFrame {
"jdbc:oracle:thin:@192.168.1.138:1521/tc12", "infodba", "infodba");
control.openDataBase();
String colString = " F.PRODUCTDEPARTMENT,F.PRODUCTNAME,F.CHANGELISTCODE,F.PROJECTMODEL,F.CLIENTNAME,F.CHANGETYPE,F.CHANGEREASON,F.TZGGLX,F.DUTYDEPARTMENT,F.DUTYMAN,D.PH,D.PM,D.YBB,D.XBB,D.BGSL,F.PRODUCTTYPE,F.ERRORTYPE,F.PRICEBOOKING,F.SALSECLASSIFY,F.ISNOTPRODUCTLOSS,F.XMJD,F.RECEIVECLASSIFY,F.DRAWINGTO,F.PROJECTCODE,F.NOTIFYEMERGENCYPROCEDURES,F.APPLYDATE,F.ACCOUNTSET ";
String colString = " F.PRODUCTDEPARTMENT,F.PRODUCTNAME,F.CHANGELISTCODE,F.PROJECTMODEL,F.CLIENTNAME,F.APPLYNAME,F.CHANGETYPE,F.CHANGEREASON,F.TZGGLX,F.DUTYDEPARTMENT,F.DUTYMAN,D.PH,D.PM,D.YBB,D.XBB,D.BGSL,F.PRODUCTTYPE,F.ERRORTYPE,F.PRICEBOOKING,F.SALSECLASSIFY,F.ISNOTPRODUCTLOSS,F.XMJD,F.RECEIVECLASSIFY,F.DRAWINGTO,F.PROJECTCODE,F.NOTIFYEMERGENCYPROCEDURES,F.APPLYDATE,F.ACCOUNTSET ";
// 获取需要判断的列
@ -491,21 +493,24 @@ public class DFL038Jframe extends JFrame {
+ " F.APPLYDATE IS NOT NULL AND to_date(F.applydate,'yyyy-MM-dd HH24:mi:ss') >= to_date('"
+ startTime
+ "','yyyy-MM-dd HH24:mi:ss') AND to_date(F.applydate,'yyyy-MM-dd HH24:mi:ss') <= to_date('"
+ endTime + "','yyyy-MM-dd HH24:mi:ss') " + conditions+" order by F.PRODUCTDEPARTMENT,F.APPLYDATE";
+ endTime + "','yyyy-MM-dd HH24:mi:ss') " + conditions
+ " order by F.PRODUCTDEPARTMENT,F.APPLYDATE";
if (depart == null || depart.trim().equals("")) {
sql1 = "select " + colString + " from DFL_CHANGEFORM F LEFT OUTER JOIN DFL_CHANGEDETAILS D ON " + leftConditions
+ " (F.OBJECTCODE like'ECN%' or F.OBJECTCODE like'QECN%') " + " AND "
sql1 = "select " + colString + " from DFL_CHANGEFORM F LEFT OUTER JOIN DFL_CHANGEDETAILS D ON "
+ leftConditions + " (F.OBJECTCODE like'ECN%' or F.OBJECTCODE like'QECN%') " + " AND "
+ " F.APPLYDATE IS NOT NULL AND to_date(F.applydate,'yyyy-MM-dd HH24:mi:ss') >= to_date('"
+ startTime
+ "','yyyy-MM-dd HH24:mi:ss') AND to_date(F.applydate,'yyyy-MM-dd HH24:mi:ss') <= to_date('"
+ endTime + "','yyyy-MM-dd HH24:mi:ss') " + conditions+" order by F.PRODUCTDEPARTMENT,F.APPLYDATE";
+ endTime + "','yyyy-MM-dd HH24:mi:ss') " + conditions
+ " order by F.PRODUCTDEPARTMENT,F.APPLYDATE";
} else if (depart != null && "全部".equals(depart)) {
sql1 = "select " + colString + " from DFL_CHANGEFORM F LEFT OUTER JOIN DFL_CHANGEDETAILS D ON " + leftConditions
+ " (F.OBJECTCODE like'ECN%' or F.OBJECTCODE like'QECN%') " + " AND "
sql1 = "select " + colString + " from DFL_CHANGEFORM F LEFT OUTER JOIN DFL_CHANGEDETAILS D ON "
+ leftConditions + " (F.OBJECTCODE like'ECN%' or F.OBJECTCODE like'QECN%') " + " AND "
+ " F.APPLYDATE IS NOT NULL AND to_date(F.applydate,'yyyy-MM-dd HH24:mi:ss') >= to_date('"
+ startTime
+ "','yyyy-MM-dd HH24:mi:ss') AND to_date(F.applydate,'yyyy-MM-dd HH24:mi:ss') <= to_date('"
+ endTime + "','yyyy-MM-dd HH24:mi:ss') " + conditions+" order by F.PRODUCTDEPARTMENT,F.APPLYDATE";
+ endTime + "','yyyy-MM-dd HH24:mi:ss') " + conditions
+ " order by F.PRODUCTDEPARTMENT,F.APPLYDATE";
}
System.out.println(sql1);
@ -623,8 +628,11 @@ public class DFL038Jframe extends JFrame {
}
Set<String> set = new HashSet<String>();
int db2 = 0;
while (dbQuery2.next()) {
set.add(dbQuery2.getString(3));
db2++;
}
dbQuery2.first();
dbQuery2.previous();
@ -666,27 +674,16 @@ public class DFL038Jframe extends JFrame {
System.out.println(dbQuery2.getRow() + "--1--" + changeType.length);
int[][] CTN = new int[list.size()][changeType.length];
int[] countNum = null;
int countYear = 0;
String year = list.get(0).substring(0, 4);
int rowY = 0;
int lastRN = list.size() + 1;
int current = 0;
while (dbQuery2.next()) {
current++;
for (int j = 0; j < list.size(); j++) {
// System.out.println(year+"-----2------"+rows[j].getCell(0).getStringCellValue().substring(0,4));
// if(!year.equals(rows[j].getCell(0).getStringCellValue().substring(0,4))) {
// System.out.println(year);
// year = rows[j].getCell(0).getStringCellValue().substring(0,4);
// System.out.println("after"+year);
// XSSFRow row = sheet1.createRow(lastRN++);
// row.createCell(0).setCellValue("合计:");
// for(int o=0;o<changeType.length;o++) {
// row.createCell(o+1).setCellValue(CTN[j][o]);
// }
// row.createCell(changeType.length+1).setCellValue(getArrayCount(CTN[j]));
// sheet1.shiftRows(j, lastRN-1, 1, true, false);
// }
if (dbQuery2.getString(3).equals(list.get(j))) {
System.out.println(dbQuery2.getString(3));
for (int n = 0; n < changeType.length; n++) {
@ -696,87 +693,67 @@ public class DFL038Jframe extends JFrame {
createCell.setCellStyle(cellStyle);
createCell.setCellValue(dbQuery2.getString(1));
num[n] += Integer.parseInt(dbQuery2.getString(1));
if (!year.equals(rows[j].getCell(0).getStringCellValue().substring(0, 4))) {
System.out.println(list);
System.out.println(year);
XSSFRow row = sheet1.createRow(lastRN++);
XSSFCell cell = row.createCell(0);
cell.setCellStyle(cellStyle);
cell.setCellValue(year + "合计:");
year = rows[j].getCell(0).getStringCellValue().substring(0, 4);
System.out.println("after" + year);
for (int o = 0; o < changeType.length; o++) {
cell = row.createCell(o + 1);
cell.setCellStyle(cellStyle);
cell.setCellValue(CTN[j - 1][o]);
}
cell = row.createCell(changeType.length + 1);
cell.setCellStyle(cellStyle);
cell.setCellValue(getArrayCount(CTN[j - 1]));
countNum = arrayAdd(CTN[j - 1], countNum);
// sheet1.shiftRows(j, lastRN-1, 1, true, false);
}
}
}
for (int n = 0; n < changeType.length; n++) {
CTN[j][n] = num[n];
}
}
}
}
int lastYearDetail[] = null;
int yearNum=1;
for (int j = 0; j <=list.size(); j++) {
if(j==list.size()) {
sheet1.shiftRows(j+yearNum, lastRN++, 1, true, false);
XSSFRow row = sheet1.createRow(j+yearNum);
XSSFCell createCell2 = row.createCell(0);
createCell2.setCellStyle(cellStyle);
createCell2.setCellValue("合计:");
if(lastYearDetail ==null) {
for(int o=0;o<changeType.length;o++) {
XSSFCell createCell = row.createCell(o+1);
createCell.setCellStyle(cellStyle);
createCell.setCellValue(CTN[j-1][o]);
}
XSSFCell createCell = row.createCell(changeType.length+1);
createCell.setCellStyle(cellStyle);
createCell.setCellValue(getArrayCount(CTN[j-1]));
lastYearDetail = CTN[j-1];
}else {
if(current == db2) {
if(countNum!=null) {
XSSFRow row = sheet1.createRow(lastRN++);
XSSFCell cell = row.createCell(0);
cell.setCellStyle(cellStyle);
cell.setCellValue(list.get(list.size()-1).substring(0,4)+"合计:");
for (int o = 0; o < changeType.length; o++) {
XSSFCell createCell = row.createCell(o+1);
createCell.setCellStyle(cellStyle);
createCell.setCellValue(CTN[j-1][o]-lastYearDetail[o]);
}
XSSFCell createCell = row.createCell(changeType.length+1);
createCell.setCellStyle(cellStyle);
createCell.setCellValue(getArrayCount(CTN[j-1])-getArrayCount(lastYearDetail));
lastYearDetail = CTN[j-1];
cell = row.createCell(o + 1);
cell.setCellStyle(cellStyle);
System.out.println("cell=>"+(null==cell));
System.out.println("CTN[CTN.length-1]=>"+(null==CTN[CTN.length-1]));
System.out.println("CTN[CTN.length-1][o]=>"+CTN[CTN.length-1][o]);
System.out.println("countNum[o]=>"+countNum[o]);
cell.setCellValue(CTN[CTN.length-1][o]-countNum[o]);
}
yearNum++;
break;
cell = row.createCell(changeType.length + 1);
cell.setCellStyle(cellStyle);
cell.setCellValue(getArrayCount(CTN[CTN.length-1])-getArrayCount(countNum));
}
// System.out.println(year+"-----2------"+rows[j].getCell(0).getStringCellValue().substring(0,4));
if(!year.equals(rows[j].getCell(0).getStringCellValue().substring(0,4))) {
System.out.println(year);
year = rows[j].getCell(0).getStringCellValue().substring(0,4);
System.out.println("after"+year);
sheet1.shiftRows(j+1, lastRN++, 1, true, false);
XSSFRow row = sheet1.createRow(j+1);
XSSFCell createCell2 = row.createCell(0);
createCell2.setCellStyle(cellStyle);
createCell2.setCellValue("合计:");
if(lastYearDetail ==null) {
for(int o=0;o<changeType.length;o++) {
XSSFCell createCell = row.createCell(o+1);
createCell.setCellStyle(cellStyle);
createCell.setCellValue(CTN[j][o]);
}
XSSFCell createCell = row.createCell(changeType.length+1);
createCell.setCellStyle(cellStyle);
createCell.setCellValue(getArrayCount(CTN[j]));
lastYearDetail = CTN[j];
}else {
XSSFRow row = sheet1.createRow(lastRN++);
XSSFCell cell = row.createCell(0);
cell.setCellStyle(cellStyle);
cell.setCellValue("合计:");
for (int o = 0; o < changeType.length; o++) {
XSSFCell createCell = row.createCell(o+1);
createCell.setCellStyle(cellStyle);
createCell.setCellValue(CTN[j][o]-lastYearDetail[o]);
}
XSSFCell createCell = row.createCell(changeType.length+1);
createCell.setCellStyle(cellStyle);
createCell.setCellValue(getArrayCount(CTN[j])-getArrayCount(lastYearDetail));
lastYearDetail = CTN[j];
cell = row.createCell(o + 1);
cell.setCellStyle(cellStyle);
cell.setCellValue(CTN[CTN.length-1][o]);
}
// sheet1.createRow(j+1);
yearNum++;
cell = row.createCell(changeType.length + 1);
cell.setCellStyle(cellStyle);
cell.setCellValue(getArrayCount(CTN[CTN.length-1]));
}
}
@ -784,46 +761,12 @@ public class DFL038Jframe extends JFrame {
System.out.println(Arrays.toString(CTN[p]));
}
XSSFRow row = sheet1.createRow(list.size()+yearNum);
XSSFCell createCell2 = row.createCell(0);
createCell2.setCellStyle(cellStyle);
createCell2.setCellValue("合计:");
for (int j = 0; j < num.length; j++) {
XSSFCell cell = row.createCell(j + 1);
cell.setCellStyle(cellStyle);
cell.setCellValue(num[j]);
}
int count = 0;
for (int q : num) {
count += q;
}
XSSFCell createCell = row.createCell(num.length + 1);
createCell.setCellStyle(cellStyle);
createCell.setCellValue(count);
for (int m = 0; m <= changeType.length; m++) {
sheet1.setColumnWidth(m, 10 * 256);
// sheet1.autoSizeColumn(m);
}
for (int j = 0; j <= title.length; j++) {
sheet2.setColumnWidth(j, 20 * 256);
// sheet2.autoSizeColumn(j);
}
FileOutputStream fos = FileUtils.openOutputStream(new File(absoluteFilePath));
workbook.write(fos);
if (fos != null) {
fos.close();
}
// listByYear(CTN,list.size(),absoluteFilePath);
} catch (Exception e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
@ -1005,7 +948,7 @@ public class DFL038Jframe extends JFrame {
for (int n = 0; n <= changeType.length + 1; n++) {
XSSFCell cell = row2.createCell(n);
if (n == 0) {
cell.setCellValue("合计:");
cell.setCellValue("合计1:");
} else if (n <= changeType.length) {
cell.setCellValue(num[n - 1]);
} else {
@ -1013,7 +956,6 @@ public class DFL038Jframe extends JFrame {
}
}
}
}
@ -1071,6 +1013,20 @@ public class DFL038Jframe extends JFrame {
return count;
}
public static int[] arrayAdd(int[] array,int [] val) {
int[] back = new int[array.length];
for(int i=0;i<array.length;i++) {
if(val == null) {
back[i] = array[i];
}
else {
back[i] = array[i]+val[i];
}
}
return back;
}
public static void main(String[] args) {
new DFL038Jframe();
// Date date = new Date();

@ -270,8 +270,6 @@ public class CreateNoemBOMDialogs extends AbstractAIFDialog {
}
/**
*
*
@ -367,7 +365,6 @@ public class CreateNoemBOMDialogs extends AbstractAIFDialog {
}
}
if(vals != null) {
TCTypeService service = session.getTypeService();
//获取BOMWindowType
TCComponentBOMWindowType winType = (TCComponentBOMWindowType) service

@ -0,0 +1,734 @@
package com.connor.dfl.plm.dfl044;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Vector;
import com.connor.dfl.plm.dfl027.ChangeOwnerbean;
import com.connor.dfl.plm.dfl038.ChangeBean;
import com.connor.dfl.plm.forms.ChangeOrderBean;
import com.connor.dfl.plm.util.CodeBean;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.util.MessageBox;
public class DataBaseControl2 {
/** ************************数据库类调用:声明部分*********************************** */
/**
* kelsen ....
*/
Connection conn;
ResultSet rs;
PreparedStatement pstmt;
Statement stmt;
String strSQLQuery;
public String str_Information = "";
private String strDriver = "oracle.jdbc.driver.OracleDriver";
private String strUrl = "";
private String strUserName = "";
private String strPassword = "";
/**
*
*/
public DataBaseControl2(String strDriver, String strUrl, String strUserName,
String strPassword) {
// this.strDriver ="oracle.jdbc.driver.OracleDriver";//驱动
// this.strUrl = "jdbc:oracle:thin:@127.0.0.1:1521:tc";//连接路径
// this.strUserName = "infodba";//数据库用户
// this.strPassword = "infodba";//数据库密码
this.strDriver = strDriver; // "oracle.jdbc.driver.OracleDriver";//驱动
this.strUrl = strUrl; // "jdbc:oracle:thin:@127.0.0.1:1521:tceng";//连接路径
this.strUserName = strUserName; // "infodba";//数据库用户
this.strPassword = strPassword; // "infodba";//数据库密码
// 加载驱动
try {
Class.forName(strDriver);// 通过反射加载驱动到内存
} catch (ClassNotFoundException cnfe) {
cnfe.printStackTrace();
}
// try {
// Class.forName("org.objectweb.rmijdbc.Driver").newInstance();
// } catch (InstantiationException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// } catch (IllegalAccessException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// } catch (ClassNotFoundException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
}
/**
*
*/
public DataBaseControl2(TCSession session) {
String[] stringArray = session.getPreferenceService().getStringArray(4,
"DFL2_ERP_SQL_Connect2");
if (stringArray != null && stringArray.length == 3) {
strUrl = "jdbc:oracle:thin:@" + stringArray[0];
strUserName = stringArray[1];
strPassword = stringArray[2];
} else {
MessageBox.post("未配置DFL2_ERP_SQL_Connect2首选项无法获得连接信息!", "错误",
MessageBox.ERROR);
}
// 加载驱动
try {
Class.forName(strDriver);// 通过反射加载驱动到内存
} catch (ClassNotFoundException cnfe) {
cnfe.printStackTrace();
}
}
/**
*
*/
public DataBaseControl2(TCSession session,String connect) {
String[] stringArray = session.getPreferenceService().getStringArray(4,
connect);
if (stringArray != null && stringArray.length == 3) {
strUrl = "jdbc:oracle:thin:@" + stringArray[0];
strUserName = stringArray[1];
strPassword = stringArray[2];
} else {
MessageBox.post("未配置"+connect+"首选项,无法获得连接信息!", "错误",
MessageBox.ERROR);
}
// 加载驱动
try {
Class.forName(strDriver);// 通过反射加载驱动到内存
} catch (ClassNotFoundException cnfe) {
cnfe.printStackTrace();
}
}
/**
*
*
* @param strSQLQuery
*/
public void dbModify(String strSQLQuery) {
openDataBase();
try {
stmt = conn.createStatement();
stmt.executeUpdate(strSQLQuery);
} catch (SQLException sqle2) {
sqle2.printStackTrace();
}
closeDataBase();
}
/**
*
*
* @param strSQLQuery
* @return
*/
public ResultSet dbQuery(String strSQLQuery) {
ResultSet rs_result = null;
if (conn == null)
openDataBase();
try {
stmt = conn.createStatement();
rs_result = stmt.executeQuery(strSQLQuery);
} catch (SQLException sqle2) {
sqle2.printStackTrace();
}
return rs_result;
}
/**
* 2
*
* @param strSQLQuery
* @return
*/
public ResultSet dbQuery2(String strSQLQuery, Object[] strs) {
ResultSet rs_result = null;
if (conn == null)
openDataBase();
try {
// stmt = conn.createStatement();
PreparedStatement ps = conn.prepareStatement(strSQLQuery);
for (int i = 0; i < strs.length; i++) {
ps.setObject(i + 1, strs[i]);
}
rs_result = ps.executeQuery();
} catch (SQLException sqle2) {
sqle2.printStackTrace();
}
return rs_result;
}
/**
* 3
*
* @param strSQLQuery
* @return
*/
public ResultSet dbQuery3(String strSQLQuery) {
ResultSet rs_result = null;
if (conn == null)
openDataBase();
try {
stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
rs_result = stmt.executeQuery(strSQLQuery);
} catch (SQLException sqle2) {
sqle2.printStackTrace();
}
return rs_result;
}
/**
* 2
*
* @param strSQLQuery
*/
public void dbModify2(String strSQLQuery, Object[] strs) {
openDataBase();
try {
// stmt = conn.createStatement();
PreparedStatement ps = conn.prepareStatement(strSQLQuery);
for (int i = 0; i < strs.length; i++) {
ps.setObject(i + 1, strs[i]);
}
ps.executeUpdate();
} catch (SQLException sqle2) {
sqle2.printStackTrace();
}
closeDataBase();
}
/**
*
*
*/
public void openDataBase() {
try {
// this.strUrl="jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.29)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=tcprod)))";
if (conn == null || conn.isClosed())
conn = DriverManager.getConnection(strUrl, strUserName,
strPassword);
} catch (SQLException sqle) {
sqle.printStackTrace();
MessageBox.post("数据库连接错误" + sqle.getMessage(), "错误", 1);
}
}
/**
*
*
*/
public void closeDataBase() {
try {
if (rs != null) {
try {
rs.close();
} catch (SQLException sqlec) {
sqlec.printStackTrace();
}
}
if (stmt != null) {
try {
stmt.close();
} catch (SQLException sqlec) {
sqlec.printStackTrace();
}
}
if (conn != null && !conn.isClosed()) {
try {
conn.close();
} catch (SQLException sqlecon) {
sqlecon.printStackTrace();
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* HashMap,key
* VectorHasnMap
*
* @param strSQLQuery
* @return
* @author xuk
*/
public Vector orgQuery(String strSQLQuery) {
openDataBase();
Vector v_result = new Vector();
try {
ResultSet rs_get = dbQuery(strSQLQuery);
// System.out.println("RS_GET:"+rs_get);
if (rs_get != null) {
ResultSetMetaData metaData = rs_get.getMetaData();
int i_ColumnCount = metaData.getColumnCount();
// System.out.println("i_ColumnCount:"+i_ColumnCount);
while (rs_get.next()) {
// System.out.println("【BJZJ2】"+rs_get.getString("BJZJ2"));;
HashMap<String, String> hm_unit = new HashMap<String, String>();
for (int i = 1; i <= i_ColumnCount; i++) {
hm_unit.put(metaData.getColumnName(i),
rs_get.getString(i));
// System.out.println("metaData.getColumnName(i):"+metaData.getColumnName(i));
// System.out.println("rs_get.getString(i):"+rs_get.getString(i));
}
v_result.add(hm_unit);
}
} else {
str_Information = "【" + strSQLQuery + "】" + "查询的结果集为空\n";
}
} catch (Exception e) {
e.printStackTrace();
}
return v_result;
}
public String getTaskIdea(String uid)
throws Exception {
openDataBase();
String query = "select IDEA from PLM_Perform_Task where PUID= ?";
// 查询该id在数据库中的内容
ResultSet rs = dbQuery2(query, new Object[] { uid});
String taskIdea = "";
if (rs.next()) {
taskIdea = rs.getString(1);
System.out.println("taskIdea=" + taskIdea);
}
closeDataBase();
return taskIdea;
}
public void setTaskIdea(String uid,String idea)
throws Exception {
openDataBase();
String query = "select IDEA from PLM_Perform_Task where PUID= ?";
// 查询该id在数据库中的内容
ResultSet rs = dbQuery2(query, new Object[] { uid});
if(rs.next()) {
String upin = "update PLM_Perform_Task set IDEA= ? where PUID= ?";
dbModify2(upin, new Object[] { idea, uid });
}else {
String upin = "insert into PLM_Perform_Task(PUID,IDEA) values ( ? , ? )";
dbModify2(upin, new Object[] { uid, idea });
}
closeDataBase();
}
/**
*
*
* @param type
*
* @param prefix
*
* @param col
* 4"0000"
* @return
* @throws Exception
*/
public String getNewCode(String type, String prefix, String col)
throws Exception {
openDataBase();
String query = "select PREFIX,LSH from PLM_LSH where PLMTYPE= ? and PREFIX= ?";
// 查询该id在数据库中的内容
ResultSet rs = dbQuery2(query, new Object[] { type, prefix });
String lshstr = col;
String pre = "";
String lsh = "";
if (rs.next()) {
pre = rs.getString(1);
lsh = rs.getString(2);
System.out.println("sspre=" + pre);
System.out.println("sslsh=" + lsh);
if ("".equals(lsh)) {
throw new Exception("流水码为空!");
}
int ls = Integer.parseInt(lsh) + 1;// 新的流水码数
lshstr = ls + "";
if (col != null) {
DecimalFormat df = new DecimalFormat(col);
lshstr = df.format(ls);
}
String upin = "update PLM_LSH set LSH= ? where PLMTYPE= ? and PREFIX= ? ";
dbModify2(upin, new Object[] { lshstr, type, prefix });
} else {
String upin = "insert into PLM_LSH(PLMTYPE,PREFIX,LSH) values ( ? , ? , ? )";
dbModify2(upin, new Object[] { type, prefix, lshstr });
}
closeDataBase();
String newId = prefix + lshstr;
return newId;
}
//获取变更单信息
public List<ChangeBean> getChangeMesg(String product,String time1,String time2) throws SQLException {
List<ChangeBean> list = new ArrayList<ChangeBean>();
if("全部".equals(product)) {
product = "";
}
String sql = "select * from DFL_CHANGEFORM where PRODUCTDEPARTMENT like '%"+product+"%'";//
SimpleDateFormat df = new SimpleDateFormat("yyyy-M-d HH:mm");
openDataBase();
System.out.println("sql============"+sql);
ResultSet rs = dbQuery(sql);
while(rs.next()){
try {
String dateStr = rs.getString(3);
System.out.println("date========"+rs.getString(3));
if(dateStr == null) {
continue;
}
Date date = df.parse(rs.getString(3));
Date date1 = df.parse(time1);
Date date2 = df.parse(time2);
if(date.after(date2) && date.before(date1)) {
System.out.println("date2========"+rs.getString(3));
}
if(date.after(date1) && date.before(date2)) {
ChangeBean bn = new ChangeBean();
bn.setApplyName(rs.getString(2));
bn.setApplyDate(rs.getString(3));
bn.setProjectCode(rs.getString(4));
bn.setClientNae(rs.getString(5));
bn.setProductName(rs.getString(7));
bn.setProjectModel(rs.getString(8));
bn.setChangeType(rs.getString(10));
bn.setProductType(rs.getString(11));
bn.setErrorType(rs.getString(12));
bn.setDutyDepartment(rs.getString(13));
bn.setDutyMan(rs.getString(14));
bn.setChangeReason(rs.getString(15));
bn.setSalseClassify(rs.getString(16));
bn.setPriceBooking(rs.getString(17));
bn.setIsNotProductLoss(rs.getString(18));
bn.setReceiveClassify(rs.getString(19));
bn.setWarehouseCode(rs.getString(20));
bn.setAccountSet(rs.getString(21));
bn.setNotifyEmergencyProcedures(rs.getString(22));
bn.setDrawingTo(rs.getString(23));
bn.setChangeListCode(rs.getString(24));
bn.setTZChangeType(rs.getString(25));
bn.setSUOSU_ProductDepartment(rs.getString(26));
bn.setProjectState(rs.getString(27));
list.add(bn);
}
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
closeDataBase();
return list;
}
/**
*
*
* @param type
*
* @param prefix
*
* @param col
* 4"0000"
* @return
* @throws Exception
*/
public String getNewCode(String type,CodeBean selCodeBean)
throws Exception {
String prefix = selCodeBean.getCode();
String col = selCodeBean.getNum();
String min = selCodeBean.getMin();
String max = selCodeBean.getMax();
openDataBase();
String query = "select PREFIX,LSH from PLM_LSH where PLMTYPE= ? and PREFIX= ?";
// 查询该id在数据库中的内容
ResultSet rs = dbQuery2(query, new Object[] { type, prefix });
String lshstr = col;
String pre = "";
String lsh = "";
if (rs.next()) {
pre = rs.getString(1);
lsh = rs.getString(2);
System.out.println("sspre=" + pre);
System.out.println("sslsh=" + lsh);
if ("".equals(lsh)) {
throw new Exception("流水码为空!");
}
int ls = Integer.parseInt(lsh) + 1;// 新的流水码数
int minls = Integer.parseInt(min);
int maxls = Integer.parseInt(max);
if (minls>ls) {
ls=minls;
}
if (ls>maxls) {
System.out.println("错误:流水码最已超过最大值");
return "MAXERR";
}
lshstr = ls + "";
if (col != null) {
DecimalFormat df = new DecimalFormat(col);
lshstr = df.format(ls);
}
String upin = "update PLM_LSH set LSH= ? where PLMTYPE= ? and PREFIX= ? ";
dbModify2(upin, new Object[] { lshstr, type, prefix });
} else {
if (col != null) {
int minls = Integer.parseInt(min);
DecimalFormat df = new DecimalFormat(col);
lshstr = df.format(minls);
}
String upin = "insert into PLM_LSH(PLMTYPE,PREFIX,LSH) values ( ? , ? , ? )";
dbModify2(upin, new Object[] { type, prefix, lshstr });
}
closeDataBase();
String newId = prefix + lshstr;
return newId;
}
/**
*
*
*/
public String getMaxCode(String type,CodeBean selCodeBean)throws Exception {
String prefix = selCodeBean.getCode();
String col = selCodeBean.getNum();
String min = selCodeBean.getMin();
String max = selCodeBean.getMax();
openDataBase();
String query = "select * from (select * from pitem where pitem_id like '"+prefix+"%' order by pitem_id desc) where rownum<=1";
// 查询该id在数据库中的内容
ResultSet rs = dbQuery(query);
String lshstr = col;
String lsh = "";
if (rs.next()) {
lsh = rs.getString(2);
System.out.println("sslsh=" + lsh);
if ("".equals(lsh)) {
throw new Exception("流水码为空!");
}
lsh = lsh.substring(6);
int ls = Integer.parseInt(lsh) + 1;// 新的流水码数
lshstr = ls + "";
System.out.println("lshstr=" + lshstr);
if (col != null) {
DecimalFormat df = new DecimalFormat(col);
lshstr = df.format(ls);
}
}
String upin = "update PLM_LSH set LSH= ? where PLMTYPE= ? and PREFIX= ? ";
dbModify2(upin, new Object[] { lshstr, type, prefix });
closeDataBase();
String newId = prefix + lshstr;
return newId;
}
/**
*
* @param v3
* @param v16
* @param time
* @param user
* @throws Exception
*/
public void setSqlConn(String v3, String v16, String time, String user)
throws Exception {
openDataBase();
// WF_MJID varchar2(200),--编码
// WF_YXJ varchar2(200),--已下机数
// WF_DATE varchar2(200),--上传日期
// WF_USER varchar2(200),--上传人员
String query = "select WF_MJID from WF_MJ_XJ_T where WF_MJID = ? ";
// 查询该id在数据库中的内容
ResultSet rs = dbQuery2(query, new Object[] {v3});
String wfmjid = "";
if (rs.next()) {
System.out.println("更新");
wfmjid = rs.getString(1);
System.out.println("wfmjid=" + wfmjid);
String upup = "UPDATE WF_MJ_XJ_T set WF_YXJ = ? ,WF_DATE= ?, WF_USER = ? WHERE WF_MJID = ? ";
dbModify2(upup, new Object[] {v16, time, user ,v3});
} else {
System.out.println("插入");
System.out.println("wfmjid=" + v3);
String upin = "insert into WF_MJ_XJ_T(WF_MJID,WF_YXJ,WF_DATE,WF_USER) values ( ?,? , ? , ? )";
dbModify2(upin, new Object[] {v3, v16, time, user});
}
closeDataBase();
return ;
}
/**
* ERP
*
* @param value
*
* @param sql
*
* @return
* @throws Exception
*/
public String getRecord(String sql)
throws Exception {
String result=null;
openDataBase();
// 查询该id在数据库中的内容
ResultSet rs = dbQuery(sql);
while (rs.next()) {
// ERPStockandPrice bean = new ERPStockandPrice();
// bean.setID(rs.getInt(1));
// bean.setfun(rs.getString(2));
// bean.setitem_id(rs.getString(3));
// bean.setzhangtao(rs.getString(4));
// bean.setUser_id(rs.getString(5));
// list.add(bean);
result = rs.getString(1);
}
closeDataBase();
return result;
}
// public List<ChangeOwnerbean> getRecord2(String value,String zhangT,String cangK,String sql)
// throws Exception {
// List<ChangeOwnerbean> list=new ArrayList<>();
// openDataBase();
// // 查询该id在数据库中的内容
// ResultSet rs = dbQuery2(sql, new Object[] {value,zhangT,cangK});
// while (rs.next()) {
// ChangeOwnerbean bean = new ChangeOwnerbean();
// bean.setId(rs.getString(1));
// bean.setCustomerName(rs.getString(2));
// bean.setSpec(rs.getString(3));
// bean.setZhangt(rs.getString(4));
// bean.setCangk(rs.getString(5));
// bean.setNum(rs.getString(6));
// bean.setUnit(rs.getString(7));
// list.add(bean);
// }
// closeDataBase();
// return list;
// }
public String getNum(Object[] values)
throws Exception {
openDataBase();
// 查询该id在数据库中的内容
String sql = "select NUM from DFL_OLD_ITEM where ITEM_ID= ? and ZHANGTAO= ? and WAREHOUSE= ?";
String num = "";
ResultSet rs = dbQuery2(sql, values);
if (rs.next()) {
num = rs.getString(1);
}
closeDataBase();
return num;
}
public double getNums(String sql)
throws Exception {
openDataBase();
// 查询该id在数据库中的内容
double nums = 0;
ResultSet rs = dbQuery(sql);
if (rs.next()) {
nums = rs.getInt(1);
}
closeDataBase();
return nums;
}
/**
*
*
* @param args
*/
public static void main(String args[]) {
try {
String str_DataBaseDriver = "oracle.jdbc.driver.OracleDriver";
String str_URL = "jdbc:oracle:thin:@localhost:1521:tc12";
String str_UserName = "infodba";
String str_Password = "infodba";
DataBaseControl2 dbc = new DataBaseControl2(str_DataBaseDriver,
str_URL, str_UserName, str_Password);
// dbc.openDataBase();
System.out.println("连接成功");
// dbc.stmt = dbc.conn.createStatement();
// String sql = "select * from PLM_LSH";
// Vector rs_result = dbc.orgQuery(sql);
// for (int i = 0; i < rs_result.size(); i++) {
// HashMap<String, String> map = (HashMap<String, String>)
// rs_result.get(i);
//
// for (Map.Entry<String, String> entry: map.entrySet()) {
// System.out.println(entry.getKey()+"---"+entry.getValue());
// }
// }
String newid = dbc.getNewCode("PLMITEMID", "pz", "0000");
System.out.println(newid);
// dbc.closeDataBase();
} catch (Exception e) {
e.printStackTrace();
}
}
}

@ -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 tabledataVector
*/
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 tabledataVector
*/
}

@ -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

@ -24,6 +24,7 @@ import org.jacorb.idl.runtime.int_token;
import com.connor.dfl.plm.dfl019.ClassPropBean;
import com.connor.dfl.plm.dfl019.ItemBean;
import com.connor.dfl.plm.dfl019.ParseXMLUtil;
import com.connor.dfl.plm.dfl044.DataBaseControl2;
import com.connor.dfl.plm.util.ClassValueBean;
import com.connor.dfl.plm.util.ClassValueUtil;
import com.connor.dfl.plm.util.ProgressBarThread;
@ -44,7 +45,7 @@ import com.teamcenter.rac.treetable.TreeTableNode;
import com.teamcenter.rac.util.MessageBox;
import com.teamcenter.soaictstubs.stringSeq_tHolder;
public class BOMExportOperation extends AbstractAIFOperation {
public class test extends AbstractAIFOperation {
private AbstractAIFApplication app;
private TCSession session;
private ProgressBarThread wait;
@ -55,10 +56,11 @@ public class BOMExportOperation extends AbstractAIFOperation {
private String xuninum = "1";
private String xuanzhongid = null;
private DataBaseControl2 data;
private String item_id1 = "";//品号 item_id
private String rev_id1 = ""; //版本 item_revision_id
private String name1 = "";//名称 object_name
private String oldid1 = "";//旧品号
private String spec1 = "";//规格
private String unit1 = "";//单位 t2_unit
private String design_num1;//设计用量 bl_quantity
@ -67,11 +69,45 @@ public class BOMExportOperation extends AbstractAIFOperation {
private String source1 = "";//来源码
private String weihao1 = "";//编号 T2_weihao
private String importance1 = "";//重要度 t2_BOMImportance
private String price1 = "";//单价
private String total1 = "";//总价
private int xuhao1 ;
private String lev1 = "";
public BOMExportOperation(AbstractAIFApplication app, TCSession session) {
private String zhangtao = "";
public test(AbstractAIFApplication app, TCSession session) {
this.app = app;
this.session = session;
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);
break;
}
}
}
}
}
} catch (TCException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Override
public void executeOperation() throws Exception {
@ -87,10 +123,10 @@ public class BOMExportOperation extends AbstractAIFOperation {
}
try {
System.out.println("开始获取BOM模板");
String puid = session.getPreferenceService().getStringValue("DFL_BOM_UID");
String puid = session.getPreferenceService().getStringValue("DFL3_BOM_UID");
System.out.println("puid======================"+puid);
if (puid == null||"".equals(puid)) {
MessageBox.post("首选项DFL_BOM_UID未配置,请联系管理员!!",
MessageBox.post("首选项DFL3_BOM_UID未配置,请联系管理员!!",
"错误", MessageBox.ERROR);
return;
}
@ -144,6 +180,11 @@ public class BOMExportOperation extends AbstractAIFOperation {
//对照表的获取方法
private void getAndSetValue1(TCComponentBOMLine bomLine,int level,int num) {
//定义一个集合,将外购、外协存在一个集合内
List<TCComponentBOMLine> wai = new ArrayList<TCComponentBOMLine>();
//定义一个集合,将虚拟存在一个集合内
List<TCComponentBOMLine> xu = new ArrayList<TCComponentBOMLine>();
// TODO Auto-generated method stub
try {
//通过解包方法来解包
@ -186,13 +227,26 @@ public class BOMExportOperation extends AbstractAIFOperation {
{
//如果版本类型是外购件版本或者外协件版本则获取属性
if("T2_outsourceRevision".equals(type) || "T2_OutBuyPartRevision".equals(type)) {
//序号+1
num++;
//将遍历的对象强转类型为bomline
TCComponentBOMLine ziLine = (TCComponentBOMLine) comp;
wai.add(ziLine);
}
//如果不是外购外协件
else {
TCComponentBOMLine ziLine = (TCComponentBOMLine) comp;
xu.add(ziLine);
}
}
}
}
//处理外购外协的数据
if(wai.size()>0) {
getItemValue1(ziLine,level,num);
for (int i = 0;i<wai.size();i++) {
num++;
TCComponentBOMLine waiLine = wai.get(i);
getItemValue1(waiLine,level,num);
List<String> beanList1 = new ArrayList<String>();
@ -211,6 +265,7 @@ public class BOMExportOperation extends AbstractAIFOperation {
beanList1.add(item_id1);
beanList1.add(rev_id1);
beanList1.add(name1);
beanList1.add(oldid1);
//beanList1.add(lev1); //不要层级
beanList1.add(spec1);
beanList1.add(unit1);
@ -220,6 +275,8 @@ public class BOMExportOperation extends AbstractAIFOperation {
beanList1.add(source1);
beanList1.add(weihao1);
beanList1.add(importance1);
// beanList1.add(price1);
// beanList1.add(total1);
System.out.println("beanList19.15====="+beanList1);
//先做布尔逻辑判断
boolean include=idlist.contains(item_id1);//true
@ -243,7 +300,7 @@ public class BOMExportOperation extends AbstractAIFOperation {
if(include1 == panduan) {
String numString = null;
for(int k = 0 ; k<=beanList2.size() ; k++) {
numString = beanList2.get(6);
numString = beanList2.get(7);
System.out.println("数量9.18====="+numString);
}
double before = Double.valueOf(numString).doubleValue();
@ -251,7 +308,7 @@ public class BOMExportOperation extends AbstractAIFOperation {
double sum = before+add;
//String sum = ""+before+add;
System.out.println("9.18sum====="+sum);
beanList2.set(6, ""+sum);
beanList2.set(7, ""+sum);
list.set(j, beanList2);
}
}
@ -260,14 +317,17 @@ public class BOMExportOperation extends AbstractAIFOperation {
System.out.println("list9.15====="+list);
}
}
}
//处理虚拟件的数据
if(xu.size()>0) {
//如果不是外购外协件则递归此方法
else {
TCComponentBOMLine ziLine = (TCComponentBOMLine) comp;
String xuniid = ziLine.getStringProperty("awb0BomLineItemId");
for (int i = 0;i<xu.size();i++) {
TCComponentBOMLine xuLine = xu.get(i);
String xuniid = xuLine.getStringProperty("awb0BomLineItemId");
//判断如果没有该虚拟件下没有物料,则跳出此循环
AIFComponentContext[] childs23 = ziLine.getChildren();
AIFComponentContext[] childs23 = xuLine.getChildren();
int geshu = childs23.length;
System.out.println("个数为9.22====="+geshu+"====="+xuniid);
if (childs23.length <= 0 ) {
@ -283,7 +343,7 @@ public class BOMExportOperation extends AbstractAIFOperation {
//设置虚拟件数量为double类型a
double a = Double.valueOf(xuninum).doubleValue();
System.out.println("8.12虚拟件的double数量a"+a+"===9.22虚拟件id==="+xuniid);
getItemValue1(ziLine,level,xuhao1);
getItemValue1(xuLine,level,xuhao1);
//设置获取的数量为double类型b
System.out.println("9.22运行方法后获得design_num1的值====="+design_num1);
double b = Double.valueOf(design_num1).doubleValue();
@ -301,12 +361,9 @@ public class BOMExportOperation extends AbstractAIFOperation {
System.out.println("8.12第一个虚拟件"+xuninum+"===9.22虚拟件id==="+xuniid);
//递归
getAndSetValue1(ziLine,level,xuhao1);
getAndSetValue1(xuLine,level,xuhao1);
}
}
}
}
//level--;
}
} catch (TCException e) {
@ -708,10 +765,13 @@ public class BOMExportOperation extends AbstractAIFOperation {
item_id1 = rev.getStringProperty("item_id");
rev_id1 = rev.getStringProperty("item_revision_id");
name1 = rev.getStringProperty("object_name");
price1 = getPrice();
total1 = getTotal(design_num1,price1);
if("T2_outsourceRevision".equals(type)) {
xuhao1 = num ;
String classID = item_id1.substring(0, 2);
item_id1 = item_id1+rev_id1;
oldid1 = rev.getStringProperty("t2_OldId");
System.out.println("classID==============="+classID);
if("51".equals(classID) || "72".equals(classID) || "76".equals(classID)) {
@ -725,10 +785,13 @@ public class BOMExportOperation extends AbstractAIFOperation {
spec1 = getOutsourceValue(rev);
}
unit1 = rev.getStringProperty("t2_unit");
brand1 = "";
}else if("T2_OutBuyPartRevision".equals(type)) {
xuhao1 = num;
ClassValueBean valueBean = ClassValueUtil.getOutBuyPartValue(rev,errList);
oldid1 = rev.getStringProperty("t2_OldID");
if(valueBean != null) {
spec1 = valueBean.getSpecs();
unit1 = valueBean.getUnit();
@ -800,6 +863,39 @@ public class BOMExportOperation extends AbstractAIFOperation {
e.printStackTrace();
}
}
private String getPrice () {
String price = null;
String sql = null;
sql = "select ccc23a from " +zhangtao + ".ccc_file inner join "+zhangtao+".ccz_file on ccz01=ccc02 and ccz02=ccc03 where ccc01='"+item_id1+"'";
System.out.println("sql======"+sql);
try {
price = data.getRecord(sql);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("11.08==price=="+price);
if(price == null ) {
price ="";
}
return price;
}
private String getTotal(String quantity,String price) {
// TODO Auto-generated method stub
if("".equals(price)||" ".equals(price)||"null".equals(price)) {
price = "0";
}
String total;
double amount = Double.valueOf(quantity).doubleValue();
double tariff = Double.valueOf(price).doubleValue();
double product = amount * tariff ;
total = ""+product;
System.out.println("11.08==总价====="+total);
return total;
}
//匹配分群码
private void getgroup() {
if("F10".equals(group1)) {

@ -140,10 +140,13 @@ public class AddDialogApply_TZ extends AbstractAIFDialog {
if(!("".equals(s.trim()))) {
sb.append(";");
}
sb.append(list.get(i));
if(i < list.size()-1) {
if(sb.length()>0&&sb.charAt(sb.length()-1)!=';') {
sb.append(";");
}
sb.append(list.get(i));
// if(i < list.size()-1) {
// sb.append(";");
// }
}
//changeform.model1.setValueAt(proid, 8, 1);

@ -100,10 +100,13 @@ public class AddDialogNotify_TZ extends AbstractAIFDialog {
if(!("".equals(s.trim()))) {
sb.append(";");
}
sb.append(list.get(i));
if(i < list.size()-1) {
if(sb.length()>0&&sb.charAt(sb.length()-1)!=';') {
sb.append(";");
}
sb.append(list.get(i));
// if(i < list.size()-1) {
// sb.append(";");
// }
}
//changeform.model1.setValueAt(proid, 8, 1);

@ -442,10 +442,13 @@ public class AddDialogQuickChange_TZ extends AbstractAIFDialog {
if(!("".equals(s.trim()))) {
sb.append(";");
}
sb.append(list.get(i));
if(i < list.size()-1) {
if(sb.length()>0&&sb.charAt(sb.length()-1)!=';') {
sb.append(";");
}
sb.append(list.get(i));
// if(i < list.size()-1) {
// sb.append(";");
// }
}
//changeform.model1.setValueAt(proid, 8, 1);

File diff suppressed because it is too large Load Diff

@ -1,5 +1,7 @@
package com.connor.dfl.plm.forms;
import org.jacorb.idl.runtime.int_token;
/**
*
* @author ËïÒã
@ -14,6 +16,7 @@ public class ChangeDetils {
private String YSL;
private String XSL;
private String BGSL;
private String GGSM;
private String WZPSL;
private String WZPUJ;
private String ZZSL;
@ -30,7 +33,7 @@ public class ChangeDetils {
public ChangeDetils() {
}
public ChangeDetils(String objtctCode,String pH, String pM, String yBB, String xBB, String ySL, String xSL, String bGSL, String wZPSL,
public ChangeDetils(String objtctCode,String pH, String pM, String yBB, String xBB, String ySL, String xSL, String bGSL,String gGSM, String wZPSL,
String wZPUJ, String zZSL, String zZYJ, String sCSL, String sSYJ, String cKSL, String cLYJ) {
this.objectCode= objtctCode;
this.PH = pH;
@ -40,6 +43,7 @@ public class ChangeDetils {
this.YSL = ySL;
this.XSL = xSL;
this.BGSL = bGSL;
this.GGSM = gGSM;
this.WZPSL = wZPSL;
this.WZPUJ = wZPUJ;
this.ZZSL = zZSL;
@ -94,11 +98,19 @@ public class ChangeDetils {
XSL = xSL;
}
public String getBGSL() {
return BGSL;
}
public void setBGSL(String bGSL) {
BGSL = bGSL;
}
public String getGGSM() {
return GGSM;
}
public void setGGSM(String gGSM) {
GGSM = gGSM;
}
public String getWZPSL() {
return WZPSL;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -83,7 +83,7 @@ public class ClassValueUtil {
String kaitou1 = attrName.substring(0,2);
//前两个字是否为规格
if("规格".equals(kaitou1)) {
valueBean.setSpec(value);
valueBean.setSpec(lovValue);
}
}
else if(attrName.contains("订货码")){

Loading…
Cancel
Save