mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
处理新增、修改排单的必传字段限制
This commit is contained in:
+4
-2
@@ -1,5 +1,7 @@
|
||||
package com.cf.imes.module.executor.controller.admin.plan;
|
||||
|
||||
import com.cf.imes.framework.es.core.valid.CreateGroup;
|
||||
import com.cf.imes.framework.es.core.valid.UpdateGroup;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderRespVO;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
@@ -35,14 +37,14 @@ public class PlanController {
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建排单")
|
||||
@PreAuthorize("@ss.hasPermission('executor:plan:create')")
|
||||
public CommonResult<Long> createPlan(@Valid @RequestBody PlanSaveReqVO createReqVO) {
|
||||
public CommonResult<Long> createPlan(@Validated(CreateGroup.class) @RequestBody PlanSaveReqVO createReqVO) {
|
||||
return success(planService.createPlan(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新排单")
|
||||
@PreAuthorize("@ss.hasPermission('executor:plan:update')")
|
||||
public CommonResult<Boolean> updatePlan(@Valid @RequestBody PlanSaveReqVO updateReqVO) {
|
||||
public CommonResult<Boolean> updatePlan(@Validated(UpdateGroup.class) @RequestBody PlanSaveReqVO updateReqVO) {
|
||||
planService.updatePlan(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
+9
-8
@@ -1,5 +1,6 @@
|
||||
package com.cf.imes.module.executor.controller.admin.plan.vo;
|
||||
|
||||
import com.cf.imes.framework.es.core.valid.CreateGroup;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
@@ -18,19 +19,19 @@ public class PlanSaveReqVO {
|
||||
private String planNo;
|
||||
|
||||
@Schema(description = "排序优先级", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "排序优先级不能为空")
|
||||
private Integer sort;
|
||||
//@NotNull(groups = CreateGroup.class,message = "排序优先级不能为空")
|
||||
private Long sort;
|
||||
|
||||
@Schema(description = "排单类型:1 混单排单,2 生产单排单", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotNull(message = "排单类型:1 混单排单,2 生产单排单不能为空")
|
||||
@NotNull(message = "排单类型:1 混单排单,2 生产单排单不能为空", groups = CreateGroup.class)
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "排单状态:0 新单,1 板材已申请,2 开料中,3 已开料", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "排单状态:0 新单,1 板材已申请,2 开料中,3 已开料不能为空")
|
||||
@NotNull(message = "排单状态:0 新单,1 板材已申请,2 开料中,3 已开料不能为空", groups = CreateGroup.class)
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "是否支付:0 否,1 是", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "是否支付:0 否,1 是不能为空")
|
||||
//@NotNull(message = "是否支付:0 否,1 是不能为空")
|
||||
private Boolean isPay;
|
||||
|
||||
@Schema(description = "机台 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "16707")
|
||||
@@ -38,7 +39,7 @@ public class PlanSaveReqVO {
|
||||
private Long machineId;
|
||||
|
||||
@Schema(description = "计划时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "计划时间不能为空")
|
||||
@NotNull(message = "计划时间不能为空", groups = CreateGroup.class)
|
||||
private LocalDateTime planTime;
|
||||
|
||||
/*@Schema(description = "生产单id列表", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@@ -51,10 +52,10 @@ public class PlanSaveReqVO {
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "生产操作人", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "生产操作人不能为空")
|
||||
@NotEmpty(message = "生产操作人不能为空", groups = CreateGroup.class)
|
||||
private String operator;
|
||||
|
||||
@Schema(description = "生产时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "生产时间不能为空")
|
||||
@NotNull(message = "生产时间不能为空", groups = CreateGroup.class)
|
||||
private LocalDateTime produceTime;
|
||||
}
|
||||
+1
-1
@@ -36,7 +36,7 @@ public class PlanDO extends BaseDO {
|
||||
/**
|
||||
* 排序优先级
|
||||
*/
|
||||
private Integer sort;
|
||||
private Long sort;
|
||||
/**
|
||||
* 排单类型:1 混单排单,2 生产单排单
|
||||
*/
|
||||
|
||||
+4
@@ -88,7 +88,10 @@ public class PlanServiceImpl implements PlanService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long createPlan(PlanSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
long sort = System.currentTimeMillis();
|
||||
PlanDO plan = BeanUtils.toBean(createReqVO, PlanDO.class);
|
||||
plan.setIsPay(Boolean.FALSE);
|
||||
plan.setSort(sort);
|
||||
planMapper.insert(plan);
|
||||
Long planId = plan.getId();
|
||||
/* List<Long> orderIds = createReqVO.getOrderIds();
|
||||
@@ -124,6 +127,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
validatePlanExists(updateReqVO.getId());
|
||||
// 更新
|
||||
PlanDO plan = BeanUtils.toBean(updateReqVO, PlanDO.class);
|
||||
plan.setIsPay(Boolean.FALSE);
|
||||
planMapper.updateById(plan);
|
||||
Long planId = plan.getId();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user