|
|
|
@ -4,16 +4,21 @@ import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesPartService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesProdOrgExtService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.api.busi.*;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.apiservice.dao.IMesNcProcessingDao;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.apiservice.util.MesPcnException;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.*;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
|
|
|
|
|
import cn.estsh.i3plus.mes.pcn.api.iservice.busi.ISyncFuncService;
|
|
|
|
|
import cn.estsh.i3plus.mes.pcn.util.PcnHttpUtil;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.tool.JsonUtilTool;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.tool.TimeTool;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.BaseResultBean;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.common.Pager;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.common.PagerHelper;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.util.StringUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.*;
|
|
|
|
@ -33,6 +38,8 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
@ -1071,6 +1078,24 @@ public class MesNcProcessingService implements IMesNcProcessingService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void syncQmsScrap(String organizeCode) {
|
|
|
|
|
String url = "";
|
|
|
|
|
MesConfig mesConfig = configService.getCfgValueByCode(organizeCode, "MES_SCRAP_URL");
|
|
|
|
|
if (mesConfig == null) {
|
|
|
|
|
MesPcnException.throwBusiException("未配置系统参数:MES_SCRAP_URL");
|
|
|
|
|
}
|
|
|
|
|
url = mesConfig.getCfgValue();
|
|
|
|
|
Map<String, String> map = new HashMap<>();
|
|
|
|
|
map.put("organizeCode", organizeCode);
|
|
|
|
|
ResultBean resultBean = getModuleData(url, map);
|
|
|
|
|
|
|
|
|
|
//校验平台登陆结果
|
|
|
|
|
if (null != resultBean && resultBean.success == false) {
|
|
|
|
|
MesPcnException.throwBusiException("同步失败");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* @Override
|
|
|
|
|
public void syncQmsScrap(String organizeCode) {
|
|
|
|
|
boolean isNew = false;
|
|
|
|
|
MesConfig mesConfig = configService.getCfgValueByCode(organizeCode, "MES_SCAP_IS_NEW_TYPE");
|
|
|
|
|
if (mesConfig != null && Objects.equals(mesConfig.getCfgValue(), "1")) {
|
|
|
|
@ -1081,7 +1106,7 @@ public class MesNcProcessingService implements IMesNcProcessingService {
|
|
|
|
|
} else {
|
|
|
|
|
sendToQms(organizeCode);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
private void sendToQmsNew(String organizeCode) {
|
|
|
|
|
|
|
|
|
@ -1161,4 +1186,29 @@ public class MesNcProcessingService implements IMesNcProcessingService {
|
|
|
|
|
partInspectionRepository.saveAll(mesPartInspectionList);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* http接口调用
|
|
|
|
|
* @param url
|
|
|
|
|
* @param paramsMap
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private ResultBean getModuleData(String url, Map<String, String> paramsMap) {
|
|
|
|
|
ResultBean resultBean = null;
|
|
|
|
|
//http接口调用
|
|
|
|
|
String data = null;
|
|
|
|
|
try {
|
|
|
|
|
data = PcnHttpUtil.doGet(url, paramsMap);
|
|
|
|
|
if (!StringUtils.isEmpty(data)) {
|
|
|
|
|
resultBean = JsonUtilTool.decode(data, ResultBean.class);
|
|
|
|
|
} else {
|
|
|
|
|
log.error("HTTP调用mes接口失败");
|
|
|
|
|
}
|
|
|
|
|
} catch (UnsupportedEncodingException e) {
|
|
|
|
|
// e.printStackTrace();
|
|
|
|
|
log.error("执行异常:{}", e);
|
|
|
|
|
log.error("HTTP调用mes接口失败");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return resultBean;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|