生产单新增

This commit is contained in:
lym
2024-03-22 10:34:21 +08:00
parent 141b6cfe28
commit 2148065876
66 changed files with 1663 additions and 432 deletions
@@ -44,5 +44,5 @@ public interface ErrorCodeConstants {
ErrorCode CUSTOM_ORDER_EXISTS = new ErrorCode(1_001_117_000, "自定义生产单号存在"); ErrorCode CUSTOM_ORDER_EXISTS = new ErrorCode(1_001_117_000, "自定义生产单号存在");
ErrorCode SALESMAN_ORDER_NOT_EXISTS = new ErrorCode(1_001_118_000, "业务员不存在"); ErrorCode SALESMAN_ORDER_NOT_EXISTS = new ErrorCode(1_001_118_000, "业务员不存在");
ErrorCode SPLITTER_ORDER_NOT_EXISTS = new ErrorCode(1_001_119_000, "拆单员不存在"); ErrorCode SPLITTER_ORDER_NOT_EXISTS = new ErrorCode(1_001_119_000, "拆单员不存在");
ErrorCode ORDER_IMPORT_FAIL = new ErrorCode(1_001_119_000, "生产单导入错误");
} }
@@ -1,7 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>com.cf.imes</groupId> <groupId>com.cf.imes</groupId>
@@ -10,28 +7,24 @@
</parent> </parent>
<packaging>jar</packaging> <packaging>jar</packaging>
<artifactId>cf-module-prod-executor-biz</artifactId> <artifactId>cf-module-prod-executor-biz</artifactId>
<properties> <properties>
<maven.compiler.source>17</maven.compiler.source> <maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target> <maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<dependencies> <dependencies>
<!-- Spring Cloud 基础 --> <!-- Spring Cloud 基础 -->
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bootstrap</artifactId> <artifactId>spring-cloud-starter-bootstrap</artifactId>
</dependency> </dependency>
<!-- 依赖服务 -->
<!-- 依赖服务 -->
<dependency> <dependency>
<groupId>com.cf.imes</groupId> <groupId>com.cf.imes</groupId>
<artifactId>cf-module-prod-executor-api</artifactId> <artifactId>cf-module-prod-executor-api</artifactId>
<version>${revision}</version> <version>${revision}</version>
</dependency> </dependency>
<!-- 业务组件 -->
<!-- 业务组件 -->
<dependency> <dependency>
<groupId>com.cf.imes</groupId> <groupId>com.cf.imes</groupId>
<artifactId>cf-spring-boot-starter-banner</artifactId> <artifactId>cf-spring-boot-starter-banner</artifactId>
@@ -48,92 +41,92 @@
<groupId>com.cf.imes</groupId> <groupId>com.cf.imes</groupId>
<artifactId>cf-spring-boot-starter-biz-error-code</artifactId> <artifactId>cf-spring-boot-starter-biz-error-code</artifactId>
</dependency> </dependency>
<!-- Web 相关 -->
<!-- Web 相关 -->
<dependency> <dependency>
<groupId>com.cf.imes</groupId> <groupId>com.cf.imes</groupId>
<artifactId>cf-spring-boot-starter-security</artifactId> <artifactId>cf-spring-boot-starter-security</artifactId>
</dependency> </dependency>
<!-- DB 相关 -->
<!-- <dependency>
<!-- DB 相关 --> <groupId>org.apache.shardingsphere</groupId>
<!-- <dependency> <artifactId>sharding-jdbc-spring-boot-starter</artifactId>
<groupId>org.apache.shardingsphere</groupId> <version>4.1.0</version>
<artifactId>sharding-jdbc-spring-boot-starter</artifactId> </dependency>
<version>4.1.0</version> -->
</dependency>
-->
<dependency> <dependency>
<groupId>com.cf.imes</groupId> <groupId>com.cf.imes</groupId>
<artifactId>cf-spring-boot-starter-mybatis</artifactId> <artifactId>cf-spring-boot-starter-mybatis</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.cf.imes</groupId> <groupId>com.cf.imes</groupId>
<artifactId>cf-spring-boot-starter-redis</artifactId> <artifactId>cf-spring-boot-starter-redis</artifactId>
</dependency> </dependency>
<!-- RPC 远程调用相关 -->
<!-- RPC 远程调用相关 -->
<dependency> <dependency>
<groupId>com.cf.imes</groupId> <groupId>com.cf.imes</groupId>
<artifactId>cf-spring-boot-starter-rpc</artifactId> <artifactId>cf-spring-boot-starter-rpc</artifactId>
</dependency> </dependency>
<!-- Registry 注册中心相关 -->
<!-- Registry 注册中心相关 -->
<dependency> <dependency>
<groupId>com.alibaba.cloud</groupId> <groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency> </dependency>
<!-- Config 配置中心相关 -->
<!-- Config 配置中心相关 -->
<dependency> <dependency>
<groupId>com.alibaba.cloud</groupId> <groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency> </dependency>
<!-- Test 测试相关 -->
<!-- Test 测试相关 -->
<dependency> <dependency>
<groupId>com.cf.imes</groupId> <groupId>com.cf.imes</groupId>
<artifactId>cf-spring-boot-starter-test</artifactId> <artifactId>cf-spring-boot-starter-test</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<!-- 工具类相关 -->
<!-- 工具类相关 -->
<dependency> <dependency>
<groupId>com.cf.imes</groupId> <groupId>com.cf.imes</groupId>
<artifactId>cf-spring-boot-starter-excel</artifactId> <artifactId>cf-spring-boot-starter-excel</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>cn.smallbun.screw</groupId> <groupId>cn.smallbun.screw</groupId>
<artifactId>screw-core</artifactId> <!-- 实现数据库文档 --> <artifactId>screw-core</artifactId>
<!-- 实现数据库文档 -->
</dependency> </dependency>
<!-- 监控相关 -->
<!-- 监控相关 -->
<dependency> <dependency>
<groupId>com.cf.imes</groupId> <groupId>com.cf.imes</groupId>
<artifactId>cf-spring-boot-starter-monitor</artifactId> <artifactId>cf-spring-boot-starter-monitor</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>de.codecentric</groupId> <groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-server</artifactId> <!-- 实现 Spring Boot Admin Server 服务端 --> <artifactId>spring-boot-admin-starter-server</artifactId>
<!-- 实现 Spring Boot Admin Server 服务端 -->
</dependency> </dependency>
<!-- 三方云服务相关 -->
<!-- 三方云服务相关 -->
<dependency> <dependency>
<groupId>com.cf.imes</groupId> <groupId>com.cf.imes</groupId>
<artifactId>cf-spring-boot-starter-file</artifactId> <artifactId>cf-spring-boot-starter-file</artifactId>
</dependency> </dependency>
<dependency>
<groupId>io.vavr</groupId>
<artifactId>vavr</artifactId>
<version>0.10.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy</artifactId>
</dependency>
<dependency>
<groupId>com.cf.imes</groupId>
<artifactId>cf-spring-boot-starter-biz-data-permission</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>
<!-- 设置构建的 jar 包名 --> <!-- 设置构建的 jar 包名 -->
<finalName>${project.artifactId}</finalName> <finalName>${project.artifactId}</finalName>
<plugins> <plugins>
<!-- 打包 --> <!-- 打包 -->
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
@@ -141,12 +134,12 @@
<executions> <executions>
<execution> <execution>
<goals> <goals>
<goal>repackage</goal> <!-- 将引入的 jar 打入其中 --> <goal>repackage</goal>
<!-- 将引入的 jar 打入其中 -->
</goals> </goals>
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
</project> </project>
@@ -1,9 +1,7 @@
package com.cf.imes.module.executor.controller.admin.order; package com.cf.imes.module.executor.controller.admin.order;
import com.cf.imes.module.executor.controller.admin.order.vo.order.*; import com.cf.imes.module.executor.controller.admin.order.vo.order.*;
import com.cf.imes.module.executor.util.OrderExcelUtil;
import io.swagger.v3.oas.annotations.Parameters; import io.swagger.v3.oas.annotations.Parameters;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ResourceUtils; import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@@ -18,7 +16,6 @@ import io.swagger.v3.oas.annotations.Operation;
import javax.validation.*; import javax.validation.*;
import javax.servlet.http.*; import javax.servlet.http.*;
import java.io.*; import java.io.*;
import java.math.BigDecimal;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.*; import java.util.*;
@@ -39,7 +36,6 @@ import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
import com.cf.imes.module.executor.service.order.OrderService; import com.cf.imes.module.executor.service.order.OrderService;
import org.springframework.http.*;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@@ -155,24 +151,31 @@ public class OrderController {
} }
@PostMapping("/import") @PostMapping("/import")
@Operation(summary = "导入生产单") @Operation(summary = "导入生产单新增")
@Parameters({ @Parameters({
@Parameter(name = "file", description = "Excel 文件", required = true), @Parameter(name = "file", description = "Excel 文件", required = true),
@Parameter(name = "updateSupport", description = "是否支持更新,默认为 false", example = "true"), @Parameter(name = "updateSupport", description = "是否支持更新,默认为 false", example = "true"),
@Parameter(name = "upload", description = "是否上传表头、表体(1,只上传表头;2,包含板材信息", required = true) @Parameter(name = "upload", description = "是否上传表头,默认为只上传表头", example = "true")
}) })
@PreAuthorize("@ss.hasPermission('system:user:import')") @PreAuthorize("@ss.hasPermission('executor:order:import')")
public void importExcel(@RequestParam("file") MultipartFile file, public CommonResult<OrderImportRespVO> importExcel(@RequestPart("file") MultipartFile file,
@RequestParam(value = "updateSupport", required = false, defaultValue = "false") Boolean updateSupport, @RequestParam(value = "upload", required = false, defaultValue = "true") Boolean upload,
@RequestParam(value = "upload") int upload, @RequestPart("orderSaveReqVO") OrderSaveReqVO createReqVO) throws IOException {
@Valid @RequestBody OrderSaveReqVO createReqVO) throws Exception {
success(orderService.createOrder(createReqVO));
// 有板材,返回包含金额,出现错误进行上传
if (upload == 2) {
// BigDecimal money = orderService.importOrderList(file, updateSupport , updateSupport);
}
return; OrderImportRespVO orderImportRespVO = orderService.importOrderList(upload , file, createReqVO);
return success(orderImportRespVO);
} }
//生产单信息修改
@PostMapping("/addPlates")
@Operation(summary = "生产单添加板材")
@Parameters({
@Parameter(name = "id", description = "编号", required = true, example = "1024")
})
@PreAuthorize("@ss.hasPermission('executor:order:update')")
public CommonResult updateOrder(@RequestParam("id") Long id,
@RequestPart("file") MultipartFile file){
// orderService.updateOrder(updateReq);
return null;
}
} }
@@ -1,51 +0,0 @@
package com.cf.imes.module.executor.controller.admin.order.vo.order;
import com.alibaba.excel.annotation.ExcelProperty;
import com.cf.imes.framework.excel.core.annotations.DictFormat;
import com.cf.imes.module.system.enums.DictTypeConstants;
import lombok.*;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
/**
* 生产单 Excel 导入 VO
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = false) // 设置 chain = false,避免生产单导入有问
public class OrderImportExcelVO {
@ExcelProperty("自定义单号")
private String customOrderNo;
@ExcelProperty("客户")
private String customer;
@ExcelProperty("经销商")
private String dealer;
@ExcelProperty(value = "客户地址")
private String address;
@ExcelProperty(value = "经销商电话")
private String dealerPhoneNumber;
@ExcelProperty(value = "客户电话")
private String phoneNumber;
@ExcelProperty(value = "业务员")
private String salesman;
@ExcelProperty(value = "交付日期")
private LocalDateTime deliveryDate;
@ExcelProperty(value = "拆单员")
private String splitter;
@ExcelProperty(value = "备注")
private List<String> remarkLists;
}
@@ -17,11 +17,11 @@ import java.util.Map;
@Builder @Builder
public class OrderImportRespVO { public class OrderImportRespVO {
@Schema(description = "创建成功的生产单名数组", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "创建成功的生产单名数组", requiredMode = Schema.RequiredMode.REQUIRED)
private List<String> createUsernames; private List<String> createOrder;
@Schema(description = "更新成功的生产单名数组", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "更新成功的生产单名数组", requiredMode = Schema.RequiredMode.REQUIRED)
private List<String> updateUsernames; private List<String> updateOrder;
@Schema(description = "导入失败的生产单集合,key 为生产单名,value 为失败原因", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "导入失败的生产单集合,key 为生产单名,value 为失败原因", requiredMode = Schema.RequiredMode.REQUIRED)
private Map<String, String> failureUsernames; private Map<String, String> failureOrder;
} }
@@ -31,10 +31,10 @@ public class OrderPageReqVO extends PageParam {
private Integer sort; private Integer sort;
@Schema(description = "CAD数据类型,1CAD 2WebCAD 3Excel", example = "1") @Schema(description = "CAD数据类型,1CAD 2WebCAD 3Excel", example = "1")
private Boolean dataType; private Integer dataType;
@Schema(description = "订单状态,0未排单1已排单2生产中3加工完成4打包完成5入库完成6出库完成", example = "1") @Schema(description = "订单状态,0未排单1已排单2生产中3加工完成4打包完成5入库完成6出库完成", example = "1")
private Boolean status; private Integer status;
@Schema(description = "自定义单号") @Schema(description = "自定义单号")
private String customOrderNo; private String customOrderNo;
@@ -1,8 +1,8 @@
package com.cf.imes.module.executor.controller.admin.order.vo.order; package com.cf.imes.module.executor.controller.admin.order.vo.order;
import com.cf.imes.framework.excel.core.annotations.DictFormat;
import com.cf.imes.module.system.enums.DictTypeConstants;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
@@ -21,95 +21,124 @@ import java.math.BigDecimal;
@Accessors(chain = false) // 设置 chain = false,避免生产单导入有问 @Accessors(chain = false) // 设置 chain = false,避免生产单导入有问
public class OrderPlateImportExcelVO { public class OrderPlateImportExcelVO {
@ExcelProperty(value = "序号") @ExcelProperty(value = "序号")
@JsonIgnore
private int ordinal; private int ordinal;
@ExcelProperty(value = "类型") @ExcelProperty(value = "类型")
private String type; @JsonIgnore
private String goodType;
@ExcelProperty(value = "物料编码") @ExcelProperty(value = "物料编码")
private String rawGoodsId; @JsonIgnore
private String goodsId;
@ExcelProperty(value = "商品名称") @ExcelProperty(value = "商品名称")
@JsonIgnore
private String goodsName; private String goodsName;
@ExcelProperty(value = "材质") @ExcelProperty(value = "材质")
@JsonIgnore
private String material; private String material;
@ExcelProperty(value = "颜色") @ExcelProperty(value = "颜色")
@JsonIgnore
private String color; private String color;
@ExcelProperty(value = "厂家") @ExcelProperty(value = "厂家")
@JsonIgnore
private String factory; private String factory;
@ExcelProperty(value = "品牌") @ExcelProperty(value = "品牌")
@JsonIgnore
private String brand; private String brand;
@ExcelProperty(value = "规格")
private String goodsModel;
@ExcelProperty(value = "型号") @ExcelProperty(value = "型号")
private String goodsSpecs; @JsonIgnore
private String model;
@ExcelProperty(value = "规格")
@JsonIgnore
private String spec;
@ExcelProperty(value = "单位") @ExcelProperty(value = "单位")
private String goodsUnit; @JsonIgnore
private String unit;
@ExcelProperty(value = "数量") @ExcelProperty(value = "数量")
private BigDecimal goodsNumber; @JsonIgnore
private Double goodsNumber;
@ExcelProperty(value = "房间") @ExcelProperty(value = "房间")
@JsonIgnore
private String roomsName; private String roomsName;
@ExcelProperty(value = "柜体") @ExcelProperty(value = "柜体")
@JsonIgnore
private String cabinetsName; private String cabinetsName;
@ExcelProperty(value = "板名称") @ExcelProperty(value = "板名称")
private String platesName; @JsonIgnore
private String name;
@ExcelProperty(value = "板号") @ExcelProperty(value = "板号")
private String platesNumber; @JsonIgnore
private String plateNo;
@ExcelProperty(value = "成品长") @ExcelProperty(value = "成品长")
private BigDecimal productLength; @JsonIgnore
private BigDecimal height;
@ExcelProperty(value = "成品宽") @ExcelProperty(value = "成品宽")
private BigDecimal productWidth; @JsonIgnore
private BigDecimal width;
@ExcelProperty(value = "开料长") @ExcelProperty(value = "开料长")
private BigDecimal actualLength; @JsonIgnore
private BigDecimal splitHeight;
@ExcelProperty(value = "开料宽") @ExcelProperty(value = "开料宽")
private BigDecimal actualWidth; @JsonIgnore
private BigDecimal splitWidth;
@ExcelProperty(value = "") @ExcelProperty(value = "")
private BigDecimal thickness; @JsonIgnore
private BigDecimal splitThickness;
@ExcelProperty(value = "左封边") @ExcelProperty(value = "左封边")
@JsonIgnore
private BigDecimal sealLeft; private BigDecimal sealLeft;
@ExcelProperty(value = "右封边") @ExcelProperty(value = "右封边")
@JsonIgnore
private BigDecimal sealRight; private BigDecimal sealRight;
@ExcelProperty(value = "上封边") @ExcelProperty(value = "上封边")
private BigDecimal sealAbove; @JsonIgnore
private BigDecimal sealUp;
@ExcelProperty(value = "下封边") @ExcelProperty(value = "下封边")
private BigDecimal sealUnder; @JsonIgnore
private BigDecimal sealDown;
@ExcelProperty(value = "组合类型") @ExcelProperty(value = "组合类型")
@JsonIgnore
private String synthesis; private String synthesis;
@ExcelProperty(value = "组合名称") @ExcelProperty(value = "组合名称")
@JsonIgnore
private String combinationName; private String combinationName;
@ExcelProperty(value = "排版面") @ExcelProperty(value = "排版面")
@JsonIgnore
private int typographicFace; private int typographicFace;
@ExcelProperty(value = "纹路") @ExcelProperty(value = "纹路")
private int grain; @JsonIgnore
private int texture;
@ExcelProperty(value = "开门方向") @ExcelProperty(value = "开门方向")
@DictFormat(DictTypeConstants.USER_SEX) @JsonIgnore
private int openingDirections; private int openDoorType;
@ExcelProperty(value = "备注1") @ExcelProperty(value = "备注1")
private String remark1; private String remark1;
@@ -141,4 +170,63 @@ public class OrderPlateImportExcelVO {
@ExcelProperty(value = "备注10") @ExcelProperty(value = "备注10")
private String remark10; private String remark10;
@ExcelProperty(value = "备注")
@JsonIgnore
private String remark = remarkJSON();
@JsonIgnore
private Long id;
@JsonIgnore
public boolean isValidParts() {
return (isNonEmpty(goodsId) || isNonEmpty(goodsName)) && (goodsNumber != null && goodsNumber> 0) && (isNonEmpty(model) || isNonEmpty(spec));
}
@JsonIgnore
public boolean isValidRawGoods() {
isSynthesis(synthesis);
return (isNonEmpty(goodsId) || isNonEmpty(goodsName) || isNonEmpty(material) || isNonEmpty(color) || isNonEmpty(spec)) &&
(goodsNumber != null && goodsNumber> 0) &&
((height != null && height.compareTo(BigDecimal.ZERO)> 0 && width != null && width.compareTo(BigDecimal.ZERO) > 0) ||
(splitHeight != null && splitHeight.compareTo(BigDecimal.ZERO) > 0 && splitWidth != null && splitWidth.compareTo(BigDecimal.ZERO) > 0)) &&
sealLeft != null && sealLeft .compareTo(BigDecimal.ZERO)> 0 &&
sealRight != null && sealRight .compareTo(BigDecimal.ZERO)> 0 &&
sealUp != null && sealUp .compareTo(BigDecimal.ZERO)> 0 &&
sealDown != null && sealDown .compareTo(BigDecimal.ZERO)> 0 ;
}
private boolean isNonEmpty(String value) {
return value != null && !value.trim().isEmpty();
}
private String isSynthesis(String value) {
if (value == null || value.trim().isEmpty()) {
return "柜体";
}
return value;
}
//使用字典
//判断类型,首先存在 板材、配件、组件、生产耗材、其他;
//排版面判断 0正面,1反面,2随意面;
//纹路判断 0正纹,1可翻转(无纹),2反纹;
//开门方向判断 0柜体板(非门板),1左开,2右开,3上翻,4下翻;
//备注转json数据
public String remarkJSON(){
ObjectMapper objectMapper = new ObjectMapper();
// 设置实体类字段的值
try {
String json = objectMapper.writeValueAsString(this);
return json;
} catch (Exception e) {
e.printStackTrace();
return "{}";
}
}
} }
@@ -37,11 +37,11 @@ public class OrderRespVO {
@Schema(description = "CAD数据类型,1CAD 2WebCAD 3Excel", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") @Schema(description = "CAD数据类型,1CAD 2WebCAD 3Excel", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty("CAD数据类型,1CAD 2WebCAD 3Excel") @ExcelProperty("CAD数据类型,1CAD 2WebCAD 3Excel")
private Boolean dataType; private Integer dataType;
@Schema(description = "订单状态,0未排单1已排单2生产中3加工完成4打包完成5入库完成6出库完成", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") @Schema(description = "订单状态,0未排单1已排单2生产中3加工完成4打包完成5入库完成6出库完成", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty("订单状态,0未排单1已排单2生产中3加工完成4打包完成5入库完成6出库完成") @ExcelProperty("订单状态,0未排单1已排单2生产中3加工完成4打包完成5入库完成6出库完成")
private Boolean status; private Integer status;
@Schema(description = "自定义单号", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "自定义单号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("自定义单号") @ExcelProperty("自定义单号")
@@ -34,11 +34,11 @@ public class OrderSaveReqVO {
@Schema(description = "CAD数据类型,1CAD 2WebCAD 3Excel", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") @Schema(description = "CAD数据类型,1CAD 2WebCAD 3Excel", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "CAD数据类型,1CAD 2WebCAD 3Excel不能为空") @NotNull(message = "CAD数据类型,1CAD 2WebCAD 3Excel不能为空")
private Boolean dataType; private Integer dataType;
@Schema(description = "订单状态,0未排单1已排单2生产中3加工完成4打包完成5入库完成6出库完成", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") @Schema(description = "订单状态,0未排单1已排单2生产中3加工完成4打包完成5入库完成6出库完成", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "订单状态,0未排单1已排单2生产中3加工完成4打包完成5入库完成6出库完成不能为空") @NotNull(message = "订单状态,0未排单1已排单2生产中3加工完成4打包完成5入库完成6出库完成不能为空")
private Boolean status; private Integer status;
@Schema(description = "自定义单号", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "自定义单号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "自定义单号不能为空") @NotEmpty(message = "自定义单号不能为空")
@@ -0,0 +1,24 @@
package com.cf.imes.module.executor.controller.admin.orderParts.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
import lombok.Data;
import org.apache.poi.ss.formula.functions.T;
import java.util.List;
import java.util.Map;
@Schema(description = "管理后台 - 生产配件导入 Response VO")
@Data
@Builder
public class OrderPartsImportRespVO {
@Schema(description = "创建成功的生产配件数组", requiredMode = Schema.RequiredMode.REQUIRED)
private List< OrderPartsSaveReqVO> createOrderParts;
@Schema(description = "更新成功的生产配件数组", requiredMode = Schema.RequiredMode.REQUIRED)
private List<String> updateOrderParts;
@Schema(description = "导入失败的生产配件集合,key 为生产单名,value 为失败原因", requiredMode = Schema.RequiredMode.REQUIRED)
private Map<String, String> failureOrderParts;
}
@@ -16,7 +16,7 @@ import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH
public class OrderPartsPageReqVO extends PageParam { public class OrderPartsPageReqVO extends PageParam {
@Schema(description = "生产单号") @Schema(description = "生产单号")
private Long orderNo; private Long orderId;
@Schema(description = "商品ID", example = "1195") @Schema(description = "商品ID", example = "1195")
private String goodsId; private String goodsId;
@@ -19,7 +19,7 @@ public class OrderPartsRespVO {
@Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("生产单号") @ExcelProperty("生产单号")
private Long orderNo; private Long orderId;
@Schema(description = "商品ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1195") @Schema(description = "商品ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1195")
@ExcelProperty("商品ID") @ExcelProperty("商品ID")
@@ -14,7 +14,7 @@ public class OrderPartsSaveReqVO {
@Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "生产单号不能为空") @NotNull(message = "生产单号不能为空")
private Long orderNo; private Long orderId;
@Schema(description = "商品ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1195") @Schema(description = "商品ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1195")
@NotNull(message = "商品ID不能为空") @NotNull(message = "商品ID不能为空")
@@ -0,0 +1,22 @@
package com.cf.imes.module.executor.controller.admin.plate.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
import lombok.Data;
import java.util.List;
import java.util.Map;
@Schema(description = "管理后台 - 生产小板导入 Response VO")
@Data
@Builder
public class PlateImportRespVO {
@Schema(description = "创建成功的生产小板数组", requiredMode = Schema.RequiredMode.REQUIRED)
private List<PlateSaveReqVO> createPlates;
@Schema(description = "更新成功的生产小板数组", requiredMode = Schema.RequiredMode.REQUIRED)
private List<String> updatePlates;
@Schema(description = "导入失败的生产小板集合,key 为生产单名,value 为失败原因", requiredMode = Schema.RequiredMode.REQUIRED)
private Map<String, String> failurePlates;
}
@@ -4,6 +4,7 @@ import lombok.*;
import java.util.*; import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import com.cf.imes.framework.common.pojo.PageParam; import com.cf.imes.framework.common.pojo.PageParam;
import java.math.BigDecimal;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@@ -15,50 +16,53 @@ import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH
@ToString(callSuper = true) @ToString(callSuper = true)
public class PlatePageReqVO extends PageParam { public class PlatePageReqVO extends PageParam {
@Schema(description = "生产单号", example = "17851") @Schema(description = "生产单号", example = "11087")
private Long orderId; private Long orderId;
@Schema(description = "板名称", example = "李四") @Schema(description = "板名称", example = "晨丰")
private String name; private String name;
@Schema(description = "板类型,0 层板 1 立板 2 背板", example = "2") @Schema(description = "自定义板编号,设计有板编号,则保留设计板编号;设计没有且在机台设置中设置了自定义板编号规则,则按规则自动生成")
private String plateNo;
@Schema(description = "板类型,0 层板 1 立板 2 背板", example = "1")
private Integer type; private Integer type;
@Schema(description = "商品 ID", example = "28756") @Schema(description = "商品 ID", example = "14195")
private String goodsId; private String goodsId;
@Schema(description = "宽度") @Schema(description = "宽度")
private Double width; private BigDecimal width;
@Schema(description = "高度") @Schema(description = "高度")
private Double height; private BigDecimal height;
@Schema(description = "厚度") @Schema(description = "厚度")
private Double thickness; private BigDecimal thickness;
@Schema(description = "拆单宽度") @Schema(description = "拆单宽度")
private Double splitWidth; private BigDecimal splitWidth;
@Schema(description = "拆单高度") @Schema(description = "拆单高度")
private Double splitHeight; private BigDecimal splitHeight;
@Schema(description = "拆单厚度") @Schema(description = "拆单厚度")
private Double splitThickness; private BigDecimal splitThickness;
@Schema(description = "左封边厚度") @Schema(description = "左封边厚度")
private Double sealLeft; private BigDecimal sealLeft;
@Schema(description = "右封边厚度") @Schema(description = "右封边厚度")
private Double sealRight; private BigDecimal sealRight;
@Schema(description = "上封边厚度") @Schema(description = "上封边厚度")
private Double sealUp; private BigDecimal sealUp;
@Schema(description = "下封边厚度") @Schema(description = "下封边厚度")
private Double sealDown; private BigDecimal sealDown;
@Schema(description = "面积") @Schema(description = "面积")
private Double area; private BigDecimal area;
@Schema(description = "纹路类型,0 正纹 1 可翻转 2 反纹") @Schema(description = "纹路类型,0 正纹 1 可翻转 2 反纹")
private Integer texture; private Integer texture;
@@ -69,29 +73,29 @@ public class PlatePageReqVO extends PageParam {
@Schema(description = "排孔类型,0 正纹 1 反面 2 随意面") @Schema(description = "排孔类型,0 正纹 1 反面 2 随意面")
private Integer holeArrange; private Integer holeArrange;
@Schema(description = "异型孔数量", example = "32490") @Schema(description = "异型孔数量", example = "28477")
private Short unregularPointCount; private Short unregularPointCount;
@Schema(description = "正面孔数量", example = "4077") @Schema(description = "正面孔数量", example = "20823")
private Short frontHoleCount; private Short frontHoleCount;
@Schema(description = "背面孔数量", example = "2405") @Schema(description = "背面孔数量", example = "3441")
private Short backHoleCount; private Short backHoleCount;
@Schema(description = "侧面孔数量", example = "1493") @Schema(description = "侧面孔数量", example = "25509")
private Short sideHoleCount; private Short sideHoleCount;
@Schema(description = "正面造型量", example = "23489") @Schema(description = "正面造型量", example = "31547")
private Short frontModelCount; private Short frontModelCount;
@Schema(description = "背面造型量", example = "5176") @Schema(description = "背面造型量", example = "26725")
private Short backModelCount; private Short backModelCount;
@Schema(description = "是否门板") @Schema(description = "是否门板")
private Boolean isDoor; private Boolean isDoor;
@Schema(description = "开门类型,0 无 1 左 2 右 3 上 4 下", example = "2") @Schema(description = "开门类型,0 无 1 左 2 右 3 上 4 下", example = "2")
private Boolean openDoorType; private Integer openDoorType;
@Schema(description = "异型偏移 x") @Schema(description = "异型偏移 x")
private Double offsetX; private Double offsetX;
@@ -102,15 +106,18 @@ public class PlatePageReqVO extends PageParam {
@Schema(description = "是否孤形对角") @Schema(description = "是否孤形对角")
private Boolean isArcAcross; private Boolean isArcAcross;
@Schema(description = "模块类型 ID", example = "15992") @Schema(description = "模块类型 ID", example = "12800")
private Long moduleTypeId; private Long moduleTypeId;
@Schema(description = "排单过滤类型,1 有挖穿造型 2 有挖穿孔 4 有二维刀路 8 可叠", example = "1") @Schema(description = "排单过滤类型,1 有挖穿造型 2 有挖穿孔 4 有二维刀路 8 可叠", example = "1")
private Boolean filterType; private Integer filterType;
@Schema(description = "备注", example = "你说的对") @Schema(description = "备注", example = "你说的对")
private String remark; private String remark;
@Schema(description = "是否作废")
private Boolean isCancel;
@Schema(description = "创建时间") @Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime; private LocalDateTime[] createTime;
@@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import lombok.*;
import java.util.*; import java.util.*;
import java.util.*; import java.util.*;
import java.math.BigDecimal;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*; import com.alibaba.excel.annotation.*;
@@ -13,69 +14,73 @@ import com.alibaba.excel.annotation.*;
@ExcelIgnoreUnannotated @ExcelIgnoreUnannotated
public class PlateRespVO { public class PlateRespVO {
@Schema(description = "板件 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "5782") @Schema(description = "板件 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "32523")
@ExcelProperty("板件 ID") @ExcelProperty("板件 ID")
private Long id; private Long id;
@Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17851") @Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11087")
@ExcelProperty("生产单号") @ExcelProperty("生产单号")
private Long orderId; private Long orderId;
@Schema(description = "板名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四") @Schema(description = "板名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰")
@ExcelProperty("板名称") @ExcelProperty("板名称")
private String name; private String name;
@Schema(description = "板类型,0 层板 1 立板 2 背板", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") @Schema(description = "自定义板编号,设计有板编号,则保留设计板编号;设计没有且在机台设置中设置了自定义板编号规则,则按规则自动生成", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("自定义板编号,设计有板编号,则保留设计板编号;设计没有且在机台设置中设置了自定义板编号规则,则按规则自动生成")
private String plateNo;
@Schema(description = "板类型,0 层板 1 立板 2 背板", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty("板类型,0 层板 1 立板 2 背板") @ExcelProperty("板类型,0 层板 1 立板 2 背板")
private Integer type; private Integer type;
@Schema(description = "商品 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "28756") @Schema(description = "商品 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "14195")
@ExcelProperty("商品 ID") @ExcelProperty("商品 ID")
private String goodsId; private String goodsId;
@Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("宽度") @ExcelProperty("宽度")
private Double width; private BigDecimal width;
@Schema(description = "高度", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "高度", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("高度") @ExcelProperty("高度")
private Double height; private BigDecimal height;
@Schema(description = "厚度", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "厚度", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("厚度") @ExcelProperty("厚度")
private Double thickness; private BigDecimal thickness;
@Schema(description = "拆单宽度", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "拆单宽度", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("拆单宽度") @ExcelProperty("拆单宽度")
private Double splitWidth; private BigDecimal splitWidth;
@Schema(description = "拆单高度", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "拆单高度", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("拆单高度") @ExcelProperty("拆单高度")
private Double splitHeight; private BigDecimal splitHeight;
@Schema(description = "拆单厚度", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "拆单厚度", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("拆单厚度") @ExcelProperty("拆单厚度")
private Double splitThickness; private BigDecimal splitThickness;
@Schema(description = "左封边厚度", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "左封边厚度", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("左封边厚度") @ExcelProperty("左封边厚度")
private Double sealLeft; private BigDecimal sealLeft;
@Schema(description = "右封边厚度", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "右封边厚度", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("右封边厚度") @ExcelProperty("右封边厚度")
private Double sealRight; private BigDecimal sealRight;
@Schema(description = "上封边厚度", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "上封边厚度", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("上封边厚度") @ExcelProperty("上封边厚度")
private Double sealUp; private BigDecimal sealUp;
@Schema(description = "下封边厚度", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "下封边厚度", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("下封边厚度") @ExcelProperty("下封边厚度")
private Double sealDown; private BigDecimal sealDown;
@Schema(description = "面积", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "面积", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("面积") @ExcelProperty("面积")
private Double area; private BigDecimal area;
@Schema(description = "纹路类型,0 正纹 1 可翻转 2 反纹", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "纹路类型,0 正纹 1 可翻转 2 反纹", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("纹路类型,0 正纹 1 可翻转 2 反纹") @ExcelProperty("纹路类型,0 正纹 1 可翻转 2 反纹")
@@ -89,27 +94,27 @@ public class PlateRespVO {
@ExcelProperty("排孔类型,0 正纹 1 反面 2 随意面") @ExcelProperty("排孔类型,0 正纹 1 反面 2 随意面")
private Integer holeArrange; private Integer holeArrange;
@Schema(description = "异型孔数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "32490") @Schema(description = "异型孔数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "28477")
@ExcelProperty("异型孔数量") @ExcelProperty("异型孔数量")
private Short unregularPointCount; private Short unregularPointCount;
@Schema(description = "正面孔数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "4077") @Schema(description = "正面孔数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "20823")
@ExcelProperty("正面孔数量") @ExcelProperty("正面孔数量")
private Short frontHoleCount; private Short frontHoleCount;
@Schema(description = "背面孔数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "2405") @Schema(description = "背面孔数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "3441")
@ExcelProperty("背面孔数量") @ExcelProperty("背面孔数量")
private Short backHoleCount; private Short backHoleCount;
@Schema(description = "侧面孔数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1493") @Schema(description = "侧面孔数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "25509")
@ExcelProperty("侧面孔数量") @ExcelProperty("侧面孔数量")
private Short sideHoleCount; private Short sideHoleCount;
@Schema(description = "正面造型量", requiredMode = Schema.RequiredMode.REQUIRED, example = "23489") @Schema(description = "正面造型量", requiredMode = Schema.RequiredMode.REQUIRED, example = "31547")
@ExcelProperty("正面造型量") @ExcelProperty("正面造型量")
private Short frontModelCount; private Short frontModelCount;
@Schema(description = "背面造型量", requiredMode = Schema.RequiredMode.REQUIRED, example = "5176") @Schema(description = "背面造型量", requiredMode = Schema.RequiredMode.REQUIRED, example = "26725")
@ExcelProperty("背面造型量") @ExcelProperty("背面造型量")
private Short backModelCount; private Short backModelCount;
@@ -119,7 +124,7 @@ public class PlateRespVO {
@Schema(description = "开门类型,0 无 1 左 2 右 3 上 4 下", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") @Schema(description = "开门类型,0 无 1 左 2 右 3 上 4 下", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@ExcelProperty("开门类型,0 无 1 左 2 右 3 上 4 下") @ExcelProperty("开门类型,0 无 1 左 2 右 3 上 4 下")
private Boolean openDoorType; private Integer openDoorType;
@Schema(description = "异型偏移 x", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "异型偏移 x", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("异型偏移 x") @ExcelProperty("异型偏移 x")
@@ -133,19 +138,23 @@ public class PlateRespVO {
@ExcelProperty("是否孤形对角") @ExcelProperty("是否孤形对角")
private Boolean isArcAcross; private Boolean isArcAcross;
@Schema(description = "模块类型 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "15992") @Schema(description = "模块类型 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "12800")
@ExcelProperty("模块类型 ID") @ExcelProperty("模块类型 ID")
private Long moduleTypeId; private Long moduleTypeId;
@Schema(description = "排单过滤类型,1 有挖穿造型 2 有挖穿孔 4 有二维刀路 8 可叠", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") @Schema(description = "排单过滤类型,1 有挖穿造型 2 有挖穿孔 4 有二维刀路 8 可叠", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty("排单过滤类型,1 有挖穿造型 2 有挖穿孔 4 有二维刀路 8 可叠") @ExcelProperty("排单过滤类型,1 有挖穿造型 2 有挖穿孔 4 有二维刀路 8 可叠")
private Boolean filterType; private Integer filterType;
@Schema(description = "备注", example = "你说的对") @Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对")
@ExcelProperty("备注") @ExcelProperty("备注")
private String remark; private String remark;
@Schema(description = "创建时间") @Schema(description = "是否作废", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("是否作废")
private Boolean isCancel;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间") @ExcelProperty("创建时间")
private LocalDateTime createTime; private LocalDateTime createTime;
@@ -4,73 +4,78 @@ import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import lombok.*;
import java.util.*; import java.util.*;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import java.math.BigDecimal;
@Schema(description = "管理后台 - 生产单板件新增/修改 Request VO") @Schema(description = "管理后台 - 生产单板件新增/修改 Request VO")
@Data @Data
public class PlateSaveReqVO { public class PlateSaveReqVO {
@Schema(description = "板件 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "5782") @Schema(description = "板件 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "32523")
private Long id; private Long id;
@Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17851") @Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11087")
@NotNull(message = "生产单号不能为空") @NotNull(message = "生产单号不能为空")
private Long orderId; private Long orderId;
@Schema(description = "板名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四") @Schema(description = "板名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰")
@NotEmpty(message = "板名称不能为空") @NotEmpty(message = "板名称不能为空")
private String name; private String name;
@Schema(description = "板类型,0 层板 1 立板 2 背板", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") @Schema(description = "自定义板编号,设计有板编号,则保留设计板编号;设计没有且在机台设置中设置了自定义板编号规则,则按规则自动生成", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "自定义板编号,设计有板编号,则保留设计板编号;设计没有且在机台设置中设置了自定义板编号规则,则按规则自动生成不能为空")
private String plateNo;
@Schema(description = "板类型,0 层板 1 立板 2 背板", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "板类型,0 层板 1 立板 2 背板不能为空") @NotNull(message = "板类型,0 层板 1 立板 2 背板不能为空")
private Integer type; private Integer type;
@Schema(description = "商品 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "28756") @Schema(description = "商品 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "14195")
@NotNull(message = "商品 ID不能为空") @NotEmpty(message = "商品 ID不能为空")
private String goodsId; private String goodsId;
@Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "宽度不能为空") @NotNull(message = "宽度不能为空")
private Double width; private BigDecimal width;
@Schema(description = "高度", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "高度", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "高度不能为空") @NotNull(message = "高度不能为空")
private Double height; private BigDecimal height;
@Schema(description = "厚度", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "厚度", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "厚度不能为空") @NotNull(message = "厚度不能为空")
private Double thickness; private BigDecimal thickness;
@Schema(description = "拆单宽度", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "拆单宽度", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "拆单宽度不能为空") @NotNull(message = "拆单宽度不能为空")
private Double splitWidth; private BigDecimal splitWidth;
@Schema(description = "拆单高度", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "拆单高度", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "拆单高度不能为空") @NotNull(message = "拆单高度不能为空")
private Double splitHeight; private BigDecimal splitHeight;
@Schema(description = "拆单厚度", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "拆单厚度", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "拆单厚度不能为空") @NotNull(message = "拆单厚度不能为空")
private Double splitThickness; private BigDecimal splitThickness;
@Schema(description = "左封边厚度", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "左封边厚度", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "左封边厚度不能为空") @NotNull(message = "左封边厚度不能为空")
private Double sealLeft; private BigDecimal sealLeft;
@Schema(description = "右封边厚度", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "右封边厚度", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "右封边厚度不能为空") @NotNull(message = "右封边厚度不能为空")
private Double sealRight; private BigDecimal sealRight;
@Schema(description = "上封边厚度", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "上封边厚度", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "上封边厚度不能为空") @NotNull(message = "上封边厚度不能为空")
private Double sealUp; private BigDecimal sealUp;
@Schema(description = "下封边厚度", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "下封边厚度", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "下封边厚度不能为空") @NotNull(message = "下封边厚度不能为空")
private Double sealDown; private BigDecimal sealDown;
@Schema(description = "面积", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "面积", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "面积不能为空") @NotNull(message = "面积不能为空")
private Double area; private BigDecimal area;
@Schema(description = "纹路类型,0 正纹 1 可翻转 2 反纹", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "纹路类型,0 正纹 1 可翻转 2 反纹", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "纹路类型,0 正纹 1 可翻转 2 反纹不能为空") @NotNull(message = "纹路类型,0 正纹 1 可翻转 2 反纹不能为空")
@@ -84,27 +89,27 @@ public class PlateSaveReqVO {
@NotNull(message = "排孔类型,0 正纹 1 反面 2 随意面不能为空") @NotNull(message = "排孔类型,0 正纹 1 反面 2 随意面不能为空")
private Integer holeArrange; private Integer holeArrange;
@Schema(description = "异型孔数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "32490") @Schema(description = "异型孔数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "28477")
@NotNull(message = "异型孔数量不能为空") @NotNull(message = "异型孔数量不能为空")
private Short unregularPointCount; private Short unregularPointCount;
@Schema(description = "正面孔数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "4077") @Schema(description = "正面孔数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "20823")
@NotNull(message = "正面孔数量不能为空") @NotNull(message = "正面孔数量不能为空")
private Short frontHoleCount; private Short frontHoleCount;
@Schema(description = "背面孔数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "2405") @Schema(description = "背面孔数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "3441")
@NotNull(message = "背面孔数量不能为空") @NotNull(message = "背面孔数量不能为空")
private Short backHoleCount; private Short backHoleCount;
@Schema(description = "侧面孔数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1493") @Schema(description = "侧面孔数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "25509")
@NotNull(message = "侧面孔数量不能为空") @NotNull(message = "侧面孔数量不能为空")
private Short sideHoleCount; private Short sideHoleCount;
@Schema(description = "正面造型量", requiredMode = Schema.RequiredMode.REQUIRED, example = "23489") @Schema(description = "正面造型量", requiredMode = Schema.RequiredMode.REQUIRED, example = "31547")
@NotNull(message = "正面造型量不能为空") @NotNull(message = "正面造型量不能为空")
private Short frontModelCount; private Short frontModelCount;
@Schema(description = "背面造型量", requiredMode = Schema.RequiredMode.REQUIRED, example = "5176") @Schema(description = "背面造型量", requiredMode = Schema.RequiredMode.REQUIRED, example = "26725")
@NotNull(message = "背面造型量不能为空") @NotNull(message = "背面造型量不能为空")
private Short backModelCount; private Short backModelCount;
@@ -114,7 +119,7 @@ public class PlateSaveReqVO {
@Schema(description = "开门类型,0 无 1 左 2 右 3 上 4 下", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") @Schema(description = "开门类型,0 无 1 左 2 右 3 上 4 下", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@NotNull(message = "开门类型,0 无 1 左 2 右 3 上 4 下不能为空") @NotNull(message = "开门类型,0 无 1 左 2 右 3 上 4 下不能为空")
private Boolean openDoorType; private Integer openDoorType;
@Schema(description = "异型偏移 x", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "异型偏移 x", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "异型偏移 x不能为空") @NotNull(message = "异型偏移 x不能为空")
@@ -128,15 +133,20 @@ public class PlateSaveReqVO {
@NotNull(message = "是否孤形对角不能为空") @NotNull(message = "是否孤形对角不能为空")
private Boolean isArcAcross; private Boolean isArcAcross;
@Schema(description = "模块类型 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "15992") @Schema(description = "模块类型 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "12800")
@NotNull(message = "模块类型 ID不能为空") @NotNull(message = "模块类型 ID不能为空")
private Long moduleTypeId; private Long moduleTypeId;
@Schema(description = "排单过滤类型,1 有挖穿造型 2 有挖穿孔 4 有二维刀路 8 可叠", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") @Schema(description = "排单过滤类型,1 有挖穿造型 2 有挖穿孔 4 有二维刀路 8 可叠", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "排单过滤类型,1 有挖穿造型 2 有挖穿孔 4 有二维刀路 8 可叠不能为空") @NotNull(message = "排单过滤类型,1 有挖穿造型 2 有挖穿孔 4 有二维刀路 8 可叠不能为空")
private Boolean filterType; private Integer filterType;
@Schema(description = "备注", example = "你说的对") @Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对")
@NotEmpty(message = "备注不能为空")
private String remark; private String remark;
@Schema(description = "是否作废", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "是否作废不能为空")
private Boolean isCancel;
} }
@@ -0,0 +1,95 @@
package com.cf.imes.module.executor.controller.admin.rawgoods;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;
import com.cf.imes.framework.common.pojo.PageParam;
import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.framework.common.pojo.CommonResult;
import com.cf.imes.framework.common.util.object.BeanUtils;
import static com.cf.imes.framework.common.pojo.CommonResult.success;
import com.cf.imes.framework.excel.core.util.ExcelUtils;
import com.cf.imes.framework.operatelog.core.annotations.OperateLog;
import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.*;
import com.cf.imes.module.executor.controller.admin.rawgoods.vo.*;
import com.cf.imes.module.executor.dal.dataobject.rawgoods.RawGoodsDO;
import com.cf.imes.module.executor.service.rawgoods.RawGoodsService;
@Tag(name = "管理后台 - 生产单设计商品表 order_raw_goods_{N}")
@RestController
@RequestMapping("/executor/raw-goods")
@Validated
public class RawGoodsController {
@Resource
private RawGoodsService rawGoodsService;
@PostMapping("/create")
@Operation(summary = "创建生产单设计商品表 order_raw_goods_{N}")
@PreAuthorize("@ss.hasPermission('executor:raw-goods:create')")
public CommonResult<Long> createRawGoods(@Valid @RequestBody RawGoodsSaveReqVO createReqVO) {
return success(rawGoodsService.createRawGoods(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新生产单设计商品表 order_raw_goods_{N}")
@PreAuthorize("@ss.hasPermission('executor:raw-goods:update')")
public CommonResult<Boolean> updateRawGoods(@Valid @RequestBody RawGoodsSaveReqVO updateReqVO) {
rawGoodsService.updateRawGoods(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除生产单设计商品表 order_raw_goods_{N}")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('executor:raw-goods:delete')")
public CommonResult<Boolean> deleteRawGoods(@RequestParam("id") Long id) {
rawGoodsService.deleteRawGoods(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得生产单设计商品表 order_raw_goods_{N}")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('executor:raw-goods:query')")
public CommonResult<RawGoodsRespVO> getRawGoods(@RequestParam("id") Long id) {
RawGoodsDO rawGoods = rawGoodsService.getRawGoods(id);
return success(BeanUtils.toBean(rawGoods, RawGoodsRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得生产单设计商品表 order_raw_goods_{N}分页")
@PreAuthorize("@ss.hasPermission('executor:raw-goods:query')")
public CommonResult<PageResult<RawGoodsRespVO>> getRawGoodsPage(@Valid RawGoodsPageReqVO pageReqVO) {
PageResult<RawGoodsDO> pageResult = rawGoodsService.getRawGoodsPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, RawGoodsRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出生产单设计商品表 order_raw_goods_{N} Excel")
@PreAuthorize("@ss.hasPermission('executor:raw-goods:export')")
@OperateLog(type = EXPORT)
public void exportRawGoodsExcel(@Valid RawGoodsPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<RawGoodsDO> list = rawGoodsService.getRawGoodsPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "生产单设计商品表 order_raw_goods_{N}.xls", "数据", RawGoodsRespVO.class,
BeanUtils.toBean(list, RawGoodsRespVO.class));
}
}
@@ -0,0 +1,22 @@
package com.cf.imes.module.executor.controller.admin.rawgoods.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
import lombok.Data;
import java.util.List;
import java.util.Map;
@Schema(description = "管理后台 - 生产板材导入 Response VO")
@Data
@Builder
public class RawGoodsImportRespVO {
@Schema(description = "创建成功的生产板材数组", requiredMode = Schema.RequiredMode.REQUIRED)
private List<String> createRawGoods;
@Schema(description = "更新成功的生产板材数组", requiredMode = Schema.RequiredMode.REQUIRED)
private List<String> updateRawGoods;
@Schema(description = "导入失败的生产板材集合,key 为生产单名,value 为失败原因", requiredMode = Schema.RequiredMode.REQUIRED)
private Map<String, String> failureRawGoods;
}
@@ -0,0 +1,49 @@
package com.cf.imes.module.executor.controller.admin.rawgoods.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.cf.imes.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 生产单设计商品表 order_raw_goods_{N}分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class RawGoodsPageReqVO extends PageParam {
@Schema(description = "生产单号", example = "8905")
private Long orderId;
@Schema(description = "设计端商品编码", example = "28930")
private String rawGoodsId;
@Schema(description = "设计端商品名称", example = "赵六")
private String goodsName;
@Schema(description = "材质")
private String material;
@Schema(description = "颜色")
private String color;
@Schema(description = "厚度")
private Double thickness;
@Schema(description = "价格", example = "3872")
private Double price;
@Schema(description = "品牌")
private String brand;
@Schema(description = "规格")
private String spec;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}
@@ -0,0 +1,60 @@
package com.cf.imes.module.executor.controller.admin.rawgoods.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 生产单设计商品表 order_raw_goods_{N} Response VO")
@Data
@ExcelIgnoreUnannotated
public class RawGoodsRespVO {
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "3090")
@ExcelProperty("id")
private Long id;
@Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "8905")
@ExcelProperty("生产单号")
private Long orderId;
@Schema(description = "设计端商品编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "28930")
@ExcelProperty("设计端商品编码")
private String rawGoodsId;
@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 = "厚度", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("厚度")
private Double thickness;
@Schema(description = "价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "3872")
@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)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}
@@ -0,0 +1,51 @@
package com.cf.imes.module.executor.controller.admin.rawgoods.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 生产单设计商品表 order_raw_goods_{N}新增/修改 Request VO")
@Data
public class RawGoodsSaveReqVO {
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "3090")
private Long id;
@Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "8905")
@NotNull(message = "生产单号不能为空")
private Long orderId;
@Schema(description = "设计端商品编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "28930")
@NotEmpty(message = "设计端商品编码不能为空")
private String rawGoodsId;
@Schema(description = "设计端商品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
@NotEmpty(message = "设计端商品名称不能为空")
private String goodsName;
@Schema(description = "材质", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "材质不能为空")
private String material;
@Schema(description = "颜色", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "颜色不能为空")
private String color;
@Schema(description = "厚度", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "厚度不能为空")
private Double thickness;
@Schema(description = "价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "3872")
@NotNull(message = "价格不能为空")
private Double price;
@Schema(description = "品牌", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "品牌不能为空")
private String brand;
@Schema(description = "规格", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "规格不能为空")
private String spec;
}
@@ -48,11 +48,11 @@ public class OrderDO extends OrganBaseDO {
/** /**
* CAD数据类型,1CAD 2WebCAD 3Excel * CAD数据类型,1CAD 2WebCAD 3Excel
*/ */
private Boolean dataType; private Integer dataType;
/** /**
* 订单状态,0未排单1已排单2生产中3加工完成4打包完成5入库完成6出库完成 * 订单状态,0未排单1已排单2生产中3加工完成4打包完成5入库完成6出库完成
*/ */
private Boolean status; private Integer status;
/** /**
* 自定义单号 * 自定义单号
*/ */
@@ -59,11 +59,12 @@ public class OrderBodyDO extends BaseDO {
/** /**
* 板材数量 * 板材数量
*/ */
private Short plateNum; private Double plateNum;
/** /**
* 异型数量 * 异型数量
*/ */
private Short unregularNum; private Double unregularNum;
/** /**
* 文件名 * 文件名
*/ */
@@ -0,0 +1,82 @@
package com.cf.imes.module.executor.dal.dataobject.orderGroup;
import lombok.*;
import com.baomidou.mybatisplus.annotation.*;
import com.cf.imes.framework.mybatis.core.dataobject.BaseDO;
import java.math.BigDecimal;
/**
* 生产单加工组 DO
*
* @author 晨丰科技
*/
@TableName("order_group")
@KeySequence("order_group_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class OrderGroupDO extends BaseDO {
/**
* 模块 ID
*/
@TableId
private Long id;
/**
* 生产单号
*/
private Long orderId;
/**
* 柜体ID,上表中ID
*/
private Long bodyId;
/**
* 加工组类型id,依据同一生产单的同一房间的同一柜体的相同加工组类型,由服务端生成
*/
private Long groupId;
/**
* 加工组类型
*/
private String groupType;
/**
* 模块名称
*/
private String name;
/**
* 模块宽度
*/
private Double width;
/**
* 模块高度
*/
private Double height;
/**
* 模块深度
*/
private Double depth;
/**
* 模块复制数量
*/
private Short multiNum;
/**
* 板材数量
*/
private Double plateNum;
/**
* 异型数量
*/
private Short unregularNum;
/**
* 文件名
*/
private String filename;
/**
* 备注
*/
private String remark;
}
@@ -1,5 +1,6 @@
package com.cf.imes.module.executor.dal.dataobject.orderParts; package com.cf.imes.module.executor.dal.dataobject.orderParts;
import com.cf.imes.framework.mybatis.core.type.JsonLongSetTypeHandler;
import lombok.*; import lombok.*;
import java.util.*; import java.util.*;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@@ -12,11 +13,10 @@ import com.cf.imes.framework.mybatis.core.dataobject.BaseDO;
* *
* @author 晨丰科技 * @author 晨丰科技
*/ */
@TableName("order_parts_n") @TableName("order_parts")
@KeySequence("order_parts_n_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 @KeySequence("order_parts_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@@ -30,7 +30,7 @@ public class OrderPartsDO extends BaseDO {
/** /**
* 生产单号 * 生产单号
*/ */
private Long orderNo; private Long orderId;
/** /**
* 商品ID * 商品ID
*/ */
@@ -145,7 +145,7 @@ public class PlateDO extends BaseDO {
/** /**
* 开门类型,0 无 1 左 2 右 3 上 4 下 * 开门类型,0 无 1 左 2 右 3 上 4 下
*/ */
private Boolean openDoorType; private Integer openDoorType;
/** /**
* 异型偏移 x * 异型偏移 x
*/ */
@@ -165,7 +165,7 @@ public class PlateDO extends BaseDO {
/** /**
* 排单过滤类型,1 有挖穿造型 2 有挖穿孔 4 有二维刀路 8 可叠 * 排单过滤类型,1 有挖穿造型 2 有挖穿孔 4 有二维刀路 8 可叠
*/ */
private Boolean filterType; private Integer filterType;
/** /**
* 备注 * 备注
*/ */
@@ -0,0 +1,67 @@
package com.cf.imes.module.executor.dal.dataobject.rawgoods;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import com.cf.imes.framework.mybatis.core.dataobject.BaseDO;
/**
* 生产单设计商品表 order_raw_goods_{N} DO
*
* @author 晨丰科技
*/
@TableName("order_raw_goods")
@KeySequence("order_raw_goods_n_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class RawGoodsDO extends BaseDO {
/**
* id
*/
@TableId
private Long id;
/**
* 生产单号
*/
private Long orderId;
/**
* 设计端商品编码
*/
private String rawGoodsId;
/**
* 设计端商品名称
*/
private String goodsName;
/**
* 材质
*/
private String material;
/**
* 颜色
*/
private String color;
/**
* 厚度
*/
private Double thickness;
/**
* 价格
*/
private Double price;
/**
* 品牌
*/
private String brand;
/**
* 规格
*/
private String spec;
}
@@ -3,6 +3,7 @@ package com.cf.imes.module.executor.dal.mysql.orderBody;
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX; import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
import com.cf.imes.module.executor.dal.dataobject.orderBody.OrderBodyDO; import com.cf.imes.module.executor.dal.dataobject.orderBody.OrderBodyDO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/** /**
* 生产单柜体 Mapper * 生产单柜体 Mapper
@@ -12,6 +13,6 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface OrderBodyMapper extends BaseMapperX<OrderBodyDO> { public interface OrderBodyMapper extends BaseMapperX<OrderBodyDO> {
int updatePlateNumById(@Param("orderId") Long orderId, @Param("plateNum") Double plateNum);
} }
@@ -0,0 +1,19 @@
package com.cf.imes.module.executor.dal.mysql.orderGroup;
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
import com.cf.imes.module.executor.dal.dataobject.orderGroup.OrderGroupDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 生产单加工组 Mapper
*
* @author 晨丰科技
*/
@Mapper
public interface OrderGroupMapper extends BaseMapperX<OrderGroupDO> {
int updatePlateNumById(@Param("orderId") Long orderId, @Param("plateNum") Double plateNum);
}
@@ -2,12 +2,15 @@ package com.cf.imes.module.executor.dal.mysql.orderParts;
import java.util.*; import java.util.*;
import com.cf.imes.framework.common.exception.ServiceException;
import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.framework.common.util.object.BeanUtils;
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.mapper.BaseMapperX; import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
import com.cf.imes.module.executor.dal.dataobject.orderParts.OrderPartsDO; import com.cf.imes.module.executor.dal.dataobject.orderParts.OrderPartsDO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import com.cf.imes.module.executor.controller.admin.orderParts.vo.*; import com.cf.imes.module.executor.controller.admin.orderParts.vo.*;
import org.apache.poi.ss.formula.functions.T;
/** /**
* 生产单配件表 order_parts_{N} Mapper * 生产单配件表 order_parts_{N} Mapper
@@ -19,7 +22,7 @@ public interface OrderPartsMapper extends BaseMapperX<OrderPartsDO> {
default PageResult<OrderPartsDO> selectPage(OrderPartsPageReqVO reqVO) { default PageResult<OrderPartsDO> selectPage(OrderPartsPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<OrderPartsDO>() return selectPage(reqVO, new LambdaQueryWrapperX<OrderPartsDO>()
.eqIfPresent(OrderPartsDO::getOrderNo, reqVO.getOrderNo()) .eqIfPresent(OrderPartsDO::getOrderId, reqVO.getOrderId())
.eqIfPresent(OrderPartsDO::getGoodsId, reqVO.getGoodsId()) .eqIfPresent(OrderPartsDO::getGoodsId, reqVO.getGoodsId())
.likeIfPresent(OrderPartsDO::getName, reqVO.getName()) .likeIfPresent(OrderPartsDO::getName, reqVO.getName())
.eqIfPresent(OrderPartsDO::getMaterial, reqVO.getMaterial()) .eqIfPresent(OrderPartsDO::getMaterial, reqVO.getMaterial())
@@ -36,4 +39,20 @@ public interface OrderPartsMapper extends BaseMapperX<OrderPartsDO> {
.orderByDesc(OrderPartsDO::getId)); .orderByDesc(OrderPartsDO::getId));
} }
default OrderPartsImportRespVO importOrderPartsList(List<OrderPartsSaveReqVO> importOrderParts) {
OrderPartsImportRespVO respVO = OrderPartsImportRespVO.builder().createOrderParts(new ArrayList<OrderPartsSaveReqVO>())
.updateOrderParts(new ArrayList<>()).failureOrderParts(new LinkedHashMap<>()).build();
importOrderParts.forEach(orderParts -> {
try{
OrderPartsDO orderPartsDO = BeanUtils.toBean(orderParts, OrderPartsDO.class);
insert(orderPartsDO);
orderParts.setId(orderPartsDO.getId());
respVO.getCreateOrderParts().add(orderParts);
}catch (ServiceException ex){
respVO.getFailureOrderParts().put(orderParts.getName(), ex.getMessage());
}
});
System.err.println("OrderPartsImportRespVO " + respVO);
return respVO;
}
} }
@@ -5,18 +5,24 @@ import java.util.*;
import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants; import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.cf.imes.framework.common.exception.ServiceException;
import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.framework.common.util.object.BeanUtils;
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.mapper.BaseMapperX; import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
import com.cf.imes.module.executor.controller.admin.plan.vo.OptimizeParamResVO;
import com.cf.imes.module.executor.controller.admin.plan.vo.PlatePage; import com.cf.imes.module.executor.controller.admin.plan.vo.PlatePage;
import com.cf.imes.module.executor.controller.admin.plan.vo.PlateParam; import com.cf.imes.module.executor.controller.admin.plan.vo.PlateParam;
import com.cf.imes.module.executor.controller.admin.plan.vo.PlateResList; import com.cf.imes.module.executor.controller.admin.plan.vo.PlateResList;
import com.cf.imes.module.executor.controller.admin.rawgoods.vo.RawGoodsImportRespVO;
import com.cf.imes.module.executor.controller.admin.rawgoods.vo.RawGoodsSaveReqVO;
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO; import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
import com.cf.imes.module.executor.dal.dataobject.orderParts.OrderPartsDO;
import com.cf.imes.module.executor.dal.dataobject.plate.PlateDO; import com.cf.imes.module.executor.dal.dataobject.plate.PlateDO;
import com.cf.imes.module.executor.dal.dataobject.rawgoods.RawGoodsDO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import com.cf.imes.module.executor.controller.admin.plate.vo.*; import com.cf.imes.module.executor.controller.admin.plate.vo.*;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.poi.ss.formula.functions.T;
/** /**
* 生产单板件 Mapper * 生产单板件 Mapper
@@ -69,4 +75,22 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
List<PlateResList> selectPlateByPlanId(@Param(Constants.WRAPPER) Wrapper<PlateDO> wrapper); List<PlateResList> selectPlateByPlanId(@Param(Constants.WRAPPER) Wrapper<PlateDO> wrapper);
List<PlateParam> selectPlateList(Long planId); List<PlateParam> selectPlateList(Long planId);
default PlateImportRespVO importPlateList(List<PlateSaveReqVO> importPlates , Long orderId) {
PlateImportRespVO respVO = PlateImportRespVO.builder().createPlates(new ArrayList<PlateSaveReqVO>())
.updatePlates(new ArrayList<>()).failurePlates(new LinkedHashMap<>()).build();
importPlates.forEach(plateSaveReqVO -> {
try {
PlateDO plateDO = BeanUtils.toBean(plateSaveReqVO, PlateDO.class).setOrderId(orderId);
insert(plateDO);
plateSaveReqVO.setId(plateDO.getId());
respVO.getCreatePlates().add(plateSaveReqVO);
} catch (ServiceException ex) {
respVO.getFailurePlates().put(plateSaveReqVO.getName(), ex.getMessage());
}
});
System.err.println("PlateImportRespVO " + respVO);
return respVO;
}
} }
@@ -0,0 +1,56 @@
package com.cf.imes.module.executor.dal.mysql.rawgoods;
import java.util.*;
import com.cf.imes.framework.common.exception.ServiceException;
import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.framework.common.util.object.BeanUtils;
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
import com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsImportRespVO;
import com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsSaveReqVO;
import com.cf.imes.module.executor.dal.dataobject.orderParts.OrderPartsDO;
import com.cf.imes.module.executor.dal.dataobject.rawgoods.RawGoodsDO;
import org.apache.ibatis.annotations.Mapper;
import com.cf.imes.module.executor.controller.admin.rawgoods.vo.*;
/**
* 生产单设计商品表 order_raw_goods_{N} Mapper
*
* @author 晨丰科技
*/
@Mapper
public interface RawGoodsMapper extends BaseMapperX<RawGoodsDO> {
default PageResult<RawGoodsDO> selectPage(RawGoodsPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<RawGoodsDO>()
.eqIfPresent(RawGoodsDO::getOrderId, reqVO.getOrderId())
.eqIfPresent(RawGoodsDO::getRawGoodsId, reqVO.getRawGoodsId())
.likeIfPresent(RawGoodsDO::getGoodsName, reqVO.getGoodsName())
.eqIfPresent(RawGoodsDO::getMaterial, reqVO.getMaterial())
.eqIfPresent(RawGoodsDO::getColor, reqVO.getColor())
.eqIfPresent(RawGoodsDO::getThickness, reqVO.getThickness())
.eqIfPresent(RawGoodsDO::getPrice, reqVO.getPrice())
.eqIfPresent(RawGoodsDO::getBrand, reqVO.getBrand())
.eqIfPresent(RawGoodsDO::getSpec, reqVO.getSpec())
.betweenIfPresent(RawGoodsDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(RawGoodsDO::getId));
}
default RawGoodsImportRespVO importRawGoodsList(List<RawGoodsSaveReqVO> importRawGoods) {
RawGoodsImportRespVO respVO = RawGoodsImportRespVO.builder().createRawGoods(new ArrayList<>())
.updateRawGoods(new ArrayList<>()).failureRawGoods(new LinkedHashMap<>()).build();
importRawGoods.forEach(rawGoodsSaveReqVO -> {
try{
insert(BeanUtils.toBean(rawGoodsSaveReqVO, RawGoodsDO.class));
respVO.getCreateRawGoods().add(rawGoodsSaveReqVO.getGoodsName());
}catch (Exception e){
e.printStackTrace();
respVO.getFailureRawGoods().put(rawGoodsSaveReqVO.getGoodsName(), e.getMessage());
}
});
System.err.println("RawGoodsImportRespVO " + respVO);
return respVO;
}
}
@@ -5,8 +5,9 @@ import javax.validation.*;
import com.cf.imes.module.executor.controller.admin.order.vo.order.*; import com.cf.imes.module.executor.controller.admin.order.vo.order.*;
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO; import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.pojo.PageResult;
import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.io.IOException;
/** /**
* 生产单表 order_{N} Service 接口 * 生产单表 order_{N} Service 接口
@@ -55,10 +56,10 @@ public interface OrderService {
/** /**
* 批量导入生产单 * 批量导入生产单
* * @param upload 是否只上传表头,默认为只上传表头
* @param importOrders 导入生产单列表 * @param file 文件内容
* @param isUpdateSupport 是否支持更新 * @param createReqVO 生产单信息
* @return 导入结果 * @return OrderImportRespVO
*/ */
OrderImportRespVO importOrderList(List<OrderPlateImportExcelVO> importOrders, Boolean isUpdateSupport); OrderImportRespVO importOrderList(Boolean upload , MultipartFile file , OrderSaveReqVO createReqVO) throws IOException;
} }
@@ -1,10 +1,28 @@
package com.cf.imes.module.executor.service.order; package com.cf.imes.module.executor.service.order;
import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator;
import com.cf.imes.module.executor.controller.admin.order.vo.order.*; import com.cf.imes.module.executor.controller.admin.order.vo.order.*;
import com.cf.imes.framework.datapermission.core.util.DataPermissionUtils;
import com.cf.imes.module.executor.controller.admin.rawgoods.vo.RawGoodsImportRespVO;
import com.cf.imes.module.executor.controller.admin.rawgoods.vo.RawGoodsSaveReqVO;
import com.cf.imes.module.executor.dal.dataobject.orderBody.OrderBodyDO;
import com.cf.imes.module.executor.dal.dataobject.orderGroup.OrderGroupDO;
import com.cf.imes.module.executor.dal.dataobject.orderItem.OrderItemDO;
import com.cf.imes.module.executor.dal.dataobject.orderParts.OrderPartsDO;
import com.cf.imes.module.executor.dal.dataobject.plate.PlateDO;
import com.cf.imes.module.executor.dal.mysql.orderBody.OrderBodyMapper;
import com.cf.imes.module.executor.dal.mysql.orderGroup.OrderGroupMapper;
import com.cf.imes.module.executor.dal.mysql.orderItem.OrderItemMapper;
import com.cf.imes.module.executor.dal.mysql.orderParts.OrderPartsMapper;
import com.cf.imes.module.executor.dal.mysql.plate.PlateMapper;
import com.cf.imes.module.executor.dal.mysql.rawgoods.RawGoodsMapper;
import com.cf.imes.module.executor.util.excel.OrderExcelUtil;
import com.cf.imes.module.system.api.user.AdminUserApi;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO; import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
@@ -12,19 +30,23 @@ import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.framework.common.util.object.BeanUtils; import com.cf.imes.framework.common.util.object.BeanUtils;
import com.cf.imes.module.executor.dal.mysql.order.OrderMapper; import com.cf.imes.module.executor.dal.mysql.order.OrderMapper;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.time.ZonedDateTime; import java.time.ZonedDateTime;
import java.time.format.DateTimeParseException; import java.time.format.DateTimeParseException;
import java.util.List; import java.util.*;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.stream.Collectors;
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*; import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
/** /**
* 生产单表 order_{N} Service 实现类 * 生产单表 order_{N} Service 实现类
* *
@@ -37,17 +59,41 @@ public class OrderServiceImpl implements OrderService {
@Resource @Resource
private OrderMapper orderMapper; private OrderMapper orderMapper;
@Resource
private RawGoodsMapper rawGoodsMapper;
@Resource
private OrderPartsMapper orderPartsMapper;
@Resource
private PlateMapper plateMapper;
@Resource
private OrderBodyMapper orderBodyMapper;
@Resource
private OrderGroupMapper orderGroupMapper;
@Resource
private OrderItemMapper orderItemMapper;
@Resource
private SnowFlakeGenerator snowFlakeGenerator;
@Resource
private AdminUserApi adminUserApi;
private static final int DEFAULT_DAYS_TO_ADD = 30; private static final int DEFAULT_DAYS_TO_ADD = 30;
// private Long organId = SecurityFrameworkUtils.getLoginUser().getOrganId();
@Override @Override
public Long createOrder(OrderSaveReqVO createReqVO) { public Long createOrder(OrderSaveReqVO createReqVO) {
//校验手机号是否合法 //校验手机号是否合法
validatePhoneNumber(createReqVO.getPhoneNumber()); validatePhoneNumber(createReqVO.getPhoneNumber());
validatePhoneNumber(createReqVO.getDealerPhoneNumber()); validatePhoneNumber(createReqVO.getDealerPhoneNumber());
//验证自定义单号是否存在,业务员、拆单员是否存在 //验证自定义单号是否存在,业务员、拆单员是否存在
validateCustomOrderNoExists(createReqVO.getCustomOrderNo()); validateOrderImportForCreateOrUpdate(createReqVO.getCustomOrderNo(), createReqVO.getSalesman(), createReqVO.getSplitter());
validateSalesmanOrderNoExists(createReqVO.getSalesman());
validateSplitterOrderNoExists(createReqVO.getSplitter());
LocalDateTime time = getAfterDate(createReqVO.getDeliveryDate()); LocalDateTime time = getAfterDate(createReqVO.getDeliveryDate());
createReqVO.setDeliveryDate(time); createReqVO.setDeliveryDate(time);
@@ -92,9 +138,158 @@ public class OrderServiceImpl implements OrderService {
} }
@Override @Override
public OrderImportRespVO importOrderList(List<OrderPlateImportExcelVO> importOrders, Boolean isUpdateSupport) { @Transactional(rollbackFor = Exception.class) // 添加事务,异常则回滚所有导入
public OrderImportRespVO importOrderList(Boolean upload, MultipartFile file, OrderSaveReqVO createReqVO) throws IOException {
OrderImportRespVO orderImportRespVO = OrderImportRespVO.builder().createOrder(new ArrayList<>())
.updateOrder(new ArrayList<>()).failureOrder(new LinkedHashMap<>()).build();
// 上传文件类型判断,抽出文件中的板件信息
List<OrderPlateImportExcelVO> list = new ArrayList<>();
if (createReqVO.getDataType() == 1) {//CAD
return orderImportRespVO;
} else if (createReqVO.getDataType() == 2) {//WebCAD
return orderImportRespVO;
} else if (createReqVO.getDataType() == 3) {//Excel
//文件数据读取
list = OrderExcelUtil.read(file, OrderPlateImportExcelVO.class);
if (list == null || list.size() == 0) {
orderImportRespVO.getFailureOrder().put("生产单导入错误", String.valueOf(OrderExcelUtil.getValue()));
return orderImportRespVO;
}
}
// 判断是否只新建生产单
Long id = createOrder(createReqVO);
if (upload) {
orderImportRespVO.getCreateOrder().add(String.valueOf(id));
return orderImportRespVO;
}
// 根据字段筛选出重复数据
List<OrderPlateImportExcelVO> duplicateOrder = list.stream()
.collect(
Collectors.toMap(
p -> Arrays.asList(p.getGoodsId(), p.getGoodsName(), p.getMaterial(), p.getColor(), p.getSpec()),
p -> p,
(existing, replacement) -> existing
)
)
.values().stream()
.collect(Collectors.toList());
// 数据分类
HashMap<String, List<OrderPlateImportExcelVO>> map = classifyGoods(duplicateOrder);
// 板材信息合集,添加生产单id,板材信息写入order_raw_goods
List<RawGoodsSaveReqVO> rawGoodsSaveReqVOList = collectImportRawPlate(map.get("plate"), id);
RawGoodsImportRespVO respRawGoods = rawGoodsMapper.importRawGoodsList(rawGoodsSaveReqVOList);
orderImportRespVO.getFailureOrder().putAll(respRawGoods.getFailureRawGoods());
return null; // 小板信息写入 、配件信息写入
Map<String, List<OrderPlateImportExcelVO>> groupedRooms = list.stream()
.collect(Collectors.groupingBy(
order -> order.getRoomsName() != null ? order.getRoomsName() : " ",
Collectors.toList()
));
groupedRooms.forEach((roomName, listRoom) -> {
System.out.println("OrderPlateImportExcelVO with roomName " + roomName + ":");
Long roomId = (Long) snowFlakeGenerator.nextId(null);
Map<String, List<OrderPlateImportExcelVO>> groupedCabinetsName = listRoom.stream()
.collect(Collectors.groupingBy(
order -> order.getCabinetsName() != null ? order.getCabinetsName() : " ",
Collectors.toList()
));
groupedCabinetsName.forEach((cabinetName, listCabinet) -> {
System.out.println("OrderPlateImportExcelVO with cabinetName " + cabinetName + ":");
final Double[] plateCountByCabinetName = {0.0};
// 插入柜体表数据
OrderBodyDO orderBodyDO = OrderBodyDO.builder().orderId(id).roomId(roomId)
.roomName(roomName).name(cabinetName).build();
orderBodyMapper.insert(orderBodyDO);
Long bodyId = orderBodyDO.getId();
Map<String, List<OrderPlateImportExcelVO>> groupedSynthesis = listCabinet.stream()
.collect(Collectors.groupingBy(
order -> order.getSynthesis() != null ? order.getSynthesis() : " ",
Collectors.toList()
));
groupedSynthesis.forEach((synthesis, listSynthesis) -> {
System.out.println("OrderPlateImportExcelVO with synthesis " + synthesis + ":");
Long synthesisId = (Long) snowFlakeGenerator.nextId(null);
Map<String, List<OrderPlateImportExcelVO>> groupedCombinationName = listSynthesis.stream()
.collect(Collectors.groupingBy(
order -> order.getCombinationName() != null ? order.getCombinationName() : " ",
Collectors.toList()
));
groupedCombinationName.forEach((combinationName, listCombination) -> {//组合名称
// 板数量
final Double[] plateCountByCombination = {0.0};
OrderGroupDO orderGroupDO = OrderGroupDO.builder().orderId(id).bodyId(bodyId)
.groupId(synthesisId).groupType(synthesis).name(combinationName).build();
// 插入group表
orderGroupMapper.insert(orderGroupDO);
Long groupId = orderGroupDO.getId();
listCombination.forEach(plateOrParts -> {
System.out.println("OrderPlateImportExcelVO with combinationName " + combinationName + ":");
plateCountByCombination[0] = plateCountByCombination[0] + plateOrParts.getGoodsNumber();
if (plateOrParts.getGoodType().replaceAll(" ", "").equals("板材") ||
plateOrParts.getGoodType().replaceAll(" ", "").equals("1")) {//板材
for (int i = 0; i < plateOrParts.getGoodsNumber(); i++) {
PlateDO plateDO = BeanUtils.toBean(plateOrParts, PlateDO.class);
plateMapper.insert(plateDO);
Long plateId = plateDO.getId();
OrderItemDO orderItemDO = OrderItemDO.builder().orderId(id).type(1)
.roomId(roomId).bodyId(bodyId).dataId(plateId).plateId(plateId)
.num(Double.valueOf(plateOrParts.getGoodsNumber())).build();
orderItemMapper.insert(orderItemDO);
}
} else {
//配件
OrderPartsDO orderPartsDO = BeanUtils.toBean(plateOrParts, OrderPartsDO.class).setName(plateOrParts.getGoodsName()).setOrderId(id);
orderPartsMapper.insert(orderPartsDO);
OrderItemDO orderItemDO = OrderItemDO.builder().orderId(id).type(2)
.roomId(roomId).bodyId(bodyId).dataId(orderPartsDO.getId()).partsId(orderPartsDO.getId())
.num(Double.valueOf(plateOrParts.getGoodsNumber())).build();
orderItemMapper.insert(orderItemDO);
}
});
// 修改group中的板件数量
// OrderGroupDO updateOrderGroupDO = orderGroupMapper.selectById(groupId).setPlateNum(plateCountByCombination[0]);
// orderGroupMapper.updateById(updateOrderGroupDO);
orderGroupMapper.updatePlateNumById(groupId, plateCountByCombination[0]);
plateCountByCabinetName[0] = plateCountByCabinetName[0] + plateCountByCombination[0];
});
});
// OrderBodyDO updateOrderBodyDO = orderBodyMapper.selectById(bodyId).setPlateNum(plateCountByCabinetName[0]);
// orderBodyMapper.updateById(updateOrderBodyDO);
orderBodyMapper.updatePlateNumById(bodyId, plateCountByCabinetName[0]);
});
});
return orderImportRespVO;
}
// 板材信息收集
private List<RawGoodsSaveReqVO> collectImportRawPlate(List<OrderPlateImportExcelVO> list, Long id) {
List<RawGoodsSaveReqVO> rawGoodsDOList = new ArrayList<>();
for (OrderPlateImportExcelVO orderPlateImportExcelVO : list) {
RawGoodsSaveReqVO rawGoodsSaveReqVO = BeanUtils.toBean(orderPlateImportExcelVO, RawGoodsSaveReqVO.class);
rawGoodsSaveReqVO.setOrderId(id);
rawGoodsDOList.add(rawGoodsSaveReqVO);
}
return rawGoodsDOList;
}
//对数据进行分类
private HashMap<String, List<OrderPlateImportExcelVO>> classifyGoods(List<OrderPlateImportExcelVO> list) {
HashMap<String, List<OrderPlateImportExcelVO>> map = new HashMap<>();
List<OrderPlateImportExcelVO> plateLists = new ArrayList<>();
List<OrderPlateImportExcelVO> partsLists = new ArrayList<>();
for (OrderPlateImportExcelVO orderPlateImportExcelVO : list) {
//判断是板材还是配件
if (orderPlateImportExcelVO.getGoodType().replaceAll(" ", "").equals("板材") || orderPlateImportExcelVO.getGoodType().replaceAll(" ", "").equals("1")) {
plateLists.add(orderPlateImportExcelVO);
} else {
partsLists.add(orderPlateImportExcelVO);
}
orderPlateImportExcelVO.setRemark(orderPlateImportExcelVO.remarkJSON());
}
map.put("plate", plateLists);
map.put("parts", partsLists);
return map;
} }
private LocalDateTime getAfterDate(LocalDateTime date) { private LocalDateTime getAfterDate(LocalDateTime date) {
@@ -118,29 +313,29 @@ public class OrderServiceImpl implements OrderService {
return date; return date;
} }
// 验证自定义单号是否存在 // 验证自定义单号是否存在
private void validateCustomOrderNoExists(String customOrderNo){ private void validateCustomOrderNoExists(String customOrderNo) {
if (orderMapper.selectOne("custom_order_no", customOrderNo) != null) { if (orderMapper.selectOne("custom_order_no", customOrderNo) != null) {
throw exception(CUSTOM_ORDER_EXISTS); throw exception(CUSTOM_ORDER_EXISTS);
} }
} }
// 业务员是否存在 // 业务员是否存在
private void validateSalesmanOrderNoExists(String salesman){ private void validateSalesmanOrderNoExists(String salesman , Long organId) {
if (orderMapper.selectOne("salesman", salesman) == null) { if (adminUserApi.validateUser(salesman,organId) == null) {
throw exception(SALESMAN_ORDER_NOT_EXISTS); throw exception(SALESMAN_ORDER_NOT_EXISTS);
} }
} }
// 拆单员是否存在 // 拆单员是否存在
private void validateSplitterOrderNoExists(String splitter){ private void validateSplitterOrderNoExists(String splitter , Long organId) {
if (orderMapper.selectOne("splitter", splitter) == null) { if (adminUserApi.validateUser(splitter,organId) == null) {
throw exception(SPLITTER_ORDER_NOT_EXISTS); throw exception(SPLITTER_ORDER_NOT_EXISTS);
} }
} }
// 校验手机号是否合法 // 校验手机号是否合法
private void validatePhoneNumber(String phoneNumber){ private void validatePhoneNumber(String phoneNumber) {
// 定义手机号正则表达式 // 定义手机号正则表达式
String regex = "^1[3-9]\\d{9}$"; String regex = "^1[3-9]\\d{9}$";
@@ -157,4 +352,14 @@ public class OrderServiceImpl implements OrderService {
throw exception(PHONE_NOT_LAWFUL); throw exception(PHONE_NOT_LAWFUL);
} }
} }
private void validateOrderImportForCreateOrUpdate(String customOrderNo, String salesman, String splitter) {
// 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确
Long organId = SecurityFrameworkUtils.getLoginUser().getOrganId();
DataPermissionUtils.executeIgnore(() -> {
validateCustomOrderNoExists(customOrderNo);
validateSalesmanOrderNoExists(salesman , organId);
validateSplitterOrderNoExists(splitter , organId);
});
}
} }
@@ -52,4 +52,12 @@ public interface OrderPartsService {
*/ */
PageResult<OrderPartsDO> getOrderPartsPage(OrderPartsPageReqVO pageReqVO); PageResult<OrderPartsDO> getOrderPartsPage(OrderPartsPageReqVO pageReqVO);
/**
* 批量导入配件
*
* @param importOrderParts 导入生产单配件列表
* @param orderId 生产单号
* @return 导入结果
*/
OrderPartsImportRespVO importOrderPartsList(List<OrderPartsSaveReqVO> importOrderParts, Long orderId);
} }
@@ -1,11 +1,21 @@
package com.cf.imes.module.executor.service.orderParts; package com.cf.imes.module.executor.service.orderParts;
import cn.hutool.core.collection.CollUtil;
import com.cf.imes.framework.common.exception.ServiceException;
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
import com.cf.imes.framework.datapermission.core.util.DataPermissionUtils;
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
import com.cf.imes.module.system.enums.ErrorCodeConstants;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.*; import java.util.*;
import com.cf.imes.module.executor.controller.admin.orderParts.vo.*; import com.cf.imes.module.executor.controller.admin.orderParts.vo.*;
import com.cf.imes.module.executor.dal.dataobject.orderParts.OrderPartsDO; import com.cf.imes.module.executor.dal.dataobject.orderParts.OrderPartsDO;
import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.pojo.PageResult;
@@ -71,4 +81,24 @@ public class OrderPartsServiceImpl implements OrderPartsService {
return orderPartsMapper.selectPage(pageReqVO); return orderPartsMapper.selectPage(pageReqVO);
} }
@Override
@Transactional(rollbackFor = Exception.class) // 添加事务,异常则回滚所有导入
public OrderPartsImportRespVO importOrderPartsList(List<OrderPartsSaveReqVO> importOrderParts, Long orderId) {
if (CollUtil.isEmpty(importOrderParts)) {
throw ServiceExceptionUtil.exception(ErrorCodeConstants.ORDER_PARTS_IMPORT_LIST_IS_EMPTY);
}
OrderPartsImportRespVO respVO = OrderPartsImportRespVO.builder().createOrderParts(new ArrayList<OrderPartsSaveReqVO>())
.updateOrderParts(new ArrayList<>()).failureOrderParts(new LinkedHashMap<>()).build();
importOrderParts.forEach(orderParts -> {
try{
Long id = (long) orderPartsMapper.insert(BeanUtils.toBean(orderParts, OrderPartsDO.class)
.setOrderId(orderId));
respVO.getCreateOrderParts().add(orderParts);
}catch (ServiceException ex){
respVO.getFailureOrderParts().put(orderParts.getName(), ex.getMessage());
}
});
return respVO;
}
} }
@@ -3,6 +3,8 @@ package com.cf.imes.module.executor.service.plate;
import java.util.*; import java.util.*;
import javax.validation.*; import javax.validation.*;
import com.cf.imes.module.executor.controller.admin.plate.vo.*; import com.cf.imes.module.executor.controller.admin.plate.vo.*;
import com.cf.imes.module.executor.controller.admin.rawgoods.vo.RawGoodsImportRespVO;
import com.cf.imes.module.executor.controller.admin.rawgoods.vo.RawGoodsSaveReqVO;
import com.cf.imes.module.executor.dal.dataobject.plate.PlateDO; import com.cf.imes.module.executor.dal.dataobject.plate.PlateDO;
import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.framework.common.pojo.PageParam; import com.cf.imes.framework.common.pojo.PageParam;
@@ -52,4 +54,13 @@ public interface PlateService {
*/ */
PageResult<PlateDO> getPlatePage(PlatePageReqVO pageReqVO); PageResult<PlateDO> getPlatePage(PlatePageReqVO pageReqVO);
/**
* 批量导入小板
*
* @param importPlates 导入生产单板材列表
* @param orderId 生产单Id
* @return 导入结果
*/
PlateImportRespVO importPlatesList(List<PlateSaveReqVO> importPlates, Long orderId);
} }
@@ -1,5 +1,12 @@
package com.cf.imes.module.executor.service.plate; package com.cf.imes.module.executor.service.plate;
import cn.hutool.core.collection.CollUtil;
import com.cf.imes.framework.common.exception.ServiceException;
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
import com.cf.imes.module.executor.controller.admin.rawgoods.vo.RawGoodsImportRespVO;
import com.cf.imes.module.executor.dal.dataobject.rawgoods.RawGoodsDO;
import com.cf.imes.module.system.enums.ErrorCodeConstants;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@@ -72,4 +79,24 @@ public class PlateServiceImpl implements PlateService {
return plateMapper.selectPage(pageReqVO); return plateMapper.selectPage(pageReqVO);
} }
@Override
@Transactional(rollbackFor = Exception.class) // 添加事务,异常则回滚所有导入
public PlateImportRespVO importPlatesList(List<PlateSaveReqVO> importPlates, Long orderId) {
if (CollUtil.isEmpty(importPlates)) {
throw ServiceExceptionUtil.exception(ErrorCodeConstants.RAW_GOODS_IMPORT_LIST_IS_EMPTY);
}
PlateImportRespVO respVO = PlateImportRespVO.builder().createPlates(new ArrayList<PlateSaveReqVO>())
.updatePlates(new ArrayList<>()).failurePlates(new LinkedHashMap<>()).build();
importPlates.forEach(plateSaveReqVO -> {
try {
Long id = (long) plateMapper.insert(BeanUtils.toBean(plateSaveReqVO, PlateDO.class)
.setOrderId(orderId));
respVO.getCreatePlates().add(plateSaveReqVO);
} catch (ServiceException ex) {
respVO.getFailurePlates().put(plateSaveReqVO.getName(), ex.getMessage());
}
});
return respVO;
}
} }
@@ -0,0 +1,67 @@
package com.cf.imes.module.executor.service.rawgoods;
import java.util.*;
import javax.validation.*;
import com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsImportRespVO;
import com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsSaveReqVO;
import com.cf.imes.module.executor.controller.admin.rawgoods.vo.*;
import com.cf.imes.module.executor.dal.dataobject.rawgoods.RawGoodsDO;
import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.framework.common.pojo.PageParam;
/**
* 生产单设计商品表 order_raw_goods_{N} Service 接口
*
* @author 晨丰科技
*/
public interface RawGoodsService {
/**
* 创建生产单设计商品表 order_raw_goods_{N}
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createRawGoods(@Valid RawGoodsSaveReqVO createReqVO);
/**
* 更新生产单设计商品表 order_raw_goods_{N}
*
* @param updateReqVO 更新信息
*/
void updateRawGoods(@Valid RawGoodsSaveReqVO updateReqVO);
/**
* 删除生产单设计商品表 order_raw_goods_{N}
*
* @param id 编号
*/
void deleteRawGoods(Long id);
/**
* 获得生产单设计商品表 order_raw_goods_{N}
*
* @param id 编号
* @return 生产单设计商品表 order_raw_goods_{N}
*/
RawGoodsDO getRawGoods(Long id);
/**
* 获得生产单设计商品表 order_raw_goods_{N}分页
*
* @param pageReqVO 分页查询
* @return 生产单设计商品表 order_raw_goods_{N}分页
*/
PageResult<RawGoodsDO> getRawGoodsPage(RawGoodsPageReqVO pageReqVO);
/**
* 批量导入板材
*
* @param importRawGoods 导入生产单板材列表
* @param orderId 生产单Id
* @return 导入结果
*/
RawGoodsImportRespVO importRawGoodsList(List<RawGoodsSaveReqVO> importRawGoods, Long orderId);
}
@@ -0,0 +1,103 @@
package com.cf.imes.module.executor.service.rawgoods;
import cn.hutool.core.collection.CollUtil;
import com.cf.imes.framework.common.exception.ServiceException;
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
import com.cf.imes.framework.datapermission.core.util.DataPermissionUtils;
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
import com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsImportRespVO;
import com.cf.imes.module.executor.dal.dataobject.orderParts.OrderPartsDO;
import com.cf.imes.module.system.enums.ErrorCodeConstants;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import com.cf.imes.module.executor.controller.admin.rawgoods.vo.*;
import com.cf.imes.module.executor.dal.dataobject.rawgoods.RawGoodsDO;
import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.framework.common.pojo.PageParam;
import com.cf.imes.framework.common.util.object.BeanUtils;
import com.cf.imes.module.executor.dal.mysql.rawgoods.RawGoodsMapper;
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
import static com.cf.imes.module.system.enums.ErrorCodeConstants.RAW_GOODS_NOT_EXISTS;
/**
* 生产单设计商品表 order_raw_goods_{N} Service 实现类
*
* @author 晨丰科技
*/
@Service
@Validated
public class RawGoodsServiceImpl implements RawGoodsService {
@Resource
private RawGoodsMapper rawGoodsMapper;
@Override
public Long createRawGoods(RawGoodsSaveReqVO createReqVO) {
// 插入
RawGoodsDO rawGoods = BeanUtils.toBean(createReqVO, RawGoodsDO.class);
rawGoodsMapper.insert(rawGoods);
// 返回
return rawGoods.getId();
}
@Override
public void updateRawGoods(RawGoodsSaveReqVO updateReqVO) {
// 校验存在
validateRawGoodsExists(updateReqVO.getId());
// 更新
RawGoodsDO updateObj = BeanUtils.toBean(updateReqVO, RawGoodsDO.class);
rawGoodsMapper.updateById(updateObj);
}
@Override
public void deleteRawGoods(Long id) {
// 校验存在
validateRawGoodsExists(id);
// 删除
rawGoodsMapper.deleteById(id);
}
private void validateRawGoodsExists(Long id) {
if (rawGoodsMapper.selectById(id) == null) {
throw exception(RAW_GOODS_NOT_EXISTS);
}
}
@Override
public RawGoodsDO getRawGoods(Long id) {
return rawGoodsMapper.selectById(id);
}
@Override
public PageResult<RawGoodsDO> getRawGoodsPage(RawGoodsPageReqVO pageReqVO) {
return rawGoodsMapper.selectPage(pageReqVO);
}
@Override
@Transactional(rollbackFor = Exception.class) // 添加事务,异常则回滚所有导入
public RawGoodsImportRespVO importRawGoodsList(List<RawGoodsSaveReqVO> importRawGoods, Long orderId) {
if (CollUtil.isEmpty(importRawGoods)) {
throw ServiceExceptionUtil.exception(ErrorCodeConstants.RAW_GOODS_IMPORT_LIST_IS_EMPTY);
}
RawGoodsImportRespVO respVO = RawGoodsImportRespVO.builder().createRawGoods(new ArrayList<>())
.updateRawGoods(new ArrayList<>()).failureRawGoods(new LinkedHashMap<>()).build();
importRawGoods.forEach(rawGoodsSaveReqVO -> {
try{
rawGoodsMapper.insert(BeanUtils.toBean(rawGoodsSaveReqVO, RawGoodsDO.class)
.setOrderId(orderId));
respVO.getCreateRawGoods().add(rawGoodsSaveReqVO.getGoodsName());
}catch (ServiceException ex){
respVO.getFailureRawGoods().put(rawGoodsSaveReqVO.getGoodsName(), ex.getMessage());
}
});
return respVO;
}
}
@@ -0,0 +1,10 @@
package com.cf.imes.module.executor.util;
/**
* 生产单新增传入文件格式转换工具
* @author: 晨丰科技
* @date: 2024/3/13 17:31
*/
public interface FileTypeChangeUtil {
}
@@ -1,70 +0,0 @@
package com.cf.imes.module.executor.util;
/**
* @projectName: cf_imes_back
* @author: 晨丰科技
* @date: 2024/3/5 10:55
* 生产单id创建
*/
public class IdGenerator {
private static final long START_TIMESTAMP = 1613203200000L; // 设置起始时间戳为2021-02-13 00:00:00
private static final long WORKER_ID_BITS = 5L;
private static final long DATABASE_ID_BITS = 5L;
private static final long SEQUENCE_BITS = 12L;
private static final long MAX_WORKER_ID = -1L ^ (-1L << WORKER_ID_BITS);
private static final long MAX_DATABASE_ID = -1L ^ (-1L << DATABASE_ID_BITS);
private static final long WORKER_ID_SHIFT = SEQUENCE_BITS;
private static final long DATABASE_ID_SHIFT = SEQUENCE_BITS + WORKER_ID_BITS;
private static final long TIMESTAMP_LEFT_SHIFT = SEQUENCE_BITS + WORKER_ID_BITS + DATABASE_ID_BITS;
private long workerId;
private long databaseId;
private long sequence = 0L;
private long lastTimestamp = -1L;
public IdGenerator(long workerId, long databaseId) {
if (workerId > MAX_WORKER_ID || workerId < 0) {
throw new IllegalArgumentException("Worker ID must be between 0 and " + MAX_WORKER_ID);
}
if (databaseId > MAX_DATABASE_ID || databaseId < 0) {
throw new IllegalArgumentException("Database ID must be between 0 and " + MAX_DATABASE_ID);
}
this.workerId = workerId;
this.databaseId = databaseId;
}
public synchronized long generateId() {
long timestamp = System.currentTimeMillis();
if (timestamp < lastTimestamp) {
throw new RuntimeException("Clock moved backwards. Refusing to generate ID for " + (lastTimestamp - timestamp) + " milliseconds");
}
if (timestamp == lastTimestamp) {
sequence = (sequence + 1) & ((1 << SEQUENCE_BITS) - 1);
if (sequence == 0) {
timestamp = tilNextMillis(lastTimestamp);
}
} else {
sequence = 0;
}
lastTimestamp = timestamp;
return ((timestamp - START_TIMESTAMP) << TIMESTAMP_LEFT_SHIFT)
| (workerId << WORKER_ID_SHIFT)
| (databaseId << DATABASE_ID_SHIFT)
| sequence;
}
private long tilNextMillis(long lastTimestamp) {
long timestamp = System.currentTimeMillis();
while (timestamp <= lastTimestamp) {
timestamp = System.currentTimeMillis();
}
return timestamp;
}
}
@@ -1,56 +0,0 @@
package com.cf.imes.module.executor.util;
import com.cf.imes.framework.excel.core.util.ExcelUtils;
import org.apache.poi.ss.usermodel.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
public class OrderExcelUtil extends ExcelUtils {
public static <T> List<T> read(MultipartFile file, Class<T> head , int upload) throws IOException {
if (file.isEmpty()) {
throw new IOException("文件为空");
} else if (!file.getOriginalFilename().endsWith(".xlsx")) {
throw new IOException("文件格式不正确");
} else if (file.getSize() > 1024 * 1024 * 10) {
throw new IOException("文件大小超过 10M");
} else if (file.getSize() == 0) {
throw new IOException("文件大小为 0");
} else {
//读取文件内容
try {
// 将 MultipartFile 转换为 InputStream
InputStream inputStream = file.getInputStream();
// 使用 WorkbookFactory 创建 Workbook 对象
Workbook workbook = WorkbookFactory.create(inputStream);
Sheet sheet = workbook.getSheetAt(0);
extractOrderInformation(sheet, file);
workbook.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return null;
}
private static void extractOrderInformation(Sheet sheet, MultipartFile file) throws IOException {
int rowNum=sheet.getLastRowNum();
for (Row row : sheet) {
Cell firstCell = row.getCell(0);
if (firstCell != null && firstCell.getCellType() == CellType.STRING) {
String cellValue = firstCell.getStringCellValue().trim();
if (cellValue.equals("&&&")) {
}
}
}
}
}
@@ -0,0 +1,97 @@
package com.cf.imes.module.executor.util.excel;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.excel.exception.ExcelDataConvertException;
import lombok.extern.slf4j.Slf4j;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Slf4j
public final class ExcelListener<T> extends AnalysisEventListener<T> {
/**
* 自定义用于暂时存储data
* 可以通过实例获取该值
*/
private List<T> datas = new ArrayList<>();
private boolean flag = true;
private String value = null;
/**
* 每解析一行都会回调invoke()方法
*
* @param data 读取后的数据对象
* @param context 内容
*/
@Override
public void invoke(T data, AnalysisContext context) {
datas.add(data);
}
/**
* 读取完后操作
*
* @param context
*/
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
if (this.flag)
log.info("所有数据读取完成");
}
/**
* 异常方法 (类型转换异常也会执行此方法) (读取一行抛出异常也会执行此方法)
*
* @param exception
* @param context
* @throws Exception
*/
@Override
public void onException(Exception exception, AnalysisContext context) {
log.info("有异常");
this.flag = false;
// 如果是某一个单元格的转换异常 能获取到具体行号
// 如果要获取头的信息 配合invokeHeadMap使用
if (exception instanceof ExcelDataConvertException) {
ExcelDataConvertException excelDataConvertException = (ExcelDataConvertException) exception;
log.error("第{}行,第{}列解析异常,数据为:{}", excelDataConvertException.getRowIndex() + 1,
excelDataConvertException.getColumnIndex(), excelDataConvertException.getCellData());
value = String.valueOf(new RuntimeException("" + (excelDataConvertException.getRowIndex() + 1) + "" +
",第" + (excelDataConvertException.getColumnIndex() + 1) + "列读取错误"));
}
}
/**
* 返回数据
*
* @return 返回读取的数据集合
**/
public List<T> getDatas() {
return datas;
}
/**
* 返回读取结果
*
* @return 是否读取成功
**/
public boolean getFlag() {
return flag;
}
/**
* 返回错误信息
*
* @return String
**/
public String getValue() {
return value;
}
}
@@ -0,0 +1,47 @@
package com.cf.imes.module.executor.util.excel;
import com.alibaba.excel.EasyExcel;
import com.cf.imes.framework.excel.core.util.ExcelUtils;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class OrderExcelUtil extends ExcelUtils {
private static String value;
public static <T> List<T> read(MultipartFile file, Class<T> head) throws IOException {
ExcelListener<T> excelListener = new ExcelListener<>();
if (file.isEmpty()) {
value = "文件为空";
throw new IOException("文件为空");
} else if (!file.getOriginalFilename().endsWith(".xlsx")) {
value = "文件格式不正确";
throw new IOException("文件格式不正确");
} else if (file.getSize() > 1024 * 1024 * 10) {
value = "文件大小超过 10M";
throw new IOException("文件大小超过 10M");
} else if (file.getSize() == 0) {
value = "文件大小为 0";
throw new IOException("文件大小为 0");
} else {
//读取文件内容
EasyExcel.read(file.getInputStream(), head, excelListener).headRowNumber(7).sheet(0).doRead();
//获取读取的数据
List<T> list = excelListener.getDatas();
if (excelListener.getFlag())
return list;
value = excelListener.getValue();
return null;
}
}
public static <T> Map<String, String> getValue() {
Map<String, String> err = new HashMap<>();
err.put("err", value);
return err;
}
}
@@ -1,15 +1,4 @@
{ {
"OrderNo" : "$OrderNo$ 订单号",
"CustomOrderNo" : "$CustomOrderNo$ 自定义单号",
"CustomNo": "$CustomNo$ 客户代码(经销商)",
"CustomName": "$CustomName$ 客户名称(经销商)",
"SalePerson": "$SalePerson$ 业务员",
"SaleDate": "$SaleDate$ 销售日期",
"DeliveryDate": "$DeliveryDate$ 送货日期",
"Consignee": "$Consignee$ 收货人(终端客户)",
"ConsigneePhone": "$ConsigneePhone$ 收货电话(终端客户电话)",
"ConsigneeAddress": "$ConsigneeAddress$ 地址",
"OrderRemark": "$Remark$ 备注",
"IOriginModelingData //造型数据": { "IOriginModelingData //造型数据": {
"outline": "IContourData 轮郭", "outline": "IContourData 轮郭",
"holes //孔轮廓": { "holes //孔轮廓": {
@@ -118,8 +107,8 @@
"PointY2": "number y2", "PointY2": "number y2",
"Angle": "number 角度" "Angle": "number 角度"
}, },
"PlateRemark //备注": { "remark //备注": {
"remark": "string 备注", "remark1": "string 备注",
"remark2": "string 备注2" "remark2": "string 备注2"
} }
} }
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.cf.imes.module.executor.dal.mysql.orderBody.OrderBodyMapper">
<update id="updatePlateNumById" >
update `order_body` set plate_num = #{plateNum} where id = #{orderId}
</update>
</mapper>
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.cf.imes.module.executor.dal.mysql.orderGroup.OrderGroupMapper">
<update id="updatePlateNumById" >
update `order_group` set plate_num = #{plateNum} where id = #{orderId}
</update>
</mapper>
@@ -102,9 +102,9 @@ public class PlateController {
// 手动创建导出 demo // 手动创建导出 demo
List<PlateImportExcelVO> list = Arrays.asList( List<PlateImportExcelVO> list = Arrays.asList(
PlateImportExcelVO.builder().goodsId("SP1123456").goodsName("xixih").material("颗粒板").width(BigDecimal.valueOf(1212.3)).height(BigDecimal.valueOf(12131.6)) PlateImportExcelVO.builder().goodsId("SP1123456").goodsName("xixih").material("颗粒板").width(BigDecimal.valueOf(1212.3)).height(BigDecimal.valueOf(12131.6))
.thickness(BigDecimal.valueOf(0.2)).price(33333.2).brand("SexEnum.MALE.getSex()").spec("大厂").remark("测试").build(), .thickness(BigDecimal.valueOf(0.2)).brand("SexEnum.MALE.getSex()").spec("大厂").remark("测试").build(),//.price(33333.2)
PlateImportExcelVO.builder().goodsId("SP1123457").goodsName("2L").material("yuanma@cf.com").width(BigDecimal.valueOf(21.6)).height(BigDecimal.valueOf(123231.6)) PlateImportExcelVO.builder().goodsId("SP1123457").goodsName("2L").material("yuanma@cf.com").width(BigDecimal.valueOf(21.6)).height(BigDecimal.valueOf(123231.6))
.thickness(BigDecimal.valueOf(5.3)).price(333.555).brand("kkkkkk").spec("大厂").remark("测试").build() .thickness(BigDecimal.valueOf(5.3)).brand("kkkkkk").spec("大厂").remark("测试").build()//.price(333.555)
); );
// 输出 // 输出
ExcelUtils.write(response, "板材导入模板.xls", "板材列表", PlateImportExcelVO.class, list); ExcelUtils.write(response, "板材导入模板.xls", "板材列表", PlateImportExcelVO.class, list);
@@ -114,11 +114,13 @@ public class PlateController {
@Operation(summary = "导入板材") @Operation(summary = "导入板材")
@Parameters({ @Parameters({
@Parameter(name = "file", description = "Excel 文件", required = true), @Parameter(name = "file", description = "Excel 文件", required = true),
@Parameter(name = "updateSupport", description = "是否支持更新,默认为 false", example = "true") @Parameter(name = "updateSupport", description = "是否支持更新,默认为 false", example = "true"),
@Parameter(name = "organId", description = "板材所属组织ID")
}) })
@PreAuthorize("@ss.hasPermission('manage:plate:import')") @PreAuthorize("@ss.hasPermission('manage:plate:import')")
public CommonResult<PlateImportRespVO> importExcel(@RequestParam("file") MultipartFile file, public CommonResult<PlateImportRespVO> importExcel(@RequestParam("file") MultipartFile file,
@RequestParam(value = "updateSupport", required = false, defaultValue = "false") Boolean updateSupport) throws Exception { @RequestParam(value = "updateSupport", required = false, defaultValue = "false") Boolean updateSupport,
@RequestParam(value = "organId") Long organId) throws Exception {
List<PlateImportExcelVO> list = ExcelUtils.read(file, PlateImportExcelVO.class); List<PlateImportExcelVO> list = ExcelUtils.read(file, PlateImportExcelVO.class);
return success(plateService.importPlateList(list, updateSupport)); return success(plateService.importPlateList(list, updateSupport));
// return null; // return null;
@@ -45,8 +45,8 @@ public class PlateImportExcelVO {
@ExcelProperty("厚度") @ExcelProperty("厚度")
private BigDecimal thickness; private BigDecimal thickness;
@ExcelProperty("价格") // @ExcelProperty("价格")
private Double price; // private Double price;
@ExcelProperty("品牌") @ExcelProperty("品牌")
private String brand; private String brand;
@@ -38,8 +38,8 @@ public class PlatePageReqVO extends PageParam {
@Schema(description = "厚度") @Schema(description = "厚度")
private BigDecimal thickness; private BigDecimal thickness;
@Schema(description = "价格", example = "3380") // @Schema(description = "价格", example = "3380")
private Double price; // private Double price;
@Schema(description = "品牌") @Schema(description = "品牌")
private String brand; private String brand;
@@ -54,4 +54,5 @@ public class PlatePageReqVO extends PageParam {
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime; private LocalDateTime[] createTime;
private Long organId;
} }
@@ -47,9 +47,9 @@ public class PlateRespVO {
@ExcelProperty("厚度") @ExcelProperty("厚度")
private BigDecimal thickness; private BigDecimal thickness;
@Schema(description = "价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "3380") // @Schema(description = "价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "3380")
@ExcelProperty("价格") // @ExcelProperty("价格")
private Double price; // private Double price;
@Schema(description = "品牌", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "品牌", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("品牌") @ExcelProperty("品牌")
@@ -67,4 +67,5 @@ public class PlateRespVO {
@ExcelProperty("创建时间") @ExcelProperty("创建时间")
private LocalDateTime createTime; private LocalDateTime createTime;
private Long organId;
} }
@@ -41,9 +41,9 @@ public class PlateSaveReqVO {
@NotNull(message = "厚度不能为空") @NotNull(message = "厚度不能为空")
private BigDecimal thickness; private BigDecimal thickness;
@Schema(description = "价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "3380") // @Schema(description = "价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "3380")
@NotNull(message = "价格不能为空") // @NotNull(message = "价格不能为空")
private Double price; // private Double price;
@Schema(description = "品牌", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "品牌", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "品牌不能为空") @NotEmpty(message = "品牌不能为空")
@@ -57,4 +57,5 @@ public class PlateSaveReqVO {
@NotEmpty(message = "备注不能为空") @NotEmpty(message = "备注不能为空")
private String remark; private String remark;
private Long organId;
} }
@@ -60,7 +60,7 @@ public class PlateDO extends BaseDO {
/** /**
* 价格 * 价格
*/ */
private Double price; // private Double price;
/** /**
* 品牌 * 品牌
*/ */
@@ -28,7 +28,7 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
.eqIfPresent(PlateDO::getWidth, reqVO.getWidth()) .eqIfPresent(PlateDO::getWidth, reqVO.getWidth())
.eqIfPresent(PlateDO::getHeight, reqVO.getHeight()) .eqIfPresent(PlateDO::getHeight, reqVO.getHeight())
.eqIfPresent(PlateDO::getThickness, reqVO.getThickness()) .eqIfPresent(PlateDO::getThickness, reqVO.getThickness())
.eqIfPresent(PlateDO::getPrice, reqVO.getPrice()) // .eqIfPresent(PlateDO::getPrice, reqVO.getPrice())
.eqIfPresent(PlateDO::getBrand, reqVO.getBrand()) .eqIfPresent(PlateDO::getBrand, reqVO.getBrand())
.eqIfPresent(PlateDO::getSpec, reqVO.getSpec()) .eqIfPresent(PlateDO::getSpec, reqVO.getSpec())
.eqIfPresent(PlateDO::getRemark, reqVO.getRemark()) .eqIfPresent(PlateDO::getRemark, reqVO.getRemark())
@@ -4,6 +4,7 @@ import com.cf.imes.framework.common.pojo.CommonResult;
import com.cf.imes.framework.common.util.collection.CollectionUtils; import com.cf.imes.framework.common.util.collection.CollectionUtils;
import com.cf.imes.module.system.api.user.dto.AdminUserRespDTO; import com.cf.imes.module.system.api.user.dto.AdminUserRespDTO;
import com.cf.imes.module.system.enums.ApiConstants; import com.cf.imes.module.system.enums.ApiConstants;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
@@ -58,4 +59,12 @@ public interface AdminUserApi {
@Parameter(name = "ids", description = "用户编号数组", example = "3,5", required = true) @Parameter(name = "ids", description = "用户编号数组", example = "3,5", required = true)
CommonResult<Boolean> validateUserList(@RequestParam("ids") Set<Long> ids); CommonResult<Boolean> validateUserList(@RequestParam("ids") Set<Long> ids);
@GetMapping(PREFIX + "/valid")
@Operation(summary = "通过用户名称获取用户信息")
@Parameters({
@Parameter(name = "name", description = "用户名称", example = "1", required = true),
@Parameter(name = "organId", description = "组织编号", example = "晨丰科技", required = true)
})
CommonResult<AdminUserRespDTO> validateUser(@RequestParam("name") String name, @RequestParam("organId") Long organId);
} }
@@ -206,4 +206,18 @@ public interface ErrorCodeConstants {
ErrorCode PROCESS_USER_NOT_EXISTS = new ErrorCode(1_002_032_002, "工序用户不存在"); ErrorCode PROCESS_USER_NOT_EXISTS = new ErrorCode(1_002_032_002, "工序用户不存在");
ErrorCode PROCESS_USER_EXISTS = new ErrorCode(1_002_032_002, "工序用户存在"); ErrorCode PROCESS_USER_EXISTS = new ErrorCode(1_002_032_002, "工序用户存在");
//=========== 板材信息 1-002-035-000 ============
ErrorCode RAW_GOODS_NOT_EXISTS = new ErrorCode(1_002_033_001, "设计板材不存再");
ErrorCode RAW_GOODS_IMPORT_LIST_IS_EMPTY = new ErrorCode(1_002_033_002, "生产板材导入数据不可以为空");
//=========== 配件信息 1-002-035-000 ============
ErrorCode ORDER_PARTS_IMPORT_LIST_IS_EMPTY = new ErrorCode(1_002_034_001, "生产配件导入数据不可以为空");
//=========== 柜体信息 1-002-035-000 ============
ErrorCode ORDER_BODY_NOT_EXISTS = new ErrorCode(1_002_035_001, "柜体信息不存在");
//=========== 柜体信息 1-002-035-000 ============
ErrorCode ORDER_GROUP_NOT_EXISTS = new ErrorCode(1_002_036_001, "加工组信息不存在");
} }
@@ -52,4 +52,11 @@ public class AdminUserApiImpl implements AdminUserApi {
return success(true); return success(true);
} }
@Override
public CommonResult<AdminUserRespDTO> validateUser(String name, Long organId) {
AdminUserDO user = userService.getUserByUsername(name, organId);
return success(BeanUtils.toBean(user, AdminUserRespDTO.class));
}
} }
@@ -5,6 +5,7 @@ import javax.validation.Valid;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.collection.CollUtil;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@@ -78,8 +79,8 @@ public class ProcessController {
@Operation(summary = "获得工序信息分页") @Operation(summary = "获得工序信息分页")
@PreAuthorize("@ss.hasPermission('system:process:query')") @PreAuthorize("@ss.hasPermission('system:process:query')")
public CommonResult<PageResult<ProcessRespVO>> getProcessPage(@Valid ProcessPageReqVO pageReqVO) { public CommonResult<PageResult<ProcessRespVO>> getProcessPage(@Valid ProcessPageReqVO pageReqVO) {
PageResult<ProcessDO> pageResult = processService.getProcessPage(pageReqVO); PageResult<ProcessRespVO> pageResult = processService.getProcessPageAll(pageReqVO);
return success(BeanUtils.toBean(pageResult, ProcessRespVO.class)); return success(pageResult);
} }
@GetMapping("/export-excel") @GetMapping("/export-excel")
@@ -55,4 +55,10 @@ public class ProcessPageReqVO extends PageParam {
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime; private LocalDateTime[] createTime;
@Schema(description = "用户id查询")
private String userId;
@Schema(description = "组织id")
private Long organId;
} }
@@ -67,4 +67,7 @@ public class ProcessRespVO {
@ExcelProperty("创建时间") @ExcelProperty("创建时间")
private LocalDateTime createTime; private LocalDateTime createTime;
@Schema(description = "工序中的用户ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "12,13")
private String users;
} }
@@ -35,6 +35,24 @@ public interface ProcessMapper extends BaseMapperX<ProcessDO> {
.orderByDesc(ProcessDO::getId)); .orderByDesc(ProcessDO::getId));
} }
// default PageResult<ProcessPageReqVO> selectPage(ProcessPageReqVO reqVO) {
// return selectPage(reqVO, new LambdaQueryWrapperX<ProcessPageReqVO>()
// .likeIfPresent(ProcessPageReqVO::getName, reqVO.getName())
// .eqIfPresent(ProcessPageReqVO::getPieceRate, reqVO.getPieceRate())
// .eqIfPresent(ProcessPageReqVO::getPieceType, reqVO.getPieceType())
// .eqIfPresent(ProcessPageReqVO::getType, reqVO.getType())
// .eqIfPresent(ProcessPageReqVO::getIsCustom, reqVO.getIsCustom())
// .eqIfPresent(ProcessPageReqVO::getIsDealer, reqVO.getIsDealer())
// .eqIfPresent(ProcessPageReqVO::getSort, reqVO.getSort())
// .eqIfPresent(ProcessPageReqVO::getHourCapacity, reqVO.getHourCapacity())
// .eqIfPresent(ProcessPageReqVO::getUnit, reqVO.getUnit())
// .eqIfPresent(ProcessPageReqVO::getIsEnabled, reqVO.getIsEnabled())
// .betweenIfPresent(ProcessPageReqVO::getPrepareTime, reqVO.getPrepareTime())
// .eqIfPresent(ProcessPageReqVO::getDescription, reqVO.getDescription())
// .betweenIfPresent(ProcessPageReqVO::getCreateTime, reqVO.getCreateTime())
// .orderByDesc(ProcessPageReqVO::getId));
// }
default List<ProcessDO> selectAll() { default List<ProcessDO> selectAll() {
return selectList(new LambdaQueryWrapperX<ProcessDO>() return selectList(new LambdaQueryWrapperX<ProcessDO>()
.orderByDesc(ProcessDO::getId)); .orderByDesc(ProcessDO::getId));
@@ -88,10 +88,9 @@ public class ProcessGroupServiceImpl implements ProcessGroupService {
String[] items = processGroup.getItems().split(","); String[] items = processGroup.getItems().split(",");
List<ProcessRespVO> lists = new ArrayList<>(); List<ProcessRespVO> lists = new ArrayList<>();
for (int i = 0; i < items.length; i++) { for (int i = 0; i < items.length; i++) {
lists.add(BeanUtils.toBean(processMapper.selectById(items[i]), ProcessRespVO.class)); if (processMapper.selectById(items[i]) != null)
System.out.println("each List " + BeanUtils.toBean(processMapper.selectById(items[i]), ProcessRespVO.class)); lists.add(BeanUtils.toBean(processMapper.selectById(items[i]), ProcessRespVO.class));
} }
System.out.println("processGroupSaveReqVO = " + processListSaveReqVO);
processListSaveReqVO.setLists(lists); processListSaveReqVO.setLists(lists);
return processListSaveReqVO; return processListSaveReqVO;
} }
@@ -1,9 +1,6 @@
package com.cf.imes.module.system.service.process; package com.cf.imes.module.system.service.process;
import com.cf.imes.module.system.controller.admin.process.vo.process.ProcessPageReqVO; import com.cf.imes.module.system.controller.admin.process.vo.process.*;
import com.cf.imes.module.system.controller.admin.process.vo.process.ProcessSaveReqVO;
import com.cf.imes.module.system.controller.admin.process.vo.process.ProcessUserRespVO;
import com.cf.imes.module.system.controller.admin.process.vo.process.ProcessUserSaveReqVO;
import com.cf.imes.module.system.dal.dataobject.process.ProcessDO; import com.cf.imes.module.system.dal.dataobject.process.ProcessDO;
import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.pojo.PageResult;
@@ -55,6 +52,13 @@ public interface ProcessService {
*/ */
PageResult<ProcessDO> getProcessPage(ProcessPageReqVO pageReqVO); PageResult<ProcessDO> getProcessPage(ProcessPageReqVO pageReqVO);
/**
* 获得工序信息表 process分页
*
* @param pageReqVO 分页查询
* @return 工序信息表 process分页
*/
PageResult<ProcessRespVO> getProcessPageAll(ProcessPageReqVO pageReqVO);
/** /**
* 获得所有工序信息表 process * 获得所有工序信息表 process
* *
@@ -1,9 +1,8 @@
package com.cf.imes.module.system.service.process; package com.cf.imes.module.system.service.process;
import com.cf.imes.module.system.controller.admin.process.vo.process.ProcessPageReqVO; import cn.hutool.core.util.StrUtil;
import com.cf.imes.module.system.controller.admin.process.vo.process.ProcessSaveReqVO; import com.cf.imes.framework.common.util.pinyin.PinYinUtils;
import com.cf.imes.module.system.controller.admin.process.vo.process.ProcessUserRespVO; import com.cf.imes.module.system.controller.admin.process.vo.process.*;
import com.cf.imes.module.system.controller.admin.process.vo.process.ProcessUserSaveReqVO;
import com.cf.imes.module.system.controller.admin.process.vo.processUser.ProcessAndUserSaveReqVO; import com.cf.imes.module.system.controller.admin.process.vo.processUser.ProcessAndUserSaveReqVO;
import com.cf.imes.module.system.dal.dataobject.process.ProcessUserDO; import com.cf.imes.module.system.dal.dataobject.process.ProcessUserDO;
import com.cf.imes.module.system.dal.mysql.process.ProcessUserMapper; import com.cf.imes.module.system.dal.mysql.process.ProcessUserMapper;
@@ -141,6 +140,35 @@ public class ProcessServiceImpl implements ProcessService {
return processMapper.selectPage(pageReqVO); return processMapper.selectPage(pageReqVO);
} }
@Override
public PageResult<ProcessRespVO> getProcessPageAll(ProcessPageReqVO pageReqVO) {
PageResult<ProcessDO> processList = processMapper.selectPage(pageReqVO);
PageResult<ProcessRespVO> processRespVOPageResult = new PageResult<ProcessRespVO>();
processRespVOPageResult.setTotal(processList.getTotal());
processList.getList().forEach(processDO -> {
ProcessRespVO processRespVO = BeanUtils.toBean(processDO, ProcessRespVO.class);
StringBuilder userIdBuilder = new StringBuilder();
List<ProcessUserDO> userIdListsByProcessId = processUserService.getProcessUser(processDO.getId());
if (userIdListsByProcessId != null) {
for (ProcessUserDO processUser : userIdListsByProcessId) {
if (processUser != null && processUser.getUserId() != null) {
if (adminUserService.getUser(processUser.getUserId()) != null) {
userIdBuilder.append(",").append(processUser.getUserId());
}
if (pageReqVO.getUserId() != null && pageReqVO.getUserId().equals("")) {
if (processUser.getUserId().equals(pageReqVO.getUserId()))
break;
}
}
}
}
processRespVO.setUsers(userIdBuilder.length() > 0 ? userIdBuilder.substring(1) : "");
processRespVOPageResult.getList().add(processRespVO);
});
return processRespVOPageResult;
}
@Override @Override
public List<ProcessDO> getAllProcess() { public List<ProcessDO> getAllProcess() {
List<ProcessDO> processDOList = processMapper.selectAll(); List<ProcessDO> processDOList = processMapper.selectAll();