|
|
@ -20,6 +20,7 @@ import com.noblelift.imp.products.mes.api.ifs.sap.SapToWmsService; |
|
|
|
import com.sap.conn.jco.JCoException; |
|
|
|
import com.sap.conn.jco.JCoFunction; |
|
|
|
import com.sap.conn.jco.JCoParameterList; |
|
|
|
import com.sap.conn.jco.JCoRepository; |
|
|
|
import com.sap.conn.jco.JCoTable; |
|
|
|
|
|
|
|
import net.sf.json.JSONArray; |
|
|
@ -56,7 +57,7 @@ public class SapToWmsServiceImpl implements SapToWmsService { |
|
|
|
|
|
|
|
} catch (JCoException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
throw new WDKException("SapJCoInterface接口连接失败" + e.getMessage()); |
|
|
|
throw new WDKException("SapJCoInterface接口连接失败:" + e.getMessage()); |
|
|
|
} |
|
|
|
JCoParameterList tablelist = function.getTableParameterList(); |
|
|
|
if(tablelist==null) { |
|
|
@ -217,7 +218,7 @@ public class SapToWmsServiceImpl implements SapToWmsService { |
|
|
|
function.execute(SapJCoInterface.myConnection); |
|
|
|
} catch (JCoException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
throw new WDKException("SapJCoInterface接口连接失败" + e.getMessage()); |
|
|
|
throw new WDKException("SapJCoInterface接口连接失败:" + e.getMessage()); |
|
|
|
} |
|
|
|
JCoParameterList tablelist = function.getTableParameterList(); |
|
|
|
if(tablelist==null) { |
|
|
@ -309,7 +310,7 @@ public class SapToWmsServiceImpl implements SapToWmsService { |
|
|
|
function.execute(SapJCoInterface.myConnection); |
|
|
|
} catch (JCoException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
throw new WDKException("SapJCoInterface接口连接失败" + e.getMessage()); |
|
|
|
throw new WDKException("SapJCoInterface接口连接失败:" + e.getMessage()); |
|
|
|
} |
|
|
|
// 班组发料信息导入: "根据日期导入当天的班组发料清单;
|
|
|
|
JCoParameterList tablelist = function.getTableParameterList(); |
|
|
@ -430,7 +431,7 @@ public class SapToWmsServiceImpl implements SapToWmsService { |
|
|
|
function.execute(SapJCoInterface.myConnection); |
|
|
|
} catch (JCoException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
throw new WDKException("SapJCoInterface接口连接失败" + e.getMessage()); |
|
|
|
throw new WDKException("SapJCoInterface接口连接失败:" + e.getMessage()); |
|
|
|
} |
|
|
|
JCoParameterList tablelist = function.getTableParameterList(); |
|
|
|
if(tablelist==null) { |
|
|
@ -491,12 +492,15 @@ public class SapToWmsServiceImpl implements SapToWmsService { |
|
|
|
@WDKTransaction |
|
|
|
public ServiceResultBean getMaterialStock(ServiceContext context, JSONObject accountId, JSONObject form) { |
|
|
|
ServiceResultBean srb = new ServiceResultBean(); |
|
|
|
//实际使用中为单值查询,因为区间数据量较大
|
|
|
|
String matnr_begin = form.optString("matnr_begin"); |
|
|
|
String matnr_end = form.optString("matnr_end"); |
|
|
|
String werks_begin = form.optString("werks_begin",""); |
|
|
|
String werks_end = form.optString("werks_end",""); |
|
|
|
//如果查询未填入工厂编码,默认查1060
|
|
|
|
String werks_begin = form.optString("werks_begin","1060"); |
|
|
|
String werks_end = form.optString("werks_end","1060"); |
|
|
|
String lgort_begin = form.optString("lgort_begin"); |
|
|
|
String lgort_end = form.optString("lgort_end"); |
|
|
|
|
|
|
|
String flag = querySAPparam(); |
|
|
|
String nums = ""; |
|
|
|
String IF_SAP_MaterStock = "IF_SAP_MaterStock"; |
|
|
@ -536,7 +540,7 @@ public class SapToWmsServiceImpl implements SapToWmsService { |
|
|
|
function.execute(SapJCoInterface.myConnection); |
|
|
|
} catch (JCoException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
throw new WDKException("SapJCoInterface接口连接失败" + e.getMessage()); |
|
|
|
throw new WDKException("SapJCoInterface接口连接失败:" + e.getMessage()); |
|
|
|
} |
|
|
|
JCoParameterList tablelist = function.getTableParameterList(); |
|
|
|
if(tablelist==null) { |
|
|
@ -589,7 +593,7 @@ public class SapToWmsServiceImpl implements SapToWmsService { |
|
|
|
|
|
|
|
// 物料实时库存接口表
|
|
|
|
|
|
|
|
WQLObject wo_IssueBillUrgent = WQLObject.getWQLObject(IF_SAP_MaterStock); |
|
|
|
WQLObject wo_IF_SAP_MaterStock = WQLObject.getWQLObject(IF_SAP_MaterStock); |
|
|
|
WQLObject ST_BS_SectAttr = WQLObject.getWQLObject("ST_BS_SectAttr"); |
|
|
|
logger.debug("数据数量:" + tblexport.getNumRows()); |
|
|
|
nums = tblexport.getNumRows() + ""; |
|
|
@ -642,7 +646,7 @@ public class SapToWmsServiceImpl implements SapToWmsService { |
|
|
|
joi.put("id", WDK.getUUID()); |
|
|
|
joi.put("stor_id", stor_uuid); |
|
|
|
// 新增
|
|
|
|
wo_IssueBillUrgent.insert(joi); |
|
|
|
wo_IF_SAP_MaterStock.insert(joi); |
|
|
|
} |
|
|
|
|
|
|
|
if (tblexport.getNumRows() == 0) { |
|
|
@ -686,8 +690,10 @@ public class SapToWmsServiceImpl implements SapToWmsService { |
|
|
|
if (flag.equals("1")) { |
|
|
|
JCoFunction function; |
|
|
|
try { |
|
|
|
function = SapJCoInterface.getRepository().getFunction("ZFSWMS_GET_MATERIAL"); |
|
|
|
|
|
|
|
JCoRepository re = SapJCoInterface.getRepository(); |
|
|
|
logger.debug("JCoRepository成功:" + re); |
|
|
|
function = re.getFunction("ZFSWMS_GET_MATERIAL"); |
|
|
|
logger.debug("function成功:" + function); |
|
|
|
JCoParameterList input = function.getImportParameterList(); |
|
|
|
if (!(matnr_begin.isEmpty() || matnr_end.isEmpty())) { |
|
|
|
JCoTable ZS_MATNR = input.getTable("ZS_MATNR"); |
|
|
@ -707,7 +713,7 @@ public class SapToWmsServiceImpl implements SapToWmsService { |
|
|
|
function.execute(SapJCoInterface.myConnection); |
|
|
|
} catch (JCoException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
throw new WDKException("SapJCoInterface接口连接失败" + e.getMessage()); |
|
|
|
throw new WDKException("SapJCoInterface接口连接失败:" + e.getMessage()); |
|
|
|
} |
|
|
|
JCoParameterList tablelist = function.getTableParameterList(); |
|
|
|
if(tablelist==null) { |
|
|
@ -832,6 +838,7 @@ public class SapToWmsServiceImpl implements SapToWmsService { |
|
|
|
wmsmaterial.put("is_dull", "0"); |
|
|
|
ST_BS_WMSMaterialIsDull.insert(wmsmaterial); |
|
|
|
|
|
|
|
//暂时屏蔽1061的物料
|
|
|
|
wmsmaterial.put("wmsmaterial_uuid", "uuid-" + MATNR + "-1061"); |
|
|
|
wmsmaterial.put("factory_uuid", "1061"); |
|
|
|
ST_BS_WMSMaterial.insert(wmsmaterial); |
|
|
@ -898,7 +905,7 @@ public class SapToWmsServiceImpl implements SapToWmsService { |
|
|
|
function.execute(SapJCoInterface.myConnection); |
|
|
|
} catch (JCoException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
throw new WDKException("SapJCoInterface接口连接失败" + e.getMessage()); |
|
|
|
throw new WDKException("SapJCoInterface接口连接失败:" + e.getMessage()); |
|
|
|
} |
|
|
|
JCoParameterList tablelist = function.getTableParameterList(); |
|
|
|
if(tablelist==null) { |
|
|
@ -969,7 +976,7 @@ public class SapToWmsServiceImpl implements SapToWmsService { |
|
|
|
function.execute(SapJCoInterface.myConnection); |
|
|
|
} catch (JCoException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
throw new WDKException("SapJCoInterface接口连接失败" + e.getMessage()); |
|
|
|
throw new WDKException("SapJCoInterface接口连接失败:" + e.getMessage()); |
|
|
|
} |
|
|
|
JCoParameterList tablelist = function.getTableParameterList(); |
|
|
|
if(tablelist==null) { |
|
|
@ -1112,7 +1119,7 @@ public class SapToWmsServiceImpl implements SapToWmsService { |
|
|
|
function.execute(SapJCoInterface.myConnection); |
|
|
|
} catch (JCoException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
throw new WDKException("SapJCoInterface接口连接失败" + e.getMessage()); |
|
|
|
throw new WDKException("SapJCoInterface接口连接失败:" + e.getMessage()); |
|
|
|
} |
|
|
|
// 表输出
|
|
|
|
JCoTable tblexport = tablelist.getTable("IT_STOCKMOVEOT"); |
|
|
@ -1222,7 +1229,7 @@ public class SapToWmsServiceImpl implements SapToWmsService { |
|
|
|
function.execute(SapJCoInterface.myConnection); |
|
|
|
} catch (JCoException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
throw new WDKException("SapJCoInterface接口连接失败" + e.getMessage()); |
|
|
|
throw new WDKException("SapJCoInterface接口连接失败:" + e.getMessage()); |
|
|
|
} |
|
|
|
JCoParameterList result = function.getExportParameterList(); |
|
|
|
// 信息提示
|
|
|
@ -1450,7 +1457,7 @@ public class SapToWmsServiceImpl implements SapToWmsService { |
|
|
|
function.execute(SapJCoInterface.myConnection); |
|
|
|
} catch (JCoException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
throw new WDKException("SapJCoInterface接口连接失败" + e.getMessage()); |
|
|
|
throw new WDKException("SapJCoInterface接口连接失败:" + e.getMessage()); |
|
|
|
} |
|
|
|
// 表输出
|
|
|
|
JCoTable tblexport = tablelist.getTable("IT_WOPOSTOT"); |
|
|
@ -1795,7 +1802,7 @@ public class SapToWmsServiceImpl implements SapToWmsService { |
|
|
|
function.execute(SapJCoInterface.myConnection); |
|
|
|
} catch (JCoException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
throw new WDKException("SapJCoInterface接口连接失败" + e.getMessage()); |
|
|
|
throw new WDKException("SapJCoInterface接口连接失败:" + e.getMessage()); |
|
|
|
} |
|
|
|
JCoParameterList result = function.getExportParameterList(); |
|
|
|
// 信息提示
|
|
|
@ -1933,7 +1940,7 @@ public class SapToWmsServiceImpl implements SapToWmsService { |
|
|
|
function.execute(SapJCoInterface.myConnection); |
|
|
|
} catch (JCoException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
throw new WDKException("SapJCoInterface接口连接失败" + e.getMessage()); |
|
|
|
throw new WDKException("SapJCoInterface接口连接失败:" + e.getMessage()); |
|
|
|
} |
|
|
|
JCoParameterList result = function.getExportParameterList(); |
|
|
|
// 信息提示
|
|
|
@ -2026,7 +2033,7 @@ public class SapToWmsServiceImpl implements SapToWmsService { |
|
|
|
function.execute(SapJCoInterface.myConnection); |
|
|
|
} catch (JCoException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
throw new WDKException("SapJCoInterface接口连接失败" + e.getMessage()); |
|
|
|
throw new WDKException("SapJCoInterface接口连接失败:" + e.getMessage()); |
|
|
|
} |
|
|
|
JCoParameterList tablelist = function.getTableParameterList(); |
|
|
|
if(tablelist==null) { |
|
|
@ -2155,7 +2162,7 @@ public class SapToWmsServiceImpl implements SapToWmsService { |
|
|
|
function.execute(SapJCoInterface.myConnection); |
|
|
|
} catch (JCoException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
throw new WDKException("SapJCoInterface接口连接失败" + e.getMessage()); |
|
|
|
throw new WDKException("SapJCoInterface接口连接失败:" + e.getMessage()); |
|
|
|
} |
|
|
|
// 表输出
|
|
|
|
JCoTable tblexport = tablelist.getTable("IT_POPOSTOT"); |
|
|
|