diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsApiController.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsApiController.java index c7fca51f..d2bd8660 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsApiController.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsApiController.java @@ -274,16 +274,32 @@ public class WmsApiController extends BaseController { @PostMapping(("/synchronizeRawMaterialDeliveryInformationToERP")) // @Log(title = "同步原材料出库信息", businessType = BusinessType.INSERT) public R synchronizeRawMaterialDeliveryInformationToERP() { - Map> otherMaterialIdMap = wmsErpScheduledTaskService.synchronizeOtherMaterialDeliveryInformationToERP(); - for (Long materialId : otherMaterialIdMap.keySet()) { - wmsErpScheduledTaskService.syncOutstockInformation(otherMaterialIdMap, materialId, ""); + int result = 0; + StringBuilder errorBuffer = new StringBuilder(); + //定时同步原材料出库信息给ERP + Map> otherMaterialIdMap = wmsErpScheduledTaskService.synchronizeOtherMaterialDeliveryInformationToERP(); + for (String materialId : otherMaterialIdMap.keySet()) { + try { + wmsErpScheduledTaskService.syncOutstockInformation(otherMaterialIdMap, materialId, ""); + } catch (Exception e) { + result++; + errorBuffer.append(result).append(e.getMessage()).append("|出库ERP异常|"); + } } - Map> returnMaterialIdMap = wmsErpScheduledTaskService.synchronizeReturnMaterialDeliveryInformationToERP(); - for (Long materialId : returnMaterialIdMap.keySet()) { - wmsErpScheduledTaskService.syncOutstockInformation(returnMaterialIdMap, materialId, WmsConstants.WMS_RAW_OUTSTOCK_TASK_TYPE_RETURN_OUTSTOCK); + //定时同步原材料退货出库信息给ERP + Map> returnMaterialIdMap = wmsErpScheduledTaskService.synchronizeReturnMaterialDeliveryInformationToERP(); + for (String materialId : returnMaterialIdMap.keySet()) { + try { + wmsErpScheduledTaskService.syncOutstockInformation(returnMaterialIdMap, materialId, WmsConstants.WMS_RAW_OUTSTOCK_TASK_TYPE_RETURN_OUTSTOCK); + } catch (Exception e) { + result++; + errorBuffer.append(result).append(e.getMessage()).append("|退库ERP异常|"); + } + } + if (errorBuffer.length() > 0) { + return R.fail(errorBuffer.toString()); } - return R.ok(); }