订单同步,改成时间范围

master
zhaoxiaolin 7 months ago
parent 6e30ae994e
commit 782edad5b3

@ -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)

@ -97,7 +97,7 @@ public interface IProOrderService {
public AjaxResult getOrderList(String id);
public void syncSAP();
public void syncSAP(ProOrder proOrder);
/**
*

@ -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,12 +447,20 @@ 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
// 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
// }
if(StringUtils.isEmpty(proOrder.getPlanDateStart())||StringUtils.isEmpty(proOrder.getPlanDateEnd())){
logger.error("手动订单同步:【参数】时间范围缺失"+ JSONObject.toJSONString(sapqo));
}else {
sapqo.setErdat(maxCreateTime.getCreateTimeStr());//S_ERDAT(创建日期) 例如20230923
}
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数据
@ -462,9 +470,11 @@ public class ProOrderServiceImpl implements IProOrderService {
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 = "";

Loading…
Cancel
Save