二级组成工序优化

highway
A0010407 1 year ago
parent 22d786f5db
commit e450cf0a4f

@ -89,11 +89,14 @@ public class ProRouteProcessController extends BaseController
// if(!proRouteProcessService.checkOrderNumExists(proRouteProcess)){ // if(!proRouteProcessService.checkOrderNumExists(proRouteProcess)){
// return AjaxResult.error("序号已存在!"); // return AjaxResult.error("序号已存在!");
// } // }
if(!proRouteProcessService.checkProcessExists(proRouteProcess)){ if(proRouteProcessService.checkProcessExists(proRouteProcess)){
return AjaxResult.error("不能重复添加工序!"); return AjaxResult.error("不能重复添加工序!");
} }
if(UserConstants.YES.equals(proRouteProcess.getKeyFlag()) && !proRouteProcessService.checkUpdateFlagUnique(proRouteProcess)){ // if(UserConstants.YES.equals(proRouteProcess.getKeyFlag()) && !proRouteProcessService.checkUpdateFlagUnique(proRouteProcess)){
return AjaxResult.error("当前工艺路线已经指定过关键工序"); // return AjaxResult.error("当前工艺路线已经指定过关键工序");
// }
if(proRouteProcessService.checkUpdateFlagUnique(proRouteProcess) && proRouteProcess.getKeyFlag().equals("Y")){
return AjaxResult.error("当前工艺路线已经指定过关键工序!");
} }
ProProcess process = proProcessService.selectProProcessByProcessId(proRouteProcess.getProcessId()); ProProcess process = proProcessService.selectProProcessByProcessId(proRouteProcess.getProcessId());
proRouteProcess.setProcessCode(process.getProcessCode()); proRouteProcess.setProcessCode(process.getProcessCode());
@ -133,12 +136,16 @@ public class ProRouteProcessController extends BaseController
// if(!proRouteProcessService.checkOrderNumExists(proRouteProcess)){ // if(!proRouteProcessService.checkOrderNumExists(proRouteProcess)){
// return AjaxResult.error("序号已存在!"); // return AjaxResult.error("序号已存在!");
// } // }
if(!proRouteProcessService.checkProcessExists(proRouteProcess)){ //判断修改的是本条数据
if(proRouteProcessService.checkProcessExists(proRouteProcess)){
return AjaxResult.error("不能重复添加工序!"); return AjaxResult.error("不能重复添加工序!");
} }
// if(UserConstants.YES.equals(proRouteProcess.getKeyFlag()) && !proRouteProcessService.checkUpdateFlagUnique(proRouteProcess)){ // if(UserConstants.YES.equals(proRouteProcess.getKeyFlag()) && !proRouteProcessService.checkUpdateFlagUnique(proRouteProcess)){
// return AjaxResult.error("当前工艺路线已经指定过关键工序"); // return AjaxResult.error("当前工艺路线已经指定过关键工序");
// } // }
if(proRouteProcessService.checkUpdateFlagUnique(proRouteProcess) && proRouteProcess.getKeyFlag().equals("Y")){
return AjaxResult.error("当前工艺路线已经指定过关键工序!");
}
ProProcess process = proProcessService.selectProProcessByProcessId(proRouteProcess.getProcessId()); ProProcess process = proProcessService.selectProProcessByProcessId(proRouteProcess.getProcessId());
proRouteProcess.setProcessCode(process.getProcessCode()); proRouteProcess.setProcessCode(process.getProcessCode());
proRouteProcess.setProcessName(process.getProcessName()); proRouteProcess.setProcessName(process.getProcessName());

@ -32,8 +32,8 @@ public interface ProRouteProcessMapper
public List<ProRouteProcess> selectProRouteProcessList(ProRouteProcess proRouteProcess); public List<ProRouteProcess> selectProRouteProcessList(ProRouteProcess proRouteProcess);
public ProRouteProcess checkOrderNumExists(ProRouteProcess proRouteProcess); public ProRouteProcess checkOrderNumExists(ProRouteProcess proRouteProcess);
public ProRouteProcess checkProcessExists(ProRouteProcess proRouteProcess); public String checkProcessExists(ProRouteProcess proRouteProcess);
public ProRouteProcess checkUpdateFlagUnique(ProRouteProcess proRouteProcess); public List<String> checkUpdateFlagUnique(ProRouteProcess proRouteProcess);
public ProRouteProcess findPreProcess(ProRouteProcess proRouteProcess); public ProRouteProcess findPreProcess(ProRouteProcess proRouteProcess);
@ -76,4 +76,10 @@ public interface ProRouteProcessMapper
* @return * @return
*/ */
public int deleteByRouteId(String routeId); public int deleteByRouteId(String routeId);
//查询修改的是不是本条数据
String checkProcessIdExist(ProRouteProcess proRouteProcess);
//查询关键工序是不是本条数据
String checkProcessFlagExist(ProRouteProcess proRouteProcess);
} }

@ -37,7 +37,6 @@ public interface IProRouteProcessService
/** /**
* *
* @param proRouteProcess
* @return * @return
*/ */
public Boolean checkProcessExists(ProRouteProcess proRouteProcess); public Boolean checkProcessExists(ProRouteProcess proRouteProcess);

@ -67,27 +67,27 @@ public class ProRouteProcessServiceImpl implements IProRouteProcessService
return UserConstants.UNIQUE; return UserConstants.UNIQUE;
} }
@Override // @Override
@DS("#header.poolName") // @DS("#header.poolName")
public Boolean checkProcessExists(ProRouteProcess proRouteProcess) { // public Boolean checkProcessExists(ProRouteProcess proRouteProcess) {
ProRouteProcess process = proRouteProcessMapper.checkProcessExists(proRouteProcess); // ProRouteProcess process = proRouteProcessMapper.checkProcessExists(proRouteProcess);
String recordId = proRouteProcess.getRecordId(); // String recordId = proRouteProcess.getRecordId();
if(StringUtils.isNotNull(process) && process.getRecordId().equals(recordId) ){ // if(StringUtils.isNotNull(process) && process.getRecordId().equals(recordId) ){
return UserConstants.NOT_UNIQUE; // return UserConstants.NOT_UNIQUE;
} // }
return UserConstants.UNIQUE; // return UserConstants.UNIQUE;
} // }
@Override // @Override
@DS("#header.poolName") // @DS("#header.poolName")
public Boolean checkUpdateFlagUnique(ProRouteProcess proRouteProcess) { // public Boolean checkUpdateFlagUnique(ProRouteProcess proRouteProcess) {
ProRouteProcess process = proRouteProcessMapper.checkUpdateFlagUnique(proRouteProcess); // ProRouteProcess process = proRouteProcessMapper.checkUpdateFlagUnique(proRouteProcess);
String recordId = proRouteProcess.getRecordId(); // String recordId = proRouteProcess.getRecordId();
if(StringUtils.isNotNull(process) && process.getRecordId().equals(recordId)){ // if(StringUtils.isNotNull(process) && process.getRecordId().equals(recordId)){
return UserConstants.NOT_UNIQUE; // return UserConstants.NOT_UNIQUE;
} // }
return UserConstants.UNIQUE; // return UserConstants.UNIQUE;
} // }
// @Override // @Override
// public boolean checkKeyProcess(ProFeedback feedback) { // public boolean checkKeyProcess(ProFeedback feedback) {
@ -191,4 +191,47 @@ public class ProRouteProcessServiceImpl implements IProRouteProcessService
public int deleteByRouteId(String routeId) { public int deleteByRouteId(String routeId) {
return proRouteProcessMapper.deleteByRouteId(routeId); return proRouteProcessMapper.deleteByRouteId(routeId);
} }
/**
*
*
* @return
*/
@Override
@DS("#header.poolName")
public Boolean checkProcessExists(ProRouteProcess proRouteProcess){
String code = proRouteProcessMapper.checkProcessExists(proRouteProcess);
//查询修改的是不是本条数据
String id = proRouteProcessMapper.checkProcessIdExist(proRouteProcess);
if(code == null || id.equals(proRouteProcess.getRecordId())){
return false;
}else{
return true;
}
}
/**
*
*
* @return
*/
@Override
@DS("#header.poolName")
public Boolean checkUpdateFlagUnique(ProRouteProcess proRouteProcess){
List<String> keyFlag = proRouteProcessMapper.checkUpdateFlagUnique(proRouteProcess);
//查询修改的是不是本条数据
boolean exit = keyFlag.contains("Y");//查询是否存在一个
//查询是否是本条数据
String id = proRouteProcessMapper.checkProcessFlagExist(proRouteProcess);
if(exit){
if(id.equals(proRouteProcess.getRecordId())){
return false;
}else{
return true;
}
}else{
return false;
}
}
} }

@ -70,26 +70,50 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where route_id = #{routeId} and order_num = #{orderNum} where route_id = #{routeId} and order_num = #{orderNum}
</select> </select>
<select id="checkProcessExists" parameterType="ProRouteProcess" resultMap="ProRouteProcessResult"> <!-- <select id="checkProcessExists" parameterType="ProRouteProcess" resultMap="ProRouteProcessResult">-->
select top 1 record_id, route_id, process_id, process_code, process_name, <!-- select top 1 record_id, route_id, process_id, process_code, process_name,-->
order_num, next_process_id, next_process_code, next_process_name, <!-- order_num, next_process_id, next_process_code, next_process_name,-->
link_type, default_pre_time, default_suf_time, color_code,key_flag, <!-- link_type, default_pre_time, default_suf_time, color_code,key_flag,-->
remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, <!-- remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by,-->
update_time <!-- update_time-->
<!-- from pro_route_process-->
<!-- where route_id = #{routeId} and process_id = #{processId}-->
<!-- </select>-->
<select id="checkProcessExists" parameterType="ProRouteProcess" resultType="java.lang.String">
select process_code
from pro_route_process from pro_route_process
where route_id = #{routeId} and process_id = #{processId} where route_id = #{routeId} and process_id = #{processId}
</select> </select>
<select id="checkUpdateFlagUnique" parameterType="ProRouteProcess" resultMap="ProRouteProcessResult"> <select id="checkProcessIdExist" parameterType="ProRouteProcess" resultType="java.lang.String">
select top 1 record_id, route_id, process_id, process_code, process_name, select record_id
order_num, next_process_id, next_process_code, next_process_name, from pro_route_process
link_type, default_pre_time, default_suf_time, color_code,key_flag, where route_id = #{routeId} and process_id = #{processId}
remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, </select>
update_time
<select id="checkProcessFlagExist" parameterType="ProRouteProcess" resultType="java.lang.String">
select record_id
from pro_route_process from pro_route_process
where route_id = #{routeId} and key_flag = 'Y' where route_id = #{routeId} and key_flag = 'Y'
</select> </select>
<!-- <select id="checkUpdateFlagUnique" parameterType="ProRouteProcess" resultMap="ProRouteProcessResult">-->
<!-- select top 1 record_id, route_id, process_id, process_code, process_name,-->
<!-- order_num, next_process_id, next_process_code, next_process_name,-->
<!-- link_type, default_pre_time, default_suf_time, color_code,key_flag,-->
<!-- remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by,-->
<!-- update_time-->
<!-- from pro_route_process-->
<!-- where route_id = #{routeId} and key_flag = 'Y'-->
<!-- </select>-->
<select id="checkUpdateFlagUnique" parameterType="ProRouteProcess" resultType="java.lang.String">
select key_flag
from pro_route_process
where route_id = #{routeId}
</select>
<select id="findPreProcess" parameterType="ProRouteProcess" resultMap="ProRouteProcessResult"> <select id="findPreProcess" parameterType="ProRouteProcess" resultMap="ProRouteProcessResult">
select top 1 record_id, route_id, process_id, process_code, process_name, select top 1 record_id, route_id, process_id, process_code, process_name,
order_num, next_process_id, next_process_code, next_process_name, order_num, next_process_id, next_process_code, next_process_name,

Loading…
Cancel
Save