mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
生产单xml导入异步:代码规范问题修复
This commit is contained in:
+39
-23
@@ -94,6 +94,7 @@ import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import static com.cf.imes.module.executor.enums.OrderImportConstants.NOT_ASSIGNED;
|
||||
import static com.cf.imes.module.plan.enums.ErrorCodeConstants.ORDER_IMPORT_PLATE_GOODS_NOT_EXISTS;
|
||||
@@ -538,7 +539,7 @@ public class DefaultXmlOrderImportFactory {
|
||||
.orderId(orderId)
|
||||
.type(OrderItemTypeEnum.PLATE_ITEM.getStatus())
|
||||
.plateId(plateId)
|
||||
.groupId(ObjectUtil.isNotNull(groupTempDataDO) ? groupTempDataDO.getInnerGroupId() : 0L)
|
||||
.groupId(Optional.ofNullable(groupTempDataDO).map(OrderImportTempDataDO::getInnerGroupId).orElse(0L))
|
||||
.roomId(roomBodyTempDataDO.getInnerRoomId())
|
||||
.bodyId(roomBodyTempDataDO.getInnerBodyId())
|
||||
.num(1.0)
|
||||
@@ -604,9 +605,7 @@ public class DefaultXmlOrderImportFactory {
|
||||
addRemark(blockProductionCode, plateDO, orderModelDO);
|
||||
// 查询大板id用于小板轮廓goodsId
|
||||
GoodsDO goodsDO = goodsMapper.selectById(goodsId);
|
||||
if (ObjectUtil.isNull(goodsDO)) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_PLATE_GOODS_NOT_EXISTS, orderId, goodsId);
|
||||
}
|
||||
Optional.ofNullable(goodsDO).orElseThrow(() -> ServiceExceptionUtil.exception(ORDER_IMPORT_PLATE_GOODS_NOT_EXISTS, orderId, goodsId));
|
||||
orderModelDO.setGoodsId(goodsDO.getGoodsId());
|
||||
orderModelDO.setPlateGoodsId(goodsId);
|
||||
orderModelDO.setOrganId(organId);
|
||||
@@ -642,10 +641,8 @@ public class DefaultXmlOrderImportFactory {
|
||||
.eq(OrderImportTempDataDO::getOuterGoodsId, blockProductionCode)
|
||||
.eq(OrderImportTempDataDO::getOrganId, organId)
|
||||
);
|
||||
BigDecimal sealLeft = BigDecimal.valueOf(0);
|
||||
BigDecimal sealRight = BigDecimal.valueOf(0);
|
||||
BigDecimal sealUp = BigDecimal.valueOf(0);
|
||||
BigDecimal sealDown = BigDecimal.valueOf(0);
|
||||
BigDecimal[] sealPositions = new BigDecimal[4];
|
||||
Arrays.fill(sealPositions, BigDecimal.ZERO);
|
||||
|
||||
ExtraVO extraVO = ExtraVO.builder()
|
||||
.edgeRemarks(new ArrayList<>())
|
||||
@@ -666,20 +663,8 @@ public class DefaultXmlOrderImportFactory {
|
||||
addSealEdgePart(orderItemDO, pointXmlVO);
|
||||
}
|
||||
|
||||
if (!plateDO.getIsSpecialShaped()) {
|
||||
if (x == 0 && y == 0) {
|
||||
sealDown = size;
|
||||
}
|
||||
if (x != 0 && y == 0) {
|
||||
sealRight = size;
|
||||
}
|
||||
if (x != 0 && y != 0) {
|
||||
sealUp = size;
|
||||
}
|
||||
if (x == 0 && y != 0) {
|
||||
sealLeft = size;
|
||||
}
|
||||
}
|
||||
// 计算封边条厚度
|
||||
calculateSealPositions(plateDO, pointXmlVO, sealPositions);
|
||||
|
||||
orderModelDO.getRawPointDetail().add(PointDetail.builder()
|
||||
.pointX(x)
|
||||
@@ -701,9 +686,40 @@ public class DefaultXmlOrderImportFactory {
|
||||
String jsonString = JSON.toJSONString(extraVO);
|
||||
JSONObject jsonObject = JSON.parseObject(jsonString);
|
||||
orderModelDO.setPlateExtraRemark(jsonObject);
|
||||
plateDO.setSealUp(sealUp).setSealDown(sealDown).setSealLeft(sealLeft).setSealRight(sealRight);
|
||||
plateDO.setSealLeft(sealPositions[0]).setSealRight(sealPositions[1]).setSealUp(sealPositions[2]).setSealDown(sealPositions[3]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 计算封边条上下左右厚度
|
||||
*
|
||||
* @param plateDO
|
||||
* @param pointXmlVO
|
||||
* @param sealPositions
|
||||
*/
|
||||
private void calculateSealPositions(PlateDO plateDO, PointXmlVO pointXmlVO, BigDecimal[] sealPositions) {
|
||||
if (!plateDO.getIsSpecialShaped()) {
|
||||
double x = Double.parseDouble(pointXmlVO.getPointX());
|
||||
double y = Double.parseDouble(pointXmlVO.getPointY());
|
||||
BigDecimal size = new BigDecimal(pointXmlVO.getEdgingThickness());
|
||||
|
||||
if (x == 0 && y != 0) {
|
||||
sealPositions[0] = size; // sealLeft
|
||||
}
|
||||
if (x != 0 && y == 0) {
|
||||
sealPositions[1] = size; // sealRight
|
||||
}
|
||||
if (x != 0 && y != 0) {
|
||||
sealPositions[2] = size; // sealUp
|
||||
}
|
||||
if (x == 0 && y == 0) {
|
||||
sealPositions[3] = size; // sealDown
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增封边条配件
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user