排班计划添加校验

This commit is contained in:
yinjinlu-pc\尹金路 2023-06-25 19:33:16 +08:00
parent 3065ba2101
commit 1d934eb2d7
2 changed files with 13 additions and 0 deletions

View File

@ -5,7 +5,9 @@ import java.util.concurrent.Callable;
import java.util.concurrent.Future;
import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.collection.CollectionUtil;
import com.ktg.common.constant.UserConstants;
import com.ktg.mes.cal.domain.CalPlanTeam;
import com.ktg.mes.cal.service.ICalPlanTeamService;
import com.ktg.mes.cal.service.ICalShiftService;
import com.ktg.mes.cal.service.ICalTeamshiftService;
@ -113,6 +115,16 @@ public class CalPlanController extends BaseController
{
if(UserConstants.ORDER_STATUS_CONFIRMED.equals(calPlan.getStatus())){
//检查班组配置
List<CalPlanTeam> teams = calPlanTeamService.selectCalPlanTeamListByPlanId(calPlan.getPlanId());
if(CollectionUtil.isEmpty(teams)){
return AjaxResult.error("请配置班组!");
} else if(teams.size() != 2 && UserConstants.CAL_SHIFT_TYPE_TWO.equals(calPlan.getShiftType())){
return AjaxResult.error("两班倒请配置两个班组!");
} else if(teams.size() !=3 && UserConstants.CAL_SHIFT_TYPE_THREE.equals(calPlan.getShiftType())){
return AjaxResult.error("三倒请配置三个班组!");
}
calTeamshiftService.genRecords(calPlan.getPlanId());
}
return toAjax(calPlanService.updateCalPlan(calPlan));

View File

@ -43,6 +43,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="shiftCount != null "> and shift_count = #{shiftCount}</if>
<if test="status !=null and status !='' "> and status = #{status}</if>
</where>
order by create_time desc
</select>
<select id="selectCalPlanByPlanId" parameterType="Long" resultMap="CalPlanResult">