Browse Source

opt:sap接口更新

master
DESKTOP-5DIJMF9\admin 2 weeks ago
parent
commit
a72bae7870
  1. 2
      lxapp/app/products/mes/md/cs/SAP_Supimport.jsp
  2. 2
      lxapp/app/products/mes/st/rc/SAP_Workimport.jsp
  3. 8
      lxservice/com/noblelift/imp/products/mes/service/ifs/sap/SapJCoInterface.java
  4. 53
      lxservice/com/noblelift/imp/products/mes/service/ifs/sap/SapToWmsServiceImpl.java

2
lxapp/app/products/mes/md/cs/SAP_Supimport.jsp

@ -52,7 +52,7 @@
var jres = $.str2json(result); var jres = $.str2json(result);
if (jres.code == "1") { //操作成功 if (jres.code == "1") { //操作成功
alert(jres.desc); alert(jres.desc);
$.notify("rc_po_edit");//触发用户添加成功消息 $.notify("supmaint_query");//触发供应商添加成功消息
_close(); _close();
}else{ }else{
alert(jres.desc); alert(jres.desc);

2
lxapp/app/products/mes/st/rc/SAP_Workimport.jsp

@ -52,7 +52,7 @@
var jres = $.str2json(result); var jres = $.str2json(result);
if (jres.code == "1") { //操作成功 if (jres.code == "1") { //操作成功
alert(jres.desc); alert(jres.desc);
$.notify("rc_po_edit");//触发用户添加成功消息 $.notify("bs_workgroup_edit");//触发用户添加成功消息
_close(); _close();
}else{ }else{
alert(jres.desc); alert(jres.desc);

8
lxservice/com/noblelift/imp/products/mes/service/ifs/sap/SapJCoInterface.java

@ -2,6 +2,9 @@ package com.noblelift.imp.products.mes.service.ifs.sap;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import org.wdk.core.bean.WDKLogger;
import com.sap.conn.jco.JCoDestination; import com.sap.conn.jco.JCoDestination;
import com.sap.conn.jco.JCoDestinationManager; import com.sap.conn.jco.JCoDestinationManager;
import com.sap.conn.jco.JCoException; import com.sap.conn.jco.JCoException;
@ -18,7 +21,7 @@ public class SapJCoInterface
public static JCoDestination myConnection; public static JCoDestination myConnection;
private static JCoRepository repository; private static JCoRepository repository;
private static WDKLogger logger = new WDKLogger("SapJCoInterface");
public static JCoRepository getRepository() throws JCoException public static JCoRepository getRepository() throws JCoException
{ {
@ -43,8 +46,9 @@ public class SapJCoInterface
} }
myConnection = JCoDestinationManager.getDestination(configFileName); myConnection = JCoDestinationManager.getDestination(configFileName);
logger.debug("SapJCoInterface myConnection成功:"+myConnection.toString());
repository = myConnection.getRepository(); repository = myConnection.getRepository();
logger.debug("SapJCoInterface repository成功:"+repository.toString());
} }
} }
} }

53
lxservice/com/noblelift/imp/products/mes/service/ifs/sap/SapToWmsServiceImpl.java

@ -40,7 +40,7 @@ public class SapToWmsServiceImpl implements SapToWmsService {
if (flag.equals("1")) { if (flag.equals("1")) {
JCoFunction function; JCoFunction function;
try { try {
function = SapJCoInterface.getRepository().getFunction("ZWMS_GET_PO_INFO"); function = SapJCoInterface.getRepository().getFunction("ZFSWMS_GET_PO_INFO");
JCoParameterList input = function.getImportParameterList(); JCoParameterList input = function.getImportParameterList();
// 是否有物料号的po // 是否有物料号的po
@ -210,7 +210,7 @@ public class SapToWmsServiceImpl implements SapToWmsService {
if (flag.equals("1")) { if (flag.equals("1")) {
JCoFunction function; JCoFunction function;
try { try {
function = SapJCoInterface.getRepository().getFunction("ZWMS_GET_WO_INFO"); function = SapJCoInterface.getRepository().getFunction("ZFSWMS_GET_WO_INFO");
JCoParameterList input = function.getImportParameterList(); JCoParameterList input = function.getImportParameterList();
// 生產訂單號碼 // 生產訂單號碼
input.setValue("P_AUFNR", p_aufnr); input.setValue("P_AUFNR", p_aufnr);
@ -295,7 +295,7 @@ public class SapToWmsServiceImpl implements SapToWmsService {
if (flag.equals("1")) { if (flag.equals("1")) {
JCoFunction function; JCoFunction function;
try { try {
function = SapJCoInterface.getRepository().getFunction("ZWMS_GET_MATERIAL_ISSUELIST"); function = SapJCoInterface.getRepository().getFunction("ZFSWMS_GET_MATERIAL_ISSUELIST");
JCoParameterList input = function.getImportParameterList(); JCoParameterList input = function.getImportParameterList();
input.setValue("P_BUKRS", form.getString("p_bukrs")); input.setValue("P_BUKRS", form.getString("p_bukrs"));
@ -425,7 +425,7 @@ public class SapToWmsServiceImpl implements SapToWmsService {
if (flag.equals("1")) { if (flag.equals("1")) {
JCoFunction function; JCoFunction function;
try { try {
function = SapJCoInterface.getRepository().getFunction("ZWMS_GET_MATERIAL_SHORTLIST"); function = SapJCoInterface.getRepository().getFunction("ZFSWMS_GET_MATERIAL_SHORTLIST");
function.execute(SapJCoInterface.myConnection); function.execute(SapJCoInterface.myConnection);
} catch (JCoException e) { } catch (JCoException e) {
@ -505,7 +505,7 @@ public class SapToWmsServiceImpl implements SapToWmsService {
logger.debug("getMaterialStock-------if之后try之前"); logger.debug("getMaterialStock-------if之后try之前");
JCoFunction function; JCoFunction function;
try { try {
function = SapJCoInterface.getRepository().getFunction("ZWMS_GET_MATERIAL_STOCK"); function = SapJCoInterface.getRepository().getFunction("ZFSWMS_GET_MATERIAL_STOCK");
JCoParameterList input = function.getImportParameterList(); JCoParameterList input = function.getImportParameterList();
JCoTable ZS_MATNR = input.getTable("ZS_MATNR"); JCoTable ZS_MATNR = input.getTable("ZS_MATNR");
@ -686,7 +686,7 @@ public class SapToWmsServiceImpl implements SapToWmsService {
if (flag.equals("1")) { if (flag.equals("1")) {
JCoFunction function; JCoFunction function;
try { try {
function = SapJCoInterface.getRepository().getFunction("ZWMS_GET_MATERIAL"); function = SapJCoInterface.getRepository().getFunction("ZFSWMS_GET_MATERIAL");
JCoParameterList input = function.getImportParameterList(); JCoParameterList input = function.getImportParameterList();
if (!(matnr_begin.isEmpty() || matnr_end.isEmpty())) { if (!(matnr_begin.isEmpty() || matnr_end.isEmpty())) {
@ -891,7 +891,7 @@ public class SapToWmsServiceImpl implements SapToWmsService {
if (flag.equals("1")) { if (flag.equals("1")) {
JCoFunction function; JCoFunction function;
try { try {
function = SapJCoInterface.getRepository().getFunction("ZWMS_GET_MATERIAL_INFO"); function = SapJCoInterface.getRepository().getFunction("ZFSWMS_GET_MATERIAL_INFO");
JCoParameterList input = function.getImportParameterList(); JCoParameterList input = function.getImportParameterList();
input.setValue("P_MATNR", p_matnr); input.setValue("P_MATNR", p_matnr);
@ -956,7 +956,7 @@ public class SapToWmsServiceImpl implements SapToWmsService {
if (flag.equals("1")) { if (flag.equals("1")) {
JCoFunction function; JCoFunction function;
try { try {
function = SapJCoInterface.getRepository().getFunction("ZWMS_GET_VENDOR_INFO"); function = SapJCoInterface.getRepository().getFunction("ZFSWMS_GET_VENDOR_INFO");
JCoParameterList input = function.getImportParameterList(); JCoParameterList input = function.getImportParameterList();
// ----from to // ----from to
JCoTable ZS_ERDAT = input.getTable("ZS_ERDAT"); JCoTable ZS_ERDAT = input.getTable("ZS_ERDAT");
@ -1059,7 +1059,7 @@ public class SapToWmsServiceImpl implements SapToWmsService {
JCoFunction function = null; JCoFunction function = null;
JCoParameterList tablelist = null; JCoParameterList tablelist = null;
try { try {
function = SapJCoInterface.getRepository().getFunction("ZWMS_MATERIAL_STOCK_MOVE"); function = SapJCoInterface.getRepository().getFunction("ZFSWMS_MATERIAL_STOCK_MOVE");
}catch(Exception e) { }catch(Exception e) {
for (int i = 0; i < allrows.size(); i++) { for (int i = 0; i < allrows.size(); i++) {
@ -1186,7 +1186,7 @@ public class SapToWmsServiceImpl implements SapToWmsService {
JCoFunction function = null; JCoFunction function = null;
JCoParameterList tablelist = null; JCoParameterList tablelist = null;
try { try {
function = SapJCoInterface.getRepository().getFunction("ZWMS_MATERIAL_STOCK_UPDATE"); function = SapJCoInterface.getRepository().getFunction("ZFSWMS_MATERIAL_STOCK_UPDATE");
tablelist = function.getTableParameterList(); tablelist = function.getTableParameterList();
}catch(Exception e) { }catch(Exception e) {
e.printStackTrace(); e.printStackTrace();
@ -1405,7 +1405,7 @@ public class SapToWmsServiceImpl implements SapToWmsService {
logger.debug("WOPost------------回传开关已开!"); logger.debug("WOPost------------回传开关已开!");
} }
try { try {
function = SapJCoInterface.getRepository().getFunction("ZWMS_WO_POST"); function = SapJCoInterface.getRepository().getFunction("ZFSWMS_WO_POST");
tablelist = function.getTableParameterList(); tablelist = function.getTableParameterList();
}catch(Exception e) { }catch(Exception e) {
for (int i = 0; i < allrows.size(); i++) { for (int i = 0; i < allrows.size(); i++) {
@ -1780,7 +1780,7 @@ public class SapToWmsServiceImpl implements SapToWmsService {
if (flag.equals("1")) { if (flag.equals("1")) {
JCoFunction function; JCoFunction function;
try { try {
function = SapJCoInterface.getRepository().getFunction("ZWMS_GET_WO_COMPONENT"); function = SapJCoInterface.getRepository().getFunction("ZFSWMS_GET_WO_COMPONENT");
JCoParameterList input = function.getImportParameterList(); JCoParameterList input = function.getImportParameterList();
// 生產訂單號碼 // 生產訂單號碼
input.setValue("IN_AUFNR", aufnr); input.setValue("IN_AUFNR", aufnr);
@ -1897,7 +1897,7 @@ public class SapToWmsServiceImpl implements SapToWmsService {
} }
JCoFunction function = null; JCoFunction function = null;
try { try {
function = SapJCoInterface.getRepository().getFunction("ZWMS_GET_WO_SEND"); function = SapJCoInterface.getRepository().getFunction("ZFSWMS_GET_WO_SEND");
}catch(Exception e) { }catch(Exception e) {
JSONObject joi = new JSONObject(); JSONObject joi = new JSONObject();
@ -2011,8 +2011,10 @@ public class SapToWmsServiceImpl implements SapToWmsService {
if (flag.equals("1")) { if (flag.equals("1")) {
JCoFunction function; JCoFunction function;
try { try {
function = SapJCoInterface.getRepository().getFunction("ZWMS_GET_WORKCENTER"); function = SapJCoInterface.getRepository().getFunction("ZFSWMS_GET_WORKCENTER");
logger.debug("JCO function [ZFSWMS_GET_WORKCENTER]:"+function.toString() );
JCoParameterList input = function.getImportParameterList(); JCoParameterList input = function.getImportParameterList();
JCoTable IN_ERDAT = input.getTable("IN_ERDAT"); JCoTable IN_ERDAT = input.getTable("IN_ERDAT");
IN_ERDAT.appendRow(); IN_ERDAT.appendRow();
@ -2051,7 +2053,7 @@ public class SapToWmsServiceImpl implements SapToWmsService {
// SAP组盘表 // SAP组盘表
String IF_SAP_WorkGroup = "IF_SAP_WorkGroup"; String IF_SAP_WorkGroup = "IF_SAP_WorkGroup";
WQLObject wo_IssueBillUrgent = WQLObject.getWQLObject(IF_SAP_WorkGroup); WQLObject wo_SAP_WorkGroup = WQLObject.getWQLObject(IF_SAP_WorkGroup);
WQLObject ST_BS_WorkGroup = WQLObject.getWQLObject("ST_BS_WorkGroup"); WQLObject ST_BS_WorkGroup = WQLObject.getWQLObject("ST_BS_WorkGroup");
for (int i = 0; i < tblexport.getNumRows(); i++) { for (int i = 0; i < tblexport.getNumRows(); i++) {
tblexport.setRow(i); tblexport.setRow(i);
@ -2061,11 +2063,11 @@ public class SapToWmsServiceImpl implements SapToWmsService {
joi.put("id", id); joi.put("id", id);
String ARBPL = tblexport.getString("ARBPL"); String ARBPL = tblexport.getString("ARBPL");
String KTEXT = tblexport.getString("KTEXT"); String KTEXT = tblexport.getString("KTEXT");
JSONObject group = wo_IssueBillUrgent.query("ARBPL = '" + ARBPL + "'").uniqueResult(0); JSONObject group = wo_SAP_WorkGroup.query("ARBPL = '" + ARBPL + "'").uniqueResult(0);
if (group == null) { if (group == null) {
joi.put("ARBPL", ARBPL); joi.put("ARBPL", ARBPL);
joi.put("KTEXT", KTEXT); joi.put("KTEXT", KTEXT);
wo_IssueBillUrgent.insert(joi); wo_SAP_WorkGroup.insert(joi);
row.put("group_uuid", id); row.put("group_uuid", id);
row.put("group_name", ARBPL); row.put("group_name", ARBPL);
@ -2079,13 +2081,14 @@ public class SapToWmsServiceImpl implements SapToWmsService {
row.put("SYSUPDATEDATE", WDK.getDateTime()); row.put("SYSUPDATEDATE", WDK.getDateTime());
ST_BS_WorkGroup.insert(row); ST_BS_WorkGroup.insert(row);
} else { } else {
group.put("KTEXT", tblexport.getString("KTEXT")); group.put("ktext", tblexport.getString("KTEXT"));
wo_IssueBillUrgent.update(joi); wo_SAP_WorkGroup.update(joi);
row = ST_BS_WorkGroup.query("group_uuid = '" + group.optString("id") + "'").uniqueResult(0); row = ST_BS_WorkGroup.query("group_uuid = '" + group.optString("id") + "'").uniqueResult(0);
row.put("simple_name", KTEXT); HashMap<String, String> map = new HashMap<>();
row.put("SYSUPDATORUUID", "0000"); map.put("simple_name", KTEXT);
row.put("SYSUPDATEDATE", WDK.getDateTime()); map.put("sysupdatoruuid", "0000");
ST_BS_WorkGroup.update(row); map.put("sysupdatedate", WDK.getDateTime());
ST_BS_WorkGroup.update(map, "group_uuid=?", new String[] {row.optString("id")});
} }
} }
} }
@ -2104,7 +2107,7 @@ public class SapToWmsServiceImpl implements SapToWmsService {
JCoFunction function = null; JCoFunction function = null;
JCoParameterList tablelist = null; JCoParameterList tablelist = null;
try { try {
function = SapJCoInterface.getRepository().getFunction("ZWMS_PO_POST"); function = SapJCoInterface.getRepository().getFunction("ZFSWMS_PO_POST");
}catch(Exception e) { }catch(Exception e) {
for (int i = 0; i < allrows.size(); i++) { for (int i = 0; i < allrows.size(); i++) {

Loading…
Cancel
Save