From 0fe22545683f1277014177540f210605979b8f17 Mon Sep 17 00:00:00 2001 From: zhaoxiaolin Date: Wed, 22 Nov 2023 11:00:10 +0800 Subject: [PATCH] =?UTF-8?q?mes=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/DeviceTaskServiceImpl.java | 3 +- .../mapper/device/DeviceTaskMapper.xml | 1 + .../com/op/sap/controller/SapController.java | 99 ++++++++++--------- 3 files changed, 55 insertions(+), 48 deletions(-) diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceTaskServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceTaskServiceImpl.java index 9e6f8c95..dd2b695f 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceTaskServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceTaskServiceImpl.java @@ -280,7 +280,7 @@ public class DeviceTaskServiceImpl implements IDeviceTaskService { for (EquPlanEquSpare spare : spares) { EquSpareApply apply = new EquSpareApply(); apply.setApplyId(IdUtils.fastSimpleUUID()); - apply.setApplyCode("A"+DateUtils.dateTimeNow(DateUtils.YYYYMMDD)+String.format("%03d",applySerialNum)); + apply.setApplyCode("A"+orderCode+String.format("%03d",applySerialNum)); applySerialNum++; apply.setSpareCode(spare.getMaterialCode()); apply.setSpareName(spare.getMaterialDesc()); @@ -305,6 +305,7 @@ public class DeviceTaskServiceImpl implements IDeviceTaskService { System.out.println(plan.getPlanCode()+"========equ_spare_apply:"+sce); } + /**equ_plan_detail->equ_order_detail*******************************************************/ EquPlanDetail itqo = new EquPlanDetail(); itqo.setParentCode(plan.getPlanEquId()); diff --git a/op-modules/op-device/src/main/resources/mapper/device/DeviceTaskMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/DeviceTaskMapper.xml index 2531142c..a190ac18 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/DeviceTaskMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/DeviceTaskMapper.xml @@ -22,6 +22,7 @@ ep.work_outsourcing_unit workOutsourcingUnit, ep.work_connection workConnection, ep.work_reason workReason, + ep.plan_code planCode, epe.equipment_code equipmentCode, epe.equipment_name equipmentName, epe.id planEquId diff --git a/op-modules/op-sap/src/main/java/com/op/sap/controller/SapController.java b/op-modules/op-sap/src/main/java/com/op/sap/controller/SapController.java index 802bb59a..ce0391b7 100644 --- a/op-modules/op-sap/src/main/java/com/op/sap/controller/SapController.java +++ b/op-modules/op-sap/src/main/java/com/op/sap/controller/SapController.java @@ -79,23 +79,25 @@ public class SapController extends BaseController { R>> dateSources0 = remoteUserService.getPoolNameList(sysUser); List> dateSources = dateSources0.getData(); dateSources.forEach(dateSource -> { - logger.info("++++++++++++" + dateSource.get("poolName") + "++++product同步开始++++++++++"); - DynamicDataSourceContextHolder.push(dateSource.get("poolName"));// 这是数据源的key - - Date maxTime0 = sapBomMapper.getProductMaxTime(); - if(maxTime0 != null){ - Calendar calendar = Calendar.getInstance(); - calendar.setTime(maxTime0); - calendar.add(Calendar.DAY_OF_YEAR, 1); - Date maxTime = calendar.getTime(); - qo.setLaeda(DateFormatUtils.format(maxTime, "yyyyMMdd"));//修改日期20230923 - } + if(!"ds_999".equals(dateSource.get("poolName"))){ + logger.info("++++++++++++" + dateSource.get("poolName") + "++++product同步开始++++++++++"); + DynamicDataSourceContextHolder.push(dateSource.get("poolName"));// 这是数据源的key + + Date maxTime0 = sapBomMapper.getProductMaxTime(); + if(maxTime0 != null){ + Calendar calendar = Calendar.getInstance(); + calendar.setTime(maxTime0); + calendar.add(Calendar.DAY_OF_YEAR, 1); + Date maxTime = calendar.getTime(); + qo.setLaeda(DateFormatUtils.format(maxTime, "yyyyMMdd"));//修改日期20230923 + } - R r = sapItemSyncService.itemSync(qo); - if(r.getCode()!=200){ - logger.error("++++++++++++" + dateSource.get("poolName")+"同步product失败,错误信息:"+ r.getMsg()); + R r = sapItemSyncService.itemSync(qo); + if(r.getCode()!=200){ + logger.error("++++++++++++" + dateSource.get("poolName")+"同步product失败,错误信息:"+ r.getMsg()); + } + logger.error("++++++++++++" + dateSource.get("poolName") + "++++product同步结束++++++++++"); } - logger.error("++++++++++++" + dateSource.get("poolName") + "++++product同步结束++++++++++"); }); return R.ok(); } @@ -115,23 +117,25 @@ public class SapController extends BaseController { R>> dateSources0 = remoteUserService.getPoolNameList(sysUser); List> dateSources = dateSources0.getData(); dateSources.forEach(dateSource -> { - logger.info("++++++++++++" + dateSource.get("poolName") + "++++bom同步开始++++++++++"); - DynamicDataSourceContextHolder.push(dateSource.get("poolName"));// 这是数据源的key - - Date maxTime0 = sapBomMapper.getProductMaxTime(); - if(maxTime0 != null){ - Calendar calendar = Calendar.getInstance(); - calendar.setTime(maxTime0); - calendar.add(Calendar.DAY_OF_YEAR, 1); - Date maxTime = calendar.getTime(); - qo.setAedat(DateFormatUtils.format(maxTime, "yyyyMMdd"));//修改日期20230923 - } + if(!"ds_999".equals(dateSource.get("poolName"))) { + logger.info("++++++++++++" + dateSource.get("poolName") + "++++bom同步开始++++++++++"); + DynamicDataSourceContextHolder.push(dateSource.get("poolName"));// 这是数据源的key + + Date maxTime0 = sapBomMapper.getProductMaxTime(); + if (maxTime0 != null) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(maxTime0); + calendar.add(Calendar.DAY_OF_YEAR, 1); + Date maxTime = calendar.getTime(); + qo.setAedat(DateFormatUtils.format(maxTime, "yyyyMMdd"));//修改日期20230923 + } - R r = sapBomService.bomSync(qo); - if(r.getCode()!=200){ - logger.error("++++++++++++" + dateSource.get("poolName")+"同步bom失败,错误信息:"+ r.getMsg()); + R r = sapBomService.bomSync(qo); + if (r.getCode() != 200) { + logger.error("++++++++++++" + dateSource.get("poolName") + "同步bom失败,错误信息:" + r.getMsg()); + } + logger.error("++++++++++++" + dateSource.get("poolName") + "++++bom同步结束++++++++++"); } - logger.error("++++++++++++" + dateSource.get("poolName") + "++++bom同步结束++++++++++"); }); return R.ok(); @@ -152,27 +156,28 @@ public class SapController extends BaseController { R>> dateSources0 = remoteUserService.getPoolNameList(sysUser); List> dateSources = dateSources0.getData(); dateSources.forEach(dateSource -> { - logger.info("++++++++++++" + dateSource.get("poolName") + "++++工艺同步开始++++++++++"); - DynamicDataSourceContextHolder.push(dateSource.get("poolName"));// 这是数据源的key - - Date maxTime0 = sapBomMapper.getRouteMaxTime(); - if(maxTime0 != null){ - Calendar calendar = Calendar.getInstance(); - calendar.setTime(maxTime0); - calendar.add(Calendar.DAY_OF_YEAR, 1); - Date maxTime = calendar.getTime(); - qo.setAedat(DateFormatUtils.format(maxTime, "yyyyMMdd"));//修改日期20230923 - } - qo.setWerks(dateSource.get("poolName").replace("ds_",""));//工厂 + if(!"ds_999".equals(dateSource.get("poolName"))) { + logger.info("++++++++++++" + dateSource.get("poolName") + "++++工艺同步开始++++++++++"); + DynamicDataSourceContextHolder.push(dateSource.get("poolName"));// 这是数据源的key + + Date maxTime0 = sapBomMapper.getRouteMaxTime(); + if (maxTime0 != null) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(maxTime0); + calendar.add(Calendar.DAY_OF_YEAR, 1); + Date maxTime = calendar.getTime(); + qo.setAedat(DateFormatUtils.format(maxTime, "yyyyMMdd"));//修改日期20230923 + } + qo.setWerks(dateSource.get("poolName").replace("ds_", ""));//工厂 - R r = sapRouterService.sapRouterSync(qo); - if(r.getCode()!=200){ - logger.error("++++++++++++" + dateSource.get("poolName")+"同步工艺失败,错误信息:"+ r.getMsg()); + R r = sapRouterService.sapRouterSync(qo); + if (r.getCode() != 200) { + logger.error("++++++++++++" + dateSource.get("poolName") + "同步工艺失败,错误信息:" + r.getMsg()); + } + logger.error("++++++++++++" + dateSource.get("poolName") + "++++工艺同步结束++++++++++"); } - logger.error("++++++++++++" + dateSource.get("poolName") + "++++工艺同步结束++++++++++"); }); return R.ok(); - } /**