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_FACE = "hole_face";//加工面
public static final String HOLE_DIRECTION = "hole_direction";// 方向 public static final String HOLE_DIRECTION = "hole_direction";// 方向
public static final String IS_NOT_MARK = "is_not_mark";// 是否标识
// ========== PLATE 模块 ========== // ========== PLATE 模块 ==========
public static final String TYPOGRAPHY_TYPE = "typographyType"; // 排版面 public static final String TYPOGRAPHY_TYPE = "typographyType"; // 排版面
public static final String GRAIN_TYPE = "grainType";// 小板纹路类型 public static final String GRAIN_TYPE = "grainType";// 小板纹路类型
public static final String DOOR_OPENING_DIRECTIONS = "doorOpeningDirections";//开门方向 public static final String DOOR_OPENING_DIRECTIONS = "doorOpeningDirections";//开门方向
public static final String PLATE_TYPE = "order_plate_type"; // 板类型 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 模块 ========== // ========== HOLE 模块 ==========
public static final String HOLE_TYPE = "hole_type";//孔类型 public static final String HOLE_TYPE = "hole_type";//孔类型
@@ -398,7 +398,7 @@ public class OrderController {
@Parameter(name = "deleted", description = "是否删除", example = "false") @Parameter(name = "deleted", description = "是否删除", example = "false")
}) })
@PreAuthorize("@ss.hasPermission('production:manager-list:detail')") @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) { @RequestParam(value = "deleted", required = false, defaultValue = "false") Boolean deleted) {
if (deleted == null) { if (deleted == null) {
deleted = false; deleted = false;
@@ -1,12 +1,15 @@
package com.cf.imes.module.executor.controller.admin.plan.dto; package com.cf.imes.module.executor.controller.admin.plan.dto;
import lombok.Builder;
import lombok.Data; import lombok.Data;
/** /**
* @author Beal * @author Beal
*/ */
@Data @Data
@Builder
public class Point { public class Point {
private Double x; private Double x;
private Double y; private Double y;
private Double z;
} }
@@ -62,7 +62,7 @@ public interface OrderService {
* @param orderId: 生产单Id * @param orderId: 生产单Id
* @return Map<String, List<?>> * @return Map<String, List<?>>
*/ */
Map<String,List> getModule(Long orderId, Integer deleted); Map<String,List<?>> getModule(Long orderId, Integer deleted);
/** /**
* @param orderId: 生产单id * @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.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator; 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.framework.security.core.util.SecurityFrameworkUtils;
import com.cf.imes.module.executor.dal.dataobject.goods.GoodsDO; 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.order.OrderDO;
@@ -83,10 +84,9 @@ public class OrderProcessServiceImpl implements OrderProcessService {
private GoodsMapper goodsMapper; private GoodsMapper goodsMapper;
@Override // 生产单状态检测
@Transactional(rollbackFor = Exception.class) private void checkOrderStatus(Long orderId, Long organId, Integer status) {
public Long createOrderProcess(OrderProcessSaveReqVO createReqVO) { OrderDO order = orderMapper.selectOrderOne(orderId, organId, status);
OrderDO order = orderMapper.selectOrderOne(createReqVO.getOrderId(), SecurityFrameworkUtils.getLoginUser().getOrganId(), OrderDeletedEnum.NOT_DELETED.getStatus());
// 当生产不为删除时,校验生产单存在 // 当生产不为删除时,校验生产单存在
if (order == null) { if (order == null) {
throw exception(ORDER_NOT_EXISTS); throw exception(ORDER_NOT_EXISTS);
@@ -96,14 +96,33 @@ public class OrderProcessServiceImpl implements OrderProcessService {
throw exception(ORDER_STATUS_CONFLICT); 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); 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); 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); Long orderProcessId = (Long) identifierGenerator.nextId(null);
@@ -21,8 +21,8 @@ import java.util.List;
@Accessors(chain = false) // 设置 chain = false,避免生产单导入有问 @Accessors(chain = false) // 设置 chain = false,避免生产单导入有问
public class IContourData { public class IContourData {
@Schema(description = "点集(二维向量(x,y))") @Schema(description = "点集(二维向量(x,y,z))")
private List<Point> pts; // private Point pts; //
@Schema(description = "凸度(0直线段 >0逆时针方向 <0顺时针方向)") @Schema(description = "凸度(0直线段 >0逆时针方向 <0顺时针方向)")
private Double[] buls; // private Double buls; //
} }
@@ -28,9 +28,9 @@ public class IOriginModelingData {
private Integer dir; private Integer dir;
@Schema(description = "轮廓,造型最外围的轮廓数据") @Schema(description = "轮廓,造型最外围的轮廓数据")
private IContourData outline; private List<IContourData> outline;
@Schema(description = "轮廓") @Schema(description = "孤岛轮廓")
private List<IContourData> holes; private List<List<IContourData>> holes;
@Schema(description = "槽加长") @Schema(description = "槽加长")
@@ -35,19 +35,20 @@ public class ToolUtil {
// 日期格式转换 // 日期格式转换
public static Map<String, Object> changeDate(String date, DateTimeFormatter formatter) { public static Map<String, Object> changeDate(String date, DateTimeFormatter formatter) {
String errorKey = "error"; String errorKey = "error";
String dateKey = "date";
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
LocalDate localDate; LocalDate localDate;
if (date == null){ if (date == null){
localDate = LocalDate.now(); localDate = LocalDate.now();
map.put("date", localDate); map.put(dateKey, localDate);
map.put(errorKey, 0); map.put(errorKey, 0);
}else { }else {
try { try {
localDate = LocalDate.parse(date, formatter); localDate = LocalDate.parse(date, formatter);
map.put("date", localDate); map.put(dateKey, localDate);
map.put(errorKey, 1); map.put(errorKey, 1);
} catch (DateTimeParseException e) { } catch (DateTimeParseException e) {
map.put("date", date); map.put(dateKey, date);
map.put(errorKey, -1); map.put(errorKey, -1);
} }
@@ -64,6 +64,7 @@ public class ApiDataAchieve {
JSONObject jsonPlatesData = new JSONObject(); JSONObject jsonPlatesData = new JSONObject();
jsonPlatesData.put(ORDER_NO_KEY, "N" + orderNo);//生产单号需要传入赋值 jsonPlatesData.put(ORDER_NO_KEY, "N" + orderNo);//生产单号需要传入赋值
jsonPlatesData.put("format", "json"); jsonPlatesData.put("format", "json");
jsonPlatesData.put("version", "3");
JSONObject dataPlates = apiDataProduction.getApiOrderMessage(token, jsonPlatesData); JSONObject dataPlates = apiDataProduction.getApiOrderMessage(token, jsonPlatesData);
return new AsyncResult<>(dataPlates); return new AsyncResult<>(dataPlates);
} }
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator; 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.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.goods.GoodsDO;
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO; import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
import com.cf.imes.module.executor.dal.dataobject.orderBody.OrderBodyDO; import com.cf.imes.module.executor.dal.dataobject.orderBody.OrderBodyDO;
@@ -743,6 +744,7 @@ public class ApiTypeRealize {
System.err.println(dataPlates); System.err.println(dataPlates);
if (ordersArray != null && !ordersArray.isEmpty()) { if (ordersArray != null && !ordersArray.isEmpty()) {
for (int i = 0; i < ordersArray.size(); i++) { for (int i = 0; i < ordersArray.size(); i++) {
System.out.println("kkk " + ordersArray.get(i));
JSONObject order = ordersArray.getJSONObject(i); JSONObject order = ordersArray.getJSONObject(i);
// 获取材料信息 // 获取材料信息
if (order.getJSONArray("Materials") != null && !order.getJSONArray("Materials").isEmpty()) { if (order.getJSONArray("Materials") != null && !order.getJSONArray("Materials").isEmpty()) {
@@ -928,30 +930,13 @@ public class ApiTypeRealize {
offSetLists.add(OffSetList.builder() offSetLists.add(OffSetList.builder()
.value(Double.valueOf(offSet.getString("Value"))) .value(Double.valueOf(offSet.getString("Value")))
.name(offSet.getString("Name")) .name(offSet.getString("Name"))
.radius(Double.valueOf(offSet.getString("Diameter")) / 2) .radius(Double.parseDouble(offSet.getString("Diameter")) / 2)
.angle(Double.valueOf(offSet.getString("Angle"))) .angle(Double.valueOf(offSet.getString("Angle")))
.depth(Double.valueOf(offSet.getString("Depth"))) .depth(Double.valueOf(offSet.getString("Depth")))
.build()); .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() modelDetails.add(ModelDetail.builder()
.depth(Double.valueOf(model.getString("Depth"))) .depth(Double.valueOf(model.getString("Depth")))
.faceType(Integer.valueOf(model.getString("Face"))) .faceType(Integer.valueOf(model.getString("Face")))
@@ -959,7 +944,7 @@ public class ApiTypeRealize {
.knifeRadius(Double.valueOf(model.getString("Diameter")) / 2) .knifeRadius(Double.valueOf(model.getString("Diameter")) / 2)
.pointList(pointLists) .pointList(pointLists)
.offSetList(offSetLists) .offSetList(offSetLists)
.originModeling(originModeling) .originModeling(getOriginModeling(model.getJSONObject("OriginModeling")))
.build()); .build());
} }
} }
@@ -967,6 +952,83 @@ public class ApiTypeRealize {
return modelDetails; 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) { private List<DrillsInfo> getDrillsInfo(JSONObject block) {
List<DrillsInfo> drillsInfos = new ArrayList<>(); List<DrillsInfo> drillsInfos = new ArrayList<>();
@@ -1303,7 +1303,7 @@ public class XmlTypeRealize {
.round(Double.parseDouble(grooveXmlVO.getRound())) .round(Double.parseDouble(grooveXmlVO.getRound()))
.redundance(Double.parseDouble(grooveXmlVO.getRedundance())) .redundance(Double.parseDouble(grooveXmlVO.getRedundance()))
.tangentAngle(Double.parseDouble(grooveXmlVO.getTangentAngle())) .tangentAngle(Double.parseDouble(grooveXmlVO.getTangentAngle()))
.originModeling(getOriginModelingData(grooveXmlVO)) // .originModeling(getOriginModelingData(grooveXmlVO))
.offSetList(addOffSetDetail(grooveXmlVO.getOffsetLineXmlVOS())) .offSetList(addOffSetDetail(grooveXmlVO.getOffsetLineXmlVOS()))
.build(); .build();
} }
@@ -1316,7 +1316,7 @@ public class XmlTypeRealize {
.addLen(Double.valueOf(grooveXmlVO.getLengthExtend())) .addLen(Double.valueOf(grooveXmlVO.getLengthExtend()))
.addDepth(Double.valueOf(grooveXmlVO.getDepthExtend())) .addDepth(Double.valueOf(grooveXmlVO.getDepthExtend()))
.addWidth(Double.valueOf(grooveXmlVO.getWidthExtend())) .addWidth(Double.valueOf(grooveXmlVO.getWidthExtend()))
.pointList(addPointDetail(grooveXmlVO.getPointXmlVOS())) // .pointList(addPointDetail(grooveXmlVO.getPointXmlVOS()))
.build(); .build();
} }