mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-13 13:22:07 +08:00
api新增sideModel
This commit is contained in:
+3
-3
@@ -464,18 +464,18 @@ public class OrderServiceImpl implements OrderService {
|
||||
}
|
||||
}
|
||||
orderInputProcessor.batchInsert(rawGoodsDO, bodyDO, groupDO, partsDO, plateDO, itemDO, goodsDO, plateGoodDOS);
|
||||
if (orderModelDOS != null && orderModelDOS.size() > 0) {
|
||||
if (orderModelDOS != null && !orderModelDOS.isEmpty()) {
|
||||
orderInputProcessor.batchSaveModel(orderModelDOS);
|
||||
}
|
||||
if (plateDetail != null){
|
||||
List<OrderModelDO> orderModelDOs = BeanUtils.toBean(plateDetail, OrderModelDO.class);
|
||||
if (orderModelDOs.size() > 0) {
|
||||
if (!orderModelDOs.isEmpty()) {
|
||||
orderModelDOs.forEach(orderModelDO -> orderModelDO.setOrderId(orderDO.getId()));
|
||||
System.out.println("----" + orderModelDOs);
|
||||
orderInputProcessor.batchSaveModel(orderModelDOs);
|
||||
}
|
||||
}
|
||||
if (orderPartsRemarks != null && orderPartsRemarks.size() > 0) {
|
||||
if (orderPartsRemarks != null && !orderPartsRemarks.isEmpty()) {
|
||||
orderInputProcessor.batchSaveOrderPartsModel(orderPartsRemarks);
|
||||
}
|
||||
|
||||
|
||||
+63
-43
@@ -637,9 +637,7 @@ public class ApiTypeRealize {
|
||||
|
||||
if (plateDetail != null){
|
||||
Long blockNo = plate.getLong(ProduceApiConstants.BD_BLOCK_NO);
|
||||
System.out.println("blockNo " + blockNo);
|
||||
PlateDetail plateDetailInfo = plateDetail.get(blockNo);
|
||||
System.out.println("hhhh " + plateDetailInfo);
|
||||
|
||||
if (plateDetailInfo != null) {
|
||||
plateDetailInfo.setPlateId(plateId)
|
||||
@@ -942,60 +940,82 @@ public class ApiTypeRealize {
|
||||
// 造型明细板数据解析 (type 为1,正面;3,侧面)
|
||||
private List<ModelDetail> getModelDetail(JSONObject block) {
|
||||
JSONArray models = block.getJSONArray(ProduceApiConstants.BPD_MODEL);
|
||||
JSONArray sideModels = block.getJSONArray(ProduceApiConstants.BPD_SIDE_MODEL); // 侧面造型
|
||||
|
||||
List<ModelDetail> modelDetails = new ArrayList<>();
|
||||
|
||||
try {
|
||||
List<ModelDetail> modelData = getModelData(models);
|
||||
if (modelData != null && !modelData.isEmpty()) {
|
||||
modelDetails.addAll(modelData);
|
||||
}
|
||||
|
||||
List<ModelDetail> sideModelData = getModelData(sideModels);
|
||||
if (sideModelData != null && !sideModelData.isEmpty()) {
|
||||
modelDetails.addAll(sideModelData);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 处理异常,例如记录日志或抛出自定义异常
|
||||
}
|
||||
|
||||
return modelDetails;
|
||||
}
|
||||
|
||||
// 造型数据生成
|
||||
private List<ModelDetail> getModelData(JSONArray models) {
|
||||
if (models == null || models.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
List<ModelDetail> modelDetails = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < models.size(); i++) {
|
||||
JSONObject model = models.getJSONObject(i);
|
||||
for (int i = 0; i < models.size(); i++) {
|
||||
JSONObject model = models.getJSONObject(i);
|
||||
|
||||
List<PointList> pointLists = new ArrayList<>();
|
||||
JSONArray pointsJson = model.getJSONArray(ProduceApiConstants.BPD_MODEL_POINTS);
|
||||
if (pointsJson != null && !pointsJson.isEmpty()) {
|
||||
for (int j = 0; j < pointsJson.size(); j++) {
|
||||
JSONObject point = pointsJson.getJSONObject(j);
|
||||
String[] points = splitAndTrim(point.getString(ProduceApiConstants.BPD_MODEL_POINTS_POS));
|
||||
pointLists.add(PointList.builder()
|
||||
.pointX(Double.valueOf(points[X]))
|
||||
.pointY(Double.valueOf(points[Y]))
|
||||
.pointZ(Double.valueOf(points[Z]))
|
||||
.curve(Double.valueOf(point.getString(ProduceApiConstants.BPD_MODEL_POINTS_CURVE)))
|
||||
.build());
|
||||
}
|
||||
List<PointList> pointLists = new ArrayList<>();
|
||||
JSONArray pointsJson = model.getJSONArray(ProduceApiConstants.BPD_MODEL_POINTS);
|
||||
if (pointsJson != null && !pointsJson.isEmpty()) {
|
||||
for (int j = 0; j < pointsJson.size(); j++) {
|
||||
JSONObject point = pointsJson.getJSONObject(j);
|
||||
String[] points = splitAndTrim(point.getString(ProduceApiConstants.BPD_MODEL_POINTS_POS));
|
||||
pointLists.add(PointList.builder()
|
||||
.pointX(Double.valueOf(points[X]))
|
||||
.pointY(Double.valueOf(points[Y]))
|
||||
.pointZ(Double.valueOf(points[Z]))
|
||||
.curve(Double.valueOf(point.getString(ProduceApiConstants.BPD_MODEL_POINTS_CURVE)))
|
||||
.build());
|
||||
}
|
||||
|
||||
List<OffSetList> offSetLists = new ArrayList<>();
|
||||
JSONArray offSets = model.getJSONArray(ProduceApiConstants.BPD_MODEL_OFFSET_LIST);
|
||||
if (offSets != null && !offSets.isEmpty()) {
|
||||
for (int j = 0; j < offSets.size(); j++) {
|
||||
JSONObject offSet = offSets.getJSONObject(j);
|
||||
offSetLists.add(OffSetList.builder()
|
||||
.value(Double.valueOf(offSet.getString(ProduceApiConstants.BPD_MODEL_OFFSET_LIST_VALUE)))
|
||||
.name(offSet.getString(ProduceApiConstants.BPD_MODEL_OFFSET_LIST_NAME))
|
||||
.radius(Double.parseDouble(offSet.getString(ProduceApiConstants.BPD_MODEL_OFFSET_LIST_DIRECTION)) / 2)
|
||||
.angle(Double.valueOf(offSet.getString(ProduceApiConstants.BPD_MODEL_OFFSET_LIST_ANGLE)))
|
||||
.depth(Double.valueOf(offSet.getString(ProduceApiConstants.BPD_MODEL_OFFSET_LIST_DEPTH)))
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
||||
modelDetails.add(ModelDetail.builder()
|
||||
.depth(Double.valueOf(model.getString(ProduceApiConstants.BPD_MODEL_DEPTH)))
|
||||
.faceType(Integer.valueOf(model.getString(ProduceApiConstants.BPD_MODEL_FACE)))
|
||||
.knifeName(model.getString(ProduceApiConstants.BPD_MODEL_TOOL_NO))
|
||||
.knifeRadius(Double.parseDouble(model.getString(ProduceApiConstants.BPD_MODEL_DIAMETER)) / 2)
|
||||
.pointList(pointLists)
|
||||
.offSetList(offSetLists)
|
||||
.originModeling(getOriginModeling(model.getJSONObject(ProduceApiConstants.BPD_MODEL_ORIGIN_MODELING)))
|
||||
.build());
|
||||
}
|
||||
|
||||
List<OffSetList> offSetLists = new ArrayList<>();
|
||||
JSONArray offSets = model.getJSONArray(ProduceApiConstants.BPD_MODEL_OFFSET_LIST);
|
||||
if (offSets != null && !offSets.isEmpty()) {
|
||||
for (int j = 0; j < offSets.size(); j++) {
|
||||
JSONObject offSet = offSets.getJSONObject(j);
|
||||
offSetLists.add(OffSetList.builder()
|
||||
.value(Double.valueOf(offSet.getString(ProduceApiConstants.BPD_MODEL_OFFSET_LIST_VALUE)))
|
||||
.name(offSet.getString(ProduceApiConstants.BPD_MODEL_OFFSET_LIST_NAME))
|
||||
.radius(Double.parseDouble(offSet.getString(ProduceApiConstants.BPD_MODEL_OFFSET_LIST_DIRECTION)) / 2)
|
||||
.angle(Double.valueOf(offSet.getString(ProduceApiConstants.BPD_MODEL_OFFSET_LIST_ANGLE)))
|
||||
.depth(Double.valueOf(offSet.getString(ProduceApiConstants.BPD_MODEL_OFFSET_LIST_DEPTH)))
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
||||
modelDetails.add(ModelDetail.builder()
|
||||
.depth(Double.valueOf(model.getString(ProduceApiConstants.BPD_MODEL_DEPTH)))
|
||||
.faceType(Integer.valueOf(model.getString(ProduceApiConstants.BPD_MODEL_FACE)))
|
||||
.knifeName(model.getString(ProduceApiConstants.BPD_MODEL_TOOL_NO))
|
||||
.knifeRadius(Double.parseDouble(model.getString(ProduceApiConstants.BPD_MODEL_DIAMETER)) / 2)
|
||||
.pointList(pointLists)
|
||||
.offSetList(offSetLists)
|
||||
.originModeling(getOriginModeling(model.getJSONObject(ProduceApiConstants.BPD_MODEL_ORIGIN_MODELING)))
|
||||
.build());
|
||||
}
|
||||
|
||||
return modelDetails;
|
||||
}
|
||||
|
||||
// 造型 --- OriginModeling
|
||||
// 造型 --- OriginModeling
|
||||
private IOriginModelingData getOriginModeling(JSONObject originModeling) {
|
||||
|
||||
if (originModeling == null || originModeling.isEmpty()) {
|
||||
|
||||
+1
@@ -247,6 +247,7 @@ public class ProduceApiConstants {
|
||||
public static final String BPD_HOLE_START_POINT = "StartPoint";
|
||||
|
||||
public static final String BPD_MODEL = "Models"; // 造型
|
||||
public static final String BPD_SIDE_MODEL = "SideModels"; // 侧面造型造型
|
||||
public static final String BPD_MODEL_DEPTH = "Depth";
|
||||
public static final String BPD_MODEL_DIAMETER = "Diameter";
|
||||
public static final String BPD_MODEL_FACE = "Face";
|
||||
|
||||
Reference in New Issue
Block a user