Browse Source

opt:优化同步sap库存功能

master
DESKTOP-5DIJMF9\admin 1 month ago
parent
commit
a77b57e9aa
  1. 1
      lxservice/com/noblelift/imp/products/mes/service/ifs/sap/SapJCoInterface.java
  2. 49
      lxservice/com/noblelift/imp/products/mes/service/ifs/sap/SapToWmsServiceImpl.java
  3. 7
      lxservice/com/noblelift/imp/products/mes/service/lxrf/ivt/StorBaseServiceImpl.java
  4. 2
      lxservice/com/noblelift/imp/products/mes/service/st/ivt/CheckServiceImpl.java

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

@ -38,6 +38,7 @@ public class SapJCoInterface
try
{
System.out.println("未找到SAP接口连接配置文件" + configFile.getCanonicalPath());
logger.debug("未找到SAP接口连接配置文件:"+configFile.getCanonicalPath());
}
catch (IOException e)
{

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

@ -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");

7
lxservice/com/noblelift/imp/products/mes/service/lxrf/ivt/StorBaseServiceImpl.java

@ -57,6 +57,13 @@ public class StorBaseServiceImpl implements StorBaseService {
stock.put("lgort_begin", sect.optString("ext_id"));
stock.put("lgort_end", sect.optString("ext_id"));
}
//如果查询单一物料号信息,分别查询1060和1061
stock.put("werks_begin", "1060");
stock.put("werks_end", "1060");
sapToWms.getMaterialStock(ctx, null, stock);
stock.put("werks_begin", "1061");
stock.put("werks_end", "1061");
sapToWms.getMaterialStock(ctx, null, stock);
}
orderBy = "struct_name,material_code";

2
lxservice/com/noblelift/imp/products/mes/service/st/ivt/CheckServiceImpl.java

@ -1164,7 +1164,7 @@ public class CheckServiceImpl implements CheckService {
if(mater == null||mater.optString("labst").isEmpty()) {
jo.put("sap_num", "0");
}else {
jo.put("sap_num", mater.optString("Rlabst"));
jo.put("sap_num", mater.optString("labst"));
}
if(jo.optDouble("total_num")>jo.optDouble("check_sum_num")) {
jo.put("result_name", "盘亏");

Loading…
Cancel
Save