From b897f349f232e7d0b3cb865c8b42e06224d6fb4a Mon Sep 17 00:00:00 2001 From: lijh Date: Thu, 8 Aug 2024 09:52:23 +0800 Subject: [PATCH] =?UTF-8?q?20240808=E6=9B=B4=E6=96=B0=E8=87=AA=E5=88=B6?= =?UTF-8?q?=E5=A4=96=E8=B4=AD=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- com.connor.chint.wuhan/META-INF/MANIFEST.MF | 1 - com.connor.chint.wuhan/plugin.xml | 48 +++ .../chint/plm/applyMatnr/ApplyMatnrOp.java | 5 + .../chint/plm/applyMatnr/ApplyMatnrOp2.java | 5 + .../chint/JDBPackage/MySceneController.java | 18 +- .../src/com/connor/plm/txdp/BZGSFram.java | 368 ++++++++++++++++++ .../src/com/connor/plm/txdp/BZGSHandler.java | 69 ++++ .../src/com/connor/plm/txdp/GXTZHandler.java | 44 +++ .../src/com/connor/plm/txdp/GXTZOp.java | 175 +++++++++ .../src/com/connor/plm/txdp/TXDPFram.java | 318 +++++++++++++-- .../src/com/connor/plm/txdp/TXDPHandler.java | 2 + 11 files changed, 1021 insertions(+), 32 deletions(-) create mode 100644 com.connor.chint.wuhan/src/com/connor/plm/txdp/BZGSFram.java create mode 100644 com.connor.chint.wuhan/src/com/connor/plm/txdp/BZGSHandler.java create mode 100644 com.connor.chint.wuhan/src/com/connor/plm/txdp/GXTZHandler.java create mode 100644 com.connor.chint.wuhan/src/com/connor/plm/txdp/GXTZOp.java diff --git a/com.connor.chint.wuhan/META-INF/MANIFEST.MF b/com.connor.chint.wuhan/META-INF/MANIFEST.MF index 7ac9057..5b13b97 100644 --- a/com.connor.chint.wuhan/META-INF/MANIFEST.MF +++ b/com.connor.chint.wuhan/META-INF/MANIFEST.MF @@ -48,7 +48,6 @@ Require-Bundle: org.eclipse.ui, com.teamcenter.rac.util;bundle-version="11000.2.0", org.eclipse.osgi.services;bundle-version="3.3.100", TcSoaCaeRac;bundle-version="11000.2.0", - com.teamcenter.rac.project;bundle-version="11000.2.0", org.apache.poi.39;bundle-version="3.9.0" Automatic-Module-Name: com.connor.chint.yunpi Bundle-RequiredExecutionEnvironment: JavaSE-1.8, diff --git a/com.connor.chint.wuhan/plugin.xml b/com.connor.chint.wuhan/plugin.xml index d937c82..cb03139 100644 --- a/com.connor.chint.wuhan/plugin.xml +++ b/com.connor.chint.wuhan/plugin.xml @@ -6,7 +6,9 @@ + + @@ -46,6 +48,8 @@ + + @@ -692,6 +696,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/com.connor.chint.wuhan/src/com/chint/plm/applyMatnr/ApplyMatnrOp.java b/com.connor.chint.wuhan/src/com/chint/plm/applyMatnr/ApplyMatnrOp.java index 8cc7aeb..43f862b 100644 --- a/com.connor.chint.wuhan/src/com/chint/plm/applyMatnr/ApplyMatnrOp.java +++ b/com.connor.chint.wuhan/src/com/chint/plm/applyMatnr/ApplyMatnrOp.java @@ -1144,6 +1144,11 @@ public class ApplyMatnrOp extends AbstractAIFOperation { general_maps.put(rev, specs); } } + }else {//20240730Ӳѯ鵽߼ + if(comps!= null && comps.length > 0) { + partRevs.add(comps[0]); + } + } diff --git a/com.connor.chint.wuhan/src/com/chint/plm/applyMatnr/ApplyMatnrOp2.java b/com.connor.chint.wuhan/src/com/chint/plm/applyMatnr/ApplyMatnrOp2.java index e4e1909..c3724de 100644 --- a/com.connor.chint.wuhan/src/com/chint/plm/applyMatnr/ApplyMatnrOp2.java +++ b/com.connor.chint.wuhan/src/com/chint/plm/applyMatnr/ApplyMatnrOp2.java @@ -1147,6 +1147,11 @@ public class ApplyMatnrOp2 extends AbstractAIFOperation { general_maps.put(rev, specs); } } + }else {//20240730Ӳѯ鵽߼ + if(comps!= null && comps.length > 0) { + partRevs.add(comps[0]); + } + } diff --git a/com.connor.chint.wuhan/src/com/connor/chint/JDBPackage/MySceneController.java b/com.connor.chint.wuhan/src/com/connor/chint/JDBPackage/MySceneController.java index 0e8023b..ecff8b5 100644 --- a/com.connor.chint.wuhan/src/com/connor/chint/JDBPackage/MySceneController.java +++ b/com.connor.chint.wuhan/src/com/connor/chint/JDBPackage/MySceneController.java @@ -147,6 +147,8 @@ public class MySceneController extends KFXPanelController { private String findLovString = "SELECT result FROM CHINT_CHECK_LOV_TEMPLATE where lovcode = ? ORDER BY code asc"; private String addMsgString = "INSERT INTO CHINT_CHECK_DETAILS (no,imcheckproject,ipcheckdetials,designresult,proofreadresult,design,proofread," + "\"AUDIT\",checkno,modelversion,numberofchecks) VALUES (?,?,?,?,?,?,?,?,?,?,1)"; + private String addMsgString1 = "INSERT INTO CHINT_CHECK_DETAILS (no,imcheckproject,ipcheckdetials,designresult,proofreadresult,design,proofread," + + "\"AUDIT\",checkno,modelversion,numberofchecks) VALUES (?,?,?,?,?,?,?,?,?,?,?)"; private String oldMsgString = "SELECT no,designresult,PROOFREADRESULT,design,proofread,\"AUDIT\" FROM CHINT_CHECK_DETAILS where checkno = ? and modelversion = ? and numberofchecks = ? ORDER BY no asc "; private String updMsgString = "UPDATE CHINT_CHECK_DETAILS SET designresult = ?,proofreadresult = ?,design = ?,proofread = ?,\"AUDIT\" = ? where checkno = ? and no = ? and modelversion = ? and numberofchecks = ? "; private String getTempString = "SELECT no,imcheckproject,ipcheckdetials,designresultrule,proofreadresultrule,designrule,proofreadrule,auditrule" @@ -260,7 +262,20 @@ public class MySceneController extends KFXPanelController { shType = "2"; } if(isFirst) { - SqlUtil.write(addMsgString, new String[] {String.valueOf(i),zdjc,zdhc,valYqz,valSjz,sjType,jdType,shType,code,version}); + + //update + String text = cb_jccs.getValue(); + //20240805 ӷǵһμ߼ + if(text != null && !text.isEmpty()) { + String substring = text.substring(1, 2); + System.out.println("text==="+substring); + SqlUtil.write(addMsgString1, new String[] {String.valueOf(i),zdjc,zdhc,valYqz,valSjz,sjType,jdType,shType,code,version,substring}); + }else { + + SqlUtil.write(addMsgString, new String[] {String.valueOf(i),zdjc,zdhc,valYqz,valSjz,sjType,jdType,shType,code,version}); + } + + }else { //update String text = cb_jccs.getValue(); @@ -1259,6 +1274,7 @@ public class MySceneController extends KFXPanelController { // String testTh = "TestTh00001"; if(checkno!=null) { ResultSet read2 = SqlUtil.read(oldMsgString, new String[] {checkno,version,String.valueOf(selectedIndex+1)}); + System.out.println(checkno+"-"+version+"-"+String.valueOf(selectedIndex+1)); System.out.println("version==>"+version); while(read2.next()) { isFirst = false; diff --git a/com.connor.chint.wuhan/src/com/connor/plm/txdp/BZGSFram.java b/com.connor.chint.wuhan/src/com/connor/plm/txdp/BZGSFram.java new file mode 100644 index 0000000..33da539 --- /dev/null +++ b/com.connor.chint.wuhan/src/com/connor/plm/txdp/BZGSFram.java @@ -0,0 +1,368 @@ +package com.connor.plm.txdp; + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.Toolkit; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.text.DecimalFormat; +import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.time.Month; +import java.time.YearMonth; +import java.time.temporal.ChronoUnit; +import java.time.temporal.WeekFields; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; + +import javax.swing.BorderFactory; +import javax.swing.JButton; +import javax.swing.JFileChooser; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTable; +import javax.swing.JTextField; +import javax.swing.border.EmptyBorder; +import javax.swing.table.DefaultTableModel; + +import org.apache.poi.ss.formula.eval.ValueEval; +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.CellValue; +import org.apache.poi.ss.usermodel.FormulaEvaluator; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.xssf.usermodel.XSSFCell; +import org.apache.poi.xssf.usermodel.XSSFRow; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; + +import com.connor.chint.sap2.util.SAPUtil; +import com.connor.chint.sap2.util.SqlUtil; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentDataset; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.DateButton; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; + +public class BZGSFram extends JFrame implements ActionListener { + + + private TCSession session; + protected DefaultTableModel tm_part; + private static ArrayList dateConnList = new ArrayList(); + private String[] prefs; + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + StringBuilder insertSql = new StringBuilder(); + private JTextField pathJTextField = new JTextField(30); + private JButton outputButton = new JButton("ѡ"); + private Workbook workbook; + public BZGSFram(TCSession session) { + // TODO Auto-generated constructor stub + this.session = session; + prefs = session.getPreferenceService().getStringValues("CHINT_SRM_SQL_CONNECT"); + initUI(); + } + + + private String sqlString = ""; + + private void initUI() { + // TODO Auto-generated method stub + try { + this.setTitle("ʱά"); + this.setLayout(new BorderLayout()); + + JPanel topPanel = getTopPanel(); + + + JPanel btnPanel = getBtnPanel(); + + this.add(topPanel, BorderLayout.NORTH); + // this.add(pane,BorderLayout.CENTER); + this.add(btnPanel, BorderLayout.SOUTH); + this.setPreferredSize(new Dimension(550, 115)); + Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); // ȡĻߴ + int screenWidth = screenSize.width; // ȡĻ + int screenHeight = screenSize.height; // ȡĻ߶ + int x = (screenWidth - 550) / 2; // FrameϽx + int y = (screenHeight - 300) / 2; // FrameϽy + this.setLocation(x, y); // Frameλ + + // this.setLocationRelativeTo(null); + this.createActionEvent(); + this.pack(); + + // this.validate(); + this.setVisible(true); + +// this.setAlwaysOnTop(true); + + } catch (Exception e) { + e.printStackTrace(); + return; + } + } + + // Ӽ + public void createActionEvent() { + + this.btnIn.addActionListener(this); + + } + + private List compList = new ArrayList(); + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + + Object source = e.getSource(); + System.out.println("source==>+" + source); + if (this.btnIn.equals(source)) { + //߼ + String pathJTextFieldStr = pathJTextField.getText(); + if(pathJTextFieldStr == null || pathJTextFieldStr.isEmpty()) { + MessageBox.post("ѡҪExcel", "ʾ", 2); + return; + } + FileInputStream input = null; + try { + SqlUtil.SRMGetTCDataConnection(prefs); + + if(!pathJTextFieldStr.contains(".xlsx")) { + MessageBox.post("ѡ.xlsxʽExcel", "ʾ", 2); + return; + } + + + + File file = new File(pathJTextFieldStr); + input = new FileInputStream(file); + workbook = new XSSFWorkbook(input); + + //ȡsheetҳ + Sheet sheet0 = workbook.getSheet("ʱ"); + + //excelÿһеֶκݿԱ жϸǷ + LinkedHashMap titleMap = new LinkedHashMap(); + Row row1 = sheet0.getRow(0); + for (int i = 0; i < 100; i++) { + Cell cell = row1.getCell(i); + if(cell == null || getCellValue(cell).isEmpty()) { + System.out.println("i==="+i); + break; + }else { + titleMap.put(getCellValue(cell), cell.getColumnIndex()); + } + } + System.out.println("titleMap==="+titleMap.toString()); + String selectTitleSql = "SELECT column_name FROM all_tab_columns WHERE owner = 'INFODBA' AND table_name = 'CHINT_WORKHOUR'"; + System.out.println("selectTitleSql ========="+selectTitleSql); + ResultSet rs = SqlUtil.read(selectTitleSql.toString()); + ArrayList titleArray = new ArrayList(); + while (rs.next()) { + titleArray.add(rs.getString(1)); + } + System.out.println("titleArray==="+titleArray.toString()); + + Iterator> iterator = titleMap.entrySet().iterator(); + + while (iterator.hasNext()) { + Map.Entry map = iterator.next(); + if(!titleArray.contains(map.getKey())) { + iterator.remove(); + System.out.println("Ƴkey======================"+map.getKey()); + } + } + + + // CHINT_WORKHOURеȫCHINT_WORKHOUR_BACKUP + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String newTime = simpleDateFormat.format(new Date()); + String user = session.getUser().getStringProperty("object_string"); + String saveSql = "INSERT INTO CHINT_WORKHOUR_BACKUP(\"COMPANYCODE\", \"PRODUCTTYPE\", \"PRODUCTXH\", \"JSASK\", \"GYNAME\", \"GYID\", \"GXNAME\", \"GXCODE\", \"ARTIFICIALTIME\", \"MACHINETIME\", \"READINESSTIME\", \"GXMARK\", \"BZTH\", \"ProCycle\", \"VOLTAGELEVEL\", \"USER\", \"CREATETIME\") " + + "SELECT \"COMPANYCODE\", \"PRODUCTTYPE\", \"PRODUCTXH\", \"JSASK\", \"GYNAME\", \"GYID\", \"GXNAME\", \"GXCODE\", \"ARTIFICIALTIME\", \"MACHINETIME\", \"READINESSTIME\", \"GXMARK\", \"BZTH\", \"ProCycle\", \"VOLTAGELEVEL\", '"+user+"', to_date('"+newTime+"','yyyy-mm-ddhh24:mi:ss')"+ + "FROM CHINT_WORKHOUR_TEST"; + System.out.println("saveSql ========="+saveSql); + SqlUtil.update(saveSql); + + String groupID = SAPUtil.getGroupID(session); + //ǰû¼֯ݴCHINT_WORKHOURɾ + String deleteSql = "DELETE FROM CHINT_WORKHOUR_TEST WHERE COMPANYCODE ='"+groupID+"'"; + SqlUtil.update(deleteSql); + // + //ѵֶƴ + StringBuilder fieldStr = new StringBuilder(); + //ʹinsert all into table(a) values(a) into table(a) values(a); + fieldStr.append("INSERT INTO CHINT_WORKHOUR_TEST("); + for (Map.Entry map : titleMap.entrySet()) { + fieldStr.append("\"").append(map.getKey()).append("\","); + } + fieldStr.setLength(fieldStr.length() - 1); + fieldStr.append(") VALUES("); + // Integer[] values = (Integer[]) titleMap.values().toArray(); + Integer[] values = titleMap.values().toArray(new Integer[0]); + for (int i = 2; i < sheet0.getLastRowNum()+1; i++) { + Row row = sheet0.getRow(i); + Cell cell = row.getCell(0); + if(getCellValue(cell).isEmpty()) { + break; + }else { + String insertSqlStr = getSql(fieldStr.toString(),row,values); + SqlUtil.update(insertSqlStr); + System.out.println("insertSqlStr==="+insertSqlStr); + } + + } + // System.out.println("insertSql===="+insertSql.toString()); + // SqlUtil.update(insertSql.toString()); + + } catch (Exception e2) { + e2.printStackTrace(); + MessageBox.post("ʧ,ϵԱ", "ʾ", 2); + } + MessageBox.post("ɹ", "ʾ", 2); + } + + } + + + + private String getSql(String fieldStr, Row row, Integer[] values) { + // TODO Auto-generated method stub + StringBuilder tempInsertSql = new StringBuilder(); + tempInsertSql.append(fieldStr); + for (int i = 0; i < values.length; i++) { + tempInsertSql.append("'").append(getCellValue(row.getCell(values[i]))).append("',"); + } + tempInsertSql.setLength(tempInsertSql.length() - 1); + tempInsertSql.append(")"); + System.out.println("tempInsertSql===="+tempInsertSql.toString()); + insertSql.append(tempInsertSql).append(";"); + return tempInsertSql.toString(); + } + + + private JButton btnIn; + + private JPanel getBtnPanel() { + JPanel topPanel = new JPanel(); + topPanel.setLayout(new PropertyLayout()); + btnIn = new JButton(""); + topPanel.add("1.1.center", new JLabel("")); + topPanel.add("2.1.center", new JLabel("")); + topPanel.add("2.2.center", new JLabel("")); + topPanel.add("2.3.center", btnIn); + + return topPanel; + } + + // ѯ + private JPanel getTopPanel() { + // TODO Auto-generated method stub + JPanel topPanel = new JPanel(); + topPanel.setLayout(new PropertyLayout()); + topPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); + + topPanel.add("1.1.left.center", new JLabel("")); + + topPanel.add("2.1.left.center", new JLabel("ļλã")); + topPanel.add("2.2.left.center", pathJTextField); + topPanel.add("2.3.left.center", outputButton); + // עťĵ¼ + outputButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + // ļѡ + JFileChooser fileChooser = new JFileChooser(); + // ļѡֻѡļ + fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); + int result = fileChooser.showOpenDialog(topPanel); + if (result == JFileChooser.APPROVE_OPTION) { + // ȡûѡ· + String selectedPath = fileChooser.getSelectedFile().getPath(); + // ûѡ· + System.out.println("ûѡ·" + selectedPath); + pathJTextField.setText(selectedPath); + } + } + }); + return topPanel; + } + + public String getCellValue(Cell cell) { + if(cell == null) { + return ""; + }else { + int cellType = cell.getCellType(); + System.out.println("cellType="+cellType+"===cell.getRowIndex()="+cell.getRowIndex()+"===cell.getColumnIndex()="+cell.getColumnIndex()); + if(cellType == 1) {//string + return cell.getStringCellValue(); + }else if(cellType == 3 || cellType == 0) {//num + double numericCellValue = cell.getNumericCellValue(); + System.out.println("numericCellValue====================="+numericCellValue); + if(numericCellValue == 0.0) { + return ""; } + + if (numericCellValue == Math.floor(numericCellValue) && !Double.isInfinite(numericCellValue)) { + long integerPart = (long) numericCellValue; + return integerPart+""; + }else { + return numericCellValue+""; + } + + + }else if(cellType == 2) { + // 鵥ԪǷǹʽ + // FormulaEvaluator + FormulaEvaluator evaluator = workbook.getCreationHelper().createFormulaEvaluator(); + // ʽ + CellValue valueEval = evaluator.evaluate(cell); +//System.out.println("valueEval.getCellType()============================================"+valueEval.getCellType()); + if(valueEval.getCellType() == 1) { + return valueEval.getStringValue(); + + }else if(valueEval.getCellType() == 0) {//num + double numericCellValue = valueEval.getNumberValue(); + // DecimalFormatָʽģʽ + DecimalFormat df = new DecimalFormat("#.00"); + + // ʽ + String formattedNumber = df.format(numericCellValue); + if(numericCellValue == 0.0) { + return ""; } + return formattedNumber; + } + } + + } + return ""; + } + + +} diff --git a/com.connor.chint.wuhan/src/com/connor/plm/txdp/BZGSHandler.java b/com.connor.chint.wuhan/src/com/connor/plm/txdp/BZGSHandler.java new file mode 100644 index 0000000..35ce7cb --- /dev/null +++ b/com.connor.chint.wuhan/src/com/connor/plm/txdp/BZGSHandler.java @@ -0,0 +1,69 @@ +package com.connor.plm.txdp; +import java.util.HashMap; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +import com.connor.chint.sap2.util.SAPUtil; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class BZGSHandler extends AbstractHandler{ + + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + AbstractAIFApplication app = AIFUtility.getCurrentApplication(); + TCSession session = (TCSession) app.getSession(); + try { + + + //ȡѡжûǷʹøù + String[] prefs = session.getPreferenceService().getStringValues("CHINT_WORKHOUR_ACL"); + String userId = session.getUser().getUserId(); + String groupID = SAPUtil.getGroupID(session); + HashMap groupNamesMap = new HashMap(); + for (int i = 0; i < prefs.length; i++) { + String[] split = prefs[i].split(":"); + groupNamesMap.put(split[0], split[1]); + } + System.out.println("groupNamesMap==="+groupNamesMap.toString()); + String names = groupNamesMap.get(groupID); + System.out.println("names==="+names); + if(names == null || names.isEmpty()) { + MessageBox.post("Ȩʹô˹ܣϵԱ", "ʾ", MessageBox.INFORMATION); + return null; + }else { + if(!names.contains(userId)) { + MessageBox.post("Ȩʹô˹ܣϵԱ", "ʾ", MessageBox.INFORMATION); + return null; + } + } + + + new Thread() { + @Override + public void run() { + + try { + new BZGSFram(session); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + }.start(); + + } catch (Exception e) { + // TODO: handle exception + e.printStackTrace(); + } + + return null; + } +} + diff --git a/com.connor.chint.wuhan/src/com/connor/plm/txdp/GXTZHandler.java b/com.connor.chint.wuhan/src/com/connor/plm/txdp/GXTZHandler.java new file mode 100644 index 0000000..aff65e4 --- /dev/null +++ b/com.connor.chint.wuhan/src/com/connor/plm/txdp/GXTZHandler.java @@ -0,0 +1,44 @@ +package com.connor.plm.txdp; +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +import com.connor.chint.yunpi.command.BomDcSapOp; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCSession; + +public class GXTZHandler extends AbstractHandler{ + + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + AbstractAIFApplication app = AIFUtility.getCurrentApplication(); + TCSession session = (TCSession) app.getSession(); + try { + + + + new Thread() { + @Override + public void run() { + + try { + new GXTZOp(app).executeOperation(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + }.start(); + + } catch (Exception e) { + // TODO: handle exception + e.printStackTrace(); + } + + return null; + } +} + diff --git a/com.connor.chint.wuhan/src/com/connor/plm/txdp/GXTZOp.java b/com.connor.chint.wuhan/src/com/connor/plm/txdp/GXTZOp.java new file mode 100644 index 0000000..ffd2e19 --- /dev/null +++ b/com.connor.chint.wuhan/src/com/connor/plm/txdp/GXTZOp.java @@ -0,0 +1,175 @@ +package com.connor.plm.txdp; + +import java.sql.ResultSet; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import javax.swing.JButton; +import javax.swing.JTextField; + +import org.apache.poi.ss.usermodel.Workbook; +import org.dom4j.Document; +import org.dom4j.DocumentHelper; +import org.dom4j.Element; + +import com.connor.chint.sap2.util.BomToSapUtil; +import com.connor.chint.sap2.util.BomUtilWh; +import com.connor.chint.sap2.util.KUtil; +import com.connor.chint.sap2.util.MyProgressBarCompent; +import com.connor.chint.sap2.util.SAPMessageUtil; +import com.connor.chint.sap2.util.SAPUtil; +import com.connor.chint.sap2.util.SqlUtil; +import com.connor.chint.sap2.util.TXTUtil; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.AbstractAIFOperation; +import com.teamcenter.rac.aif.kernel.AIFComponentContext; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentBOMLine; +import com.teamcenter.rac.kernel.TCComponentBOMWindow; +import com.teamcenter.rac.kernel.TCComponentBOMWindowType; +import com.teamcenter.rac.kernel.TCComponentDataset; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCComponentItemType; +import com.teamcenter.rac.kernel.TCComponentMEProcessRevision; +import com.teamcenter.rac.kernel.TCComponentUser; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.services.rac.cad._2007_01.StructureManagement.ExpandPSData; + +public class GXTZOp extends AbstractAIFOperation { + + private AbstractAIFApplication app; + private TCSession session; + private String groupName; + private String userName; + private String[] prefs; + + public GXTZOp(AbstractAIFApplication app) { + // Auto-generated constructor stub + this.app = app; + this.session = (TCSession) app.getSession(); + + prefs = session.getPreferenceService().getStringValues("CHINT_SRM_SQL_CONNECT"); + } + + @Override + public void executeOperation() throws Exception { + // Auto-generated method stub + MyProgressBarCompent comp = null; + SqlUtil.SRMGetTCDataConnection(prefs); + try { + KUtil.setByPass(true); + groupName = SAPUtil.getGroupID(session); + userName = getUserName(session); + System.out.println(groupName + "------------------" + userName); + InterfaceAIFComponent target = app.getTargetComponent(); + TCComponentItemRevision degignRev = null; + if (target != null && target.getType().equals("ZT2_Design3DRevision")) { + degignRev = (TCComponentItemRevision) target; + + } else { + MessageBox.post("ѡͼֽ汾", "", MessageBox.INFORMATION); + return; + } + + // sqlѯȡӦͼֽid + HashMap sqlMap = new HashMap(); + String selectSql = "SELECT \"drawingno\",\"source\" FROM CHINT_DESIGN__SOURCE_RULE WHERE \"factory\" = '" + + groupName + "'"; + System.out.println("selectSql =========" + selectSql); + ResultSet rs = SqlUtil.read(selectSql); + while (rs.next()) { + sqlMap.put(rs.getString(1), rs.getString(2)); + } + if (sqlMap.size() == 0) { + MessageBox.post("֯δݿлȡͼֽ", "", MessageBox.INFORMATION); + return; + } + System.out.println("sqlMap====" + sqlMap.toString()); + + comp = new MyProgressBarCompent("", "ڽиͼֽ⹺...."); + String lineSeparator = System.lineSeparator();// з + StringBuffer errMessage = new StringBuffer(""); + StringBuffer succMessage = new StringBuffer(""); + succMessage.append("ɹ޸£").append(lineSeparator); + errMessage.append("޷޸£").append(lineSeparator); + String current_user_name = getUserName(session); + TCComponentBOMWindowType bomWinType = (TCComponentBOMWindowType) session.getTypeComponent("BOMWindow"); + TCComponentBOMWindow win = bomWinType.create(null); + TCComponentBOMLine setWindowTopLine = win.setWindowTopLine(degignRev.getItem(), degignRev, null, null); + + // soaȡbom + List childLines = BomToSapUtil.getBomLineTreeNodeSOA2(setWindowTopLine); + System.out.println("childLines.size====" + childLines.size()); + + // ߼ + for (int i = 0; i < childLines.size(); i++) { + TCComponentItemRevision tcComponentItemRevision = childLines.get(i); + String[] properties = tcComponentItemRevision + .getProperties(new String[] { "item_id", "item_revision_id" }); + String zt2_Source = tcComponentItemRevision.getStringProperty("zt2_Source"); + for (Entry map : sqlMap.entrySet()) { + String key = map.getKey(); + if (properties[0].contains(key)) { + String value = map.getValue(); + System.out.println("item_id========" + properties[0]); + if (!zt2_Source.equals(value)) { + + // жǷ񷢲 + if (KUtil.isTCM(tcComponentItemRevision)) { + errMessage.append(properties[0] + "-" + properties[1] + "򷢲޷ģֹ"); + errMessage.append(lineSeparator); + } else { + + // жϵ¼Ƿowning_user + TCComponent owning_user = tcComponentItemRevision.getReferenceProperty("owning_user"); + String user_name = owning_user.getProperty("user_name"); + if (current_user_name.equals(user_name)) { + // ޸İ汾ֵ + tcComponentItemRevision.setProperty("zt2_Source", value); + succMessage.append( + properties[0] + "-" + properties[1] + "Ѵ" + (zt2_Source.equals("S1")?"":"⹺") + "ij" + (value.equals("S1")?"":"⹺")); + succMessage.append(lineSeparator); + } else { + errMessage.append(properties[0] + "-" + properties[1] + "Ϊ" + user_name + + "޷ģϵ" + user_name); + errMessage.append(lineSeparator); + } + + } + + } + } + } + } + + win.close(); + if (comp != null) { + comp.setVisible(false); + } + + MessageBox.post(succMessage.toString() + lineSeparator + errMessage.toString(), "ĿBOMSAP", 2); + } catch (Exception e) { + + e.printStackTrace(); + } finally { + KUtil.setByPass(false); + } + } + + public String getUserName(TCSession session) throws TCException { + TCComponentUser user = session.getUser(); + session.getUserName(); + return user.getTCProperty("user_name").getDisplayValue(); + } + +} diff --git a/com.connor.chint.wuhan/src/com/connor/plm/txdp/TXDPFram.java b/com.connor.chint.wuhan/src/com/connor/plm/txdp/TXDPFram.java index 29d0b95..f234e21 100644 --- a/com.connor.chint.wuhan/src/com/connor/plm/txdp/TXDPFram.java +++ b/com.connor.chint.wuhan/src/com/connor/plm/txdp/TXDPFram.java @@ -18,6 +18,7 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; +import java.text.DecimalFormat; import java.text.SimpleDateFormat; import java.time.LocalDate; import java.time.Month; @@ -145,33 +146,33 @@ public class TXDPFram extends JFrame implements ActionListener { if (this.btnIn.equals(source)) { //߼ String pathJTextFieldStr = pathJTextField.getText(); -// if(pathJTextFieldStr == null || pathJTextFieldStr.isEmpty()) { -// MessageBox.post("ѡҪExcel", "ʾ", 2); -// return; -// } + if(pathJTextFieldStr == null || pathJTextFieldStr.isEmpty()) { + MessageBox.post("ѡҪExcel", "ʾ", 2); + return; + } FileInputStream input = null; try { SqlUtil.SRMGetTCDataConnection(prefs); // // // -// if(!pathJTextFieldStr.contains(".xlsx")) { -// MessageBox.post("ѡ.xlsxʽExcel", "ʾ", 2); -// return; -// } -// -// //жǷдȺ; -// if(xjjTextField == null || xjjTextField.getText().isEmpty()) { -// MessageBox.post("д ¼мȡ ٵ룡", "ʾ", 2); -// return; -// } -// -// if(edmTextField == null || edmTextField.getText().isEmpty()) { -// MessageBox.post("д 롱 룡", "ʾ", 2); -// return; -// } + if(!pathJTextFieldStr.contains(".xlsx")) { + MessageBox.post("ѡ.xlsxʽExcel", "ʾ", 2); + return; + } + + //жǷдȺ; + if(xjjTextField == null || xjjTextField.getText().isEmpty()) { + MessageBox.post("д ¼мȡ ٵ룡", "ʾ", 2); + return; + } + + if(edmTextField == null || edmTextField.getText().isEmpty()) { + MessageBox.post("д 롱 룡", "ʾ", 2); + return; + } - File file = new File("D://a.xlsx"); + File file = new File(pathJTextFieldStr); input = new FileInputStream(file); workbook = new XSSFWorkbook(input); int numberOfSheets = workbook.getNumberOfSheets(); @@ -204,12 +205,17 @@ public class TXDPFram extends JFrame implements ActionListener { Row row4 = sheet0.getRow(4); Row row5 = sheet0.getRow(5); Row row6 = sheet0.getRow(6); + Row row35 = sheet0.getRow(35); + + + + drawingno = getCellValue(row2.getCell(5)); if(drawingno == null || drawingno.isEmpty()) { MessageBox.post("ͼֽŲΪգ", "ʾ", 2); return; } - String insertSqlT1 = "INSERT INTO CHINT_IRON_CORE_SUM(\"lower_clamp_width\",\"yoke_section_distance\",\"drawingno\",\"producttype\",\"productmodel\",\"workcode\",\"core_angle_weight\",\"core_netdiameter\",\"mo\",\"hw\",\"core_cross_secarea\",\"core_filmthick_ness\",\"lamination_coefficient\",\"material_code\",\"reference_cross_sectional_area\",\"stepping_eccentricity_1\",\"stepping_eccentricity_2\",\"stepping_eccentricity_3\",\"step_mode\",\"net_core_weight\") VALUES('"+ + String insertSqlT1 = "INSERT INTO CHINT_IRON_CORE_SUM(\"lower_clamp_width\",\"yoke_section_distance\",\"drawingno\",\"producttype\",\"productmodel\",\"workcode\",\"core_angle_weight\",\"core_netdiameter\",\"mo\",\"hw\",\"core_cross_secarea\",\"core_filmthick_ness\",\"lamination_coefficient\",\"material_code\",\"reference_cross_sectional_area\",\"stepping_eccentricity_1\",\"stepping_eccentricity_2\",\"stepping_eccentricity_3\",\"step_mode\",\"net_core_weight\",\"half_stack\",\"cross_sectional_area_face\") VALUES('"+ xjjTextField.getText()+"','"+ edmTextField.getText()+"','"+ drawingno+"','"+ @@ -229,7 +235,9 @@ public class TXDPFram extends JFrame implements ActionListener { getCellValue(row6.getCell(4))+"','"+ getCellValue(row6.getCell(5))+"','"+ getCellValue(row6.getCell(7))+"','"+ - getCellValue(row6.getCell(10))+"')"; + getCellValue(row6.getCell(10))+"','"+ + getCellValue(row35.getCell(8))+"','"+ + getCellValue(row35.getCell(9))+"')"; System.out.println("insertSqlT1======="+insertSqlT1); @@ -267,6 +275,12 @@ public class TXDPFram extends JFrame implements ActionListener { } } + + + + + + } // if(sheet1 != null) { @@ -295,7 +309,7 @@ public class TXDPFram extends JFrame implements ActionListener { String cellValue = getCellValue(row.getCell(1)); String cellValue2 = getCellValue(row.getCell(2)); System.out.println("cellValue2================================================"+cellValue2); - if(cellValue == null || cellValue.isEmpty() || cellValue2.equals("-0")) { + if(cellValue == null || cellValue.isEmpty() || cellValue2.equals("-0") || cellValue2.equals("-")) { break; }else { @@ -334,7 +348,7 @@ public class TXDPFram extends JFrame implements ActionListener { String cellValue = getCellValue(row.getCell(1)); String cellValue2 = getCellValue(row.getCell(2)); System.out.println("cellValue2================================================"+cellValue2); - if(cellValue == null || cellValue.isEmpty() || cellValue2.equals("-0")) { + if(cellValue == null || cellValue.isEmpty() || cellValue2.equals("-0") || cellValue2.equals("-")) { break; }else { @@ -361,7 +375,239 @@ public class TXDPFram extends JFrame implements ActionListener { } }else if(producttype.equals("")) { - + Sheet sheet0 = workbook.getSheet(""); + Sheet sheet1 = workbook.getSheet("е1"); + Sheet sheet2 = workbook.getSheet("е2"); + Sheet sheet3 = workbook.getSheet("е3"); + Sheet sheet4 = workbook.getSheet("е"); + Sheet sheet5 = workbook.getSheet("е1"); + Sheet sheet6 = workbook.getSheet("е2"); + int lastRowNum = sheet0.getLastRowNum(); + System.out.println("lastRowNum==================="+lastRowNum); + //֯ + if(sheet0 != null) { + //table1 + Row row2 = sheet0.getRow(2); + Row row3 = sheet0.getRow(3); + Row row4 = sheet0.getRow(4); + Row row5 = sheet0.getRow(5); + Row row6 = sheet0.getRow(6); + Row row39 = sheet0.getRow(39); + + + + + + + + + + drawingno = getCellValue(row2.getCell(6)); + if(drawingno == null || drawingno.isEmpty()) { + MessageBox.post("ͼֽŲΪգ", "ʾ", 2); + return; + } + String insertSqlT1 = "INSERT INTO CHINT_IRON_CORE_SUM(\"lower_clamp_width\",\"yoke_section_distance\",\"drawingno\",\"producttype\",\"productmodel\",\"workcode\",\"core_angle_weight\",\"core_netdiameter\",\"mo\",\"hw\",\"core_cross_sectional\",\"core_filmthick_ness\",\"lamination_coefficient\",\"material_code\",\"reference_cross_sectional_area\",\"stepping_eccentricity_1\",\"stepping_eccentricity_2\",\"stepping_eccentricity_3\",\"step_mode\",\"net_core_weight\",\"mo2\",\"half_stack\",\"cross_sectional_area_side\",\"cross_sectional_area_yoke\",\"cross_sectional_area_main\") VALUES('"+ + xjjTextField.getText()+"','"+ + edmTextField.getText()+"','"+ + drawingno+"','"+ + producttype+"','"+ + getCellValue(row2.getCell(3))+"','"+ + getCellValue(row2.getCell(8))+"','"+ + getCellValue(row3.getCell(13))+"','"+ + getCellValue(row4.getCell(3))+"','"+ + getCellValue(row4.getCell(6))+"','"+ + getCellValue(row4.getCell(8))+"','"+ + getCellValue(row4.getCell(13))+"','"+ + getCellValue(row5.getCell(3))+"','"+ + getCellValue(row5.getCell(6))+"','"+ + getCellValue(row5.getCell(8))+"','"+ + getCellValue(row5.getCell(13))+"','"+ + getCellValue(row6.getCell(3))+"','"+ + getCellValue(row6.getCell(4))+"','"+ + getCellValue(row6.getCell(5))+"','"+ + getCellValue(row6.getCell(7))+"','"+ + getCellValue(row6.getCell(13))+"','"+ + getCellValue(row3.getCell(6))+"','"+ + getCellValue(row39.getCell(9))+"','"+ + getCellValue(row39.getCell(10))+"','"+ + getCellValue(row39.getCell(11))+"','"+ + getCellValue(row39.getCell(12))+"')"; + + System.out.println("5insertSqlT1======="+insertSqlT1); + SqlUtil.update(insertSqlT1); + + + + //table2 + for (int i = 8; i < sheet0.getLastRowNum(); i++) { + //жϸǷΪ + Row row = sheet0.getRow(i); + if(row == null) { + break; + }else { + String cellValue = getCellValue(row.getCell(3)); + if(cellValue == null || cellValue.isEmpty()) { + break; + }else { + + String insertSqlT2 = "INSERT INTO CHINT_IRON_CORE_SUM_DETIALS(\"drawingno\",\"producttype\",\"class_number\",\"thickness_perstage\",\"main_column_width\",\"side_column_width\",\"yoke_width\",\"yoke_offset\",\"oil_passage\",\"cumulative_stage_thickness\",\"cross_sectional_area_side\",\"cross_sectional_area_yoke\",\"cross_sectional_area_main\",\"number_pieces\") VALUES('"+ + drawingno+"','"+ + producttype+"','"+ + getCellValue(row.getCell(2))+"','"+ + getCellValue(row.getCell(3))+"','"+ + getCellValue(row.getCell(4))+"','"+ + getCellValue(row.getCell(5))+"','"+ + getCellValue(row.getCell(6))+"','"+ + getCellValue(row.getCell(7))+"','"+ + getCellValue(row.getCell(8))+"','"+ + getCellValue(row.getCell(9))+"','"+ + getCellValue(row.getCell(10))+"','"+ + getCellValue(row.getCell(11))+"','"+ + getCellValue(row.getCell(12))+"','"+ + getCellValue(row.getCell(13))+"')"; + System.out.println("5insertSqlT2======="+insertSqlT2); + SqlUtil.update(insertSqlT2); + } + } + + } + + + + + + + + } + // + if(sheet1 != null) { + + getJqd(sheet1,drawingno,producttype); + } + + if(sheet2 != null) { + + getJqd(sheet2,drawingno,producttype); + } + + if(sheet3 != null) { + + getJqd(sheet3,drawingno,producttype); + } + + // + if(sheet4 != null) { + for (int i =2; i < sheet4.getLastRowNum(); i++) { + //жϸǷΪ + Row row = sheet4.getRow(i); + if(row == null) { + break; + }else { + String cellValue = getCellValue(row.getCell(1)); + String cellValue2 = getCellValue(row.getCell(2)); + if(cellValue == null || cellValue.isEmpty() || cellValue2.equals("-0") || cellValue2.equals("-")) { + break; + }else { + + String insertSqlBz = "INSERT INTO CHINT_IRON_CORE_DETIALS(\"drawingno\",\"producttype\",\"class_number\",\"material_code\",\"slice_number\",\"weight\",\"pkup\",\"pkdn\",\"b\",\"a\",\"c\",\"classification\") VALUES('"+ + drawingno+"','"+ + producttype+"','"+ + getCellValue(row.getCell(1))+"','"+ + getCellValue(row.getCell(2))+"','"+ + getCellValue(row.getCell(3))+"','"+ + getCellValue(row.getCell(4))+"','"+ + getCellValue(row.getCell(5))+"','"+ + getCellValue(row.getCell(6))+"','"+ + getCellValue(row.getCell(7))+"','"+ + getCellValue(row.getCell(8))+"','"+ + getCellValue(row.getCell(9))+"','"+ + ""+"')"; + System.out.println("insertSqlBz======="+insertSqlBz); + SqlUtil.update(insertSqlBz); + } + } + + } + + } + + + //1 + if(sheet5 != null) { + for (int i =2; i < sheet5.getLastRowNum(); i++) { + //жϸǷΪ + System.out.println("i-====================================="+i); + Row row = sheet5.getRow(i); + if(row == null) { + break; + }else { + String cellValue = getCellValue(row.getCell(1)); + String cellValue2 = getCellValue(row.getCell(2)); + System.out.println("cellValue2================================================"+cellValue2); + if(cellValue == null || cellValue.isEmpty() || cellValue2.equals("-0") || cellValue2.equals("-")) { + break; + }else { + + String insertSqlE = "INSERT INTO CHINT_IRON_CORE_DETIALS(\"drawingno\",\"producttype\",\"class_number\",\"material_code\",\"slice_number\",\"weight\",\"pkup\",\"pkdn\",\"b\",\"d\",\"a\",\"c\",\"classification\") VALUES('"+ + drawingno+"','"+ + producttype+"','"+ + getCellValue(row.getCell(1))+"','"+ + getCellValue(row.getCell(2))+"','"+ + getCellValue(row.getCell(3))+"','"+ + getCellValue(row.getCell(4))+"','"+ + getCellValue(row.getCell(5))+"','"+ + getCellValue(row.getCell(6))+"','"+ + getCellValue(row.getCell(7))+"','"+ + getCellValue(row.getCell(8))+"','"+ + getCellValue(row.getCell(9))+"','"+ + getCellValue(row.getCell(10))+"','"+ + "1"+"')"; + System.out.println("insertSqlE1======="+insertSqlE); + SqlUtil.update(insertSqlE); + } + } + + } + + } + + //2 + if(sheet6 != null) { + for (int i =2; i < sheet6.getLastRowNum(); i++) { + //жϸǷΪ + Row row = sheet6.getRow(i); + if(row == null) { + break; + }else { + String cellValue = getCellValue(row.getCell(1)); + String cellValue2 = getCellValue(row.getCell(2)); + if(cellValue == null || cellValue.isEmpty() || cellValue2.equals("-0") || cellValue2.equals("-")) { + break; + }else { + + String insertSqlE = "INSERT INTO CHINT_IRON_CORE_DETIALS(\"drawingno\",\"producttype\",\"class_number\",\"material_code\",\"slice_number\",\"weight\",\"pkup\",\"pkdn\",\"b\",\"d\",\"a\",\"c\",\"classification\") VALUES('"+ + drawingno+"','"+ + producttype+"','"+ + getCellValue(row.getCell(1))+"','"+ + getCellValue(row.getCell(2))+"','"+ + getCellValue(row.getCell(3))+"','"+ + getCellValue(row.getCell(4))+"','"+ + getCellValue(row.getCell(5))+"','"+ + getCellValue(row.getCell(6))+"','"+ + getCellValue(row.getCell(7))+"','"+ + getCellValue(row.getCell(8))+"','"+ + getCellValue(row.getCell(9))+"','"+ + getCellValue(row.getCell(10))+"','"+ + "2"+"')"; + System.out.println("insertSqlE2======="+insertSqlE); + SqlUtil.update(insertSqlE); + } + } + + } + + } }else { MessageBox.post("ģsheetҳ,жϲ", "ʾ", 2); return; @@ -439,10 +685,18 @@ public class TXDPFram extends JFrame implements ActionListener { return cell.getStringCellValue(); }else if(cellType == 3 || cellType == 0) {//num double numericCellValue = cell.getNumericCellValue(); - + System.out.println("numericCellValue====================="+numericCellValue); if(numericCellValue == 0.0) { return ""; } - return cell.getNumericCellValue()+""; + + if (numericCellValue == Math.floor(numericCellValue) && !Double.isInfinite(numericCellValue)) { + long integerPart = (long) numericCellValue; + return integerPart+""; + }else { + return numericCellValue+""; + } + + }else if(cellType == 2) { // 鵥ԪǷǹʽ // FormulaEvaluator @@ -455,10 +709,14 @@ public class TXDPFram extends JFrame implements ActionListener { }else if(valueEval.getCellType() == 0) {//num double numericCellValue = valueEval.getNumberValue(); - + // DecimalFormatָʽģʽ + DecimalFormat df = new DecimalFormat("#.00"); + + // ʽ + String formattedNumber = df.format(numericCellValue); if(numericCellValue == 0.0) { return ""; } - return valueEval.getNumberValue()+""; + return formattedNumber; } } @@ -480,7 +738,7 @@ public class TXDPFram extends JFrame implements ActionListener { String cellValue = getCellValue(row.getCell(1)); String cellValue2 = getCellValue(row.getCell(2)); System.out.println("cellValue2================================================"+cellValue2); - if(cellValue == null || cellValue.isEmpty() || cellValue2.equals("-0")) { + if(cellValue == null || cellValue.isEmpty() || cellValue2.equals("-0") || cellValue2.equals("-")) { break; }else { String insertSqlZz = "INSERT INTO CHINT_IRON_CORE_DETIALS(\"drawingno\",\"producttype\",\"class_number\",\"material_code\",\"slice_number\",\"weight\",\"pkup\",\"pkdn\",\"b\",\"d\",\"joint_number\",\"a\",\"c\",\"classification\") VALUES('"+ diff --git a/com.connor.chint.wuhan/src/com/connor/plm/txdp/TXDPHandler.java b/com.connor.chint.wuhan/src/com/connor/plm/txdp/TXDPHandler.java index c2b3b50..49ab851 100644 --- a/com.connor.chint.wuhan/src/com/connor/plm/txdp/TXDPHandler.java +++ b/com.connor.chint.wuhan/src/com/connor/plm/txdp/TXDPHandler.java @@ -16,6 +16,8 @@ public class TXDPHandler extends AbstractHandler{ TCSession session = (TCSession) app.getSession(); try { + + new Thread() { @Override public void run() {