erzhongxmu 2023-10-13 17:22:44 +08:00
parent e19a83fdd9
commit 175077f02b
3 changed files with 1 additions and 179 deletions

View File

@ -1,119 +0,0 @@
package com.zzjee.sap;
import org.jeecgframework.core.util.ResourceUtil;
import java.sql.*;
public class hanautil {
// public static void main(String[] args) {
//// String DRIVER = "com.sap.cloud.db.jdbc.Driver"; //jdbc 4.0
//// String cosFilePath = "/jeewx_logo.jpg";
//// String localFilePath1 = "C:\\Users\\qinfeng\\Desktop\\jeewx_logo.jpg";
//// //上传文件
//// JSONObject getFileResult= QCloudUtils.upload(cosFilePath,localFilePath1);
// QCloudDemo demo = new QCloudDemo();
// try {
// demo.select();
// } catch (Exception e) {
// e.printStackTrace();
// }
// //获取文档列表
// //JSONObject getFileResult= QCloudUtils.listByFoler("/");
//// System.out.println(getFileResult);
// }
//根据防伪码获取物料详细信息
public String select(String id) throws Exception {
String sap_hana= ResourceUtil.getConfigByName("sap_hana");
String sap_user=ResourceUtil.getConfigByName("sap_user");
String sap_password=ResourceUtil.getConfigByName("sap_password");
String result=null;
Connection con = this.getConnection("com.sap.db.jdbc.Driver", sap_hana, sap_user, sap_password);
PreparedStatement pstmt = con.prepareStatement("SELECT T.BRAND, T.SAP,T.STYLE,T.COLOR_CD,BD.BARCODE FROM SMS.BL_PRODUCT T INNER JOIN SMS.BL_DPATCH BD ON T.CODE_NAME = BD.PRODUCT_ID WHERE BD.BARCODE = '"+id+"'");
ResultSet rs = pstmt.executeQuery();
result = this.processResult(rs);
this.closeConnection(con, pstmt);
return result;
}
//根据防伪码获取物料详细信息
public String selectdetail(String id) throws Exception {
String sap_hana= ResourceUtil.getConfigByName("sap_hana");
String sap_user=ResourceUtil.getConfigByName("sap_user");
String sap_password=ResourceUtil.getConfigByName("sap_password");
String result=null;
Connection con = this.getConnection("com.sap.db.jdbc.Driver", sap_hana, sap_user, sap_password);
PreparedStatement pstmt = con.prepareStatement("SELECT T.BRAND, T.SAP,T.STYLE,T.COLOR_CD,BD.BARCODE,t.URL FROM SMS.BL_PRODUCT T INNER JOIN SMS.BL_DPATCH BD ON T.CODE_NAME = BD.PRODUCT_ID WHERE BD.BARCODE = '"+id+"'");
ResultSet rs = pstmt.executeQuery();
result = this.processResult(rs);
this.closeConnection(con, pstmt);
return result;
}
//根据防伪码获取sap物料号
public String selectmatnr(String id) throws Exception {
String sap_hana= ResourceUtil.getConfigByName("sap_hana");
String sap_user=ResourceUtil.getConfigByName("sap_user");
String sap_password=ResourceUtil.getConfigByName("sap_password");
String result=null;
Connection con = this.getConnection("com.sap.db.jdbc.Driver", sap_hana, sap_user, sap_password);
PreparedStatement pstmt = con.prepareStatement("SELECT T.SAP FROM SMS.BL_PRODUCT T INNER JOIN SMS.BL_DPATCH BD ON T.CODE_NAME = BD.PRODUCT_ID WHERE BD.BARCODE = '"+id+"'");
ResultSet rs = pstmt.executeQuery();
result = this.processResult(rs);
this.closeConnection(con, pstmt);
return result;
}
private String processResult(ResultSet rs) throws Exception {
String result=null;
if (rs.next()) {
ResultSetMetaData rsmd = rs.getMetaData();
int colNum = rsmd.getColumnCount();
for (int i = 1; i <= colNum; i++) {
if (i == 1) {
System.out.print(rsmd.getColumnName(i));
} else {
System.out.print("\t" + rsmd.getColumnName(i));
}
}
System.out.print("\n");
System.out.println("———————–");
do {
for (int i = 1; i <= colNum; i++) {
if (i == 1) {
result = rs.getString(i);
} else {
result = result + ":"+rs.getString(i);
}
}
System.out.print("\n");
} while (rs.next());
} else {
System.out.println("query not result.");
}
return result;
}
private Connection getConnection(String driver, String url, String user,
String password) throws Exception {
Class.forName(driver);
return DriverManager.getConnection(url, user, password);
}
private void closeConnection(Connection con, Statement stmt)
throws Exception {
if (stmt != null) {
stmt.close();
}
if (con != null) {
con.close();
}
}
}

View File

@ -43,23 +43,6 @@ public class sapWmUtil {
return result;
}
//获取镭射清单
//
public static Map<String,Object> getWmlsqd(String ZLSQD) {
Map<String, Object> result = new HashMap<String, Object>();
try {
SapRFC saprfc = SapRFC.getInstance();
saprfc.prepare("Z_WM_CCS_SAP");
saprfc.addParameter("ZLSQD", ZLSQD);
saprfc.addParameter("ZCCSTYPE", "R");
saprfc.execCall();
JCoTable tab = saprfc.getResultTable("IT_OUT");
result.put("IT_OUT", tab);
} catch (Exception e) {
System.out.print(e.getMessage());
}
return result;
}
//获取WM单据
//
@ -102,10 +85,6 @@ public class sapWmUtil {
}
return result;
}
//获取镭射清单
//
public static Map<String,Object> getcwkc(String LGNUM,String MATNR,String LGPLA) {
Map<String, Object> result = new HashMap<String, Object>();
@ -130,29 +109,5 @@ public class sapWmUtil {
return result;
}
//更新镭射清单
//
public static Map<String,Object> updateWmlsqd(Map<String,Object> inmap) {
Map<String, Object> result = new HashMap<String, Object>();
try {
SapRFC saprfc = SapRFC.getInstance();
saprfc.prepare("Z_WM_CCS_SAP");
saprfc.addParameter("ZLSQD", inmap.get("ZLSQD").toString());
saprfc.addParameter("ZCCSTYPE", inmap.get("ZCCSTYPE").toString());
JCoTable tabin = saprfc.getParamTableList("IT_IN");
tabin.appendRow();
tabin.appendRows(0);
tabin.setValue("ZLSQD","1");
tabin.setValue("ZPGDH","1");
tabin.setValue("AUFNR","1");
saprfc.execCall();
JCoTable tabout = saprfc.getResultTable("IT_OUT");
System.out.print("rows:" + tabout.getNumRows());
result.put("IT_OUT", tabout);
} catch (Exception e) {
System.out.print(e.getMessage());
}
return result;
}
}

View File

@ -10,21 +10,7 @@ import java.util.List;
import java.util.Map;
public class sapgetdocutil {
//获取镭射清单
public static List<wmientity> getlsqd(String id, String par[]){
Map<String, Object> result = new HashMap<String, Object>();
List<wmientity> reslit = new ArrayList<wmientity>();
try {
result = sapWmUtil.getWmlsqd(id);
JCoTable restable = (JCoTable)result.get("IT_OUT");
org.jeecgframework.core.util.LogUtil.info("===================获取镭射清单开始===================");
reslit = getlistbyparandrable(restable,par);
org.jeecgframework.core.util.LogUtil.info("===================获取镭射清单开始===================");
} catch (Exception e) {
e.printStackTrace();
}
return reslit;
}
//获取WMDOC
public static List<wmientity> getWmdoc(String DOCTYPE,String DOCID,String tablename,String par[]) {
// Map<String, Object> result = new HashMap<String, Object>();