Merge remote-tracking branch 'origin/master'

master
mengjiao 7 months ago
commit c820d089b5

@ -287,8 +287,8 @@ public class ProOrderController extends BaseController {
*/ */
@Log(title = "手动执行同步SAP订单", businessType = BusinessType.INSERT) @Log(title = "手动执行同步SAP订单", businessType = BusinessType.INSERT)
@PostMapping("/syncSAP") @PostMapping("/syncSAP")
public void syncSAP() { public void syncSAP(@RequestBody ProOrder proOrder) {
proOrderService.syncSAP(); proOrderService.syncSAP(proOrder);
} }
@Log(title = "自动同步SAP订单", businessType = BusinessType.INSERT) @Log(title = "自动同步SAP订单", businessType = BusinessType.INSERT)

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

@ -439,7 +439,7 @@ public class ProOrderServiceImpl implements IProOrderService {
*/ */
@Override @Override
@DS("#header.poolName") @DS("#header.poolName")
public void syncSAP() { public void syncSAP(ProOrder proOrder) {
SapShopOrderQuery sapqo = new SapShopOrderQuery(); SapShopOrderQuery sapqo = new SapShopOrderQuery();
// sapqo.setCreateTime(DateUtils.addDays(DateUtils.getNowDate(),-4)); // sapqo.setCreateTime(DateUtils.addDays(DateUtils.getNowDate(),-4));
// //获取当前所选工厂 // //获取当前所选工厂
@ -447,24 +447,34 @@ public class ProOrderServiceImpl implements IProOrderService {
String key = "#header.poolName"; String key = "#header.poolName";
sapqo.setWerk(request.getHeader(key.substring(8)).replace("ds_","")); sapqo.setWerk(request.getHeader(key.substring(8)).replace("ds_",""));
SapProOrder maxCreateTime = proOrderMapper.getMaxCreatetime(); // SapProOrder maxCreateTime = proOrderMapper.getMaxCreatetime();
if(maxCreateTime == null ){ // if(maxCreateTime == null ){
sapqo.setErdat(DateFormatUtils.format(new Date(), "yyyyMMdd"));//S_ERDAT(创建日期) 例如20230923 // sapqo.setErdat(DateFormatUtils.format(new Date(), "yyyyMMdd"));//S_ERDAT(创建日期) 例如20230923
}else{ // }else{
sapqo.setErdat(maxCreateTime.getCreateTimeStr());//S_ERDAT(创建日期) 例如20230923 // 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数据 //取>=20230923的sap数据
R<List<SapProOrder>> rSapProOrder = remoteSapService.shopOrderSync(sapqo);//sap只能同步指定日期的数据 R<List<SapProOrder>> rSapProOrder = remoteSapService.shopOrderSync(sapqo);//sap只能同步指定日期的数据
List<SapProOrder> newOrders = rSapProOrder.getData(); List<SapProOrder> newOrders = rSapProOrder.getData();
if(CollectionUtils.isEmpty(newOrders)){ if (CollectionUtils.isEmpty(newOrders)) {
System.out.println("无"+sapqo.getErdat()+"之后的最新订单"); System.out.println("无" + sapqo.getErdat() + "之后的最新订单");
}else { } else {
logger.info("手动订单同步:【结果】" + JSONObject.toJSONString(newOrders));
syncSAPFunc(newOrders, "Job"); syncSAPFunc(newOrders, "Job");
} }
} }
}
public String syncSAPFunc(List<SapProOrder> newOrders,String syncUser){ public String syncSAPFunc(List<SapProOrder> newOrders,String syncUser){
String failOrder = ""; String failOrder = "";

Loading…
Cancel
Save