|
|
@ -343,6 +343,9 @@ public class ToolServiceImpl implements ToolService { |
|
|
String toolId = inData.getToolId(); |
|
|
String toolId = inData.getToolId(); |
|
|
String toolInstance = inData.getToolInstance(); |
|
|
String toolInstance = inData.getToolInstance(); |
|
|
Date lastCalibrationDate = inData.getLastCalibrationDate(); |
|
|
Date lastCalibrationDate = inData.getLastCalibrationDate(); |
|
|
|
|
|
String objectId = inData.getObjectId(); |
|
|
|
|
|
String normalWorkCenterNo = inData.getNormalWorkCenterNo(); |
|
|
|
|
|
String normalProductionLine = inData.getNormalProductionLine(); |
|
|
//查询是否存在 |
|
|
//查询是否存在 |
|
|
IfsToolInstanceData toolInstanceData = toolDao.getToolInstanceByToolInstance(site, toolId, toolInstance); |
|
|
IfsToolInstanceData toolInstanceData = toolDao.getToolInstanceByToolInstance(site, toolId, toolInstance); |
|
|
//如果存在 |
|
|
//如果存在 |
|
|
@ -350,27 +353,58 @@ public class ToolServiceImpl implements ToolService { |
|
|
throw new RuntimeException("当前工具实例不存在!"); |
|
|
throw new RuntimeException("当前工具实例不存在!"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//1.调用存储过程检查工具实例的修改 |
|
|
|
|
|
Map<String, Object> resultMap = this.checkUpdateToolInstance(site, toolId, toolInstance, objectId, normalWorkCenterNo, normalProductionLine); |
|
|
|
|
|
//判断是否检验成功 |
|
|
|
|
|
String resultCode = String.valueOf(resultMap.get("result_code")); |
|
|
|
|
|
if ("400".equalsIgnoreCase(resultCode)) { |
|
|
|
|
|
String resultMsg = String.valueOf(resultMap.get("result_msg")); |
|
|
|
|
|
throw new RuntimeException(resultMsg); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
toolInstanceData = new IfsToolInstanceDateData(); |
|
|
toolInstanceData = new IfsToolInstanceDateData(); |
|
|
//拷贝属性 设置参数 |
|
|
//拷贝属性 设置参数 |
|
|
BeanUtils.copyProperties(inData, toolInstanceData); |
|
|
BeanUtils.copyProperties(inData, toolInstanceData); |
|
|
String lastCalibrationTime = ""; |
|
|
String lastCalibrationTime = ""; |
|
|
if(lastCalibrationDate != null){ |
|
|
if(lastCalibrationDate != null){ |
|
|
lastCalibrationTime = DateUtils.getStringDate(lastCalibrationDate, "yyyy-MM-dd"); |
|
|
lastCalibrationTime = DateUtils.getStringDate(lastCalibrationDate, "yyyy-MM-dd"); |
|
|
|
|
|
inData.setNextCalibrationDate(lastCalibrationDate); |
|
|
} |
|
|
} |
|
|
toolInstanceData.setLastCalibrationDate(lastCalibrationTime); |
|
|
toolInstanceData.setLastCalibrationDate(lastCalibrationTime); |
|
|
//1.校验存在调用接口 |
|
|
|
|
|
|
|
|
/* //2.校验存在调用接口 |
|
|
String toolURL = apiUrl + "/tool/ifs/modifyToolInstanceToIfs"; |
|
|
String toolURL = apiUrl + "/tool/ifs/modifyToolInstanceToIfs"; |
|
|
ResponseData toolResponse = HttpClientUtil.doPostByRawWithPLM(toolURL, inData); |
|
|
ResponseData toolResponse = HttpClientUtil.doPostByRawWithPLM(toolURL, inData); |
|
|
if (!"200".equals(toolResponse.getCode())) { |
|
|
if (!"200".equals(toolResponse.getCode())) { |
|
|
throw new RuntimeException("IFS ToolInstance修改异常:" + toolResponse.getMsg()); |
|
|
throw new RuntimeException("IFS ToolInstance修改异常:" + toolResponse.getMsg()); |
|
|
} |
|
|
} |
|
|
String objStr = String.valueOf(toolResponse.getObj()); |
|
|
String objStr = String.valueOf(toolResponse.getObj()); |
|
|
IfsToolData ifsTool = JSON.parseObject(objStr, IfsToolData.class); |
|
|
|
|
|
|
|
|
IfsToolData ifsTool = JSON.parseObject(objStr, IfsToolData.class);*/ |
|
|
inData.setCreateDate(new Date()); |
|
|
inData.setCreateDate(new Date()); |
|
|
|
|
|
inData.setState("Active"); |
|
|
//2.调用方法保存当前的数据 |
|
|
//2.调用方法保存当前的数据 |
|
|
toolDao.updateToolInstance(inData); |
|
|
toolDao.updateToolInstance(inData); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @description: 调用存储过程修改工具实例 |
|
|
|
|
|
* @author LR |
|
|
|
|
|
* @date 2024/9/5 16:38 |
|
|
|
|
|
* @version 1.0 |
|
|
|
|
|
*/ |
|
|
|
|
|
public Map<String, Object> checkUpdateToolInstance(String site, String toolId, String toolInstance, String objectId, String normalWorkCenterNo, String normalProductionLine) { |
|
|
|
|
|
List<Object> params = new ArrayList<>(); |
|
|
|
|
|
params.add(site); |
|
|
|
|
|
params.add(toolId); |
|
|
|
|
|
params.add(toolInstance); |
|
|
|
|
|
params.add(objectId); |
|
|
|
|
|
params.add(normalWorkCenterNo); |
|
|
|
|
|
params.add(normalProductionLine); |
|
|
|
|
|
//调用存储过程 |
|
|
|
|
|
List<Map<String, Object>> resultList = procedureDao.getProcedureData("checkUpdateToolInstance", params); |
|
|
|
|
|
//处理返回的结果 |
|
|
|
|
|
return resultList.get(0); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
@Transactional |
|
|
@Transactional |
|
|
public void removeToolInstance(IfsToolInstance inData) { |
|
|
public void removeToolInstance(IfsToolInstance inData) { |
|
|
@ -384,13 +418,14 @@ public class ToolServiceImpl implements ToolService { |
|
|
if(toolInstanceData == null){ |
|
|
if(toolInstanceData == null){ |
|
|
throw new RuntimeException("当前工具实例不存在!"); |
|
|
throw new RuntimeException("当前工具实例不存在!"); |
|
|
} |
|
|
} |
|
|
|
|
|
//1.校验是否可以删除 目前不用校验 |
|
|
|
|
|
|
|
|
//1.校验存在调用接口 |
|
|
|
|
|
String toolURL = apiUrl + "/tool/ifs/removeToolInstanceToIfs"; |
|
|
|
|
|
|
|
|
//2.校验存在调用接口 |
|
|
|
|
|
/* String toolURL = apiUrl + "/tool/ifs/removeToolInstanceToIfs"; |
|
|
ResponseData toolResponse = HttpClientUtil.doPostByRawWithPLM(toolURL, inData); |
|
|
ResponseData toolResponse = HttpClientUtil.doPostByRawWithPLM(toolURL, inData); |
|
|
if (!"200".equals(toolResponse.getCode())) { |
|
|
if (!"200".equals(toolResponse.getCode())) { |
|
|
throw new RuntimeException("IFS ToolInstance删除异常:" + toolResponse.getMsg()); |
|
|
throw new RuntimeException("IFS ToolInstance删除异常:" + toolResponse.getMsg()); |
|
|
} |
|
|
|
|
|
|
|
|
}*/ |
|
|
//2.调用方法保存当前的数据 |
|
|
//2.调用方法保存当前的数据 |
|
|
toolDao.deleteToolInstance(inData); |
|
|
toolDao.deleteToolInstance(inData); |
|
|
} |
|
|
} |
|
|
@ -423,7 +458,7 @@ public class ToolServiceImpl implements ToolService { |
|
|
String resultMsg = String.valueOf(resultMap.get("result_msg")); |
|
|
String resultMsg = String.valueOf(resultMap.get("result_msg")); |
|
|
throw new RuntimeException(resultMsg); |
|
|
throw new RuntimeException(resultMsg); |
|
|
} |
|
|
} |
|
|
IfsToolInstanceDateData instanceDateData = new IfsToolInstanceDateData(); |
|
|
|
|
|
|
|
|
/* IfsToolInstanceDateData instanceDateData = new IfsToolInstanceDateData(); |
|
|
//属性拷贝 |
|
|
//属性拷贝 |
|
|
BeanUtils.copyProperties(inData, instanceDateData); |
|
|
BeanUtils.copyProperties(inData, instanceDateData); |
|
|
//设置时间的信息 |
|
|
//设置时间的信息 |
|
|
@ -439,7 +474,7 @@ public class ToolServiceImpl implements ToolService { |
|
|
String objStr = String.valueOf(toolResponse.getObj()); |
|
|
String objStr = String.valueOf(toolResponse.getObj()); |
|
|
IfsToolInstanceDateData ifsTool = JSON.parseObject(objStr, IfsToolInstanceDateData.class); |
|
|
IfsToolInstanceDateData ifsTool = JSON.parseObject(objStr, IfsToolInstanceDateData.class); |
|
|
inData.setIfsRowId(ifsTool.getIfsRowId()); |
|
|
inData.setIfsRowId(ifsTool.getIfsRowId()); |
|
|
inData.setIfsRowVersion(ifsTool.getIfsRowVersion()); |
|
|
|
|
|
|
|
|
inData.setIfsRowVersion(ifsTool.getIfsRowVersion());*/ |
|
|
//保存新增的数据 |
|
|
//保存新增的数据 |
|
|
toolDao.insertToolInstanceDate(inData); |
|
|
toolDao.insertToolInstanceDate(inData); |
|
|
} |
|
|
} |
|
|
@ -492,7 +527,7 @@ public class ToolServiceImpl implements ToolService { |
|
|
String resultMsg = String.valueOf(resultMap.get("result_msg")); |
|
|
String resultMsg = String.valueOf(resultMap.get("result_msg")); |
|
|
throw new RuntimeException(resultMsg); |
|
|
throw new RuntimeException(resultMsg); |
|
|
} |
|
|
} |
|
|
IfsToolInstanceDateData instanceDateData = new IfsToolInstanceDateData(); |
|
|
|
|
|
|
|
|
/* IfsToolInstanceDateData instanceDateData = new IfsToolInstanceDateData(); |
|
|
//属性拷贝 |
|
|
//属性拷贝 |
|
|
BeanUtils.copyProperties(inData, instanceDateData); |
|
|
BeanUtils.copyProperties(inData, instanceDateData); |
|
|
//设置时间的信息 |
|
|
//设置时间的信息 |
|
|
@ -508,7 +543,7 @@ public class ToolServiceImpl implements ToolService { |
|
|
String objStr = String.valueOf(toolResponse.getObj()); |
|
|
String objStr = String.valueOf(toolResponse.getObj()); |
|
|
IfsToolInstanceDateData ifsTool = JSON.parseObject(objStr, IfsToolInstanceDateData.class); |
|
|
IfsToolInstanceDateData ifsTool = JSON.parseObject(objStr, IfsToolInstanceDateData.class); |
|
|
inData.setIfsRowId(ifsTool.getIfsRowId()); |
|
|
inData.setIfsRowId(ifsTool.getIfsRowId()); |
|
|
inData.setIfsRowVersion(ifsTool.getIfsRowVersion()); |
|
|
|
|
|
|
|
|
inData.setIfsRowVersion(ifsTool.getIfsRowVersion());*/ |
|
|
//保存新增的数据 |
|
|
//保存新增的数据 |
|
|
toolDao.updateToolInstanceDate(inData); |
|
|
toolDao.updateToolInstanceDate(inData); |
|
|
} |
|
|
} |
|
|
@ -545,14 +580,14 @@ public class ToolServiceImpl implements ToolService { |
|
|
int id = inData.getId(); |
|
|
int id = inData.getId(); |
|
|
|
|
|
|
|
|
IfsToolInstanceDateData instanceDateData = new IfsToolInstanceDateData(); |
|
|
IfsToolInstanceDateData instanceDateData = new IfsToolInstanceDateData(); |
|
|
//属性拷贝 |
|
|
|
|
|
|
|
|
/*//属性拷贝 |
|
|
BeanUtils.copyProperties(inData, instanceDateData); |
|
|
BeanUtils.copyProperties(inData, instanceDateData); |
|
|
//2.校验存在调用接口 |
|
|
//2.校验存在调用接口 |
|
|
String toolURL = apiUrl + "/tool/ifs/removeToolInstanceDateToIfs"; |
|
|
String toolURL = apiUrl + "/tool/ifs/removeToolInstanceDateToIfs"; |
|
|
ResponseData toolResponse = HttpClientUtil.doPostByRawWithPLM(toolURL, instanceDateData); |
|
|
ResponseData toolResponse = HttpClientUtil.doPostByRawWithPLM(toolURL, instanceDateData); |
|
|
if (!"200".equals(toolResponse.getCode())) { |
|
|
if (!"200".equals(toolResponse.getCode())) { |
|
|
throw new RuntimeException("IFS ToolInstanceDate删除异常:" + toolResponse.getMsg()); |
|
|
throw new RuntimeException("IFS ToolInstanceDate删除异常:" + toolResponse.getMsg()); |
|
|
} |
|
|
|
|
|
|
|
|
}*/ |
|
|
//保存新增的数据 |
|
|
//保存新增的数据 |
|
|
toolDao.deleteToolInstanceDate(inData); |
|
|
toolDao.deleteToolInstanceDate(inData); |
|
|
} |
|
|
} |
|
|
|