|
|
|
@ -2,9 +2,12 @@ package com.op.technology.controller;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
|
|
import com.baomidou.dynamic.datasource.DynamicRoutingDataSource;
|
|
|
|
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
|
|
|
|
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DataSourceProperty;
|
|
|
|
|
import com.op.common.core.domain.R;
|
|
|
|
|
import com.op.common.core.utils.bean.BeanUtils;
|
|
|
|
@ -32,6 +35,8 @@ import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
import org.springframework.web.context.request.RequestContextHolder;
|
|
|
|
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -173,4 +178,27 @@ public class ProRouteController extends BaseController {
|
|
|
|
|
dynamicRoutingDataSource.removeDataSource(dataSourceProperty.getPoolName());
|
|
|
|
|
return R.ok();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 新增工艺路线
|
|
|
|
|
*/
|
|
|
|
|
@RequiresPermissions("mes:pro:proroute:add")
|
|
|
|
|
@Log(title = "指定物料进行工艺路线同步", businessType = BusinessType.INSERT)
|
|
|
|
|
@PostMapping("/syncProductSAP")
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public AjaxResult syncProductSAP(@RequestBody ProRoute proRoute) {
|
|
|
|
|
SapRouterQuery qo = new SapRouterQuery();
|
|
|
|
|
qo.setMatnr(proRoute.getProductCodes());
|
|
|
|
|
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
|
|
|
|
String key = "#header.poolName";
|
|
|
|
|
qo.setWerks(request.getHeader(key.substring(8)).replace("ds_",""));
|
|
|
|
|
logger.info("选择产品进行工艺更新开始:"+ JSONObject.toJSONString(qo));
|
|
|
|
|
R r = remoteSapService.sapRouterSync(qo);
|
|
|
|
|
logger.info("选择产品进行工艺更新结束:"+ JSONObject.toJSONString(r));
|
|
|
|
|
if (r.getCode() == 200) {
|
|
|
|
|
return AjaxResult.success();
|
|
|
|
|
}
|
|
|
|
|
return AjaxResult.error("手动同步失败");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|