api新增outline

This commit is contained in:
lym
2024-10-28 11:03:26 +08:00
parent 603bd88469
commit 17884649ba
13 changed files with 926 additions and 1879 deletions
@@ -7,13 +7,16 @@ public class DictTypeConstants {
public static final String HOLE_FACE = "hole_face";//加工面
public static final String HOLE_DIRECTION = "hole_direction";// 方向
public static final String IS_NOT_MARK = "is_not_mark";// 是否标识
// ========== PLATE 模块 ==========
public static final String TYPOGRAPHY_TYPE = "typographyType"; // 排版面
public static final String GRAIN_TYPE = "grainType";// 小板纹路类型
public static final String DOOR_OPENING_DIRECTIONS = "doorOpeningDirections";//开门方向
public static final String PLATE_TYPE = "order_plate_type"; // 板类型
public static final String PLATE_TEXTURE_TYPE = "plate_texture_type";// 板材纹路:0有 1无
public static final String COATING_TYPE = "coatingType";// xml 设计饰面
public static final String ODDMENT_MARK = "oddment_mark";// xml 设计饰面
// ========== HOLE 模块 ==========
public static final String HOLE_TYPE = "hole_type";//孔类型
@@ -398,7 +398,7 @@ public class OrderController {
@Parameter(name = "deleted", description = "是否删除", example = "false")
})
@PreAuthorize("@ss.hasPermission('production:manager-list:detail')")
public CommonResult<Map<String, List>> getModule(@RequestParam("orderId") Long orderId,
public CommonResult<Map<String, List<?>>> getModule(@RequestParam("orderId") Long orderId,
@RequestParam(value = "deleted", required = false, defaultValue = "false") Boolean deleted) {
if (deleted == null) {
deleted = false;
@@ -1,12 +1,15 @@
package com.cf.imes.module.executor.controller.admin.plan.dto;
import lombok.Builder;
import lombok.Data;
/**
* @author Beal
*/
@Data
@Builder
public class Point {
private Double x;
private Double y;
private Double z;
}
@@ -62,7 +62,7 @@ public interface OrderService {
* @param orderId: 生产单Id
* @return Map<String, List<?>>
*/
Map<String,List> getModule(Long orderId, Integer deleted);
Map<String,List<?>> getModule(Long orderId, Integer deleted);
/**
* @param orderId: 生产单id
@@ -2,6 +2,7 @@ package com.cf.imes.module.executor.service.process;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
import com.cf.imes.module.executor.dal.dataobject.goods.GoodsDO;
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
@@ -83,10 +84,9 @@ public class OrderProcessServiceImpl implements OrderProcessService {
private GoodsMapper goodsMapper;
@Override
@Transactional(rollbackFor = Exception.class)
public Long createOrderProcess(OrderProcessSaveReqVO createReqVO) {
OrderDO order = orderMapper.selectOrderOne(createReqVO.getOrderId(), SecurityFrameworkUtils.getLoginUser().getOrganId(), OrderDeletedEnum.NOT_DELETED.getStatus());
// 生产单状态检测
private void checkOrderStatus(Long orderId, Long organId, Integer status) {
OrderDO order = orderMapper.selectOrderOne(orderId, organId, status);
// 当生产不为删除时,校验生产单存在
if (order == null) {
throw exception(ORDER_NOT_EXISTS);
@@ -96,14 +96,33 @@ public class OrderProcessServiceImpl implements OrderProcessService {
throw exception(ORDER_STATUS_CONFLICT);
}
}
// 校验工序组存在
if (!processGroupApi.getProcessGroup(createReqVO.getGroupId())) {
}
// 校验工序组存在
private void checkProcessGroup(Long id) {
if (!processGroupApi.getProcessGroup(id)) {
throw exception(PROCESS_GROUP_NOT_EXISTS);
}
// 校验是否已经存在该生产单对应的工序组
if (orderProcessMapper.getOrderProcess(createReqVO.getOrderId(), SecurityFrameworkUtils.getLoginUser().getOrganId())) {
}
// 校验是否已经存在该生产单对应的工序组
private void checkOrderProcessExists(Long orderId, Long organId) {
if (orderProcessMapper.getOrderProcess(orderId, organId)) {
throw exception(ORDER_PROCESS_EXISTS);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public Long createOrderProcess(OrderProcessSaveReqVO createReqVO) {
checkOrderStatus(createReqVO.getOrderId(), OrganContextHolder.getOrganId(), OrderDeletedEnum.NOT_DELETED.getStatus());
// 校验工序组存在
checkProcessGroup(createReqVO.getGroupId());
// 校验是否已经存在该生产单对应的工序组
checkOrderProcessExists(createReqVO.getOrderId(), OrganContextHolder.getOrganId());
// 插入
Long orderProcessId = (Long) identifierGenerator.nextId(null);
@@ -21,8 +21,8 @@ import java.util.List;
@Accessors(chain = false) // 设置 chain = false,避免生产单导入有问
public class IContourData {
@Schema(description = "点集(二维向量(x,y))")
private List<Point> pts; //
@Schema(description = "点集(二维向量(x,y,z))")
private Point pts; //
@Schema(description = "凸度(0直线段 >0逆时针方向 <0顺时针方向)")
private Double[] buls; //
private Double buls; //
}
@@ -28,9 +28,9 @@ public class IOriginModelingData {
private Integer dir;
@Schema(description = "轮廓,造型最外围的轮廓数据")
private IContourData outline;
@Schema(description = "轮廓")
private List<IContourData> holes;
private List<IContourData> outline;
@Schema(description = "孤岛轮廓")
private List<List<IContourData>> holes;
@Schema(description = "槽加长")
@@ -35,19 +35,20 @@ public class ToolUtil {
// 日期格式转换
public static Map<String, Object> changeDate(String date, DateTimeFormatter formatter) {
String errorKey = "error";
String dateKey = "date";
Map<String, Object> map = new HashMap<>();
LocalDate localDate;
if (date == null){
localDate = LocalDate.now();
map.put("date", localDate);
map.put(dateKey, localDate);
map.put(errorKey, 0);
}else {
try {
localDate = LocalDate.parse(date, formatter);
map.put("date", localDate);
map.put(dateKey, localDate);
map.put(errorKey, 1);
} catch (DateTimeParseException e) {
map.put("date", date);
map.put(dateKey, date);
map.put(errorKey, -1);
}
@@ -64,6 +64,7 @@ public class ApiDataAchieve {
JSONObject jsonPlatesData = new JSONObject();
jsonPlatesData.put(ORDER_NO_KEY, "N" + orderNo);//生产单号需要传入赋值
jsonPlatesData.put("format", "json");
jsonPlatesData.put("version", "3");
JSONObject dataPlates = apiDataProduction.getApiOrderMessage(token, jsonPlatesData);
return new AsyncResult<>(dataPlates);
}
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
import com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsRemark;
import com.cf.imes.module.executor.controller.admin.plan.dto.Point;
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;
@@ -743,6 +744,7 @@ public class ApiTypeRealize {
System.err.println(dataPlates);
if (ordersArray != null && !ordersArray.isEmpty()) {
for (int i = 0; i < ordersArray.size(); i++) {
System.out.println("kkk " + ordersArray.get(i));
JSONObject order = ordersArray.getJSONObject(i);
// 获取材料信息
if (order.getJSONArray("Materials") != null && !order.getJSONArray("Materials").isEmpty()) {
@@ -928,30 +930,13 @@ public class ApiTypeRealize {
offSetLists.add(OffSetList.builder()
.value(Double.valueOf(offSet.getString("Value")))
.name(offSet.getString("Name"))
.radius(Double.valueOf(offSet.getString("Diameter")) / 2)
.radius(Double.parseDouble(offSet.getString("Diameter")) / 2)
.angle(Double.valueOf(offSet.getString("Angle")))
.depth(Double.valueOf(offSet.getString("Depth")))
.build());
}
}
List<PointList> pointListInOrigin = new ArrayList<>();
if (model.getJSONArray("OriginModeling") != null && !model.getJSONArray("OriginModeling").isEmpty()) {
for (int j = 0; j < model.getJSONArray("OriginModeling").size(); j++) {
JSONObject point = model.getJSONArray("OriginModeling").getJSONObject(j);
String[] points = splitAndTrim(point.getString("Pos"));
pointListInOrigin.add(PointList.builder()
.pointX(Double.valueOf(points[X]))
.pointY(Double.valueOf(points[Y]))
.pointZ(Double.valueOf(points[Z]))
.curve(Double.valueOf(point.getString("Curve")))
.build());
}
}
IOriginModelingData originModeling = IOriginModelingData.builder()
.pointList(pointListInOrigin)
.build();
modelDetails.add(ModelDetail.builder()
.depth(Double.valueOf(model.getString("Depth")))
.faceType(Integer.valueOf(model.getString("Face")))
@@ -959,7 +944,7 @@ public class ApiTypeRealize {
.knifeRadius(Double.valueOf(model.getString("Diameter")) / 2)
.pointList(pointLists)
.offSetList(offSetLists)
.originModeling(originModeling)
.originModeling(getOriginModeling(model.getJSONObject("OriginModeling")))
.build());
}
}
@@ -967,6 +952,83 @@ public class ApiTypeRealize {
return modelDetails;
}
// 造型 --- OriginModeling
private IOriginModelingData getOriginModeling(JSONObject originModeling) {
if (originModeling == null || originModeling.isEmpty()) {
return null;
}
JSONArray outLine = originModeling.getJSONArray("Outline");
JSONArray holes = originModeling.getJSONArray("Holes");
return IOriginModelingData.builder()
.thickness(Double.valueOf(originModeling.getString("Thickness")))
.knifeRadius(Double.valueOf(originModeling.getString("KnifeRadius")))
.dir(originModeling.getInteger("Dir"))
.outline(getOutlineOrOutline(outLine))
.holes(getOutlineOrHoles(holes))
.addLen(Double.valueOf(originModeling.getString("AddLen")))
.addWidth(Double.valueOf(originModeling.getString("AddWidth")))
.addDepth(Double.valueOf(originModeling.getString("AddDepth")))
.build();
}
private List<IContourData> getOutlineOrOutline(JSONArray json) {
if (json == null || json.isEmpty()) {
return Collections.emptyList();
}
List<IContourData> contourDataList = new ArrayList<>();
for (int i = 0; i < json.size(); i++) {
JSONObject element = json.getJSONObject(i);
String[] points = splitAndTrim(element.getString("Pos"));
Point pointVO = Point.builder()
.x(Double.valueOf(points[X]))
.y(Double.valueOf(points[Y]))
.z(Double.valueOf(points[Z]))
.build();
IContourData iContourDataVO = IContourData.builder()
.pts(pointVO)
.buls(Double.valueOf(element.getString("Curve")))
.build();
contourDataList.add(iContourDataVO);
}
return contourDataList;
}
private List<List<IContourData>> getOutlineOrHoles(JSONArray json) {
List<List<IContourData>> contourDataList = new ArrayList<>();
if (json == null || json.isEmpty()) {
return contourDataList;
}
for (int i = 0; i < json.size(); i++) {
JSONArray element = json.getJSONArray(i);
if (element == null || element.isEmpty()) {
continue;
}
List<IContourData> contourData = new ArrayList<>();
for (int j = 0; j < element.size(); j++) {
JSONObject point = element.getJSONObject(i);
String[] points = splitAndTrim(point.getString("Pos"));
Point pointVO = Point.builder()
.x(Double.valueOf(points[X]))
.y(Double.valueOf(points[Y]))
.z(Double.valueOf(points[Z]))
.build();
IContourData iContourDataVO = IContourData.builder()
.pts(pointVO)
.buls(Double.valueOf(point.getString("Curve")))
.build();
contourData.add(iContourDataVO);
}
contourDataList.add(contourData);
}
return contourDataList;
}
// 排钻数据
private List<DrillsInfo> getDrillsInfo(JSONObject block) {
List<DrillsInfo> drillsInfos = new ArrayList<>();
@@ -1303,7 +1303,7 @@ public class XmlTypeRealize {
.round(Double.parseDouble(grooveXmlVO.getRound()))
.redundance(Double.parseDouble(grooveXmlVO.getRedundance()))
.tangentAngle(Double.parseDouble(grooveXmlVO.getTangentAngle()))
.originModeling(getOriginModelingData(grooveXmlVO))
// .originModeling(getOriginModelingData(grooveXmlVO))
.offSetList(addOffSetDetail(grooveXmlVO.getOffsetLineXmlVOS()))
.build();
}
@@ -1316,7 +1316,7 @@ public class XmlTypeRealize {
.addLen(Double.valueOf(grooveXmlVO.getLengthExtend()))
.addDepth(Double.valueOf(grooveXmlVO.getDepthExtend()))
.addWidth(Double.valueOf(grooveXmlVO.getWidthExtend()))
.pointList(addPointDetail(grooveXmlVO.getPointXmlVOS()))
// .pointList(addPointDetail(grooveXmlVO.getPointXmlVOS()))
.build();
}