测试项信息维护若干bug修改

main
刘江林 6 years ago
parent 2a45b91196
commit c778f5c739

@ -12,8 +12,7 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.108.0",
com.teamcenter.rac.kernel;bundle-version="12000.1.0", com.teamcenter.rac.kernel;bundle-version="12000.1.0",
com.teamcenter.rac.ui.views;bundle-version="12000.1.0", com.teamcenter.rac.ui.views;bundle-version="12000.1.0",
org.eclipse.core.runtime;bundle-version="3.12.0", org.eclipse.core.runtime;bundle-version="3.12.0",
org.eclipse.ui.forms;bundle-version="3.7.0", org.eclipse.ui.forms;bundle-version="3.7.0"
org.eclipse.swt
Automatic-Module-Name: JDProject Automatic-Module-Name: JDProject
Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: com.connor.jd.plm.action, Export-Package: com.connor.jd.plm.action,

@ -269,7 +269,7 @@ public class CSXWHDialog extends Application {
if (delCompList.get(i) == findList.get(j).getCompId()) { if (delCompList.get(i) == findList.get(j).getCompId()) {
String sql = "delete from JD2_Component where test_id=?"; String sql = "delete from JD2_Component where test_id=?";
update(sql, findList.get(j).getCompId()); update(sql, findList.get(j).getCompId());
// System.out.println("移除了原本数据库就有的"); System.out.println("移除了原本数据库就有的");
findList.remove(j); findList.remove(j);
} }
Iterator<ComponentBean> compIt = componentData.iterator(); Iterator<ComponentBean> compIt = componentData.iterator();
@ -277,7 +277,7 @@ public class CSXWHDialog extends Application {
int compid = compIt.next().getCompId(); int compid = compIt.next().getCompId();
if (delCompList.get(i) == compid) { if (delCompList.get(i) == compid) {
compIt.remove(); compIt.remove();
// System.out.println("初始结果集移除了一条"); System.out.println("初始结果集移除了一条");
} }
} }
} }
@ -300,14 +300,17 @@ public class CSXWHDialog extends Application {
} }
if (flag) { if (flag) {
for (ComponentBean com : findList) { for (ComponentBean com : findList) {
System.out.println("状态" + com.getStage()); // System.out.println("状态" + com.getStage());
if (com.getStage() == 1) { if (com.getStage() == 1) {
insert(com); insert(com);
com.setStage(0); com.setStage(0);
selectId(com);
System.out.println("com的Id" + com.getCompId());
} }
if (com.getStage() == 2) { if (com.getStage() == 2) {
update(com); update(com);
com.setStage(0); com.setStage(0);
} }
} }
tableView0.refresh(); tableView0.refresh();
@ -519,6 +522,7 @@ public class CSXWHDialog extends Application {
if (mac.getStage() == 1) { if (mac.getStage() == 1) {
insertMac(mac); insertMac(mac);
mac.setStage(0); mac.setStage(0);
selectMacId(mac);
} }
if (mac.getStage() == 2) { if (mac.getStage() == 2) {
updateMac(mac); updateMac(mac);
@ -576,6 +580,66 @@ public class CSXWHDialog extends Application {
return results; return results;
} }
private void selectId(ComponentBean com) {
String sql = "select component_id_seq.nextval from dual";
con = DBConnectionUtil.dbConn("infodba", "infodba");
try {
ps = con.prepareStatement(sql);
rs = ps.executeQuery();
while (rs.next()) {
int id = rs.getInt(1) - 1;
System.out.println("id" + id);
com.setCompId(id);
}
} catch (Exception e) {
System.out.println("查找失败");
} finally {
if (ps != null) {
try {
ps.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
if (con != null) {
try {
con.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
}
private void selectMacId(MachineBean com) {
String sql = "select machine_id_seq.nextval from dual";
con = DBConnectionUtil.dbConn("infodba", "infodba");
try {
ps = con.prepareStatement(sql);
rs = ps.executeQuery();
while (rs.next()) {
int id = rs.getInt(1);
com.setMacId(id);
}
} catch (Exception e) {
} finally {
if (ps != null) {
try {
ps.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
if (con != null) {
try {
con.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
}
private void insert(ComponentBean com) { private void insert(ComponentBean com) {
String sql = "insert into JD2_Component(test_type,test_project,test_time,test_num,test_cost) values(?,?,?,?,?)"; String sql = "insert into JD2_Component(test_type,test_project,test_time,test_num,test_cost) values(?,?,?,?,?)";
con = DBConnectionUtil.dbConn("infodba", "infodba"); con = DBConnectionUtil.dbConn("infodba", "infodba");
@ -602,6 +666,20 @@ public class CSXWHDialog extends Application {
} catch (Exception e) { } catch (Exception e) {
System.out.println("Ìí¼Óʧ°Ü"); System.out.println("Ìí¼Óʧ°Ü");
} finally { } finally {
if (ps != null) {
try {
ps.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
if (con != null) {
try {
con.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
} }
} }
@ -627,6 +705,20 @@ public class CSXWHDialog extends Application {
} catch (Exception e) { } catch (Exception e) {
System.out.println("Ìí¼Óʧ°Ü"); System.out.println("Ìí¼Óʧ°Ü");
} finally { } finally {
if (ps != null) {
try {
ps.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
if (con != null) {
try {
con.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
} }
} }
@ -656,6 +748,20 @@ public class CSXWHDialog extends Application {
} catch (Exception e) { } catch (Exception e) {
} finally { } finally {
if (ps != null) {
try {
ps.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
if (con != null) {
try {
con.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
} }
} }
@ -709,6 +815,20 @@ public class CSXWHDialog extends Application {
} catch (Exception e) { } catch (Exception e) {
} finally { } finally {
if (ps != null) {
try {
ps.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
if (con != null) {
try {
con.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
} }
} }
} }
Loading…
Cancel
Save