出厂编号新增逻辑调整

lidy
李冬阳 1 year ago
parent d185c0f806
commit 876649dd40

@ -631,10 +631,10 @@ public class DYStandardBOMController {
// if (KUtil.isTCM(rev)) { // if (KUtil.isTCM(rev)) {
// topBean.setIsTCM("已发布"); // topBean.setIsTCM("已发布");
// } // }
//
// //20240401优化速度 用sql查询id //20240401优化速度 用sql查询id
//
//
// factoryNos = rev.getRelatedComponents("ZT2_FactoryNumber"); // factoryNos = rev.getRelatedComponents("ZT2_FactoryNumber");
// if (factoryNos != null && factoryNos.length > 0) { // if (factoryNos != null && factoryNos.length > 0) {
// for (int j = 0, len2 = factoryNos.length; j < len2; j++) { // for (int j = 0, len2 = factoryNos.length; j < len2; j++) {
@ -642,7 +642,6 @@ public class DYStandardBOMController {
// } // }
// } // }
String uid = rev.getUid(); String uid = rev.getUid();
@ -679,22 +678,22 @@ public class DYStandardBOMController {
// if(release != null && !release.isEmpty()) { // if(release != null && !release.isEmpty()) {
// topBean.setIsTCM("已发布"); // topBean.setIsTCM("已发布");
// } // }
//
topBean.setIsTCM(release == null ? "":"已发布"); topBean.setIsTCM(release == null ? "":release);
topBean.setStatus_BOM(webNo == null ? "":webNo); topBean.setStatus_BOM(webNo == null ? "":webNo);
topBean.addFactoryID(itemId == null ? "":itemId); topBean.addFactoryID(itemId == null ? "":itemId);
} }
//
// if(rs != null) { if(rs != null) {
// rs.close(); rs.close();
// rs = null; rs = null;
// System.out.println("111111111111111111111111111111111111111111111111111111111111111111111"); System.out.println("111111111111111111111111111111111111111111111111111111111111111111111");
// } }
// if(state != null) { if(state != null) {
// state.close(); state.close();
// } }
//
topBean.getFactoryNo(); topBean.getFactoryNo();
topTreeNode = new DefaultMutableTreeNode(topBean); topTreeNode = new DefaultMutableTreeNode(topBean);
@ -1532,7 +1531,6 @@ public class DYStandardBOMController {
public void revSaveAs(DefaultMutableTreeNode topnode, ProgressBar pb, List<StandardBOMBean> beans) public void revSaveAs(DefaultMutableTreeNode topnode, ProgressBar pb, List<StandardBOMBean> beans)
throws Exception { throws Exception {
KUtil.setByPass(true);
pb.startProgress(); pb.startProgress();
pb.setText("正在修订......"); pb.setText("正在修订......");
KUtil.stopTableEditing(dialog.t_part); KUtil.stopTableEditing(dialog.t_part);
@ -1547,12 +1545,10 @@ public class DYStandardBOMController {
dyBean.setRev(newRev); dyBean.setRev(newRev);
doClickTree(topnode, beans); doClickTree(topnode, beans);
dialog.isUpdate = false; dialog.isUpdate = false;
KUtil.setByPass(false);
} }
public DefaultMutableTreeNode revSaveAs2(DefaultMutableTreeNode topnode, ProgressBar pb, public DefaultMutableTreeNode revSaveAs2(DefaultMutableTreeNode topnode, ProgressBar pb,
List<StandardBOMBean> beans) throws Exception { List<StandardBOMBean> beans) throws Exception {
KUtil.setByPass(true);
pb.startProgress(); pb.startProgress();
pb.setText("正在修订......"); pb.setText("正在修订......");
KUtil.stopTableEditing(dialog.t_part); KUtil.stopTableEditing(dialog.t_part);
@ -1569,7 +1565,6 @@ public class DYStandardBOMController {
topnode.setUserObject(dyBean); topnode.setUserObject(dyBean);
doClickTree(topnode, beans); doClickTree(topnode, beans);
dialog.isUpdate = true; dialog.isUpdate = true;
KUtil.setByPass(false);
return topnode; return topnode;
} }
@ -1661,7 +1656,6 @@ public class DYStandardBOMController {
if (!dialog.isUpdate) { if (!dialog.isUpdate) {
return; return;
} }
KUtil.setByPass(true);
TCComponentItemRevision rev; TCComponentItemRevision rev;
TCComponentBOMLine childLine; TCComponentBOMLine childLine;
StandardBOMBean bean; StandardBOMBean bean;
@ -1781,7 +1775,6 @@ public class DYStandardBOMController {
} }
pb.disposeDialog(); pb.disposeDialog();
dialog.isUpdate = false; dialog.isUpdate = false;
KUtil.setByPass(false);
} }
// List<StandardBOMBean> beans // List<StandardBOMBean> beans

@ -377,7 +377,6 @@ public class DYStandardBOMDialog extends AbstractAIFDialog {
pb.disposeDialog(); pb.disposeDialog();
rev_Is_TCM = false; rev_Is_TCM = false;
} else { } else {
controller.save2(pb, select_node, beans); controller.save2(pb, select_node, beans);
controller.refushTable(beans); controller.refushTable(beans);
} }

@ -54,6 +54,14 @@ public class DYStandardBomBean {
} }
public String getStatus_BOM() {
return status_BOM;
}
public void setStatus_BOM(String status_BOM) {
this.status_BOM = status_BOM;
}
public void getFactoryNo() { public void getFactoryNo() {
if (factoryIDs.size() > 0) { if (factoryIDs.size() > 0) {
factoryID = ZYFactoryUtil.getFactory(factoryIDs, 4); factoryID = ZYFactoryUtil.getFactory(factoryIDs, 4);
@ -134,13 +142,4 @@ public class DYStandardBomBean {
} }
} }
public String getStatus_BOM() {
return status_BOM;
}
public void setStatus_BOM(String status_BOM) {
this.status_BOM = status_BOM;
}
} }

@ -870,8 +870,10 @@ public class FactoryNoZYDialog2zt extends AbstractAIFDialog {
factoryID = factoryID + String.format(c, start + j); factoryID = factoryID + String.format(c, start + j);
}else if(type.equals(ztsvg)) { }else if(type.equals(ztsvg)) {
factoryID = type + String.format(c, start + j); factoryID = type + String.format(c, start + j);
} }else if(isAdd) {
else { String prefix0 = (String) t_bom.getValueAt(0, 5);
factoryID = prefix0 + String.format(c, start + j);
}else {
factoryID = type + dateString + String.format(c, start + j); factoryID = type + dateString + String.format(c, start + j);
} }
list_new_factoryNos.add(factoryID); list_new_factoryNos.add(factoryID);

@ -8,18 +8,11 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.FileReader; import java.io.FileReader;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.Properties;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JFileChooser; import javax.swing.JFileChooser;
@ -57,7 +50,6 @@ public class SpecStatementDialog2 extends AbstractAIFDialog {
private JButton b_path; // 文件保存路径 private JButton b_path; // 文件保存路径
protected JTextField jtf_path; // 文件路径 protected JTextField jtf_path; // 文件路径
private String name;//报表类型 private String name;//报表类型
private String nameEnglish = "";//报表类型
public static final String[] HEADER = new String[] { "", "序号", "方案名称", "物料编码" }; public static final String[] HEADER = new String[] { "", "序号", "方案名称", "物料编码" };
public static final int[] HEADERWIDTH = new int[] { 50, 60, 180, 180 }; public static final int[] HEADERWIDTH = new int[] { 50, 60, 180, 180 };
@ -78,7 +70,6 @@ public class SpecStatementDialog2 extends AbstractAIFDialog {
public void run() { public void run() {
try { try {
initUI(); initUI();
System.out.println("initUI()==============================================");
conntroller.readSpecs(actionInfo); conntroller.readSpecs(actionInfo);
addListeners(); addListeners();
showDialog(); showDialog();
@ -91,32 +82,26 @@ public class SpecStatementDialog2 extends AbstractAIFDialog {
} }
} }
private void initUI() throws IOException { private void initUI() {
this.setPreferredSize(new Dimension(700, 400)); this.setPreferredSize(new Dimension(700, 400));
this.setMinimumSize(new Dimension(650, 400)); this.setMinimumSize(new Dimension(650, 400));
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(BorderLayout.SOUTH, getBtnPanel()); this.add(BorderLayout.SOUTH, getBtnPanel());
this.add(BorderLayout.CENTER, getTablePanel()); this.add(BorderLayout.CENTER, getTablePanel());
this.add(BorderLayout.NORTH, getPathPanel());
switch (actionInfo) { switch (actionInfo) {
case "000": case "000":
this.setTitle("项目规范书报表导出"); // 中压 this.setTitle("项目规范书报表导出"); // 中压
name = "中压项目规范书报表"; name = "中压项目规范书报表";
nameEnglish = "c";
System.out.println("nameEnglish1======="+nameEnglish);
break; break;
case "001": case "001":
this.setTitle("一次规范书汇总报表导出"); // 中压 this.setTitle("一次规范书汇总报表导出"); // 中压
name = "中压一次规范书汇总报表"; name = "中压一次规范书汇总报表";
nameEnglish = "a";
System.out.println("nameEnglish2======="+nameEnglish);
break; break;
case "002": case "002":
this.setTitle("二次规范书汇总报表导出"); // 中压 this.setTitle("二次规范书汇总报表导出"); // 中压
name = "中压二次规范书汇总报表"; name = "中压二次规范书汇总报表";
nameEnglish = "b";
System.out.println("nameEnglish3======="+nameEnglish);
break; break;
case "003": case "003":
@ -129,7 +114,7 @@ public class SpecStatementDialog2 extends AbstractAIFDialog {
break; break;
} }
this.add(BorderLayout.NORTH, getPathPanel());
} }
private void setCompEnabled(boolean b) { private void setCompEnabled(boolean b) {
@ -236,35 +221,22 @@ public class SpecStatementDialog2 extends AbstractAIFDialog {
return panel; return panel;
} }
private JPanel getPathPanel() throws IOException { private JPanel getPathPanel() {
JPanel panel = new JPanel(new PropertyLayout()); JPanel panel = new JPanel(new PropertyLayout());
jtf_path = new JTextField(30); jtf_path = new JTextField(30);
//2022/11/14新增记录保存路径 //2022/11/14新增记录保存路径
//2022/11/14新增记录保存路径 String tempPath = System.getProperty("java.io.tmpdir");
System.out.println("System.getenv(\"Temp\")==========="+System.getenv("Temp")); String tempFilePath = tempPath + File.separator + name + "功能导出路径.txt";
Path configFilePath = Paths.get(System.getenv("Temp")+"//export_dir.config"); File exportFileTxt = new File(tempFilePath);
// 检查文件是否存在,不存在则创建 if(exportFileTxt.exists()) {
if (!Files.exists(configFilePath)) { String[] openTextFile = openTextFile(tempFilePath);
Files.createFile(configFilePath); System.out.println("上次保存路径:"+openTextFile[0]);
} jtf_path.setText(openTextFile[0]);
}else {
Properties properties = new Properties(); File desktopDir = FileSystemView.getFileSystemView().getHomeDirectory();
try (InputStream in = new FileInputStream(System.getenv("Temp")+"//export_dir.config")) { String desktopPath = desktopDir.getAbsolutePath();
properties.load(in); jtf_path.setText(desktopPath);
} }
System.out.println("properties==="+properties.toString());
System.out.println("size==="+properties.size());
System.out.println("nameEnglish======="+nameEnglish);
String property = properties.getProperty(nameEnglish);
if(property != null && !property.isEmpty()) {
jtf_path.setText(property);
}else {
File desktopDir = FileSystemView.getFileSystemView().getHomeDirectory();
String desktopPath = desktopDir.getAbsolutePath();
jtf_path.setText(desktopPath);
}
b_path = new JButton("浏览"); b_path = new JButton("浏览");
panel.add("1.1.left.top", new JLabel("报表保存路径: ")); panel.add("1.1.left.top", new JLabel("报表保存路径: "));
@ -278,13 +250,16 @@ public class SpecStatementDialog2 extends AbstractAIFDialog {
JFileChooser jfc = new JFileChooser(); JFileChooser jfc = new JFileChooser();
FileSystemView fsv = FileSystemView.getFileSystemView(); FileSystemView fsv = FileSystemView.getFileSystemView();
//2022/11/14新增记录保存路径 //2022/11/14新增记录保存路径
String property = properties.getProperty(nameEnglish); String tempPath = System.getProperty("java.io.tmpdir");
if(property != null && !property.isEmpty()) { String tempFilePath = tempPath + File.separator + name + "功能导出路径.txt";
jfc.setCurrentDirectory(new File(property)); File exportFileTxt = new File(tempFilePath);
if(exportFileTxt.exists()) {
String[] openTextFile = openTextFile(tempFilePath);
System.out.println("上次保存路径:"+openTextFile[0]);
jfc.setCurrentDirectory(new File(openTextFile[0]));
}else { }else {
jfc.setCurrentDirectory(fsv.getHomeDirectory()); jfc.setCurrentDirectory(fsv.getHomeDirectory());
} }
System.out.println("111111111111111111111111111111111111111111111111");
jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
jfc.showOpenDialog(SpecStatementDialog2.this); jfc.showOpenDialog(SpecStatementDialog2.this);
@ -293,15 +268,12 @@ public class SpecStatementDialog2 extends AbstractAIFDialog {
System.out.println("->" + f.getAbsolutePath()); System.out.println("->" + f.getAbsolutePath());
jtf_path.setText(f.getAbsolutePath()); jtf_path.setText(f.getAbsolutePath());
//2022/11/14新增记录保存路径 //2022/11/14新增记录保存路径
properties.setProperty(nameEnglish, f.getAbsolutePath()); try {
System.out.println("f.getAbsolutePath()=========="+f.getAbsolutePath()); writeFile(tempFilePath,f.getAbsolutePath());
} } catch (IOException e1) {
// 保存修改后的配置 // TODO Auto-generated catch block
try (OutputStream out = Files.newOutputStream(configFilePath)) { e1.printStackTrace();
properties.store(out, null); }
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} }
} }
}); });

@ -8,18 +8,11 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.FileReader; import java.io.FileReader;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.Properties;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JFileChooser; import javax.swing.JFileChooser;
@ -59,7 +52,7 @@ public class StructExportDialog extends AbstractAIFDialog {
private JTextField jtf_path; // 路径textField private JTextField jtf_path; // 路径textField
private JButton b_path; // 选择路径 private JButton b_path; // 选择路径
private String name; //报名类型 private String name; //报名类型
private String nameEnglish;//报表类型
public StructExportDialog(AbstractAIFApplication app, String actionInfo, ProgressBar pb_start) { public StructExportDialog(AbstractAIFApplication app, String actionInfo, ProgressBar pb_start) {
// TODO Auto-generated constructor stub // TODO Auto-generated constructor stub
super(false); super(false);
@ -70,11 +63,9 @@ public class StructExportDialog extends AbstractAIFDialog {
switch (actionInfo) { switch (actionInfo) {
case "M008_Project": case "M008_Project":
name = "项目报表"; name = "项目报表";
nameEnglish = "d";
break; break;
case "M008_Part": case "M008_Part":
name = "方案报表"; name = "方案报表";
nameEnglish = "e";
break; break;
default: default:
@ -96,7 +87,7 @@ public class StructExportDialog extends AbstractAIFDialog {
} }
} }
private void initUI() throws IOException { private void initUI() {
this.setTitle("结构报表导出"); this.setTitle("结构报表导出");
this.setPreferredSize(new Dimension(500, 400)); this.setPreferredSize(new Dimension(500, 400));
@ -205,35 +196,24 @@ public class StructExportDialog extends AbstractAIFDialog {
return panel; return panel;
} }
private JPanel getPathPanel() throws IOException { private JPanel getPathPanel() {
JPanel panel = new JPanel(new PropertyLayout()); JPanel panel = new JPanel(new PropertyLayout());
// JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT, 15, 5)); // JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT, 15, 5));
jtf_path = new JTextField(30); jtf_path = new JTextField(30);
//2022/11/14新增记录保存路径 //2022/11/14新增记录保存路径
System.out.println("System.getenv(\"Temp\")==========="+System.getenv("Temp")); String tempPath = System.getProperty("java.io.tmpdir");
Path configFilePath = Paths.get(System.getenv("Temp")+"//export_dir.config"); String tempFilePath = tempPath + File.separator + name + "功能导出路径.txt";
// 检查文件是否存在,不存在则创建 File exportFileTxt = new File(tempFilePath);
if (!Files.exists(configFilePath)) { if(exportFileTxt.exists()) {
Files.createFile(configFilePath); String[] openTextFile = openTextFile(tempFilePath);
} System.out.println("上次保存路径:"+openTextFile[0]);
jtf_path.setText(openTextFile[0]);
Properties properties = new Properties();
try (InputStream in = new FileInputStream(System.getenv("Temp")+"//export_dir.config")) {
properties.load(in);
}
System.out.println("properties==="+properties.toString());
System.out.println("size==="+properties.size());
System.out.println("nameEnglish======="+nameEnglish);
String property = properties.getProperty(nameEnglish);
if(property != null && !property.isEmpty()) {
jtf_path.setText(property);
}else { }else {
File desktopDir = FileSystemView.getFileSystemView().getHomeDirectory(); File desktopDir = FileSystemView.getFileSystemView().getHomeDirectory();
String desktopPath = desktopDir.getAbsolutePath(); String desktopPath = desktopDir.getAbsolutePath();
jtf_path.setText(desktopPath); jtf_path.setText(desktopPath);
} }
b_path = new JButton("浏览"); b_path = new JButton("浏览");
panel.add("1.1.left.top", new JLabel("报表保存路径: ")); panel.add("1.1.left.top", new JLabel("报表保存路径: "));
@ -250,13 +230,16 @@ public class StructExportDialog extends AbstractAIFDialog {
JFileChooser jfc = new JFileChooser(); JFileChooser jfc = new JFileChooser();
FileSystemView fsv = FileSystemView.getFileSystemView(); FileSystemView fsv = FileSystemView.getFileSystemView();
//2022/11/14新增记录保存路径 //2022/11/14新增记录保存路径
String property = properties.getProperty(nameEnglish); String tempPath = System.getProperty("java.io.tmpdir");
if(property != null && !property.isEmpty()) { String tempFilePath = tempPath + File.separator + name + "功能导出路径.txt";
jfc.setCurrentDirectory(new File(property)); File exportFileTxt = new File(tempFilePath);
if(exportFileTxt.exists()) {
String[] openTextFile = openTextFile(tempFilePath);
System.out.println("上次保存路径:"+openTextFile[0]);
jfc.setCurrentDirectory(new File(openTextFile[0]));
}else { }else {
jfc.setCurrentDirectory(fsv.getHomeDirectory()); jfc.setCurrentDirectory(fsv.getHomeDirectory());
} }
System.out.println("111111111111111111111111111111111111111111111111");
jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
jfc.showOpenDialog(StructExportDialog.this); jfc.showOpenDialog(StructExportDialog.this);
@ -265,15 +248,12 @@ public class StructExportDialog extends AbstractAIFDialog {
System.out.println("->" + f.getAbsolutePath()); System.out.println("->" + f.getAbsolutePath());
jtf_path.setText(f.getAbsolutePath()); jtf_path.setText(f.getAbsolutePath());
//2022/11/14新增记录保存路径 //2022/11/14新增记录保存路径
properties.setProperty(nameEnglish, f.getAbsolutePath()); try {
System.out.println("f.getAbsolutePath()=========="+f.getAbsolutePath()); writeFile(tempFilePath,f.getAbsolutePath());
} } catch (IOException e1) {
// 保存修改后的配置 // TODO Auto-generated catch block
try (OutputStream out = Files.newOutputStream(configFilePath)) { e1.printStackTrace();
properties.store(out, null); }
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} }
} }
}); });

Loading…
Cancel
Save