mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
Merge branch 'main' of ssh://192.168.1.205:9922/cf_devdept2/cf_imes_server
This commit is contained in:
-48
@@ -1,48 +0,0 @@
|
||||
package com.cf.imes.module.executor.controller.admin.plate.vo;
|
||||
|
||||
import com.cf.imes.module.executor.controller.admin.plan.dto.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Beal
|
||||
*/
|
||||
@Data
|
||||
public class PlateDetailVO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 5934179383701994502L;
|
||||
|
||||
@Schema(description = "生产单id")
|
||||
private Long orderId;
|
||||
|
||||
@Schema(description = "点详情列表")
|
||||
private List<PointDetail> pointDetailList;
|
||||
|
||||
@Schema(description = "孔详情列表")
|
||||
private List<HoleDetail> holeDetailList;
|
||||
|
||||
@Schema(description = "造型列表")
|
||||
private List<ModelDetail> modelDetailList;
|
||||
|
||||
@Schema(description = "偏移量")
|
||||
private OffSet offSet;
|
||||
|
||||
@Schema(description = "是否新版本")
|
||||
private Boolean newVersion;
|
||||
|
||||
@Schema(description = "原始点详情列表")
|
||||
private List<OldPointDetail> oldPointDetailList;
|
||||
|
||||
@Schema(description = "开料尺寸")
|
||||
private KaiLiaoSize kaiLiaoSize;
|
||||
|
||||
@Schema(description = "边模型详情列表")
|
||||
private List<SideModelDetail> sideModelDetails;
|
||||
|
||||
@Schema(description = "边孔详情")
|
||||
private List<SideHoleDetail> sideHoleDetailList;
|
||||
|
||||
}
|
||||
+1
-10
@@ -110,15 +110,6 @@ public interface GoodsMapper extends BaseMapperX<GoodsDO> {
|
||||
List<GoodsDO> selectPlanGoodsDataSource(@Param("filed") String filed,@Param("planId") Long planId ,@Param("organId") Long organId);
|
||||
|
||||
|
||||
// default GoodsDO selectGoodsId(Long orderId, String goodsId, Long organId) {
|
||||
// return selectOne(new LambdaQueryWrapperX<GoodsDO>()
|
||||
// .eq(GoodsDO::getOrganId, organId)
|
||||
// .eq(GoodsDO::getDeleted, false)
|
||||
// .eq(GoodsDO::getGoodsId, goodsId)
|
||||
// .eq(GoodsDO::getOrderId, orderId)
|
||||
// .select(GoodsDO::getId));
|
||||
//
|
||||
// }
|
||||
|
||||
GoodsDO selectGoodsId(@Param("orderId") Long orderId,@Param("goodsId") String goodsId,@Param("organId") Long organId);
|
||||
|
||||
@@ -217,7 +208,7 @@ public interface GoodsMapper extends BaseMapperX<GoodsDO> {
|
||||
return selectList(new LambdaQueryWrapperX<GoodsDO>()
|
||||
.eq(GoodsDO::getOrganId, organId)
|
||||
.eq(GoodsDO::getDeleted, false)
|
||||
.inIfPresent(GoodsDO::getOrderId,orderIds)
|
||||
.in(GoodsDO::getOrderId,orderIds)
|
||||
.eq(GoodsDO::getPlanId,0)
|
||||
.select(GoodsDO::getOrderId));
|
||||
|
||||
|
||||
+2
-3
@@ -98,7 +98,6 @@ public interface OrderMapper extends BaseMapperX<OrderDO> {
|
||||
|
||||
IPage<OrderRespVOCopy> selectOrderPage(@Param("page") IPage page, @Param(Constants.WRAPPER) Wrapper<OrderDO> wrapper);
|
||||
|
||||
// IPage<OrderRespVOCopy> selectOrderPage(@Param("page") IPage page,@Param("pageReqVO") OrderPageReqVOCopy pageReqVO, @Param("organId") Long organId);
|
||||
|
||||
Map<String, Object> selectDynamicSqlString(@Param("sqlStr") String sqlStr);
|
||||
|
||||
@@ -273,9 +272,9 @@ public interface OrderMapper extends BaseMapperX<OrderDO> {
|
||||
|
||||
default List<OrderDO> selectOrderPackList(List<Long> orderIds, Long organId) {
|
||||
return selectList(new LambdaQueryWrapperX<OrderDO>()
|
||||
.eqIfPresent(OrderDO::getOrganId, organId)
|
||||
.eq(OrderDO::getOrganId, organId)
|
||||
.eq(OrderDO::getDeleted, false)
|
||||
.inIfPresent(OrderDO::getId,orderIds)
|
||||
.in(OrderDO::getId,orderIds)
|
||||
.eq(OrderDO::getPackaged, OrderPackageStatusEnum.PACKAGED.getStatus()));
|
||||
|
||||
}
|
||||
|
||||
+37
-15
@@ -6,6 +6,7 @@ import co.elastic.clients.elasticsearch.ElasticsearchClient;
|
||||
import co.elastic.clients.elasticsearch._types.FieldValue;
|
||||
import co.elastic.clients.elasticsearch.core.*;
|
||||
import co.elastic.clients.elasticsearch.core.search.Hit;
|
||||
import co.elastic.clients.elasticsearch.indices.RefreshRequest;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.cf.imes.framework.common.enums.OrderStatusEnum;
|
||||
import com.cf.imes.framework.common.enums.PlanStatusEnum;
|
||||
@@ -188,6 +189,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
List<PlateDO> plateDOS = plateMapper.selectPlateByPlateNo(plateNo.stream().distinct().toList(), getUserOrganId());
|
||||
|
||||
AssertUtils.notEmpty(plateDOS,ORDER_PLAN_OPTIMIZE_ERROR);
|
||||
|
||||
List<Long> orderIds = new ArrayList<>(plateDOS.stream().map(PlateDO::getOrderId).distinct().toList());
|
||||
|
||||
@@ -230,7 +232,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
}catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
throw new ServiceException(ES_ERROR_UPDATE);
|
||||
throw new ServiceException(ES_DATA_ERROR);
|
||||
}
|
||||
|
||||
if(cutedBoardNumber > 0){
|
||||
@@ -247,15 +249,21 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
planMapper.updateById(planDO);
|
||||
|
||||
List<Long> deleteOrderIds = goodsMapper.selectNoPlanOrdersListByOrderIds(orderIds, getUserOrganId()).stream().map(GoodsDO::getOrderId).distinct().toList();
|
||||
// 需要去除的生产单ID
|
||||
List<Long> deleteOrderIds = new ArrayList<>();
|
||||
|
||||
// 筛选出还有未排单的生产单ID
|
||||
deleteOrderIds.addAll(goodsMapper.selectNoPlanOrdersListByOrderIds(orderIds, getUserOrganId()).stream().map(GoodsDO::getOrderId).distinct().toList());
|
||||
|
||||
// 筛选出生产单对应的排单里状态为 未排单的 生产单ID
|
||||
deleteOrderIds.addAll(goodsMapper.selectOrderPlanList(orderIds, getUserOrganId()));
|
||||
|
||||
// 去除
|
||||
orderIds.removeAll(deleteOrderIds);
|
||||
|
||||
if(ObjectUtil.isNotEmpty(orderIds)) {
|
||||
|
||||
List<Long> orderIdList = goodsMapper.selectOrderPlanList(orderIds, getUserOrganId());
|
||||
|
||||
List<OrderDO> orderDOS = orderMapper.selectOrderPackList(orderIdList, getUserOrganId());
|
||||
List<OrderDO> orderDOS = orderMapper.selectOrderPackList(orderIds, getUserOrganId());
|
||||
|
||||
if (ObjectUtil.isNotEmpty(orderDOS)) {
|
||||
List<OrderDO> orderDOList = orderDOS.stream().map(m -> m.setStatus(OrderStatusEnum.FINISH_PRODUCTION.getStatus())).toList();
|
||||
@@ -333,7 +341,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage());
|
||||
throw new ServiceException(ES_ERROR_UPDATE);
|
||||
throw new ServiceException(ES_DATA_ERROR);
|
||||
}
|
||||
|
||||
if(cutedBoardInfo.getCutedBoardNumber() == 0){
|
||||
@@ -708,7 +716,8 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
// 保存优化后的大板数据
|
||||
batchSaveBoardModel(req.getOptimizeBoardModelDOS());
|
||||
|
||||
|
||||
// ES文档数据刷新
|
||||
refresh(ORDER_REMAIN_PLATE_MODEL);
|
||||
|
||||
plateMapper.updatePlateOptimized(orderIds,ids,getUserOrganId());
|
||||
|
||||
@@ -774,12 +783,9 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
*/
|
||||
public void batchSaveBoardModel(List<OptimizeBoardModelDO> optimizeBoardModelDOS) {
|
||||
try {
|
||||
BulkResponse bulkResponse = esDocumentService.bulkCreate(ORDER_REMAIN_PLATE_MODEL, optimizeBoardModelDOS);
|
||||
boolean errors = bulkResponse.errors();
|
||||
if (errors) {
|
||||
log.error("优化生产ES文档保存数据异常: "+bulkResponse.items().toString());
|
||||
throw new ServiceException(DATA_DATA_ERROR);
|
||||
}
|
||||
|
||||
esDocumentService.bulkCreate(ORDER_REMAIN_PLATE_MODEL, optimizeBoardModelDOS);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("优化生产ES文档保存数据异常: "+e.getMessage());
|
||||
@@ -905,12 +911,28 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
log.info("Deleted {} documents with planId {}", response.deleted(), planIds);
|
||||
} catch (Exception e) {
|
||||
log.error("Error deleting documents with planId {}: {}", planIds, e.getMessage());
|
||||
throw new ServiceException(ES_ERROR_DELETE);
|
||||
throw new ServiceException(ES_DATA_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void refresh( String index) {
|
||||
|
||||
try {
|
||||
|
||||
// 创建刷新请求
|
||||
RefreshRequest refreshRequest = new RefreshRequest.Builder().index(index).build();
|
||||
|
||||
elasticsearchClient.indices().refresh(refreshRequest);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("ES文档数据刷新失败:"+e.getMessage());
|
||||
throw new ServiceException(ES_DATA_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -992,7 +992,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
log.info("Deleted {} documents with planId {}", response.deleted(), planIds);
|
||||
} catch (Exception e) {
|
||||
log.error("Error deleting documents with planId {}: {}", planIds, e.getMessage());
|
||||
throw new ServiceException(ES_ERROR_DELETE);
|
||||
throw new ServiceException(ES_DATA_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-3
@@ -50,8 +50,7 @@ import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.ES_ERROR_UPDATE;
|
||||
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR;
|
||||
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.*;
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.common.util.json.JsonUtils.parseObject;
|
||||
import static com.cf.imes.framework.common.util.json.JsonUtils.toJsonString;
|
||||
@@ -175,7 +174,7 @@ public class PlateServiceImpl implements PlateService {
|
||||
} catch (Exception e) {
|
||||
|
||||
log.error(e.getMessage());
|
||||
throw new ServiceException(ES_ERROR_UPDATE);
|
||||
throw new ServiceException(ES_DATA_ERROR);
|
||||
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -467,7 +467,7 @@
|
||||
<foreach item="orderIds" collection="orderIds" open="(" separator="," close=")">
|
||||
#{orderIds}
|
||||
</foreach>
|
||||
and op.status = 2
|
||||
and op.status in (0,1);
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user