mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 12:52:07 +08:00
数据文件转换存储修改
This commit is contained in:
Binary file not shown.
+1
-1
@@ -44,5 +44,5 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode CUSTOM_ORDER_EXISTS = new ErrorCode(1_001_117_000, "自定义生产单号存在");
|
||||
ErrorCode SALESMAN_ORDER_NOT_EXISTS = new ErrorCode(1_001_118_000, "业务员不存在");
|
||||
ErrorCode SPLITTER_ORDER_NOT_EXISTS = new ErrorCode(1_001_119_000, "拆单员不存在");
|
||||
ErrorCode ORDER_IMPORT_FAIL = new ErrorCode(1_001_119_000, "生产单导入错误");
|
||||
ErrorCode ORDER_PROCESS_NOT_EXISTS = new ErrorCode(1_001_119_000, "工序组不存在");
|
||||
}
|
||||
|
||||
@@ -24,6 +24,10 @@
|
||||
<artifactId>cf-module-prod-executor-api</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf-spring-boot-starter-biz-dict</artifactId>
|
||||
</dependency>
|
||||
<!-- 业务组件 -->
|
||||
<dependency>
|
||||
<groupId>com.cf.imes</groupId>
|
||||
|
||||
+18
-6
@@ -157,12 +157,12 @@ public class OrderController {
|
||||
@Parameters({
|
||||
@Parameter(name = "file", description = "Excel 文件", required = true),
|
||||
@Parameter(name = "isAddPlate", description = "是否为生产单新增板材", example = "false"),
|
||||
@Parameter(name = "upload", description = "是否只上传表头,默认为只上传表头", example = "true")
|
||||
@Parameter(name = "upload", description = "是否只上传表头,默认为只上传表头", example = "false")
|
||||
})
|
||||
@PreAuthorize("@ss.hasPermission('executor:order:import')")
|
||||
public CommonResult<OrderImportRespVO> importExcel(@RequestPart("file") MultipartFile file,
|
||||
@RequestParam(value = "isAddPlate", required = false, defaultValue = "false") Boolean isAddPlate,
|
||||
@RequestParam(value = "upload", required = false, defaultValue = "true") Boolean upload,
|
||||
@RequestParam(value = "upload", required = false, defaultValue = "false") Boolean upload,
|
||||
@RequestPart("orderSaveReqVO") OrderSaveReqVO createReqVO) throws IOException {
|
||||
|
||||
OrderImportRespVO orderImportRespVO = orderService.importOrderList(upload, file, createReqVO, isAddPlate);
|
||||
@@ -181,13 +181,25 @@ public class OrderController {
|
||||
|
||||
// 获取当前条件下所有生产单信息
|
||||
@GetMapping("/allOrder")
|
||||
@Operation(summary = "条件选择获得生产单表")
|
||||
@Operation(summary = "获得所有生产单")
|
||||
@PreAuthorize("@ss.hasPermission('executor:order:query')")
|
||||
public CommonResult<PageResult<OrderRespVO>> getAllOrder(@Valid OrderPageReqVO pageReqVO) {
|
||||
PageResult<OrderDO> pageResult = orderService.getOrderPage(pageReqVO);
|
||||
public CommonResult<List<OrderRespVO>> getOrderCheck(@Valid OrderPageReqVO pageReqVO) {
|
||||
List<OrderDO> pageResult = orderService.getAllOrderCheck(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, OrderRespVO.class));
|
||||
}
|
||||
|
||||
// 生产单增加工序
|
||||
@PostMapping("/addOrderProcess")
|
||||
@Operation(summary = "生产单增加工序")
|
||||
@Parameters({
|
||||
@Parameter(name = "orderId", description = "生产单编号", required = true, example = "1024"),
|
||||
@Parameter(name = "processGroupId", description = "工序组编号", required = true, example = "1024")
|
||||
})
|
||||
@PreAuthorize("@ss.hasPermission('executor:order:query')")
|
||||
public CommonResult<Boolean> addOrderProcess(@RequestParam("orderId")Long orderId,
|
||||
@RequestParam("processGroupId")Long processGroupId) {
|
||||
orderService.addOrderProcess(orderId , processGroupId);
|
||||
return success(true);
|
||||
}
|
||||
// 获得当前生产单的工序信息
|
||||
// @GetMapping("/getOrderProcess")
|
||||
// @Operation(summary = "生产单获取工序信息")
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ public class OrderPartsPageReqVO extends PageParam {
|
||||
private String material;
|
||||
|
||||
@Schema(description = "配件类型", example = "2")
|
||||
private String type;
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "型号")
|
||||
private String model;
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ public class OrderPartsRespVO {
|
||||
|
||||
@Schema(description = "配件类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@ExcelProperty("配件类型")
|
||||
private String type;
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "型号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("型号")
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ public class OrderPartsSaveReqVO {
|
||||
|
||||
@Schema(description = "配件类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotEmpty(message = "配件类型不能为空")
|
||||
private String type;
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "型号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "型号不能为空")
|
||||
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
package com.cf.imes.module.executor.controller.admin.process;
|
||||
|
||||
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.process.vo.*;
|
||||
import com.cf.imes.module.executor.dal.dataobject.process.OrderProcessDO;
|
||||
import com.cf.imes.module.executor.service.process.OrderProcessService;
|
||||
|
||||
@Tag(name = "管理后台 - 生产单工序")
|
||||
@RestController
|
||||
@RequestMapping("/executor/order-process")
|
||||
@Validated
|
||||
public class OrderProcessController {
|
||||
|
||||
@Resource
|
||||
private OrderProcessService orderProcessService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建生产单工序")
|
||||
@PreAuthorize("@ss.hasPermission('executor:order-process:create')")
|
||||
public CommonResult<Long> createOrderProcess(@Valid @RequestBody OrderProcessSaveReqVO createReqVO) {
|
||||
return success(orderProcessService.createOrderProcess(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新生产单工序")
|
||||
@PreAuthorize("@ss.hasPermission('executor:order-process:update')")
|
||||
public CommonResult<Boolean> updateOrderProcess(@Valid @RequestBody OrderProcessSaveReqVO updateReqVO) {
|
||||
orderProcessService.updateOrderProcess(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除生产单工序")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('executor:order-process:delete')")
|
||||
public CommonResult<Boolean> deleteOrderProcess(@RequestParam("id") Long id) {
|
||||
orderProcessService.deleteOrderProcess(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得生产单工序")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('executor:order-process:query')")
|
||||
public CommonResult<OrderProcessRespVO> getOrderProcess(@RequestParam("id") Long id) {
|
||||
OrderProcessDO orderProcess = orderProcessService.getOrderProcess(id);
|
||||
return success(BeanUtils.toBean(orderProcess, OrderProcessRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
package com.cf.imes.module.executor.controller.admin.process.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 = "管理后台 - 生产单工序分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class OrderProcessPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "生产单号")
|
||||
private Long orderNo;
|
||||
|
||||
@Schema(description = "工序名", example = "张三")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "工序组 ID", example = "4356")
|
||||
private Long groupId;
|
||||
|
||||
@Schema(description = "工序状态,0未加工,1已加工", example = "2")
|
||||
private Boolean status;
|
||||
|
||||
@Schema(description = "板材大小")
|
||||
private Double size;
|
||||
|
||||
@Schema(description = "下一工序 ID", example = "24046")
|
||||
private Long nextStepId;
|
||||
|
||||
@Schema(description = "创建日期")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
package com.cf.imes.module.executor.controller.admin.process.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 = "管理后台 - 生产单工序 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class OrderProcessRespVO {
|
||||
|
||||
@Schema(description = "工序 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "31600")
|
||||
@ExcelProperty("工序 ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("生产单号")
|
||||
private Long orderNo;
|
||||
|
||||
@Schema(description = "工序名", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
|
||||
@ExcelProperty("工序名")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "工序组 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "4356")
|
||||
@ExcelProperty("工序组 ID")
|
||||
private Long groupId;
|
||||
|
||||
@Schema(description = "工序状态,0未加工,1已加工", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@ExcelProperty("工序状态,0未加工,1已加工")
|
||||
private Boolean status;
|
||||
|
||||
@Schema(description = "板材大小", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("板材大小")
|
||||
private Double size;
|
||||
|
||||
@Schema(description = "下一工序 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "24046")
|
||||
@ExcelProperty("下一工序 ID")
|
||||
private Long nextStepId;
|
||||
|
||||
@Schema(description = "创建日期", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建日期")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
package com.cf.imes.module.executor.controller.admin.process.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 生产单工序新增/修改 Request VO")
|
||||
@Data
|
||||
public class OrderProcessSaveReqVO {
|
||||
|
||||
@Schema(description = "工序 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "31600")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "生产单号不能为空")
|
||||
private Long orderNo;
|
||||
|
||||
@Schema(description = "工序名", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
|
||||
@NotEmpty(message = "工序名不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "工序组 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "4356")
|
||||
@NotNull(message = "工序组 ID不能为空")
|
||||
private Long groupId;
|
||||
|
||||
@Schema(description = "工序状态,0未加工,1已加工", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotNull(message = "工序状态,0未加工,1已加工不能为空")
|
||||
private Boolean status;
|
||||
|
||||
@Schema(description = "板材大小", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "板材大小不能为空")
|
||||
private Double size;
|
||||
|
||||
@Schema(description = "下一工序 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "24046")
|
||||
@NotNull(message = "下一工序 ID不能为空")
|
||||
private Long nextStepId;
|
||||
|
||||
}
|
||||
+1
-1
@@ -46,7 +46,7 @@ public class OrderPartsDO extends BaseDO {
|
||||
/**
|
||||
* 配件类型
|
||||
*/
|
||||
private String type;
|
||||
private Integer type;
|
||||
/**
|
||||
* 型号
|
||||
*/
|
||||
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
package com.cf.imes.module.executor.dal.dataobject.process;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* 生产单工序 DO
|
||||
*
|
||||
* @author 晨丰科技
|
||||
*/
|
||||
@TableName("order_process")
|
||||
@KeySequence("order_process_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class OrderProcessDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 工序 ID
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 生产单号
|
||||
*/
|
||||
private Long orderNo;
|
||||
/**
|
||||
* 工序名
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 工序组 ID
|
||||
*/
|
||||
private Long groupId;
|
||||
/**
|
||||
* 工序状态,0未加工,1已加工
|
||||
*/
|
||||
private Boolean status;
|
||||
/**
|
||||
* 板材大小
|
||||
*/
|
||||
private Double size;
|
||||
/**
|
||||
* 下一工序 ID
|
||||
*/
|
||||
private Long nextStepId;
|
||||
|
||||
}
|
||||
+22
-5
@@ -13,8 +13,10 @@ import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 生产单表 order_{N} Mapper
|
||||
@@ -49,10 +51,9 @@ public interface OrderMapper extends BaseMapperX<OrderDO> {
|
||||
|
||||
IPage<OrderRespVO> selectOrderPage(@Param("page") IPage page, @Param(Constants.WRAPPER) Wrapper<OrderDO> wrapper);
|
||||
|
||||
default PageResult<OrderDO> selectOrderCheck(OrderPageReqVO reqVO) {
|
||||
return selectPage(reqVO , null, new MPJLambdaWrapper<OrderDO>()
|
||||
default List<OrderDO> selectOrderCheck(OrderPageReqVO reqVO) {
|
||||
MPJLambdaWrapper<OrderDO> wrapper = new MPJLambdaWrapper<OrderDO>()
|
||||
.eqIfExists(OrderDO::getParentNo, reqVO.getParentNo())
|
||||
.between(OrderDO::getDeliveryDate, reqVO.getDeliveryDate()[0],reqVO.getDeliveryDate()[1])
|
||||
.eqIfExists(OrderDO::getType, reqVO.getType())
|
||||
.eqIfExists(OrderDO::getSort, reqVO.getSort())
|
||||
.eqIfExists(OrderDO::getDataType, reqVO.getDataType())
|
||||
@@ -67,8 +68,24 @@ public interface OrderMapper extends BaseMapperX<OrderDO> {
|
||||
.eqIfExists(OrderDO::getSplitter, reqVO.getSplitter())
|
||||
.eqIfExists(OrderDO::getRemark, reqVO.getRemark())
|
||||
.eqIfExists(OrderDO::getDeleted, reqVO.getDeleted())
|
||||
.between(OrderDO::getDeliveryDate, reqVO.getDeliveryDate()[0],reqVO.getDeliveryDate()[1])
|
||||
.orderByDesc(OrderDO::getId));
|
||||
.orderByDesc(OrderDO::getId);
|
||||
if (reqVO.getDeliveryDate() != null && reqVO.getDeliveryDate().length == 2) {
|
||||
LocalDateTime startTime = reqVO.getDeliveryDate()[0];
|
||||
LocalDateTime endTime = reqVO.getDeliveryDate()[1];
|
||||
|
||||
if (startTime != null) {
|
||||
wrapper.between(OrderDO::getDeliveryDate, startTime, endTime);
|
||||
}
|
||||
}
|
||||
if (reqVO.getCreateTime() != null && reqVO.getCreateTime().length == 2) {
|
||||
LocalDateTime startTime = reqVO.getCreateTime()[0];
|
||||
LocalDateTime endTime = reqVO.getCreateTime()[1];
|
||||
|
||||
if (startTime != null) {
|
||||
wrapper.between(OrderDO::getCreateTime, startTime, endTime);
|
||||
}
|
||||
}
|
||||
return selectList(wrapper);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.cf.imes.module.executor.dal.mysql.process;
|
||||
|
||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.cf.imes.module.executor.dal.dataobject.process.OrderProcessDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 生产单工序 Mapper
|
||||
*
|
||||
* @author 晨丰科技
|
||||
*/
|
||||
@Mapper
|
||||
public interface OrderProcessMapper extends BaseMapperX<OrderProcessDO> {
|
||||
|
||||
}
|
||||
+10
-1
@@ -80,5 +80,14 @@ public interface OrderService {
|
||||
* @param pageReqVO: 查询信息
|
||||
* @return List<OrderDO>
|
||||
*/
|
||||
PageResult<OrderDO> getAllOrderCheck(OrderPageReqVO pageReqVO);
|
||||
List<OrderDO> getAllOrderCheck(OrderPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* @param orderId:
|
||||
* @param processGroupId:
|
||||
* @return void
|
||||
* @author Administrator
|
||||
* @date 2024/3/26
|
||||
*/
|
||||
void addOrderProcess(Long orderId , Long processGroupId);
|
||||
}
|
||||
+60
-51
@@ -18,7 +18,11 @@ 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.executor.util.FileTypeChangeUtil;
|
||||
import com.cf.imes.module.executor.util.deviseData.Detail;
|
||||
import com.cf.imes.module.executor.util.deviseData.IBoardProdInfo;
|
||||
import com.cf.imes.module.executor.util.fileConversion.admin.files.excel.OrderExcelUtil;
|
||||
import com.cf.imes.module.executor.util.fileConversion.admin.files.excel.OrderPlateImportExcelVO;
|
||||
import com.cf.imes.module.system.api.user.AdminUserApi;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -86,6 +90,9 @@ public class OrderServiceImpl implements OrderService {
|
||||
@Resource
|
||||
private AdminUserApi adminUserApi;
|
||||
|
||||
@Resource
|
||||
private FileTypeChangeUtil fileTypeChangeUtil;
|
||||
|
||||
private static final int DEFAULT_DAYS_TO_ADD = 30;
|
||||
|
||||
|
||||
@@ -145,20 +152,23 @@ public class OrderServiceImpl implements OrderService {
|
||||
public OrderImportRespVO importOrderList(Boolean upload, MultipartFile file, OrderSaveReqVO createReqVO, Boolean isAddPlate) throws IOException {
|
||||
OrderImportRespVO orderImportRespVO = OrderImportRespVO.builder().createOrder(new ArrayList<>())
|
||||
.updateOrder(new ArrayList<>()).failureOrder(new LinkedHashMap<>()).build();
|
||||
// 上传文件类型判断,抽出文件中的板件信息
|
||||
List<OrderPlateImportExcelVO> list = new ArrayList<>();
|
||||
// List<IBoardProdInfo> list = new ArrayList<>();
|
||||
List<Detail> 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);//缺少数据转换
|
||||
System.out.println("================== " +list);
|
||||
if (list == null || list.size() == 0) {
|
||||
orderImportRespVO.getFailureOrder().put("生产单导入错误", String.valueOf(OrderExcelUtil.getValue()));
|
||||
// 文件数据读取
|
||||
List<Detail> iboardProdInfoList = fileTypeChangeUtil.fileDataChange(file);
|
||||
if (iboardProdInfoList == null || iboardProdInfoList.size() == 0) {
|
||||
orderImportRespVO.getFailureOrder().put("生产单导入错误", String.valueOf(fileTypeChangeUtil.getValue()));
|
||||
return orderImportRespVO;
|
||||
}
|
||||
for (Detail detail : iboardProdInfoList) {
|
||||
list.add(detail);
|
||||
// list.add(detail.getIBoardProdInfo());
|
||||
}
|
||||
}
|
||||
Long id;
|
||||
// 判断是否为为生产单添加板材
|
||||
@@ -173,12 +183,12 @@ public class OrderServiceImpl implements OrderService {
|
||||
validateOrderExists(createReqVO.getId());
|
||||
id = createReqVO.getId();
|
||||
}
|
||||
|
||||
// 根据字段筛选出重复数据
|
||||
List<OrderPlateImportExcelVO> duplicateOrder = list.stream()
|
||||
List<Detail> duplicateOrder = list.stream()
|
||||
.collect(
|
||||
Collectors.toMap(
|
||||
p -> Arrays.asList(p.getGoodsId(), p.getGoodsName(), p.getMaterial(), p.getColor(), p.getSpec()),
|
||||
p -> Arrays.asList(p.getIBoardProdInfo().getGoodsId(), p.getIBoardProdInfo().getGoodsName(),
|
||||
p.getIBoardProdInfo().getMaterial(), p.getIBoardProdInfo().getColor(), p.getIBoardProdInfo().getSpec()),
|
||||
p -> p,
|
||||
(existing, replacement) -> existing
|
||||
)
|
||||
@@ -186,45 +196,44 @@ public class OrderServiceImpl implements OrderService {
|
||||
.values().stream()
|
||||
.collect(Collectors.toList());
|
||||
// 数据分类
|
||||
HashMap<String, List<OrderPlateImportExcelVO>> map = classifyGoods(duplicateOrder);
|
||||
HashMap<String, List<Detail>> 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());
|
||||
|
||||
// 小板信息写入 、配件信息写入
|
||||
Map<String, List<OrderPlateImportExcelVO>> groupedRooms = list.stream()
|
||||
Map<String, List<Detail>> groupedRooms = list.stream()
|
||||
.collect(Collectors.groupingBy(
|
||||
order -> order.getRoomsName() != null ? order.getRoomsName() : " ",
|
||||
order -> order.getIBoardProdInfo().getRoomsName() != null ? order.getIBoardProdInfo().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()
|
||||
Map<String, List<Detail>> groupedCabinetsName = listRoom.stream()
|
||||
.collect(Collectors.groupingBy(
|
||||
order -> order.getCabinetsName() != null ? order.getCabinetsName() : " ",
|
||||
order -> order.getIBoardProdInfo().getCabinetsName() != null ? order.getIBoardProdInfo().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()
|
||||
Map<String, List<Detail>> groupedSynthesis = listCabinet.stream()
|
||||
.collect(Collectors.groupingBy(
|
||||
order -> order.getSynthesis() != null ? order.getSynthesis() : " ",
|
||||
order -> order.getIBoardProdInfo().getSynthesis() != null ? order.getIBoardProdInfo().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()
|
||||
Map<String, List<Detail>> groupedCombinationName = listSynthesis.stream()
|
||||
.collect(Collectors.groupingBy(
|
||||
order -> order.getCombinationName() != null ? order.getCombinationName() : " ",
|
||||
order -> order.getIBoardProdInfo().getCombinationName() != null ? order.getIBoardProdInfo().getCombinationName() : " ",
|
||||
Collectors.toList()
|
||||
));
|
||||
groupedCombinationName.forEach((combinationName, listCombination) -> {//组合名称
|
||||
@@ -237,40 +246,40 @@ public class OrderServiceImpl implements OrderService {
|
||||
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++) {
|
||||
plateCountByCombination[0] = plateCountByCombination[0] + plateOrParts.getIBoardProdInfo().getGoodsNumber();
|
||||
if (plateOrParts.getIBoardProdInfo().getGoodType()== 1) {
|
||||
//板材
|
||||
for (int i = 0; i < plateOrParts.getIBoardProdInfo().getGoodsNumber(); i++) {
|
||||
PlateDO plateDO = BeanUtils.toBean(plateOrParts, PlateDO.class).setOrderId(id).setGoodsId("");
|
||||
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();
|
||||
.num(1.0).build();
|
||||
orderItemMapper.insert(orderItemDO);
|
||||
// 写入Detail中的IBoardProdInfo
|
||||
plateOrParts.getIBoardProdInfo().setPlateId(plateId);
|
||||
}
|
||||
} else {
|
||||
//配件
|
||||
OrderPartsDO orderPartsDO = BeanUtils.toBean(plateOrParts, OrderPartsDO.class).setName(plateOrParts.getGoodsName()).setOrderId(id);
|
||||
OrderPartsDO orderPartsDO = BeanUtils.toBean(plateOrParts, OrderPartsDO.class).
|
||||
setName(plateOrParts.getIBoardProdInfo().getGoodsName()).setType(plateOrParts.getIBoardProdInfo().getGoodType()).setOrderId(id);
|
||||
orderPartsMapper.insert(orderPartsDO);
|
||||
OrderItemDO orderItemDO = OrderItemDO.builder().orderId(id).type(2)
|
||||
OrderItemDO orderItemDO = OrderItemDO.builder().orderId(id).type(Integer.valueOf(plateOrParts.getIBoardProdInfo().getGoodType()))
|
||||
.roomId(roomId).bodyId(bodyId).dataId(orderPartsDO.getId()).partsId(orderPartsDO.getId())
|
||||
.num(Double.valueOf(plateOrParts.getGoodsNumber())).build();
|
||||
.num(Double.valueOf(plateOrParts.getIBoardProdInfo().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]);
|
||||
});
|
||||
});
|
||||
fileTypeChangeUtil.fileDataChangeToJson(list , id);
|
||||
return orderImportRespVO;
|
||||
}
|
||||
|
||||
@@ -289,22 +298,22 @@ public class OrderServiceImpl implements OrderService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<OrderDO> getAllOrderCheck(OrderPageReqVO pageReqVO) {
|
||||
public List<OrderDO> getAllOrderCheck(OrderPageReqVO pageReqVO) {
|
||||
return orderMapper.selectOrderCheck(pageReqVO);
|
||||
}
|
||||
|
||||
|
||||
// 板材信息收集
|
||||
private List<RawGoodsSaveReqVO> collectImportRawPlate(List<OrderPlateImportExcelVO> list, Long id) {
|
||||
// 板材信息收集
|
||||
private List<RawGoodsSaveReqVO> collectImportRawPlate(List<Detail> list, Long id) {
|
||||
List<RawGoodsSaveReqVO> rawGoodsDOList = new ArrayList<>();
|
||||
|
||||
for (OrderPlateImportExcelVO orderPlateImportExcelVO : list) {
|
||||
RawGoodsSaveReqVO rawGoodsSaveReqVO = BeanUtils.toBean(orderPlateImportExcelVO, RawGoodsSaveReqVO.class);
|
||||
for (Detail detail : list) {
|
||||
RawGoodsSaveReqVO rawGoodsSaveReqVO = BeanUtils.toBean(detail.getIBoardProdInfo(), RawGoodsSaveReqVO.class);
|
||||
rawGoodsSaveReqVO.setOrderId(id);
|
||||
rawGoodsSaveReqVO.setRawGoodsId(orderPlateImportExcelVO.getGoodsId());
|
||||
rawGoodsSaveReqVO.setRawGoodsId(detail.getIBoardProdInfo().getGoodsId());
|
||||
// 创建 Pattern 对象
|
||||
Pattern pattern = Pattern.compile(".*?[^\\d]+(\\d+).*");
|
||||
Matcher matcher = pattern.matcher(orderPlateImportExcelVO.getSpec());
|
||||
Matcher matcher = pattern.matcher(detail.getIBoardProdInfo().getSpec());
|
||||
if (matcher.matches()) {
|
||||
String number = matcher.group(1);
|
||||
// 去除空格
|
||||
@@ -316,19 +325,19 @@ public class OrderServiceImpl implements OrderService {
|
||||
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) {
|
||||
//对数据进行分类
|
||||
private HashMap<String, List<Detail>> classifyGoods(List<Detail> list) {
|
||||
HashMap<String, List<Detail>> map = new HashMap<>();
|
||||
List<Detail> plateLists = new ArrayList<>();
|
||||
List<Detail> partsLists = new ArrayList<>();
|
||||
for (Detail detail : list) {
|
||||
//判断是板材还是配件
|
||||
if (orderPlateImportExcelVO.getGoodType().replaceAll(" ", "").equals("板材") || orderPlateImportExcelVO.getGoodType().replaceAll(" ", "").equals("1")) {
|
||||
plateLists.add(orderPlateImportExcelVO);
|
||||
if (detail.getIBoardProdInfo().getGoodType()== 1) {
|
||||
plateLists.add(detail);
|
||||
} else {
|
||||
partsLists.add(orderPlateImportExcelVO);
|
||||
partsLists.add(detail);
|
||||
}
|
||||
orderPlateImportExcelVO.setRemark(orderPlateImportExcelVO.remarkJSON());
|
||||
// orderPlateImportExcelVO.setRemark(orderPlateImportExcelVO.remarkJSON());
|
||||
}
|
||||
map.put("plate", plateLists);
|
||||
map.put("parts", partsLists);
|
||||
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
package com.cf.imes.module.executor.service.process;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import com.cf.imes.module.executor.controller.admin.process.vo.*;
|
||||
import com.cf.imes.module.executor.dal.dataobject.process.OrderProcessDO;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
|
||||
/**
|
||||
* 生产单工序 Service 接口
|
||||
*
|
||||
* @author 晨丰科技
|
||||
*/
|
||||
public interface OrderProcessService {
|
||||
|
||||
/**
|
||||
* 创建生产单工序
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createOrderProcess(@Valid OrderProcessSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新生产单工序
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateOrderProcess(@Valid OrderProcessSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除生产单工序
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteOrderProcess(Long id);
|
||||
|
||||
/**
|
||||
* 获得生产单工序
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 生产单工序
|
||||
*/
|
||||
OrderProcessDO getOrderProcess(Long id);
|
||||
|
||||
}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
package com.cf.imes.module.executor.service.process;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import com.cf.imes.module.executor.controller.admin.process.vo.*;
|
||||
import com.cf.imes.module.executor.dal.dataobject.process.OrderProcessDO;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
|
||||
import com.cf.imes.module.executor.dal.mysql.process.OrderProcessMapper;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 生产单工序 Service 实现类
|
||||
*
|
||||
* @author 晨丰科技
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class OrderProcessServiceImpl implements OrderProcessService {
|
||||
|
||||
@Resource
|
||||
private OrderProcessMapper orderProcessMapper;
|
||||
|
||||
@Override
|
||||
public Long createOrderProcess(OrderProcessSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
OrderProcessDO orderProcess = BeanUtils.toBean(createReqVO, OrderProcessDO.class);
|
||||
orderProcessMapper.insert(orderProcess);
|
||||
// 返回
|
||||
return orderProcess.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateOrderProcess(OrderProcessSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateOrderProcessExists(updateReqVO.getId());
|
||||
// 更新
|
||||
OrderProcessDO updateObj = BeanUtils.toBean(updateReqVO, OrderProcessDO.class);
|
||||
orderProcessMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteOrderProcess(Long id) {
|
||||
// 校验存在
|
||||
validateOrderProcessExists(id);
|
||||
// 删除
|
||||
orderProcessMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateOrderProcessExists(Long id) {
|
||||
if (orderProcessMapper.selectById(id) == null) {
|
||||
throw exception(ORDER_PROCESS_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrderProcessDO getOrderProcess(Long id) {
|
||||
return orderProcessMapper.selectById(id);
|
||||
}
|
||||
|
||||
}
|
||||
+18
-3
@@ -1,10 +1,25 @@
|
||||
package com.cf.imes.module.executor.util;
|
||||
|
||||
import com.cf.imes.module.executor.util.deviseData.Detail;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 生产单新增传入文件格式转换工具
|
||||
* @author: 晨丰科技
|
||||
* @date: 2024/3/13 17:31
|
||||
*/
|
||||
public interface FileTypeChangeUtil {
|
||||
public interface FileTypeChangeUtil {
|
||||
// 文件数据格式转换
|
||||
List<Detail> fileDataChange(MultipartFile file) throws IOException;
|
||||
// List<Detail>转json,并且文件压缩存储
|
||||
void fileDataChangeToJson(List<Detail> detailList , Long orderId) throws JsonProcessingException;
|
||||
|
||||
// Api数据格式转换
|
||||
|
||||
// ds数据转换
|
||||
|
||||
Map<String, String> getValue();
|
||||
}
|
||||
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package com.cf.imes.module.executor.util.deviseData;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* CAD板件信息详情
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = false) // 设置 chain = false,避免生产单导入有问
|
||||
public class Detail {
|
||||
|
||||
private String orderId ; //生产单id
|
||||
private IBoardProdInfo iBoardProdInfo; //板件属性信息
|
||||
private ModelDetail modelDetail ; //模块明细
|
||||
private PointDetail pointDetail ; //点明细
|
||||
private HoleDetail holeDetail ; //孔明细
|
||||
private PointDetail orgPointDetail ; //原始点明细
|
||||
private ModelDetail sideModelDetail ; //侧面模块明细
|
||||
private HoleDetail sideHoleDetail;//侧面孔明细
|
||||
}
|
||||
+24
-15
@@ -1,23 +1,32 @@
|
||||
package com.cf.imes.module.executor.util.deviseData;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @projectName: cf_imes_server
|
||||
* @author: 晨丰科技
|
||||
* @date: 2024/3/22 16:58
|
||||
* 孔明细
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = false) // 设置 chain = false,避免生产单导入有问
|
||||
public class HoleDetail {
|
||||
|
||||
private Integer HoleID;
|
||||
private Integer HoleType;// 请定义HoleType枚举类型
|
||||
private Integer Face; // 请定义FaceType枚举类型
|
||||
private Integer PointX;
|
||||
private Integer PointY;
|
||||
private Integer PointZ;
|
||||
private Integer Radius;
|
||||
private Integer Depth;
|
||||
private Integer EndPoint;
|
||||
private Integer PointX2;
|
||||
private Integer PointY2;
|
||||
private Integer Angle;
|
||||
private Integer holeId; //孔ID
|
||||
private Integer holeType;// 孔类型(0大孔, 10小孔, 20木削, 21木削大孔, 30层板钉, 40通孔, 50连接杆, -10造型孔)
|
||||
private Integer faceType; // 孔面类型(0正面, 1反面, 2侧面)
|
||||
private Integer pointX;
|
||||
private Integer pointY;
|
||||
private Integer pointZ;
|
||||
private Integer radius; //孔半径
|
||||
private Integer depth; //孔深度
|
||||
private Integer endPoint; //孔末端点
|
||||
private Integer pointX2;
|
||||
private Integer pointY2;
|
||||
private Integer angle; //角度
|
||||
|
||||
}
|
||||
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
package com.cf.imes.module.executor.util.deviseData;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 板件属性信息
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = false) // 设置 chain = false,避免生产单导入有问
|
||||
public class IBoardProdInfo {
|
||||
|
||||
private String goodsId;
|
||||
private String goodsName;
|
||||
private int goodType;
|
||||
private String factory;
|
||||
private String brand;
|
||||
private String model;
|
||||
private String spec;
|
||||
private String unit;
|
||||
private Double goodsNumber;
|
||||
private String plateNo;
|
||||
private Long plateId; //板件Id
|
||||
private String name; //板件名称
|
||||
private String roomsName; //房间名称
|
||||
private String cabinetsName; //柜体名
|
||||
private String material; //材质
|
||||
private String color; //颜色
|
||||
private Integer texture; //纹路 纹路(0正纹1可翻转2反纹)
|
||||
private int typographicFace; //排版面 排钻类型(0正面1反面2随意面)
|
||||
private int openDoorType; //开门类型 0非门板,1左开,2右开,3上翻,4下翻
|
||||
private Boolean isRect; //是否为矩形
|
||||
|
||||
private Integer splitHeight; //开料长
|
||||
private Integer splitWidth; //开料宽
|
||||
private Integer splitThickness; //开料厚度
|
||||
|
||||
private Integer decomposeHeight; //拆单长
|
||||
private Integer decomposeWidth; //拆单宽
|
||||
private Integer decomposeThickness; //拆单厚度
|
||||
|
||||
private Integer finishedHeight; //成品长
|
||||
private Integer finishedWidth; //成品宽
|
||||
private Integer finishedThickness; //成品厚度
|
||||
|
||||
private Integer edgeHeight; //外封边长
|
||||
private Integer edgeWidth; //外封边宽
|
||||
private Integer edgeThickness; //外封边厚度
|
||||
|
||||
private BigDecimal sealLeft;
|
||||
private BigDecimal sealRight;
|
||||
private BigDecimal sealUp;
|
||||
private BigDecimal sealDown;
|
||||
|
||||
private String synthesis;
|
||||
private String combinationName;
|
||||
|
||||
private String remark; //备注
|
||||
}
|
||||
+14
-5
@@ -1,14 +1,23 @@
|
||||
package com.cf.imes.module.executor.util.deviseData;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @projectName: cf_imes_server
|
||||
* @author: 晨丰科技
|
||||
* @date: 2024/3/22 16:47
|
||||
* 轮廓数据
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = false) // 设置 chain = false,避免生产单导入有问
|
||||
public class IContourData {
|
||||
private ArrayList<Point> pts;
|
||||
private Integer[] buls;
|
||||
private ArrayList<Point> pts; //点集(二维向量(x,y))
|
||||
private Integer[] buls; //凸度(0直线段 >0逆时针方向 <0顺时针方向)
|
||||
}
|
||||
|
||||
+20
-11
@@ -1,20 +1,29 @@
|
||||
package com.cf.imes.module.executor.util.deviseData;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Dictionary;
|
||||
|
||||
/**
|
||||
* @projectName: cf_imes_server
|
||||
* @author: 晨丰科技
|
||||
* @date: 2024/3/22 16:48
|
||||
* 造型数据
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = false) // 设置 chain = false,避免生产单导入有问
|
||||
public class IOriginModelingData {
|
||||
|
||||
private IContourData outline;
|
||||
private Dictionary<String, IContourData> holes;
|
||||
private Integer thickness;
|
||||
private Integer dir; // 请定义FaceDirection枚举类型
|
||||
private Integer knifeRadius;
|
||||
private Integer addLen;
|
||||
private Integer addWidth;
|
||||
private Integer addDepth;
|
||||
private IContourData outline; //轮郭
|
||||
private Dictionary<String, IContourData> holes; //孔轮廓
|
||||
private Integer thickness; //厚度
|
||||
private Integer dir; // 0正面、1反面、2侧面
|
||||
private Integer knifeRadius; //刀半径
|
||||
private Integer addLen; //槽加长
|
||||
private Integer addWidth; //槽加宽
|
||||
private Integer addDepth; //槽加深
|
||||
}
|
||||
|
||||
+21
-12
@@ -1,21 +1,30 @@
|
||||
package com.cf.imes.module.executor.util.deviseData;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @projectName: cf_imes_server
|
||||
* @author: 晨丰科技
|
||||
* @date: 2024/3/22 16:53
|
||||
* 模块明细
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = false) // 设置 chain = false,避免生产单导入有问
|
||||
public class ModelDetail {
|
||||
|
||||
private Integer ModelID;
|
||||
private Integer LineID;
|
||||
private Integer Face;
|
||||
private String KnifeName;
|
||||
private Integer KnifeRadius;
|
||||
private Integer Depth;
|
||||
private IOriginModelingData OriginModeling;
|
||||
private List<PointList> PointList;
|
||||
private List<OffSetList> OffSetList;
|
||||
private Integer modelId; //模块ID
|
||||
private Integer lineID; //纹路ID
|
||||
private Integer typographicFace; //排版面 0正面, 1反面, 2侧面
|
||||
private String knifeName; //刀具名称
|
||||
private Integer knifeRadius; //刀半径
|
||||
private Integer depth; //深度
|
||||
private IOriginModelingData originModeling; //造型数据
|
||||
private List<PointList> pointList; //点列表
|
||||
private List<OffSetList> offSetList; //偏移量列表 //模块偏移数据
|
||||
}
|
||||
|
||||
+18
-9
@@ -1,16 +1,25 @@
|
||||
package com.cf.imes.module.executor.util.deviseData;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @projectName: cf_imes_server
|
||||
* @author: 晨丰科技
|
||||
* @date: 2024/3/22 16:51
|
||||
* 偏移量列表 模块偏移数据
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = false) // 设置 chain = false,避免生产单导入有问
|
||||
public class OffSetList {
|
||||
|
||||
private String Name;
|
||||
private Integer Face;// 请定义FaceType枚举类型
|
||||
private Integer Value;
|
||||
private Integer Radius;
|
||||
private Integer Deep;
|
||||
private Integer Angle;
|
||||
private String name; //名称
|
||||
private Integer faceType;// 面向类型(0正面, 1反面, 2侧面)
|
||||
private Integer value; //值
|
||||
private Integer radius;//半径
|
||||
private Integer deep;//深度
|
||||
private Integer angle;//角度
|
||||
}
|
||||
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
package com.cf.imes.module.executor.util.deviseData;
|
||||
|
||||
/**
|
||||
* @projectName: cf_imes_server
|
||||
* @author: 晨丰科技
|
||||
* @date: 2024/3/22 17:00
|
||||
*/
|
||||
public class OrgPointDetail
|
||||
|
||||
{
|
||||
}
|
||||
+17
-8
@@ -1,14 +1,23 @@
|
||||
package com.cf.imes.module.executor.util.deviseData;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @projectName: cf_imes_server
|
||||
* @author: 晨丰科技
|
||||
* @date: 2024/3/22 16:57
|
||||
* 点明细
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = false) // 设置 chain = false,避免生产单导入有问
|
||||
public class PointDetail {
|
||||
private Integer PointID;
|
||||
private Integer PointX;
|
||||
private Integer PointY;
|
||||
private Integer Curve;
|
||||
private Integer SealSize;
|
||||
private Integer pointId;
|
||||
private Integer pointX;
|
||||
private Integer pointY;
|
||||
private Integer curve;//曲线
|
||||
private Integer SealSize;//封边尺寸
|
||||
}
|
||||
|
||||
+19
-10
@@ -1,16 +1,25 @@
|
||||
package com.cf.imes.module.executor.util.deviseData;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @projectName: cf_imes_server
|
||||
* @author: 晨丰科技
|
||||
* @date: 2024/3/22 16:49
|
||||
* 点列表
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = false) // 设置 chain = false,避免生产单导入有问
|
||||
public class PointList {
|
||||
private Integer LineID;
|
||||
private Integer PointID;
|
||||
private Integer PointX;
|
||||
private Integer PointY;
|
||||
private Integer Radius;
|
||||
private Integer Depth;
|
||||
private Integer Curve;
|
||||
private Integer lineId;//纹路Id
|
||||
private Integer pointId;//点Id
|
||||
private Integer pointX;
|
||||
private Integer pointY;
|
||||
private Integer radius;
|
||||
private Integer depth;
|
||||
private Integer curve;
|
||||
}
|
||||
|
||||
-22
@@ -1,22 +0,0 @@
|
||||
package com.cf.imes.module.executor.util.deviseData;
|
||||
|
||||
/**
|
||||
* @projectName: cf_imes_server
|
||||
* @author: 晨丰科技
|
||||
* @date: 2024/3/22 18:02
|
||||
*/
|
||||
public class SideHoleDetail {
|
||||
|
||||
private Integer HoleID;
|
||||
private Integer HoleType; // 请定义HoleType枚举类型
|
||||
private Integer Face; // 请定义FaceType枚举类型
|
||||
private Integer PointX;
|
||||
private Integer PointY;
|
||||
private Integer PointZ;
|
||||
private Integer Radius;
|
||||
private Integer Depth;
|
||||
private String EndPoint;
|
||||
private Integer PointX2;
|
||||
private Integer PointY2;
|
||||
private Integer Angle;
|
||||
}
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
package com.cf.imes.module.executor.util.deviseData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @projectName: cf_imes_server
|
||||
* @author: 晨丰科技
|
||||
* @date: 2024/3/22 17:59
|
||||
*/
|
||||
public class SideModelDetail {
|
||||
|
||||
private Integer ModelID;
|
||||
private Integer LineID;
|
||||
private int Face;
|
||||
private String KnifeName;
|
||||
private Integer KnifeRadius;
|
||||
private Integer Depth;
|
||||
private IOriginModelingData OriginModeling;
|
||||
private List<PointList> PointList;
|
||||
private List<OffSetList> OffSetList;
|
||||
}
|
||||
-17
@@ -1,17 +0,0 @@
|
||||
package com.cf.imes.module.executor.util.deviseData;
|
||||
|
||||
/**
|
||||
* @projectName: cf_imes_server
|
||||
* @author: 晨丰科技
|
||||
* @date: 2024/3/23 9:10
|
||||
*/
|
||||
public class detail {
|
||||
|
||||
private ModelDetail ModelDetail ;
|
||||
private PointDetail PointDetail ;
|
||||
private HoleDetail HoleDetail ;
|
||||
private OrgPointDetail OrgPointDetail ;
|
||||
private SideModelDetail SideModelDetail ;
|
||||
private SideHoleDetail SideHoleDetail;
|
||||
private String remark ;
|
||||
}
|
||||
+4
-5
@@ -1,4 +1,4 @@
|
||||
package com.cf.imes.module.executor.util.excel;
|
||||
package com.cf.imes.module.executor.util.fileConversion.admin.files.excel;
|
||||
|
||||
import com.alibaba.excel.context.AnalysisContext;
|
||||
import com.alibaba.excel.event.AnalysisEventListener;
|
||||
@@ -61,10 +61,9 @@ public final class ExcelListener<T> extends AnalysisEventListener<T> {
|
||||
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) + "列读取错误"));
|
||||
System.out.println();
|
||||
excelDataConvertException.getColumnIndex() + 1, excelDataConvertException.getCellData());
|
||||
value = value + String.valueOf(new RuntimeException("第" + (excelDataConvertException.getRowIndex() + 1) + "行" +
|
||||
",第" + (excelDataConvertException.getColumnIndex() + 1) + "列读取错误")) ;
|
||||
}
|
||||
}
|
||||
|
||||
+113
@@ -0,0 +1,113 @@
|
||||
package com.cf.imes.module.executor.util.fileConversion.admin.files.excel;
|
||||
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.module.executor.util.FileTypeChangeUtil;
|
||||
import com.cf.imes.module.executor.util.ZLibUtils;
|
||||
import com.cf.imes.module.executor.util.deviseData.Detail;
|
||||
import com.cf.imes.module.executor.util.deviseData.IBoardProdInfo;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 实现数据格式转换
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class FileTypeChangeRealize implements FileTypeChangeUtil {
|
||||
|
||||
private String valueErr = "";
|
||||
|
||||
private Boolean flag = true;
|
||||
@Override
|
||||
public List<Detail> fileDataChange(MultipartFile file) throws IOException {
|
||||
List<Detail> details = new ArrayList<>();
|
||||
List<OrderPlateImportExcelVO> orderPlateImportExcelVOS = OrderExcelUtil.read(file, OrderPlateImportExcelVO.class);
|
||||
|
||||
if (orderPlateImportExcelVOS == null || orderPlateImportExcelVOS.isEmpty()) {
|
||||
return details;
|
||||
}
|
||||
|
||||
StringBuilder value = new StringBuilder();
|
||||
|
||||
|
||||
for (OrderPlateImportExcelVO orderPlateImportExcelVO : orderPlateImportExcelVOS) {
|
||||
handleOrderPlateImportExcelVO(orderPlateImportExcelVO, value);
|
||||
if(flag){
|
||||
Detail detail = Detail.builder()
|
||||
.iBoardProdInfo(BeanUtils.toBean(orderPlateImportExcelVO, IBoardProdInfo.class))
|
||||
.build();
|
||||
details.add(detail);
|
||||
}else {
|
||||
details = null;
|
||||
System.out.println(value.toString());
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
return details;
|
||||
}
|
||||
|
||||
private void handleOrderPlateImportExcelVO(OrderPlateImportExcelVO orderPlateImportExcelVO, StringBuilder value) {
|
||||
if (orderPlateImportExcelVO.getGoodType() == 0) {
|
||||
appendError(value, " 商品类别未填写 ", orderPlateImportExcelVO);
|
||||
flag = false;
|
||||
} else {
|
||||
if (!orderPlateImportExcelVO.isVail()) {
|
||||
if (orderPlateImportExcelVO.getGoodType() == 1) {
|
||||
if (!orderPlateImportExcelVO.isValidRawGoods()) {
|
||||
appendError(value, " 板材信息填写有误 ", orderPlateImportExcelVO);
|
||||
flag = false;
|
||||
}
|
||||
} else {
|
||||
if (!orderPlateImportExcelVO.isValidParts()) {
|
||||
appendError(value, " 配件信息填写有误 ", orderPlateImportExcelVO);
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void appendError(StringBuilder value, String errorMessage, OrderPlateImportExcelVO orderPlateImportExcelVO) {
|
||||
value.append(orderPlateImportExcelVO.getOrdinal())
|
||||
.append(orderPlateImportExcelVO.getGoodsName())
|
||||
.append(errorMessage);
|
||||
valueErr = valueErr + value.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fileDataChangeToJson(List<Detail> detailList , Long orderId) throws JsonProcessingException {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
String detailListJson = objectMapper.writeValueAsString(detailList);
|
||||
// List<Detail> convertedDetailList = objectMapper.readValue(detailListJson, new TypeReference<List<Detail>>() {});
|
||||
byte[] jsonData = detailListJson.getBytes();
|
||||
|
||||
// 使用 Zlib 压缩算法进行压缩
|
||||
byte[] compressedData = ZLibUtils.compress(jsonData);
|
||||
|
||||
// 将压缩后的数据写入文件
|
||||
try (FileOutputStream fos = new FileOutputStream(orderId + ".zlib")) {
|
||||
fos.write(compressedData);
|
||||
System.out.println("Data compressed and saved to compressed_data.zlib");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getValue() {
|
||||
Map<String, String> err = OrderExcelUtil.getValue();
|
||||
err.put("readErr", valueErr);
|
||||
return err;
|
||||
}
|
||||
}
|
||||
+4
-3
@@ -1,4 +1,4 @@
|
||||
package com.cf.imes.module.executor.util.excel;
|
||||
package com.cf.imes.module.executor.util.fileConversion.admin.files.excel;
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.cf.imes.framework.excel.core.util.ExcelUtils;
|
||||
@@ -28,7 +28,8 @@ public class OrderExcelUtil extends ExcelUtils {
|
||||
throw new IOException("文件大小为 0");
|
||||
} else {
|
||||
//读取文件内容
|
||||
EasyExcel.read(file.getInputStream(), head, excelListener).headRowNumber(7).sheet(0).doRead();
|
||||
EasyExcel.read(file.getInputStream(), head, excelListener).
|
||||
headRowNumber(7).sheet(0).doRead();
|
||||
//获取读取的数据
|
||||
List<T> list = excelListener.getDatas();
|
||||
|
||||
@@ -41,7 +42,7 @@ public class OrderExcelUtil extends ExcelUtils {
|
||||
|
||||
public static <T> Map<String, String> getValue() {
|
||||
Map<String, String> err = new HashMap<>();
|
||||
err.put("err", value);
|
||||
err.put("readErr", value);
|
||||
return err;
|
||||
}
|
||||
}
|
||||
+25
-43
@@ -1,11 +1,8 @@
|
||||
package com.cf.imes.module.executor.controller.admin.order.vo.order;
|
||||
package com.cf.imes.module.executor.util.fileConversion.admin.files.excel;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.framework.excel.core.annotations.DictFormat;
|
||||
import com.cf.imes.framework.excel.core.convert.DictConvert;
|
||||
import com.cf.imes.module.system.api.dict.DictDataApi;
|
||||
import com.cf.imes.module.system.api.dict.dto.DictDataRespDTO;
|
||||
import com.cf.imes.module.system.enums.DictTypeConstants;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
@@ -15,9 +12,11 @@ import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 生产单 Excel 导入 VO
|
||||
@@ -33,9 +32,10 @@ public class OrderPlateImportExcelVO {
|
||||
@JsonIgnore
|
||||
private int ordinal;
|
||||
|
||||
@ExcelProperty(value = "类型")
|
||||
@ExcelProperty(value = "类型", converter = DictConvert.class)
|
||||
@JsonIgnore
|
||||
private String goodType;
|
||||
@DictFormat(DictTypeConstants.PRODUCT_TYPE)
|
||||
private int goodType;
|
||||
|
||||
@ExcelProperty(value = "物料编码")
|
||||
@JsonIgnore
|
||||
@@ -75,6 +75,7 @@ public class OrderPlateImportExcelVO {
|
||||
|
||||
@ExcelProperty(value = "数量")
|
||||
@JsonIgnore
|
||||
@NotNull
|
||||
private Double goodsNumber;
|
||||
|
||||
@ExcelProperty(value = "房间")
|
||||
@@ -142,14 +143,14 @@ public class OrderPlateImportExcelVO {
|
||||
@DictFormat(DictTypeConstants.YPOGRAPHY_TYPE)
|
||||
private int typographicFace;
|
||||
|
||||
@ExcelProperty(value = "纹路")
|
||||
@ExcelProperty(value = "纹路", converter = DictConvert.class)
|
||||
@JsonIgnore
|
||||
// @DictFormat(DictTypeConstants.GRAIN_TYPE)
|
||||
@DictFormat(DictTypeConstants.GRAIN_TYPE)
|
||||
private int texture;
|
||||
|
||||
@ExcelProperty(value = "开门方向")
|
||||
@ExcelProperty(value = "开门方向", converter = DictConvert.class)
|
||||
@JsonIgnore
|
||||
// @DictFormat(DictTypeConstants.DOOR_OPENING_DIRECTIONS)
|
||||
@DictFormat(DictTypeConstants.DOOR_OPENING_DIRECTIONS)
|
||||
private int openDoorType;
|
||||
|
||||
@ExcelProperty(value = "备注1")
|
||||
@@ -187,24 +188,23 @@ public class OrderPlateImportExcelVO {
|
||||
private String remark = remarkJSON();
|
||||
|
||||
@JsonIgnore
|
||||
private Long id;
|
||||
private Long id;//生产单Id
|
||||
|
||||
@JsonIgnore
|
||||
public boolean isValidParts() {
|
||||
return (isNonEmpty(goodsId) || isNonEmpty(goodsName)) && (goodsNumber != null && goodsNumber> 0) && (isNonEmpty(model) || isNonEmpty(spec));
|
||||
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) ||
|
||||
(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 ;
|
||||
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) {
|
||||
@@ -218,17 +218,8 @@ public class OrderPlateImportExcelVO {
|
||||
return value;
|
||||
}
|
||||
|
||||
//使用字典
|
||||
//判断类型,首先存在 板材、配件、组件、生产耗材、其他;
|
||||
|
||||
//排版面判断 0正面,1反面,2随意面;
|
||||
|
||||
//纹路判断 0正纹,1可翻转(无纹),2反纹;
|
||||
|
||||
//开门方向判断 0柜体板(非门板),1左开,2右开,3上翻,4下翻;
|
||||
|
||||
//备注转json数据
|
||||
public String remarkJSON(){
|
||||
public String remarkJSON() {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
// 设置实体类字段的值
|
||||
try {
|
||||
@@ -240,17 +231,8 @@ public class OrderPlateImportExcelVO {
|
||||
}
|
||||
}
|
||||
|
||||
// excel中字典转换
|
||||
private int getDictValue(String dictType, int index) {
|
||||
int value = 0;
|
||||
if(index == 1){
|
||||
// CommonResult<DictDataRespDTO> dictDataRespDTOCommonResult = dictDataApi.getDictData(dictType, label);
|
||||
}else if(index == 2){
|
||||
|
||||
}else if(index == 3){
|
||||
|
||||
}
|
||||
return value;
|
||||
public Boolean isVail(){
|
||||
return (isValidParts() && isValidRawGoods());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
@@ -29,4 +29,5 @@ public interface DictTypeConstants {
|
||||
String YPOGRAPHY_TYPE = "ypographyType"; // 排版面
|
||||
String GRAIN_TYPE = "grainType";//纹路类型
|
||||
String DOOR_OPENING_DIRECTIONS = "doorOpeningDirections";//开门方向
|
||||
String PRODUCT_TYPE = "productType";//产品类型
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user