|
|
|
@ -967,7 +967,161 @@ public class SapItemSyncImpl implements SapItemSyncService {
|
|
|
|
|
}else {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
JCoFunction func2 = repository.getFunction("ZMES_MIGO_102");//103冲销
|
|
|
|
|
JCoFunction func2 = repository.getFunction("ZMES_MIGO_104");//103冲销
|
|
|
|
|
if (func2 == null) {
|
|
|
|
|
throw new RuntimeException("Function does not exist in SAP");
|
|
|
|
|
}
|
|
|
|
|
log.info("105参数-------" + mapList.toString());
|
|
|
|
|
JCoTable L_ITEM = func2.getTableParameterList().getTable("L_ITEM");
|
|
|
|
|
L_ITEM.appendRow();
|
|
|
|
|
L_ITEM.setValue("LFBJA",mjahr);//参考凭证会计年度
|
|
|
|
|
L_ITEM.setValue("LFBNR",mblnr);//参考凭证的凭证号
|
|
|
|
|
L_ITEM.setValue("LFPOS",zeile);//参考凭证项目
|
|
|
|
|
L_ITEM.setValue("EBELN", ebeln);//采购订单编号 采购凭证号
|
|
|
|
|
L_ITEM.setValue("MATNR", matnr);//采购订单编号 采购凭证号
|
|
|
|
|
L_ITEM.setValue("EBELP",map.get("ebelp") );//采购凭证的项目编号
|
|
|
|
|
// L_ITEM.setValue("WERKS", werks);//工厂
|
|
|
|
|
// L_ITEM.setValue("LGORT", "0001");//库存地点
|
|
|
|
|
L_ITEM.setValue("QUANTITY",menge);//数量
|
|
|
|
|
// L_ITEM.setValue("BATCH", map.get("incomeBatchNo"));//批号
|
|
|
|
|
// L_ITEM.setValue("HSDAT","");//生产日期
|
|
|
|
|
System.out.println(L_ITEM);
|
|
|
|
|
func2.execute(dest);//执行调用函数
|
|
|
|
|
RETCODE = func2.getExportParameterList().getString("RETCODE");
|
|
|
|
|
MESSAGE = func2.getExportParameterList().getString("L_MSG");
|
|
|
|
|
MATERIALDOCUMENT = func2.getExportParameterList().getString("MATERIALDOCUMENT");
|
|
|
|
|
MATDOCUMENTYEAR = func2.getExportParameterList().getString("MATDOCUMENTYEAR");
|
|
|
|
|
log.info("103冲销结果结果-----" + RETCODE+"/" +MESSAGE+"/" +MATERIALDOCUMENT+"/" +MATDOCUMENTYEAR);
|
|
|
|
|
}
|
|
|
|
|
if((Constants.FAIL).equals(Integer.parseInt(RETCODE))){
|
|
|
|
|
return R.fail(MESSAGE);
|
|
|
|
|
}
|
|
|
|
|
Map Resmap = new HashMap();
|
|
|
|
|
Resmap.put("MATERIALDOCUMENT", MATERIALDOCUMENT);
|
|
|
|
|
Resmap.put("MATDOCUMENTYEAR", MATDOCUMENTYEAR);
|
|
|
|
|
return R.ok(Resmap, MESSAGE);
|
|
|
|
|
} else {
|
|
|
|
|
// 表为空的处理
|
|
|
|
|
System.out.println("表中没有数据。");
|
|
|
|
|
return R.fail("没有暂收数据");
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error(e.getMessage());
|
|
|
|
|
return R.fail(e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public R handleUpdateSAP105(List<Map> mapList) {
|
|
|
|
|
try {
|
|
|
|
|
Map map= mapList.get(0);
|
|
|
|
|
JCoRepository repository = dest.getRepository();
|
|
|
|
|
JCoFunction func = repository.getFunction("ZMES_GET_MSEG");
|
|
|
|
|
if (func == null) {
|
|
|
|
|
throw new RuntimeException("Function does not exist in SAP");
|
|
|
|
|
}
|
|
|
|
|
log.info("取物料凭证数据接口的参数-------" + mapList.toString());
|
|
|
|
|
|
|
|
|
|
JCoTable S_MBLNR = func.getTableParameterList().getTable("S_MBLNR");
|
|
|
|
|
//交货单号
|
|
|
|
|
JCoTable S_MJAHR = func.getTableParameterList().getTable("S_MJAHR");
|
|
|
|
|
//销售凭证类型
|
|
|
|
|
JCoTable S_MATNR = func.getTableParameterList().getTable("S_MATNR");
|
|
|
|
|
// S_MBLNR.setValue("S_MBLNR", S_MBLNR);
|
|
|
|
|
S_MBLNR.appendRow();
|
|
|
|
|
S_MBLNR.setValue(Constants.SIGN, "I");
|
|
|
|
|
S_MBLNR.setValue(Constants.OPTION, "BT");
|
|
|
|
|
S_MBLNR.setValue(Constants.LOW,map.get("S_MBLNR"));
|
|
|
|
|
S_MBLNR.setValue(Constants.HIGH,map.get("S_MBLNR"));
|
|
|
|
|
S_MJAHR.appendRow();
|
|
|
|
|
S_MJAHR.setValue(Constants.SIGN, "I");
|
|
|
|
|
S_MJAHR.setValue(Constants.OPTION, "BT");
|
|
|
|
|
S_MJAHR.setValue(Constants.LOW,map.get("S_MJAHR"));
|
|
|
|
|
S_MJAHR.setValue(Constants.HIGH,map.get("S_MJAHR"));
|
|
|
|
|
S_MATNR.appendRow();
|
|
|
|
|
S_MATNR.setValue(Constants.SIGN, "I");
|
|
|
|
|
S_MATNR.setValue(Constants.OPTION, "BT");
|
|
|
|
|
S_MATNR.setValue(Constants.LOW,map.get("S_MATNR"));
|
|
|
|
|
S_MATNR.setValue(Constants.HIGH,map.get("S_MATNR"));
|
|
|
|
|
func.execute(dest);//执行调用函数
|
|
|
|
|
/**
|
|
|
|
|
* MBLNR
|
|
|
|
|
* MJAHR
|
|
|
|
|
* ZEILE
|
|
|
|
|
* EBELN
|
|
|
|
|
* EBELP
|
|
|
|
|
* MATNR
|
|
|
|
|
* WERKS
|
|
|
|
|
* LGORT
|
|
|
|
|
* MENGE
|
|
|
|
|
* MEINS
|
|
|
|
|
* ERFMG
|
|
|
|
|
* ERFME
|
|
|
|
|
* BPMNG
|
|
|
|
|
* BPRME
|
|
|
|
|
*/
|
|
|
|
|
JCoTable maraTable = func.getTableParameterList().getTable("LT_MSEG");
|
|
|
|
|
// 首先检查表中是否有行
|
|
|
|
|
if (maraTable.getNumRows() > 0) {
|
|
|
|
|
// 遍历每一行
|
|
|
|
|
|
|
|
|
|
String mblnr = new String(); // 物料凭证编号
|
|
|
|
|
String mjahr = new String(); // 物料凭证年度
|
|
|
|
|
String zeile = new String(); // 物料凭证中的项目
|
|
|
|
|
String ebeln = new String(); // 采购订单编号
|
|
|
|
|
String ebelp = new String(); // 采购凭证的项目编号
|
|
|
|
|
String matnr = new String(); // 物料号
|
|
|
|
|
String werks = new String(); // 工厂
|
|
|
|
|
String lgort = new String(); // 库存地点
|
|
|
|
|
String menge = new String(); // 数量
|
|
|
|
|
String meins = new String(); // 基本计量单位
|
|
|
|
|
String erfmg = new String(); // 以输入单位计的数量
|
|
|
|
|
String erfme = new String(); // 条目单位
|
|
|
|
|
String bpmng = new String(); // 采购订单价格单位的数量
|
|
|
|
|
String bprme = new String(); // 订单价格单位(采购)
|
|
|
|
|
String RETCODE= new String();
|
|
|
|
|
String MESSAGE= new String();
|
|
|
|
|
String MATERIALDOCUMENT = new String();
|
|
|
|
|
String MATDOCUMENTYEAR= new String();
|
|
|
|
|
String tem="0";
|
|
|
|
|
for (int i = 0; i < maraTable.getNumRows(); i++) {
|
|
|
|
|
maraTable.setRow(i);
|
|
|
|
|
mblnr = maraTable.getString("MBLNR"); // 物料凭证编号
|
|
|
|
|
mjahr = maraTable.getString("MJAHR"); // 物料凭证年度
|
|
|
|
|
zeile = maraTable.getString("ZEILE"); // 物料凭证中的项目
|
|
|
|
|
ebeln = maraTable.getString("EBELN"); // 采购订单编号
|
|
|
|
|
matnr = maraTable.getString("MATNR"); // 物料号
|
|
|
|
|
werks = maraTable.getString("WERKS"); // 工厂
|
|
|
|
|
lgort = maraTable.getString("LGORT"); // 库存地点
|
|
|
|
|
menge = maraTable.getString("MENGE"); // 数量
|
|
|
|
|
meins = maraTable.getString("MEINS"); // 基本计量单位
|
|
|
|
|
erfmg = maraTable.getString("ERFMG"); // 以输入单位计的数量
|
|
|
|
|
erfme = maraTable.getString("ERFME"); // 条目单位
|
|
|
|
|
bpmng = maraTable.getString("BPMNG"); // 采购订单价格单位的数量
|
|
|
|
|
bprme = maraTable.getString("BPRME"); // 订单价格单位(采购)
|
|
|
|
|
|
|
|
|
|
// 处理获取到的字段值
|
|
|
|
|
System.out.println("物料凭证编号: " + mblnr);
|
|
|
|
|
System.out.println("物料凭证年度: " + mjahr);
|
|
|
|
|
System.out.println("物料凭证中的项目: " + zeile);
|
|
|
|
|
System.out.println("采购订单编号: " + ebeln);
|
|
|
|
|
System.out.println("采购凭证的项目编号: " + ebelp);
|
|
|
|
|
System.out.println("物料号: " + matnr);
|
|
|
|
|
System.out.println("工厂: " + werks);
|
|
|
|
|
System.out.println("库存地点: " + lgort);
|
|
|
|
|
System.out.println("数量: " + menge);
|
|
|
|
|
System.out.println("基本计量单位: " + meins);
|
|
|
|
|
System.out.println("以输入单位计的数量: " + erfmg);
|
|
|
|
|
System.out.println("条目单位: " + erfme);
|
|
|
|
|
System.out.println("采购订单价格单位的数量: " + bpmng);
|
|
|
|
|
System.out.println("订单价格单位(采购): " + bprme);
|
|
|
|
|
//需要做判断
|
|
|
|
|
if (map.get("poNo").equals(ebeln)&&map.get("S_MATNR").equals(matnr)){//需要判断采购单和物料
|
|
|
|
|
tem="1";
|
|
|
|
|
}else {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
JCoFunction func2 = repository.getFunction("ZMES_MIGO_106");//105冲销
|
|
|
|
|
if (func2 == null) {
|
|
|
|
|
throw new RuntimeException("Function does not exist in SAP");
|
|
|
|
|
}
|
|
|
|
|