wms冲销bug

master
mengjiao 2 months ago
parent 91bf322f6b
commit 255677abf4

@ -145,7 +145,7 @@ public interface RemoteSapService {
@PostMapping("/sap/handleUpdateSAP105")
public R handleUpdateSAP105(@RequestBody(required = false)List<Map> mapList);
@PostMapping("/sap/handleUpdateSAP102")
R handleUpdateSAP102(List<Map> mapList);
public R handleUpdateSAP102(@RequestBody(required = false)List<Map> mapList);
}

@ -548,7 +548,11 @@ public class SapController extends BaseController {
public R handleUpdateSAP105(@RequestBody(required = false) List<Map> mapList) {
return sapItemSyncService.handleUpdateSAP105(mapList);
}
@PostMapping("/handleUpdateSAP102")
@Log(title = "sap102冲销接口", businessType = BusinessType.SAP)
public R handleUpdateSAP102(@RequestBody(required = false) List<Map> mapList) {
return sapItemSyncService.handleUpdateSAP102(mapList);
}
/*******************设备*****************/
@PostMapping("/sapZmesAnlaGet")
@Log(title = "设备同步接口", businessType = BusinessType.SAP)

@ -46,4 +46,6 @@ public interface SapItemSyncService {
R handleUpdateSAP103(List<Map> mapList);
R handleUpdateSAP105(List<Map> mapList);
R handleUpdateSAP102(List<Map> mapList);
}

@ -1162,4 +1162,50 @@ public class SapItemSyncImpl implements SapItemSyncService {
return R.fail(e.getMessage());
}
}
@Override
public R handleUpdateSAP102(List<Map> mapList) {
try {
JCoRepository repository = dest.getRepository();
JCoFunction func = repository.getFunction("ZMES_102_MB31");
if (func == null) {
throw new RuntimeException("Function does not exist in SAP");
}
JCoTable L_ITEM = func.getTableParameterList().getTable("L_ITEM");
log.info("生产订单收货冲销接口开始----------------------------------------");
Map map= mapList.get(0);
L_ITEM.appendRow();
L_ITEM.setValue("AUFNR", map.get("AUFNR"));
L_ITEM.setValue("WERKS", map.get("WERKS"));
L_ITEM.setValue("LGORT", map.get("LGORT"));
L_ITEM.setValue("MATNR", map.get("MATNR"));
L_ITEM.setValue("QUANTITY", map.get("QUANTITY"));
L_ITEM.setValue("ERFME", map.get("ERFME"));
L_ITEM.setValue("BATCH", map.get("BATCH"));
L_ITEM.setValue("STCK_TYPE", "");
System.out.println(L_ITEM);
func.execute(dest);
String L_MSG = func.getExportParameterList().getString("L_MSG");
String RETCODE = func.getExportParameterList().getString("RETCODE");
String MATERIALDOCUMENT = func.getExportParameterList().getString("MATERIALDOCUMENT");
String MATDOCUMENTYEAR = func.getExportParameterList().getString("MATDOCUMENTYEAR");
System.out.println("L_MSG" + L_MSG);
System.out.println("返回值0-没有错误1-有错误:" + RETCODE);
System.out.println("物料凭证编号" + MATERIALDOCUMENT);
System.out.println("物料凭证年度" + MATDOCUMENTYEAR);
if((Constants.FAIL).equals(Integer.parseInt(RETCODE))){
return R.fail(L_MSG);
}
Map Resmap = new HashMap();
Resmap.put("MATERIALDOCUMENT", MATERIALDOCUMENT);
Resmap.put("MATDOCUMENTYEAR", MATDOCUMENTYEAR);
return R.ok(Resmap, L_MSG);
} catch (Exception e) {
return R.fail(e.getMessage());
}
}
}

@ -1298,31 +1298,31 @@ public class WmsProductPutServiceImpl implements IWmsProductPutService {
String result="操作成功";
for (WmsProductPut wmsProductPut: wmsProductPutList){
// WmsProductPut wmsProductPut1= wmsProductPutMapper.selectWmsProductPutByIdANDStatus(wmsProductPut.getId());
// //LFBJA
// //LFBNR
// //LFPOS
// //EBELN
// //EBELP
// //MATNR
// //QUANTITY
// //WERKS
// //LGORT
// //这个地方
// Map paramMap=new HashMap<>();
// List<Map> mapList = new ArrayList<>();
// paramMap.put("LFBJA",wmsProductPut1.getAttr10());//参考凭证会计年度
// paramMap.put("LFBNR",wmsProductPut1.getSapProof());//参考凭证的凭证号
// //paramMap.put("LFPOS",wmsProductPut1.get());//参考凭证项目
// paramMap.put("EBELN",wmsProductPut1.getProductCode());//采购凭证
// paramMap.put("EBELP",wmsProductPut1.getPoLine());//采购凭证的项目编
// paramMap.put("MATNR",wmsProductPut1.getPoNo());//物料号
// paramMap.put("QUANTITY",wmsProductPut1.getPoNo());//数量
// paramMap.put("WERKS",wmsProductPut1.getPoNo());//工厂
// paramMap.put("LGORT",wmsProductPut1.getPoNo());//库存地点
// mapList.add(paramMap);
// R result2 = remoteSapService.handleUpdateSAP102(mapList);
// if (result2.getCode()==200){
WmsProductPut wmsProductPut1= wmsProductPutMapper.selectWmsProductPutByIdANDStatus(wmsProductPut.getId());
//LFBJA
//LFBNR
//LFPOS
//EBELN
//EBELP
//MATNR
//QUANTITY
//WERKS
//LGORT
//这个地方
Map paramMap=new HashMap<>();
List<Map> mapList = new ArrayList<>();
paramMap.put("AUFNR",wmsProductPut1.getProductOrder());//单号
paramMap.put("WERKS",wmsProductPut1.getFactoryCode());//工厂
paramMap.put("LGORT",wmsProductPut1.getWhCode());//库存地点
// paramMap.put("STCK_TYPE",wmsProductPut1.getPoLine());//采购凭证的项目编
paramMap.put("MATNR",wmsProductPut1.getProductCode());//物料
paramMap.put("QUANTITY",wmsProductPut1.getPlanQuantity());//数量
paramMap.put("ERFME",wmsProductPut1.getUnitOfMeasure());//条目单位
paramMap.put("BATCH",wmsProductPut1.getAttr4());//批号
mapList.add(paramMap);
R result2 = remoteSapService.handleUpdateSAP102(mapList);
if (result2.getCode()==200){
// //应该是修改订单,然后修改库存
// Map map = new HashMap();
// map = (Map) result2.getData();
// String MATERIALDOCUMENT = (String) map.get("MATERIALDOCUMENT");
@ -1359,14 +1359,14 @@ public class WmsProductPutServiceImpl implements IWmsProductPutService {
// wmsRawOrderIn.setUserDefined4(MATERIALDOCUMENT);
// wmsRawOrderIn.setUserDefined5(MATDOCUMENTYEAR);
// wmsRawOrderInMapper.updateWmsRawOrderIn(wmsRawOrderIn);
//
// }else {
}else {
// //失败了
// wmsRawOrderIn.setAccountingTime(new Date());
// wmsRawOrderIn.setAccountingMessage(result2.getMsg());
// wmsRawOrderInMapper.updateWmsRawOrderIn(wmsRawOrderIn);
//
// }
// wmsProductPut.set(new Date());
// wmsProductPut.setAccountingMessage(result2.getMsg());
// wmsProductPutMapper.updateWmsRawOrderIn(wmsProductPut);
}
}
return result;
}

Loading…
Cancel
Save