fix:套轴校验

This commit is contained in:
2024-10-29 16:29:38 +08:00
parent 8d7be82cab
commit d07ebd656d

View File

@@ -204,7 +204,11 @@ public class NbjPdaServiceImpl implements NbjPdaService {
if (pointCode.equals(tzzcPoint.getTruss_point_code2()) && ObjectUtil.isNotEmpty(tzzcPoint.getQzz_no2())) { if (pointCode.equals(tzzcPoint.getTruss_point_code2()) && ObjectUtil.isNotEmpty(tzzcPoint.getQzz_no2())) {
throw new BadRequestException("系统检测到点位[" + pointCode + "]状态不为空, 如实际已经清空,请手持操作点位清除!"); throw new BadRequestException("系统检测到点位[" + pointCode + "]状态不为空, 如实际已经清空,请手持操作点位清除!");
} }
// 分切计划校验
JSONArray rows = param.getJSONArray("row"); JSONArray rows = param.getJSONArray("row");
if (rows.size() > 2) {
throw new BadRequestException("一次只能绑定2个分切计划");
}
List<PdmBiSlittingproductionplan> planList = rows.toJavaList(PdmBiSlittingproductionplan.class); List<PdmBiSlittingproductionplan> planList = rows.toJavaList(PdmBiSlittingproductionplan.class);
List<String> orderIds = planList.stream() List<String> orderIds = planList.stream()
.map(o -> o.getWorkorder_id()) .map(o -> o.getWorkorder_id())
@@ -212,6 +216,10 @@ public class NbjPdaServiceImpl implements NbjPdaService {
List<PdmBiSlittingproductionplan> plans = slittingproductionplanService.getByIds(orderIds); List<PdmBiSlittingproductionplan> plans = slittingproductionplanService.getByIds(orderIds);
// 当前套轴的分切计划 // 当前套轴的分切计划
PdmBiSlittingproductionplan demoPlan = plans.get(0); PdmBiSlittingproductionplan demoPlan = plans.get(0);
boolean flag = planList.stream().anyMatch(p -> !p.getUp_or_down().equals(demoPlan.getUp_or_down()));
if (flag) {
throw new BadRequestException("分切计划需要都是在同一根轴");
}
String resourceName = demoPlan.getResource_name(); String resourceName = demoPlan.getResource_name();
// 生成虚拟气胀轴编码 // 生成虚拟气胀轴编码
String qzzNo = TaskUtils.createVirtualQzzNo(resourceName, "yyMMddHHmmss", demoPlan); String qzzNo = TaskUtils.createVirtualQzzNo(resourceName, "yyMMddHHmmss", demoPlan);