|
|
|
@ -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,24 +447,34 @@ 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
|
|
|
|
|
}
|
|
|
|
|
// 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));
|
|
|
|
|
if(StringUtils.isEmpty(proOrder.getPlanDateStart())||StringUtils.isEmpty(proOrder.getPlanDateEnd())){
|
|
|
|
|
logger.error("手动订单同步:【参数】时间范围缺失"+ JSONObject.toJSONString(sapqo));
|
|
|
|
|
}else {
|
|
|
|
|
Map<String, Object> dataParams = new HashMap<>();
|
|
|
|
|
dataParams.put("planDateStart", proOrder.getPlanDateStart());
|
|
|
|
|
dataParams.put("planDateEnd", proOrder.getPlanDateEnd());
|
|
|
|
|
sapqo.setParams(dataParams);
|
|
|
|
|
|
|
|
|
|
logger.info("手动订单同步:【参数】" + JSONObject.toJSONString(sapqo));
|
|
|
|
|
//取>=20230923的sap数据
|
|
|
|
|
R<List<SapProOrder>> rSapProOrder = remoteSapService.shopOrderSync(sapqo);//sap只能同步指定日期的数据
|
|
|
|
|
|
|
|
|
|
List<SapProOrder> newOrders = rSapProOrder.getData();
|
|
|
|
|
if(CollectionUtils.isEmpty(newOrders)){
|
|
|
|
|
System.out.println("无"+sapqo.getErdat()+"之后的最新订单");
|
|
|
|
|
}else {
|
|
|
|
|
if (CollectionUtils.isEmpty(newOrders)) {
|
|
|
|
|
System.out.println("无" + sapqo.getErdat() + "之后的最新订单");
|
|
|
|
|
} else {
|
|
|
|
|
logger.info("手动订单同步:【结果】" + JSONObject.toJSONString(newOrders));
|
|
|
|
|
syncSAPFunc(newOrders, "Job");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String syncSAPFunc(List<SapProOrder> newOrders,String syncUser){
|
|
|
|
|
String failOrder = "";
|
|
|
|
|