diff --git a/cf-module-prod-executor/cf-module-prod-executor-api/src/main/java/com/cf/imes/module/executor/enums/ErrorCodeConstants.java b/cf-module-prod-executor/cf-module-prod-executor-api/src/main/java/com/cf/imes/module/executor/enums/ErrorCodeConstants.java index c851cba16..cc7c5375f 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-api/src/main/java/com/cf/imes/module/executor/enums/ErrorCodeConstants.java +++ b/cf-module-prod-executor/cf-module-prod-executor-api/src/main/java/com/cf/imes/module/executor/enums/ErrorCodeConstants.java @@ -60,4 +60,6 @@ public interface ErrorCodeConstants { ErrorCode FILE_READ_ERR = new ErrorCode(1_002_029_012, "文件读取错误"); ErrorCode FILE_ADD_ERR = new ErrorCode(1_002_029_012, "文件已经存在是否强制保存"); ErrorCode FILE_UPLOAD_ERR = new ErrorCode(1_002_029_012, "文件内容为空"); + + ErrorCode SOURCE_NOT_EXITS_ERROR = new ErrorCode(1_002_029_013, "源数据查询失败"); } diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/enums/OrderItemType.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/enums/OrderItemType.java new file mode 100644 index 000000000..68cb9db86 --- /dev/null +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/enums/OrderItemType.java @@ -0,0 +1,33 @@ +package com.cf.imes.module.executor.enums; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +/** + * 生产单明细类型 + * + * @author Gqr + * @since 2024/6/7 14:50 + */ +@RequiredArgsConstructor +@Getter +public enum OrderItemType { + + BOARD(1, "板材"), + + PARTS(2, "五金/配件"), + + OTHER(3, "其他"), + + QUOTE_PARTS(4, "报价配件"); + + /** + * 类型编码 + */ + private final Integer code; + + /** + * 描述 + */ + private final String desc; +} diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/enums/OrderPlanStatusEnum.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/enums/OrderPlanStatusEnum.java new file mode 100644 index 000000000..4f993f5a8 --- /dev/null +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/enums/OrderPlanStatusEnum.java @@ -0,0 +1,32 @@ +package com.cf.imes.module.executor.enums; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +/** + * 排单状态 + * + * @author Gqr + * @since 2024/6/7 14:25 + */ +@RequiredArgsConstructor +@Getter +public enum OrderPlanStatusEnum { + NEW(0, "新单"), + + APPLY(1, "板材已申请"), + + OPENING(2, "开料中"), + + OPENED(3, "已开料"); + + /** + * 类型编码 + */ + private final Integer code; + + /** + * 描述 + */ + private final String desc; +} \ No newline at end of file diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/enums/OrderPlateFilterTypeEnum.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/enums/OrderPlateFilterTypeEnum.java new file mode 100644 index 000000000..26bda1b9a --- /dev/null +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/enums/OrderPlateFilterTypeEnum.java @@ -0,0 +1,32 @@ +package com.cf.imes.module.executor.enums; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +/** + * 生产单板件排单过滤类型 + * + * @author Gqr + * @since 2024/6/7 14:31 + */ +@RequiredArgsConstructor +@Getter +public enum OrderPlateFilterTypeEnum { + HAS_CUT_THROUGH_SHAPE(1, "有挖穿造型"), + + HAS_CUT_PUNCH(2, "有挖穿孔"), + + HAS_2D_KNIFE_PATHS(4, "有二维刀路"), + + STACKABLE(8, "可叠"); + + /** + * 类型编码 + */ + private final Integer code; + + /** + * 描述 + */ + private final String desc; +} diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/order/OrderServiceImpl.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/order/OrderServiceImpl.java index f3cb6ee4d..a9093cc00 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/order/OrderServiceImpl.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/order/OrderServiceImpl.java @@ -655,13 +655,16 @@ public class OrderServiceImpl implements OrderService { case "配件汇总1-模板.xlsx":// 配件汇总 map.put(orderDO, orderPartsMapper.selectPartAll(orderDO.getId(), SecurityFrameworkUtils.getLoginUser().getOrganId())); break; - case "板材明细-按房间-模板.xlsx":// + case "板材明细-按房间-模板.xlsx": break; - case "板材明细-按板材-模板.xlsx":// + case "板材明细-按板材-模板.xlsx": + map.put(orderDO, plateMapper.selectPlateGoodsList(orderDO.getId(), SecurityFrameworkUtils.getLoginUser().getOrganId())); + break; - case "板材汇总-按房间-模板.xlsx":// + case "板材汇总-按房间-模板.xlsx": break; - case "板材汇总-按板材-模板.xlsx":// + case "板材汇总-按板材-模板.xlsx": + map.put(orderDO, plateMapper.selectPlateGoodsList(orderDO.getId(), SecurityFrameworkUtils.getLoginUser().getOrganId())); break; default: // 处理默认情况,可以选择忽略或者做其他处理 diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/fileConversion/admin/api/webcad/ApiTypeRealize.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/fileConversion/admin/api/webcad/ApiTypeRealize.java index bb5de1295..68213a96b 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/fileConversion/admin/api/webcad/ApiTypeRealize.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/fileConversion/admin/api/webcad/ApiTypeRealize.java @@ -498,7 +498,7 @@ public class ApiTypeRealize { .groupId(0L) .partsId(0L) .plateId(plateId) - .num(0.0) + .num(1.0) .build(); if (plateDetail.get(plate.getInteger("BlockNo")) != null) { diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/type/板材汇总-按房间-模板.xlsx b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/type/板材汇总-按房间-模板.xlsx index b72c7c80e..30ed4d786 100644 Binary files a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/type/板材汇总-按房间-模板.xlsx and b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/type/板材汇总-按房间-模板.xlsx differ diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/type/板材汇总-按板材-模板.xlsx b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/type/板材汇总-按板材-模板.xlsx index f66c0d0d6..8b8535da9 100644 Binary files a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/type/板材汇总-按板材-模板.xlsx and b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/type/板材汇总-按板材-模板.xlsx differ diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/type/生产单Excel导入错误导出模板.xlsx b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/type/生产单Excel导入错误导出模板.xlsx index 5acc4721d..8f98befc8 100644 Binary files a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/type/生产单Excel导入错误导出模板.xlsx and b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/type/生产单Excel导入错误导出模板.xlsx differ diff --git a/cf-module-prod-manage/cf-module-prod-manage-api/src/main/java/com/cf/imes/module/manage/enums/DictTypeConstants.java b/cf-module-prod-manage/cf-module-prod-manage-api/src/main/java/com/cf/imes/module/manage/enums/DictTypeConstants.java new file mode 100644 index 000000000..005e62b4d --- /dev/null +++ b/cf-module-prod-manage/cf-module-prod-manage-api/src/main/java/com/cf/imes/module/manage/enums/DictTypeConstants.java @@ -0,0 +1,11 @@ +package com.cf.imes.module.manage.enums; + +/** + * Manage 字典类型的枚举类 + * + * @author 晨丰科技 + */ +public interface DictTypeConstants { + + String SYNTHESIS_TYPE = "synthesisType";//加工组类型 +} diff --git a/cf-module-prod-manage/cf-module-prod-manage-api/src/main/java/com/cf/imes/module/manage/enums/RemainPlateStatusEnum.java b/cf-module-prod-manage/cf-module-prod-manage-api/src/main/java/com/cf/imes/module/manage/enums/RemainPlateStatusEnum.java new file mode 100644 index 000000000..d979e2dde --- /dev/null +++ b/cf-module-prod-manage/cf-module-prod-manage-api/src/main/java/com/cf/imes/module/manage/enums/RemainPlateStatusEnum.java @@ -0,0 +1,22 @@ +package com.cf.imes.module.manage.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public enum RemainPlateStatusEnum { + UNUSED(0, "未使用"), + IN_USE(1, "使用中"); + + private final Integer status; + private String description; + + public boolean equals(Integer status) { + return this.status .equals(status) ; + } + + public boolean equals(RemainPlateStatusEnum enableStatusEnum) { + return enableStatusEnum != null && enableStatusEnum.status .equals(this.getStatus()) ; + } +} diff --git a/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/java/com/cf/imes/module/manage/controller/admin/plate/RemainPlateController.java b/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/java/com/cf/imes/module/manage/controller/admin/plate/RemainPlateController.java index 1136477f6..2dcba5a0c 100644 --- a/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/java/com/cf/imes/module/manage/controller/admin/plate/RemainPlateController.java +++ b/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/java/com/cf/imes/module/manage/controller/admin/plate/RemainPlateController.java @@ -5,6 +5,7 @@ import com.cf.imes.module.manage.controller.admin.plate.vo.remain.RemainPlateRes import com.cf.imes.module.manage.controller.admin.plate.vo.remain.RemainPlateSaveReqVO; import com.cf.imes.module.manage.dal.dataobject.remainplaten.RemainPlateDO; import com.cf.imes.module.manage.service.remainplaten.RemainPlateService; +import io.swagger.v3.oas.annotations.Parameters; import org.springframework.web.bind.annotation.*; import org.springframework.validation.annotation.Validated; import org.springframework.security.access.prepost.PreAuthorize; @@ -30,7 +31,7 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; -@Tag(name = "管理后台 - 生产单余料板表 order_remain_plate_{N}") +@Tag(name = "管理后台 - 生产单余料板表") @RestController @RequestMapping("/manage/remain-plate") @Validated @@ -40,31 +41,61 @@ public class RemainPlateController { private RemainPlateService remainPlateService; @PostMapping("/create") - @Operation(summary = "创建生产单余料板表 order_remain_plate_{N}") + @Operation(summary = "创建生产单余料板表") @PreAuthorize("@ss.hasPermission('manage:remain-plate:create')") public CommonResult createRemainPlate(@Valid @RequestBody RemainPlateSaveReqVO createReqVO) { return success(remainPlateService.createRemainPlate(createReqVO)); } @PutMapping("/update") - @Operation(summary = "更新生产单余料板表 order_remain_plate_{N}") + @Operation(summary = "更新生产单余料板表") @PreAuthorize("@ss.hasPermission('manage:remain-plate:update')") public CommonResult updateRemainPlate(@Valid @RequestBody RemainPlateSaveReqVO updateReqVO) { remainPlateService.updateRemainPlate(updateReqVO); return success(true); } + @PutMapping("/updateStatus") + @Operation(summary = "余料板批量核销") + @Parameters({ + @Parameter(name = "id", description = "余料板id集", required = true), + @Parameter(name = "status", description = "修改的状态", required = true , example = "1"), + @Parameter(name = "useType", description = "使用类型,0核销,1排单,2补板", required = true , example = "1"), + @Parameter(name = "planId", description = "排单 ID", example = "1") + }) + @PreAuthorize("@ss.hasPermission('manage:remain-plate:update')") + public CommonResult updateRemainPlate(@RequestParam("id") Set ids, + @RequestParam("status") Integer status, + @RequestParam("useType") Integer useType, + @RequestParam("planId") Long planId) { + remainPlateService.updateRemainPlateStatus(ids,status,useType,planId); + return success(true); + } + + @PutMapping("/revertUpdate") + @Operation(summary = "余料板批量释放") + @Parameters({ + @Parameter(name = "id", description = "余料板id集", required = true), + @Parameter(name = "status", description = "修改的状态", required = true , example = "1") + }) + @PreAuthorize("@ss.hasPermission('manage:remain-plate:update')") + public CommonResult updateRemainPlate(@RequestParam("id") Set ids, + @RequestParam("status") Integer status) { + remainPlateService.revertRemainPlateStatus(ids,status); + return success(true); + } + @DeleteMapping("/delete") - @Operation(summary = "删除生产单余料板表 order_remain_plate_{N}") + @Operation(summary = "删除生产单余料板表") @Parameter(name = "id", description = "编号", required = true) @PreAuthorize("@ss.hasPermission('manage:remain-plate:delete')") - public CommonResult deleteRemainPlate(@RequestParam("id") Long id) { - remainPlateService.deleteRemainPlate(id); + public CommonResult deleteRemainPlate(@RequestParam("id") Set ids) { + remainPlateService.deleteRemainPlate(ids); return success(true); } @GetMapping("/get") - @Operation(summary = "获得生产单余料板表 order_remain_plate_{N}") + @Operation(summary = "获得生产单余料板表") @Parameter(name = "id", description = "编号", required = true, example = "1024") @PreAuthorize("@ss.hasPermission('manage:remain-plate:query')") public CommonResult getRemainPlate(@RequestParam("id") Long id) { @@ -73,7 +104,7 @@ public class RemainPlateController { } @GetMapping("/page") - @Operation(summary = "获得生产单余料板表 order_remain_plate_{N}分页") + @Operation(summary = "获得生产单余料板表分页") @PreAuthorize("@ss.hasPermission('manage:remain-plate:query')") public CommonResult> getRemainPlatePage(@Valid RemainPlatePageReqVO pageReqVO) { PageResult pageResult = remainPlateService.getRemainPlatePage(pageReqVO); @@ -81,7 +112,7 @@ public class RemainPlateController { } @GetMapping("/export-excel") - @Operation(summary = "导出生产单余料板表 order_remain_plate_{N} Excel") + @Operation(summary = "导出生产单余料板表Excel") @PreAuthorize("@ss.hasPermission('manage:remain-plate:export')") @OperateLog(type = EXPORT) public void exportRemainPlateExcel(@Valid RemainPlatePageReqVO pageReqVO, diff --git a/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/java/com/cf/imes/module/manage/controller/admin/plate/vo/remain/RemainPlatePageReqVO.java b/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/java/com/cf/imes/module/manage/controller/admin/plate/vo/remain/RemainPlatePageReqVO.java index acace44b5..04ba05ee4 100644 --- a/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/java/com/cf/imes/module/manage/controller/admin/plate/vo/remain/RemainPlatePageReqVO.java +++ b/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/java/com/cf/imes/module/manage/controller/admin/plate/vo/remain/RemainPlatePageReqVO.java @@ -19,12 +19,21 @@ public class RemainPlatePageReqVO extends PageParam { @Schema(description = "排单 ID", example = "16628") private Long planId; + @Schema(description = "组织id", example = "1") + private Long organId; + @Schema(description = "初始排单 ID", example = "6628") private Long initPlanId; - @Schema(description = "余料板状态,0未使用,1使用中,2已使用", example = "1") + @Schema(description = "余料板状态,0未使用,1使用中", example = "0") private Integer status; + @Schema(description = "是否为开料添加,0否,1是", example = "0") + private Boolean isCutting; + + @Schema(description = "使用类型,0核销,1排单,2补板", example = "0") + private Integer useType; + @Schema(description = "商品 ID", example = "7425") private String goodsId; @@ -38,10 +47,10 @@ public class RemainPlatePageReqVO extends PageParam { private String color; @Schema(description = "宽度") - private BigDecimal width; + private BigDecimal[] width; @Schema(description = "长度") - private BigDecimal length; + private BigDecimal[] length; @Schema(description = "厚度") private BigDecimal thickness; @@ -62,7 +71,7 @@ public class RemainPlatePageReqVO extends PageParam { private String remark; @Schema(description = "轮廊数据,Json 串") - private String outline; + private String outLineJson; @Schema(description = "创建日期") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) diff --git a/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/java/com/cf/imes/module/manage/controller/admin/plate/vo/remain/RemainPlateRespVO.java b/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/java/com/cf/imes/module/manage/controller/admin/plate/vo/remain/RemainPlateRespVO.java index 8e46093d2..03736b370 100644 --- a/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/java/com/cf/imes/module/manage/controller/admin/plate/vo/remain/RemainPlateRespVO.java +++ b/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/java/com/cf/imes/module/manage/controller/admin/plate/vo/remain/RemainPlateRespVO.java @@ -16,6 +16,10 @@ public class RemainPlateRespVO { @ExcelProperty("余料板 ID") private Long id; + @Schema(description = "组织id", example = "1") + @ExcelIgnore + private Long organId; + @Schema(description = "排单 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "16628") @ExcelProperty("排单 ID") private Long planId; @@ -24,10 +28,18 @@ public class RemainPlateRespVO { @ExcelProperty("初始排单 ID") private Long initPlanId; - @Schema(description = "余料板状态,0未使用,1使用中,2已使用", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") - @ExcelProperty("余料板状态,0未使用,1使用中,2已使用") + @Schema(description = "余料板状态,0未使用,1使用中", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @ExcelProperty("余料板状态,0未使用,1使用中") private Integer status; + @Schema(description = "是否为开料添加,0否,1是", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @ExcelProperty("是否为开料添加,0否,1是") + private Boolean isCutting; + + @Schema(description = "使用类型,0核销,1排单,2补板", example = "0") + @ExcelProperty("使用类型,0核销,1排单,2补板") + private Integer useType; + @Schema(description = "商品 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "7425") @ExcelProperty("商品 ID") private String goodsId; @@ -78,7 +90,7 @@ public class RemainPlateRespVO { @Schema(description = "轮廊数据,Json 串", requiredMode = Schema.RequiredMode.REQUIRED) @ExcelProperty("轮廊数据,Json 串") - private String outline; + private String outLineJson; @Schema(description = "创建日期", requiredMode = Schema.RequiredMode.REQUIRED) @ExcelProperty("创建日期") diff --git a/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/java/com/cf/imes/module/manage/controller/admin/plate/vo/remain/RemainPlateSaveReqVO.java b/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/java/com/cf/imes/module/manage/controller/admin/plate/vo/remain/RemainPlateSaveReqVO.java index 1ea6928a3..ddd6083b0 100644 --- a/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/java/com/cf/imes/module/manage/controller/admin/plate/vo/remain/RemainPlateSaveReqVO.java +++ b/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/java/com/cf/imes/module/manage/controller/admin/plate/vo/remain/RemainPlateSaveReqVO.java @@ -1,5 +1,6 @@ package com.cf.imes.module.manage.controller.admin.plate.vo.remain; +import com.alibaba.excel.annotation.ExcelProperty; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; import javax.validation.constraints.NotEmpty; @@ -10,21 +11,29 @@ import java.math.BigDecimal; @Data public class RemainPlateSaveReqVO { - @Schema(description = "余料板 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "16470") + @Schema(description = "余料板 ID") private Long id; - @Schema(description = "排单 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "16628") - @NotNull(message = "排单 ID不能为空") + @Schema(description = "组织id", example = "1") + private Long organId; + + @Schema(description = "排单 ID") private Long planId; - @Schema(description = "初始排单 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "6628") - @NotNull(message = "初始排单 ID不能为空") + @Schema(description = "初始排单 ID") private Long initPlanId; @Schema(description = "余料板状态,0未使用,1使用中,2已使用", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") @NotNull(message = "余料板状态,0未使用,1使用中,2已使用不能为空") private Integer status; + @Schema(description = "是否为开料添加,0否,1是", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotNull(message = "是否为开料添加,0否,1是") + private Boolean isCutting; + + @Schema(description = "使用类型,0核销,1排单,2补板", example = "0") + private Integer useType; + @Schema(description = "商品 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "7425") @NotEmpty(message = "商品 ID不能为空") private String goodsId; @@ -71,6 +80,6 @@ public class RemainPlateSaveReqVO { @Schema(description = "轮廊数据,Json 串", requiredMode = Schema.RequiredMode.REQUIRED) @NotEmpty(message = "轮廊数据,Json 串不能为空") - private String outline; + private String outLineJson; } \ No newline at end of file diff --git a/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/java/com/cf/imes/module/manage/dal/dataobject/remainplaten/RemainPlateDO.java b/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/java/com/cf/imes/module/manage/dal/dataobject/remainplaten/RemainPlateDO.java index 11977afbd..14ce761cf 100644 --- a/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/java/com/cf/imes/module/manage/dal/dataobject/remainplaten/RemainPlateDO.java +++ b/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/java/com/cf/imes/module/manage/dal/dataobject/remainplaten/RemainPlateDO.java @@ -42,6 +42,14 @@ public class RemainPlateDO extends BaseDO { * 余料板状态,0未使用,1使用中,2已使用 */ private Integer status; + /** + * 是否为开料添加,0否,1是 + */ + private Boolean isCutting; + /** + * 使用类型,0核销,1排单,2补板 + */ + private Integer useType; /** * 商品 ID */ @@ -93,6 +101,6 @@ public class RemainPlateDO extends BaseDO { /** * 轮廊数据,Json 串 */ - private String outline; + private String outLineJson; } \ No newline at end of file diff --git a/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/java/com/cf/imes/module/manage/dal/mysql/remainplaten/RemainPlateMapper.java b/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/java/com/cf/imes/module/manage/dal/mysql/remainplaten/RemainPlateMapper.java index 4b287e87c..3cdc618b0 100644 --- a/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/java/com/cf/imes/module/manage/dal/mysql/remainplaten/RemainPlateMapper.java +++ b/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/java/com/cf/imes/module/manage/dal/mysql/remainplaten/RemainPlateMapper.java @@ -1,5 +1,6 @@ package com.cf.imes.module.manage.dal.mysql.remainplaten; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX; import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX; @@ -7,6 +8,8 @@ import com.cf.imes.module.manage.controller.admin.plate.vo.remain.RemainPlatePag import com.cf.imes.module.manage.dal.dataobject.remainplaten.RemainPlateDO; import org.apache.ibatis.annotations.Mapper; +import java.util.Set; + /** * 生产单余料板表 order_remain_plate_{N} Mapper * @@ -21,20 +24,32 @@ public interface RemainPlateMapper extends BaseMapperX { .eqIfPresent(RemainPlateDO::getInitPlanId, reqVO.getInitPlanId()) .eqIfPresent(RemainPlateDO::getStatus, reqVO.getStatus()) .eqIfPresent(RemainPlateDO::getGoodsId, reqVO.getGoodsId()) + .eqIfPresent(RemainPlateDO::getIsCutting, reqVO.getIsCutting()) .likeIfPresent(RemainPlateDO::getName, reqVO.getName()) .eqIfPresent(RemainPlateDO::getMaterial, reqVO.getMaterial()) .eqIfPresent(RemainPlateDO::getColor, reqVO.getColor()) - .eqIfPresent(RemainPlateDO::getWidth, reqVO.getWidth()) - .eqIfPresent(RemainPlateDO::getLength, reqVO.getLength()) .eqIfPresent(RemainPlateDO::getThickness, reqVO.getThickness()) .eqIfPresent(RemainPlateDO::getBrand, reqVO.getBrand()) .eqIfPresent(RemainPlateDO::getPlaceStyle, reqVO.getPlaceStyle()) .eqIfPresent(RemainPlateDO::getStore, reqVO.getStore()) .eqIfPresent(RemainPlateDO::getCount, reqVO.getCount()) .eqIfPresent(RemainPlateDO::getRemark, reqVO.getRemark()) - .eqIfPresent(RemainPlateDO::getOutline, reqVO.getOutline()) + .eqIfPresent(RemainPlateDO::getUseType, reqVO.getUseType()) + .eqIfPresent(RemainPlateDO::getOrganId, reqVO.getOrganId()) + .eqIfPresent(RemainPlateDO::getOutLineJson, reqVO.getOutLineJson()) + .betweenIfPresent(RemainPlateDO::getWidth, reqVO.getWidth()) + .betweenIfPresent(RemainPlateDO::getLength, reqVO.getLength()) .betweenIfPresent(RemainPlateDO::getCreateTime, reqVO.getCreateTime()) .orderByDesc(RemainPlateDO::getId)); } + // 批量修改状态 + default void updateRemainPlateStatus(Set ids, Integer status, Integer useType,Long organId,Long planId) { + update(new UpdateWrapper() + .set("status", status) + .set("use_type", useType) + .set("plan_id",planId) + .eq("organ_id",organId) + .in("id", ids)); + } } \ No newline at end of file diff --git a/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/java/com/cf/imes/module/manage/service/remainplaten/RemainPlateService.java b/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/java/com/cf/imes/module/manage/service/remainplaten/RemainPlateService.java index ecec41ff7..99546599e 100644 --- a/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/java/com/cf/imes/module/manage/service/remainplaten/RemainPlateService.java +++ b/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/java/com/cf/imes/module/manage/service/remainplaten/RemainPlateService.java @@ -6,16 +6,17 @@ import com.cf.imes.module.manage.controller.admin.plate.vo.remain.RemainPlateSav import com.cf.imes.module.manage.dal.dataobject.remainplaten.RemainPlateDO; import javax.validation.Valid; +import java.util.Set; /** - * 生产单余料板表 order_remain_plate_{N} Service 接口 + * 生产单余料板表 Service 接口 * * @author 晨丰科技 */ public interface RemainPlateService { /** - * 创建生产单余料板表 order_remain_plate_{N} + * 创建生产单余料板表 * * @param createReqVO 创建信息 * @return 编号 @@ -23,32 +24,50 @@ public interface RemainPlateService { Long createRemainPlate(@Valid RemainPlateSaveReqVO createReqVO); /** - * 更新生产单余料板表 order_remain_plate_{N} + * 批量核销 + * + * @param ids 编号 + * @param status 状态 + * @param useType 使用类型 + * @param planId 排单id + */ + void updateRemainPlateStatus(Set ids, Integer status,Integer useType,Long planId); + + /** + * 更新生产单余料板表 + * + * @param ids 编号 + * @param status 状态 + */ + void revertRemainPlateStatus(Set ids, Integer status); + + /** + * 核销板材库 * * @param updateReqVO 更新信息 */ void updateRemainPlate(@Valid RemainPlateSaveReqVO updateReqVO); /** - * 删除生产单余料板表 order_remain_plate_{N} + * 删除生产单余料板表 * - * @param id 编号 + * @param ids 编号 */ - void deleteRemainPlate(Long id); + void deleteRemainPlate(Set ids); /** - * 获得生产单余料板表 order_remain_plate_{N} + * 获得生产单余料板表 * * @param id 编号 - * @return 生产单余料板表 order_remain_plate_{N} + * @return 生产单余料板表 */ RemainPlateDO getRemainPlate(Long id); /** - * 获得生产单余料板表 order_remain_plate_{N}分页 + * 获得生产单余料板表 * * @param pageReqVO 分页查询 - * @return 生产单余料板表 order_remain_plate_{N}分页 + * @return 生产单余料板表 */ PageResult getRemainPlatePage(RemainPlatePageReqVO pageReqVO); diff --git a/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/java/com/cf/imes/module/manage/service/remainplaten/RemainPlateServiceImpl.java b/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/java/com/cf/imes/module/manage/service/remainplaten/RemainPlateServiceImpl.java index dad8ac4a8..298f310a1 100644 --- a/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/java/com/cf/imes/module/manage/service/remainplaten/RemainPlateServiceImpl.java +++ b/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/java/com/cf/imes/module/manage/service/remainplaten/RemainPlateServiceImpl.java @@ -1,9 +1,11 @@ package com.cf.imes.module.manage.service.remainplaten; +import com.cf.imes.framework.organ.core.context.OrganContextHolder; import com.cf.imes.module.manage.controller.admin.plate.vo.remain.RemainPlatePageReqVO; import com.cf.imes.module.manage.controller.admin.plate.vo.remain.RemainPlateSaveReqVO; import com.cf.imes.module.manage.dal.dataobject.remainplaten.RemainPlateDO; import com.cf.imes.module.manage.dal.mysql.remainplaten.RemainPlateMapper; +import com.cf.imes.module.manage.enums.RemainPlateStatusEnum; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; import com.cf.imes.framework.common.pojo.PageResult; @@ -13,8 +15,10 @@ import com.cf.imes.framework.common.util.object.BeanUtils; import javax.annotation.Resource; +import java.util.Set; + import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; -import static com.cf.imes.module.system.enums.ErrorCodeConstants.REMAIN_PLATE_NOT_EXISTS; +import static com.cf.imes.module.system.enums.ErrorCodeConstants.*; /** * 生产单余料板表 order_remain_plate_{N} Service 实现类 @@ -37,21 +41,58 @@ public class RemainPlateServiceImpl implements RemainPlateService { return remainPlate.getId(); } + @Override + public void updateRemainPlateStatus(Set ids, Integer status, Integer useType,Long planId) { + //判断是否符合核销标准 + validateRemainPlateStatus(ids,RemainPlateStatusEnum.UNUSED.getStatus()); + //以id为条件批量修改余料库中的状态 + remainPlateMapper.updateRemainPlateStatus(ids, status, useType, OrganContextHolder.getOrganId(),planId); + } + + @Override + public void revertRemainPlateStatus(Set ids, Integer status) { + // 判断余料的状态 为使用中 + validateRemainPlateStatus(ids,RemainPlateStatusEnum.IN_USE.getStatus()); + remainPlateMapper.updateRemainPlateStatus(ids, status, null, OrganContextHolder.getOrganId(),null); + } + @Override public void updateRemainPlate(RemainPlateSaveReqVO updateReqVO) { // 校验存在 validateRemainPlateExists(updateReqVO.getId()); - // 更新 - RemainPlateDO updateObj = BeanUtils.toBean(updateReqVO, RemainPlateDO.class); + // 是否使用 + if (validateRemainPlateStatus(updateReqVO.getId()) == RemainPlateStatusEnum.IN_USE.getStatus()){ + throw exception(REMAIN_PLATE_STATUS_USED); + } + // 判断是否为开料添加 + RemainPlateDO updateObj = new RemainPlateDO(); + if (validateRemainPlateIsCutting(updateReqVO.getId())){ + updateObj.setRemark(updateReqVO.getRemark()); + }else { + // 更新 + updateObj = BeanUtils.toBean(updateReqVO, RemainPlateDO.class); + } remainPlateMapper.updateById(updateObj); } @Override - public void deleteRemainPlate(Long id) { - // 校验存在 - validateRemainPlateExists(id); + public void deleteRemainPlate(Set ids) { + // 判断余料的状态 为使用中 + validateRemainPlateStatus(ids,RemainPlateStatusEnum.IN_USE.getStatus()); // 删除 - remainPlateMapper.deleteById(id); + remainPlateMapper.deleteBatchIds(ids); + } + + // 判断余料板是否正在使用 + private void validateRemainPlateStatus(Set ids, Integer status) { + for (Long id : ids) { + if (validateRemainPlateStatus(id) == status) { + if (status == RemainPlateStatusEnum.IN_USE.getStatus()) + throw exception(REMAIN_PLATE_STATUS_USED); + if (status == RemainPlateStatusEnum.UNUSED.getStatus()) + throw exception(REMAIN_PLATE_STATUS_NO_USED); + } + } } private void validateRemainPlateExists(Long id) { @@ -60,6 +101,18 @@ public class RemainPlateServiceImpl implements RemainPlateService { } } + private boolean validateRemainPlateIsCutting(Long id) { + return remainPlateMapper.selectById(id).getIsCutting(); + } + + private Integer validateRemainPlateStatus(Long id) { + return remainPlateMapper.selectById(id).getStatus(); + } + + private Integer validateRemainPlateUseType(Long id) { + return remainPlateMapper.selectById(id).getUseType(); + } + @Override public RemainPlateDO getRemainPlate(Long id) { return remainPlateMapper.selectById(id); diff --git a/cf-module-system/cf-module-system-api/src/main/java/com/cf/imes/module/system/enums/ErrorCodeConstants.java b/cf-module-system/cf-module-system-api/src/main/java/com/cf/imes/module/system/enums/ErrorCodeConstants.java index 33de65513..f52d99d21 100644 --- a/cf-module-system/cf-module-system-api/src/main/java/com/cf/imes/module/system/enums/ErrorCodeConstants.java +++ b/cf-module-system/cf-module-system-api/src/main/java/com/cf/imes/module/system/enums/ErrorCodeConstants.java @@ -256,4 +256,7 @@ public interface ErrorCodeConstants { ErrorCode APPLICATION_LOGIN_USER_DISABLED = new ErrorCode(1_002_037_001, "应用登陆失败"); ErrorCode ERR = new ErrorCode(1_002_038_001, "未知错误"); + + ErrorCode REMAIN_PLATE_STATUS_USED = new ErrorCode(1_002_038_001, "余料板正在使用中,禁止修改"); + ErrorCode REMAIN_PLATE_STATUS_NO_USED = new ErrorCode(1_002_038_001, "余料板未使用"); }