manage服务当前使用功能移到executor服务

This commit is contained in:
gaoqr
2025-03-19 17:34:36 +08:00
parent d8b97a317f
commit 9f93ea382c
117 changed files with 9000 additions and 9 deletions
+7 -3
View File
@@ -91,6 +91,8 @@
<xlsx-streamer.version>2.1.0</xlsx-streamer.version> <xlsx-streamer.version>2.1.0</xlsx-streamer.version>
<stax-api.version>1.0-2</stax-api.version> <stax-api.version>1.0-2</stax-api.version>
<excel-poi.version>4.1.2</excel-poi.version> <excel-poi.version>4.1.2</excel-poi.version>
<!-- 语音-->
<jacob.version>1.18</jacob.version>
</properties> </properties>
<dependencyManagement> <dependencyManagement>
@@ -678,7 +680,6 @@
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/com.monitorjbl/xlsx-streamer --> <!-- https://mvnrepository.com/artifact/com.monitorjbl/xlsx-streamer -->
<dependency> <dependency>
<groupId>com.monitorjbl</groupId> <groupId>com.monitorjbl</groupId>
@@ -687,7 +688,6 @@
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/javax.xml.stream/stax-api --> <!-- https://mvnrepository.com/artifact/javax.xml.stream/stax-api -->
<dependency> <dependency>
<groupId>javax.xml.stream</groupId> <groupId>javax.xml.stream</groupId>
@@ -696,7 +696,6 @@
</dependency> </dependency>
<!-- SMS SDK begin --> <!-- SMS SDK begin -->
<dependency> <dependency>
<groupId>com.aliyun</groupId> <groupId>com.aliyun</groupId>
@@ -754,6 +753,11 @@
<artifactId>xercesImpl</artifactId> <artifactId>xercesImpl</artifactId>
<version>${xercesImpl.version}</version> <version>${xercesImpl.version}</version>
</dependency> </dependency>
<dependency>
<groupId>com.hynnet</groupId>
<artifactId>jacob</artifactId>
<version>${jacob.version}</version>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
@@ -57,7 +57,7 @@ spring:
- Path=/jmreport/** - Path=/jmreport/**
## manage-server 服务 ## manage-server 服务
- id: manage-admin-api - id: manage-admin-api
uri: grayLb://manage-server uri: grayLb://executor-server
predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组 predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组
- Path=/admin-api/manage/** - Path=/admin-api/manage/**
filters: filters:
@@ -26,4 +26,10 @@ public class DictTypeConstants {
public static final String UNIT_LENGTH = "length_unit"; // 长度单位 public static final String UNIT_LENGTH = "length_unit"; // 长度单位
public static final String UNIT_AREA = "area_unit"; // 面积单位 public static final String UNIT_AREA = "area_unit"; // 面积单位
public static final String UNIT_NUMBER = "area_number"; // 个数单位 public static final String UNIT_NUMBER = "area_number"; // 个数单位
public static final String PLATE_TEXTURE = "plate_texture_type";// 板件纹里
public static final String PART_CATEGORY = "part_category";// 配件主类型
public static final String BOOLEAN_STRING = "infra_boolean_string"; // Boolean 是否类型
} }
@@ -95,4 +95,15 @@ public class ErrorCodeConstants {
public static final ErrorCode ORDER_IMPORT_GROUPCODE_NOT_EXIST_VALID_ERROR = new ErrorCode(1_002_031_013, "导入校验异常:板件{}下加工组编码{}不存在于加工组编码列表中"); public static final ErrorCode ORDER_IMPORT_GROUPCODE_NOT_EXIST_VALID_ERROR = new ErrorCode(1_002_031_013, "导入校验异常:板件{}下加工组编码{}不存在于加工组编码列表中");
public static final ErrorCode ORDER_IMPORT_ROOMCODE_NOT_EXIST_VALID_ERROR = new ErrorCode(1_002_031_014, "导入校验异常:板件{}下房间编码{}不存在于房间编码列表中"); public static final ErrorCode ORDER_IMPORT_ROOMCODE_NOT_EXIST_VALID_ERROR = new ErrorCode(1_002_031_014, "导入校验异常:板件{}下房间编码{}不存在于房间编码列表中");
public static final ErrorCode ORDER_IMPORT_BODYCODE_NOT_EXIST_VALID_ERROR = new ErrorCode(1_002_031_015, "导入校验异常:板件{}下柜体编码{}不存在于柜体编码列表中"); public static final ErrorCode ORDER_IMPORT_BODYCODE_NOT_EXIST_VALID_ERROR = new ErrorCode(1_002_031_015, "导入校验异常:板件{}下柜体编码{}不存在于柜体编码列表中");
// ========== manage配件 1_004_001_000 ==========
public static final ErrorCode PARTS_NOT_EXISTS = new ErrorCode(1_004_001_000, "配件不存在");
public static final ErrorCode PARTS_GOOD_ID_EXISTS = new ErrorCode(1_004_001_001, "配件编号已存在");
public static final ErrorCode PARTS_UNIT_NOT_NULL = new ErrorCode(1_004_001_002, "配件-组件或五金或封边条,单位禁止为空");
public static final ErrorCode PARTS_EDGE_NOT_NULL = new ErrorCode(1_004_001_003, "配件-封边条颜色、宽厚禁止为空");
public static final ErrorCode FILE_NULL = new ErrorCode(1_004_001_004, "上传文件为空");
public static final ErrorCode FILE_FORMAT_ERROR = new ErrorCode(1_004_001_005, "导入文件格式有误");
public static final ErrorCode FILE_EXCEED_SIZE = new ErrorCode(1_004_001_006, "文件大小超过 10M");
public static final ErrorCode FILE_CONTENT_NULL = new ErrorCode(1_004_001_007, "文件大小为空");
} }
@@ -0,0 +1,23 @@
package com.cf.imes.module.executor.enums.manage.parts;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 配件主类的枚举值
*/
@Getter
@AllArgsConstructor
public enum CategoryEnum implements ObjectEnum{
ASSEMBLY("组件"),
HARDWARE("五金"),
EDGING("封边条"),
OTHER("其他");
/**
* 类别名称
*/
private final String value;
}
@@ -0,0 +1,6 @@
package com.cf.imes.module.executor.enums.manage.parts;
public interface ObjectEnum {
String getValue();
}
@@ -0,0 +1,17 @@
package com.cf.imes.module.executor.enums.manage.parts;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum WhetherEnum implements ObjectEnum {
TRUE(""),
FALSE("");
/**
* 类别名称
*/
private final String value;
}
@@ -0,0 +1,32 @@
package com.cf.imes.module.executor.enums.manage.remainPlate;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 余料板放置枚举类
*/
@Getter
@AllArgsConstructor
public enum RemainPlatePlaceStyleEnum {
ZERO(0, "正面"),
ONE(1, "正面右转"),
TWO(2, "正面后转"),
THREE(3, "正面左转"),
FOUR(4, "反面"),
FIVE(5, "反面右转"),
SIX(6, "反面后转"),
SEVEN(7, "反面左转");
private final Integer status;
private String description;
public boolean equals(Integer status) {
return this.status .equals(status) ;
}
public boolean equals(RemainPlatePlaceStyleEnum enableStatusEnum) {
return enableStatusEnum != null && enableStatusEnum.status .equals(this.getStatus()) ;
}
}
@@ -0,0 +1,22 @@
package com.cf.imes.module.executor.enums.manage.remainPlate;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum RemainPlateStatusEnum {
UNUSED(0, "未使用"),
USED(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()) ;
}
}
@@ -0,0 +1,25 @@
package com.cf.imes.module.executor.enums.manage.remainPlate;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum RemainPlateUseTypeEnum {
TYPE_ZERO(0, ""),
TYPE_ONE(1, "核销"),
TYPE_TWO(2, "排单"),
TYPE_THREE(3, "补板");
private final Integer status;
private String description;
public boolean equals(Integer status) {
return this.status .equals(status) ;
}
public boolean equals(RemainPlateUseTypeEnum enableStatusEnum) {
return enableStatusEnum != null && enableStatusEnum.status .equals(this.getStatus()) ;
}
}
@@ -173,8 +173,11 @@
<artifactId>stax-api</artifactId> <artifactId>stax-api</artifactId>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/com.jacob/jacob -->
<dependency>
<groupId>com.hynnet</groupId>
<artifactId>jacob</artifactId>
</dependency>
<!-- JSON --> <!-- JSON -->
@@ -0,0 +1,26 @@
package com.cf.imes.module.executor.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Data
@Component
@ConfigurationProperties(prefix = "voices.parameters")
public class VocieParameters {
// 设置音频的质量( 越大越好,目前最大好像 22,最小为 4 )
private Long quality;
// 朗读声音大小
private Long soundSize;
// 朗读速度
private Long readingSpeed;
// 音频保存的路径
private String path;
}
@@ -0,0 +1,277 @@
package com.cf.imes.module.executor.controller.admin.manage.pack;
import com.cf.imes.framework.common.pojo.CommonResult;
import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.module.executor.controller.admin.manage.pack.prePack.PrePackReqVO;
import com.cf.imes.module.executor.controller.admin.manage.pack.vo.DeleteOtherPartsReqVO;
import com.cf.imes.module.executor.controller.admin.manage.pack.vo.OrderPackReqVO;
import com.cf.imes.module.executor.controller.admin.manage.pack.vo.OrderPackRespVO;
import com.cf.imes.module.executor.controller.admin.manage.pack.vo.OrderPartsReqVO;
import com.cf.imes.module.executor.controller.admin.manage.pack.vo.OrderPartsRespVO;
import com.cf.imes.module.executor.controller.admin.manage.pack.vo.OtherPackReqVO;
import com.cf.imes.module.executor.controller.admin.manage.pack.vo.PackPageReqVO;
import com.cf.imes.module.executor.controller.admin.manage.pack.vo.PackReqVO;
import com.cf.imes.module.executor.controller.admin.manage.pack.vo.PackRespVO;
import com.cf.imes.module.executor.controller.admin.manage.pack.vo.PackageDetailsReqVO;
import com.cf.imes.module.executor.controller.admin.manage.pack.vo.PackingReqVO;
import com.cf.imes.module.executor.controller.admin.manage.pack.vo.PlateDetailsRespVO;
import com.cf.imes.module.executor.controller.admin.manage.pack.vo.PrintOrderPackReqVO;
import com.cf.imes.module.executor.controller.admin.manage.pack.vo.PrintOrderPackRespVO;
import com.cf.imes.module.executor.controller.admin.manage.query.vo.pack.OrderPackageVO;
import com.cf.imes.module.executor.service.manage.pack.PackService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;
import static com.cf.imes.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 生产打包 ")
@RestController
@RequestMapping("/manage/pack")
@Validated
public class PackController {
@Resource
private PackService packService;
@GetMapping("/page")
@Operation(summary = "打包分页查询")
@PreAuthorize("@ss.hasPermission('manage:pack:query')")
public CommonResult<PageResult<PackRespVO>> getPlatePage(@Valid PackPageReqVO pageReqVO) {
return CommonResult.success(packService.getPackPage(pageReqVO));
}
@GetMapping("/getOrderPlate")
@Operation(summary = "查看生产订单对应的没有打包的板材信息")
@Parameter(name = "orderId", description = "生产单Id", required = true)
@PreAuthorize("@ss.hasAnyPermissions('manage:pack:export-lost-plate','manage:pack:pack')")
public CommonResult<List<PlateDetailsRespVO>> getOrderPlateList(@Valid @RequestParam("orderId") Long orderId) {
return success(packService.getOrderPlateList(orderId));
}
@GetMapping("/getOrderPlateList")
@Operation(summary = "查询多个生产单对应的板材信息")
@Parameter(name = "orderIds", description = "生产单ID", required = true)
@PreAuthorize("@ss.hasAnyPermissions('manage:pack:create','manage:pack:pre-pack','manage:pack:pack')")
public CommonResult<List<PlateDetailsRespVO>> getOrdersPlateList(@Valid @RequestParam("orderIds") List<Long> orderIds) {
return success(packService.getOrdersPlateList(orderIds));
}
@GetMapping("/getOrderPack")
@Operation(summary = "查看生产订单对应的包裹信息-未分页")
@PreAuthorize("@ss.hasAnyPermissions('manage:pack:export-pack-num','manage:pack:pack')")
public CommonResult<List<OrderPackageVO>> getOrderPack(@Valid PackageDetailsReqVO reqVO) {
return success(packService.getOrderPack(reqVO));
}
@GetMapping("/getPageOrderPack")
@Operation(summary = "查看生产订单对应的包裹信息-分页")
@PreAuthorize("@ss.hasPermission('manage:pack:pack-details')")
public CommonResult<PageResult<OrderPackageVO>> getPageOrderPack(@Valid PackageDetailsReqVO reqVO) {
return success(packService.getPageOrderPack(reqVO));
}
@GetMapping("/getParts")
@Operation(summary = "查看配件列表")
@PreAuthorize("@ss.hasPermission('manage:pack-parts:query')")
public CommonResult<List<OrderPartsRespVO>> getParts(@Valid OrderPartsReqVO reqVO) {
return success(packService.getPartsList(reqVO));
}
@PutMapping("/updatePack")
@Operation(summary = "板材包裹更新-即封包")
@PreAuthorize("@ss.hasPermission('manage:pack:update')")
public CommonResult<OrderPackRespVO> updatePack(@Valid @RequestBody OrderPackReqVO packageVO) {
return success(packService.updatePack(packageVO));
}
@PutMapping("/updateParts")
@Operation(summary = "配件包裹更新-即封包")
@PreAuthorize("@ss.hasPermission('manage:pack:update')")
public CommonResult<OrderPackRespVO> updateParts(@Valid @RequestBody OrderPartsReqVO reqVO) {
return success(packService.updateParts(reqVO));
}
@GetMapping("/selectPack")
@Operation(summary = "查询包裹")
@Parameter(name = "orderId", description = "生产单Id", required = true)
@PreAuthorize("@ss.hasPermission('manage:pack:query')")
public CommonResult<List<OrderPackRespVO>> selectPack(@Valid @RequestParam("orderId") Long orderId) {
return success(packService.selectPack(orderId));
}
@DeleteMapping("/deletePack")
@Operation(summary = "删除包裹及其关联的包裹信息(删除全部)")
@PreAuthorize("@ss.hasPermission('manage:pack:delete')")
public CommonResult<Boolean> deleteOrderPack (@Valid @RequestBody PackReqVO reqVO) {
packService.deleteOrderPack(reqVO);
return success(true);
}
@PutMapping("/unpacking")
@Operation(summary = "拆包-更改包裹为未封包")
@PreAuthorize("@ss.hasPermission('manage:pack:unpacking')")
public CommonResult<OrderPackRespVO> unpacking(@Valid @RequestBody PackingReqVO reqVO) {
OrderPackRespVO unpacking = packService.unpacking(reqVO.getPackageId());
return success(unpacking);
}
// @GetMapping("/print")
// @Operation(summary = "包裹订单打印")
// @PreAuthorize("@ss.hasPermission('manage:pack:query')")
public CommonResult<PrintOrderPackRespVO> printOrderPack (@Valid PrintOrderPackReqVO reqVO) {
return success(packService.printOrderPack(reqVO));
}
// @PostMapping("/insertParts")
// @Operation(summary = "新增配件包裹")
// @PreAuthorize("@ss.hasPermission('manage:pack:insert')")
public CommonResult<OrderPackRespVO> addNewPartsPack (@Valid @RequestBody OrderPackReqVO reqVO) {
return success(packService.addNewPartsPack(reqVO));
}
@PostMapping("/insertOtherPack")
@Operation(summary = "新增外部配件-即新增一个包裹")
@PreAuthorize("@ss.hasPermission('manage:pack:external-parts')")
public CommonResult<OrderPackRespVO> addNewOtherPack(@Valid @RequestBody OtherPackReqVO reqVO) {
return success(packService.addNewOtherPack(reqVO));
}
@PutMapping("/insertOther")
@Operation(summary = "新增外部配件")
@PreAuthorize("@ss.hasPermission('manage:pack:external-parts')")
public CommonResult<OrderPartsRespVO> addNewOtherParts (@Valid @RequestBody OtherPackReqVO reqVO) {
return success(packService.addNewOtherParts(reqVO));
}
@DeleteMapping("/deleteOtherParts")
@Operation(summary = "删除包裹中的外部配件")
@PreAuthorize("@ss.hasPermission('manage:pack:delete')")
public CommonResult<Boolean> deleteOtherParts (@Valid @RequestBody DeleteOtherPartsReqVO reqVO) {
packService.deleteOtherParts(reqVO);
return success(true);
}
@GetMapping("/getPrePackInfo")
@Operation(summary = "查询预打包优化信息")
@PreAuthorize("@ss.hasPermission('manage:pack:pre-pack')")
public CommonResult<String> getPrePackInfo ( @RequestParam("orderId") Long orderId) {
return success(packService.getPrePackInfo(orderId));
}
@PostMapping("/saveOptimizeInfo")
@Operation(summary = "预打包保存优化信息")
@PreAuthorize("@ss.hasPermission('manage:pack:pre-pack')")
public CommonResult<Boolean> saveOptimizeInfo(@Valid @RequestBody PrePackReqVO reqVO) {
packService.saveOptimizeInfo(reqVO);
return success(true);
}
}
@@ -0,0 +1,28 @@
package com.cf.imes.module.executor.controller.admin.manage.pack.prePack;
import lombok.Builder;
import lombok.Data;
import lombok.ToString;
@Data
@ToString(callSuper = true)
@Builder
public class PackPlateList {
// 包裹ID
private Long packId;
// 包裹编号
private String packNo;
// 板材ID
private Long plateId;
// 板材编号
private String plateNo;
}
@@ -0,0 +1,34 @@
package com.cf.imes.module.executor.controller.admin.manage.pack.prePack;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.ToString;
@Schema(description = "预打包的优化结构")
@Data
@ToString(callSuper = true)
public class PrePackData {
@Schema(description = "包裹编号")
private String name;
@Schema(description = "点的位置信息")
private Double pointX;
private Double pointY;
@Schema(description = "板材编号")
private String plateNo;
@Schema(description = "板材宽度")
private Long plateWidth;
@Schema(description = "板材高度")
private Long plateHeight;
}
@@ -0,0 +1,105 @@
package com.cf.imes.module.executor.controller.admin.manage.pack.prePack;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.ToString;
import javax.validation.Valid;
import java.util.List;
@Schema(description = "预打包的优化结构")
@Data
@ToString(callSuper = true)
public class PrePackOptimizeInfo {
@Schema(description = "分组名称")
private String groupName;
@Schema(description = "优化的数据")
private List<PrePackData> list;
@Valid
@Data
public static class PrePackData {
@Schema(description = "包裹编号")
private String name;
@Schema(description = "")
private List<PrerStoreyNum> list;
}
@Valid
@Data
public static class PrerStoreyNum {
@Schema(description = "包裹层数名称")
private String name;
@Schema(description = "")
private Long floor_place_width;
@Schema(description = "")
private Long floor_place_height;
@Schema(description = "")
private List<PrerPlateData> list;
}
@Valid
@Data
public static class PrerPlateData {
@Schema(description = "小板名称")
private String name;
@Schema(description = "")
private String plateNo;
@Schema(description = "")
private String plateId;
@Schema(description = "")
private PrePlaceInfo placeInfo;
}
@Valid
@Data
public static class PrePlaceInfo{
@Schema(description = "")
private String banid;
@Schema(description = "")
private Double line;
@Schema(description = "")
private Double x;
@Schema(description = "")
private Double y;
@Schema(description = "")
private Long pbg;
@Schema(description = "")
private Long pbk;
}
}
@@ -0,0 +1,30 @@
package com.cf.imes.module.executor.controller.admin.manage.pack.prePack;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.ToString;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
@Schema(description = "管理后台 - 预打包保存优化信息")
@Data
@ToString(callSuper = true)
public class PrePackReqVO {
@Schema(description = "生产单ID")
@NotNull(message = "优化数据异常,请重新优化")
private Long orderId;
@Schema(description = "优化信息")
@NotBlank(message = "优化数据异常,请重新优化")
private String optimizeInfo;
}
@@ -0,0 +1,37 @@
package com.cf.imes.module.executor.controller.admin.manage.pack.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.ToString;
import javax.validation.constraints.NotNull;
@Schema(description = "管理后台 - 删除其他配件 Request VO")
@Data
@ToString(callSuper = true)
public class DeleteOtherPartsReqVO {
@Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "生产单号为空,请重新删除配件")
private Long orderId;
@Schema(description = "包裹Id", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "包裹号为空,请重新删除配件")
private Long packageId;
@Schema(description = "配件ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "配件信息为空,请重新删除配件")
private Long partsId;
@Schema(description = "是否是其他类型的配件", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "配件类型为空,请重新删除配件")
private Boolean isOtherParts;
}
@@ -0,0 +1,16 @@
package com.cf.imes.module.executor.controller.admin.manage.pack.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Schema(description = "工序组名称")
@Data
public class GroupNameList {
@Schema(description = "工序组名称")
private String name;
}
@@ -0,0 +1,57 @@
package com.cf.imes.module.executor.controller.admin.manage.pack.vo;
import com.cf.imes.module.executor.validation.manage.pack.PackTypeValid;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.ToString;
import javax.validation.constraints.NotNull;
import java.util.List;
@Schema(description = "管理后台 - 包裹新增 Request VO")
@Data
@ToString(callSuper = true)
public class OrderPackReqVO {
@Schema(description = "包裹ID", requiredMode = Schema.RequiredMode.REQUIRED)
private Long packId;
@Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "生产单号为空")
private Long orderId;
@Schema(description = "包裹编号", requiredMode = Schema.RequiredMode.REQUIRED)
private String packNo;
@Schema(description = "包裹类型", requiredMode = Schema.RequiredMode.REQUIRED)
@PackTypeValid
private Integer packageType;
// @Schema(description = "包裹状态", requiredMode = Schema.RequiredMode.REQUIRED)
// private Long packStatus;
@Schema(description = "备注")
private String remark;
@Schema(description = "新增的板件ID", requiredMode = Schema.RequiredMode.REQUIRED)
private List<Long> addPlateIdList;
@Schema(description = "移除的板件ID", requiredMode = Schema.RequiredMode.REQUIRED)
private List<Long> deletePlateIdList;
@Schema(description = "新增的配件包裹ID", requiredMode = Schema.RequiredMode.REQUIRED)
private List<Long> addPartsIdList;
}
@@ -0,0 +1,39 @@
package com.cf.imes.module.executor.controller.admin.manage.pack.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
import lombok.Data;
@Schema(description = "管理后台 - 生产单包裹表 Response VO")
@Data
@Builder
public class OrderPackRespVO {
@Schema(description = "包裹ID", requiredMode = Schema.RequiredMode.REQUIRED)
private Long id;
@Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED)
private Long orderId;
@Schema(description = "包裹编号", requiredMode = Schema.RequiredMode.REQUIRED)
private String packageNo;
@Schema(description = "包裹类型,-1未定义,0板材,1配件,2其他配件", requiredMode = Schema.RequiredMode.REQUIRED)
private Integer packageType;
@Schema(description = "包裹名", requiredMode = Schema.RequiredMode.REQUIRED)
private String name;
@Schema(description = "包裹状态,0未封包,1已封包,2已入库,3已出库", requiredMode = Schema.RequiredMode.REQUIRED)
private Integer status;
@Schema(description = "组织ID", requiredMode = Schema.RequiredMode.REQUIRED)
private Long organId;
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED)
private String remark;
}
@@ -0,0 +1,39 @@
package com.cf.imes.module.executor.controller.admin.manage.pack.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.ToString;
import javax.validation.constraints.NotNull;
import java.util.List;
@Schema(description = "管理后台 - 生产单模块表 Request VO")
@Data
//@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class OrderPartsReqVO /*extends PageParam*/ {
@Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "生产单号为空")
private Long orderId;
@Schema(description = "更新配件时传-包裹ID")
private Long packId;
@Schema(description = "新增的配件ID")
private List<Long> addPartsIdList;
@Schema(description = "更新配件时传-删除的配件ID")
private List<Long> deletePartsIdList;
@Schema(description = "新增的板件ID")
private List<Long> addPlateIdList;
}
@@ -0,0 +1,69 @@
package com.cf.imes.module.executor.controller.admin.manage.pack.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Schema(description = "管理后台 - 配件列表详情 Response VO")
@Data
public class OrderPartsRespVO {
@Schema(description = "配件ID", requiredMode = Schema.RequiredMode.REQUIRED)
private Long partsId;
@Schema(description = "配件名称", requiredMode = Schema.RequiredMode.REQUIRED)
private String name;
@Schema(description = "型号", requiredMode = Schema.RequiredMode.REQUIRED)
private String model;
@Schema(description = "规格", requiredMode = Schema.RequiredMode.REQUIRED)
private String spec;
@Schema(description = "数量", requiredMode = Schema.RequiredMode.REQUIRED)
private Long num;
@Schema(description = "单位", requiredMode = Schema.RequiredMode.REQUIRED)
private String unit;
@Schema(description = "品牌", requiredMode = Schema.RequiredMode.REQUIRED)
private String brand;
@Schema(description = "厂家", requiredMode = Schema.RequiredMode.REQUIRED)
private String factory;
@Schema(description = "配件类型", requiredMode = Schema.RequiredMode.REQUIRED)
private String type;
@Schema(description = "是否复合配件", requiredMode = Schema.RequiredMode.REQUIRED)
private Boolean isComposite;
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED)
private String remark;
@Schema(description = "配件颜色", requiredMode = Schema.RequiredMode.REQUIRED)
private String partsColor;
@Schema(description = "配件宽度", requiredMode = Schema.RequiredMode.REQUIRED)
private Double partsWidth;
@Schema(description = "配件长度", requiredMode = Schema.RequiredMode.REQUIRED)
private Double partsLength;
@Schema(description = "配件厚度", requiredMode = Schema.RequiredMode.REQUIRED)
private Double partsThickness;
@Schema(description = "配件主类:1封边2五金3组件", requiredMode = Schema.RequiredMode.REQUIRED)
private String category;
@Schema(description = "子配件ID列表,复合部件时记录子配件ID,半角逗号分隔", requiredMode = Schema.RequiredMode.REQUIRED)
private String subparts;
}
@@ -0,0 +1,35 @@
package com.cf.imes.module.executor.controller.admin.manage.pack.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
@Schema(description = "管理后台 - 查看生产单对应的板件信息")
@Data
@ExcelIgnoreUnannotated
public class OrderPlateDetailsRespVO {
@Schema(description = "板件总数", requiredMode = Schema.RequiredMode.REQUIRED)
private Long plateNum;
@Schema(description = "已处理量", requiredMode = Schema.RequiredMode.REQUIRED)
private Long plateProcessedNum;
@Schema(description = "待处理量", requiredMode = Schema.RequiredMode.REQUIRED)
private Long pendingNum;
// @Schema(description = "当前包裹的板件数", requiredMode = Schema.RequiredMode.REQUIRED)
// private Long currentPackNum;
@Schema(description = "生产单对应的板件信息", requiredMode = Schema.RequiredMode.REQUIRED)
List<PlateDetailsRespVO> plateDetailsRespVO;
}
@@ -0,0 +1,23 @@
package com.cf.imes.module.executor.controller.admin.manage.pack.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Schema(description = "管理后台 - 板材列表显示 Response VO")
@Data
public class OrderPlateGroupRespVO {
@Schema(description = "房间id", requiredMode = Schema.RequiredMode.REQUIRED)
private Long roomId;
@Schema(description = "房间名称", requiredMode = Schema.RequiredMode.REQUIRED)
private String roomName;
}
@@ -0,0 +1,50 @@
package com.cf.imes.module.executor.controller.admin.manage.pack.vo;
import com.cf.imes.framework.common.validation.NumberValid;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.ToString;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
@Schema(description = "管理后台 - 新增外部配件 Request VO")
@Data
@ToString(callSuper = true)
public class OtherPackReqVO {
@Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "生产单号为空,请重新新增外部配件")
private Long orderId;
@Schema(description = "配件名称", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "配件名称不能为空")
@Size(max = 64, message = "配件名称长度不能超过 64 个字符")
private String name;
@Schema(description = "配件数量", requiredMode = Schema.RequiredMode.REQUIRED)
@NumberValid(name = "配件数量")
private Double num;
@Schema(description = "配件单位", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "配件单位不能为空")
@Size(max = 32, message = "配件单位长度不能超过 32 个字符")
private String unit;
@Schema(description = "包裹编号", requiredMode = Schema.RequiredMode.REQUIRED)
private String packNo;
@Schema(description = "备注")
private String remark;
}
@@ -0,0 +1,28 @@
package com.cf.imes.module.executor.controller.admin.manage.pack.vo;
import com.cf.imes.framework.common.pojo.PageParam;
import com.cf.imes.module.executor.validation.manage.pack.PackTypeValid;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.ToString;
import javax.validation.constraints.NotNull;
@Schema(description = "管理后台 - 查看包裹详情")
@Data
@ToString(callSuper = true)
public class PackDetailsReqVO extends PageParam {
@Schema(description = "包裹ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "包裹数据错误,请重新查看")
private Long packageId;
@Schema(description = "包裹类型", requiredMode = Schema.RequiredMode.REQUIRED)
@PackTypeValid
private Integer type;
}
@@ -0,0 +1,56 @@
package com.cf.imes.module.executor.controller.admin.manage.pack.vo;
import com.cf.imes.framework.common.pojo.PageParam;
import com.cf.imes.module.executor.validation.manage.pack.OrderPackagedStatusValid;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.Pattern;
@Schema(description = "管理后台 - 打包分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class PackPageReqVO extends PageParam {
@Schema(description = "打包状态(0:未打包,1:已打包)", requiredMode = Schema.RequiredMode.REQUIRED)
@OrderPackagedStatusValid
private Integer status;
@Schema(description = "订单号")
@Pattern(regexp = "^[0-9]*$",message = "生产单号必须为数字")
@Length(max = 19,message = "生产单号长度不能超过19")
private String orderId;
@Schema(description = "自定义单号")
@Length(max = 32,message = "自定义单号数据过长,请重新输入")
private String customOrderNo;
@Schema(description = "经销商")
@Length(max = 255, message = "经销商数据过长,请重新输入")
private String dealer;
@Schema(description = "客户")
@Length(max = 255, message = "客户数据过长,请重新输入")
private String customer;
@Schema(description = "地址")
@Length(max = 255, message = "收货地址数据过长,请重新输入")
private String address;
@Schema(description = "是否翻页-true:上,false:下")
private Boolean isUp;
}
@@ -0,0 +1,34 @@
package com.cf.imes.module.executor.controller.admin.manage.pack.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.ToString;
import javax.validation.constraints.NotNull;
@Schema(description = "管理后台 - 删除订单包裹 Request VO")
@Data
@ToString(callSuper = true)
public class PackReqVO {
@Schema(description = "生产单ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "生产单号为空,请重新删除配件")
private Long orderId;
@Schema(description = "包裹ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "包裹信息为空,请重新删除配件")
private Long packageId;
@Schema(description = "包裹编号", requiredMode = Schema.RequiredMode.REQUIRED)
private Long packageNo;
@Schema(description = "是否是其他类型的包裹", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "包裹类型为空,请重新删除配件")
private Boolean isOther;
}
@@ -0,0 +1,101 @@
package com.cf.imes.module.executor.controller.admin.manage.pack.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.Setter;
import java.time.LocalDateTime;
import java.util.List;
@Schema(description = "管理后台 - 生产单表 order_{N} Response VO")
@Data
@Setter
public class PackRespVO {
@Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "7788")
private Long id;
@Schema(description = "包裹ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "7788")
private Long packId;
@Schema(description = "自定义单号", requiredMode = Schema.RequiredMode.REQUIRED,example = "ABCD")
private String customOrderNo;
@Schema(description = "经销商电话", requiredMode = Schema.RequiredMode.REQUIRED,example = "ABCD")
private String dealerPhoneNumber;
@Schema(description = "经销商", requiredMode = Schema.RequiredMode.REQUIRED,example = "ABCD")
private String dealer;
@Schema(description = "订单日期", requiredMode = Schema.RequiredMode.REQUIRED,example = "ABCD")
private LocalDateTime orderDate;
@Schema(description = "交付日期", requiredMode = Schema.RequiredMode.REQUIRED,example = "ABCD")
private LocalDateTime deliveryDate;
@Schema(description = "打包状态", requiredMode = Schema.RequiredMode.REQUIRED,example = "0")
private Integer packaged;
@Schema(description = "客户", requiredMode = Schema.RequiredMode.REQUIRED,example = "张三")
private String customer;
@Schema(description = "客户地址", requiredMode = Schema.RequiredMode.REQUIRED,example = "AABB")
private String address;
@Schema(description = "客户电话", requiredMode = Schema.RequiredMode.REQUIRED,example = "ABCD")
private String phoneNumber;
@Schema(description = "业务员", requiredMode = Schema.RequiredMode.REQUIRED,example = "ABCD")
private String salesman;
@Schema(description = "拆单员", requiredMode = Schema.RequiredMode.REQUIRED,example = "ABCD")
private String splitter;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime createTime;
@Schema(description = "已打包数-包裹数")
private Long packCount;
@Schema(description = "已打包片数-已处理量")
private Long packPieceCount;
@Schema(description = "总片数-板件总数")
private Long totalPieceCount;
@Schema(description = "待处理量")
private Long pendingNum;
@Schema(description = "生产单对应的板材ID集")
private List<Long> plateIdList;
@Schema(description = "生产单对应的包裹ID集")
private List<Long> packIdList;
// @Schema(description = "生产单对应的板件信息", requiredMode = Schema.RequiredMode.REQUIRED)
// List<PlateDetailsRespVO> plateDetailsRespVO;
}
@@ -0,0 +1,42 @@
package com.cf.imes.module.executor.controller.admin.manage.pack.vo;
import com.cf.imes.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.ToString;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.Pattern;
@Schema(description = "管理后台 - 查看生产单下对应的包裹信息")
@Data
@ToString(callSuper = true)
public class PackageDetailsReqVO extends PageParam {
@Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED)
@Pattern(regexp = "^[0-9]*$",message = "生产单号必须为数字")
@Length(max = 19,message = "生产单号长度不能超过 19 位")
private String orderId;
@Schema(description = "板编号")
@Pattern(regexp = "^[0-9]*$",message = "板编号必须为数字")
@Length(max = 13,message = "板编号长度不能超过 13 位")
private String plateNo;
@Schema(description = "包裹状态")
private Boolean packStatus;
@Schema(description = "包裹编号")
@Pattern(regexp = "^[0-9]*$",message = "包裹编号必须为数字")
@Length(max = 13,message = "包裹编号长度不能超过 13 位")
private String packageNo;
}
@@ -0,0 +1,21 @@
package com.cf.imes.module.executor.controller.admin.manage.pack.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.ToString;
import javax.validation.constraints.NotNull;
@Schema(description = "管理后台 - 拆包")
@Data
@ToString(callSuper = true)
public class PackingReqVO {
@Schema(description = "包裹ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "包裹异常,请查看是否封包")
private Long packageId;
}
@@ -0,0 +1,23 @@
package com.cf.imes.module.executor.controller.admin.manage.pack.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.ToString;
@Schema(description = "板材和配件ID")
@Data
@ToString(callSuper = true)
public class PlateAndPartIdList {
@Schema(description = "板材ID")
private Long plateId;
@Schema(description = "配件ID")
private Long partsId;
}
@@ -0,0 +1,106 @@
package com.cf.imes.module.executor.controller.admin.manage.pack.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
@Schema(description = "管理后台 - 板材详情(导出板材表) Response VO")
@Data
@ExcelIgnoreUnannotated
public class PlateDetailsRespVO {
@Schema(description = "包裹ID", requiredMode = Schema.RequiredMode.REQUIRED)
private Long packageId;
@Schema(description = "包裹号", requiredMode = Schema.RequiredMode.REQUIRED)
private String packageNo;
@Schema(description = "房间名称", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("房间名称")
private String roomName;
@Schema(description = "柜体名称", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("柜体名称")
private String cabinetName;
@Schema(description = "房间ID", requiredMode = Schema.RequiredMode.REQUIRED)
private String roomId;
@Schema(description = "柜体ID", requiredMode = Schema.RequiredMode.REQUIRED)
private String bodyId;
@Schema(description = "生产单ID", requiredMode = Schema.RequiredMode.REQUIRED)
private String orderId;
@Schema(description = "板材ID", requiredMode = Schema.RequiredMode.REQUIRED)
private String plateId;
@Schema(description = "自定义板编号", requiredMode = Schema.RequiredMode.REQUIRED)
private String customPlateNo;
@Schema(description = "板编号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("板编号")
private String plateNo;
@Schema(description = "板名称", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("板名称")
private String plateName;
@Schema(description = "材料", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("材料")
private String material;
@Schema(description = "颜色", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("颜色")
private String color;
@Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("宽度")
private Double width;
@Schema(description = "长度", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("长度")
private Double height;
@Schema(description = "厚度", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("厚度")
private Double thickness;
@Schema(description = "面积", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("面积")
private Double area;
@Schema(description = "纹路", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("纹路")
private Integer texture;
@Schema(description = "异形", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("异形")
private Boolean specialShaped;
@Schema(description = "造型", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("造型")
private Boolean profiling;
@Schema(description = "排孔", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("排孔")
private Boolean rowHole;
@Schema(description = "加工组", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("加工组")
private String processGroup;
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("备注")
private String remark;
@Schema(description = "加工组名称集合")
private List<GroupNameList> processGroupNameList;
}
@@ -0,0 +1,23 @@
package com.cf.imes.module.executor.controller.admin.manage.pack.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.ToString;
@Schema(description = "管理后台 - 打印生产单的包裹 Request VO")
@Data
@ToString(callSuper = true)
public class PrintOrderPackReqVO {
@Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "9822")
private Long orderId;
@Schema(description = "包裹id", requiredMode = Schema.RequiredMode.REQUIRED, example = "9822")
private Long packageNo;
}
@@ -0,0 +1,46 @@
package com.cf.imes.module.executor.controller.admin.manage.pack.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
@Schema(description = "管理后台 - 包裹打印显示 Response VO")
@Data
public class PrintOrderPackRespVO {
@Schema(description = "自定义单号", requiredMode = Schema.RequiredMode.REQUIRED)
private String customOrderNo;
@Schema(description = "经销商", requiredMode = Schema.RequiredMode.REQUIRED,example = "ABCD")
private String dealer;
@Schema(description = "订单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "7788")
private Long orderId;
@Schema(description = "包裹ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "7788")
private Long packNo;
@Schema(description = "包裹序号", requiredMode = Schema.RequiredMode.REQUIRED, example = "7788")
private Long packNum;
@Schema(description = "客户地址", requiredMode = Schema.RequiredMode.REQUIRED,example = "AABB")
private String address;
@Schema(description = "板材列表", requiredMode = Schema.RequiredMode.REQUIRED,example = "AABB")
private List<PlateDetailsRespVO> plateList;
}
@@ -0,0 +1,179 @@
package com.cf.imes.module.executor.controller.admin.manage.parts;
import com.cf.imes.framework.common.pojo.CommonResult;
import com.cf.imes.framework.common.pojo.PageParam;
import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.framework.common.util.object.BeanUtils;
import com.cf.imes.framework.excel.core.util.ExcelUtils;
import com.cf.imes.framework.operatelog.core.annotations.OperateLog;
import com.cf.imes.module.executor.controller.admin.manage.parts.vo.PartsCadPageReqVO;
import com.cf.imes.module.executor.controller.admin.manage.parts.vo.PartsImportExcelVO;
import com.cf.imes.module.executor.controller.admin.manage.parts.vo.PartsPageReqVO;
import com.cf.imes.module.executor.controller.admin.manage.parts.vo.PartsRespVO;
import com.cf.imes.module.executor.controller.admin.manage.parts.vo.PartsSaveReqVO;
import com.cf.imes.module.executor.dal.dataobject.orderParts.PartsDO;
import com.cf.imes.module.executor.service.manage.parts.PartsExcelListener;
import com.cf.imes.module.executor.service.manage.parts.PartsService;
import com.cf.imes.module.executor.util.file.ExcelReadUtil;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import java.io.IOException;
import java.util.List;
import static com.cf.imes.framework.common.pojo.CommonResult.success;
import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.IMPORT;
@Tag(name = "管理后台 - 配件管理")
@RestController
@RequestMapping("/manage/parts/")
@Validated
public class PartsController {
@Resource
private PartsService partsService;
final String IMPORT_TEMPLATE = "配件导入模板.xlsx";
@PostMapping("/create")
@Operation(summary = "创建配件")
@PreAuthorize("@ss.hasAnyPermissions('system:accessory:create','base:accessory:create')")
public CommonResult<Long> create(@Valid @RequestBody PartsSaveReqVO createReqVO) {
return success(partsService.create(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新配件")
@PreAuthorize("@ss.hasAnyPermissions('system:accessory:update','base:accessory:update')")
public CommonResult<Boolean> update(@Valid @RequestBody PartsSaveReqVO updateReqVO) {
partsService.update(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除配件")
@Parameters({
@Parameter(name = "id", description = "编号", required = true, example = "1024"),
@Parameter(name = "organId", description = "板材所属组织ID", example = "1024")
})
@PreAuthorize("@ss.hasAnyPermissions('system:accessory:delete','base:accessory:delete')")
public CommonResult<Boolean> delete(@RequestParam("id") Long id,
@RequestParam(value = "organId",required = false, defaultValue = "0") Long organId) {
partsService.delete(id, organId);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得配件")
@Parameters({
@Parameter(name = "id", description = "编号", required = true, example = "1024"),
@Parameter(name = "organId", description = "板材所属组织ID", example = "1024")
})
@PreAuthorize("@ss.hasAnyPermissions('system:accessory:update','base:accessory:update')")
public CommonResult<PartsRespVO> get(@RequestParam("id") Long id,
@RequestParam(value = "organId", required = false, defaultValue = "0") Long organId) {
PartsDO partsDO = partsService.get(id, organId);
return success(BeanUtils.toBean(partsDO, PartsRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得配件分页")
@PreAuthorize("@ss.hasAnyPermissions('system:accessory:query','base:accessory:query')")
public CommonResult<PageResult<PartsRespVO>> getPage(@Valid PartsPageReqVO pageReqVO) {
PageResult<PartsDO> pageResult = partsService.getPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, PartsRespVO.class));
}
@GetMapping("/webcad/page")
@Operation(summary = "获得配件分页")
public CommonResult<PageResult<PartsRespVO>> webCadGetPage(@Valid PartsPageReqVO pageReqVO) {
PageResult<PartsDO> pageResult = partsService.webCadGetPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, PartsRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出配件文件")
@PreAuthorize("@ss.hasAnyPermissions('system:accessory:export','base:accessory:export')")
@OperateLog(type = EXPORT)
public void exportExcel(@Valid PartsPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<PartsDO> list = partsService.getPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "配件表.xls", "数据", PartsRespVO.class,
BeanUtils.toBean(list, PartsRespVO.class));
}
@GetMapping("/get-import-template")
@Operation(summary = "获得导入配件模板")
@Parameter(name = "value", description = "文件类型", required = true, example = "0")
@PreAuthorize("@ss.hasAnyPermissions('system:accessory:export-template','base:accessory:export-template')")
public void importTemplate(HttpServletResponse response, @RequestParam("value") @NotEmpty(message = "文件路径不能为空") String value) {
partsService.exportTemplate(response, value);
}
@PostMapping("/import")
@Operation(summary = "导入配件")
@Parameters({
@Parameter(name = "file", description = "Excel 文件", required = true),
@Parameter(name = "updateSupport", description = "是否支持更新", example = "true"),
@Parameter(name = "organId", description = "配件所属组织ID")
})
@OperateLog(type = IMPORT)
@PreAuthorize("@ss.hasAnyPermissions('system:accessory:import','base:accessory:import')")
public void importExcel(@RequestParam("file") MultipartFile file,
@RequestParam(value = "updateSupport", required = false, defaultValue = "false") Boolean updateSupport,
@RequestParam(value = "organId", required = false, defaultValue = "0") Long organId,
HttpServletResponse response) throws Exception {
ExcelReadUtil excelReadUtil = new ExcelReadUtil();
PartsExcelListener listener = new PartsExcelListener();
List<PartsImportExcelVO> list = excelReadUtil.read(file, PartsImportExcelVO.class, listener);
if (!excelReadUtil.getFlag())
ExcelUtils.write(response, IMPORT_TEMPLATE, "配件列表", PartsImportExcelVO.class, list);
else {
if (list.isEmpty()){
PartsImportExcelVO partsImportExcelVO = PartsImportExcelVO.builder().result("导入失败,请保证导入文件中包含配件数据").build();
list.add(partsImportExcelVO);
ExcelUtils.write(response, IMPORT_TEMPLATE, "配件列表", PartsImportExcelVO.class, list);
} else {
partsService.importPartsList(list, updateSupport, organId);// 成功,批量导入
}
}
}
@GetMapping("/cad/page")
@Operation(summary = "cad获得配件分页")
// @PreAuthorize("@ss.hasAnyPermissions('system:accessory:query','base:accessory:query')")
public CommonResult<PageResult<PartsRespVO>> getCadPage(@Valid PartsCadPageReqVO pageReqVO) {
PageResult<PartsDO> pageResult = partsService.getCadPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, PartsRespVO.class));
}
@GetMapping("/webcad/all")
@Operation(summary = "获取全部配件信息")
public CommonResult<List<PartsRespVO>> getPlateAll(@RequestParam("category") String category) {
List<PartsDO> list = partsService.getPartAll(category);
return success(BeanUtils.toBean(list, PartsRespVO.class));
}
}
@@ -0,0 +1,88 @@
package com.cf.imes.module.executor.controller.admin.manage.parts.vo;
import com.cf.imes.framework.common.pojo.PageParam;
import com.cf.imes.module.executor.validation.manage.parts.PartsNumberValid;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import javax.validation.constraints.Size;
/**
* cad 传参
*/
@Schema(description = "管理后台 - 配件分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class PartsCadPageReqVO extends PageParam {
@Schema(description = "商品名称", example = "张三")
@Size(max = 64, message = "配件名称长度不能超过64个字符")
private String name;
@Schema(description = "颜色")
@Size(max = 32, message = "颜色长度不能超过32个字符")
private String color;
@Schema(description = "材质:颗粒板、欧松板、多层板、生态板、禾香板、密度板、实木、铝蜂窝板、铝塑板")
@Size(max = 64, message = "材质长度不能超过64个字符")
private String material;
@Schema(description = "配件类型", example = "2")
@Size(max = 32, message = "配件类型长度不能超过323个字符")
private String category;
@Schema(description = "配件子类", example = "2")
@Size(max = 64, message = "配件子类长度不能超过64个字符")
private String type;
@Schema(description = "型号")
@Size(max = 64, message = "配件型号长度不能超过64个字符")
private String model;
@Schema(description = "规格")
@Size(max = 64, message = "配件规格不能超过64个字符")
private String spec;
@Schema(description = "宽度")
@PartsNumberValid(name = "宽度")
private Double width;
@Schema(description = "长度")
@PartsNumberValid(name = "长度")
private Double length;
@Schema(description = "厚度")
@PartsNumberValid(name = "厚度")
private Double thickness;
@Schema(description = "品牌")
@Size(max = 64, message = "配件品牌不能超过64个字符")
private String brand;
@Schema(description = "厂家")
@Size(max = 128, message = "厂家长度不能超过64个字符")
private String factory;
@Schema(description = "单位")
@Size(max = 32, message = "单位长度不能超过64个字符")
private String unit;
@Schema(description = "是否复合部件:0 否 1 是")
private Boolean isComposite;
@Schema(description = "备注", example = "你说的对")
@Size(max = 255, message = "备注长度不能超过255个字符")
private String remark;
private Long organId;
@Schema(description = "排序", example = "ascend")
private String order;
@Schema(description = "排序字段", example = "id")
private String field;
}
@@ -0,0 +1,74 @@
package com.cf.imes.module.executor.controller.admin.manage.parts.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
/**
* 配件导入模板
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = false) // 设置 chain = false,避免用户导入有问题
public class PartsImportExcelVO {
@ExcelProperty("物料编号")
private String goodsId;
@ExcelProperty("分类")
private String category;
@ExcelProperty("复合")
private String isComposite;
@ExcelProperty("子类")
private String type;
@ExcelProperty("物料名称")
private String name;
@ExcelProperty("型号")
private String model;
@ExcelProperty("规格")
private String spec;
@ExcelProperty("材质")
private String material;
@ExcelProperty("颜色")
private String color;
@ExcelProperty("品牌")
private String brand;
@ExcelProperty("厂家")
private String factor;
@ExcelProperty("长度")// float(8,3)
private String length;
@ExcelProperty("宽度")// float(8,3)
private String width;
@ExcelProperty("厚度")
private String thickness;
@ExcelProperty("备注")
private String remark;
@ExcelProperty("价格")// float(8,3)
private String price;
@ExcelProperty("单位")
private String unit;
@ExcelProperty("上传结果")
private String result;
}
@@ -0,0 +1,108 @@
package com.cf.imes.module.executor.controller.admin.manage.parts.vo;
import com.cf.imes.framework.common.pojo.PageParam;
import com.cf.imes.module.executor.validation.manage.parts.PartsNumberValid;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;
import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/**
* 查询
*/
@Schema(description = "管理后台 - 配件分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class PartsPageReqVO extends PageParam {
@Schema(description = "设计端商品ID", example = "26589")
@Size(max = 32, message = "配件编号长度不能超过32个字符")
private String goodsId;
@Schema(description = "配件名称", example = "张三")
@Size(max = 64, message = "配件名称长度不能超过64个字符")
private String name;
@Schema(description = "颜色")
@Size(max = 32, message = "颜色长度不能超过32个字符")
private String color;
@Schema(description = "材质:颗粒板、欧松板、多层板、生态板、禾香板、密度板、实木、铝蜂窝板、铝塑板")
@Size(max = 64, message = "材质长度不能超过64个字符")
private String material;
@Schema(description = "配件类型", example = "2")
@Size(max = 32, message = "配件类型长度不能超过323个字符")
private String category;
@Schema(description = "配件子类", example = "2")
@Size(max = 64, message = "配件子类长度不能超过64个字符")
private String type;
@Schema(description = "型号")
@Size(max = 64, message = "配件型号长度不能超过64个字符")
private String model;
@Schema(description = "规格")
@Size(max = 64, message = "配件规格不能超过64个字符")
private String spec;
@Schema(description = "价格")
@PartsNumberValid(name = "价格")
private Double[] price;
@Schema(description = "宽度")
@PartsNumberValid(name = "宽度")
private Double[] width;
@Schema(description = "长度")
@PartsNumberValid(name = "长度")
private Double[] length;
@Schema(description = "厚度")
@PartsNumberValid(name = "厚度")
private Double[] thickness;
@Schema(description = "品牌")
@Size(max = 64, message = "配件品牌不能超过64个字符")
private String brand;
@Schema(description = "厂家")
@Size(max = 128, message = "厂家长度不能超过64个字符")
private String factory;
@Schema(description = "单位")
@Size(max = 32, message = "单位长度不能超过64个字符")
private String unit;
@Schema(description = "是否复合部件:0 否 1 是")
private Boolean isComposite;
@Schema(description = "子配件ID列表,复合部件时记录子配件ID,半角逗号分隔", example = "你说的对")
@Size(max = 255, message = "子配件列表长度不能超过255个字符")
private String subparts;
@Schema(description = "备注", example = "你说的对")
@Size(max = 255, message = "备注长度不能超过255个字符")
private String remark;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
private Long organId;
@Schema(description = "排序", example = "ascend")
private String order;
@Schema(description = "排序字段", example = "id")
private String field;
}
@@ -0,0 +1,111 @@
package com.cf.imes.module.executor.controller.admin.manage.parts.vo;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.cf.imes.framework.common.validation.NumberValid;
import com.cf.imes.framework.excel.core.annotations.DictFormat;
import com.cf.imes.framework.excel.core.convert.DictConvert;
import com.cf.imes.module.executor.enums.DictTypeConstants;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 配件 Response VO")
@Data
@ExcelIgnoreUnannotated
public class PartsRespVO {
@Schema(description = "配件 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "11238")
@ExcelProperty("配件ID")
@ExcelIgnore
private Long id;
@Schema(description = "设计端商品ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "26589")
@ExcelProperty("配件编号")
private String goodsId;
@Schema(description = "是否复合部件:0 否 1 是", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty(value = "是否复合部件", converter = DictConvert.class)
@DictFormat(DictTypeConstants.BOOLEAN_STRING)
private Boolean isComposite;
@Schema(description = "子配件ID列表,复合部件时记录子配件ID,半角逗号分隔", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对")
// @ExcelProperty("子配件ID列表")
@ExcelIgnore
private String subparts;
@Schema(description = "配件类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@ExcelProperty("配件类型")
@DictFormat(DictTypeConstants.PART_CATEGORY)
private String category;
@Schema(description = "配件子类", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@ExcelProperty("配件子类")
private String type;
@Schema(description = "配件名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
@ExcelProperty("配件名称")
private String name;
@Schema(description = "型号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("型号")
private String model;
@Schema(description = "材质:颗粒板、欧松板、多层板、生态板、禾香板、密度板、实木、铝蜂窝板、铝塑板", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("材质")
private String material;
@Schema(description = "颜色", requiredMode = Schema.RequiredMode.REQUIRED)
@Size(max = 32, message = "颜色长度不能超过32个字符")
@ExcelProperty("颜色")
private String color;
@Schema(description = "单位", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("单位")
private String unit;
@Schema(description = "规格", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("规格")
private String spec;
@Schema(description = "品牌", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("品牌")
private String brand;
@Schema(description = "厂家", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("厂家")
private String factory;
@Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED)
@NumberValid(name = "宽度")
@ExcelProperty("宽度")
private Double width;
@Schema(description = "长度", requiredMode = Schema.RequiredMode.REQUIRED)
@NumberValid(name = "长度")
@ExcelProperty("长度")
private Double length;
@Schema(description = "厚度", requiredMode = Schema.RequiredMode.REQUIRED)
@NumberValid(name = "厚度")
@ExcelProperty("厚度")
private Double thickness;
@Schema(description = "价格", requiredMode = Schema.RequiredMode.REQUIRED)
@NumberValid(name = "价格")
@ExcelProperty("价格")
private Double price;
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对")
@ExcelProperty("备注")
private String remark;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}
@@ -0,0 +1,100 @@
package com.cf.imes.module.executor.controller.admin.manage.parts.vo;
import com.cf.imes.framework.common.validation.NumberValid;
import com.cf.imes.module.executor.validation.manage.parts.PartsCategoryValid;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Size;
@Schema(description = "管理后台 - 配件 新增/修改 Request VO")
@Data
public class PartsSaveReqVO {
@Schema(description = "配件 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "11238")
private Long id;
@Schema(description = "设计端商品ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "26589")
@NotEmpty(message = "设计端商品ID不能为空")
@Size(max = 32, message = "设计端商品ID长度不能超过32个字符")
private String goodsId;
@Schema(description = "配件名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
@NotEmpty(message = "配件名称不能为空")
@Size(max = 64, message = "配件名称长度不能超过64个字符")
private String name;
@Schema(description = "颜色", requiredMode = Schema.RequiredMode.REQUIRED)
@Size(max = 32, message = "颜色长度不能超过32个字符")
// @NotEmpty(message = "颜色不能为空")
private String color;
@Schema(description = "材质:颗粒板、欧松板、多层板、生态板、禾香板、密度板、实木、铝蜂窝板、铝塑板", requiredMode = Schema.RequiredMode.REQUIRED)
// @NotEmpty(message = "材质:颗粒板、欧松板、多层板、生态板、禾香板、密度板、实木、铝蜂窝板、铝塑板不能为空")
@Size(max = 64, message = "材质长度不能超过64个字符")
private String material;
@Schema(description = "配件类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@NotEmpty(message = "配件类型不能为空")
@Size(max = 32, message = "配件类型长度不能超过32个字符")
@PartsCategoryValid
private String category;
@Schema(description = "配件子类", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@Size(max = 64, message = "配件子类长度不能超过64个字符")
private String type;
@Schema(description = "型号", requiredMode = Schema.RequiredMode.REQUIRED)
// @NotEmpty(message = "型号不能为空")
@Size(max = 64, message = "型号长度不能超过64个字符")
private String model;
@Schema(description = "价格", requiredMode = Schema.RequiredMode.REQUIRED)
@NumberValid(name = "价格")
private Double price;
@Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED)
@NumberValid(name = "宽度")
private Double width;
@Schema(description = "长度", requiredMode = Schema.RequiredMode.REQUIRED)
@NumberValid(name = "长度")
private Double length;
@Schema(description = "厚度", requiredMode = Schema.RequiredMode.REQUIRED)
@NumberValid(name = "厚度")
private Double thickness;
@Schema(description = "规格", requiredMode = Schema.RequiredMode.REQUIRED)
@Size(max = 64, message = "规格长度不能超过64个字符")
private String spec;
@Schema(description = "品牌", requiredMode = Schema.RequiredMode.REQUIRED)
@Size(max = 64, message = "品牌长度不能超过64个字符")
private String brand;
@Schema(description = "厂家", requiredMode = Schema.RequiredMode.REQUIRED)
@Size(max = 128, message = "厂家长度不能超过128个字符")
private String factory;
@Schema(description = "单位", requiredMode = Schema.RequiredMode.REQUIRED)
// @NotEmpty(message = "单位不能为空")
@Size(max = 32, message = "单位长度不能超过32个字符")
private String unit;
@Schema(description = "是否复合部件:0 否 1 是", requiredMode = Schema.RequiredMode.REQUIRED)
// @NotNull(message = "是否复合部件不能为空")
private Boolean isComposite;
@Schema(description = "子配件ID列表,复合部件时记录子配件ID,半角逗号分隔", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对")
@Size(max = 255, message = "子配件列表长度不能超过255个字符")
private String subparts;
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对")
@Size(max = 255, message = "备注长度不能超过255个字符")
private String remark;
private Long organId;
}
@@ -0,0 +1,189 @@
package com.cf.imes.module.executor.controller.admin.manage.plate;
import com.cf.imes.framework.common.pojo.CommonResult;
import com.cf.imes.framework.common.pojo.PageParam;
import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.framework.common.util.object.BeanUtils;
import com.cf.imes.framework.excel.core.util.ExcelUtils;
import com.cf.imes.framework.operatelog.core.annotations.OperateLog;
import com.cf.imes.module.executor.controller.admin.manage.plate.vo.plate.PlateImportExcelVO;
import com.cf.imes.module.executor.controller.admin.manage.plate.vo.plate.PlatePageReqVO;
import com.cf.imes.module.executor.controller.admin.manage.plate.vo.plate.PlateRespVO;
import com.cf.imes.module.executor.controller.admin.manage.plate.vo.plate.PlateSaveReqVO;
import com.cf.imes.module.executor.dal.dataobject.plate.PlateGoodDO;
import com.cf.imes.module.executor.service.manage.plate.PlateExcelListener;
import com.cf.imes.module.executor.service.manage.plate.PlateManageService;
import com.cf.imes.module.executor.util.file.ExcelReadUtil;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.List;
import static com.cf.imes.framework.common.pojo.CommonResult.success;
import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.IMPORT;
@Tag(name = "管理后台 - 板材库管理")
@RestController
@RequestMapping("/manage/plate")
@Validated
public class PlateManageController {
@Resource
private PlateManageService plateService;
final String IMPORT_TEMPLATE = "板材导入模板.xlsx";
@PostMapping("/create")
@Operation(summary = "创建板材信息")
@PreAuthorize("@ss.hasAnyPermissions('manage:plate:create','base:plate:create')")
public CommonResult<Long> createPlate(@Valid @RequestBody PlateSaveReqVO createReqVO) {
return success(plateService.createPlate(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新板材信息")
@PreAuthorize("@ss.hasAnyPermissions('manage:plate:update','base:plate:update')")
public CommonResult<Boolean> updatePlate(@Valid @RequestBody PlateSaveReqVO updateReqVO) {
plateService.updatePlate(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除板材信息")
@Parameters({
@Parameter(name = "id", description = "编号", required = true, example = "1024"),
@Parameter(name = "organId", description = "板材所属组织ID", example = "1024")
})
@PreAuthorize("@ss.hasAnyPermissions('manage:plate:delete','base:plate:delete')")
public CommonResult<Boolean> deletePlate(@RequestParam("id") Long id,
@RequestParam(value = "organId",required = false, defaultValue = "0") Long organId) {
plateService.deletePlate(id,organId);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得板材信息")
@Parameters({
@Parameter(name = "id", description = "编号", required = true, example = "1024"),
@Parameter(name = "organId", description = "板材所属组织ID", required = true, example = "1024")
})
@PreAuthorize("@ss.hasAnyPermissions('manage:plate:update','base:plate:update')")
public CommonResult<PlateRespVO> getPlate(@RequestParam("id") Long id,
@RequestParam("organId") Long organId) {
PlateGoodDO plate = plateService.getPlate(id, organId);
return success(BeanUtils.toBean(plate, PlateRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得板材信息分页")
@PreAuthorize("@ss.hasAnyPermissions('manage:plate:query','base:plate:query')")
public CommonResult<PageResult<PlateRespVO>> getPlatePage(@Valid PlatePageReqVO pageReqVO) {
PageResult<PlateGoodDO> pageResult = plateService.getPlatePage(pageReqVO);
return success(BeanUtils.toBean(pageResult, PlateRespVO.class));
}
@GetMapping("/webcad/page")
@Operation(summary = "webcad获得板材信息分页")
public CommonResult<PageResult<PlateRespVO>> webCadGetPlatePage(@Valid PlatePageReqVO pageReqVO) {
PageResult<PlateGoodDO> pageResult = plateService.webCadGetPlatePage(pageReqVO);
return success(BeanUtils.toBean(pageResult, PlateRespVO.class));
}
@GetMapping("/export")
@Operation(summary = "导出板材信息")
@PreAuthorize("@ss.hasAnyPermissions('manage:plate:export','base:plate:export')")
@OperateLog(type = EXPORT)
public void exportPlateExcel(@Valid PlatePageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<PlateGoodDO> list = plateService.getPlatePage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "板材信息表.xls", "数据", PlateRespVO.class,
BeanUtils.toBean(list, PlateRespVO.class));
}
@GetMapping("/get-import-template")
@Operation(summary = "获得导入用户模板")
@PreAuthorize("@ss.hasAnyPermissions('system:plate:export-template','base:plate:export-template')")
public void importTemplate(HttpServletResponse response) throws IOException {
// // 手动创建导出 demo
// List<PlateImportExcelVO> list = Arrays.asList(
// PlateImportExcelVO.builder().goodsId("BD10010001").goodsName("18mm-多层板-暖白").material("多层板").width(String.valueOf(1220)).height(String.valueOf(2440))
// .thickness(String.valueOf(18)).brand("AAA").spec("2440*1220*18").color("暖白").price("120").texture("无").build(),
// PlateImportExcelVO.builder().goodsId("BD10010002").goodsName("18mm-颗粒板-高级灰").material("多层板").width(String.valueOf(1220)).height(String.valueOf(2750))
// .thickness(String.valueOf(18)).brand("鸿达树").spec("2750*1220*18").color("高级灰").price("120").texture("无").build()
// );
// // 输出
// ExcelUtils.write(response, IMPORT_TEMPLATE, "板材列表", PlateImportExcelVO.class, list);
plateService.exportTemplate(response, "excel_plate_add.xlsx");
}
// @GetMapping("/get-import-template")
// @Operation(summary = "获得导入板材模板")
// @Parameter(name = "value", description = "文件类型", required = true, example = "0")
// public void importTemplate(HttpServletResponse response, @RequestParam("value") @NotEmpty(message = "文件路径不能为空") String value) {
// plateService.exportTemplate(response, value);
// }
@PostMapping("/import")
@Operation(summary = "导入板材")
@Parameters({
@Parameter(name = "file", description = "Excel 文件", required = true),
@Parameter(name = "updateSupport", description = "是否支持更新,默认为 false", example = "true"),
@Parameter(name = "organId", description = "板材所属组织ID")
})
@OperateLog(type = IMPORT)
// @PreAuthorize("@ss.hasPermission('manage:plate:import')")
@PreAuthorize("@ss.hasAnyPermissions('manage:plate:import','base:plate:import')")
public void importExcel(@RequestParam("file") MultipartFile file,
@RequestParam(value = "updateSupport", required = false, defaultValue = "false") Boolean updateSupport,
@RequestParam(value = "organId") Long organId,
HttpServletResponse response) throws Exception {
ExcelReadUtil excelReadUtil = new ExcelReadUtil();
PlateExcelListener listener = new PlateExcelListener();
List<PlateImportExcelVO> list = excelReadUtil.read(file, PlateImportExcelVO.class, listener);
// 判断文件是否导入成功
if (!excelReadUtil.getFlag())
ExcelUtils.write(response, IMPORT_TEMPLATE, "板材列表", PlateImportExcelVO.class, list);
else {
if (list.isEmpty()){
PlateImportExcelVO plateImportExcelVO = PlateImportExcelVO.builder().result("导入失败,请保证导入文件中包含板材数据").build();
list.add(plateImportExcelVO);
ExcelUtils.write(response, IMPORT_TEMPLATE, "板材列表", PlateImportExcelVO.class, list);
}else {
plateService.importPlateList(list, updateSupport, organId);// 成功,批量导入
}
}
// plateExcelUtil.clear();
}
@GetMapping("/webcad/all")
@Operation(summary = "获取全部板材信息")
public CommonResult<List<PlateRespVO>> webCadGetPlateAll() {
List<PlateGoodDO> list = plateService.getPlateAll();
return success(BeanUtils.toBean(list, PlateRespVO.class));
}
}
@@ -0,0 +1,136 @@
package com.cf.imes.module.executor.controller.admin.manage.plate;
import com.cf.imes.framework.common.pojo.CommonResult;
import com.cf.imes.framework.common.pojo.PageParam;
import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.framework.common.util.object.BeanUtils;
import com.cf.imes.framework.excel.core.util.ExcelUtils;
import com.cf.imes.framework.operatelog.core.annotations.OperateLog;
import com.cf.imes.module.executor.controller.admin.manage.plate.vo.remain.RemainPlatePageReqVO;
import com.cf.imes.module.executor.controller.admin.manage.plate.vo.remain.RemainPlateRespVO;
import com.cf.imes.module.executor.controller.admin.manage.plate.vo.remain.RemainPlateSaveReqVO;
import com.cf.imes.module.executor.controller.admin.manage.plate.vo.remain.RemainPlateUptReqVO;
import com.cf.imes.module.executor.dal.dataobject.remainplaten.RemainPlateDO;
import com.cf.imes.module.executor.service.manage.remainplaten.RemainPlateManageService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.List;
import java.util.Set;
import static com.cf.imes.framework.common.pojo.CommonResult.success;
import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Tag(name = "管理后台 - 余料管理")
@RestController
@RequestMapping("/manage/remain-plate")
@Validated
public class RemainPlateManageController {
@Resource
private RemainPlateManageService remainPlateService;
@PostMapping("/create")
@Operation(summary = "添加余料(单个)")
@PreAuthorize("@ss.hasAnyPermissions('manage:remain-plate:create','placeorder:optimize')")
public CommonResult<Boolean> createRemainPlate(@Valid @RequestBody RemainPlateSaveReqVO createReqVO) {
return success(remainPlateService.createRemainPlate(createReqVO));
}
@PostMapping("/createMultiple")
@Operation(summary = "创建生产单余料板表(多个)")
@PreAuthorize("@ss.hasAnyPermissions('manage:remain-plate:create','placeorder:optimize')")
public CommonResult<Boolean> createRemainPlateMultiple(@Valid @RequestBody Set<RemainPlateSaveReqVO> createReqVOS) {
return success(remainPlateService.createRemainPlateMultiple(createReqVOS));
}
@PutMapping("/update")
@Operation(summary = "余料修改")
@PreAuthorize("@ss.hasPermission('manage:remain-plate:update')")
public CommonResult<Boolean> updateRemainPlate(@Valid @RequestBody RemainPlateSaveReqVO updateReqVO) {
remainPlateService.updateRemainPlate(updateReqVO);
return success(true);
}
@PutMapping("/updateStatus")
@Operation(summary = "余料板批量核销")
@PreAuthorize("@ss.hasAnyPermissions('manage:remain-plate:update','manage:remain-plate:write-off')")
public CommonResult<Boolean> updateRemainPlate(@RequestBody RemainPlateUptReqVO updateReqVO) {
remainPlateService.updateRemainPlateStatus(updateReqVO.getIds(),
updateReqVO.getStatus(),
updateReqVO.getUseType(),
updateReqVO.getPlanId());
return success(true);
}
@PutMapping("/revertUpdate")
@Operation(summary = "余料板批量释放")
@PreAuthorize("@ss.hasAnyPermissions('manage:remain-plate:update','manage:remain-plate:release')")
public CommonResult<Boolean> revertRemainPlate(@RequestBody RemainPlateUptReqVO updateReqVO) {
remainPlateService.revertRemainPlateStatus(updateReqVO.getIds(),updateReqVO.getStatus());
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除余料")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('manage:remain-plate:delete')")
public CommonResult<Boolean> deleteRemainPlate(@RequestParam("id") Set<Long> ids) {
remainPlateService.deleteRemainPlate(ids);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得生产单余料板表")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('manage:remain-plate:query')")
public CommonResult<RemainPlateRespVO> getRemainPlate(@RequestParam("id") Long id) {
RemainPlateDO remainPlate = remainPlateService.getRemainPlate(id);
return success(BeanUtils.toBean(remainPlate, RemainPlateRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得生产单余料板表分页")
@PreAuthorize("@ss.hasAnyPermissions('manage:remain-plate:query','placeorder:optimize','placeorder:remain-insert','production:manager-list:calculate')")
public CommonResult<PageResult<RemainPlateRespVO>> getRemainPlatePage(@Valid RemainPlatePageReqVO pageReqVO) {
PageResult<RemainPlateDO> pageResult = remainPlateService.getRemainPlatePage(pageReqVO);
return success(BeanUtils.toBean(pageResult, RemainPlateRespVO.class));
}
@GetMapping("/pageAdd")
@Operation(summary = "获得生产单余料板可添加分页")
@PreAuthorize("@ss.hasPermission('manage:remain-plate:query')")
public CommonResult<PageResult<RemainPlateRespVO>> getRemainPlatePageToAdd(@Valid RemainPlatePageReqVO pageReqVO) {
PageResult<RemainPlateDO> pageResult = remainPlateService.getRemainPlatePageToAdd(pageReqVO);
return success(BeanUtils.toBean(pageResult, RemainPlateRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出生产单余料板表Excel")
@PreAuthorize("@ss.hasPermission('manage:remain-plate:export')")
@OperateLog(type = EXPORT)
public void exportRemainPlateExcel(@Valid RemainPlatePageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<RemainPlateDO> list = remainPlateService.getRemainPlatePage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "生产单余料板表 order_remain_plate_{N}.xls", "数据", RemainPlateRespVO.class,
BeanUtils.toBean(list, RemainPlateRespVO.class));
}
}
@@ -0,0 +1,106 @@
package com.cf.imes.module.executor.controller.admin.manage.plate.vo.plate;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotEmpty;
/**
* 用户 Excel 导入 VO
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = false) // 设置 chain = false,避免用户导入有问题
public class PlateImportExcelVO {
@ExcelProperty("*物料编号")
@NotEmpty(message = "物料编号不能为空")
private String goodsId;
@ExcelProperty("*物料名称")
@NotEmpty(message = "物料名称不能为空")
private String goodsName;
@ExcelProperty("*材质")
@NotEmpty(message = "材质不能为空")
private String material;
@ExcelProperty("*颜色")
@NotEmpty(message = "颜色不能为空")
private String color;
@ExcelProperty(value = "纹理")
@ColumnWidth(10)
private String texture;
@ExcelProperty("宽度")
@ColumnWidth(10)
@NotEmpty(message = "宽度不能为空")
private String width;
@ExcelProperty("高度")// float(8,3)
@ColumnWidth(10)
@NotEmpty(message = "高度不能为空")
private String height;
@ExcelProperty("*厚度")
@ColumnWidth(10)
@NotEmpty(message = "厚度不能为空")
private String thickness;
@ExcelProperty("规格")
@NotEmpty(message = "规格不能为空")
private String spec;
@ExcelProperty("备注")
private String remark;
@ExcelProperty("品牌")
@NotEmpty(message = "品牌不能为空")
private String brand;
@ExcelProperty("价格")
@NotEmpty(message = "价格不能为空")
private String price;
@ExcelProperty("上传结果")
private String result;
public boolean isValidGoods() {
return !(goodsId == null || goodsId.isEmpty() || goodsName == null || goodsName.isEmpty() || material == null ||
material.isEmpty() || color == null || color.isEmpty() ||thickness.isEmpty() );
}
// 数据长度判断
public boolean checkPrecision(Double number) {
if (number == null) {
return false;
}
// 将浮点数转换成字符串
String numberStr = Double.toString(number);
// 分割整数部分和小数部分
String[] parts = numberStr.split("\\.");
String integerPart = parts[0];
String decimalPart = parts.length > 1 ? parts[1] : "";
// 检查整数部分位数
if (integerPart.length() > 5) {
return false;
}
// 检查小数部分位数
if (decimalPart.length() > 3) {
return false;
}
return true;
}
}
@@ -0,0 +1,28 @@
package com.cf.imes.module.executor.controller.admin.manage.plate.vo.plate;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
import lombok.Data;
import java.util.List;
import java.util.Map;
/**
* @projectName: cf_imes_back
* @author: 晨丰科技
* @date: 2024/2/27 16:36
*/
@Schema(description = "管理后台 - 板材信息表 plate_{N}导入 Response VO")
@Data
@Builder
public class PlateImportRespVO {
@Schema(description = "创建成功的板材数组", requiredMode = Schema.RequiredMode.REQUIRED)
private List<String> createPlateNames;
@Schema(description = "更新成功的板材数组", requiredMode = Schema.RequiredMode.REQUIRED)
private List<String> updatePlateNames;
@Schema(description = "导入失败的板材集合,key 为板材名,value 为失败原因", requiredMode = Schema.RequiredMode.REQUIRED)
private Map<String, String> failurePlateNames;
}
@@ -0,0 +1,75 @@
package com.cf.imes.module.executor.controller.admin.manage.plate.vo.plate;
import com.cf.imes.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;
import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 板材信息表 plate_{N}分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class PlatePageReqVO extends PageParam {
@Schema(description = "客户的商品编号", example = "1")
@Size(max = 32, message = "商品编号长度不能超过32个字符")
private String goodsId;
@Schema(description = "商品名称", example = "赵六")
@Size(max = 64, message = "商品名称长度不能超过64个字符")
private String goodsName;
@Schema(description = "材质:颗粒板、欧松板、多层板、生态板、禾香板、密度板、实木、铝蜂窝板、铝塑板")
@Size(max = 64, message = "材质长度不能超过64个字符")
private String material;
@Schema(description = "颜色")
@Size(max = 32, message = "颜色长度不能超过32个字符")
private String color;
@Schema(description = "纹理")
private Boolean texture;
@Schema(description = "宽度")
private Double width;
@Schema(description = "高度")
private Double height;
@Schema(description = "厚度")
private Double thickness;
@Schema(description = "价格", example = "3380")
private Double price;
@Schema(description = "品牌")
@Size(max = 64, message = "品牌长度不能超过64个字符")
private String brand;
@Schema(description = "规格")
@Size(max = 64, message = "规格长度不能超过64个字符")
private String spec;
@Schema(description = "备注", example = "随便")
@Size(max = 255, message = "备注长度不能超过255个字符")
private String remark;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
private Long organId;
@Schema(description = "排序", example = "ascend")
private String order;
@Schema(description = "排序字段", example = "id")
private String field;
}
@@ -0,0 +1,77 @@
package com.cf.imes.module.executor.controller.admin.manage.plate.vo.plate;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.cf.imes.framework.excel.core.annotations.DictFormat;
import com.cf.imes.framework.excel.core.convert.DictConvert;
import com.cf.imes.module.executor.enums.DictTypeConstants;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 板材信息表 plate_{N} Response VO")
@Data
@ExcelIgnoreUnannotated
public class PlateRespVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelIgnore
private Long id;
@Schema(description = "客户的商品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty("商品编号")
private String goodsId;
@Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
@ExcelProperty("商品名称")
private String goodsName;
@Schema(description = "材质:颗粒板、欧松板、多层板、生态板、禾香板、密度板、实木、铝蜂窝板、铝塑板", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("材质")
private String material;
@Schema(description = "颜色", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("颜色")
private String color;
@Schema(description = "纹理", example = "")
@ExcelProperty(value = "纹理", converter = DictConvert.class)
@DictFormat(DictTypeConstants.PLATE_TEXTURE)
private Boolean texture;
@Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("宽度")
private Double width;
@Schema(description = "高度", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("高度")
private Double height;
@Schema(description = "厚度", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("厚度")
private Double thickness;
@Schema(description = "价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "3380")
@ExcelProperty("价格")
private Double price;
@Schema(description = "品牌", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("品牌")
private String brand;
@Schema(description = "规格", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("规格")
private String spec;
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "随便")
@ExcelProperty("备注")
private String remark;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelIgnore
private LocalDateTime createTime;
private Long organId;
}
@@ -0,0 +1,74 @@
package com.cf.imes.module.executor.controller.admin.manage.plate.vo.plate;
import com.cf.imes.framework.common.validation.NumberValid;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
@Schema(description = "管理后台 - 板材信息表 plate_{N}新增/修改 Request VO")
@Data
public class PlateSaveReqVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Long id;
@Schema(description = "客户的商品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotEmpty(message = "客户的商品编号不能为空")
@Size(max = 32, message = "商品编号长度不能超过32个字符")
private String goodsId;
@Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
@NotEmpty(message = "商品名称不能为空")
@Size(max = 64, message = "商品名称长度不能超过64个字符")
private String goodsName;
@Schema(description = "材质:颗粒板、欧松板、多层板、生态板、禾香板、密度板、实木、铝蜂窝板、铝塑板", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "材质:颗粒板、欧松板、多层板、生态板、禾香板、密度板、实木、铝蜂窝板、铝塑板不能为空")
@Size(max = 64, message = "材质长度不能超过64个字符")
private String material;
@Schema(description = "颜色", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "颜色不能为空")
@Size(max = 32, message = "颜色长度不能超过32个字符")
private String color;
@Schema(description = "纹理", requiredMode = Schema.RequiredMode.REQUIRED)
// @NotNull(message = "纹理不能为空")
private Boolean texture;
@Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED)
// @NotNull(message = "宽度不能为空")
@NumberValid(name = "宽度")
private Double width;
@Schema(description = "高度", requiredMode = Schema.RequiredMode.REQUIRED)
// @NotNull(message = "高度不能为空")
@NumberValid(name = "高度")
private Double height;
@Schema(description = "厚度", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "厚度不能为空")
@NumberValid(name = "厚度")
private Double thickness;
@Schema(description = "价格", example = "3380")
@NumberValid(name = "价格")
private Double price;
@Schema(description = "品牌")
@Size(max = 64, message = "品牌长度不能超过64个字符")
private String brand;
@Schema(description = "规格")
@Size(max = 64, message = "规格长度不能超过64个字符")
private String spec;
@Schema(description = "备注", example = "随便")
@Size(max = 255, message = "备注长度不能超过255个字符")
private String remark;
private Long organId;
}
@@ -0,0 +1,113 @@
package com.cf.imes.module.executor.controller.admin.manage.plate.vo.remain;
import com.cf.imes.framework.common.pojo.PageParam;
import com.cf.imes.framework.common.validation.NumberValid;
import com.cf.imes.module.executor.validation.manage.common.ValidCommonStatus;
import com.cf.imes.module.executor.validation.manage.placeStyle.ValidPlaceStyle;
import com.cf.imes.module.executor.validation.manage.type.ValidTypeField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 生产单余料板表 order_remain_plate_{N}分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class RemainPlatePageReqVO extends PageParam {
@Schema(description = "ID", example = "16628")
@Pattern(regexp = "^[0-9]*$",message = "余料号应为数字")
private String id;
@Schema(description = "排单 ID", example = "16628")
@Pattern(regexp = "^[0-9]*$",message = "使用排单号应为数字")
private String planId;
@Schema(description = "组织id", example = "1")
private Long organId;
@Schema(description = "初始排单 ID", example = "6628")
@Pattern(regexp = "^[0-9]*$",message = "排单号应为数字")
private String initPlanId;
@Schema(description = "余料板状态,0未使用,1使用中", example = "0")
@ValidCommonStatus
private Integer status;
@Schema(description = "是否为开料添加,0否,1是", example = "0")
private Boolean isCutting;
@Schema(description = "使用类型,0核销,1排单,2补板", example = "0")
@ValidTypeField
private Integer useType;
@Schema(description = "商品 ID", example = "7425")
@Size(max = 32, message = "商品ID长度不能超过32个字符")
private String goodsId;
@Schema(description = "商品名", example = "晨丰")
@Size(max = 255, message = "商品名长度不能超过255个字符")
private String name;
@Schema(description = "材料")
@Size(max = 50, message = "材料长度不能超过50个字符")
private String material;
@Schema(description = "颜色")
@Size(max = 50, message = "颜色长度不能超过50个字符")
private String color;
@Schema(description = "纹理")
private Boolean texture;
@Schema(description = "宽度")
private BigDecimal[] width;
@Schema(description = "长度")
private BigDecimal[] length;
@Schema(description = "厚度")
@NumberValid(name = "厚度")
private BigDecimal thickness;
@Schema(description = "品牌")
@Size(max = 50, message = "品牌长度不能超过50个字符")
private String brand;
@Schema(description = "放置样式,0正面,1正面右转,2正面后转,3正面左转,4反面,5反面右转,6反面后转,7反面左转")
@ValidPlaceStyle
private Integer placeStyle;
@Schema(description = "仓库名")
@Size(max = 64, message = "品牌长度不能超过64个字符")
private String store;
@Schema(description = "数量", example = "18318")
private Integer count;
@Schema(description = "备注", example = "随便")
@Size(max = 255, message = "品牌长度不能超过255个字符")
private String remark;
@Schema(description = "轮廊数据,Json 串")
private String outLineJson;
@Schema(description = "创建日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "排序", example = "ascend")
private String order;
@Schema(description = "排序字段", example = "id")
private String field;
}
@@ -0,0 +1,105 @@
package com.cf.imes.module.executor.controller.admin.manage.plate.vo.remain;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 生产单余料板表 order_remain_plate_{N} Response VO")
@Data
@ExcelIgnoreUnannotated
public class RemainPlateRespVO {
@Schema(description = "余料板 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "16470")
@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;
@Schema(description = "初始排单 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "6628")
@ExcelProperty("初始排单 ID")
private Long initPlanId;
@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;
@Schema(description = "商品名", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰")
@ExcelProperty("商品名")
private String name;
@Schema(description = "材料", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("材料")
private String material;
@Schema(description = "颜色", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("颜色")
private String color;
@Schema(description = "纹理 有 无", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("纹理 有 无")
private Boolean texture;
@Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("宽度")
private BigDecimal width;
@Schema(description = "长度", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("长度")
private BigDecimal length;
@Schema(description = "厚度", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("厚度")
private BigDecimal thickness;
@Schema(description = "品牌", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("品牌")
private String brand;
@Schema(description = "放置样式,0正面,1正面右转,2正面后转,3正面左转,4反面,5反面右转,6反面后转,7反面左转", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("放置样式,0正面,1正面右转,2正面后转,3正面左转,4反面,5反面右转,6反面后转,7反面左转")
private Integer placeStyle;
@Schema(description = "仓库名", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("仓库名")
private String store;
@Schema(description = "数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "18318")
@ExcelProperty("数量")
private Integer count;
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "随便")
@ExcelProperty("备注")
private String remark;
@Schema(description = "轮廊数据,Json 串", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("轮廊数据,Json 串")
private String outLineJson;
@Schema(description = "创建日期", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建日期")
private LocalDateTime createTime;
}
@@ -0,0 +1,102 @@
package com.cf.imes.module.executor.controller.admin.manage.plate.vo.remain;
import com.cf.imes.framework.common.validation.NumberValid;
import com.cf.imes.module.executor.validation.manage.common.ValidCommonStatus;
import com.cf.imes.module.executor.validation.manage.placeStyle.ValidPlaceStyle;
import com.cf.imes.module.executor.validation.manage.type.ValidTypeField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.math.BigDecimal;
@Schema(description = "管理后台 - 生产单余料板表 Request VO")
@Data
public class RemainPlateSaveReqVO {
@Schema(description = "余料板 ID")
private Long id;
@Schema(description = "组织id", example = "1")
private Long organId;
@Schema(description = "排单 ID")
private Long planId;
@Schema(description = "初始排单 ID")
private Long initPlanId;
@Schema(description = "余料板状态,0未使用,1已使用", example = "1")
@ValidCommonStatus
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 = "1")
@ValidTypeField
private Integer useType;
@Schema(description = "商品 ID", example = "7425")
@Size(max = 32, message = "商品ID长度不能超过32个字符")
private String goodsId;
@Schema(description = "商品名", example = "晨丰")
@Size(max = 255, message = "商品名长度不能超过255个字符")
private String name;
@Schema(description = "材料", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "材料不能为空")
@Size(max = 50, message = "材料长度不能超过50个字符")
private String material;
@Schema(description = "颜色", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "颜色不能为空")
@Size(max = 50, message = "颜色长度不能超过50个字符")
private String color;
@Schema(description = "纹理 有 无", requiredMode = Schema.RequiredMode.REQUIRED)
private Boolean texture;
@Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "宽度不能为空")
@NumberValid(name = "宽度")
private BigDecimal width;
@Schema(description = "长度", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "长度不能为空")
@NumberValid(name = "长度")
private BigDecimal length;
@Schema(description = "厚度", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "厚度不能为空")
@NumberValid(name = "厚度")
private BigDecimal thickness;
@Schema(description = "品牌")
@Size(max = 50, message = "品牌长度不能超过50个字符")
private String brand;
@Schema(description = "放置样式,0正面,1正面右转,2正面后转,3正面左转,4反面,5反面右转,6反面后转,7反面左转", example = "0")
@ValidPlaceStyle
private Integer placeStyle;
@Schema(description = "仓库名")
@Size(max = 64, message = "仓库名长度不能超过64个字符")
private String store;
@Schema(description = "数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "18318")
@NotNull(message = "数量不能为空")
private Integer count;
@Schema(description = "备注", example = "随便")
@Size(max = 255, message = "备注长度不能超过255个字符")
private String remark;
@Schema(description = "轮廊数据,Json 串", requiredMode = Schema.RequiredMode.REQUIRED, example = "18318")
private String outLineJson;
}
@@ -0,0 +1,67 @@
package com.cf.imes.module.executor.controller.admin.manage.plate.vo.remain;
import com.cf.imes.framework.common.validation.NumberValid;
import com.cf.imes.module.executor.validation.manage.placeStyle.ValidPlaceStyle;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.math.BigDecimal;
/**
* 余料修改字段
*/
@Schema(description = "管理后台 - 余料修改字段 VO")
@Data
public class RemainPlateUpSaveVO {
@Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "宽度不能为空")
@NumberValid(name = "宽度")
private BigDecimal width;
@Schema(description = "长度", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "长度不能为空")
@NumberValid(name = "长度")
private BigDecimal length;
@Schema(description = "厚度", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "厚度不能为空")
@NumberValid(name = "厚度")
private BigDecimal thickness;
@Schema(description = "纹理 有 无", requiredMode = Schema.RequiredMode.REQUIRED)
private Boolean texture;
@Schema(description = "材料", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "材料不能为空")
@Size(max = 50, message = "材料长度不能超过50个字符")
private String material;
@Schema(description = "颜色", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "颜色不能为空")
@Size(max = 50, message = "颜色长度不能超过50个字符")
private String color;
@Schema(description = "品牌")
@Size(max = 50, message = "品牌长度不能超过50个字符")
private String brand;
@Schema(description = "仓库名")
@Size(max = 64, message = "品牌长度不能超过64个字符")
private String store;
@Schema(description = "备注", example = "随便")
@Size(max = 255, message = "品牌长度不能超过255个字符")
private String remark;
@Schema(description = "放置样式", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "余料放置样式不可为空")
@ValidPlaceStyle
private Integer placeStyle;
@Schema(description = "轮廊数据,Json 串", requiredMode = Schema.RequiredMode.REQUIRED)
private String outLineJson;
}
@@ -0,0 +1,27 @@
package com.cf.imes.module.executor.controller.admin.manage.plate.vo.remain;
import com.cf.imes.module.executor.validation.manage.common.ValidCommonStatus;
import com.cf.imes.module.executor.validation.manage.type.ValidTypeField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.Set;
@Schema(description = "管理后台 - 生产单余料板表 order_remain_plate_{N} Response VO")
@Data
public class RemainPlateUptReqVO {
@Schema(description = "余料板集", example = "16470")
private Set<Long> ids;
@Schema(description = "余料板状态,0未使用,1使用中", example = "1")
@ValidCommonStatus
private Integer status;
@Schema(description = "使用类型,1核销,2排单,3补板", example = "0")
@ValidTypeField
private Integer useType;
@Schema(description = "排单 ID", example = "6628")
private Long planId;
}
@@ -0,0 +1,28 @@
package com.cf.imes.module.executor.controller.admin.manage.process.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
public class PlateDetails {
@Schema(description = "板编号")
private Long plateId;
@Schema(description = "自定义板编号-板号")
private Long plateNo;
@Schema(description = "")
private Long length;
@Schema(description = "")
private Long width;
@Schema(description = "")
private Long thickness;
}
@@ -0,0 +1,39 @@
package com.cf.imes.module.executor.controller.admin.manage.process.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.ToString;
@Schema(description = "管理后台 - 查询板件")
@Data
@ToString(callSuper = true)
public class ProcessPlateReqVO {
@Schema(description = "工序类型",requiredMode = Schema.RequiredMode.REQUIRED)
private Long processType;
@Schema(description = "生产单号",requiredMode = Schema.RequiredMode.REQUIRED)
private Long orderId;
// @Schema(description = "工序明细ID",requiredMode = Schema.RequiredMode.REQUIRED)
// private Long stepItemId;
@Schema(description = "生产单工序步骤ID", requiredMode = Schema.RequiredMode.REQUIRED,example = "11")
private Long processStepId;
@Schema(description = "加工项名称", requiredMode = Schema.RequiredMode.REQUIRED,example = "ABCD")
private String name;
@Schema(description = "柜体ID")
private Long bodyId;
}
@@ -0,0 +1,64 @@
package com.cf.imes.module.executor.controller.admin.manage.query.vo.pack;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 生产单包裹表 Response VO")
@Data
public class OrderPackageVO {
@Schema(description = "主键-包裹ID", requiredMode = Schema.RequiredMode.REQUIRED)
private Long id;
@Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED)
private Long orderId;
@Schema(description = "自定义单号")
private String customOrderNo;
@Schema(description = "客户")
private String customer;
@Schema(description = "客户地址")
private String address;
@Schema(description = "经销商")
private String dealer;
@Schema(description = "包裹编号", requiredMode = Schema.RequiredMode.REQUIRED)
private String packageNo;
@Schema(description = "包裹类型", requiredMode = Schema.RequiredMode.REQUIRED)
private Long type;
@Schema(description = "包裹状态", requiredMode = Schema.RequiredMode.REQUIRED)
private Long status;
@Schema(description = "组织ID", requiredMode = Schema.RequiredMode.REQUIRED)
private Long organId;
@Schema(description = "创建人", requiredMode = Schema.RequiredMode.REQUIRED)
private String creator;
@Schema(description = "包裹备注", requiredMode = Schema.RequiredMode.REQUIRED)
private String packRemark;
@Schema(description = "生产单备注", requiredMode = Schema.RequiredMode.REQUIRED)
private String orderRemark;
@Schema(description = "出库人", requiredMode = Schema.RequiredMode.REQUIRED)
private String updater;
@Schema(description = "出库时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime updateTime;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime createTime;
}
@@ -0,0 +1,127 @@
package com.cf.imes.module.executor.controller.admin.manage.query.vo.pack;
import com.cf.imes.module.executor.controller.admin.manage.pack.vo.GroupNameList;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
@Schema(description = "管理后台 - 包裹详情 Response VO")
@Data
public class PackageDetailsRespVO {
@Schema(description = "生产单ID", requiredMode = Schema.RequiredMode.REQUIRED)
private String orderId;
@Schema(description = "房间名称-板材类型显示", requiredMode = Schema.RequiredMode.REQUIRED)
private String roomName;
@Schema(description = "柜体名称", requiredMode = Schema.RequiredMode.REQUIRED)
private String cabinetName;
@Schema(description = "板材ID", requiredMode = Schema.RequiredMode.REQUIRED)
private Long plateId;
@Schema(description = "板编号", requiredMode = Schema.RequiredMode.REQUIRED)
private String plateNo;
@Schema(description = "板名称", requiredMode = Schema.RequiredMode.REQUIRED)
private String plateName;
@Schema(description = "材料", requiredMode = Schema.RequiredMode.REQUIRED)
private String material;
@Schema(description = "颜色", requiredMode = Schema.RequiredMode.REQUIRED)
private String color;
@Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED)
private Double width;
@Schema(description = "长度", requiredMode = Schema.RequiredMode.REQUIRED)
private Double height;
@Schema(description = "厚度", requiredMode = Schema.RequiredMode.REQUIRED)
private Double thickness;
@Schema(description = "面积", requiredMode = Schema.RequiredMode.REQUIRED)
private Double area;
@Schema(description = "纹路", requiredMode = Schema.RequiredMode.REQUIRED)
private String texture;
@Schema(description = "是否异型", requiredMode = Schema.RequiredMode.REQUIRED)
private Boolean specialShaped;
@Schema(description = "是否造型", requiredMode = Schema.RequiredMode.REQUIRED)
private Boolean profiling;
@Schema(description = "是否有孔", requiredMode = Schema.RequiredMode.REQUIRED)
private Boolean rowHole;
@Schema(description = "加工组", requiredMode = Schema.RequiredMode.REQUIRED)
private String processGroup;
@Schema(description = "备注(板材和配件都要传递)", requiredMode = Schema.RequiredMode.REQUIRED)
private String remark;
@Schema(description = "加工组名称集合")
private List<GroupNameList> processGroupNameList;
@Schema(description = "配件名称-配件类型显示", requiredMode = Schema.RequiredMode.REQUIRED)
private String name;
@Schema(description = "配件ID", requiredMode = Schema.RequiredMode.REQUIRED)
private Long partsId;
@Schema(description = "型号", requiredMode = Schema.RequiredMode.REQUIRED)
private String model;
@Schema(description = "规格", requiredMode = Schema.RequiredMode.REQUIRED)
private String spec;
@Schema(description = "明细配件类型, 2 五金/配件 3 其他 4 报价配件", requiredMode = Schema.RequiredMode.REQUIRED)
private String type;
@Schema(description = "数量", requiredMode = Schema.RequiredMode.REQUIRED)
private Long num;
@Schema(description = "单位", requiredMode = Schema.RequiredMode.REQUIRED)
private String unit;
@Schema(description = "是否复合部件:0 否 1 是", requiredMode = Schema.RequiredMode.REQUIRED)
private Boolean isComposite;
@Schema(description = "品牌", requiredMode = Schema.RequiredMode.REQUIRED)
private String brand;
@Schema(description = "厂家", requiredMode = Schema.RequiredMode.REQUIRED)
private String factory;
@Schema(description = "配件颜色", requiredMode = Schema.RequiredMode.REQUIRED)
private String partsColor;
@Schema(description = "配件宽度", requiredMode = Schema.RequiredMode.REQUIRED)
private Double partsWidth;
@Schema(description = "配件长度", requiredMode = Schema.RequiredMode.REQUIRED)
private Double partsLength;
@Schema(description = "配件厚度", requiredMode = Schema.RequiredMode.REQUIRED)
private Double partsThickness;
@Schema(description = "配件主类:1封边2五金3组件", requiredMode = Schema.RequiredMode.REQUIRED)
private String category;
@Schema(description = "子配件ID列表,复合部件时记录子配件ID,半角逗号分隔", requiredMode = Schema.RequiredMode.REQUIRED)
private String subparts;
}
@@ -0,0 +1,27 @@
package com.cf.imes.module.executor.controller.admin.manage.query.vo.productionStatus;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Schema(description = "管理后台 - 生产单模块表 order_module_{N} Response VO")
@Data
public class OrderModuleVO {
@Schema(description = "柜体 id", requiredMode = Schema.RequiredMode.REQUIRED, example = "嘿嘿")
private Long bodyId;
@Schema(description = "加工组 id", example = "嘿嘿")
private Long groupId;
@Schema(description = "组合名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "嘿嘿")
private String name;
@Schema(description = "加工组名称", example = "嘿嘿")
private String groupName;
}
@@ -0,0 +1,47 @@
package com.cf.imes.module.executor.controller.admin.manage.query.vo.productionStatus;
import com.cf.imes.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.util.List;
@Schema(description = "管理后台 - 生产单表 order_{N} 分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class OrderPlatePageReqVO extends PageParam {
@Schema(description = "生产状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2,3")
private List<Long> statusList;
@Schema(description = "订单号")
private Long orderNo;
@Schema(description = "自定义单号")
private String customOrderNo;
@Schema(description = "客户")
private String customer;
@Schema(description = "地址")
private String address;
@Schema(description = "经销商")
private String dealer;
}
@@ -0,0 +1,33 @@
package com.cf.imes.module.executor.controller.admin.manage.query.vo.productionStatus;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Schema(description = "管理后台 - 板材信息表 Response VO")
@Data
public class OrderPlateRespVO {
@Schema(description = "板编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "9822")
private Long id;
@Schema(description = "板名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
private String name;
@Schema(description = "颜色", requiredMode = Schema.RequiredMode.REQUIRED)
private String color;
@Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED)
private Double width;
@Schema(description = "高度", requiredMode = Schema.RequiredMode.REQUIRED)
private Double height;
@Schema(description = "厚度", requiredMode = Schema.RequiredMode.REQUIRED)
private Double thickness;
@Schema(description = "材质:颗粒板、欧松板、多层板、生态板、禾香板、密度板、实木、铝蜂窝板、铝塑板", requiredMode = Schema.RequiredMode.REQUIRED)
private String material;
}
@@ -0,0 +1,24 @@
package com.cf.imes.module.executor.controller.admin.manage.query.vo.productionStatus;
import com.cf.imes.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@Schema(description = "管理后台 - 板材信息表分页")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class PlatePageVO extends PageParam {
@Schema(description = "柜体 id",requiredMode = Schema.RequiredMode.REQUIRED)
private Long bodyId ;
@Schema(description = "加工组 id")
private Long groupId;
}
@@ -0,0 +1,175 @@
package com.cf.imes.module.executor.controller.admin.manage.test;
import com.cf.imes.module.executor.dal.mysql.manage.test.TestMapper;
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.Dispatch;
import com.jacob.com.Variant;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.jetbrains.annotations.TestOnly;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.annotation.security.PermitAll;
import java.io.File;
import java.util.List;
import java.util.Random;
/**
* @author there
* 测试 controller
*/
@RestController
@RequestMapping("/manage/test")
@Tag(name = "测试")
public class TestController {
@Resource
private TestMapper testMapper;
@GetMapping("/get")
@PermitAll
@Operation(summary = "测试")
public Object get() {
return testMapper.selectList();
}
public class JacobTestController {
/* *
* 语音转文字并播放
*
* @param text
*/
private static void convertTextToSpeech(String text) {
try {
//jacob.dll没成功安装,执行这一步会出错
//构建音频格式 调用注册表应用
Dispatch spAudioFormat = new ActiveXComponent("Sapi.SpAudioFormat").getObject();
//音频文件输出流
Dispatch spFileStream = new ActiveXComponent("Sapi.SpFileStream").getObject();
//构建音频对象
Dispatch spVoice = new ActiveXComponent("Sapi.SpVoice").getObject();
//设置spAudioFormat音频流格式类型22
Dispatch.put(spAudioFormat, "Type", new Variant(22));
//设置spFileStream文件输出流的音频格式
Dispatch.putRef(spFileStream, "Format", spAudioFormat);
//设置spFileStream文件输出流参数地址等
Dispatch.call(spFileStream, "Open", new Variant("E:AAAAA\48641486.wav"), new Variant(3), new Variant(true));
//设置spVoice声音对象的音频输出流为输出文件对象
Dispatch.putRef(spVoice, "AudioOutputStream", spFileStream);
//设置spVoice声音对象的音量大小100
Dispatch.put(spVoice, "Volume", new Variant(100));
//设置spVoice声音对象的速度 0为正常速度,范围【..-2 -1 0 1 2..】
Dispatch.put(spVoice, "Rate", new Variant(0));
//设置spVoice声音对象中的文本内容
Dispatch.call(spVoice, "Speak", new Variant(text));
//关闭spFileStream输出文件
Dispatch.call(spFileStream, "Close");
//释放资源
spVoice.safeRelease();
spAudioFormat.safeRelease();
spFileStream.safeRelease();
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
/* private static XxlJobProperties aabb(){
XxlJobParameter xxlJobParameter = new XxlJobParameter();
xxlJobParameter.setEnabled(false);
xxlJobParameter.setAccessToken("1122");
xxlJobParameter.setAddresses("五阿里乌");
xxlJobParameter.setAppName("aaappn");
XxlJobProperties bean = BeanUtils.toBean(xxlJobParameter, XxlJobProperties.class);
return bean;
}*/
}
public static void deleteFiles(List<String> filePaths) {
// 检查文件路径集合是否为空
if (filePaths == null || filePaths.isEmpty()) {
System.out.println("文件路径集合为空");
return;
}
for (String filePath : filePaths) {
// 检查文件路径是否为空
if (filePath == null || filePath.isEmpty()) {
System.out.println("文件路径为空");
continue;
}
File file = new File(filePath);
// 检查文件是否存在
if (!file.exists()) {
System.out.println("文件不存在:" + filePath);
continue;
}
// 检查是否是文件
if (!file.isFile()) {
System.out.println("路径指向的不是文件:" + filePath);
continue;
}
// 尝试删除文件
if (file.delete()) {
System.out.println("文件删除成功:" + filePath);
} else {
System.out.println("文件删除失败:" + filePath);
}
}
}
public static Integer aacc() {
RedisTemplate<Object, Object> re = new RedisTemplate<>();
int randomInt = new Random(System.currentTimeMillis()).nextInt(900) + 100;// 生成100到999之间的随机数
return randomInt;
}
@TestOnly
public static void main(String[] args) {
// test main
}
}
@@ -0,0 +1,66 @@
package com.cf.imes.module.executor.controller.admin.manage.voice;
import com.cf.imes.framework.common.pojo.CommonResult;
import com.cf.imes.module.executor.controller.admin.manage.voice.vo.VoiceReqVO;
import com.cf.imes.module.executor.service.manage.voice.VoiceService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.validation.Valid;
@Tag(name = "管理后台 - 语音播报")
@RestController
@RequestMapping("/manage/voice")
@Validated
public class VoiceController {
@Resource
private VoiceService voiceService;
@PostMapping()
@Operation(summary = "语音播报")
@PreAuthorize("@ss.hasPermission('manage:voice:insert')")
public CommonResult<ResponseEntity<byte[]>> voiceAnnouncements(@Valid @RequestBody VoiceReqVO reqVO ) throws Exception {
String sourceFile = voiceService.voiceAnnouncements(reqVO.getData());
ResponseEntity<byte[]> voice = voiceService.getVoice(sourceFile);
// 删除生成的 mp3 文件
voiceService.deleteFiles(sourceFile);
return CommonResult.success(voice);
// String gzipFile = sourceFile+".zip";
//
// // 压缩语音文件
// voiceService.zipFiles(sourceFile, gzipFile);
//
}
}
@@ -0,0 +1,17 @@
package com.cf.imes.module.executor.controller.admin.manage.voice.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.ToString;
@Schema(description = "管理后台 - 语音播报 Request VO")
@Data
@ToString(callSuper = true)
public class VoiceReqVO {
@Schema(description = "语音数据", requiredMode = Schema.RequiredMode.REQUIRED)
private String data;
}
@@ -0,0 +1,14 @@
package com.cf.imes.module.executor.dal.dataobject.manage.test;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
/**
* @author there
*/
@Data
@TableName("test")
public class TestDO {
private Integer id;
private String name;
}
@@ -58,6 +58,12 @@ public class RemainPlateDO extends BaseDO {
* 背面颜色 * 背面颜色
*/ */
private String colorBlack; private String colorBlack;
/**
* 纹理
*/
private Boolean texture;
/** /**
* 宽度 * 宽度
*/ */
@@ -0,0 +1,12 @@
package com.cf.imes.module.executor.dal.mysql.manage.test;
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
import com.cf.imes.module.executor.dal.dataobject.manage.test.TestDO;
import org.apache.ibatis.annotations.Mapper;
/**
* @author there
*/
@Mapper
public interface TestMapper extends BaseMapperX<TestDO> {
}
@@ -11,6 +11,10 @@ import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX; import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.cf.imes.framework.mybatis.core.query.QueryWrapperX; import com.cf.imes.framework.mybatis.core.query.QueryWrapperX;
import com.cf.imes.framework.organ.core.aop.OrganIgnore; import com.cf.imes.framework.organ.core.aop.OrganIgnore;
import com.cf.imes.module.executor.controller.admin.manage.pack.vo.PackPageReqVO;
import com.cf.imes.module.executor.controller.admin.manage.pack.vo.PackRespVO;
import com.cf.imes.module.executor.controller.admin.manage.pack.vo.PrintOrderPackRespVO;
import com.cf.imes.module.executor.controller.admin.manage.query.vo.productionStatus.OrderPlatePageReqVO;
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderCountProducePeriodRespVO; import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderCountProducePeriodRespVO;
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderOverdueRespVO; import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderOverdueRespVO;
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderPageReqVO; import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderPageReqVO;
@@ -274,4 +278,37 @@ public interface OrderMapper extends BaseMapperX<OrderDO> {
List<Long> selectNoPlanOrderPlateCount(@Param(Constants.WRAPPER) Wrapper<OrderDO> wrapper); List<Long> selectNoPlanOrderPlateCount(@Param(Constants.WRAPPER) Wrapper<OrderDO> wrapper);
List<PlateResList> selectNoPlanOrderPlateList(@Param(Constants.WRAPPER) Wrapper<OrderDO> wrapper,@Param("pageNo") Integer pageNo,@Param("pageSize") Integer pageSize); List<PlateResList> selectNoPlanOrderPlateList(@Param(Constants.WRAPPER) Wrapper<OrderDO> wrapper,@Param("pageNo") Integer pageNo,@Param("pageSize") Integer pageSize);
default PageResult<OrderDO> selectProductionPage(OrderPlatePageReqVO pageReqVO) {
return selectPage(pageReqVO, new LambdaQueryWrapperX<OrderDO>()
.eqIfPresent(OrderDO::getId, pageReqVO.getOrderNo())
.eqIfPresent(OrderDO::getCustomOrderNo, pageReqVO.getCustomOrderNo())
.likeIfPresent(OrderDO::getCustomer, pageReqVO.getCustomer())
.likeIfPresent(OrderDO::getAddress, pageReqVO.getAddress())
.and(wrapper -> {
for (Long status : pageReqVO.getStatusList()) {
wrapper.or().eq(OrderDO::getStatus, status);
}
})
.orderByDesc(OrderDO::getCreateTime));
}
List<PackRespVO> selectOrderIds(@Param("createTime") String createTime, @Param("organId") Long organId, @Param("orderId") Long orderId);
List<PackRespVO> selectOrderIdsFalse(@Param("createTime") String createTime,@Param("organId") Long organId, @Param("orderId") Long orderId);
PrintOrderPackRespVO selectOrderPack(@Param("orderNo")Long orderNo, @Param("packageNo") Long packageNo, @Param("organId") Long organId);
IPage<PackRespVO> selectOrderIdList(@Param("page") IPage page, @Param("pageReqVO") PackPageReqVO pageReqVO, @Param("organId") Long organId);
} }
@@ -3,6 +3,13 @@ package com.cf.imes.module.executor.dal.mysql.orderItem;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX; import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX; import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.cf.imes.module.executor.controller.admin.manage.pack.vo.PlateAndPartIdList;
import com.cf.imes.module.executor.controller.admin.manage.pack.vo.PlateDetailsRespVO;
import com.cf.imes.module.executor.controller.admin.manage.process.vo.PlateDetails;
import com.cf.imes.module.executor.controller.admin.manage.process.vo.ProcessPlateReqVO;
import com.cf.imes.module.executor.controller.admin.manage.query.vo.productionStatus.OrderModuleVO;
import com.cf.imes.module.executor.controller.admin.manage.query.vo.productionStatus.OrderPlateRespVO;
import com.cf.imes.module.executor.controller.admin.manage.query.vo.productionStatus.PlatePageVO;
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderGoodsDetailRespVO; import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderGoodsDetailRespVO;
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderGoodsRespVO; import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderGoodsRespVO;
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderPlatesDetailRespVO; import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderPlatesDetailRespVO;
@@ -133,4 +140,64 @@ public interface OrderItemMapper extends BaseMapperX<OrderItemDO> {
@Param("organId") Long organId, @Param("deleted") Integer deleted); @Param("organId") Long organId, @Param("deleted") Integer deleted);
List<Long> selectOrderPlanList(@Param("orderId") Long orderId,@Param("roomIds") Set<Long> roomIds, @Param("bodyId") Long bodyId,@Param("organId") Long organId); List<Long> selectOrderPlanList(@Param("orderId") Long orderId,@Param("roomIds") Set<Long> roomIds, @Param("bodyId") Long bodyId,@Param("organId") Long organId);
List<PlateDetailsRespVO> selectPrintPlateList(@Param("orderNo")Long orderNo, @Param("packageNo") Long packageNo, @Param("organId") Long organId);
void deleteOrderPack(@Param("packId") Long packId,@Param("orderId") Long orderId,@Param("organId") Long organId);
void deleteOtherParts(@Param("partsId") Long partsId,@Param("orderId") Long orderId,@Param("organId") Long organId);
void insertPackId(@Param("plateIdList") List<Long> plateIdList, @Param("packId") Long packId,@Param("orderId") Long orderId,@Param("organId") Long organId);
void deletePackId(@Param("deletePlateIdList") List<Long> deletePlateIdList,@Param("packId") Long packId,@Param("orderId") Long orderId,@Param("organId") Long organId);
void insertPartsId(@Param("packId") Long packId, @Param("addPartsIdList") List<Long> addPartsIdList,@Param("orderId") Long orderId,@Param("organId") Long organId);
void insertParts(@Param("addPartsList") List<Long> addPartsList, @Param("packId")Long packId, @Param("orderId") Long orderId,@Param("organId") Long organId);
void deletePartsList(@Param("deletePartsList")List<Long> deletePartsList,@Param("packId") Long packId,@Param("orderId") Long orderId,@Param("organId") Long organId);
default List<OrderItemDO> selectPackList(Long packId, Long orderId , Long organId) {
return selectList(new LambdaQueryWrapperX<OrderItemDO>()
.eq(OrderItemDO::getOrganId, organId)
.eqIfPresent(OrderItemDO::getOrderId,orderId)
.eqIfPresent(OrderItemDO::getPackageId, packId));
}
void deleteParts(@Param("packageId") Long packageId,@Param("orderId") Long orderId ,@Param("partsIds") List<Long> partsIds,@Param("organId") Long organId);
void updateParts(@Param("partsId") Long partsId,@Param("packageId") Long packageId,@Param("orderId") Long orderId,@Param("organId") Long organId);
default List<OrderItemDO> selectPackPlateList(Long orderId, Long organId) {
return selectList(new LambdaQueryWrapperX<OrderItemDO>()
.eq(OrderItemDO::getOrganId, organId)
.eqIfPresent(OrderItemDO::getOrderId, orderId));
}
default List<OrderItemDO> selectPackByPlateId(List<Long> plateId, Long orderId , Long organId) {
return selectList(new LambdaQueryWrapperX<OrderItemDO>()
.eq(OrderItemDO::getOrganId, organId)
.eqIfPresent(OrderItemDO::getOrderId,orderId)
.inIfPresent(OrderItemDO::getPlateId, plateId)
.select(OrderItemDO::getPackageId));
}
List<PlateAndPartIdList> selectOrderPackPartsIds(@Param("orderId") Long orderId, @Param("organId") Long organId);
List<PlateAndPartIdList> selectOrderPackPlateIds(@Param("orderId") Long orderId,@Param("organId") Long organId);
} }
@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX; import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX; import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.cf.imes.module.executor.controller.admin.manage.pack.vo.OrderPartsRespVO;
import com.cf.imes.module.executor.controller.admin.manage.query.vo.pack.PackageDetailsRespVO;
import com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsPageReqVO; import com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsPageReqVO;
import com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsPrintRespVO; import com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsPrintRespVO;
import com.cf.imes.module.executor.controller.admin.orderParts.vo.PartGoodsRespVO; import com.cf.imes.module.executor.controller.admin.orderParts.vo.PartGoodsRespVO;
@@ -111,4 +113,16 @@ public interface OrderPartsMapper extends BaseMapperX<OrderPartsDO> {
@Param("deleted")Integer deleted, @Param("deleted")Integer deleted,
@Param("roomId")Long roomId, @Param("roomId")Long roomId,
@Param("bodyId")Long bodyId); @Param("bodyId")Long bodyId);
IPage<PackageDetailsRespVO> selectParts(@Param("page") IPage page, @Param("packageId") Long packageId, @Param("organId") Long organId);
List<OrderPartsRespVO> selectPartsList(@Param("orderId") Long orderId , @Param("organId") Long organId);
void deleteOrderParts(@Param("partsIds") List<Long> partsIds,@Param("orderId") Long orderId,@Param("organId") Long organId);
void updateParts(@Param("partsId") Long partsId,@Param("orderId") Long orderId,@Param("organId") Long organId);
} }
@@ -1,9 +1,15 @@
package com.cf.imes.module.executor.dal.mysql.orderParts; package com.cf.imes.module.executor.dal.mysql.orderParts;
import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX; import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.cf.imes.module.executor.controller.admin.manage.parts.vo.PartsCadPageReqVO;
import com.cf.imes.module.executor.controller.admin.manage.parts.vo.PartsPageReqVO;
import com.cf.imes.module.executor.dal.dataobject.orderParts.PartsDO; import com.cf.imes.module.executor.dal.dataobject.orderParts.PartsDO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/** /**
* 配件表 parts_{N} Mapper * 配件表 parts_{N} Mapper
* *
@@ -16,4 +22,161 @@ public interface PartsMapper extends BaseMapperX<PartsDO> {
return selectOne(PartsDO::getGoodsId, goodId, PartsDO::getOrganId, organId); return selectOne(PartsDO::getGoodsId, goodId, PartsDO::getOrganId, organId);
} }
default PageResult<PartsDO> selectPage(PartsPageReqVO reqVO) {
LambdaQueryWrapperX<PartsDO> queryWrapper = new LambdaQueryWrapperX<PartsDO>()
.eqIfPresent(PartsDO::getOrganId, reqVO.getOrganId())
.eqIfPresent(PartsDO::getCategory, reqVO.getCategory())
.likeIfPresent(PartsDO::getGoodsId, reqVO.getGoodsId())
.likeIfPresent(PartsDO::getColor, reqVO.getColor())
.likeIfPresent(PartsDO::getType, reqVO.getType())
.likeIfPresent(PartsDO::getName, reqVO.getName())
.likeIfPresent(PartsDO::getMaterial, reqVO.getMaterial())
.likeIfPresent(PartsDO::getModel, reqVO.getModel())
.likeIfPresent(PartsDO::getSpec, reqVO.getSpec())
.likeIfPresent(PartsDO::getBrand, reqVO.getBrand())
.likeIfPresent(PartsDO::getFactory, reqVO.getFactory())
.likeIfPresent(PartsDO::getUnit, reqVO.getUnit())
.eqIfPresent(PartsDO::getIsComposite, reqVO.getIsComposite())
.betweenIfPresent(PartsDO::getWidth, reqVO.getWidth())
.betweenIfPresent(PartsDO::getLength, reqVO.getLength())
.betweenIfPresent(PartsDO::getThickness, reqVO.getThickness())
.likeIfPresent(PartsDO::getRemark, reqVO.getRemark())
.betweenIfPresent(PartsDO::getCreateTime, reqVO.getCreateTime());
if (reqVO.getOrder() == null) {
queryWrapper.orderByDesc(PartsDO::getId);
}else {
if (reqVO.getOrder().equals("ascend")) {
switch (reqVO.getField()) {
case "goodsId" -> queryWrapper.orderByAsc(PartsDO::getGoodsId);
case "isComposite" -> queryWrapper.orderByAsc(PartsDO::getIsComposite);
case "category" -> queryWrapper.orderByAsc(PartsDO::getCategory);
case "type" -> queryWrapper.orderByAsc(PartsDO::getType);
case "name" -> queryWrapper.orderByAsc(PartsDO::getName);
case "model" -> queryWrapper.orderByAsc(PartsDO::getModel);
case "material" -> queryWrapper.orderByAsc(PartsDO::getMaterial);
case "color" -> queryWrapper.orderByAsc(PartsDO::getColor);
case "unit" -> queryWrapper.orderByAsc(PartsDO::getUnit);
case "spec" -> queryWrapper.orderByAsc(PartsDO::getSpec);
case "brand" -> queryWrapper.orderByAsc(PartsDO::getBrand);
case "factory" -> queryWrapper.orderByAsc(PartsDO::getFactory);
case "width" -> queryWrapper.orderByAsc(PartsDO::getWidth);
case "length" -> queryWrapper.orderByAsc(PartsDO::getLength);
case "thickness" -> queryWrapper.orderByAsc(PartsDO::getThickness);
default -> {
// default不排序
}
}
}else if (reqVO.getOrder().equals("descend")) {
switch (reqVO.getField()) {
case "goodsId" -> queryWrapper.orderByDesc(PartsDO::getGoodsId);
case "isComposite" -> queryWrapper.orderByDesc(PartsDO::getIsComposite);
case "category" -> queryWrapper.orderByDesc(PartsDO::getCategory);
case "type" -> queryWrapper.orderByDesc(PartsDO::getType);
case "name" -> queryWrapper.orderByDesc(PartsDO::getName);
case "model" -> queryWrapper.orderByDesc(PartsDO::getModel);
case "material" -> queryWrapper.orderByDesc(PartsDO::getMaterial);
case "color" -> queryWrapper.orderByDesc(PartsDO::getColor);
case "unit" -> queryWrapper.orderByDesc(PartsDO::getUnit);
case "spec" -> queryWrapper.orderByDesc(PartsDO::getSpec);
case "brand" -> queryWrapper.orderByDesc(PartsDO::getBrand);
case "factory" -> queryWrapper.orderByDesc(PartsDO::getFactory);
case "width" -> queryWrapper.orderByDesc(PartsDO::getWidth);
case "length" -> queryWrapper.orderByDesc(PartsDO::getLength);
case "thickness" -> queryWrapper.orderByDesc(PartsDO::getThickness);
default -> {
// default不排序
}
}
}
}
return selectPage(reqVO, queryWrapper);
}
default PartsDO selectById(Long id , Long organId) {
return selectOne(PartsDO::getId, id, PartsDO::getOrganId, organId);
}
default PartsDO selectExceptGoodID(Long id, String goodId , Long organId) {
return selectOne(new LambdaQueryWrapperX<PartsDO>()
.ne(PartsDO::getId, id)
.eq(PartsDO::getGoodsId, goodId)
.eq(PartsDO::getOrganId, organId));
}
default PageResult<PartsDO> selectCadPage(PartsCadPageReqVO reqVO) {
LambdaQueryWrapperX<PartsDO> queryWrapper = new LambdaQueryWrapperX<PartsDO>()
.eqIfPresent(PartsDO::getOrganId, reqVO.getOrganId())
.eqIfPresent(PartsDO::getCategory, reqVO.getCategory())
.likeIfPresent(PartsDO::getColor, reqVO.getColor())
.likeIfPresent(PartsDO::getType, reqVO.getType())
.likeIfPresent(PartsDO::getName, reqVO.getName())
.likeIfPresent(PartsDO::getMaterial, reqVO.getMaterial())
.likeIfPresent(PartsDO::getModel, reqVO.getModel())
.likeIfPresent(PartsDO::getSpec, reqVO.getSpec())
.likeIfPresent(PartsDO::getBrand, reqVO.getBrand())
.likeIfPresent(PartsDO::getFactory, reqVO.getFactory())
.likeIfPresent(PartsDO::getUnit, reqVO.getUnit())
.eqIfPresent(PartsDO::getIsComposite, reqVO.getIsComposite())
.eqIfPresent(PartsDO::getWidth, reqVO.getWidth())
.eqIfPresent(PartsDO::getLength, reqVO.getLength())
.eqIfPresent(PartsDO::getThickness, reqVO.getThickness())
.likeIfPresent(PartsDO::getRemark, reqVO.getRemark());
if (reqVO.getOrder() == null) {
queryWrapper.orderByDesc(PartsDO::getId);
}else {
if (reqVO.getOrder().equals("ascend")) {
switch (reqVO.getField()) {
case "isComposite" -> queryWrapper.orderByAsc(PartsDO::getIsComposite);
case "category" -> queryWrapper.orderByAsc(PartsDO::getCategory);
case "type" -> queryWrapper.orderByAsc(PartsDO::getType);
case "name" -> queryWrapper.orderByAsc(PartsDO::getName);
case "model" -> queryWrapper.orderByAsc(PartsDO::getModel);
case "material" -> queryWrapper.orderByAsc(PartsDO::getMaterial);
case "color" -> queryWrapper.orderByAsc(PartsDO::getColor);
case "unit" -> queryWrapper.orderByAsc(PartsDO::getUnit);
case "spec" -> queryWrapper.orderByAsc(PartsDO::getSpec);
case "brand" -> queryWrapper.orderByAsc(PartsDO::getBrand);
case "factory" -> queryWrapper.orderByAsc(PartsDO::getFactory);
case "width" -> queryWrapper.orderByAsc(PartsDO::getWidth);
case "length" -> queryWrapper.orderByAsc(PartsDO::getLength);
case "thickness" -> queryWrapper.orderByAsc(PartsDO::getThickness);
default -> {
// default不排序
}
}
}else if (reqVO.getOrder().equals("descend")) {
switch (reqVO.getField()) {
case "isComposite" -> queryWrapper.orderByDesc(PartsDO::getIsComposite);
case "category" -> queryWrapper.orderByDesc(PartsDO::getCategory);
case "type" -> queryWrapper.orderByDesc(PartsDO::getType);
case "name" -> queryWrapper.orderByDesc(PartsDO::getName);
case "model" -> queryWrapper.orderByDesc(PartsDO::getModel);
case "material" -> queryWrapper.orderByDesc(PartsDO::getMaterial);
case "color" -> queryWrapper.orderByDesc(PartsDO::getColor);
case "unit" -> queryWrapper.orderByDesc(PartsDO::getUnit);
case "spec" -> queryWrapper.orderByDesc(PartsDO::getSpec);
case "brand" -> queryWrapper.orderByDesc(PartsDO::getBrand);
case "factory" -> queryWrapper.orderByDesc(PartsDO::getFactory);
case "width" -> queryWrapper.orderByDesc(PartsDO::getWidth);
case "length" -> queryWrapper.orderByDesc(PartsDO::getLength);
case "thickness" -> queryWrapper.orderByDesc(PartsDO::getThickness);
default -> {
// default不排序
}
}
}
}
return selectPage(reqVO, queryWrapper);
}
default List<PartsDO> getAllByOrganId(Long organId, String category) {
return selectList(new LambdaQueryWrapperX<PartsDO>()
.eq(PartsDO::getOrganId, organId)
.eq(PartsDO::getCategory, category)
.eq(PartsDO::getDeleted, 0));
}
} }
@@ -1,7 +1,16 @@
package com.cf.imes.module.executor.dal.mysql.pack; package com.cf.imes.module.executor.dal.mysql.pack;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.cf.imes.framework.common.enums.OrderPackageStatusEnum;
import com.cf.imes.framework.common.enums.OrderPackageTypeEnum;
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX; import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.cf.imes.module.executor.controller.admin.manage.pack.vo.PackRespVO;
import com.cf.imes.module.executor.controller.admin.manage.query.vo.pack.OrderPackageVO;
import com.cf.imes.module.executor.dal.dataobject.pack.OrderPackageDO; import com.cf.imes.module.executor.dal.dataobject.pack.OrderPackageDO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@@ -14,4 +23,73 @@ public interface OrderPackageMapper extends BaseMapperX<OrderPackageDO> {
void updatePackList(@Param("orderId") Long orderId, @Param("packIds") List<Long> packIds, @Param("organId") Long organId); void updatePackList(@Param("orderId") Long orderId, @Param("packIds") List<Long> packIds, @Param("organId") Long organId);
IPage<OrderPackageVO> selectByOrderNo(@Param("page") IPage page, @Param(Constants.WRAPPER) Wrapper<OrderPackageDO> wrapper);
default OrderPackageDO selectByPackNo(String packNo, Long organId) {
return selectOne(new LambdaQueryWrapperX<OrderPackageDO>()
.eq(OrderPackageDO::getOrganId, organId)
.eqIfPresent(OrderPackageDO::getPackageNo, packNo));
}
List<PackRespVO> selectPackPage(@Param("orderIds") List<Long> orderIds, @Param("organId") Long organId);
default OrderPackageDO selectByPackId(Long packId, Long orderId, Long organId) {
return selectOne(new LambdaQueryWrapperX<OrderPackageDO>()
.eq(OrderPackageDO::getOrganId, organId)
.eq(OrderPackageDO::getDeleted,false)
.eqIfPresent(OrderPackageDO::getOrderId,orderId)
.eqIfPresent(OrderPackageDO::getId, packId));
}
void updateParts(@Param("packageId") Long packageId,@Param("orderId") Long orderId,@Param("organId") Long organId);
default List<OrderPackageDO> selectPackStatus(Long orderId, Long organId) {
return selectList(new LambdaQueryWrapperX<OrderPackageDO>()
.eq(OrderPackageDO::getOrganId,organId)
.eq(OrderPackageDO::getDeleted,false)
.eqIfPresent(OrderPackageDO::getOrderId, orderId));
}
default List<OrderPackageDO> selectPackList(Long orderId, Long organId) {
return selectList(new LambdaQueryWrapperX<OrderPackageDO>()
.eq(OrderPackageDO::getOrganId,organId)
.eq(OrderPackageDO::getDeleted,false)
.eqIfPresent(OrderPackageDO::getOrderId, orderId)
.eqIfPresent(OrderPackageDO::getStatus, OrderPackageStatusEnum.UNPACKED.getStatus()));
}
List<PackRespVO> selectPackPieceCount(@Param("orderIds") List<Long> orderIds, @Param("organId") Long organId);
// 删除当前生产单下所有的包裹
default void updateDelete(Long orderId,Long organId) {
LambdaUpdateWrapper<OrderPackageDO> wrapper = new LambdaUpdateWrapper<OrderPackageDO>()
.set(OrderPackageDO::getDeleted, true)
.eq(OrderPackageDO::getOrganId,organId)
.eq(OrderPackageDO::getOrderId, orderId)
.eq(OrderPackageDO::getType, OrderPackageTypeEnum.PLATE.getType());
update(wrapper);
}
List<OrderPackageVO> selectPackListByOrderId(@Param("orderId") Long orderId,@Param("organId") Long organId);
default List<OrderPackageDO> selectPackStatusList(Long orderId, Long organId) {
return selectList(new LambdaQueryWrapperX<OrderPackageDO>()
.eq(OrderPackageDO::getOrganId,organId)
.eq(OrderPackageDO::getDeleted,false)
.eqIfPresent(OrderPackageDO::getOrderId, orderId)
.eq(OrderPackageDO::getStatus,OrderPackageStatusEnum.PACKAGED.getStatus()));
}
} }
@@ -14,4 +14,10 @@ public interface OrderPrepackagedMapper extends BaseMapperX<OrderPrepackagedDO>
.eqIfPresent(OrderPrepackagedDO::getOrderId, orderId)); .eqIfPresent(OrderPrepackagedDO::getOrderId, orderId));
} }
default OrderPrepackagedDO selectOrder(Long orderId, Long organId) {
return selectOne(new LambdaQueryWrapperX<OrderPrepackagedDO>()
.eq(OrderPrepackagedDO::getOrganId, organId)
.eqIfPresent(OrderPrepackagedDO::getOrderId, orderId));
}
} }
@@ -4,9 +4,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX; import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX; import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.cf.imes.module.executor.controller.admin.manage.plate.vo.plate.PlatePageReqVO;
import com.cf.imes.module.executor.controller.admin.plate.vo.GoodsPlateFilterPageReqVO; import com.cf.imes.module.executor.controller.admin.plate.vo.GoodsPlateFilterPageReqVO;
import com.cf.imes.module.executor.dal.dataobject.plate.PlateGoodDO; import com.cf.imes.module.executor.dal.dataobject.plate.PlateGoodDO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List; import java.util.List;
@@ -99,4 +101,82 @@ public interface PlateGoodMapper extends BaseMapperX<PlateGoodDO> {
.in(PlateGoodDO::getGoodsId, goodsId)); .in(PlateGoodDO::getGoodsId, goodsId));
} }
default PlateGoodDO selectByGoodID(String goodId , Long organId) {
return selectOne(PlateGoodDO::getGoodsId, goodId, PlateGoodDO::getOrganId, organId);
}
default PageResult<PlateGoodDO> selectPage(PlatePageReqVO reqVO) {
LambdaQueryWrapperX<PlateGoodDO> queryWrapper = new LambdaQueryWrapperX<PlateGoodDO>()
.eqIfPresent(PlateGoodDO::getOrganId, reqVO.getOrganId())
.likeIfPresent(PlateGoodDO::getGoodsId, reqVO.getGoodsId())
.likeIfPresent(PlateGoodDO::getGoodsName, reqVO.getGoodsName())
.likeIfPresent(PlateGoodDO::getMaterial, reqVO.getMaterial())
.likeIfPresent(PlateGoodDO::getColor, reqVO.getColor())
.eqIfPresent(PlateGoodDO::getWidth, reqVO.getWidth())
.eqIfPresent(PlateGoodDO::getHeight, reqVO.getHeight())
.eqIfPresent(PlateGoodDO::getThickness, reqVO.getThickness())
.likeIfPresent(PlateGoodDO::getBrand, reqVO.getBrand())
.likeIfPresent(PlateGoodDO::getSpec, reqVO.getSpec())
.likeIfPresent(PlateGoodDO::getRemark, reqVO.getRemark())
.eqIfPresent(PlateGoodDO::getTexture, reqVO.getTexture())
.betweenIfPresent(PlateGoodDO::getCreateTime, reqVO.getCreateTime());
if (reqVO.getOrder() == null) {
queryWrapper.orderByDesc(PlateGoodDO::getId);
}else {
if (reqVO.getOrder().equals("ascend")) {
switch (reqVO.getField()) {
case "goodsId" -> queryWrapper.orderByAsc(PlateGoodDO::getGoodsId);
case "goodsName" -> queryWrapper.orderByAsc(PlateGoodDO::getGoodsName);
case "material" -> queryWrapper.orderByAsc(PlateGoodDO::getMaterial);
case "color" -> queryWrapper.orderByAsc(PlateGoodDO::getColor);
case "texture" -> queryWrapper.orderByAsc(PlateGoodDO::getTexture);
case "width" -> queryWrapper.orderByAsc(PlateGoodDO::getWidth);
case "height" -> queryWrapper.orderByAsc(PlateGoodDO::getHeight);
case "thickness" -> queryWrapper.orderByAsc(PlateGoodDO::getThickness);
case "brand" -> queryWrapper.orderByAsc(PlateGoodDO::getBrand);
default -> {
// default不排序
}
}
}else if (reqVO.getOrder().equals("descend")) {
switch (reqVO.getField()) {
case "goodsId" -> queryWrapper.orderByDesc(PlateGoodDO::getGoodsId);
case "goodsName" -> queryWrapper.orderByDesc(PlateGoodDO::getGoodsName);
case "material" -> queryWrapper.orderByDesc(PlateGoodDO::getMaterial);
case "color" -> queryWrapper.orderByDesc(PlateGoodDO::getColor);
case "texture" -> queryWrapper.orderByDesc(PlateGoodDO::getTexture);
case "width" -> queryWrapper.orderByDesc(PlateGoodDO::getWidth);
case "height" -> queryWrapper.orderByDesc(PlateGoodDO::getHeight);
case "thickness" -> queryWrapper.orderByDesc(PlateGoodDO::getThickness);
case "brand" -> queryWrapper.orderByDesc(PlateGoodDO::getBrand);
default -> {
// default不排序
}
}
}
}
return selectPage(reqVO, queryWrapper);
}
PlateGoodDO selectOneById(@Param("id") Long id, @Param("organId") Long organId);
default Boolean isByGoodID(String goodId , Long organId) {
return selectList(PlateGoodDO::getGoodsId, goodId, PlateGoodDO::getOrganId, organId).size() > 0;
}
default Boolean isByGoodIDAndId(String goodId , Long organId , Long id) {
return selectCount(new LambdaQueryWrapper<PlateGoodDO>()
.ne(PlateGoodDO::getId, id)
.eq(PlateGoodDO::getGoodsId, goodId)
.eq(PlateGoodDO::getOrganId, organId)) > 0;
}
default List<PlateGoodDO> getAllByOrganId(Long organId) {
return selectList(new LambdaQueryWrapper<PlateGoodDO>()
.eq(PlateGoodDO::getOrganId, organId)
.eq(PlateGoodDO::getDeleted, 0));
}
} }
@@ -9,6 +9,10 @@ import com.cf.imes.framework.common.enums.OrderPlateTypeEnum;
import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX; import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX; import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.cf.imes.module.executor.controller.admin.manage.pack.vo.PackRespVO;
import com.cf.imes.module.executor.controller.admin.manage.pack.vo.PlateDetailsRespVO;
import com.cf.imes.module.executor.controller.admin.manage.process.vo.PlateDetails;
import com.cf.imes.module.executor.controller.admin.manage.query.vo.pack.PackageDetailsRespVO;
import com.cf.imes.module.executor.controller.admin.plan.saveOptimize.PrintOrderPackReqVO; import com.cf.imes.module.executor.controller.admin.plan.saveOptimize.PrintOrderPackReqVO;
import com.cf.imes.module.executor.controller.admin.plan.vo.NotPlanOrderPlateRespVO; import com.cf.imes.module.executor.controller.admin.plan.vo.NotPlanOrderPlateRespVO;
import com.cf.imes.module.executor.controller.admin.plan.vo.PlateDetailRespVO; import com.cf.imes.module.executor.controller.admin.plan.vo.PlateDetailRespVO;
@@ -295,4 +299,21 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
@Param("bodyId")Long bodyId, @Param("bodyId")Long bodyId,
@Param("plateId")Long goodsId); // 汇总 @Param("plateId")Long goodsId); // 汇总
List<PlateDetails> selectListByOrderId(@Param("orderId") Long orderId, @Param("organId") Long organId);
default List<PlateDO> selectplateByPlateNoList(String plateNo, Long orderId, Long organId) {
return selectList(new LambdaQueryWrapperX<PlateDO>()
.eq(PlateDO::getOrganId, organId)
.eq(PlateDO::getDeleted,false)
.eq(PlateDO::getOrderId, orderId)
.likeIfPresent(PlateDO::getPlateNo, plateNo)
.select(PlateDO::getId));
}
List<PackRespVO> selectPackPlateNum(@Param("orderIds") List<Long> orderIds, @Param("organId") Long organId);
List<PlateDetailsRespVO> selectOrderNoPackPlateList(@Param("orderId") Long orderId, @Param("organId") Long organId);
List<PlateDetailsRespVO> selectOrderPlateList(@Param("orderIds") List<Long> orderIds, @Param("organId") Long organId);
} }
@@ -1,6 +1,7 @@
package com.cf.imes.module.executor.dal.mysql.remainplaten; package com.cf.imes.module.executor.dal.mysql.remainplaten;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX; import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX; import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
@@ -11,6 +12,7 @@ import org.apache.ibatis.annotations.Param;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Set;
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId; import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
@@ -72,5 +74,134 @@ public interface RemainPlateMapper extends BaseMapperX<RemainPlateDO> {
} }
// List<RemainPlateDO> selectTestSQL(@Param("sql") String sql); default PageResult<RemainPlateDO> selectPage(com.cf.imes.module.executor.controller.admin.manage.plate.vo.remain.RemainPlatePageReqVO reqVO) {
LambdaQueryWrapperX<RemainPlateDO> wrapper = new LambdaQueryWrapperX<RemainPlateDO>()
.likeIfPresent(RemainPlateDO::getId,reqVO.getId() != null ? reqVO.getId() : null)
.likeIfPresent(RemainPlateDO::getPlanId, reqVO.getPlanId() != null ? reqVO.getPlanId() : null)
.likeIfPresent(RemainPlateDO::getInitPlanId, reqVO.getInitPlanId() != null ? reqVO.getInitPlanId() : null)
.eqIfPresent(RemainPlateDO::getStatus, reqVO.getStatus())
.eqIfPresent(RemainPlateDO::getGoodsId, reqVO.getGoodsId())
.eqIfPresent(RemainPlateDO::getIsCutting, reqVO.getIsCutting())
.likeIfPresent(RemainPlateDO::getName, reqVO.getName())
.likeIfPresent(RemainPlateDO::getMaterial, reqVO.getMaterial())
.likeIfPresent(RemainPlateDO::getColor, reqVO.getColor())
.eqIfPresent(RemainPlateDO::getThickness, reqVO.getThickness())
.eqIfPresent(RemainPlateDO::getBrand, reqVO.getBrand())
.eqIfPresent(RemainPlateDO::getPlaceStyle, reqVO.getPlaceStyle())
.likeIfPresent(RemainPlateDO::getStore, reqVO.getStore())
.eqIfPresent(RemainPlateDO::getCount, reqVO.getCount())
.eqIfPresent(RemainPlateDO::getTexture, reqVO.getTexture())
.likeIfPresent(RemainPlateDO::getRemark, reqVO.getRemark())
.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());
if (reqVO.getOrder() == null) {
wrapper.orderByDesc(RemainPlateDO::getId);
}else {
if (reqVO.getOrder().equals("ascend")) {
switch (reqVO.getField()) {
case "id" -> wrapper.orderByAsc(RemainPlateDO::getId);
case "length" -> wrapper.orderByAsc(RemainPlateDO::getLength);
case "width" -> wrapper.orderByAsc(RemainPlateDO::getWidth);
case "thickness" -> wrapper.orderByAsc(RemainPlateDO::getThickness);
case "material" -> wrapper.orderByAsc(RemainPlateDO::getMaterial);
case "color" -> wrapper.orderByAsc(RemainPlateDO::getColor);
case "texture" -> wrapper.orderByAsc(RemainPlateDO::getTexture);
case "brand" -> wrapper.orderByAsc(RemainPlateDO::getBrand);
case "store" -> wrapper.orderByAsc(RemainPlateDO::getStore);
case "initPlanId" -> wrapper.orderByAsc(RemainPlateDO::getInitPlanId);
case "planId" -> wrapper.orderByAsc(RemainPlateDO::getPlanId);
case "status" -> wrapper.orderByAsc(RemainPlateDO::getStatus);
default -> {
// default不排序
}
}
}else if (reqVO.getOrder().equals("descend")) {
switch (reqVO.getField()) {
case "id" -> wrapper.orderByDesc(RemainPlateDO::getId);
case "length" -> wrapper.orderByDesc(RemainPlateDO::getLength);
case "width" -> wrapper.orderByDesc(RemainPlateDO::getWidth);
case "thickness" -> wrapper.orderByDesc(RemainPlateDO::getThickness);
case "material" -> wrapper.orderByDesc(RemainPlateDO::getMaterial);
case "color" -> wrapper.orderByDesc(RemainPlateDO::getColor);
case "texture" -> wrapper.orderByDesc(RemainPlateDO::getTexture);
case "brand" -> wrapper.orderByDesc(RemainPlateDO::getBrand);
case "store" -> wrapper.orderByDesc(RemainPlateDO::getStore);
case "initPlanId" -> wrapper.orderByDesc(RemainPlateDO::getInitPlanId);
case "planId" -> wrapper.orderByDesc(RemainPlateDO::getPlanId);
case "status" -> wrapper.orderByDesc(RemainPlateDO::getStatus);
default -> {
// default不排序
}
}
}
}
return selectPage(reqVO, wrapper);
}
default PageResult<RemainPlateDO> selectPageToAdd(com.cf.imes.module.executor.controller.admin.manage.plate.vo.remain.RemainPlatePageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<RemainPlateDO>()
.neIfPresent(RemainPlateDO::getInitPlanId, reqVO.getInitPlanId())
.eqIfPresent(RemainPlateDO::getStatus, reqVO.getStatus())
.eqIfPresent(RemainPlateDO::getGoodsId, reqVO.getGoodsId())
.likeIfPresent(RemainPlateDO::getName, reqVO.getName())
.likeIfPresent(RemainPlateDO::getMaterial, reqVO.getMaterial())
.likeIfPresent(RemainPlateDO::getColor, reqVO.getColor())
.eqIfPresent(RemainPlateDO::getThickness, reqVO.getThickness())
.eqIfPresent(RemainPlateDO::getBrand, reqVO.getBrand())
.likeIfPresent(RemainPlateDO::getStore, reqVO.getStore())
.eqIfPresent(RemainPlateDO::getCount, reqVO.getCount())
.eqIfPresent(RemainPlateDO::getTexture, reqVO.getTexture())
.likeIfPresent(RemainPlateDO::getRemark, reqVO.getRemark())
.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<Long> ids, Integer status, Integer useType, Long organId, Long planId) {
update(new UpdateWrapper<RemainPlateDO>()
.set("status", status)
.set("use_type", useType)
.set("plan_id",planId)
.eq("organ_id",organId)
.in("id", ids));
}
// 查询该排单是否已经添加余料
default List<RemainPlateDO> selectRemainPlatesByInitPlanId(Long initPlanId, Integer deleted, Long organId) {
return selectList(new LambdaUpdateWrapper<RemainPlateDO>()
.eq(RemainPlateDO::getInitPlanId, initPlanId)
.eq(RemainPlateDO::getDeleted, deleted)
.eq(RemainPlateDO::getOrganId, organId));
}
// 判断该排单是否存在以使用的余料
default List<RemainPlateDO> selectRemainPlatesByPlanId(Long planId, Integer status, Integer deleted, Long organId) {
return selectList(new LambdaUpdateWrapper<RemainPlateDO>()
.eq(RemainPlateDO::getPlanId, planId)
.eq(RemainPlateDO::getStatus, status)
.eq(RemainPlateDO::getDeleted, deleted)
.eq(RemainPlateDO::getOrganId, organId));
}
// 通过排单id批量余料板
void deleteRemainPlate(@Param("initPlanId") Long initPlanId, @Param("organId") Long organId);
// 根据使用排单id批量还原状态
default void updateRemainPlateStatusByPlanId(Integer status, Integer useType,Long organId,Long planId) {
update(new UpdateWrapper<RemainPlateDO>()
.set("status", status)
.set("use_type", useType)
.set("plan_id","")
.eq("organ_id",organId)
.eq("plan_id", planId));
}
} }
@@ -10,6 +10,7 @@ import com.cf.imes.module.system.api.organ.OrganApi;
import com.cf.imes.module.system.api.permission.PermissionApi; import com.cf.imes.module.system.api.permission.PermissionApi;
import com.cf.imes.module.system.api.process.ProcessApi; import com.cf.imes.module.system.api.process.ProcessApi;
import com.cf.imes.module.system.api.process.ProcessGroupApi; import com.cf.imes.module.system.api.process.ProcessGroupApi;
import com.cf.imes.module.system.api.setting.SettingApi;
import com.cf.imes.module.system.api.systemconfig.SystemConfigApi; import com.cf.imes.module.system.api.systemconfig.SystemConfigApi;
import com.cf.imes.module.system.api.user.AdminUserApi; import com.cf.imes.module.system.api.user.AdminUserApi;
import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.cloud.openfeign.EnableFeignClients;
@@ -19,8 +20,8 @@ import org.springframework.context.annotation.Configuration;
* @author there * @author there
*/ */
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
@EnableFeignClients(clients = {AdminUserApi.class, MachineApi.class, DictDataApi.class, AdminUserApi.class, @EnableFeignClients(clients = {AdminUserApi.class, MachineApi.class, DictDataApi.class,
FileApi.class, ProcessGroupApi.class, FileApi.class, DataSourceApi.class, ApplicationApi.class, FileApi.class, ProcessGroupApi.class, FileApi.class, DataSourceApi.class, ApplicationApi.class,
ProcessApi.class, OrganApi.class, SystemConfigApi.class, CustomPlateNoSeqApi.class, PermissionApi.class}) ProcessApi.class, OrganApi.class, SystemConfigApi.class, CustomPlateNoSeqApi.class, PermissionApi.class, SettingApi.class})
public class RpcConfiguration { public class RpcConfiguration {
} }
@@ -0,0 +1,105 @@
package com.cf.imes.module.executor.service.manage.pack;
import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.module.executor.controller.admin.manage.pack.prePack.PrePackReqVO;
import com.cf.imes.module.executor.controller.admin.manage.pack.vo.DeleteOtherPartsReqVO;
import com.cf.imes.module.executor.controller.admin.manage.pack.vo.OrderPackReqVO;
import com.cf.imes.module.executor.controller.admin.manage.pack.vo.OrderPackRespVO;
import com.cf.imes.module.executor.controller.admin.manage.pack.vo.OrderPartsReqVO;
import com.cf.imes.module.executor.controller.admin.manage.pack.vo.OrderPartsRespVO;
import com.cf.imes.module.executor.controller.admin.manage.pack.vo.OtherPackReqVO;
import com.cf.imes.module.executor.controller.admin.manage.pack.vo.PackPageReqVO;
import com.cf.imes.module.executor.controller.admin.manage.pack.vo.PackReqVO;
import com.cf.imes.module.executor.controller.admin.manage.pack.vo.PackRespVO;
import com.cf.imes.module.executor.controller.admin.manage.pack.vo.PackageDetailsReqVO;
import com.cf.imes.module.executor.controller.admin.manage.pack.vo.PlateDetailsRespVO;
import com.cf.imes.module.executor.controller.admin.manage.pack.vo.PrintOrderPackReqVO;
import com.cf.imes.module.executor.controller.admin.manage.pack.vo.PrintOrderPackRespVO;
import com.cf.imes.module.executor.controller.admin.manage.query.vo.pack.OrderPackageVO;
import java.util.List;
public interface PackService {
// 打包分页查询
PageResult<PackRespVO> getPackPage(PackPageReqVO pageReqVO);
// 查看生产订单对应的包裹信息
List<OrderPackageVO> getOrderPack(PackageDetailsReqVO reqVO);
PageResult<OrderPackageVO> getPageOrderPack(PackageDetailsReqVO reqVO);
// 查看生产订单对应的板材信息
List<PlateDetailsRespVO> getOrderPlateList(Long orderId);
// 查询多个生产单对应的板材信息
List<PlateDetailsRespVO> getOrdersPlateList(List<Long> orderIds);
// 查看配件列表分页
List<OrderPartsRespVO> getPartsList(OrderPartsReqVO reqVO);
OrderPackRespVO updateParts(OrderPartsReqVO reqVO);
// 拆包
OrderPackRespVO unpacking(Long packageID);
// 更新包裹
OrderPackRespVO updatePack(OrderPackReqVO packageVO);
// 查询包裹
List<OrderPackRespVO> selectPack(Long orderId);
// 包裹订单打印
PrintOrderPackRespVO printOrderPack(PrintOrderPackReqVO reqVO);
// 删除包裹及其关联的包裹信息(删除全部)
void deleteOrderPack(PackReqVO reqVO);
// 新增外部配件包裹
OrderPackRespVO addNewOtherPack(OtherPackReqVO reqVO);
// 新增外部配件
OrderPartsRespVO addNewOtherParts(OtherPackReqVO reqVO);
// 删除包裹中的外部配件
void deleteOtherParts(DeleteOtherPartsReqVO reqVO);
// 新增配件-即新增一个包裹
OrderPackRespVO addNewPartsPack(OrderPackReqVO reqVO);
// 查询预打包优化信息
String getPrePackInfo(Long orderId);
// 保存优化后的预打包信息
void saveOptimizeInfo(PrePackReqVO reqVO);
}
@@ -0,0 +1,238 @@
package com.cf.imes.module.executor.service.manage.parts;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.nacos.common.utils.StringUtils;
import com.cf.imes.module.executor.controller.admin.manage.parts.vo.PartsImportExcelVO;
import com.cf.imes.module.executor.enums.manage.parts.CategoryEnum;
import com.cf.imes.module.executor.enums.manage.parts.ObjectEnum;
import com.cf.imes.module.executor.enums.manage.parts.WhetherEnum;
import com.cf.imes.module.executor.util.file.ExcelListener;
import lombok.extern.slf4j.Slf4j;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.Consumer;
import java.util.function.Supplier;
/**
* 配件 导入监听器
*/
@Slf4j
public final class PartsExcelListener extends ExcelListener<PartsImportExcelVO> {
private static final String ZERO = "0";
/**
* 自定义用于暂时存储data
* 可以通过实例获取该值
*/
private List<PartsImportExcelVO> datas = new ArrayList<>();
private boolean flag = true;
private Map<Integer, String> valueMap = new HashMap<>();
// 非空判断,错误写入;不为空则判断字符串长度是否超过
private void isEmptyAndAdd(Supplier<String> getter, Consumer<String> setter,String msg, int maxLength) {
String value = getter.get();
if (StringUtils.isEmpty(value)) {
setter.accept(msg + "不可为空");
this.flag = false;
} else { // 字符长度判断
isLong(value, setter, maxLength, msg);
}
}
private void isEmpty(Supplier<String> getter, Consumer<String> setter,String msg) {
String value = getter.get();
if (StringUtils.isEmpty(value)) {
setter.accept(msg + "不可为空");
this.flag = false;
}
}
//不为空时,判断长度
private void isNotEmptyAndAdd(Supplier<String> getter, Consumer<String> setter,String msg, int maxLength) {
String value = getter.get();
if (StringUtils.isNotEmpty(value)) {
isLong(value, setter, maxLength, msg);
}
}
// 非空判断,并判断枚举值是否正确
private <T extends Enum<T> & ObjectEnum> void isEmptyAndEnumAdd(Supplier<String> getter, Consumer<String> setter, String msg, Class<T> enumClass) {
String value = getter.get();
if (StringUtils.isEmpty(value)) {
setter.accept(msg + "不可为空");
this.flag = false;
} else {
isNotEmptyToEnum(getter, setter, msg, enumClass);
}
}
// 不为空,判断枚举值是否正确
private <T extends Enum<T> & ObjectEnum> void isNotEmptyToEnum(Supplier<String> getter, Consumer<String> setter, String msg, Class<T> enumClass) {
String value = getter.get();
if (!StringUtils.isEmpty(value)) {
boolean isValid = false;
for (T enumValue : enumClass.getEnumConstants()) {
if (Objects.equals(enumValue.getValue(), value)) {
isValid = true;
break;
}
}
if (!isValid) {
setter.accept(msg + "请使用规范标识填写表格");
this.flag = false;
}
}
}
// 非空时判断字符串是否可以转换为Double,并判断整数位与小数位是否符合长度要求
private void isEmptyAndDoubleAdd(Supplier<String> getter, Consumer<String> setter, String msg, int integerLength, int decimalLength) {
String value = getter.get();
if (StringUtils.isNotEmpty(value)) {
// 判断是否可以转换
try {
Double d = Double.parseDouble(value);
if (d < Double.parseDouble(ZERO)) {
setter.accept(msg + "必须大于0");
} else {
// 处理科学计数法,保留小数点后四位
DecimalFormat decimalFormat = new DecimalFormat("#.####");
String valueString = decimalFormat.format(d);
String[] split = valueString.split("\\.");
// 获取小数点前的位数
int integerPartLength = split[0].length();
// 获取小数点后的位数
int fractionalPartLength = 0;
if (split.length > 2) {
fractionalPartLength = split[1].length();
}
if (integerPartLength > integerLength || fractionalPartLength > decimalLength) {
setter.accept(msg + "长度不合法,总长度不超过8位,小数点后不超过3位");
}
}
} catch (NumberFormatException e) {
setter.accept(msg + "必须为数字");
this.flag = false;
}
}
}
// 判断字符串长度是否过长
private void isLong(String value, Consumer<String> setter, int maxLength, String msg) {
if (value.length() > maxLength) {
setter.accept(msg + "长度不能超过" + maxLength + "个字符");
this.flag = false;
}
}
// 结果数据生成
private String setResult(String result, String value) {
if (StringUtils.isEmpty(result)) {
return value;
} else {
return result + "," + value;
}
}
/**
* 每解析一行都会回调invoke()方法
*
* @param data 读取后的数据对象
* @param context 内容
*/
@Override
public void invoke(PartsImportExcelVO data, AnalysisContext context) {
// 一,必须存在且合理
isEmptyAndAdd(data::getGoodsId, data::setResult, setResult(data.getResult(), "物料编号"), 32);
isEmptyAndAdd(data::getName, data::setResult, setResult(data.getResult(), "物料名称"), 64);
isEmptyAndEnumAdd(data::getCategory, data::setResult, setResult(data.getResult(), "分类"), CategoryEnum.class);
isNotEmptyAndAdd(data::getCategory, data::setResult, setResult(data.getResult(), "分类"),32);
// 二,分类,必须存在
if (data.getCategory() != null ) {
if (!CategoryEnum.OTHER.getValue().equals(data.getCategory())) { // 不为其他
isEmpty(data::getUnit, data::setResult, setResult(data.getResult(), "单位"));
if (CategoryEnum.EDGING.getValue().equals(data.getCategory())) { // 为封边
isEmpty(data::getColor, data::setResult, setResult(data.getResult(), "颜色"));
isEmpty(data::getWidth, data::setResult, setResult(data.getResult(), "宽度"));
isEmpty(data::getThickness, data::setResult, setResult(data.getResult(), "厚度"));
}
}
}
// 三,存在则判断是否符合
isNotEmptyToEnum(data::getIsComposite, data::setResult, setResult(data.getResult(), "是否复合部件"), WhetherEnum.class);
isNotEmptyAndAdd(data::getType, data::setResult, setResult(data.getResult(), "子类型"), 64);
isNotEmptyAndAdd(data::getModel, data::setResult, setResult(data.getResult(), "型号"), 64);
isNotEmptyAndAdd(data::getColor, data::setResult, setResult(data.getResult(), "颜色"), 64);
isNotEmptyAndAdd(data::getMaterial, data::setResult, setResult(data.getResult(), "材质"), 64);
isNotEmptyAndAdd(data::getUnit, data::setResult, setResult(data.getResult(), "单位"), 32);
isNotEmptyAndAdd(data::getSpec, data::setResult, setResult(data.getResult(), "规格"), 64);
isNotEmptyAndAdd(data::getBrand, data::setResult, setResult(data.getResult(), "品牌"), 64);
isNotEmptyAndAdd(data::getFactor, data::setResult, setResult(data.getResult(), "厂家"), 128);
isEmptyAndDoubleAdd(data::getLength, data::setResult, setResult(data.getResult(), "长度"), 5 , 3);
isEmptyAndDoubleAdd(data::getWidth, data::setResult, setResult(data.getResult(), "宽度"), 5 , 3);
isEmptyAndDoubleAdd(data::getThickness, data::setResult, setResult(data.getResult(), "厚度"), 5 , 3);
isNotEmptyAndAdd(data::getRemark, data::setResult, setResult(data.getResult(), "备注"), 255);
// 当为封边的时候,一定需要
// if (StringUtils.isNotEmpty(data.getCategory())) {
// if (data.getCategory().equals(CategoryEnum.EDGING.getValue())) {
// isEmpty(data::getThickness, data::setResult, setResult(data.getResult(), "厚度"));
// isEmpty(data::getWidth, data::setResult, setResult(data.getResult(), "宽度"));
// }
// }
if (data.getResult() != null)
data.setResult(data.getResult().replace("null,", ""));
valueMap.put(context.getCurrentRowNum(), data.getResult());
datas.add(data);
}
/**
* 读取完后操作
*
* @param context
*/
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
if (this.flag)
log.info("PlateExcelListener 所有数据读取完成");
}
/**
* 返回数据
*
* @return 返回读取的数据集合
**/
public List<PartsImportExcelVO> getDates() {
return datas;
}
/**
* 返回读取结果
*
* @return 是否读取成功
**/
public boolean getFlag() {
return flag;
}
/**
* 返回错误信息
*
* @return String
**/
public Map<Integer, String> getValueMap() {
return valueMap;
}
}
@@ -0,0 +1,94 @@
package com.cf.imes.module.executor.service.manage.parts;
import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.module.executor.controller.admin.manage.parts.vo.PartsCadPageReqVO;
import com.cf.imes.module.executor.controller.admin.manage.parts.vo.PartsImportExcelVO;
import com.cf.imes.module.executor.controller.admin.manage.parts.vo.PartsPageReqVO;
import com.cf.imes.module.executor.controller.admin.manage.parts.vo.PartsSaveReqVO;
import com.cf.imes.module.executor.dal.dataobject.orderParts.PartsDO;
import org.springframework.boot.system.ApplicationHome;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.File;
import java.util.List;
/**
* 配件表 parts_{N} Service 接口
*
* @author 晨丰科技
*/
public interface PartsService {
/**
* 创建配件表 parts_{N}
*
* @param createReqVO 创建信息
* @return 编号
*/
Long create(@Valid PartsSaveReqVO createReqVO);
/**
* 更新配件表 parts_{N}
*
* @param updateReqVO 更新信息
*/
void update(@Valid PartsSaveReqVO updateReqVO);
/**
* 删除配件表 parts_{N}
*
* @param id 编号
*/
void delete(Long id, Long organId);
/**
* 获得配件表 parts_{N}
*
* @param id 编号
* @return 配件表 parts_{N}
*/
PartsDO get(Long id, Long organId);
/**
* 获得配件表 parts_{N}分页
*
* @param pageReqVO 分页查询
* @return 配件表 parts_{N}分页
*/
PageResult<PartsDO> getPage(PartsPageReqVO pageReqVO);
/**
* webcad获取配件表 parts_{N}分页
*
* @param pageReqVO 分页查询
* @return 配件表 parts_{N}分页
*/
PageResult<PartsDO> webCadGetPage(PartsPageReqVO pageReqVO);
PageResult<PartsDO> getCadPage(PartsCadPageReqVO pageReqVO);
/**
* 生产导入文件模板下载
*/
void exportTemplate(HttpServletResponse response, String value);
/**
* 批量导入配件
*
* @param importParts 导入配件列表
* @param isUpdateSupport 是否支持更新
*/
void importPartsList(List<PartsImportExcelVO> importParts, boolean isUpdateSupport, Long organId);
default String getSavePath() {
ApplicationHome applicationHome = new ApplicationHome(this.getClass());
// 保存目录位置根据项目需求可随意更改
return applicationHome.getDir().getAbsolutePath() + File.separator + "type";
}
List<PartsDO> getPartAll(String category);
}
@@ -0,0 +1,261 @@
package com.cf.imes.module.executor.service.manage.parts;
import com.cf.imes.framework.common.pojo.CommonResult;
import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.framework.common.util.object.BeanUtils;
import com.cf.imes.framework.organ.core.aop.OrganIgnore;
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
import com.cf.imes.module.executor.controller.admin.manage.parts.vo.PartsCadPageReqVO;
import com.cf.imes.module.executor.controller.admin.manage.parts.vo.PartsImportExcelVO;
import com.cf.imes.module.executor.controller.admin.manage.parts.vo.PartsPageReqVO;
import com.cf.imes.module.executor.controller.admin.manage.parts.vo.PartsSaveReqVO;
import com.cf.imes.module.executor.dal.dataobject.orderParts.PartsDO;
import com.cf.imes.module.executor.dal.mysql.orderParts.PartsMapper;
import com.cf.imes.module.executor.enums.manage.parts.CategoryEnum;
import com.cf.imes.module.executor.util.file.FileHelperUtil;
import com.cf.imes.module.executor.util.number.NumberHelperUtil;
import com.cf.imes.module.system.api.organ.OrganApi;
import com.cf.imes.module.system.api.permission.PermissionApi;
import com.cf.imes.module.system.enums.ErrorCodeConstants;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
/**
* 配件表 parts_{N} Service 实现类
*
* @author 晨丰科技
*/
@Service
@Validated
public class PartsServiceImpl implements PartsService {
@Resource
private PartsMapper partsMapper;
@Resource
private OrganApi organApi;
@Resource
private PermissionApi permissionApi;
@Resource
private NumberHelperUtil numberUtil;
private final static String BASE_PARTS_IMPORT_PERMISSION = "base:accessory:import"; // 导入板材
private final static String BASE_PARTS_DELETE_PERMISSION = "base:accessory:delete"; // 删除板材信息
private final static String BASE_PARTS_CREATE_PERMISSION = "base:accessory:create"; // 创建板材信息
private final static String BASE_PARTS_UPDATE_PERMISSION = "base:accessory:update"; // 更新板材信息
private final static String BASE_PARTS_QUERY_PERMISSION = "base:accessory:query"; // 获得板材信息
@Override
@OrganIgnore
public Long create(PartsSaveReqVO createReqVO) {
validateFieldExists(createReqVO);
PartsDO partsDO = BeanUtils.toBean(createReqVO, PartsDO.class);
Long organId = getOrganId(BASE_PARTS_CREATE_PERMISSION, getLoginUser().getId(), partsDO.getOrganId());
partsDO.setOrganId(organId).setIsComposite(createReqVO.getIsComposite() != null && createReqVO.getIsComposite());
// 判断是否存在--- goodsId
if (validateExistsByGoodsId(partsDO.getGoodsId(), organId)) {
throw exception(PARTS_GOOD_ID_EXISTS);
}
partsMapper.insert(partsDO);
// 返回
return partsDO.getId();
}
@Override
@OrganIgnore
@Transactional(rollbackFor = Exception.class)
public void update(PartsSaveReqVO updateReqVO) {
validateFieldExists(updateReqVO);
Long organId = getOrganId(BASE_PARTS_UPDATE_PERMISSION, getLoginUser().getId(), updateReqVO.getOrganId());
// 校验id存在
boolean index = validateExistsById(updateReqVO.getId(),organId);
if (!index) {
throw exception(PARTS_NOT_EXISTS);
}
// 校验goodsId是否存在
if (!validateExistsExceptGoodsId(updateReqVO.getId(),updateReqVO.getGoodsId(),organId)) {
throw exception(PARTS_GOOD_ID_EXISTS);
}
// 更新
updateReqVO.setOrganId(organId).setIsComposite(updateReqVO.getIsComposite() != null && updateReqVO.getIsComposite());
PartsDO updateObj = BeanUtils.toBean(updateReqVO, PartsDO.class);
partsMapper.updateById(updateObj);
}
@Override
@OrganIgnore
public void delete(Long id, Long organId) {
// 校验存在
if (!validateExistsById(id, getOrganId(BASE_PARTS_DELETE_PERMISSION, getLoginUser().getId(), organId))) {
throw exception(PARTS_NOT_EXISTS);
}
// 删除
partsMapper.deleteById(id);
}
private boolean validateExistsById(Long id, Long organId) {
if (partsMapper.selectById(id, organId) == null) {
return false;
}
return true;
}
private boolean validateExistsByGoodsId(String goodsId, Long organId) {
if (partsMapper.selectByGoodID(goodsId, organId) == null) {
return false;
}
return true;
}
private boolean validateExistsExceptGoodsId(Long id, String goodsId, Long organId) {
if (partsMapper.selectExceptGoodID(id, goodsId, organId) == null) { // 不存在相同的goods_id
return true;
}
return false;
}
@Override
@OrganIgnore
public PartsDO get(Long id, Long organId) {
organId = getOrganId(BASE_PARTS_QUERY_PERMISSION, getLoginUser().getId(), organId);
return partsMapper.selectById(id, organId);
}
@Override
@OrganIgnore
public PageResult<PartsDO> getPage(PartsPageReqVO pageReqVO) {
pageReqVO.setOrganId(getOrganId(BASE_PARTS_QUERY_PERMISSION, getLoginUser().getId(), pageReqVO.getOrganId()))
.setLength(numberUtil.compareLength(pageReqVO.getLength()))
.setWidth(numberUtil.compareLength(pageReqVO.getWidth()))
.setThickness(numberUtil.compareLength(pageReqVO.getThickness()));
return partsMapper.selectPage(pageReqVO);
}
@Override
public PageResult<PartsDO> webCadGetPage(PartsPageReqVO pageReqVO) {
pageReqVO.setLength(numberUtil.compareLength(pageReqVO.getLength()))
.setWidth(numberUtil.compareLength(pageReqVO.getWidth()))
.setThickness(numberUtil.compareLength(pageReqVO.getThickness()));
return partsMapper.selectPage(pageReqVO);
}
@Override
public PageResult<PartsDO> getCadPage(PartsCadPageReqVO pageReqVO) {
// pageReqVO.setOrganId(getOrganId(BASE_PARTS_QUERY_PERMISSION, getLoginUser().getId(), pageReqVO.getOrganId()));
return partsMapper.selectCadPage(pageReqVO);
}
@Override
@OrganIgnore
public void exportTemplate(HttpServletResponse response, String value) {
String rootPath = getSavePath();
FileHelperUtil.getFile(rootPath, response, value);
}
@Override
@OrganIgnore
public void importPartsList(List<PartsImportExcelVO> importParts, boolean isUpdateSupport, Long organId) {
// 组织id
organId = getOrganId(BASE_PARTS_IMPORT_PERMISSION, getLoginUser().getId(), organId);
// 批量插入集合
List<PartsDO> insertList = new ArrayList<>();
// 批量更新集合
List<PartsDO> updateList = new ArrayList<>();
Long finalOrganId = organId;
importParts.forEach(importPart -> {
// 判断如果不存在,在进行插入
PartsDO existPlate = partsMapper.selectByGoodID(importPart.getGoodsId(), finalOrganId);
if (existPlate == null) { // 不存在
insertList.add(BeanUtils.toBean(importPart, PartsDO.class).setOrganId(finalOrganId));
return;
}
// 判断是否允许更新
if (!isUpdateSupport) {
PartsDO partsDO = BeanUtils.toBean(importPart, PartsDO.class).setOrganId(finalOrganId).setId(existPlate.getId());
updateList.add(partsDO);
}
});
// 批量插入,批量更新
if (!insertList.isEmpty()) {
partsMapper.insertBatch(insertList);
}
if (!updateList.isEmpty()) {
partsMapper.updateBatch(updateList);
}
}
@Override
public List<PartsDO> getPartAll(String category) {
return partsMapper.getAllByOrganId(OrganContextHolder.getOrganId(), category);
}
private void validateOrganExists(Long organId) {
CommonResult<Boolean> index = organApi.validOrgan(organId);
if (!index.isSuccess()) {
throw exception(ErrorCodeConstants.ORGAN_NOT_EXISTS);
}
}
// 组织id返回
private Long getOrganId(String type, Long userId, Long organId) {
boolean hasPermission = permissionApi.hasRoles(userId, type).getData();
Long organIdDefault = OrganContextHolder.getOrganId();
if (hasPermission && organId != null && organId != 0) {
validateOrganExists(organId);
organIdDefault = organId;
}
return organIdDefault;
}
// 必填字段判断
private void validateFieldExists(PartsSaveReqVO partsSaveReqVO) {
if (!CategoryEnum.OTHER.getValue().equals(partsSaveReqVO.getCategory())) { // 不为其他
if (partsSaveReqVO.getUnit() == null || partsSaveReqVO.getUnit().isEmpty()) {
throw exception(PARTS_UNIT_NOT_NULL);
}
if (CategoryEnum.EDGING.getValue().equals(partsSaveReqVO.getCategory())) { // 为封边
if (partsSaveReqVO.getColor() == null || partsSaveReqVO.getWidth() == null || partsSaveReqVO.getThickness() == null) {
throw exception(PARTS_EDGE_NOT_NULL);
}
}
}
}
}
@@ -0,0 +1,146 @@
package com.cf.imes.module.executor.service.manage.plate;
import com.alibaba.excel.context.AnalysisContext;
import com.cf.imes.module.executor.controller.admin.manage.plate.vo.plate.PlateImportExcelVO;
import com.cf.imes.module.executor.util.file.ExcelListener;
import lombok.extern.slf4j.Slf4j;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Slf4j
public final class PlateExcelListener<T> extends ExcelListener<PlateImportExcelVO> {
/**
* 自定义用于暂时存储data
* 可以通过实例获取该值
*/
private List<PlateImportExcelVO> datas = new ArrayList<>();
private boolean flag = true;
private Map<Integer, String> valueMap = new HashMap<>();
/**
* 每解析一行都会回调invoke()方法
*
* @param data 读取后的数据对象
* @param context 内容
*/
@Override
public void invoke(PlateImportExcelVO data, AnalysisContext context) {
if (!data.isValidGoods()) {//返回false,表示商品信息无效;否则返回true,表示商品信息有效
data.setResult("板材【*】信息请填写完整");
this.flag = false;
}
checkData(data.getHeight(),"高度",data);
checkData(data.getWidth(),"宽度",data);
checkData(data.getThickness(),"厚度",data);
if (data.getPrice() == null || data.getPrice().equals("")) {
data.setPrice("0");
}
checkData(data.getPrice(),"价格",data);
checkTexture(data.getTexture(),"纹理",data);
// 字段长度判断
checkLength(data.getGoodsId(),"物料编号",data,32);
checkLength(data.getGoodsName(),"物料名称",data,64);
checkLength(data.getMaterial(),"材质",data,64);
checkLength(data.getColor(),"颜色",data,32);
checkLength(data.getSpec(),"规格",data,64);
checkLength(data.getBrand(),"品牌",data,64);
checkLength(data.getRemark(),"备注",data,255);
if (data.getResult() != null)
data.setResult(data.getResult().replace("null,", ""));
valueMap.put(context.getCurrentRowNum(), data.getResult());
datas.add(data);
}
// 错误判断
private void checkData(String valueCheck, String head, PlateImportExcelVO data) {
// 长宽厚、价格判断非空
if (valueCheck == null || valueCheck.equals("")) {
this.flag = false;
data.setResult(data.getResult() + "," + head + "信息缺少");
} else {
try {
if (!data.checkPrecision(Double.valueOf(valueCheck))) {
data.setResult(data.getResult() + "," + head + "数据有误");
this.flag = false;
}
} catch (NumberFormatException e) {
this.flag = false;
data.setResult(data.getResult() + "," + head + "需要填写数字");
}
}
}
private void checkTexture(String valueCheck, String head, PlateImportExcelVO data) {
if (valueCheck != null && !valueCheck.equals("")) {
String value = valueCheck.trim();
if (!value.equals("") && !value.equals("")) {
this.flag = false;
data.setResult(data.getResult() + "," + head + "信息有误");
} else if (value.equals("")) {
data.setTexture("");
} else {
data.setTexture("");
}
}
}
/**
* 字段长度判断
*/
private void checkLength(String valueCheck, String head, PlateImportExcelVO data, int maxLength) {
if (valueCheck != null && !valueCheck.equals("")) {
if (valueCheck.length() > maxLength) {
this.flag = false;
data.setResult(data.getResult() + "," + head + "信息有误");
}
}
}
/**
* 读取完后操作
*
* @param context
*/
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
if (this.flag)
log.info("PlateExcelListener 所有数据读取完成");
}
/**
* 返回数据
*
* @return 返回读取的数据集合
**/
public List<PlateImportExcelVO> getDates() {
return datas;
}
/**
* 返回读取结果
*
* @return 是否读取成功
**/
public boolean getFlag() {
return flag;
}
/**
* 返回错误信息
*
* @return String
**/
public Map<Integer, String> getValueMap() {
return valueMap;
}
}
@@ -0,0 +1,100 @@
package com.cf.imes.module.executor.service.manage.plate;
import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.module.executor.controller.admin.manage.plate.vo.plate.PlateImportExcelVO;
import com.cf.imes.module.executor.controller.admin.manage.plate.vo.plate.PlateImportRespVO;
import com.cf.imes.module.executor.controller.admin.manage.plate.vo.plate.PlatePageReqVO;
import com.cf.imes.module.executor.controller.admin.manage.plate.vo.plate.PlateSaveReqVO;
import com.cf.imes.module.executor.dal.dataobject.plate.PlateGoodDO;
import org.springframework.boot.system.ApplicationHome;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.File;
import java.util.List;
/**
* 板材信息表 plate_{N} Service 接口
*
* @author 晨丰科技
*/
public interface PlateManageService {
/**
* 创建板材信息表 plate_{N}
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createPlate(@Valid PlateSaveReqVO createReqVO);
/**
* 更新板材信息表 plate_{N}
*
* @param updateReqVO 更新信息
*/
void updatePlate(@Valid PlateSaveReqVO updateReqVO);
/**
* 删除板材信息表 plate_{N}
*
* @param id 编号
*/
void deletePlate(Long id,Long organId);
/**
* 获得板材信息表 plate_{N}
*
* @param id 编号
* @return 板材信息表 plate_{N}
*/
PlateGoodDO getPlate(Long id, Long organId);
/**
* 获得板材信息表 plate_{N}
*
* @param id 编号
* @return 板材信息表 plate_{N}
*/
PlateGoodDO getPlateGoods(String id, Long organId);
/**
* 获得板材信息表 plate_{N}分页
*
* @param pageReqVO 分页查询
* @return 板材信息表 plate_{N}分页
*/
PageResult<PlateGoodDO> getPlatePage(PlatePageReqVO pageReqVO);
/**
* webcad获取板材信息表 plate_{N}分页
*
* @param pageReqVO 分页查询
* @return 板材信息表 plate_{N}分页
*/
PageResult<PlateGoodDO> webCadGetPlatePage(PlatePageReqVO pageReqVO);
/**
* 批量导入板材
*
* @param importUsers 导入板材列表
* @param isUpdateSupport 是否支持更新
* @return 导入结果
*/
PlateImportRespVO importPlateList(List<PlateImportExcelVO> importUsers, boolean isUpdateSupport , Long organId);
/**
* 生产导入文件模板下载
*/
void exportTemplate(HttpServletResponse response, String value);
default String getSavePath() {
ApplicationHome applicationHome = new ApplicationHome(this.getClass());
// 保存目录位置根据项目需求可随意更改
return applicationHome.getDir().getAbsolutePath() + File.separator + "type";
}
List<PlateGoodDO> getPlateAll();
}
@@ -0,0 +1,226 @@
package com.cf.imes.module.executor.service.manage.plate;
import com.cf.imes.framework.common.pojo.CommonResult;
import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.framework.common.util.object.BeanUtils;
import com.cf.imes.framework.organ.core.aop.OrganIgnore;
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
import com.cf.imes.module.executor.controller.admin.manage.plate.vo.plate.PlateImportExcelVO;
import com.cf.imes.module.executor.controller.admin.manage.plate.vo.plate.PlateImportRespVO;
import com.cf.imes.module.executor.controller.admin.manage.plate.vo.plate.PlatePageReqVO;
import com.cf.imes.module.executor.controller.admin.manage.plate.vo.plate.PlateSaveReqVO;
import com.cf.imes.module.executor.dal.dataobject.plate.PlateGoodDO;
import com.cf.imes.module.executor.dal.mysql.plate.PlateGoodMapper;
import com.cf.imes.module.executor.dal.mysql.plate.PlateMapper;
import com.cf.imes.module.executor.util.file.FileHelperUtil;
import com.cf.imes.module.system.api.organ.OrganApi;
import com.cf.imes.module.system.api.permission.PermissionApi;
import com.cf.imes.module.system.enums.ErrorCodeConstants;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;
import static com.cf.imes.module.system.enums.ErrorCodeConstants.PLATE_GOODS_ID_NOT_SAME;
import static com.cf.imes.module.system.enums.ErrorCodeConstants.REMAIN_PLATE_NOT_EXISTS;
/**
* 板材信息表 plate_{N} Service 实现类
*
* @author 晨丰科技
*/
@Service
@Validated
public class PlateManageServiceImpl implements PlateManageService {
@Resource
private PlateGoodMapper plateGoodMapper;
@Resource
private OrganApi organApi;
@Resource
private PermissionApi permissionApi;
private final static String BASE_PLATE_IMPORT_PERMISSION = "base:plate:import"; // 导入板材
private final static String BASE_PLATE_DELETE_PERMISSION = "base:plate:delete"; // 删除板材信息
private final static String BASE_PLATE_CREATE_PERMISSION = "base:plate:create"; // 创建板材信息
private final static String BASE_PLATE_UPDATE_PERMISSION = "base:plate:update"; // 更新板材信息
private final static String BASE_PLATE_QUERY_PERMISSION = "base:plate:query"; // 获得板材信息
@Override
@OrganIgnore
public Long createPlate(PlateSaveReqVO createReqVO) {
PlateGoodDO plate = BeanUtils.toBean(createReqVO, PlateGoodDO.class);
// 判断板材是否存在
validateGoodExists(plate.getGoodsId(),
getOrganId(BASE_PLATE_CREATE_PERMISSION, getLoginUser().getId(), plate.getOrganId()));
plateGoodMapper.insert(plate);// 组织id未传输
// 返回
return plate.getId();
}
@Override
@OrganIgnore
@Transactional(rollbackFor = Exception.class)
public void updatePlate(PlateSaveReqVO updateReqVO) {
// 校验存在
Long organId = getOrganId(BASE_PLATE_UPDATE_PERMISSION, getLoginUser().getId(), updateReqVO.getOrganId());
if (updateReqVO.getId() == null) {
throw exception(ErrorCodeConstants.PLATE_NOT_EXISTS);
}
validatePlateExists(Long.valueOf(updateReqVO.getId()), organId);
PlateGoodDO updateObj = BeanUtils.toBean(updateReqVO, PlateGoodDO.class);
// 校验板材goods_id是否相同
if (plateGoodMapper.isByGoodIDAndId(updateReqVO.getGoodsId(), organId, Long.valueOf(updateReqVO.getId()))) {
throw exception(PLATE_GOODS_ID_NOT_SAME);
}
plateGoodMapper.updateById(updateObj);
}
@Override
@OrganIgnore
@Transactional(rollbackFor = Exception.class)
public void deletePlate(Long id, Long organId) {
// 校验存在
validatePlateExists(id,
getOrganId(BASE_PLATE_DELETE_PERMISSION, getLoginUser().getId(), organId));
// 删除
plateGoodMapper.deleteById(id);
}
private void validatePlateExists(Long id, Long organId) {
if (plateGoodMapper.selectOneById(id, organId) == null) {
throw exception(REMAIN_PLATE_NOT_EXISTS);
}
}
@Override
@OrganIgnore
public PlateGoodDO getPlate(Long id, Long organId) {
return plateGoodMapper.selectOneById(id, organId);
}
@Override
public PlateGoodDO getPlateGoods(String id, Long organId) {
return plateGoodMapper.selectByGoodID(id, organId);
}
@Override
@OrganIgnore
public PageResult<PlateGoodDO> getPlatePage(PlatePageReqVO pageReqVO) {
// if (permissionApi.hasRoles(getLoginUser().getId(), BASE_PLATE_QUERY_PERMISSION).getData()) {
// if (pageReqVO.getOrganId() != null && pageReqVO.getOrganId() != 0) {
// validateOrganExists(pageReqVO.getOrganId());
// }
// } else {
// pageReqVO.setOrganId(OrganContextHolder.getOrganId());
// }
// if (pageReqVO.getOrganId() == null || pageReqVO.getOrganId() == 0) {
pageReqVO.setOrganId(getOrganId(BASE_PLATE_QUERY_PERMISSION, getLoginUser().getId(), pageReqVO.getOrganId()));
// }
return plateGoodMapper.selectPage(pageReqVO);
}
@Override
public PageResult<PlateGoodDO> webCadGetPlatePage(PlatePageReqVO pageReqVO) {
return plateGoodMapper.selectPage(pageReqVO);
}
@Override
@OrganIgnore
@Transactional(rollbackFor = Exception.class) // 添加事务,异常则回滚所有导入
public PlateImportRespVO importPlateList(List<PlateImportExcelVO> importPlates, boolean isUpdateSupport, Long organId) {
organId = getOrganId(BASE_PLATE_IMPORT_PERMISSION, getLoginUser().getId(), organId);
PlateImportRespVO respVO = PlateImportRespVO.builder().createPlateNames(new ArrayList<>())
.updatePlateNames(new ArrayList<>()).failurePlateNames(new LinkedHashMap<>()).build();
// 批量插入集合
List<PlateGoodDO> insertList = new ArrayList<>();
// 批量更新集合
List<PlateGoodDO> updateList = new ArrayList<>();
Long finalOrganId = organId;
importPlates.forEach(importPlate -> {
// 判断如果不存在,在进行插入
PlateGoodDO existPlate = plateGoodMapper.selectByGoodID(importPlate.getGoodsId(), finalOrganId);
if (existPlate == null) {
respVO.getCreatePlateNames().add(importPlate.getGoodsName());
insertList.add(BeanUtils.toBean(importPlate, PlateGoodDO.class)
.setOrganId(finalOrganId));
// .setTexture(Boolean.valueOf(importPlate.getTexture()));
return;
}
// 判断是否允许更新
if (!isUpdateSupport) {
respVO.getFailurePlateNames().put(importPlate.getGoodsName(), ErrorCodeConstants.PLATE_EXISTS.getMsg());
PlateGoodDO plateDO = BeanUtils.toBean(importPlate, PlateGoodDO.class)
.setOrganId(finalOrganId)
.setId(existPlate.getId());
// .setTexture(Boolean.valueOf(importPlate.getTexture()));
updateList.add(plateDO);
}
});
// 批量插入,批量更新
if (insertList.size() > 0) {
plateGoodMapper.insertBatch(insertList);
}
if (updateList.size() > 0) {
plateGoodMapper.updateBatch(updateList);
}
return respVO;
}
@Override
@OrganIgnore
public void exportTemplate(HttpServletResponse response, String value) {
String rootPath = getSavePath();
FileHelperUtil.getFile(rootPath, response, value);
}
@Override
public List<PlateGoodDO> getPlateAll() {
return plateGoodMapper.getAllByOrganId(OrganContextHolder.getOrganId());
}
private void validateOrganExists(Long organId) {
CommonResult<Boolean> index = organApi.validOrgan(organId);
if (!index.isSuccess()) {
throw exception(ErrorCodeConstants.ORGAN_NOT_EXISTS);
}
}
// 当前组织中板材是否存在
private void validateGoodExists(String goodsId, Long organId) {
if (plateGoodMapper.selectByGoodID(goodsId, organId) != null) {
throw exception(ErrorCodeConstants.PLATE_EXISTS);
}
}
// 组织id返回
private Long getOrganId(String type, Long userId, Long organId) {
boolean hasPermission = permissionApi.hasRoles(userId, type).getData();
Long organIdDefault = OrganContextHolder.getOrganId();
if (hasPermission && organId != null && organId != 0) {
validateOrganExists(organId);
organIdDefault = organId;
}
return organIdDefault;
}
}
@@ -0,0 +1,89 @@
package com.cf.imes.module.executor.service.manage.remainplaten;
import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.module.executor.controller.admin.manage.plate.vo.remain.RemainPlatePageReqVO;
import com.cf.imes.module.executor.controller.admin.manage.plate.vo.remain.RemainPlateSaveReqVO;
import com.cf.imes.module.executor.dal.dataobject.remainplaten.RemainPlateDO;
import javax.validation.Valid;
import java.util.Set;
/**
* 生产单余料板表 Service 接口
*
* @author 晨丰科技
*/
public interface RemainPlateManageService {
/**
* 创建生产单余料板表
*
* @param createReqVO 创建信息
* @return 编号
*/
Boolean createRemainPlate(@Valid RemainPlateSaveReqVO createReqVO);
/**
* 创建生产单余料板表
*
* @param createReqVOS 创建信息 多个
* @return 编号
*/
Boolean createRemainPlateMultiple(@Valid Set<RemainPlateSaveReqVO> createReqVOS);
/**
* 批量核销
*
* @param ids 编号
* @param status 状态
* @param useType 使用类型
* @param planId 排单id
*/
void updateRemainPlateStatus(Set<Long> ids, Integer status,Integer useType,Long planId);
/**
* 更新生产单余料板表
*
* @param ids 编号
* @param status 状态
*/
void revertRemainPlateStatus(Set<Long> ids, Integer status);
/**
* 核销板材库
*
* @param updateReqVO 更新信息
*/
void updateRemainPlate(@Valid RemainPlateSaveReqVO updateReqVO);
/**
* 删除生产单余料板表
*
* @param ids 编号
*/
void deleteRemainPlate(Set<Long> ids);
/**
* 获得生产单余料板表
*
* @param id 编号
* @return 生产单余料板表
*/
RemainPlateDO getRemainPlate(Long id);
/**
* 获得生产单余料板表
*
* @param pageReqVO 分页查询
* @return 生产单余料板表
*/
PageResult<RemainPlateDO> getRemainPlatePage(RemainPlatePageReqVO pageReqVO);
/**
* 查询可添加余料板
*
* @param pageReqVO 分页查询
* @return 生产单余料板表
*/
PageResult<RemainPlateDO> getRemainPlatePageToAdd(RemainPlatePageReqVO pageReqVO);
}
@@ -0,0 +1,198 @@
package com.cf.imes.module.executor.service.manage.remainplaten;
import com.cf.imes.framework.common.enums.DeletedCodeEnum;
import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.framework.common.util.object.BeanUtils;
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
import com.cf.imes.module.executor.controller.admin.manage.plate.vo.remain.RemainPlatePageReqVO;
import com.cf.imes.module.executor.controller.admin.manage.plate.vo.remain.RemainPlateSaveReqVO;
import com.cf.imes.module.executor.dal.dataobject.remainplaten.RemainPlateDO;
import com.cf.imes.module.executor.dal.mysql.remainplaten.RemainPlateMapper;
import com.cf.imes.module.executor.enums.manage.remainPlate.RemainPlateStatusEnum;
import com.cf.imes.module.executor.enums.manage.remainPlate.RemainPlateUseTypeEnum;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
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_COUNT_MAX;
import static com.cf.imes.module.system.enums.ErrorCodeConstants.REMAIN_PLATE_ID_NOT_EXISTS;
import static com.cf.imes.module.system.enums.ErrorCodeConstants.REMAIN_PLATE_NOT_EXISTS;
import static com.cf.imes.module.system.enums.ErrorCodeConstants.REMAIN_PLATE_STATUS_NO_USED;
import static com.cf.imes.module.system.enums.ErrorCodeConstants.REMAIN_PLATE_STATUS_USED;
import static com.cf.imes.module.system.enums.ErrorCodeConstants.REMAIN_PLATE_USR_TYPE;
/**
* 生产单余料板表 order_remain_plate_{N} Service 实现类
*
* @author 晨丰科技
*/
@Service
@Validated
public class RemainPlateManageServiceImpl implements RemainPlateManageService {
@Resource
private RemainPlateMapper remainPlateMapper;
private static final Integer MAX_NUM = 999; // 余料单次最大条数
@Override
public Boolean createRemainPlate(RemainPlateSaveReqVO createReqVO) {
List<RemainPlateDO> remainPlates = new ArrayList<>();
// 限制新增数量不能超过999
if (createReqVO.getCount() > MAX_NUM) {
throw exception(REMAIN_PLATE_COUNT_MAX);
}
// 插入
if (createReqVO.getCount() >= 1) {
for (int i = 0; i < createReqVO.getCount(); i++) {
RemainPlateDO remainPlate = BeanUtils.toBean(createReqVO, RemainPlateDO.class).setCount(1).setOrganId(OrganContextHolder.getOrganId());
remainPlates.add(remainPlate);
}
}
// 批量增加
return remainPlateMapper.insertBatch(remainPlates);
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean createRemainPlateMultiple(Set<RemainPlateSaveReqVO> createReqVOS) {
Collection<RemainPlateDO> remainPlates = new ArrayList<>();
createReqVOS.forEach(createReqVO -> {
// 判断该排单是否已经添加过余料
if (remainPlateMapper.selectRemainPlatesByInitPlanId(createReqVO.getInitPlanId(), DeletedCodeEnum.NOT_DELETED.getStatus(), OrganContextHolder.getOrganId()).size() > 0) {
// 删除余料
remainPlateMapper.deleteRemainPlate(createReqVO.getInitPlanId(), OrganContextHolder.getOrganId());
}
RemainPlateDO remainPlate = BeanUtils.toBean(createReqVO, RemainPlateDO.class);
remainPlates.add(remainPlate);
});
return remainPlateMapper.insertBatch(remainPlates);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateRemainPlateStatus(Set<Long> ids, Integer status, Integer useType, Long planId) {
// 余料存在判断
validateRemainPlateExists(ids);
if (useType != RemainPlateUseTypeEnum.TYPE_ONE.getStatus() && useType != RemainPlateUseTypeEnum.TYPE_ZERO.getStatus()) { //余料使用状态为2或3
// 判断该排单是否存在以使用的余料
if (remainPlateMapper.selectRemainPlatesByPlanId(planId, RemainPlateStatusEnum.USED.getStatus(),
DeletedCodeEnum.NOT_DELETED.getStatus(), OrganContextHolder.getOrganId()).size() > 0) {
// 余料状态还原
remainPlateMapper.updateRemainPlateStatusByPlanId(RemainPlateStatusEnum.UNUSED.getStatus(), RemainPlateUseTypeEnum.TYPE_ZERO.getStatus(),
OrganContextHolder.getOrganId(), planId);
}
}
if (ids != null){
//判断是否符合核销标准
validateRemainPlateStatus(ids, RemainPlateStatusEnum.USED.getStatus());
//以id为条件批量修改余料库中的状态
remainPlateMapper.updateRemainPlateStatus(ids, status, useType, OrganContextHolder.getOrganId(), planId);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void revertRemainPlateStatus(Set<Long> ids, Integer status) {
if (ids == null) {
throw exception(REMAIN_PLATE_ID_NOT_EXISTS);
}
// 判断余料的状态是否存在使用中
validateRemainPlateStatus(ids, RemainPlateStatusEnum.UNUSED.getStatus());
// 判断使用类型是否为核销
for (Long id : ids) {
if (!validateRemainPlateUseType(id).equals(RemainPlateUseTypeEnum.TYPE_ONE.getStatus())) {
throw exception(REMAIN_PLATE_USR_TYPE);
}
}
remainPlateMapper.updateRemainPlateStatus(ids, status, null, OrganContextHolder.getOrganId(), 0L);
}
@Override
public void updateRemainPlate(RemainPlateSaveReqVO updateReqVO) {
// 校验存在
validateRemainPlateExists(updateReqVO.getId());
// 是否使用
if (validateRemainPlateStatus(updateReqVO.getId()) == RemainPlateStatusEnum.USED.getStatus()) {
throw exception(REMAIN_PLATE_STATUS_USED);
}
// 判断是否为开料添加
RemainPlateDO updateObj = validateRemainPlateIsCutting(updateReqVO.getId());
RemainPlateDO updateUpSaveVO = BeanUtils.toBean(updateReqVO, RemainPlateDO.class);
updateObj.setWidth(updateUpSaveVO.getWidth()).setLength(updateUpSaveVO.getLength()).setThickness(updateUpSaveVO.getThickness())
.setMaterial(updateUpSaveVO.getMaterial()).setColor(updateUpSaveVO.getColor()).setBrand(updateUpSaveVO.getBrand())
.setRemark(updateUpSaveVO.getRemark()).setStore(updateUpSaveVO.getStore()).setTexture(updateUpSaveVO.getTexture())
.setPlaceStyle(updateUpSaveVO.getPlaceStyle()).setOutLineJson(updateUpSaveVO.getOutLineJson());
remainPlateMapper.updateById(updateUpSaveVO);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteRemainPlate(Set<Long> ids) {
if (ids == null) {
throw exception(REMAIN_PLATE_ID_NOT_EXISTS);
}
// 余料存在判断
validateRemainPlateExists(ids);
// 判断余料的状态是否存在使用中
validateRemainPlateStatus(ids, RemainPlateStatusEnum.USED.getStatus());
// 删除
remainPlateMapper.deleteBatchIds(ids);
}
// 判断余料板是否正在使用
private void validateRemainPlateStatus(Set<Long> ids, Integer status) {
for (Long id : ids) {
if (validateRemainPlateStatus(id) == status) {
if (status == RemainPlateStatusEnum.USED.getStatus())
throw exception(REMAIN_PLATE_STATUS_USED);
if (status == RemainPlateStatusEnum.UNUSED.getStatus())
throw exception(REMAIN_PLATE_STATUS_NO_USED);
}
}
}
private void validateRemainPlateExists(Long id) {
if (remainPlateMapper.selectById(id) == null) {
throw exception(REMAIN_PLATE_NOT_EXISTS);
}
}
private void validateRemainPlateExists(Set<Long> id) {
if (remainPlateMapper.selectBatchIds(id).isEmpty()) {
throw exception(REMAIN_PLATE_NOT_EXISTS);
}
}
private RemainPlateDO validateRemainPlateIsCutting(Long id) {
return remainPlateMapper.selectById(id);
}
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);
}
@Override
public PageResult<RemainPlateDO> getRemainPlatePage(RemainPlatePageReqVO pageReqVO) {
return remainPlateMapper.selectPage(pageReqVO);
}
@Override
public PageResult<RemainPlateDO> getRemainPlatePageToAdd(RemainPlatePageReqVO pageReqVO) {
return remainPlateMapper.selectPageToAdd(pageReqVO.setStatus(RemainPlateStatusEnum.UNUSED.getStatus()));
}
}
@@ -0,0 +1,24 @@
package com.cf.imes.module.executor.service.manage.voice;
import org.springframework.http.ResponseEntity;
import java.io.IOException;
import java.sql.SQLException;
public interface VoiceService {
// 生成音频文件
String voiceAnnouncements(String data) throws IOException, SQLException;
// 把生成的音频文件进行压缩
void zipFiles(String sourceFile, String gzipFile) throws IOException;
void deleteFiles(String sourceFile);
ResponseEntity<byte[]> getVoice(String sourceFile);
}
@@ -0,0 +1,229 @@
package com.cf.imes.module.executor.service.manage.voice;
import com.cf.imes.module.executor.config.VocieParameters;
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.Dispatch;
import com.jacob.com.Variant;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.Channels;
import java.nio.channels.FileChannel;
import java.nio.channels.WritableByteChannel;
import java.util.Objects;
import java.util.Random;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
@Service
@Slf4j
public class VoiceServiceImpl implements VoiceService{
@Resource
private VocieParameters vocieParameters;
// static {
// System.loadLibrary("jacob-1.18-x64");
// }
//生成音频文件
@Override
public String voiceAnnouncements(String data) {
// 音频保存的路径
String path = vocieParameters.getPath();
// 设置音频的质量( 越大越好,目前最大好像 22,最小为 4 )
Long quality = vocieParameters.getQuality();
// 朗读声音大小
Long soundSize = vocieParameters.getSoundSize();
// 朗读速度
Long readingSpeed = vocieParameters.getReadingSpeed();
ActiveXComponent ax = null;
Dispatch spFileStream = null;
Dispatch spAudioFormat = null;
Dispatch spVoice = null;
try{
ax = new ActiveXComponent("Sapi.SpFileStream");
spFileStream = ax.getObject();
ax = new ActiveXComponent("Sapi.SpAudioFormat");
spAudioFormat = ax.getObject();
spVoice = new ActiveXComponent("Sapi.SpVoice").getObject();
// 设置音频流格式
Dispatch.put(spAudioFormat, "Type", new Variant(quality));
// 设置文件输出流格式
Dispatch.putRef(spFileStream, "Format", spAudioFormat);
// 随机数,控制文件的名字
int randomInt = new Random(System.currentTimeMillis()).nextInt(900) + 100;// 生成100到999之间的随机数
// 文件的路径
String filePath = path + randomInt + ".mp3";
// 调用输出文件流打开方法,创建一个.wav文件
Dispatch.call(spFileStream, "Open", new Variant(filePath), new Variant(3), new Variant(true));
// 设置声音对象的音频输出流为输出文件对象
Dispatch.putRef(spVoice, "AudioOutputStream", spFileStream);
// 设置音量 0 ~ 100
Dispatch.put(spVoice, "Volume", new Variant(soundSize));
// 设置朗读速度 -10 ~ +10
Dispatch.put(spVoice, "Rate", new Variant(readingSpeed));
Dispatch.call(spVoice, "Speak", new Variant(data));
log.info("输出语音文件成功!");
return filePath;
}catch(Exception e){
e.printStackTrace();
}finally {
// 关闭输出文件
Dispatch.call(Objects.requireNonNull(spFileStream), "Close");
Dispatch.putRef(Objects.requireNonNull(spVoice), "AudioOutputStream", null);
Objects.requireNonNull(spAudioFormat).safeRelease();
spFileStream.safeRelease();
spVoice.safeRelease();
ax.safeRelease();
}
return null;
}
@Override
public ResponseEntity<byte[]> getVoice( String fileName) {
try {
File audioFile = new File(fileName);
if (!audioFile.exists()) {
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(null);
}
// 读取文件到字节数组
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
try (FileInputStream fileInputStream = new FileInputStream(audioFile)) {
byte[] buffer = new byte[1024];
int bytesRead;
while ((bytesRead = fileInputStream.read(buffer)) != -1) {
byteArrayOutputStream.write(buffer, 0, bytesRead);
}
}
byte[] audioBytes = byteArrayOutputStream.toByteArray();
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.parseMediaType("audio/mpeg"));
headers.setContentLength(audioBytes.length);
headers.setCacheControl("must-revalidate, post-check=0, pre-check=0");
return new ResponseEntity<>(audioBytes, headers, HttpStatus.OK);
} catch (IOException e) {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null);
}
}
/**
* 把生成的音频文件进行压缩
* @param fileNames 需要压缩的文件名称列表(包含相对路径)
* @param zipOutName 压缩后的文件名称
**/
@Override
public void zipFiles(String fileNames, String zipOutName) throws IOException {
WritableByteChannel writableByteChannel = null;
ByteBuffer buffer = ByteBuffer.allocate(2048);
FileInputStream fileInputStream = null;
FileChannel fileChannel = null;
try (ZipOutputStream zipOutputStream = new ZipOutputStream(new FileOutputStream(zipOutName))) {
writableByteChannel = Channels.newChannel(zipOutputStream);
File source = new File(fileNames);
zipOutputStream.putNextEntry(new ZipEntry(source.getName()));
fileInputStream = new FileInputStream(fileNames);
fileChannel = fileInputStream.getChannel();
while (fileChannel.read(buffer) != -1) {
//更新缓存区位置
buffer.flip();
while (buffer.hasRemaining()) {
writableByteChannel.write(buffer);
}
buffer.rewind();
}
fileChannel.close();
log.info("文件压缩成功");
} catch (Exception e) {
log.error("batchZipFiles error fileNames:");
} finally {
IOUtils.closeQuietly(writableByteChannel);
IOUtils.closeQuietly(fileChannel);
IOUtils.closeQuietly(fileInputStream);
buffer.clear();
}
}
// 删除生成的 mp3 文件
@Override
public void deleteFiles(String sourceFile) {
// 检查文件路径是否为空
if (sourceFile == null || sourceFile.isEmpty()) {
log.error("文件路径为空");
}
File file = new File(sourceFile);
// 检查文件是否存在
if (!file.exists()) {
log.error("文件不存在:" + sourceFile);
}
// 检查是否是文件
if (!file.isFile()) {
log.error("路径指向的不是文件:" + sourceFile);
}
// 尝试删除文件
if (file.delete()) {
log.error("文件删除成功:" + sourceFile);
} else {
log.error("文件删除失败:" + sourceFile);
}
}
}
@@ -0,0 +1,68 @@
package com.cf.imes.module.executor.util.file;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 文件读取监听
*/
public class ExcelListener<T> extends AnalysisEventListener<T> {
/**
* 自定义用于暂时存储data
* 可以通过实例获取该值
*/
private List<T> dates = new ArrayList<>();
private boolean flag = true;
private Map<Integer, String> valueMap = new HashMap<>();
@Override
public void invoke(T t, AnalysisContext analysisContext) {
// todo invoke
}
/**
* 读取完后操作
*
* @param context
*/
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
// todo doAfterAllAnalysed
}
/**
* 返回数据
*
* @return 返回读取的数据集合
**/
public List<T> getDates() {
return dates;
}
/**
* 返回读取结果
*
* @return 是否读取成功
**/
public boolean getFlag() {
return flag;
}
/**
* 返回错误信息
*
* @return String
**/
public Map<Integer, String> getValueMap() {
return valueMap;
}
}
@@ -0,0 +1,48 @@
package com.cf.imes.module.executor.util.file;
import com.alibaba.excel.EasyExcelFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
* 文件读取
*/
@Slf4j
public final class ExcelReadUtil{
private String value;
private boolean flag;
public <T> List<T> read(MultipartFile file, Class<T> head, ExcelListener<T> listener) throws IOException {
value = "";
Long fileSize = 1024 * 1024 * 10L; // 10 MB
flag = FileHelperUtil.checkFile(file, fileSize);
if (flag) {
EasyExcelFactory.read(file.getInputStream(), head, listener)
.autoCloseStream(true) // 不要自动关闭,交给 Servlet 自己处理
.headRowNumber(1).sheet(0).doRead();
//获取读取的数据
List<T> list = listener.getDates();
flag = listener.getFlag();
if (!flag) {
value = "导入数据有误";
}
return list;
}
return new ArrayList<>();
}
public String getValue() {
return value;
}
public boolean getFlag() {
return flag;
}
}
@@ -0,0 +1,65 @@
package com.cf.imes.module.executor.util.file;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URLEncoder;
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.cf.imes.module.infra.enums.ErrorCodeConstants.FILE_NOT_EXISTS;
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
/**
* 文件相关工具类
*/
public class FileHelperUtil {
// 文件下载
public static void getFile(String route, HttpServletResponse response, String value) {
// path是指想要下载的文件的路径
File file = new File(route + File.separator + value);
// 获取文件名
String filename = file.getName();
// 将文件写入输入流
try (FileInputStream fis = new FileInputStream(file)) {
byte[] buffer = new byte[fis.available()];
fis.read(buffer);
fis.close();
response.reset();
response.setCharacterEncoding("UTF-8");
response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(filename, "UTF-8"));
response.addHeader("Content-Length", "" + file.length());
OutputStream outputStream = new BufferedOutputStream(response.getOutputStream());
response.setContentType("application/octet-stream");
outputStream.write(buffer);
outputStream.flush();
} catch (IOException ex) {
throw exception(FILE_NOT_EXISTS);
}
}
// 文件条件判断
public static boolean checkFile(MultipartFile file,
Long fileSize) {
if (file.isEmpty()) {
throw exception(FILE_NULL);
}
if (!(file.getOriginalFilename().endsWith(".xlsx") || file.getOriginalFilename().endsWith(".xls"))) {
throw exception(FILE_FORMAT_ERROR);
}
if (file.getSize() > fileSize) {
throw exception(FILE_EXCEED_SIZE);
}
if (file.getSize() == 0) {
throw exception(FILE_CONTENT_NULL);
}
return true;
}
}
@@ -0,0 +1,42 @@
package com.cf.imes.module.executor.util.number;
import org.springframework.stereotype.Component;
/**
* 数据处理相关工具类
*/
@Component
public class NumberHelperUtil {
public Double[] compareLength(Double[] numbers) {
if (numbers == null || numbers.length < 2) {
return numbers; // 如果数组为空或长度不足2,直接返回原数组
}
Double min = numbers[0];
Double max = numbers[1];
// 检查前值和后值是否都为null或小于等于0
if ((min == null || min <= 0) && (max == null || max <= 0)) {
return new Double[]{null, null}; // 忽略该字段
}
// 只输入前值,不输入后值
if (max == null || max <= 0) {
return new Double[]{min, null};
}
// 不输入前值,只输入后值
if (min == null || min <= 0) {
return new Double[]{null, max};
}
// 前值和后值都输入,且前值大于后值,则前值和后值交换
if (min > max) {
return new Double[]{max, min};
}
return new Double[]{min, max};
}
}
@@ -0,0 +1,27 @@
package com.cf.imes.module.executor.validation.manage.common;
import com.cf.imes.module.executor.enums.manage.remainPlate.RemainPlateStatusEnum;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
/**
* 状态校验
*/
public class CommonStatusValidator implements ConstraintValidator<ValidCommonStatus, Integer> {
private ValidCommonStatus annotation;
@Override
public void initialize(ValidCommonStatus constraintAnnotation) {
this.annotation = constraintAnnotation;
}
@Override
public boolean isValid(Integer value, ConstraintValidatorContext context) {
if (value == null) {
value = RemainPlateStatusEnum.UNUSED.getStatus(); // 默认值为未使用
}
return value == RemainPlateStatusEnum.UNUSED.getStatus() || value == RemainPlateStatusEnum.USED.getStatus();
}
}
@@ -0,0 +1,24 @@
package com.cf.imes.module.executor.validation.manage.common;
import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* 状态校验注解
*/
@Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = CommonStatusValidator.class)
@Documented
public @interface ValidCommonStatus {
String message() default "状态值必须为 0:未使用、1:已使用 ";
Class<?>[] groups() default {};
Class<? extends Payload>[] payload() default {};
}
@@ -0,0 +1,33 @@
package com.cf.imes.module.executor.validation.manage.pack;
import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author 打包状态校验注解
*/
@Target({
ElementType.FIELD,
})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Constraint(
validatedBy = {OrderPackagedValidator.class}
)
public @interface OrderPackagedStatusValid {
String message() default "打包状态不合法";
Class<?>[] groups() default {};
Class<? extends Payload>[] payload() default {};
}
@@ -0,0 +1,30 @@
package com.cf.imes.module.executor.validation.manage.pack;
import cn.hutool.core.util.ObjectUtil;
import com.cf.imes.framework.common.enums.OrderPackageStatusEnum;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
/**
* @author 打包状态校验器
*/
public class OrderPackagedValidator implements ConstraintValidator<OrderPackagedStatusValid, Integer> {
@Override
public boolean isValid(Integer value, ConstraintValidatorContext constraintValidatorContext) {
if (ObjectUtil.isNull(value)) {
return true;
}
for (OrderPackageStatusEnum statusEnum : OrderPackageStatusEnum.values()) {
if (ObjectUtil.equal(statusEnum.getStatus(), value)) {
return true;
}
}
return false;
}
}
@@ -0,0 +1,33 @@
package com.cf.imes.module.executor.validation.manage.pack;
import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author 包裹类型校验注解
*/
@Target({
ElementType.FIELD,
})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Constraint(
validatedBy = {PackTypeValidator.class}
)
public @interface PackTypeValid {
String message() default "包裹类型不合法";
Class<?>[] groups() default {};
Class<? extends Payload>[] payload() default {};
}
@@ -0,0 +1,31 @@
package com.cf.imes.module.executor.validation.manage.pack;
import cn.hutool.core.util.ObjectUtil;
import com.cf.imes.framework.common.enums.OrderPackageTypeEnum;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
/**
* @author 包裹类型校验器
*/
public class PackTypeValidator implements ConstraintValidator<PackTypeValid, Integer> {
@Override
public boolean isValid(Integer value, ConstraintValidatorContext constraintValidatorContext) {
if (ObjectUtil.isNull(value)) {
return true;
}
for (OrderPackageTypeEnum typeEnum : OrderPackageTypeEnum.values()) {
if (ObjectUtil.equal(typeEnum.getType(), value)) {
return true;
}
}
return false;
}
}

Some files were not shown because too many files have changed in this diff Show More