xml导入-版一

This commit is contained in:
lym
2024-08-29 17:36:39 +08:00
parent 7cf453050f
commit fc220e5b83
74 changed files with 3488 additions and 107 deletions
@@ -1,7 +1,9 @@
package com.cf.imes.module.executor.controller.admin.order;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
import com.cf.imes.framework.web.config.WebProperties;
import com.cf.imes.module.executor.controller.admin.order.vo.order.*;
import com.cf.imes.module.executor.controller.admin.order.vo.product.OrderBodyRespVO;
import com.cf.imes.module.executor.controller.admin.order.vo.product.OrderRoomBodyRespVO;
@@ -14,8 +16,11 @@ import com.cf.imes.module.executor.util.fileConversion.admin.api.webcad.ApiDataA
import com.cf.imes.module.executor.util.fileConversion.admin.api.webcad.ApiTypeRealize;
import com.cf.imes.module.executor.util.fileConversion.admin.files.excel.ExcelReadUtil;
import com.cf.imes.module.executor.util.fileConversion.admin.files.excel.OrderPlateImportExcelVO;
import com.cf.imes.module.executor.util.fileConversion.admin.files.xml.VO.OrderXmlVO;
import com.cf.imes.module.executor.util.fileConversion.admin.files.xml.XMLReadUtil;
import io.swagger.v3.oas.annotations.Parameters;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@@ -41,6 +46,7 @@ import static com.cf.imes.framework.common.pojo.CommonResult.success;
import com.cf.imes.framework.operatelog.core.annotations.OperateLog;
import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.*;
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
@@ -50,9 +56,12 @@ import com.cf.imes.module.executor.service.order.OrderService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
@@ -75,6 +84,12 @@ public class OrderController {
@Resource
private ApiTypeRealize apiTypeRealize;
@Resource
private IdentifierGenerator identifierGenerator;
@Resource
private ThreadPoolTaskExecutor asyncExecutor;
@PutMapping("/update")
@Operation(summary = "更新生产单")
@@ -177,7 +192,25 @@ public class OrderController {
public CommonResult<Long> test(@RequestParam(value = "orderNo", required = false, defaultValue = "20230809027818") String orderNo)
throws InterruptedException, ExecutionException {
Long organId = SecurityFrameworkUtils.getLoginUser().getOrganId();
Long orderId = (Long) identifierGenerator.nextId(null);
Long organId = getUserOrganId();
// final RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
//// 从HttpServletRequest中提取servletPath
// String servletPath = request.getServletPath();
// System.out.println("servletPath = " + servletPath.startsWith(properties.getAdminApi().getPrefix()));
// CompletableFuture.runAsync(() -> {
//// System.out.println(String.join("-", Thread.currentThread().getName(), " i = " + i.getAndIncrement()));
// RequestContextHolder.setRequestAttributes(requestAttributes);
// try {
// orderService.importApiData(orderNo, orderId, organId);
// } catch (Exception e) {
// log.error(" 1: ", e);
// }
// }, asyncExecutor).exceptionally(e -> {
// log.error("error", e);
// return null;
// });
// Long organId = SecurityFrameworkUtils.getLoginUser().getOrganId();
JSONObject oauth = apiDataAchieve.getApiToken(organId).get();
String token = oauth.getJSONObject("info").getString("access_token");
String shopId = oauth.getJSONObject("info").getString("shop_id");
@@ -204,8 +237,12 @@ public class OrderController {
plate, // 板件明细
dataModule,// 加工组信息
block,// 板材数据
orderNo); // 原始板编号
orderNo,// 原始板编号
orderId,
organId);
return success(orderService.importApiData(listMap));
// return success(orderId);
}
@PostMapping("/importFile")
@@ -263,12 +300,16 @@ public class OrderController {
} else if (type == 2) { // xml
OrderXmlVO orderXmlVO = (OrderXmlVO) XMLReadUtil.read(file, OrderXmlVO.class);
System.out.println("orderXmlVO = " + orderXmlVO);
}
orderService.importExcelData(orderDO, list, index);
// orderService.importExcelData(orderDO, list, index);
} catch (Exception e) {
ExcelWriterUtil.writeErr(response, "系统出现未知错误,请下载模板,按照模板重新上传文件", orderService.getSavePath() + File.separator + "order_err.xlsx");
log.error("导入文件出现异常", e);
}
}
@@ -100,4 +100,11 @@ public class OrderPartsController {
return success(orderPartsService.getPartsPageByTerms(pageVO));
}
@GetMapping("/getWithRoomAndBody")
@Operation(summary = "获得房间柜体下的生产单配件")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('executor:order-parts:query')")
public CommonResult<List<PartGoodsRespVO>> getWithRoomAndBody(@RequestParam("id") Long id) {
return success(orderPartsService.getWithRoomAndBody(id));
}
}
@@ -61,6 +61,10 @@ public class GoodsDO extends BaseDO {
* 颜色
*/
private String color;
/**
* 背面颜色
*/
private String colorBlack;
/**
* 宽度
*/
@@ -43,6 +43,10 @@ public class ManagePlateDO extends BaseDO {
* 颜色
*/
private String color;
/**
* 背面颜色
*/
private String colorBlack;
/**
* 宽度
*/
@@ -40,6 +40,10 @@ public class PlateGoodDO extends BaseDO {
* 颜色
*/
private String color;
/**
* 背面颜色
*/
private String colorBlack;
/**
* 纹路
*/
@@ -51,6 +51,10 @@ public class RawGoodsDO extends BaseDO {
* 颜色
*/
private String color;
/**
* 背面颜色
*/
private String colorBlack;
/**
* 纹路 0 正纹 1 可翻转 2 反纹
*/
@@ -54,6 +54,10 @@ public class RemainPlateDO extends BaseDO {
* 颜色
*/
private String color;
/**
* 背面颜色
*/
private String colorBlack;
/**
* 宽度
*/
@@ -13,6 +13,7 @@ import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.module.executor.dal.dataobject.orderBody.OrderBodyDO;
import org.springframework.boot.system.ApplicationHome;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
@@ -21,6 +22,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
/**
* 生产单表 order_{N} Service 接口
@@ -102,6 +104,7 @@ public interface OrderService {
* @date 2024/3/30
*/
Long importApiData(Map<String, List<?>> listMap);
void importApiData(String orderNo, Long orderId, Long organId) throws InterruptedException, ExecutionException;
/**
* 文件数据导入
@@ -1,29 +1,23 @@
package com.cf.imes.module.executor.service.order;
import cn.hutool.core.collection.CollectionUtil;
import cn.smallbun.screw.core.util.CollectionUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
import com.cf.imes.framework.common.exception.ServiceException;
import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator;
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.cf.imes.framework.organ.core.aop.OrganIgnore;
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
import com.cf.imes.framework.security.core.LoginUser;
import com.cf.imes.module.executor.controller.admin.order.vo.order.*;
import com.cf.imes.module.executor.controller.admin.order.vo.product.OrderBodyRespVO;
import com.cf.imes.module.executor.controller.admin.order.vo.product.OrderRoomBodyRespVO;
import com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsRemark;
import com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsRespVO;
import com.cf.imes.module.executor.controller.admin.plan.vo.OrderRespVOCopy;
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateGoodsIdVO;
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateRespVO;
import com.cf.imes.module.executor.dal.dataobject.goods.GoodsDO;
import com.cf.imes.module.executor.dal.dataobject.orderBody.OrderBodyDO;
@@ -48,6 +42,8 @@ import com.cf.imes.module.executor.enums.OrderDeletedEnum;
import com.cf.imes.module.executor.enums.OrderStatusEnum;
import com.cf.imes.framework.common.enums.OrderPackageStatusEnum;
import com.cf.imes.module.executor.util.deviseData.dataTwo.PlateDetail;
import com.cf.imes.module.executor.util.fileConversion.admin.api.webcad.ApiDataAchieve;
import com.cf.imes.module.executor.util.fileConversion.admin.api.webcad.ApiTypeRealize;
import com.cf.imes.module.executor.util.fileConversion.admin.files.excel.ExcelTypeRealize;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
@@ -69,7 +65,7 @@ import java.net.URLEncoder;
import java.time.*;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@@ -79,6 +75,7 @@ import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.ge
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
/**
@@ -129,6 +126,12 @@ public class OrderServiceImpl implements OrderService {
@Resource
private SnowFlakeGenerator snowFlakeGenerator;
@Resource
private ApiDataAchieve apiDataAchieve;
@Resource
private ApiTypeRealize apiTypeRealize;
@Resource
private ExcelTypeRealize excelTypeRealize;
@@ -148,6 +151,8 @@ public class OrderServiceImpl implements OrderService {
//验证自定义单号是否存在, 生产单未删除
validateCustomOrderNoExists(updateReqVO.getCustomOrderNo(), updateReqVO.getId());
// 发货日期校验
// 更新
OrderDO updateObj = BeanUtils.toBean(updateReqVO, OrderDO.class);
if (updateReqVO.getCustomOrderNo() == null || updateReqVO.getCustomOrderNo().equals("")) {
@@ -236,7 +241,7 @@ public class OrderServiceImpl implements OrderService {
// 查询当前房间下的所有板材
plateDOList = plateMapper.selectPlateTypeByRoomId(orderId, roomIds, null, getUserOrganId(), index);
bodyIds = orderBodyMapper.selectBodyIdByRoomId(orderId, roomIds, getUserOrganId(), index);
} else if (bodyId != 0) {
} else if (bodyId != null && bodyId != 0) {
// 校验柜体存在
validateOrderBodyExists(orderId, bodyId, getUserOrganId(), index);
// 查询当前房间下的所有板材
@@ -339,6 +344,83 @@ public class OrderServiceImpl implements OrderService {
return order.get(0).getId();
}
@Override
// @Async
@Transactional(rollbackFor = Exception.class)
public void importApiData(String orderNo, Long orderId, Long organId) throws InterruptedException, ExecutionException {
// RequestContextHolder.setRequestAttributes(requestAttributes);
JSONObject oauth = apiDataAchieve.getApiToken(organId).get();
String token = oauth.getJSONObject("info").getString("access_token");
String shopId = oauth.getJSONObject("info").getString("shop_id");
JSONObject order = apiDataAchieve.getApiOrder(token, shopId, orderNo).get();
if (!order.getString("err_code").equals("0")) {
throw exception(PLATE_PLAN_DATA_ERROR);
}
if (order.getJSONArray("data") == null) {
throw exception(PLATE_PLAN_DATA_NULL);
}
JSONObject dataPlates = apiDataAchieve.getApiPlateProData(token, orderNo).get();
JSONObject dataParts = apiDataAchieve.getApiPartsMessage(token, orderNo).get();
JSONObject dataBody = apiDataAchieve.getApiBodyMessage(token, orderNo).get();
JSONObject dataGoods = apiDataAchieve.getApiGoodsMessage(token, orderNo).get();
JSONObject plate = apiDataAchieve.getApiPlateDetailMessage(token, orderNo).get();
JSONObject dataModule = apiDataAchieve.getApiGroupMessage(token, orderNo).get();
JSONObject block = apiDataAchieve.getApiBlocksMessage(token, orderNo).get();
Map<String, List<?>> listMap = apiTypeRealize.apiPlateDataChange(
order,
dataPlates,//板件生产信息
dataParts,// 配件信息
dataBody, // 柜体信息
dataGoods, // 商品信息
plate, // 板件明细
dataModule,// 加工组信息
block,// 板材数据
orderNo,// 原始板编号
orderId,
organId);
List<OrderDO> orderDOS = (List<OrderDO>) listMap.get("orderDO");
if (orderDOS != null && orderDOS.size() > 0) {
OrderDO orderDO = orderDOS.get(0);
validateCustomOrderNoExists(orderDO.getCustomOrderNo());
String nickName = SecurityFrameworkUtils.getLoginUser().getNickname();
if (orderDO.getSalesman() == null || orderDO.getSalesman().equals("")) {
orderDO.setSalesman(nickName);
}
if (orderDO.getSplitter() == null || orderDO.getSplitter().equals("")) {
orderDO.setSplitter(nickName);
}
orderMapper.insert(orderDO);
}
List<GoodsDO> goodsDO = (List<GoodsDO>) listMap.get("goodsDO");
List<RawGoodsDO> rawGoodsDO = (List<RawGoodsDO>) listMap.get("rawGoodsDO");
List<OrderBodyDO> bodyDO = (List<OrderBodyDO>) listMap.get("bodyDO");
List<OrderGroupDO> groupDO = (List<OrderGroupDO>) listMap.get("groupDO");
List<OrderPartsDO> partsDO = (List<OrderPartsDO>) listMap.get("partsDO");
List<PlateDO> plateDO = (List<PlateDO>) listMap.get("platesDO");
List<PlateDetail> plateDetail = (List<PlateDetail>) listMap.get("plateDetail");
List<OrderItemDO> itemDO = (List<OrderItemDO>) listMap.get("itemDO");
List<OrderPartsRemark> partsRemark = (List<OrderPartsRemark>) listMap.get("partsRemark");
Map<String, List<?>> map = getPlateGoods(goodsDO);// 检验商品板材信息是否存在
goodsDO = (List<GoodsDO>) map.get("goodsDO");
List<PlateGoodDO> plateGoodDOS = (List<PlateGoodDO>) map.get("plateGoodDOLists");
orderInputProcessor.batchInsert(rawGoodsDO, bodyDO, groupDO, partsDO, plateDO, itemDO, goodsDO, plateGoodDOS);
List<OrderModelDO> orderModelDOs = BeanUtils.toBean(plateDetail, OrderModelDO.class);
if (orderModelDOs.size() > 0) {
orderModelDOs.forEach(orderModelDO -> orderModelDO.setOrderId(orderDOS.get(0).getId()));
orderInputProcessor.batchSaveModel(orderModelDOs);
}
if (partsRemark.size() > 0) {
orderInputProcessor.batchSaveOrderPartsModel(partsRemark);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void importExcelData(OrderDO orderDO, List<?> list, Integer index) {
@@ -69,4 +69,8 @@ public interface OrderPartsService {
*/
PageResult<OrderPartsRespVO> getPartsPageByTerms(PlateTermsPageReqVO pageReqVO);
/**
* 分组查询
*/
List<PartGoodsRespVO> getWithRoomAndBody(Long orderId);
}
@@ -9,6 +9,7 @@ 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.plate.vo.PlateRespVO;
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateTermsPageReqVO;
import com.cf.imes.module.executor.enums.OrderDeletedEnum;
import com.cf.imes.module.system.enums.ErrorCodeConstants;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.stereotype.Service;
@@ -113,4 +114,11 @@ public class OrderPartsServiceImpl implements OrderPartsService {
return new PageResult<OrderPartsRespVO>(pageRes.getRecords(), pageRes.getTotal());
}
@Override
public List<PartGoodsRespVO> getWithRoomAndBody(Long orderId) {
Integer notDeletedStatus = OrderDeletedEnum.NOT_DELETED.getStatus();
// 查询明细列表
return orderPartsMapper.selectPartDetail(orderId, SecurityFrameworkUtils.getLoginUser().getOrganId(), notDeletedStatus);
}
}
@@ -0,0 +1,207 @@
package com.cf.imes.module.executor.util;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.MDC;
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.task.TaskDecorator;
import org.springframework.scheduling.annotation.AsyncConfigurer;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.Executor;
import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.LinkedBlockingQueue;
import cn.hutool.core.thread.ThreadFactoryBuilder;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import javax.annotation.Nonnull;
/**
* SpringBoot 装配线程池
* @author FengJinSong
*/
@Slf4j
@EnableAsync
@Configuration
public class ThreadPoolConfig implements AsyncConfigurer {
private static final String EXECUTOR_NAME = "asyncExecutor";
@Value("${thread-pool.config.corePoolSize:26}")
private Integer corePoolSize;
@Value("${thread-pool.config.maxPoolSize:100}")
private Integer maxPoolSize;
@Value("${thread-pool.config.queueCapacity:200}")
private Integer queueCapacity;
@Value("${thread-pool.config.threadNamePrefix:AsyncThread-}")
private String threadNamePrefix;
@Value("${thread-pool.config.rejectedExecutionHandler:CallerRunsPolicy}")
private String rejectedExecutionHandler;
@Bean(name = EXECUTOR_NAME)
@Override
public Executor getAsyncExecutor() {
ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor();
// 核心线程数
threadPoolTaskExecutor.setCorePoolSize(corePoolSize);
// 最大线程数
threadPoolTaskExecutor.setMaxPoolSize(maxPoolSize);
// 阻塞队列容量
threadPoolTaskExecutor.setQueueCapacity(queueCapacity);
// 待任务在关机时完成--表明等待所有线程执行完
threadPoolTaskExecutor.setWaitForTasksToCompleteOnShutdown(true);
// 线程名称前缀
threadPoolTaskExecutor.setThreadNamePrefix(threadNamePrefix);
// threadPoolTaskExecutor.setTaskDecorator(new ContextCopyingDecorator());
// 设置拒绝策略
threadPoolTaskExecutor.setRejectedExecutionHandler(getRejectedExecutionHandler(rejectedExecutionHandler));
threadPoolTaskExecutor.initialize();
return threadPoolTaskExecutor;
}
@Override
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
return (throwable, method, obj) -> {
log.error("[ThreadPool Exception]Message [{}], Method [{}]", throwable.getMessage(), method.getName());
for (Object param : obj) {
log.error("Parameter value [{}] ", param);
}
};
}
/**
* 根据传入的参数获取拒绝策略
*
* @param rejectedName 拒绝策略名,比如 CallerRunsPolicy
* @return RejectedExecutionHandler 实例对象,没有匹配的策略时,默认取 CallerRunsPolicy 实例
*/
public RejectedExecutionHandler getRejectedExecutionHandler(String rejectedName) {
Map<String, RejectedExecutionHandler> rejectedExecutionHandlerMap = new HashMap<>(16);
rejectedExecutionHandlerMap.put("CallerRunsPolicy", new ThreadPoolExecutor.CallerRunsPolicy());
rejectedExecutionHandlerMap.put("AbortPolicy", new ThreadPoolExecutor.AbortPolicy());
rejectedExecutionHandlerMap.put("DiscardPolicy", new ThreadPoolExecutor.DiscardPolicy());
rejectedExecutionHandlerMap.put("DiscardOldestPolicy", new ThreadPoolExecutor.DiscardOldestPolicy());
return rejectedExecutionHandlerMap.getOrDefault(rejectedName, new ThreadPoolExecutor.CallerRunsPolicy());
}
// @Slf4j
// static class ContextCopyingDecorator implements TaskDecorator {
// @Nonnull
// @Override
// public Runnable decorate(@Nonnull Runnable runnable) {
// try {
// RequestAttributes context = RequestContextHolder.currentRequestAttributes(); //1
// Map<String,String> previous = MDC.getCopyOfContextMap(); //2
// SecurityContext securityContext = SecurityContextHolder.getContext(); //3
// return () -> {
// try {
// RequestContextHolder.setRequestAttributes(context); //1
// MDC.setContextMap(previous); //2
// SecurityContextHolder.setContext(securityContext); //3
// runnable.run();
// } finally {
// RequestContextHolder.resetRequestAttributes(); // 1
// MDC.clear(); // 2
// SecurityContextHolder.clearContext(); // 3
// }
// };
// } catch (IllegalStateException e) {
// return runnable;
// }
//
//
// }
// }
}
//public class ThreadPoolConfig {
// //自定义使用参数
// @Value("${async.executor.thread.core_pool_size}")
// private int corePoolSize; //配置核心线程数
// @Value("${async.executor.thread.max_pool_size}")
// private int maxPoolSize; //配置最大线程数
// @Value("${async.executor.thread.queue_capacity}")
// private int queueCapacity;
// @Value("${async.executor.thread.name.prefix}")
// private String namePrefix;
// @Value("${async.executor.thread.keep_alive_seconds}")
// private int keepAliveSeconds;
//
// //1、自定义asyncServiceExecutor线程池
// @Bean(name = "asyncServiceExecutor")
// public ThreadPoolTaskExecutor asyncServiceExecutor() {
// log.info("start asyncServiceExecutor......");
// //在这里修改
// ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
// //配置核心线程数
// executor.setCorePoolSize(corePoolSize);
// //配置最大线程数
// executor.setMaxPoolSize(maxPoolSize);
// //设置线程空闲等待时间 s
// executor.setKeepAliveSeconds(keepAliveSeconds);
// //配置队列大小 设置任务等待队列的大小
// executor.setQueueCapacity(queueCapacity);
// //配置线程池中的线程的名称前缀
// //设置线程池内线程名称的前缀-------阿里编码规约推荐--方便出错后进行调试
// executor.setThreadNamePrefix(namePrefix);
// // rejection-policy:当pool已经达到max size的时候,如何处理新任务
// // CALLER_RUNS:不在新线程中执行任务,而是有调用者所在的线程来执行
// executor.setRejectedExecutionHandler(new ThreadPoolExecutor.DiscardPolicy());
// //执行初始化
// executor.initialize();
// return executor;
// }
// /**
// * 2、公共线程池,利用系统availableProcessors线程数量进行计算
// */
// @Bean(name = "commonThreadPoolTaskExecutor")
// public ThreadPoolTaskExecutor commonThreadPoolTaskExecutor() {
// ThreadPoolTaskExecutor pool = new ThreadPoolTaskExecutor();
// int processNum = Runtime.getRuntime().availableProcessors(); // 返回可用处理器的Java虚拟机的数量
// int corePoolSize = (int) (processNum / (1 - 0.2));
// int maxPoolSize = (int) (processNum / (1 - 0.5));
// pool.setCorePoolSize(corePoolSize); // 核心池大小
// pool.setMaxPoolSize(maxPoolSize); // 最大线程数
// pool.setQueueCapacity(maxPoolSize * 1000); // 队列程度
// pool.setThreadPriority(Thread.MAX_PRIORITY);
// pool.setDaemon(false);
// pool.setKeepAliveSeconds(300);// 线程空闲时间
// return pool;
// }
// //3自定义defaultThreadPoolExecutor线程池
// @Bean(name = "defaultThreadPoolExecutor", destroyMethod = "shutdown")
// public ThreadPoolExecutor systemCheckPoolExecutorService() {
// int maxNumPool=Runtime.getRuntime().availableProcessors();
// return new ThreadPoolExecutor(3,
// maxNumPool,
// 60,
// TimeUnit.SECONDS,
// new LinkedBlockingQueue<Runnable>(10000),
// //置线程名前缀,例如设置前缀为hutool-thread-,则线程名为hutool-thread-1之类。
// new ThreadFactoryBuilder().setNamePrefix("default-executor-thread-%d").build(),
// (r, executor) -> log.error("system pool is full! "));
// }
//}
@@ -20,10 +20,10 @@ import java.util.List;
public class IOriginModelingData {
@Schema(description = "刀半径")
private float knifeRadius;
private Double knifeRadius;
@Schema(description = "厚度")
private float thickness;
private Double thickness;
@Schema(description = "方向")
private Integer dir;
@@ -34,9 +34,9 @@ public class IOriginModelingData {
@Schema(description = "槽加长")
private float addLen;
private Double addLen;
@Schema(description = "槽加宽")
private float addWidth;
private Double addWidth;
@Schema(description = "槽加深")
private float addDepth;
private Double addDepth;
}
@@ -19,6 +19,9 @@ import java.util.List;
@Schema(description = "管理后台 - 造型信息")
public class ModelDetail {
@Schema(description = "类型——矩形槽Rectangle、路径槽Path、内铣槽internalMilling、折返路径槽turnbackPath")
private String type;
@Schema(description = "使用字典进行解析 造型排版面 0正面, 1反面, 2侧面")
private Integer faceType;
@@ -19,6 +19,9 @@ import lombok.experimental.Accessors;
@Accessors(chain = false) // 设置 chain = false,避免生产单导入有问
public class OffSetList {
@Schema(description = "偏移刀路ID")
private String id;
// 刀路的偏移值
@Schema(description = "刀路的偏倚值")
private Double value;
@@ -7,6 +7,8 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
/**
* 点明细 , 表示小板外围轮廓的几个转折点
*/
@@ -17,14 +19,18 @@ import lombok.experimental.Accessors;
@Accessors(chain = false) // 设置 chain = false,避免生产单导入有问
public class PointDetail {
@Schema(description = "点id")
private String id;
// 点的位置信息
@Schema(description = "点的位置信息")
private Double pointX;
private Double pointY;
@Schema(description = "曲线-凸度")
private Double curve;
@Schema(description = "边圆弧半径(直线段为0)")
private Double radius;
// 点的封边尺寸
@Schema(description = "点的封边尺寸,封边尺寸,封边的厚度,长同边长")
private Double sealSize;
private BigDecimal sealSize;
}
@@ -33,5 +33,7 @@ public class PointList {
private Double curve;
@Schema(description = "曲线深度")
private Double depth;
@Schema(description = "起点圆弧半径(直线段为0)")
private Double holeRadius;
}
@@ -0,0 +1,69 @@
package com.cf.imes.module.executor.util.fileConversion.admin;
import java.lang.reflect.Method;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* 数据转换工具类
*/
public class ToolUtil {
// 手机号验证
public static Boolean validatePhoneNumber(String phoneNumber) {
// 定义手机号正则表达式
String regex = "^1[3-9]\\d{9}$";
// 编译正则表达式
Pattern pattern = Pattern.compile(regex);
// 创建 Matcher 对象
Matcher matcher = pattern.matcher(phoneNumber);
// 判断手机号是否匹配正则表达式
if (!matcher.matches()) {
return false;
}
return true;
}
// 日期格式转换
public static Map<String, Object> changeDate(String date, DateTimeFormatter formatter) {
Map<String, Object> map = new HashMap<>();
LocalDate localDate;
if (date == null){
localDate = LocalDate.now();
map.put("date", localDate);
map.put("error", 0);
}else {
try {
localDate = LocalDate.parse(date, formatter);
map.put("date", localDate);
map.put("error", 1);
} catch (DateTimeParseException e) {
map.put("date", date);
map.put("error", -1);
}
}
return map;
}
// 数据类型转换
public static boolean convertToType(String str, Class<?> targetType) {
try {
Method method = targetType.getMethod("parse" + targetType.getSimpleName(), String.class);
method.invoke(null, str);
return true;
} catch (Exception e) {
return false;
}
}
}
@@ -44,7 +44,7 @@ public class ApiTypeRealize {
private DictDataApi dictDataApi;
@Resource
SnowflakeIdWorker3rd idWorker;
private SnowflakeIdWorker3rd idWorker;
// private Integer num = 0;
@@ -70,39 +70,39 @@ public class ApiTypeRealize {
public Map<String, List<?>> apiPlateDataChange(JSONObject order, JSONObject dataPlates, JSONObject dataParts
, JSONObject dataBody, JSONObject dataGoods
, JSONObject plates, JSONObject dataModule
, JSONObject dataBlocks, String orderNo) {
, JSONObject dataBlocks, String orderNo,Long orderId, Long organId) {
Map<String, List<?>> map = new HashMap<>();
// 生产单id
Long orderId = (Long) identifierGenerator.nextId(null);
// Long orderId = (Long) identifierGenerator.nextId(null);
// 获取组织id 之后删除
// Long orgId = 325L;
// 生产单数据
OrderDO orderDO = orderInfoChange(order, orderId, orderNo);
OrderDO orderDO = orderInfoChange(order, orderId, orderNo, organId);
List<OrderDO> orderList = new ArrayList<>();
orderList.add(orderDO);
// 商品信息数据 信息以全
Map<String, Map<Long, ?>> goodsInfoChange = rawGoodsInfoChange(dataGoods, orderId, dataBlocks);
Map<String, Map<Long, ?>> goodsInfoChange = rawGoodsInfoChange(dataGoods, orderId, dataBlocks, organId);
List<GoodsDO> goodsDO = (List<GoodsDO>) goodsInfoChange.get("goodsDOS").values().stream().collect(Collectors.toList());
map.put("goodsDO", goodsDO);
List<RawGoodsDO> rawGoodsDO = (List<RawGoodsDO>) goodsInfoChange.get("rawGoodsDOS").values().stream().collect(Collectors.toList());
map.put("rawGoodsDO", rawGoodsDO);
// 柜体信息 少异形数量、板材数量
Map<Long, OrderBodyDO> bodyInfoChange = bodyInfoChange(dataBody, orderId);
Map<Long, OrderBodyDO> bodyInfoChange = bodyInfoChange(dataBody, orderId, organId);
// 加工组 少异形数量、板材数量
Map<String, Map<Long, ?>> group =
groupInfoChange(dataModule, orderId, bodyInfoChange);
groupInfoChange(dataModule, orderId, bodyInfoChange, organId);
Map<Long, OrderGroupDO> orderGroupDO = (Map<Long, OrderGroupDO>) group.get("orderGroup");
Map<Long, List<Long>> groupLists = (Map<Long, List<Long>>) group.get("lists"); // 加工组中包含的板件、配件id
// 配件
Map<String, Map<Long, ?>> partsDO = partsInfoChange(dataParts, orderId,
(Map<Long, GoodsDO>) goodsInfoChange.get("goodsDOS"), bodyInfoChange);
(Map<Long, GoodsDO>) goodsInfoChange.get("goodsDOS"), bodyInfoChange, organId);
Map<Long, OrderPartsRemark> partsRemark = (Map<Long, OrderPartsRemark>) partsDO.get("remarks"); // 配件备注
map.put("partsRemark", partsRemark.values().stream().collect(Collectors.toList()));
@@ -117,7 +117,7 @@ public class ApiTypeRealize {
itemsList.addAll(partsItems.values());
// 板材 写库
Map<String, Map<Long, ?>> platesDO = platesInfoChange(dataPlates, plates, orderId,
(Map<Long, GoodsDO>) goodsInfoChange.get("goodsDOS"), bodyInfoChange, dataBlocks);
(Map<Long, GoodsDO>) goodsInfoChange.get("goodsDOS"), bodyInfoChange, dataBlocks, organId);
Map<Long, PlateDO> orderPlatesDO = (Map<Long, PlateDO>) platesDO.get("platesInfos");
map.put("platesDO", orderPlatesDO.values().stream().collect(Collectors.toList()));
map.put("plateDetail", platesDO.get("plateDetail").values().stream().collect(Collectors.toList()));
@@ -221,7 +221,7 @@ public class ApiTypeRealize {
/**
* 加工组 信息转换
*/
private Map<String, Map<Long, ?>> groupInfoChange(JSONObject dataModule, Long orderId, Map<Long, OrderBodyDO> bodyInfoChange) {
private Map<String, Map<Long, ?>> groupInfoChange(JSONObject dataModule, Long orderId, Map<Long, OrderBodyDO> bodyInfoChange, Long organId) {
Map<String, Map<Long, ?>> map = new HashMap<>();
Map<Long, OrderGroupDO> orderGroupDOs = new HashMap<>();// 加工组id 和 加工组信息
Map<Long, List<Long>> groupLists = new HashMap<>();// 加工组id 和 详细信息
@@ -248,6 +248,7 @@ public class ApiTypeRealize {
.unregularNum(0)
.filename("")
.remark("")
.organId(organId)
.build();
groupLists.put(group.getLong("ModuleID"), jsonArrayToList(group.getJSONArray("ItemIDList")));
orderGroupDOs.put(group.getLong("ModuleID"), bodyInfo);
@@ -267,7 +268,7 @@ public class ApiTypeRealize {
* @author Administrator
* @date 2024/4/30
*/
public OrderDO orderInfoChange(JSONObject orderJson, Long orderId, String orderNo) {
public OrderDO orderInfoChange(JSONObject orderJson, Long orderId, String orderNo, Long organId) {
// 获取 Orders 字段对应的数组
JSONObject order = orderJson.getJSONArray("data").getJSONObject(0);
@@ -305,6 +306,7 @@ public class ApiTypeRealize {
// .splitter("")
.splitter(order.getString("cd_nick_name"))
.remark(orderRemark + order.getString("comments"))
.organId(organId)
.build();
Integer submitState = order.getInteger("submit_state");
@@ -344,7 +346,7 @@ public class ApiTypeRealize {
* @author Administrator
* @date 2024/4/30
*/
public Map<String, Map<Long, ?>> rawGoodsInfoChange(JSONObject dataRawGoods, Long orderId, JSONObject dataBlocks) {
public Map<String, Map<Long, ?>> rawGoodsInfoChange(JSONObject dataRawGoods, Long orderId, JSONObject dataBlocks, Long organId) {
Map<String, Map<Long, ?>> map = new HashMap<>();
Map<Long, RawGoodsDO> rawGoodsDOS = new HashMap<>();
Map<Long, GoodsDO> goodsDOS = new HashMap<>();
@@ -367,6 +369,7 @@ public class ApiTypeRealize {
.price(goods.getDouble("Price"))
.brand(goods.getString("Brand"))
.spec(goods.getString("Spec"))
.organId(organId)
.build();
rawGoodsDOS.put(goods.getLong("GoodsID"), rawGoodsDO);
@@ -385,6 +388,7 @@ public class ApiTypeRealize {
.price(BigDecimal.valueOf(goods.getDouble("Price")))
.brand(goods.getString("Brand"))
.spec(goods.getString("Spec"))
.organId(organId)
.build();
goodsDOS.put(goods.getLong("GoodsID"), goodsDO);
@@ -404,7 +408,7 @@ public class ApiTypeRealize {
* @author Administrator
* @date 2024/4/30
*/
private Map<Long, OrderBodyDO> bodyInfoChange(JSONObject dataBody, Long orderId) {
private Map<Long, OrderBodyDO> bodyInfoChange(JSONObject dataBody, Long orderId, Long organId) {
Map<Long, OrderBodyDO> bodyInfos = new HashMap<>();
if (dataBody.getJSONArray("List") != null &&
@@ -424,8 +428,9 @@ public class ApiTypeRealize {
.multiNum(0)
.plateNum(0)
.unregularNum(0)
.filename("")
.remark("")
.filename("")
.remark("")
.organId(organId)
.build();
bodyInfos.put(body.getLong("BoxID"), bodyInfo);
@@ -456,7 +461,7 @@ public class ApiTypeRealize {
* @author Administrator
* @date 2024/4/30
*/
public Map<String, Map<Long, ?>> partsInfoChange(JSONObject value, Long orderId, Map<Long, GoodsDO> goodsDOMap, Map<Long, OrderBodyDO> bodyInfos) {
public Map<String, Map<Long, ?>> partsInfoChange(JSONObject value, Long orderId, Map<Long, GoodsDO> goodsDOMap, Map<Long, OrderBodyDO> bodyInfos, Long organId) {
Map<String, Map<Long, ?>> map = new HashMap<>();
Map<Long, OrderPartsDO> partsInfos = new HashMap<>();
Map<Long, OrderItemDO> partsItem = new HashMap<>();
@@ -484,6 +489,7 @@ public class ApiTypeRealize {
.price(parts.getDouble("Price"))
.isComposite(parts.getBoolean("IsComposite"))
.remark(parts.getString("Remark"))
.organId(organId)
.build();
remarks.put(parts.getLong("ItemID"), partsRemarkChange(parts, orderId, partsId));
partsInfos.put(parts.getLong("ItemID"), partsInfo);
@@ -500,6 +506,7 @@ public class ApiTypeRealize {
.groupId(0L)
.partsId(partsId)
.num(parts.getDouble("Num"))
.organId(organId)
.build();
partsItem.put(parts.getLong("ItemID"), item);
}
@@ -534,7 +541,7 @@ public class ApiTypeRealize {
*/
private Map<String, Map<Long, ?>> platesInfoChange(JSONObject value, JSONObject dataPlates, Long orderId,
Map<Long, GoodsDO> goodsDOMap, Map<Long, OrderBodyDO> bodyInfos,
JSONObject dataBlocks) {
JSONObject dataBlocks, Long organId) {
// 板材 写ES
Map<Long, PlateDetail> plateDetail = platesDetailChange(value);
@@ -597,6 +604,7 @@ public class ApiTypeRealize {
.isCancel(false)
.filterType("")
.remark(remark)
.organId(organId)
.build();
// item 明细
@@ -612,6 +620,7 @@ public class ApiTypeRealize {
.partsId(0L)
.plateId(plateId)
.num(1.0)
.organId(organId)
.build();
if (plateDetail != null){
@@ -833,7 +842,7 @@ public class ApiTypeRealize {
.pointX(Double.valueOf(rawPoint.getString("X")))
.pointY(Double.valueOf(rawPoint.getString("Y")))
.curve(Double.valueOf(rawPoint.getString("Curve")))
.sealSize(Double.valueOf(rawPoint.getString("Edge")))
.sealSize(BigDecimal.valueOf(Double.valueOf(rawPoint.getString("Edge"))))
.build());
}
@@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.nacos.common.utils.StringUtils;
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
import com.cf.imes.module.executor.util.fileConversion.admin.ToolUtil;
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;
@@ -96,24 +97,22 @@ public class ExcelReadUtil { // 文件读取
if (orderMap.get("客户地址") == null) {
error += "客户地址不能为空;";
}
if (orderMap.get("出货日期") == null) {
error += "出货日期不能为空;";
}
if (orderMap.get("客户电话") == null) {
error += "客户电话不能为空;";
} else {
if (!validatePhoneNumber((String) orderMap.get("客户电话"))) {
if (!ToolUtil.validatePhoneNumber((String) orderMap.get("客户电话"))) {
error += orderMap.get("客户电话") + "-客户电话格式错误;";
}
}
if (orderMap.get("经销商电话") != null) {
if (!validatePhoneNumber((String) orderMap.get("经销商电话"))) {
if (!ToolUtil.validatePhoneNumber((String) orderMap.get("经销商电话"))) {
error += orderMap.get("经销商电话") + "-经销商电话格式错误;";
}
}
OrderDO orderDO = OrderDO.builder()
.organId(OrganContextHolder.getOrganId())
.dataType(0)
.orderDate(LocalDateTime.now())
.customer((String) orderMap.get("客户")) //
.customOrderNo((String) orderMap.get("自定义单号"))
.dealer((String) orderMap.get("经销商")) //
@@ -129,16 +128,15 @@ public class ExcelReadUtil { // 文件读取
} else {
String s = (String) orderMap.get("出货日期");
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
try {
LocalDate orderDate = LocalDate.parse(s, formatter);
LocalDate now = LocalDate.now();
if (orderDate.isBefore(LocalDate.now())) {
orderDate = now.plus(30, ChronoUnit.DAYS);
}
System.out.println(" orderDate " + orderDate);
orderDO.setDeliveryDate(orderDate.atStartOfDay()); //
} catch (DateTimeParseException e) {
Map<String, Object> mapDate = ToolUtil.changeDate(s, formatter);
if (mapDate.get("error") instanceof Integer && (Integer) mapDate.get("error") == -1) {
error += s + "-出货日期格式错误;";
} else {
LocalDate deliveryDate = (LocalDate) mapDate.get("date");
if (deliveryDate.isBefore(LocalDate.now())) {
deliveryDate = LocalDate.now().plus(30, ChronoUnit.DAYS);
}
orderDO.setDeliveryDate(deliveryDate.atStartOfDay());
}
}
map.put("order", orderDO);
@@ -146,34 +144,6 @@ public class ExcelReadUtil { // 文件读取
return map;
}
private Boolean validatePhoneNumber(String phoneNumber) {
// 定义手机号正则表达式
String regex = "^1[3-9]\\d{9}$";
// 编译正则表达式
Pattern pattern = Pattern.compile(regex);
// 创建 Matcher 对象
Matcher matcher = pattern.matcher(phoneNumber);
// 判断手机号是否匹配正则表达式
if (!matcher.matches()) {
return false;
}
return true;
}
private LocalDateTime changeTime(String dateString) {
// 使用 DateTimeFormatter 解析字符串为 LocalDateTime 对象
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy/MM/dd");
LocalDateTime dateTime = LocalDateTime.parse(dateString, formatter);
// 打印解析后的 LocalDateTime 对象
System.out.println("Parsed LocalDateTime: " + dateTime);
return dateTime;
}
// 赋值单元格数据
private OrderPlateImportExcelVO changeValue(Map<Integer, String> dataMap) {
OrderPlateImportExcelVO vo = new OrderPlateImportExcelVO();
@@ -336,13 +306,16 @@ public class ExcelReadUtil { // 文件读取
if (StringUtils.isEmpty(vo.getGoodsNumber())) {
errList.add("数量不能为空");
flag = false;
} else {
if (!checkNumber(vo.getGoodsNumber())) {
}else {
if (!convertToDouble(vo.getGoodsNumber())) {
flag = false;
errList.add("数量不能为0");
errList.add("数量类型错误");
}else {
if (!checkNumber(vo.getGoodsNumber())) {
flag = false;
errList.add("数量不能为0");
}
}
}
// 检查商品物料编码或是商品名称、规格、材质、颜色不可全为空
if (StringUtils.isEmpty(vo.getGoodsId()) && (StringUtils.isEmpty(vo.getGoodsName()) || StringUtils.isEmpty(vo.getSpec())
@@ -355,7 +328,19 @@ public class ExcelReadUtil { // 文件读取
// 数量类型判断
if (!convertToInteger(vo.getGoodsNumber())) {
flag = false;
errList.add("数量类型错误");
if (errList.contains("数量类型错误")){
Iterator<String> iterator = errList.iterator();
while (iterator.hasNext()) {
String element = iterator.next();
if ("数量类型错误".equals(element)) {
iterator.remove();
}
}
errList.add("板材数量类型需为整数");
}else {
errList.add("数量类型错误");
}
}
// 纹理有效性判断
if (StringUtils.isEmpty(vo.getWave())) {
@@ -48,13 +48,11 @@ public class ExcelTypeRealize {
@Resource
private DictDataApi dictDataApi;
final String NOT_ASSIGNED_ROOM = "分房间";
final String NOT_ASSIGNED_BODY = "未分柜体";
final String NOT_ASSIGNED = "命名";
// 数据转换 + 错误验证
public Map<String, List<?>> changeDate(List<?> list, Long orderId) {
if (list.isEmpty()) {
// throw exception(FILE_UPLOAD_ERR);
return null;
}
@@ -96,7 +94,6 @@ public class ExcelTypeRealize {
p.getGoodsHeight(),
p.getGoodsWidth(),
p.getGoodsThickness(),
// p.getModel(),
p.getBrand()),
Collectors.toList()
));
@@ -139,7 +136,7 @@ public class ExcelTypeRealize {
// 房间名称为条件进行分组
Map<String, List<OrderPlateImportExcelVO>> roomCollect = excelVOS.stream().collect(
Collectors.groupingBy(
excelVO -> excelVO.getRoomsName() != null ? excelVO.getRoomsName() : "未命名",
excelVO -> excelVO.getRoomsName() != null ? excelVO.getRoomsName() : NOT_ASSIGNED,
Collectors.toList()
));
@@ -148,7 +145,7 @@ public class ExcelTypeRealize {
// 柜体名称为条件进行分组
Map<String, List<OrderPlateImportExcelVO>> bodyCollect = listRoom.stream()
.collect(Collectors.groupingBy(
excelVO -> excelVO.getCabinetsName() != null ? excelVO.getCabinetsName() : "未命名",
excelVO -> excelVO.getCabinetsName() != null ? excelVO.getCabinetsName() : NOT_ASSIGNED,
Collectors.toList()
));
@@ -0,0 +1,27 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml.VO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
@Data
@AllArgsConstructor
@NoArgsConstructor
@XmlRootElement(name = "Accessory")
@XmlAccessorType(XmlAccessType.FIELD)
public class AccessoryXmlVO implements Serializable {
// 封边条列表
@XmlElement(name = "Edgings")
private EdgingXmlVOS edgingXmlVOS;
// 五金列表
@XmlElement(name = "Hardwares")
private HardwareXmlVOS hardwareXmlVOS;
}
@@ -0,0 +1,24 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml.VO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@XmlRootElement(name = "Assemblies")
@XmlAccessorType(XmlAccessType.FIELD)
// 组件/部件列表
public class AssemblieXmlVOS implements Serializable {
@XmlElement( name = "Assembly")
private List<AssemblyXmlVO> assemblyXmlVOList;
}
@@ -0,0 +1,100 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml.VO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
@Data
@AllArgsConstructor
@NoArgsConstructor
@XmlRootElement(name = "Assembly")
@XmlAccessorType(XmlAccessType.FIELD)
// 组件/部件信息
public class AssemblyXmlVO implements Serializable {
// 五金ID
@XmlAttribute(name = "组件/部件ID")
private String id;
// 类型——抽屉Drawer、酒格WineGrid、框架/拼框门FrameDoor、线条(顶线、脚线、挡水条等)Line、桌面/台面TableTop、水槽Sink……
@XmlAttribute(name = "type")
private String type;
// 物料编码
@XmlAttribute(name = "itemNo")
private String itemNo;
// 厂家
@XmlAttribute(name = "manufacturer")
private String manufacturer;
// 品牌
@XmlAttribute(name = "brand")
private String brand;
// 名称
@XmlAttribute(name = "name")
private String name;
// 材质
@XmlAttribute(name = "material")
private String material;
// 颜色
@XmlAttribute(name = "color")
private String color;
// 规格/类型
@XmlAttribute(name = "specs")
private String specs;
// 长度
@XmlAttribute(name = "length")
private String length;
// 宽度
@XmlAttribute(name = "width")
private String width;
// 高
@XmlAttribute(name = "height")
private String height;
// 数量
@XmlAttribute(name = "count")
private String count;
// 单位
@XmlAttribute(name = "unit")
private String unit;
// 仓库
@XmlAttribute(name = "warehouse")
private String warehouse;
// 货架
@XmlAttribute(name = "shelf")
private String shelf;
// 房间ID
@XmlAttribute(name = "roomId")
private String roomId;
// 柜体ID
@XmlAttribute(name = "boxId")
private String boxId;
// 加工组ID
@XmlAttribute(name = "groupId")
private String groupId;
// 模块ID
@XmlAttribute(name = "moduleId")
private String moduleId;
}
@@ -0,0 +1,161 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml.VO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.xml.bind.annotation.*;
import java.io.Serializable;
@Data
@AllArgsConstructor
@NoArgsConstructor
@XmlRootElement(name = "Block")
@XmlAccessorType(XmlAccessType.FIELD)
// 板件信息
public class BlockXmlVO implements Serializable {
// 板件ID
@XmlAttribute(name = "id")
private String id;
// 设计编号
@XmlAttribute(name = "designNo")
private String designNo;
// 生产编号
@XmlAttribute(name = "productionNo")
private String productionNo;
// 名称
@XmlAttribute(name = "name")
private String name;
// 类型——类型——背板类、层板类、立板类
@XmlAttribute(name = "type")
private String type;
// 开向——左开、右开、上开(上翻)、下开(下翻)、非门板
@XmlAttribute(name = "openDirection")
private String openDirection;
// 设计纹路——正纹、反纹、可翻转
@XmlAttribute(name = "texture")
private String texture;
// 设计饰面——无、单面贴皮/涂装(正面、反面)、双面贴皮/涂装(不同色、同色)
@XmlAttribute(name = "coatingType")
private String coatingType;
// 成品长
@XmlAttribute(name = "length")
private String length;
// 成品宽
@XmlAttribute(name = "width")
private String width;
// 成品厚
@XmlAttribute(name = "thickness")
private String thickness;
// 坯料长
@XmlAttribute(name = "rawLength")
private String rawLength;
// 坯料宽
@XmlAttribute(name = "rawWidth")
private String rawWidth;
// 坯料厚
@XmlAttribute(name = "rawThickness")
private String rawThickness;
// 开料长
@XmlAttribute(name = "cuttingLength")
private String cuttingLength;
// 开料宽
@XmlAttribute(name = "cuttingWidth")
private String cuttingWidth;
// 开料厚
@XmlAttribute(name = "cuttingThickness")
private String cuttingThickness;
// 成倍数量
@XmlAttribute(name = "multipleNumber")
private String multipleNumber;
// 成倍序号
@XmlAttribute(name = "multipleNo")
private String multipleNo;
// 异形——是/否
@XmlAttribute(name = "unregular")
private String unregular;
// 挖槽——是/否
@XmlAttribute(name = "slotting")
private String slotting;
// 排版面——设计正面、设计反面、随意面
@XmlAttribute(name = "layoutFace")
private String layoutFace;
// 正面饰面颜色、无
@XmlAttribute(name = "coatingObverse")
private String coatingObverse;
// 反面饰面颜色、无
@XmlAttribute(name = "coatingReverse")
private String coatingReverse;
// 房间ID
@XmlAttribute(name = "roomId")
private String roomId;
// 柜体ID
@XmlAttribute(name = "boxId")
private String boxId;
// 加工组ID
@XmlAttribute(name = "groupId")
private String groupId;
// 模块ID
@XmlAttribute(name = "moduleId")
private String moduleId;
// 成品(设计成型/已封边/贴皮或涂装的板件)轮廓信息
@XmlElement(name = "Outline")
private OutlineXmlVO outlineXmlVO ;
// 坯料(还需进行精修/铣削/打磨的板材)轮廓信息
@XmlElement(name = "RawOutline")
private RawOutlineXmlVO rawOutlineXmlVO ;
// 开料成型(精修/铣削/打磨完成,未封边/贴皮或涂装的板材)轮廓信息
@XmlElement(name = "CuttingOutline")
private CuttingOutlineXmlVO cuttingOutlineXmlVO ;
// 孔信息
@XmlElement(name = "Holes")
private HoleXmlVOS holeXmlVOS;
// 凹槽信息
@XmlElement(name = "Grooves")
private GrooveXmlVOS grooveXmlVOS ;
// 孤岛列表
@XmlElement(name = "Islets")
private IsletXmlVOS isletXmlVOS ;
// 关联配件/组件列表
@XmlElement(name = "correlations")
private CorrelationXmlVOS correlationXmlVOS;
// 备注
@XmlElement(name = "Remarks")
private RemarkXmlVOS remarkXmlVOS;
}
@@ -0,0 +1,26 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml.VO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.xml.bind.annotation.*;
import java.io.Serializable;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@XmlRootElement(name = "Blocks")
@XmlAccessorType(XmlAccessType.FIELD)
// 板件列表
public class BlockXmlVOS implements Serializable {
// 数量
@XmlAttribute( name = "count")
private String count;
//
@XmlElement( name = "Block")
private List<BlockXmlVO> blockXmlVOList;
}
@@ -0,0 +1,44 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml.VO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
@Data
@AllArgsConstructor
@NoArgsConstructor
@XmlRootElement(name = "Box")
@XmlAccessorType(XmlAccessType.FIELD)
public class BoxXmlVO implements Serializable {
// 柜体ID
@XmlAttribute(name = "id")
private String id;
// 房间名称
@XmlAttribute(name = "name")
private String name;
// 房间编号
@XmlAttribute(name = "code")
private String code;
// 房间高度
@XmlAttribute(name = "height")
private String height;
// 房间宽度
@XmlAttribute(name = "width")
private String width;
// 房间深度
@XmlAttribute(name = "length")
private String length;
}
@@ -0,0 +1,23 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml.VO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
@Data
@AllArgsConstructor
@NoArgsConstructor
@XmlRootElement(name = "correlation")
@XmlAccessorType(XmlAccessType.FIELD)
public class CorrelationXmlVO implements Serializable {
// [关联五金ID/关联组件ID]
@XmlAttribute(name = "id")
private String id;
}
@@ -0,0 +1,24 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml.VO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@XmlRootElement(name = "correlations")
@XmlAccessorType(XmlAccessType.FIELD)
public class CorrelationXmlVOS implements Serializable {
// 房间
@XmlElement(name = "correlation")
private List<CorrelationXmlVO> correlationXmlVOList;
}
@@ -0,0 +1,33 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml.VO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.xml.bind.annotation.*;
import java.io.Serializable;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@XmlRootElement(name = "CuttingOutline")
@XmlAccessorType(XmlAccessType.FIELD)
// 开料成型(还需进行精修/铣削/打磨的板材,成品尺寸-封边+预留边)轮廓信息
public class CuttingOutlineXmlVO implements Serializable {
// 相对于成品轮廓,基准点的X坐标偏移量
@XmlAttribute(name = "referenceOffsetX")
private String referenceOffsetX;
// 相对于成品轮廓,基准点的Y坐标偏移量
@XmlAttribute(name = "referenceOffsetY")
private String referenceOffsetY;
// 点阵数量
@XmlAttribute(name = "count")
private String count;
@XmlElement(name = "Point")
private List<PointXmlVO> pointXmlVOList;
}
@@ -0,0 +1,96 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml.VO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
@Data
@AllArgsConstructor
@NoArgsConstructor
@XmlRootElement(name = "Edging")
@XmlAccessorType(XmlAccessType.FIELD)
// 封边条信息
public class EdgingXmlVO implements Serializable {
// 封边条ID
@XmlAttribute(name = "id")
private String id;
// 物料编码
@XmlAttribute(name = "itemNo")
private String itemNo;
// 厂家
@XmlAttribute(name = "manufacturer")
private String manufacturer;
// 品牌
@XmlAttribute(name = "brand")
private String brand;
// 名称
@XmlAttribute(name = "name")
private String name;
// 材质
@XmlAttribute(name = "material")
private String material;
// 颜色
@XmlAttribute(name = "color")
private String color;
// 规格
@XmlAttribute(name = "specs")
private String specs;
// 长
@XmlAttribute(name = "length")
private String length;
// 宽
@XmlAttribute(name = "width")
private String width;
// 厚
@XmlAttribute(name = "thickness")
private String thickness;
// 长度单位——默认m米
@XmlAttribute(name = "unit")
private String unit;
// 仓库
@XmlAttribute(name = "warehouse")
private String warehouse;
// 货架
@XmlAttribute(name = "shelf")
private String shelf;
// 数量
@XmlAttribute(name = "count")
private String count;
// 房间ID
@XmlAttribute(name = "roomId")
private String roomId;
// 柜体ID
@XmlAttribute(name = "boxId")
private String boxId;
// 加工组ID
@XmlAttribute(name = "groupId")
private String groupId;
// 模块ID
@XmlAttribute(name = "moduleId")
private String moduleId;
}
@@ -0,0 +1,24 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml.VO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@XmlRootElement(name = "Edgings")
@XmlAccessorType(XmlAccessType.FIELD)
// 封边条列表
public class EdgingXmlVOS implements Serializable {
@XmlElement( name = "Edging")
private List<EdgingXmlVO> edgingXmlVOList;
}
@@ -0,0 +1,94 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml.VO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.xml.bind.annotation.*;
import java.io.Serializable;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@XmlRootElement(name = "Groove")
@XmlAccessorType(XmlAccessType.FIELD)
// 凹槽信息
public class GrooveXmlVO implements Serializable {
// 凹槽ID
@XmlAttribute(name = "id")
private String id;
// 父(孤岛)ID
@XmlAttribute(name = "parentID")
private String parentId;
// 类型——矩形槽Rectangle、路径槽Path、内铣槽internalMilling、折返路径槽turnbackPath
@XmlAttribute(name = "type")
private String type;
// 加工面——正面、反面、左侧面、右侧面、上侧面、下侧面、斜面
@XmlAttribute(name = "face")
private String face;
// 宽度
@XmlAttribute(name = "width")
private String width;
// 长度
@XmlAttribute(name = "length")
private String length;
// 深度
@XmlAttribute(name = "depth")
private String depth;
// 加宽
@XmlAttribute(name = "widthExtend")
private String widthExtend;
// 加长
@XmlAttribute(name = "lengthExtend")
private String lengthExtend;
// 加深
@XmlAttribute(name = "depthExtend")
private String depthExtend;
// 圆角半径
@XmlAttribute(name = "round")
private String round;
// 刀名称
@XmlAttribute(name = "toolName")
private String toolName;
// 刀号
@XmlAttribute(name = "toolNo")
private String toolNo;
// 刀直径
@XmlAttribute(name = "toolDiameter")
private String toolDiameter;
// 刀路冗余量——偏移重叠量
@XmlAttribute(name = "redundance")
private String redundance;
// 角度——二维刀路V型刀提角/清角用
@XmlAttribute(name = "tangentAngle")
private String tangentAngle;
// 内层(不含内嵌凹槽内的孤岛)孤岛数量
@XmlAttribute(name = "isletCount")
private String isletCount;
// 凹槽点信息
@XmlElement(name = "Points")
private PointXmlVOS pointXmlVOS;
// 偏移刀路列表
@XmlElement(name = "offsetLines")
private OffsetLineXmlVOS offsetLineXmlVOS;
}
@@ -0,0 +1,50 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml.VO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.xml.bind.annotation.*;
import java.io.Serializable;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@XmlRootElement(name = "Grooves")
@XmlAccessorType(XmlAccessType.FIELD)
// 凹槽列表
public class GrooveXmlVOS implements Serializable {
// 凹槽数量
@XmlAttribute(name = "count")
private String count;
// 正面垂凹槽数量
@XmlAttribute(name = "countFaceA")
private String countFaceA;
// 反面凹槽数量
@XmlAttribute(name = "countFaceB")
private String countFaceB;
// 侧凹槽数量
@XmlAttribute(name = "countSide")
private String countSide;
// 斜面凹槽数量
@XmlAttribute(name = "countBevelled")
private String countBevelled;
// 矩形凹槽数量
@XmlAttribute(name = "countRectangle")
private String countRectangle;
// 挖穿造型/槽数量
@XmlAttribute(name = "countThrough")
private String countThrough;
// 凹槽信息
@XmlElement(name = "Groove")
private List<GrooveXmlVO> grooveXmlVOList;
}
@@ -0,0 +1,47 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml.VO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
@Data
@AllArgsConstructor
@NoArgsConstructor
@XmlRootElement(name = "Box")
@XmlAccessorType(XmlAccessType.FIELD)
public class GroupXmlVO implements Serializable {
// 加工组ID
@XmlAttribute(name = "id")
private String id;
// 加工组名称
@XmlAttribute(name = "name")
private String name;
// 加工组编号
@XmlAttribute(name = "code")
private String code;
// 加工组高度
@XmlAttribute(name = "height")
private String height;
// 加工组宽度
@XmlAttribute(name = "width")
private String width;
// 加工组长度
@XmlAttribute(name = "length")
private String length;
// 加工组数量
@XmlAttribute(name = "count")
private String count;
}
@@ -0,0 +1,26 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml.VO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.xml.bind.annotation.*;
import java.io.Serializable;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@XmlRootElement(name = "Groups")
@XmlAccessorType(XmlAccessType.FIELD)
// 加工组
public class GroupXmlVOS implements Serializable {
// 数量
@XmlAttribute(name = "count")
private String count;
// 房间
@XmlElement(name = "Room")
private List<GroupXmlVO> groupXmlVOList;
}
@@ -0,0 +1,101 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml.VO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
@Data
@AllArgsConstructor
@NoArgsConstructor
@XmlRootElement(name = "Hardware")
@XmlAccessorType(XmlAccessType.FIELD)
// 五金信息
public class HardwareXmlVO implements Serializable {
// 五金ID
@XmlAttribute(name = "id")
private String id;
// 类型——拉手Handle、铰链Hinge、导轨Track、衣杆/裤杆Pole、杆托/杆座PoleBase、拉直器Straightener、灯带LightBelt、螺丝(及螺母)Screw(Nut)……
@XmlAttribute(name = "type")
private String type;
// 物料编码
@XmlAttribute(name = "itemNo")
private String itemNo;
// 厂家
@XmlAttribute(name = "manufacturer")
private String manufacturer;
// 品牌
@XmlAttribute(name = "brand")
private String brand;
// 名称
@XmlAttribute(name = "name")
private String name;
// 材质
@XmlAttribute(name = "material")
private String material;
// 颜色
@XmlAttribute(name = "color")
private String color;
// 规格/类型
@XmlAttribute(name = "specs")
private String specs;
// 长度
@XmlAttribute(name = "length")
private String length;
// 宽度
@XmlAttribute(name = "width")
private String width;
// 厚
@XmlAttribute(name = "thickness")
private String thickness;
// 数量
@XmlAttribute(name = "count")
private String count;
// 单位
@XmlAttribute(name = "unit")
private String unit;
// 仓库
@XmlAttribute(name = "warehouse")
private String warehouse;
// 货架
@XmlAttribute(name = "shelf")
private String shelf;
// 房间ID
@XmlAttribute(name = "roomId")
private String roomId;
// 柜体ID
@XmlAttribute(name = "boxId")
private String boxId;
// 加工组ID
@XmlAttribute(name = "groupId")
private String groupId;
// 模块ID
@XmlAttribute(name = "moduleId")
private String moduleId;
}
@@ -0,0 +1,24 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml.VO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@XmlRootElement(name = "Hardwares")
@XmlAccessorType(XmlAccessType.FIELD)
// 五金列表
public class HardwareXmlVOS implements Serializable {
@XmlElement( name = "Hardware")
private List<HardwareXmlVO> hardwareXmlVOList;
}
@@ -0,0 +1,82 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml.VO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.xml.bind.annotation.*;
import java.io.Serializable;
@Data
@AllArgsConstructor
@NoArgsConstructor
@XmlRootElement(name = "Hole")
@XmlAccessorType(XmlAccessType.FIELD)
public class HoleXmlVO implements Serializable {
// 孔ID
@XmlAttribute(name = "id")
private String id;
// 孔类型
@XmlAttribute(name = "type")
private String type;
// 拆单名/商品名
@XmlAttribute(name = "name")
private String name;
// 加工面——正面、反面、左侧面、右侧面、上侧面、下侧面、斜面
@XmlAttribute(name = "face")
private String face;
// 方向——向后Z-、向前Z+、向右X+、向左X-、向下Y-、向上Y+、斜O
@XmlAttribute(name = "direction")
private String direction;
// 直径/沉头孔外直径
@XmlAttribute(name = "diameter")
private String diameter;
// 沉头孔内直径
@XmlAttribute(name = "diameterInner")
private String diameterInner;
// 深度/沉头孔浅孔深度
@XmlAttribute(name = "depth")
private String depth;
// 沉头孔深孔深度
@XmlAttribute(name = "depthInner")
private String depthInner;
// 孔组数量
@XmlAttribute(name = "groupNumber")
private String groupNumber;
// 孔组X坐标偏移
@XmlAttribute(name = "groupXoffset")
private String groupXoffset;
// 孔组Y坐标偏移
@XmlAttribute(name = "groupYoffset")
private String groupYoffset;
// 孔组Z坐标偏移
@XmlAttribute(name = "groupZoffset")
private String groupZoffset;
// 刀名称
@XmlAttribute(name = "toolName")
private String toolName;
// 刀号
@XmlAttribute(name = "toolNo")
private String toolNo;
@XmlElement(name = "Begin")
private PointBeginXmlVO pointBeginXmlVO;
@XmlElement(name = "End")
private PointEndXmlVO pointEndXmlVO;
}
@@ -0,0 +1,53 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml.VO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.xml.bind.annotation.*;
import java.io.Serializable;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@XmlRootElement(name = "Holes")
@XmlAccessorType(XmlAccessType.FIELD)
// 孔列表
public class HoleXmlVOS implements Serializable {
// 孔数量
@XmlAttribute(name = "count")
private String count;
// 正面垂直孔数量
@XmlAttribute(name = "countFaceA")
private String countFaceA;
// 反面垂直孔数量
@XmlAttribute(name = "countFaceB")
private String countFaceB;
// 水平侧孔数量
@XmlAttribute(name = "countSide")
private String countSide;
// 斜面孔数量
@XmlAttribute(name = "countBevelled")
private String countBevelled;
// 偏心轮/锁定孔数
@XmlAttribute(name = "countLocking")
private String countLocking;
// 预埋件孔数量
@XmlAttribute(name = "countBuildIn")
private String countBuildIn;
// 挖穿孔数量
@XmlAttribute(name = "countThrough")
private String countThrough;
@XmlElement(name = "Hole")
private List<HoleXmlVO> holeXmlVOList;
}
@@ -0,0 +1,34 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml.VO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.xml.bind.annotation.*;
import java.io.Serializable;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@XmlRootElement(name = "Islet")
@XmlAccessorType(XmlAccessType.FIELD)
// 孤岛信息
public class IsletXmlVO implements Serializable {
// 孤岛ID
@XmlAttribute(name = "id")
private String id;
// 父(凹槽)ID
@XmlAttribute(name = "parentID")
private String parentId;
// 内层(不含内嵌孤岛内的凹槽)凹槽数量
@XmlAttribute(name = "grooveCount")
private String grooveCount;
// 孤岛点信息
@XmlElement(name = "Point")
private List<PointXmlVO> pointXmlVOList;
}
@@ -0,0 +1,26 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml.VO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@XmlRootElement(name = "Islets")
@XmlAccessorType(XmlAccessType.FIELD)
// 孤岛列表
public class IsletXmlVOS implements Serializable {
// 房间
@XmlElement(name = "Islet")
private List<IsletXmlVO> isletXmlVOList;
}
@@ -0,0 +1,29 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml.VO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.xml.bind.annotation.*;
import java.io.Serializable;
@Data
@AllArgsConstructor
@NoArgsConstructor
@XmlRootElement(name = "Material")
@XmlAccessorType(XmlAccessType.FIELD)
// 物料信息
public class MaterialXmlVO implements Serializable {
// 板材列表
@XmlElement(name = "Plates")
private PlateXmlVOS plateXmlVOS;
// 配件列表
@XmlElement(name = "Accessory")
private AccessoryXmlVO accessoryXmlVO;
// 组件/部件列表
@XmlElement(name = "Assemblies")
private AssemblieXmlVOS assemblieXmlVOS;
}
@@ -0,0 +1,45 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml.VO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.xml.bind.annotation.*;
import java.io.Serializable;
@Data
@AllArgsConstructor
@NoArgsConstructor
@XmlRootElement(name = "Module")
@XmlAccessorType(XmlAccessType.FIELD)
public class ModuleXmlVO implements Serializable {
// 房间ID
@XmlAttribute(name = "id")
private String id;
// 房间名称
@XmlAttribute(name = "name")
private String name;
// 房间编号
@XmlAttribute(name = "code")
private String code;
// 房间高度
@XmlAttribute(name = "height")
private String height;
// 房间宽度
@XmlAttribute(name = "width")
private String width;
// 房间长度
@XmlAttribute(name = "length")
private String length;
// 房间数量
@XmlAttribute(name = "count")
private String count;
}
@@ -0,0 +1,25 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml.VO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.xml.bind.annotation.*;
import java.io.Serializable;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@XmlRootElement(name = "Modules")
@XmlAccessorType(XmlAccessType.FIELD)
public class ModuleXmlVOS implements Serializable {
// 模块数量
@XmlAttribute(name = "count")
private String count;
// 房间
@XmlElement(name = "Room")
private List<ModuleXmlVO> moduleXmlVOList;
}
@@ -0,0 +1,48 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml.VO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
@Data
@AllArgsConstructor
@NoArgsConstructor
@XmlRootElement(name = "offsetLine")
@XmlAccessorType(XmlAccessType.FIELD)
// 偏移刀路信息
public class OffsetLineXmlVO implements Serializable {
// 偏移刀路ID
@XmlAttribute(name = "id")
private String id;
// 偏移值——正值外偏/右偏、负值内偏/左偏
@XmlAttribute(name = "offset")
private String offset;
// 深度
@XmlAttribute(name = "depth")
private String depth;
// 刀名称
@XmlAttribute(name = "toolName")
private String toolName;
// 刀号
@XmlAttribute(name = "toolNo")
private String toolNo;
// 刀直径
@XmlAttribute(name = "toolDiameter")
private String toolDiameter;
// 角度——二维刀路V型刀提角/清角用
@XmlAttribute(name = "tangentAngle")
private String tangentAngle;
}
@@ -0,0 +1,24 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml.VO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@XmlRootElement(name = "offsetLines")
@XmlAccessorType(XmlAccessType.FIELD)
// 偏移刀路列表
public class OffsetLineXmlVOS implements Serializable {
@XmlElement(name = "offsetLine")
private List<OffsetLineXmlVO> offsetLineXmlVOList;
}
@@ -0,0 +1,123 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml.VO;
import lombok.*;
import java.math.BigDecimal;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class OrderPartsAddVO {
/**
* 配件 ID
*/
private Long id;
/**
* 组织 ID
*/
private Long organId;
/**
* 生产单号
*/
private Long orderId;
/**
* 商品ID
*/
private String goodsId;
/**
* 配件名称
*/
private String name;
/**
* 材质
*/
private String material;
/**
* 配件类型
*/
private String type;
/**
* 颜色
*/
private String color;
/**
* 长
*/
private BigDecimal length;
/**
* 宽
*/
private BigDecimal width;
/**
* 高
*/
private BigDecimal thickness;
/**
* 型号
*/
private String model;
/**
* 规格
*/
private String spec;
/**
* 品牌
*/
private String brand;
/**
* 厂家
*/
private String factory;
/**
* 单位
*/
private String unit;
/**
* 价格
*/
private Double price;
/**
* 数量
*/
private Double num;
/**
* 是否复合部件:0 否 1 是
*/
private Boolean isComposite;
/**
* 仓库
*/
private String warehouse;
/**
* 货架
*/
private String shelf;
/**
* 房间ID
*/
private String roomId;
/**
* 柜体ID
*/
private String bodyId;
/**
* 加工组ID
*/
private String groupId;
/**
* 模块ID
*/
private String modelId;
/**
* 备注
*/
private String remark;
/**
* 是否删除
*/
private Boolean deleted;
}
@@ -0,0 +1,117 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml.VO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.xml.bind.annotation.*;
import java.io.Serializable;
@Data
@AllArgsConstructor
@NoArgsConstructor
@XmlRootElement(name = "Order")
@XmlAccessorType(XmlAccessType.FIELD)
public class OrderXmlVO implements Serializable {
// 订单ID
@XmlAttribute(name = "id")
private String id;
// 订单编号
@XmlAttribute(name = "orderNo")
private String orderNo;
// 订单自定义编号
@XmlAttribute(name = "customOrderNo")
private String customOrderNo;
// 客户
@XmlAttribute(name = "customer")
private String customer;
// 客户电话
@XmlAttribute(name = "customerPhone")
private String customerPhone;
// 客户地址
@XmlAttribute(name = "customerAddress")
private String customerAddress;
// 经销商
@XmlAttribute(name = "dealer")
private String dealer;
// 经销商电话
@XmlAttribute(name = "dealerPhone")
private String dealerPhone;
// 经销商地址
@XmlAttribute(name = "dealerAddress")
private String dealerAddress;
// 业务员
@XmlAttribute(name = "seller")
private String seller;
// 业务员电话
@XmlAttribute(name = "sellerPhone")
private String sellerPhone;
// 业务员地址
@XmlAttribute(name = "sellerAddress")
private String sellerAddress;
// 设计师
@XmlAttribute(name = "designer")
private String designer;
// 设计师电话
@XmlAttribute(name = "designerPhone")
private String designerPhone;
// 设计师地址
@XmlAttribute(name = "designerAddress")
private String designerAddress;
// 解单员
@XmlAttribute(name = "analyst")
private String analyst;
// 解单员电话
@XmlAttribute(name = "analystPhone")
private String analystPhone;
// 解单员地址
@XmlAttribute(name = "analystAddress")
private String analystAddress;
// 订单日期
@XmlAttribute(name = "orderDate")
private String orderDate;
// 出货日期
@XmlAttribute(name = "deliveryDate")
private String deliveryDate;
// 备注信息
@XmlAttribute(name = "memo")
private String memo;
// 房间信息
@XmlElement(name = "Rooms")
private RoomXmlVOS roomXmlVOS;
// 模块信息
@XmlElement( name = "Modules")
private ModuleXmlVOS moduleXmlVOS;
// 分组信息
@XmlElement(name = "Groups")
private GroupXmlVOS groupXmlVOS;
// 材质信息
@XmlElement(name = "Material")
private MaterialXmlVO materialXmlVO;
}
@@ -0,0 +1,20 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml.VO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.xml.bind.annotation.*;
import java.io.Serializable;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@XmlRootElement(name = "Outline")
@XmlAccessorType(XmlAccessType.FIELD)
public class OutlineXmlVO implements Serializable {
@XmlElement(name = "Point")
private List<PointXmlVO> pointXmlVOList;
}
@@ -0,0 +1,116 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml.VO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.xml.bind.annotation.*;
import java.io.Serializable;
@Data
@AllArgsConstructor
@NoArgsConstructor
@XmlRootElement(name = "Plate")
@XmlAccessorType(XmlAccessType.FIELD)
// 板材信息
public class PlateXmlVO implements Serializable {
// 板材ID
@XmlAttribute(name = "id")
private String id;
// 物料编码
@XmlAttribute(name = "itemNo")
private String itemNo;
// 厂家
@XmlAttribute(name = "manufacturer")
private String manufacturer;
// 品牌
@XmlAttribute(name = "brand")
private String brand;
// 名称
@XmlAttribute(name = "name")
private String name;
// 材质
@XmlAttribute(name = "material")
private String material;
// 饰面类型——无、单面贴皮/涂装、双面贴皮/涂装
@XmlAttribute(name = "coating")
private String coating;
// 有无纹理
@XmlAttribute(name = "grained")
private String grained;
// 正面饰面颜色、无
@XmlAttribute(name = "coatingObverse")
private String coatingObverse;
// 反面饰面颜色、无
@XmlAttribute(name = "coatingReverse")
private String coatingReverse;
// 规格
@XmlAttribute(name = "specs")
private String specs;
// 长
@XmlAttribute(name = "length")
private String length;
// 宽
@XmlAttribute(name = "width")
private String width;
// 厚
@XmlAttribute(name = "thickness")
private String thickness;
// 余料长
@XmlAttribute(name = "oddmentLength")
private String oddmentLength;
// 余料宽
@XmlAttribute(name = "oddmentWidth")
private String oddmentWidth;
// 余料厚
@XmlAttribute(name = "oddmentThickness")
private String oddmentThickness;
// 长度单位——默认mm毫米
@XmlAttribute(name = "unitLength")
private String unitLength;
// 面积
@XmlAttribute(name = "area")
private String area;
// 面积单位——默认m²平方米
@XmlAttribute(name = "unitArea")
private String unitArea;
// 仓库
@XmlAttribute(name = "warehouse")
private String warehouse;
// 货架
@XmlAttribute(name = "shelf")
private String shelf;
// 余料编号
@XmlAttribute(name = "oddmentNo")
private String oddmentNo;
// 备注信息
@XmlAttribute(name = "memo")
private String memo;
@XmlElement(name = "Blocks")
private BlockXmlVOS blockXmlVOS;
}
@@ -0,0 +1,23 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml.VO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@XmlRootElement(name = "Plates")
@XmlAccessorType(XmlAccessType.FIELD)
public class PlateXmlVOS implements Serializable {
@XmlElement( name = "Plate")
private List<PlateXmlVO> plateXmlVOList;
}
@@ -0,0 +1,43 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml.VO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
@Data
@AllArgsConstructor
@NoArgsConstructor
@XmlRootElement(name = "Begin")
@XmlAccessorType(XmlAccessType.FIELD)
public class PointBeginXmlVO implements Serializable {
// 起点坐标X
@XmlAttribute(name = "X")
private String x;
// 起点坐标Y
@XmlAttribute(name = "Y")
private String y;
// 起点坐标Z
@XmlAttribute(name = "Z")
private String z;
// 刀具X轴旋转角度
@XmlAttribute(name = "toolRotateX")
private String toolRotateX;
// 刀具Y轴旋转角度
@XmlAttribute(name = "toolRotateY")
private String toolRotateY;
// 刀具Z轴旋转角度
@XmlAttribute(name = "toolRotateZ")
private String toolRotateZ;
}
@@ -0,0 +1,43 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml.VO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
@Data
@AllArgsConstructor
@NoArgsConstructor
@XmlRootElement(name = "End")
@XmlAccessorType(XmlAccessType.FIELD)
public class PointEndXmlVO implements Serializable {
// 终点坐标X
@XmlAttribute(name = "X")
private String x;
// 终点坐标Y
@XmlAttribute(name = "Y")
private String y;
// 终点坐标Z
@XmlAttribute(name = "Z")
private String z;
// 刀具X轴旋转角度
@XmlAttribute(name = "toolRotateX")
private String toolRotateX;
// 刀具Y轴旋转角度
@XmlAttribute(name = "toolRotateY")
private String toolRotateY;
// 刀具Z轴旋转角度
@XmlAttribute(name = "toolRotateZ")
private String toolRotateZ;
}
@@ -0,0 +1,80 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml.VO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
@Data
@AllArgsConstructor
@NoArgsConstructor
@XmlRootElement(name = "Point")
@XmlAccessorType(XmlAccessType.FIELD)
// 孤岛点信息
public class PointXmlVO implements Serializable {
// 点ID
@XmlAttribute(name = "id")
private String id;
// 点X坐标
@XmlAttribute(name = "pointX")
private String pointX;
// 点Y坐标
@XmlAttribute(name = "pointY")
private String pointY;
// 点Z坐标
@XmlAttribute(name = "pointZ")
private String pointZ;
// 圆弧凹凸度——直线段为0
@XmlAttribute(name = "curvature")
private String curvature;
// 边圆弧半径——直线段为0
@XmlAttribute(name = "radius")
private String radius;
// 加工工艺
@XmlAttribute(name = "process")
private String process;
// 封边条ID
@XmlAttribute(name = "edgingId")
private String edgingId;
// 封边条厚度
@XmlAttribute(name = "edgingThickness")
private String edgingThickness;
// 封边条颜色
@XmlAttribute(name = "edgingColor")
private String edgingColor;
// 封边条材质
@XmlAttribute(name = "edgingMaterial")
private String edgingMaterial;
// 封边条余量(两头)
@XmlAttribute(name = "edgingExtend")
private String edgingExtend;
// 预铣/精修量
@XmlAttribute(name = "preMilling")
private String preMilling;
// 延展/收缩量
@XmlAttribute(name = "scale")
private String scale;
// 边备注信息
@XmlAttribute(name = "remark")
private String remark;
}
@@ -0,0 +1,23 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml.VO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@XmlRootElement(name = "Points")
@XmlAccessorType(XmlAccessType.FIELD)
public class PointXmlVOS implements Serializable {
@XmlElement(name = "Point")
private List<PointXmlVO> pointXmlVOList;
}
@@ -0,0 +1,33 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml.VO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.xml.bind.annotation.*;
import java.io.Serializable;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@XmlRootElement(name = "RawOutline")
@XmlAccessorType(XmlAccessType.FIELD)
// 坯料(还需进行精修/铣削/打磨的板材)轮廓信息
public class RawOutlineXmlVO implements Serializable {
// 相对于成品轮廓,基准点的X坐标偏移量
@XmlAttribute(name = "referenceOffsetX")
private String referenceOffsetX;
// 相对于成品轮廓,基准点的Y坐标偏移量
@XmlAttribute(name = "referenceOffsetY")
private String referenceOffsetY;
// 点阵数量
@XmlAttribute(name = "count")
private String count;
@XmlElement(name = "Point")
private List<PointXmlVO> pointXmlVOList;
}
@@ -0,0 +1,31 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml.VO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
@Data
@AllArgsConstructor
@NoArgsConstructor
@XmlRootElement(name = "Remark")
@XmlAccessorType(XmlAccessType.FIELD)
public class RemarkXmlVO implements Serializable {
// 备注ID
@XmlAttribute(name = "id")
private String id;
// 备注名称
@XmlAttribute(name = "name")
private String name;
// 备注信息
@XmlAttribute(name = "info")
private String info;
}
@@ -0,0 +1,22 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml.VO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@XmlRootElement(name = "Remarks")
@XmlAccessorType(XmlAccessType.FIELD)
public class RemarkXmlVOS {
@XmlElement(name = "Remark")
private List<RemarkXmlVO> remarkXmlVOList;
}
@@ -0,0 +1,48 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml.VO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.xml.bind.annotation.*;
import java.io.Serializable;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@XmlRootElement(name = "Room")
@XmlAccessorType(XmlAccessType.FIELD)
public class RoomXmlVO implements Serializable {
// 房间ID
@XmlAttribute(name = "id")
private String id;
// 房间名称
@XmlAttribute(name = "name")
private String name;
// 房间编号
@XmlAttribute(name = "code")
private String code;
// 房间高度
@XmlAttribute(name = "height")
private String height;
// 房间宽度
@XmlAttribute(name = "width")
private String width;
// 房间长度
@XmlAttribute(name = "length")
private String length;
// 房间数量
@XmlAttribute(name = "count")
private String count;
@XmlElement(name = "Box")
private List<BoxXmlVO> boxXmlVOList;
}
@@ -0,0 +1,26 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml.VO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.xml.bind.annotation.*;
import java.io.Serializable;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@XmlRootElement(name = "Rooms")
@XmlAccessorType(XmlAccessType.FIELD)
public class RoomXmlVOS implements Serializable {
// 数量
@XmlAttribute(name = "count")
private String count;
// 房间
@XmlElement(name = "Room")
private List<RoomXmlVO> roomXmlVOList;
}
@@ -0,0 +1,47 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
import java.io.*;
import java.nio.charset.StandardCharsets;
@Slf4j
@Component
public class XMLReadUtil {
public static Object read(MultipartFile file, Class<?> clazz) throws IOException {
byte[] firstThreeBytes = new byte[3];
// 用字符缓冲流获取XML文件内容
InputStream inputStream = file.getInputStream();
inputStream.read(firstThreeBytes, 0, 3);
// if (firstThreeBytes[0] == (byte) 0xEF && firstThreeBytes[1] == (byte) 0xBB && firstThreeBytes[2] == (byte) 0xBF) {
// // 跳过 BOM
// inputStream.skip(3);
// }
try (BufferedReader br = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8))) {
StringBuffer builder = new StringBuffer();
String line;
while ((line = br.readLine()) != null) {
builder.append(line);
}
// XML转为JAVA对象
Object odfBody = XmlBuilder.xmlStrToOject(clazz, builder.toString());
System.out.println(" odfBody " + JSON.toJSONString(odfBody));
return odfBody;
} catch (IOException e) {
log.error("Error reading the file: " + file.getOriginalFilename(), e);
} catch (Exception e) {
log.error("Error parsing the XML to an OrderXmlVO object", e);
}
return null;
}
}
@@ -0,0 +1,44 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml;
import java.io.Reader;
import java.io.StringReader;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Unmarshaller;
/**
* @projectName: cf_imes_server
* @author: 晨丰科技
* @date: 2024/8/21 17:58
*/
public class XmlBuilder {
/**
* 将XML转为指定的POJO
* @param clazz
* @param xmlStr
* @return
* @throws Exception
*/
public static Object xmlStrToOject(Class<?> clazz, String xmlStr) throws Exception {
Object xmlObject = null;
Reader reader = null;
JAXBContext context = JAXBContext.newInstance(clazz);
// XML 转为对象的接口
Unmarshaller unmarshaller = context.createUnmarshaller();
reader = new StringReader(xmlStr);
xmlObject = unmarshaller.unmarshal(reader);
if (null != reader) {
reader.close();
}
return xmlObject;
}
}
@@ -0,0 +1,747 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator;
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
import com.cf.imes.module.executor.dal.dataobject.goods.GoodsDO;
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
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.dataobject.rawgoods.RawGoodsDO;
import com.cf.imes.module.executor.util.deviseData.dataTwo.*;
import com.cf.imes.module.executor.util.fileConversion.admin.SnowflakeIdWorker3rd;
import com.cf.imes.module.executor.util.fileConversion.admin.ToolUtil;
import com.cf.imes.module.executor.util.fileConversion.admin.files.xml.VO.*;
import com.cf.imes.module.system.api.dict.DictDataApi;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.cf.imes.module.system.enums.DictTypeConstants.*;
/**
* 实现数据格式转换
* 使用自带id
*/
@Slf4j
@Component
public class XmlTypeRealize {
@Resource
private SnowFlakeGenerator snowFlakeGenerator;
@Resource
SnowflakeIdWorker3rd idWorker;
@Resource
private DictDataApi dictDataApi;
final String NOT_ASSIGNED = "未命名";
final String NOT_ROOM = "无房间";
final String NOT_BODY = "无柜体";
@Resource
private IdentifierGenerator identifierGenerator;
// 数据转换 + 错误验证
public Map<String, List<?>> changeDate(OrderXmlVO orderXmlVO, Long orderId, Long organId) {
if (orderXmlVO == null) {
return null;
}
Map<String, List<?>> map = new HashMap<>();
return null;
}
// 生产单转换
public Map<String, Object> changeOrder(OrderXmlVO orderXmlVO, Long orderId, Long organId) {
Map<String, Object> map = new HashMap<>();
String error = "";
if (orderXmlVO.getCustomOrderNo() == null) {
error += "客户不能为空;";
}
if (orderXmlVO.getDealer() == null) {
error += "经销商不能为空;";
}
if (orderXmlVO.getCustomerAddress() == null) {
error += "客户地址不能为空;";
}
if (orderXmlVO.getCustomerPhone() == null) {
error += "客户电话不能为空;";
} else {
if (!ToolUtil.validatePhoneNumber(orderXmlVO.getCustomerPhone())) {
error += orderXmlVO.getCustomerPhone() + "-客户电话格式错误;";
}
}
if (orderXmlVO.getDealerPhone() != null) {
if (!ToolUtil.validatePhoneNumber(orderXmlVO.getDealerPhone())) {
error += orderXmlVO.getDealerPhone() + "-经销商电话格式错误;";
}
}
OrderDO orderDO = OrderDO.builder()
.id(orderId)
.organId(organId)
.dataType(0)
.customer(orderXmlVO.getCustomer()) //
.customOrderNo(orderXmlVO.getCustomOrderNo())
.dealer(orderXmlVO.getDealer()) //
.dealerPhoneNumber(orderXmlVO.getDealerPhone())
.address(orderXmlVO.getCustomerAddress()) //
.phoneNumber(orderXmlVO.getCustomerPhone()) //
.salesman(orderXmlVO.getSeller())
.splitter(orderXmlVO.getAnalyst())
.remark(orderXmlVO.getMemo())
.build();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
Map<String, Object> mapDate = ToolUtil.changeDate(orderXmlVO.getOrderDate(), formatter);
if (orderXmlVO.getOrderDate() == null) {
error += "-订单日期不可为空;";
} else {
if (mapDate.get("error") instanceof Integer && (Integer) mapDate.get("error") == -1) {
error += orderXmlVO.getOrderDate() + "-订单日期格式错误;";
} else {
orderDO.setOrderDate(((LocalDate) mapDate.get("date")).atStartOfDay());
}
}
mapDate = ToolUtil.changeDate(orderXmlVO.getDeliveryDate(), formatter);
if (orderXmlVO.getDeliveryDate() == null) {
error += "-出货日期不可为空;";
} else {
if (mapDate.get("error") instanceof Integer && (Integer) mapDate.get("error") == -1) {
error += orderXmlVO.getDeliveryDate() + "-出货日期格式错误;";
} else {
orderDO.setDeliveryDate(((LocalDate) mapDate.get("date")).atStartOfDay());
}
}
map.put("order", orderDO);
map.put("error", error);
return map;
}
// 房间柜体信息转换
public Map<String, Map<String, OrderBodyDO>> bodyInfoChange(RoomXmlVOS roomXmlVOS, Long orderId, Long organId) {
Map<String, Map<String, OrderBodyDO>> roomInfos = new HashMap<>();
if (roomXmlVOS != null && roomXmlVOS.getRoomXmlVOList() != null && roomXmlVOS.getRoomXmlVOList().size() > 0) {
Map<String, OrderBodyDO> bodyInfos = new HashMap<>();
for (RoomXmlVO roomXmlVO : roomXmlVOS.getRoomXmlVOList()) {
Long roomId = Long.valueOf(roomXmlVO.getId());
for (BoxXmlVO boxXmlVO : roomXmlVO.getBoxXmlVOList()) {
bodyInfos.put(boxXmlVO.getId(), OrderBodyDO.builder()
.id((Long) identifierGenerator.nextId(null))
.organId(organId)
.orderId(orderId)
.roomId(roomId)
.roomName(roomXmlVO.getName())
.name(boxXmlVO.getName())
.width(Double.parseDouble(boxXmlVO.getWidth()))
.height(Double.parseDouble(boxXmlVO.getHeight()))
.depth(Double.parseDouble(boxXmlVO.getLength()))
.build());
}
roomInfos.put(roomXmlVO.getId(), bodyInfos);
}
}
return roomInfos;
}
// 加工组信息转换
public Map<String, OrderGroupDO> groupInfoChange(GroupXmlVOS groupXmlVOS, Long orderId, Long organId) {
Map<String, OrderGroupDO> groupInfos = new HashMap<>();
if (groupXmlVOS != null && groupXmlVOS.getGroupXmlVOList() != null && groupXmlVOS.getGroupXmlVOList().size() > 0) {
for (GroupXmlVO groupXmlVO : groupXmlVOS.getGroupXmlVOList()) {
groupInfos.put(groupXmlVO.getId(), OrderGroupDO.builder()
.id((Long) identifierGenerator.nextId(null))
.organId(organId)
.orderId(orderId)
.name(groupXmlVO.getName())
.height(Double.parseDouble(groupXmlVO.getHeight()))
.width(Double.parseDouble(groupXmlVO.getWidth()))
.depth(Double.parseDouble(groupXmlVO.getLength()))
.build());
}
}
return groupInfos;
}
// 板材信息转换
public Map<String, List<Object>> goodsInfoChange(OrderXmlVO orderXmlVO, Long orderId, Long organId) {
Map<String, List<Object>> map = new HashMap<>();
List<RawGoodsDO> rawGoodsDOs = new ArrayList<>();
List<GoodsDO> goodsDOs = new ArrayList<>();
List<OrderBodyDO> bodyBOs = new ArrayList<>();
List<OrderGroupDO> groupDOs = new ArrayList<>();
List<PlateDO> plateDOs = new ArrayList<>();
List<OrderItemDO> itemDOs = new ArrayList<>();
List<OrderPartsDO> partsDOs = new ArrayList<>();
Map<String, OrderGroupDO> groupInfos = groupInfoChange(orderXmlVO.getGroupXmlVOS(), orderId, organId); // 加工组
Map<String, Object> itemInfos = new HashMap<>();
Map<String, Object> partsInfos = new HashMap<>();
// 房间柜体
Map<String, Map<String, OrderBodyDO>> roomInfos = bodyInfoChange(orderXmlVO.getRoomXmlVOS(), orderId, organId);
if (orderXmlVO.getMaterialXmlVO() != null ){
MaterialXmlVO materialXmlVO = orderXmlVO.getMaterialXmlVO();
if (materialXmlVO.getAccessoryXmlVO() != null && materialXmlVO.getAssemblieXmlVOS() != null && materialXmlVO.getPlateXmlVOS() != null) {
PlateXmlVOS plateXmlVOS = materialXmlVO.getPlateXmlVOS();
AssemblieXmlVOS assemblieXmlVOS = materialXmlVO.getAssemblieXmlVOS();
AccessoryXmlVO accessoryXmlVO = materialXmlVO.getAccessoryXmlVO();
// 配件
Map<String, Map<String, Object>> partAllInfo = goodsInfoChange(accessoryXmlVO, assemblieXmlVOS, orderId, organId, roomInfos, groupInfos);
itemInfos.putAll(partAllInfo.get("orderItemMap"));
partsInfos.putAll(partAllInfo.get("orderPartsMap"));
// 板材 小板
if (plateXmlVOS.getPlateXmlVOList() != null && plateXmlVOS.getPlateXmlVOList().size() > 0) {
for (PlateXmlVO plateXmlVO : plateXmlVOS.getPlateXmlVOList()) {
Long rawGoodsId = (Long) identifierGenerator.nextId(null);
Long goodsId = (Long) identifierGenerator.nextId(null);
rawGoodsDOs.add(RawGoodsDO.builder()
.id(rawGoodsId)
.organId(organId)
.orderId(orderId)
.rawGoodsId(plateXmlVO.getItemNo())
.goodsName(plateXmlVO.getName())
.material(plateXmlVO.getMaterial())
.color(plateXmlVO.getCoatingObverse())
.colorBlack(plateXmlVO.getCoatingReverse())
.texture(ToolUtil.convertToType(plateXmlVO.getGrained(), Boolean.class) ? Boolean.valueOf(plateXmlVO.getGrained()) : false)
.thickness(Double.parseDouble(plateXmlVO.getThickness()))
.brand(plateXmlVO.getBrand())
.spec(plateXmlVO.getSpecs())
.build());
GoodsDO goodsDO = GoodsDO.builder()
.id(goodsId)
.organId(organId)
.orderId(orderId)
.rawGoodsId(String.valueOf(rawGoodsId))
.goodsId(plateXmlVO.getItemNo())
.goodsName(plateXmlVO.getName())
.material(plateXmlVO.getMaterial())
.color(plateXmlVO.getCoatingObverse())
.colorBlack(plateXmlVO.getCoatingReverse())
.texture(ToolUtil.convertToType(plateXmlVO.getGrained(), Boolean.class) ? Boolean.valueOf(plateXmlVO.getGrained()) : false)
.width(BigDecimal.valueOf(Double.parseDouble(plateXmlVO.getWidth())))
.height(BigDecimal.valueOf(Double.parseDouble(plateXmlVO.getLength())))
.thickness(BigDecimal.valueOf(Double.parseDouble(plateXmlVO.getThickness())))
.brand(plateXmlVO.getBrand())
.spec(plateXmlVO.getSpecs())
.remark(plateXmlVO.getMemo())
.build();
goodsDOs.add(goodsDO);
// 小板信息
plateInfoChange(plateXmlVO.getBlockXmlVOS(), orderId, goodsDO.getId(), organId, roomInfos, groupInfos, partsInfos, itemInfos, plateDOs);
}
}
}
}
return map;
}
// id得到
private Map<String,Long> getId(String roomNo, String BoxNo, Map<String, Map<String, OrderBodyDO>> roomInfos,
String groupNo, Map<String, OrderGroupDO> groupInfos,
Long orderId, Long organId) {
Map<String,Long> map = new HashMap<>();
Map<String, OrderBodyDO> bodyMap = roomInfos.get(roomNo);
OrderBodyDO bodyDO;
if (bodyMap.containsKey(BoxNo)) {
bodyDO = (OrderBodyDO) bodyMap.get(BoxNo);
} else {
Long roomId = (Long) identifierGenerator.nextId(null);
bodyDO = OrderBodyDO.builder()
.id((Long) identifierGenerator.nextId(null))
.organId(organId)
.orderId(orderId)
.roomId(roomId)
.roomName(NOT_ASSIGNED)
.name(NOT_ASSIGNED)
.width(0.0)
.height(0.0)
.depth(0.0)
.build();
bodyMap.put(NOT_ASSIGNED, bodyDO);
roomInfos.put(NOT_ASSIGNED, bodyMap);
}
Long roomId = bodyDO.getRoomId();
Long bodyId = bodyDO.getId();
// 加工组
OrderGroupDO orderGroupDO = groupInfos.get(groupNo);
Long groupId = 0L;
if (orderGroupDO != null) {
groupId = orderGroupDO.getId();
}
map.put("roomId", roomId);
map.put("bodyId", bodyId);
map.put("groupId", groupId);
return map;
}
// 配件信息转换
public Map<String, Map<String, Object>> goodsInfoChange(AccessoryXmlVO accessoryXmlVO, AssemblieXmlVOS assemblieXmlVOS, Long orderId, Long organId,
Map<String, Map<String, OrderBodyDO>> roomInfos, Map<String, OrderGroupDO> groupInfos) {
Map<String, Map<String, Object>> map = new HashMap<>();
Map<String, Object> orderPartsMap = new HashMap<>();
Map<String, Object> orderItemMap = new HashMap<>();
if (accessoryXmlVO != null) {
if (accessoryXmlVO.getEdgingXmlVOS() != null && accessoryXmlVO.getEdgingXmlVOS().getEdgingXmlVOList() != null && accessoryXmlVO.getEdgingXmlVOS().getEdgingXmlVOList().size() > 0) {
EdgingXmlVOS edgingXmlVOS = accessoryXmlVO.getEdgingXmlVOS();
for (EdgingXmlVO edgingXmlVO : edgingXmlVOS.getEdgingXmlVOList()) {
Map<String,Long> idMap = getId(edgingXmlVO.getRoomId(), edgingXmlVO.getBoxId(), roomInfos, edgingXmlVO.getGroupId(), groupInfos, orderId, organId);
Long partsId = (Long) identifierGenerator.nextId(null);
orderPartsMap.put(edgingXmlVO.getId(), OrderPartsAddVO.builder()
.id(partsId)
.organId(organId)
.orderId(orderId)
.goodsId(edgingXmlVO.getItemNo())
.factory(edgingXmlVO.getManufacturer())
.brand(edgingXmlVO.getBrand())
.name(edgingXmlVO.getName())
.material(edgingXmlVO.getMaterial())
.spec(edgingXmlVO.getSpecs())
.unit(edgingXmlVO.getUnit())
.width(BigDecimal.valueOf(Double.parseDouble(edgingXmlVO.getWidth())))
.length(BigDecimal.valueOf(Double.parseDouble(edgingXmlVO.getLength())))
.thickness(BigDecimal.valueOf(Double.parseDouble(edgingXmlVO.getThickness())))
.warehouse(edgingXmlVO.getWarehouse())
.shelf(edgingXmlVO.getShelf())
.color(edgingXmlVO.getColor())
.isComposite(false)
.num(Double.valueOf(edgingXmlVO.getCount()))
.build());
orderItemMap.put(edgingXmlVO.getId(), OrderItemDO.builder()
.id((Long) identifierGenerator.nextId(null))
.organId(organId)
.orderId(orderId)
.type(2)
.partsId(partsId)
.groupId(idMap.get("groupId"))
.roomId(idMap.get("roomId"))
.bodyId(idMap.get("bodyId"))
.num(Double.valueOf(edgingXmlVO.getCount()))
.build());
}
}
if (accessoryXmlVO.getHardwareXmlVOS() != null && accessoryXmlVO.getHardwareXmlVOS().getHardwareXmlVOList() != null && accessoryXmlVO.getHardwareXmlVOS().getHardwareXmlVOList().size() > 0) {
HardwareXmlVOS hardwareXmlVOS = accessoryXmlVO.getHardwareXmlVOS();
for (HardwareXmlVO hardwareXmlVO : hardwareXmlVOS.getHardwareXmlVOList()) {
Map<String,Long> idMap = getId(hardwareXmlVO.getRoomId(), hardwareXmlVO.getBoxId(), roomInfos, hardwareXmlVO.getGroupId(), groupInfos, orderId, organId);
Long partsId = (Long) identifierGenerator.nextId(null);
orderPartsMap.put(hardwareXmlVO.getId(), OrderPartsAddVO.builder()
.id(partsId)
.organId(organId)
.type(hardwareXmlVO.getType())
.orderId(orderId)
.goodsId(hardwareXmlVO.getItemNo())
.factory(hardwareXmlVO.getManufacturer())
.brand(hardwareXmlVO.getBrand())
.name(hardwareXmlVO.getName())
.material(hardwareXmlVO.getMaterial())
.spec(hardwareXmlVO.getSpecs())
.unit(hardwareXmlVO.getUnit())
.width(BigDecimal.valueOf(Double.parseDouble(hardwareXmlVO.getWidth())))
.length(BigDecimal.valueOf(Double.parseDouble(hardwareXmlVO.getLength())))
.thickness(BigDecimal.valueOf(Double.parseDouble(hardwareXmlVO.getThickness())))
.warehouse(hardwareXmlVO.getWarehouse())
.shelf(hardwareXmlVO.getShelf())
.color(hardwareXmlVO.getColor())
.num(Double.valueOf(hardwareXmlVO.getCount()))
.roomId(hardwareXmlVO.getRoomId())
.bodyId(hardwareXmlVO.getBoxId())
.isComposite(false)
.build());
orderItemMap.put(hardwareXmlVO.getId(), OrderItemDO.builder()
.id((Long) identifierGenerator.nextId(null))
.organId(organId)
.orderId(orderId)
.type(2)
.partsId(partsId)
.groupId(idMap.get("groupId"))
.roomId(idMap.get("roomId"))
.bodyId(idMap.get("bodyId"))
.num(Double.valueOf(hardwareXmlVO.getCount()))
.build());
}
}
}
if (assemblieXmlVOS != null && assemblieXmlVOS.getAssemblyXmlVOList() != null && assemblieXmlVOS.getAssemblyXmlVOList().size() > 0) {
for (AssemblyXmlVO assemblyXmlVO : assemblieXmlVOS.getAssemblyXmlVOList()) {
Map<String,Long> idMap = getId(assemblyXmlVO.getRoomId(), assemblyXmlVO.getBoxId(), roomInfos, assemblyXmlVO.getGroupId(), groupInfos, orderId, organId);
Long partsId = (Long) identifierGenerator.nextId(null);
orderPartsMap.put(assemblyXmlVO.getId(), OrderPartsAddVO.builder()
.id(partsId)
.organId(organId)
.orderId(orderId)
.type(assemblyXmlVO.getType())
.goodsId(assemblyXmlVO.getItemNo())
.factory(assemblyXmlVO.getManufacturer())
.brand(assemblyXmlVO.getBrand())
.name(assemblyXmlVO.getName())
.material(assemblyXmlVO.getMaterial())
.spec(assemblyXmlVO.getSpecs())
.color(assemblyXmlVO.getColor())
.length(BigDecimal.valueOf(Double.parseDouble(assemblyXmlVO.getLength())))
.width(BigDecimal.valueOf(Double.parseDouble(assemblyXmlVO.getWidth())))
.thickness(BigDecimal.valueOf(Double.parseDouble(assemblyXmlVO.getHeight())))
.num(Double.valueOf(assemblyXmlVO.getCount()))
.unit((assemblyXmlVO.getUnit()))
.warehouse(assemblyXmlVO.getWarehouse())
.shelf(assemblyXmlVO.getShelf())
.roomId(assemblyXmlVO.getRoomId())
.bodyId(assemblyXmlVO.getBoxId())
.isComposite(true)
.build());
orderItemMap.put(assemblyXmlVO.getId(), OrderItemDO.builder()
.id((Long) identifierGenerator.nextId(null))
.organId(organId)
.orderId(orderId)
.type(2)
.partsId(partsId)
.groupId(idMap.get("groupId"))
.roomId(idMap.get("roomId"))
.bodyId(idMap.get("bodyId"))
.num(Double.valueOf(assemblyXmlVO.getCount()))
.build());
}
}
map.put("orderItemMap", orderItemMap);
map.put("orderPartsMap", orderPartsMap);
return map;
}
public List<PlateDetail> plateInfoChange(BlockXmlVOS blockXmlVOS, Long orderId, Long goodsId, Long organId,
Map<String, Map<String, OrderBodyDO>> roomInfos, Map<String, OrderGroupDO> groupInfos,
Map<String, Object> partsMap, Map<String, Object> orderItemMap, List<PlateDO> plateDOs) {
List<PlateDetail> plateDetails = new ArrayList<>();
if (blockXmlVOS != null && blockXmlVOS.getBlockXmlVOList() != null && blockXmlVOS.getBlockXmlVOList().size() > 0) {
for (BlockXmlVO blockXmlVO : blockXmlVOS.getBlockXmlVOList()) {
String roomId = blockXmlVO.getRoomId();
String bodyId = blockXmlVO.getBoxId();
String groupId = blockXmlVO.getGroupId();
long plateNo = idWorker.nextId();
long obtainingTime = idWorker.obtainingTime();
Long plateId = (Long) identifierGenerator.nextId(null);
BigDecimal area = BigDecimal.valueOf(Double.parseDouble(blockXmlVO.getWidth()) * Double.parseDouble(blockXmlVO.getLength()));
// 开料面积
BigDecimal sealAcreage = BigDecimal.valueOf(Double.parseDouble(blockXmlVO.getCuttingWidth()) * Double.parseDouble(blockXmlVO.getCuttingLength()));
// 开门类型获取
Integer doorType = Integer.valueOf(dictDataApi.parseDictData(DOOR_OPEN_DIR, blockXmlVO.getOpenDirection()).getData().getValue());
// 板材获取
Map<String,Long> idMap = getId(blockXmlVO.getRoomId(), blockXmlVO.getBoxId(), roomInfos, blockXmlVO.getGroupId(), groupInfos, orderId, organId);
PlateDO plateDO = PlateDO.builder()
.id(plateId)
.organId(organId)
.orderId(orderId)
.name(blockXmlVO.getName())
.plateNo((obtainingTime) + Long.toString(plateNo).substring(2))
.type(Integer.valueOf(blockXmlVO.getType()))
.goodsId(goodsId)
.width(BigDecimal.valueOf(Double.parseDouble(blockXmlVO.getWidth())))
.height(BigDecimal.valueOf(Double.parseDouble(blockXmlVO.getLength())))
.thickness(BigDecimal.valueOf(Double.parseDouble(blockXmlVO.getThickness())))
.splitHeight(BigDecimal.valueOf(Double.parseDouble(blockXmlVO.getLength())))
.splitThickness(BigDecimal.valueOf(Double.parseDouble(blockXmlVO.getThickness())))
.splitWidth(BigDecimal.valueOf(Double.parseDouble(blockXmlVO.getWidth())))
.area(area)
.texture(Integer.valueOf(blockXmlVO.getTexture()))
.holeFace(Integer.valueOf(blockXmlVO.getLayoutFace()))
.isDoor(doorType == 0)
.openDoorType(doorType)
.isSpecialShaped(convertToBoolean(blockXmlVO.getUnregular()))
.build();
orderItemMap.put(blockXmlVO.getId(), OrderItemDO.builder()
.id((Long) identifierGenerator.nextId(null))
.organId(organId)
.orderId(orderId)
.type(2)
.plateId(plateId)
.groupId(idMap.get("groupId"))
.roomId(idMap.get("roomId"))
.bodyId(idMap.get("bodyId"))
.num(1.0)
.build());
PlateDetail plateDetail = PlateDetail.builder()
.plateId(plateId)
.plateNo(plateDO.getPlateNo())
.name(plateDO.getName())
.customPlateNo(blockXmlVO.getDesignNo())
.texture(plateDO.getTexture())
.typographicFace(plateDO.getHoleFace())
.openDoorType(plateDO.getOpenDoorType())
.boardType(blockXmlVO.getType())
.multiNum(Integer.valueOf(blockXmlVO.getMultipleNumber()))
.plateWidth(plateDO.getWidth())
.plateLength(plateDO.getHeight())
.acreage(plateDO.getArea())
.splitLength(BigDecimal.valueOf(Long.parseLong(blockXmlVO.getCuttingLength())))
.splitWidth(BigDecimal.valueOf(Long.parseLong(blockXmlVO.getCuttingWidth())))
.sealAcreage(sealAcreage)
.isUnRegular(plateDO.getIsSpecialShaped())
.build();
// 小板、es 封边值
addSealEdge(plateDO, plateDetail, blockXmlVO.getOutlineXmlVO(), partsMap);
// 偏移量 不含封边
addPointDetail(plateDO, plateDetail, blockXmlVO.getCuttingOutlineXmlVO());
// 孔数据
addHole(plateDO, plateDetail, blockXmlVO.getHoleXmlVOS());
// 造型数据
addContourDetail(plateDO, plateDetail, blockXmlVO.getGrooveXmlVOS());
// 小板备注信息
addRemark(plateDO, plateDetail, blockXmlVO);
//
plateDOs.add(plateDO);
plateDetails.add(plateDetail);
}
}
return plateDetails;
}
// 是否转换布尔值
public Boolean convertToBoolean(String str) {
Boolean isTrue = false;
switch (str) {
case "":
isTrue = true;
break;
default:
isTrue = false;
break;
}
return isTrue;
}
// 封边值相关信息添加 (原始点明细)
private void addSealEdge(PlateDO plateDO, PlateDetail plateDetail, OutlineXmlVO outlineXmlVO, Map<String, Object> edgIng) {
BigDecimal sealLeft = BigDecimal.valueOf(0);
BigDecimal sealRight = BigDecimal.valueOf(0);
BigDecimal sealUp = BigDecimal.valueOf(0);
BigDecimal sealDown = BigDecimal.valueOf(0);
if (outlineXmlVO != null && outlineXmlVO.getPointXmlVOList() != null && outlineXmlVO.getPointXmlVOList().size() > 0) {
for (PointXmlVO pointXmlVO : outlineXmlVO.getPointXmlVOList()) {
Double x = Double.parseDouble(pointXmlVO.getPointX());
Double y = Double.parseDouble(pointXmlVO.getPointY());
OrderPartsAddVO edging = (OrderPartsAddVO) edgIng.get(pointXmlVO.getEdgingId());
if (!plateDO.getIsSpecialShaped()) {
if (x == 0 && y == 0) {
sealDown = edging.getThickness();
}
if (x != 0 && y == 0) {
sealRight = edging.getThickness();
}
if (x != 0 && y != 0) {
sealUp = edging.getThickness();
}
if (x == 0 && y != 0) {
sealLeft = edging.getThickness();
}
}
plateDetail.getRawPointDetail().add(PointDetail.builder()
.id(pointXmlVO.getId())
.pointX(x)
.pointY(y)
.curve(Double.parseDouble(pointXmlVO.getCurvature()))
.radius(Double.parseDouble(pointXmlVO.getRadius()))
.sealSize(edging.getThickness())
.build());
plateDetail.getSideRemark().put(pointXmlVO.getId(), pointXmlVO.getRemark());
}
}
plateDetail.setSealUp(sealUp).setSealDown(sealDown).setSealLeft(sealLeft).setSealRight(sealRight);
plateDO.setSealUp(sealUp).setSealDown(sealDown).setSealLeft(sealLeft).setSealRight(sealRight);
}
// 点明细(不含封边)
private void addPointDetail(PlateDO plateDO, PlateDetail plateDetail, CuttingOutlineXmlVO cuttingOutlineXmlVO) {
if (cuttingOutlineXmlVO != null) {
plateDO.setOffsetX(BigDecimal.valueOf(Long.parseLong(cuttingOutlineXmlVO.getReferenceOffsetX()))).
setOffsetY(BigDecimal.valueOf(Long.parseLong(cuttingOutlineXmlVO.getReferenceOffsetY())));
plateDetail.setOffsetX(plateDO.getOffsetX()).setOffsetY(plateDO.getOffsetY());
if (cuttingOutlineXmlVO.getPointXmlVOList() != null && cuttingOutlineXmlVO.getPointXmlVOList().size() > 0) {
for (PointXmlVO pointXmlVO : cuttingOutlineXmlVO.getPointXmlVOList()) {
plateDetail.getPointDetail().add(PointDetail.builder()
.id(pointXmlVO.getId())
.pointX(Double.parseDouble(pointXmlVO.getPointX()))
.pointY(Double.parseDouble(pointXmlVO.getPointY()))
.curve(Double.parseDouble(pointXmlVO.getCurvature()))
.radius(Double.parseDouble(pointXmlVO.getRadius()))
.build());
}
}
}
}
// 孔
private void addHole(PlateDO plateDO, PlateDetail plateDetail, HoleXmlVOS holeXmlVOS) {
if (holeXmlVOS != null) {
plateDO.setFrontHoleCount(Integer.valueOf(holeXmlVOS.getCountFaceA())).
setBackHoleCount(Integer.valueOf(holeXmlVOS.getCountFaceB())).
setSideHoleCount(Integer.valueOf(holeXmlVOS.getCountSide()));
if (holeXmlVOS.getCountThrough() != null && Integer.parseInt(holeXmlVOS.getCountThrough()) > 0) {
plateDO.setFilterType(plateDO.getFilterType() + ",2");
}
if (holeXmlVOS.getHoleXmlVOList() != null && holeXmlVOS.getHoleXmlVOList().size() > 0) {
for (HoleXmlVO holeXmlVO : holeXmlVOS.getHoleXmlVOList()) {
Integer faceType = Integer.valueOf(dictDataApi.parseDictData(HOLE_FACE, holeXmlVO.getFace()).getData().getValue());
faceType = faceType == 0 || faceType == 1 ? faceType : 2;
Integer direction = Integer.valueOf(dictDataApi.parseDictData(HOLE_DIR, holeXmlVO.getDirection()).getData().getValue());
Integer holeType = Integer.valueOf(dictDataApi.parseDictData(HOLE_TYPE, holeXmlVO.getType()).getData().getValue());
Double radius = holeXmlVO.getDiameter() != null ? Double.parseDouble(holeXmlVO.getDiameter()) / 2 : 0;
Double depth = holeXmlVO.getDepth() != null ? Double.parseDouble(holeXmlVO.getDepth()) : 0;
HoleDetail holeDetail = HoleDetail.builder()
.holeName(holeXmlVO.getName())
.faceType(faceType)
.holeType(Integer.valueOf(holeXmlVO.getType()))
.direction(direction)
.holeType(holeType)
.radius(radius)
.depth(depth)
.build();
if (holeXmlVO.getPointBeginXmlVO() != null) {
holeDetail.setStartX(Double.parseDouble(holeXmlVO.getPointBeginXmlVO().getX())).
setStartY(Double.parseDouble(holeXmlVO.getPointBeginXmlVO().getY())).
setStartZ(Double.parseDouble(holeXmlVO.getPointBeginXmlVO().getZ()));
}
if (holeXmlVO.getPointEndXmlVO() != null) {
holeDetail.setEndX(Double.parseDouble(holeXmlVO.getPointEndXmlVO().getX())).
setEndY(Double.parseDouble(holeXmlVO.getPointEndXmlVO().getY())).
setEndZ(Double.parseDouble(holeXmlVO.getPointEndXmlVO().getZ()));
}
plateDetail.getHoleDetail().add(holeDetail);
}
}
}
}
// 造型
private void addContourDetail(PlateDO plateDO, PlateDetail plateDetail, GrooveXmlVOS grooveXmlVOS) {
if (grooveXmlVOS != null) {
plateDO.setFrontModelCount(Integer.valueOf(grooveXmlVOS.getCountFaceA())).
setBackModelCount(Integer.valueOf(grooveXmlVOS.getCountFaceB()));
if (grooveXmlVOS.getCountThrough() != null && Integer.parseInt(grooveXmlVOS.getCountThrough()) > 0) {
plateDO.setFilterType(plateDO.getFilterType() + ",1");
}
if (grooveXmlVOS.getGrooveXmlVOList() != null && grooveXmlVOS.getGrooveXmlVOList().size() > 0) {
for (GrooveXmlVO grooveXmlVO : grooveXmlVOS.getGrooveXmlVOList()) {
Integer faceType = Integer.valueOf(dictDataApi.parseDictData(HOLE_FACE, grooveXmlVO.getFace()).getData().getValue());
faceType = faceType == 0 || faceType == 1 ? faceType : 2;
ModelDetail modelDetail = ModelDetail.builder()
.type(grooveXmlVO.getType())
.faceType(faceType)
.depth(Double.parseDouble(grooveXmlVO.getDepth()))
.knifeName(grooveXmlVO.getToolName())
.knifeRadius(Double.parseDouble(grooveXmlVO.getToolDiameter()) / 2)
.originModeling(getOriginModelingData(grooveXmlVO))
.pointList(addPointDetail(grooveXmlVO.getPointXmlVOS()))
.offSetList(addOffSetDetail(grooveXmlVO.getOffsetLineXmlVOS())).build();
plateDetail.getContourDetail().add(modelDetail);
}
}
}
}
// 造像轮廓数据
private IOriginModelingData getOriginModelingData(GrooveXmlVO grooveXmlVO) {
return IOriginModelingData.builder()
.knifeRadius(Double.parseDouble(grooveXmlVO.getToolDiameter()) / 2)
.thickness(Double.valueOf(grooveXmlVO.getDepth()))
.addLen(Double.valueOf(grooveXmlVO.getLengthExtend()))
.addDepth(Double.valueOf(grooveXmlVO.getDepthExtend()))
.addWidth(Double.valueOf(grooveXmlVO.getWidthExtend()))
.build();
}
// 点列表的赋值
private List<PointList> addPointDetail(PointXmlVOS pointXmlVOS) {
List<PointList> pointLists = new ArrayList<>();
if (pointXmlVOS != null && pointXmlVOS.getPointXmlVOList() != null && pointXmlVOS.getPointXmlVOList().size() > 0) {
for (PointXmlVO pointXmlVO : pointXmlVOS.getPointXmlVOList()) {
pointLists.add(PointList.builder()
.pointId(Integer.valueOf(pointXmlVO.getId()))
.pointX(Double.parseDouble(pointXmlVO.getPointX())).
pointY(Double.parseDouble(pointXmlVO.getPointY()))
.pointZ(Double.parseDouble(pointXmlVO.getPointZ()))
.radius(Double.parseDouble(pointXmlVO.getRadius()))
.curve(Double.parseDouble(pointXmlVO.getCurvature()))
.holeRadius(Double.parseDouble(pointXmlVO.getRadius()))
.build());
}
}
return pointLists;
}
// 偏移量列表
private List<OffSetList> addOffSetDetail(OffsetLineXmlVOS offsetLineXmlVOS) {
List<OffSetList> offSetList = new ArrayList<>();
if (offsetLineXmlVOS != null && offsetLineXmlVOS.getOffsetLineXmlVOList() != null && offsetLineXmlVOS.getOffsetLineXmlVOList().size() > 0) {
for (OffsetLineXmlVO offsetLineXmlVO : offsetLineXmlVOS.getOffsetLineXmlVOList()) {
offSetList.add(OffSetList.builder()
.id(offsetLineXmlVO.getId())
.value(Double.parseDouble(offsetLineXmlVO.getOffset()))
.depth(Double.parseDouble(offsetLineXmlVO.getDepth()))
.angle(Double.parseDouble(offsetLineXmlVO.getTangentAngle()))
.name(offsetLineXmlVO.getToolName())
.radius(Double.parseDouble(offsetLineXmlVO.getToolDiameter()) / 2)
.build());
}
}
return offSetList;
}
// 小板备注
private void addRemark(PlateDO plateDO, PlateDetail plateDetail, BlockXmlVO blockXmlVO) {
if (blockXmlVO.getRemarkXmlVOS() != null && blockXmlVO.getRemarkXmlVOS().getRemarkXmlVOList() != null && blockXmlVO.getRemarkXmlVOS().getRemarkXmlVOList().size() > 0) {
for (RemarkXmlVO remarkXmlVO : blockXmlVO.getRemarkXmlVOS().getRemarkXmlVOList()) {
plateDetail.getRemark().put(remarkXmlVO.getName(), remarkXmlVO.getInfo());
}
plateDO.setRemark(JSONObject.toJSONString(plateDetail.getRemark()));
}
}
}
@@ -0,0 +1,24 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml;
import com.cf.imes.module.executor.dal.dataobject.orderBody.OrderBodyDO;
import java.lang.reflect.Method;
/**
* @projectName: cf_imes_server
* @author: 晨丰科技
* @date: 2024/8/23 16:59
*/
public class test {
public static void main(String[] args) {
// 给定的圆的直径
double diameter = 5;
// 计算半径
double radius = diameter / 3;
// 输出结果
System.out.println("圆的半径是: " + radius);
}
}