|
|
|
@ -459,10 +459,89 @@ public class SapItemSyncImpl implements SapItemSyncService {
|
|
|
|
|
log.info("成品备货单参数-------" + mapList.toString());
|
|
|
|
|
JCoTable S_TDDAT = func.getTableParameterList().getTable("S_TDDAT");
|
|
|
|
|
JCoTable S_MATNR = func.getTableParameterList().getTable("S_MATNR");
|
|
|
|
|
System.out.println(S_TDDAT);
|
|
|
|
|
System.out.println(S_MATNR);
|
|
|
|
|
if (mapList==null || mapList.size()==0)
|
|
|
|
|
{
|
|
|
|
|
return R.fail("参数不能为空");
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isNotEmpty(mapList.get("S_MATNR").toString())){
|
|
|
|
|
S_TDDAT.appendRow();
|
|
|
|
|
S_TDDAT.setValue(Constants.SIGN, "I");
|
|
|
|
|
S_TDDAT.setValue(Constants.OPTION, "BT");
|
|
|
|
|
S_TDDAT.setValue(Constants.LOW, "20231201");
|
|
|
|
|
S_TDDAT.setValue(Constants.LOW, mapList.get("S_MATNR").toString());
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isNotEmpty(mapList.get("S_TDDAT").toString())){
|
|
|
|
|
S_TDDAT.appendRow();
|
|
|
|
|
S_TDDAT.setValue(Constants.SIGN, "I");
|
|
|
|
|
S_TDDAT.setValue(Constants.OPTION, "BT");
|
|
|
|
|
S_TDDAT.setValue(Constants.LOW, mapList.get("S_TDDAT").toString());
|
|
|
|
|
S_TDDAT.setValue(Constants.HIGH, END_DATE);
|
|
|
|
|
}
|
|
|
|
|
func.execute(dest);//执行调用函数
|
|
|
|
|
String RETCODE=func.getExportParameterList().getString("RETCODE");
|
|
|
|
|
String MSG=func.getExportParameterList().getString("MSG");
|
|
|
|
|
JCoTable maraTable = func.getTableParameterList().getTable("LT_CP");
|
|
|
|
|
List<Map<String,String>> mapResult=new ArrayList<>();
|
|
|
|
|
for (int i = 0; i < maraTable.getNumRows(); i++) {
|
|
|
|
|
maraTable.setRow(i);
|
|
|
|
|
Map map=new HashMap();
|
|
|
|
|
String MATNR=maraTable.getString("MATNR");//物料号
|
|
|
|
|
String MAKTX=maraTable.getString("MAKTX");//物料描述
|
|
|
|
|
String VBELN=maraTable.getString("VBELN");//交货单
|
|
|
|
|
String VBELN_VA=maraTable.getString("VBELN_VA");//销售单
|
|
|
|
|
String MENGE=maraTable.getString("MENGE");//数量
|
|
|
|
|
String MEINS=maraTable.getString("MEINS");//单位
|
|
|
|
|
String TDDAT=maraTable.getString("TDDAT");//计划日期
|
|
|
|
|
String KUNNR=maraTable.getString("KUNNR");//送达方
|
|
|
|
|
String KUNNR_NM=maraTable.getString("KUNNR_NM");//送达方描述
|
|
|
|
|
String LIFNR=maraTable.getString("LIFNR");//货运代理
|
|
|
|
|
String LIFNR_NM=maraTable.getString("LIFNR_NM");//货运代理描述
|
|
|
|
|
String ZSAREA=maraTable.getString("ZSAREA");//销售大区
|
|
|
|
|
String BZTXT1=maraTable.getString("BZTXT1");//销售大区描述
|
|
|
|
|
log.info("物料号"+MATNR+"物料描述"+MAKTX+"交货单"+VBELN+"销售单"+VBELN_VA+
|
|
|
|
|
"数量"+MENGE+"单位"+MEINS+"计划日期"+TDDAT+"送达方"+KUNNR+"送达方描述"+KUNNR_NM+"货运代理"+LIFNR+
|
|
|
|
|
"货运代理描述"+LIFNR_NM+"销售大区"+ZSAREA+"销售大区描述"+BZTXT1);
|
|
|
|
|
map.put("MATNR",MATNR);
|
|
|
|
|
map.put("MAKTX",MAKTX);
|
|
|
|
|
map.put("VBELN",VBELN);
|
|
|
|
|
map.put("VBELN_VA",VBELN_VA);
|
|
|
|
|
map.put("MENGE",MENGE);
|
|
|
|
|
map.put("MEINS",MEINS);
|
|
|
|
|
map.put("TDDAT",TDDAT);
|
|
|
|
|
map.put("KUNNR",KUNNR);
|
|
|
|
|
map.put("KUNNR_NM",KUNNR_NM);
|
|
|
|
|
map.put("LIFNR",LIFNR);
|
|
|
|
|
map.put("LIFNR_NM",LIFNR_NM);
|
|
|
|
|
map.put("ZSAREA",ZSAREA);
|
|
|
|
|
map.put("BZTXT1",BZTXT1);
|
|
|
|
|
mapResult.add(map);
|
|
|
|
|
}
|
|
|
|
|
if ((Constants.FAIL).equals(Integer.parseInt(RETCODE))){
|
|
|
|
|
return R.fail(MSG);
|
|
|
|
|
}
|
|
|
|
|
return R.ok(mapResult,MSG);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error(e.getMessage());
|
|
|
|
|
return R.fail(e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public R incomingConversion(Map<String, Object> mapList) {
|
|
|
|
|
try {
|
|
|
|
|
JCoRepository repository = dest.getRepository();
|
|
|
|
|
JCoFunction func = repository.getFunction("ZMES_ZSDR29");
|
|
|
|
|
if (func == null) {
|
|
|
|
|
throw new RuntimeException("Function does not exist in SAP");
|
|
|
|
|
}
|
|
|
|
|
log.info("成品备货单参数-------" + mapList.toString());
|
|
|
|
|
JCoTable S_TDDAT = func.getTableParameterList().getTable("S_TDDAT");
|
|
|
|
|
JCoTable S_MATNR = func.getTableParameterList().getTable("S_MATNR");
|
|
|
|
|
S_TDDAT.appendRow();
|
|
|
|
|
S_TDDAT.setValue(Constants.SIGN, "I");
|
|
|
|
|
S_TDDAT.setValue(Constants.OPTION, "BT");
|
|
|
|
|
S_TDDAT.setValue(Constants.LOW, "20240301");
|
|
|
|
|
S_TDDAT.setValue("HIGH", END_DATE);
|
|
|
|
|
System.out.println(S_TDDAT);
|
|
|
|
|
System.out.println(S_MATNR);
|
|
|
|
@ -485,4 +564,6 @@ public class SapItemSyncImpl implements SapItemSyncService {
|
|
|
|
|
return R.fail(e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|