diff --git a/op-modules/op-plan/src/main/java/com/op/plan/controller/ProOrderController.java b/op-modules/op-plan/src/main/java/com/op/plan/controller/ProOrderController.java index 2bc863f3..e3242b79 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/controller/ProOrderController.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/controller/ProOrderController.java @@ -287,8 +287,8 @@ public class ProOrderController extends BaseController { */ @Log(title = "手动执行同步SAP订单", businessType = BusinessType.INSERT) @PostMapping("/syncSAP") - public void syncSAP() { - proOrderService.syncSAP(); + public void syncSAP(@RequestBody ProOrder proOrder) { + proOrderService.syncSAP(proOrder); } @Log(title = "自动同步SAP订单", businessType = BusinessType.INSERT) diff --git a/op-modules/op-plan/src/main/java/com/op/plan/service/IProOrderService.java b/op-modules/op-plan/src/main/java/com/op/plan/service/IProOrderService.java index 2edcec22..6b209060 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/service/IProOrderService.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/service/IProOrderService.java @@ -97,7 +97,7 @@ public interface IProOrderService { public AjaxResult getOrderList(String id); - public void syncSAP(); + public void syncSAP(ProOrder proOrder); /** * 处理表格信息 diff --git a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderServiceImpl.java b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderServiceImpl.java index 1a2bfe57..d56438a4 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderServiceImpl.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderServiceImpl.java @@ -439,7 +439,7 @@ public class ProOrderServiceImpl implements IProOrderService { */ @Override @DS("#header.poolName") - public void syncSAP() { + public void syncSAP(ProOrder proOrder) { SapShopOrderQuery sapqo = new SapShopOrderQuery(); // sapqo.setCreateTime(DateUtils.addDays(DateUtils.getNowDate(),-4)); // //获取当前所选工厂 @@ -447,22 +447,32 @@ public class ProOrderServiceImpl implements IProOrderService { String key = "#header.poolName"; sapqo.setWerk(request.getHeader(key.substring(8)).replace("ds_","")); - SapProOrder maxCreateTime = proOrderMapper.getMaxCreatetime(); - if(maxCreateTime == null ){ - sapqo.setErdat(DateFormatUtils.format(new Date(), "yyyyMMdd"));//S_ERDAT(创建日期) 例如:20230923 - }else{ - sapqo.setErdat(maxCreateTime.getCreateTimeStr());//S_ERDAT(创建日期) 例如:20230923 - } - - logger.info("手动订单同步:【参数】"+ JSONObject.toJSONString(sapqo)); - //取>=20230923的sap数据 - R> rSapProOrder = remoteSapService.shopOrderSync(sapqo);//sap只能同步指定日期的数据 +// SapProOrder maxCreateTime = proOrderMapper.getMaxCreatetime(); +// if(maxCreateTime == null ){ +// sapqo.setErdat(DateFormatUtils.format(new Date(), "yyyyMMdd"));//S_ERDAT(创建日期) 例如:20230923 +// }else{ +// sapqo.setErdat(maxCreateTime.getCreateTimeStr());//S_ERDAT(创建日期) 例如:20230923 +// } - List newOrders = rSapProOrder.getData(); - if(CollectionUtils.isEmpty(newOrders)){ - System.out.println("无"+sapqo.getErdat()+"之后的最新订单"); + if(StringUtils.isEmpty(proOrder.getPlanDateStart())||StringUtils.isEmpty(proOrder.getPlanDateEnd())){ + logger.error("手动订单同步:【参数】时间范围缺失"+ JSONObject.toJSONString(sapqo)); }else { - syncSAPFunc(newOrders, "Job"); + Map dataParams = new HashMap<>(); + dataParams.put("planDateStart", proOrder.getPlanDateStart()); + dataParams.put("planDateEnd", proOrder.getPlanDateEnd()); + sapqo.setParams(dataParams); + + logger.info("手动订单同步:【参数】" + JSONObject.toJSONString(sapqo)); + //取>=20230923的sap数据 + R> rSapProOrder = remoteSapService.shopOrderSync(sapqo);//sap只能同步指定日期的数据 + + List newOrders = rSapProOrder.getData(); + if (CollectionUtils.isEmpty(newOrders)) { + System.out.println("无" + sapqo.getErdat() + "之后的最新订单"); + } else { + logger.info("手动订单同步:【结果】" + JSONObject.toJSONString(newOrders)); + syncSAPFunc(newOrders, "Job"); + } } }