mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-13 05:12:07 +08:00
1、生产管理:计算用板量、未排单、已排单、优化相关移除order_plan_item,使用orders、order_goods新结构记录板件数量和面积;2、新增webcad导入支持板件数量和面积统计,订单商品规格/品牌支持可空;3、新增生产系统api导入支持板件数量和面积统计;
This commit is contained in:
+4
-1
@@ -18,7 +18,10 @@ public class ErrorCodeConstants {
|
||||
public static final ErrorCode PLAN_NOT_DATA_EXISTS = new ErrorCode(1_001_107_007, "排单号:{} 不存在,无法进行操作,请检查排单数据");
|
||||
public static final ErrorCode PLAN_PLATE_IS_CUTTING = new ErrorCode(1_001_107_008, "当前排单已有板材开料,无法开启混单");
|
||||
public static final ErrorCode PLAN_IS_MIXED_ERROR = new ErrorCode(1_001_107_009, "当前排单为混单,无法开启混单配置");
|
||||
|
||||
public static final ErrorCode CREATE_PLAN_ORDER_UPDATE_CONCURRENCY_ERROR = new ErrorCode(1_001_107_010, "创建排单失败:生产单号【{}】板件数量已发生改变,请刷新后重新创建单排");
|
||||
public static final ErrorCode CREATE_PLAN_GOODS_UPDATE_CONCURRENCY_ERROR = new ErrorCode(1_001_107_011, "创建排单失败:材质【{}】板件数量已发生改变,请刷新后重新创建单排");
|
||||
public static final ErrorCode ORDER_PLATE_UPDATE_CONCURRENCY_ERROR = new ErrorCode(1_001_107_012, "更新生产单状态失败:生产单号【{}】板件数量已发生改变,请刷新后重新操作");
|
||||
public static final ErrorCode GOODS_PLATE_UPDATE_CONCURRENCY_ERROR = new ErrorCode(1_001_107_013, "更新材质状态失败:材质【{}】板件数量已发生改变,请刷新后重新操作");
|
||||
|
||||
|
||||
// ========== 生产单商品 TODO 补充编号 ==========
|
||||
|
||||
+11
-10
@@ -8,6 +8,7 @@ import co.elastic.clients.elasticsearch.core.SearchRequest;
|
||||
import co.elastic.clients.elasticsearch.core.SearchResponse;
|
||||
import co.elastic.clients.elasticsearch.core.search.Hit;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||
@@ -22,7 +23,6 @@ import com.cf.imes.module.executor.dal.dataobject.orderItem.OrderItemDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderParts.OrderPartsDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.ordermodel.OrderModelDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.plan.PlanDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.planitem.PlanItemDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.plate.PlateDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.remainplaten.RemainPlateDO;
|
||||
import com.cf.imes.module.executor.dal.mysql.goods.GoodsMapper;
|
||||
@@ -32,7 +32,6 @@ import com.cf.imes.module.executor.dal.mysql.orderGroup.OrderGroupMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.orderItem.OrderItemMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.orderParts.OrderPartsMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.plan.PlanMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.planItem.PlanItemMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.plate.PlateMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.remainplaten.RemainPlateMapper;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
@@ -92,9 +91,6 @@ public class OrderPlanApiImpl implements OrderPlanApi{
|
||||
@Resource
|
||||
private OrderPartsMapper orderPartsMapper;
|
||||
|
||||
@Resource
|
||||
private PlanItemMapper planItemMapper;
|
||||
|
||||
@Resource
|
||||
private ElasticsearchClient elasticsearchClient;
|
||||
|
||||
@@ -119,20 +115,25 @@ public class OrderPlanApiImpl implements OrderPlanApi{
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> getOrder(Long orderId) {
|
||||
Long organId = getUserOrganId();
|
||||
|
||||
List<PlateDO> plateDOS = plateMapper.selectNoCutPlateByPlateId(Collections.singletonList(orderId), getUserOrganId());
|
||||
List<PlateDO> plateDOS = plateMapper.selectNoCutPlateByPlateId(Collections.singletonList(orderId), organId);
|
||||
|
||||
if(CollUtil.isNotEmpty(plateDOS)){
|
||||
return CommonResult.success(false);
|
||||
}
|
||||
|
||||
List<PlanItemDO> planItemDOS = planItemMapper.selectOrderPlanList(orderId, getUserOrganId());
|
||||
List<PlateDO> orderPlanPlateList = plateMapper.selectList(new LambdaQueryWrapper<PlateDO>()
|
||||
.eq(PlateDO::getOrderId, orderId)
|
||||
.eq(PlateDO::getOrganId, orderId)
|
||||
.ne(PlateDO::getPlanId, 0)
|
||||
.select(PlateDO::getPlanId));
|
||||
|
||||
if(CollUtil.isNotEmpty(planItemDOS)){
|
||||
if(CollUtil.isNotEmpty(orderPlanPlateList)){
|
||||
|
||||
List<Long> planIds = planItemDOS.stream().map(PlanItemDO::getPlanId).distinct().toList();
|
||||
List<Long> planIds = orderPlanPlateList.stream().map(PlateDO::getPlanId).distinct().toList();
|
||||
|
||||
List<Long> planDOS = planMapper.selectPlanList(planIds,getUserOrganId());
|
||||
List<Long> planDOS = planMapper.selectPlanList(planIds, organId);
|
||||
|
||||
if(CollUtil.isEmpty(planDOS)){
|
||||
return CommonResult.success(true);
|
||||
|
||||
-1
@@ -238,7 +238,6 @@ public class OrderController {
|
||||
if (!isLocked) {
|
||||
throw new ServiceException(ORDER_IMPORT_ORGAN_LOCK_ERROR);
|
||||
}
|
||||
Thread.sleep(20000);
|
||||
Long orderId = null;
|
||||
try {
|
||||
orderId = (Long) identifierGenerator.nextId(null);
|
||||
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package com.cf.imes.module.executor.controller.admin.order.vo.order;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author Gqr
|
||||
* @since 2025/6/26 16:30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class OrderPlanPlateNumAndAreaRespVO {
|
||||
/**
|
||||
* 已排板件数量
|
||||
*/
|
||||
private Integer num;
|
||||
|
||||
/**
|
||||
* 已排板件面积
|
||||
*/
|
||||
private BigDecimal area;
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package com.cf.imes.module.executor.controller.admin.plan.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author Gqr
|
||||
* @since 2025/6/26 15:53
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class OrderPlanPlateStatisticsRespVO {
|
||||
/**
|
||||
* 排单id
|
||||
*/
|
||||
private Long planId;
|
||||
|
||||
/**
|
||||
* 排单板件数量
|
||||
*/
|
||||
private Integer count;
|
||||
|
||||
/**
|
||||
* 订单id
|
||||
*/
|
||||
private Long orderId;
|
||||
}
|
||||
+4
-3
@@ -8,6 +8,7 @@ import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@@ -25,7 +26,7 @@ public class OrderRespVOCopy {
|
||||
@Schema(description = "生产单id")
|
||||
private Long orderId;
|
||||
@Schema(description = "生产单状态")
|
||||
private Long status;
|
||||
private Integer status;
|
||||
@Schema(description = "自定义单号")
|
||||
private String defineId;
|
||||
@Schema(description = "客户")
|
||||
@@ -34,10 +35,10 @@ public class OrderRespVOCopy {
|
||||
private String address;
|
||||
@Schema(description = "订单日期")
|
||||
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY, timezone = TIME_ZONE_DEFAULT)
|
||||
private Date orderDate;
|
||||
private LocalDateTime orderDate;
|
||||
@Schema(description = "交付日期")
|
||||
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT)
|
||||
private Date deliveryDate;
|
||||
private LocalDateTime deliveryDate;
|
||||
@Schema(description = "更新时间")
|
||||
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT)
|
||||
private Date updateTime;
|
||||
|
||||
+24
@@ -98,4 +98,28 @@ public class GoodsDO extends BaseDO {
|
||||
*/
|
||||
private Boolean deleted;
|
||||
|
||||
/**
|
||||
* 板件数量
|
||||
*/
|
||||
private Integer plateNum;
|
||||
|
||||
/**
|
||||
* 已排单小板数量
|
||||
*/
|
||||
private Integer plannedPlateNum;
|
||||
|
||||
/**
|
||||
* 板件总面积
|
||||
*/
|
||||
private Double area;
|
||||
|
||||
/**
|
||||
* 已排单面积
|
||||
*/
|
||||
private Double plannedPlateArea;
|
||||
|
||||
/**
|
||||
* 版本号:乐观锁用
|
||||
*/
|
||||
private int version;
|
||||
}
|
||||
+23
@@ -123,4 +123,27 @@ public class OrderDO extends BaseDO {
|
||||
*/
|
||||
@TableField(value = "custom_plateno_seq", typeHandler = CompressStringTypeHandler.class)
|
||||
private String customPlatenoSeq;
|
||||
|
||||
|
||||
/**
|
||||
* 板件数量
|
||||
*/
|
||||
private Integer plateNum;
|
||||
|
||||
/**
|
||||
* 已排单小板数量
|
||||
*/
|
||||
private Integer plannedPlateNum;
|
||||
|
||||
/**
|
||||
* 板件总面积
|
||||
*/
|
||||
private Double area;
|
||||
|
||||
/**
|
||||
* 已排单面积
|
||||
*/
|
||||
private Double plannedPlateArea;
|
||||
|
||||
private int version;
|
||||
}
|
||||
|
||||
+4
@@ -98,4 +98,8 @@ public class PlanDO extends BaseDO {
|
||||
// */
|
||||
// private Boolean isTopUp;
|
||||
|
||||
/**
|
||||
* 板材商品id
|
||||
*/
|
||||
private String goodsId;
|
||||
}
|
||||
+5
@@ -206,4 +206,9 @@ public class PlateDO extends BaseDO {
|
||||
|
||||
@TableField(exist = false)
|
||||
private StringBuilder customPlateNoBuilder;
|
||||
|
||||
/**
|
||||
* 排单id
|
||||
*/
|
||||
private Long planId;
|
||||
}
|
||||
+9
@@ -10,6 +10,7 @@ import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.module.executor.controller.admin.goods.vo.GoodsPageReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.goods.vo.GoodsRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderGoodsPlateIds;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderPlanPlateNumAndAreaRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.bo.OrderRoomBodyList;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.GoodsReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.PlateInfoVO;
|
||||
@@ -191,4 +192,12 @@ public interface GoodsMapper extends BaseMapperX<GoodsDO> {
|
||||
.eq(GoodsDO::getDeleted, deleted)
|
||||
.eq(GoodsDO::getOrganId, organId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询订单材质下已排单的板件数量和面积
|
||||
*
|
||||
* @param orderGoodsId
|
||||
* @return
|
||||
*/
|
||||
OrderPlanPlateNumAndAreaRespVO selectPlannedPlateNumAndArea(@Param("orderGoodsId") Long orderGoodsId);
|
||||
}
|
||||
+8
@@ -19,6 +19,7 @@ import com.cf.imes.module.executor.controller.admin.order.vo.order.LabelOrderDat
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderCountProducePeriodRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderOverdueRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderPageReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderPlanPlateNumAndAreaRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.bo.OrderIds;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.*;
|
||||
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
|
||||
@@ -303,4 +304,11 @@ public interface OrderMapper extends BaseMapperX<OrderDO> {
|
||||
|
||||
List<LabelOrderData> selectLabelOrderData(@Param("orderIds") List<Long> orderIds,@Param("organId") Long organId);
|
||||
|
||||
/**
|
||||
* 查询订单下已排单的板件数量和面积
|
||||
*
|
||||
* @param orderId
|
||||
* @return
|
||||
*/
|
||||
OrderPlanPlateNumAndAreaRespVO selectPlannedPlateNumAndArea(@Param("orderId") Long orderId);
|
||||
}
|
||||
|
||||
+29
-2
@@ -7,7 +7,7 @@ import com.cf.imes.framework.common.enums.PlanStatusEnum;
|
||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderStatisticsReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.OrderGoodsResp;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.OrderPlanPlateStatisticsRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.OrderPlanStatisticsAreaRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.OrderPlanStatisticsCountRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.PlateOptimize;
|
||||
@@ -18,6 +18,7 @@ import org.apache.ibatis.annotations.Param;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 生产单开料排单 Mapper
|
||||
@@ -122,5 +123,31 @@ public interface PlanMapper extends BaseMapperX<PlanDO> {
|
||||
|
||||
List<PlanDO> selectIsTopDownPlan(@Param("updateTime") LocalDateTime updateTime,@Param("organId") Long organId);
|
||||
|
||||
List<OrderGoodsResp> selectPlanGoodsList(@Param("planId") Long planId, @Param("organId") Long organId);
|
||||
/**
|
||||
* 统计涉及移除小板的排单下还存在的排单数量
|
||||
*
|
||||
* @param planIds
|
||||
* @param organId
|
||||
* @return
|
||||
*/
|
||||
List<OrderPlanPlateStatisticsRespVO> countDeletePlanPlate(@Param("planIds") List<Long> planIds, @Param("orderIds") Set<Long> orderIds, @Param("organId") Long organId);
|
||||
|
||||
/**
|
||||
* 查询排单下订单id的列表
|
||||
*
|
||||
* @param planIds
|
||||
* @param organId
|
||||
* @return
|
||||
*/
|
||||
List<OrderPlanPlateStatisticsRespVO> selectPlanOrderIds(@Param("planIds") List<Long> planIds, @Param("orderIds") Set<Long> orderIds, @Param("organId") Long organId);
|
||||
|
||||
/**
|
||||
* 查询排单+生产单下订单材质orderGoodsId
|
||||
*
|
||||
* @param planId
|
||||
* @param orderIds
|
||||
* @param organId
|
||||
* @return
|
||||
*/
|
||||
List<Long> selectPlanOrderGoodsId(@Param("planId") Long planId, @Param("orderIds") List<Long> orderIds, @Param("organId") Long organId);
|
||||
}
|
||||
+2
-53
@@ -4,13 +4,10 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.LabelOrderPlateData;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.*;
|
||||
import com.cf.imes.module.executor.controller.admin.plate.vo.OrderPlateIds;
|
||||
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.planitem.PlanItemDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.plate.PlateDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@@ -26,21 +23,7 @@ public interface PlanItemMapper extends BaseMapperX<PlanItemDO> {
|
||||
|
||||
|
||||
|
||||
List<OrderRespVOCopy> selectOrderList(@Param(Constants.WRAPPER) Wrapper<OrderDO> wrapper,@Param("pageNo") Integer pageNo,@Param("pageSize") Integer pageSize);
|
||||
|
||||
|
||||
List<Long> selectOrderListCount(@Param(Constants.WRAPPER) Wrapper<OrderDO> wrapper);
|
||||
|
||||
|
||||
|
||||
default List<PlanItemDO> selectPlanPlateList(List<Long> planIds, List<Long> orderIds, Long organId) {
|
||||
return selectList( new LambdaQueryWrapperX<PlanItemDO>()
|
||||
.eq(PlanItemDO::getOrganId, organId)
|
||||
.inIfPresent(PlanItemDO::getOrderId,orderIds)
|
||||
.in(PlanItemDO::getPlanId,planIds));
|
||||
|
||||
}
|
||||
|
||||
IPage<OrderRespVOCopy> selectOrderList(@Param("page") IPage page, @Param(Constants.WRAPPER) Wrapper<OrderDO> wrapper,@Param("type")int type);
|
||||
|
||||
List<PlateDetailRespVO> selectPlanPlateDetailList(@Param("planId") Long planId, @Param("organId") Long organId);
|
||||
|
||||
@@ -49,7 +32,7 @@ public interface PlanItemMapper extends BaseMapperX<PlanItemDO> {
|
||||
|
||||
List<PlateResList> selectPlateListByPlateIds(@Param(Constants.WRAPPER) Wrapper<PlanItemDO> wrapper,@Param("pageNo") Integer pageNo,@Param("pageSize") Integer pageSize);
|
||||
|
||||
List<PlateResList> selectPlateListByPlateId(@Param("planId") Long planId, @Param("organId") Long organId);
|
||||
List<PlateResList> selectPlateListByPlanId(@Param("planId") Long planId, @Param("organId") Long organId);
|
||||
|
||||
Long selectPlateCountByPlateIds(@Param(Constants.WRAPPER) Wrapper<PlanItemDO> wrapper);
|
||||
|
||||
@@ -60,42 +43,8 @@ public interface PlanItemMapper extends BaseMapperX<PlanItemDO> {
|
||||
|
||||
List<OrderGoodsResp> selectNoOrderGoodsIdList(@Param(Constants.WRAPPER) Wrapper<PlanItemDO> wrapper,@Param("organId") Long organId);
|
||||
|
||||
List<OrderPlateIds> selectPlanIncrementPlate(@Param("noPlanIds") List<Long> noPlanIds,@Param("organId") Long organId);
|
||||
|
||||
|
||||
default List<PlanItemDO> selectOrderPlanList(Long orderId,Long organId) {
|
||||
return selectList( new LambdaQueryWrapperX<PlanItemDO>()
|
||||
.eq(PlanItemDO::getOrganId, organId)
|
||||
.eq(PlanItemDO::getOrderId,orderId)
|
||||
.select(PlanItemDO::getPlanId));
|
||||
}
|
||||
|
||||
|
||||
List<PlateDO> selectOrderPlanPlateListByPlanId(@Param("planId") Long planId, @Param("organId") Long organId);
|
||||
|
||||
|
||||
|
||||
default List<PlanItemDO> selectIsPlanPlateList(List<Long> orderIds, List<Long> plateIds,Long organId) {
|
||||
return selectList( new LambdaQueryWrapperX<PlanItemDO>()
|
||||
.eq(PlanItemDO::getOrganId, organId)
|
||||
.inIfPresent(PlanItemDO::getOrderId,orderIds)
|
||||
.inIfPresent(PlanItemDO::getPlateId,plateIds)
|
||||
.select(PlanItemDO::getPlanId));
|
||||
}
|
||||
|
||||
List<Long> selectOrderPlateList(@Param("orderIds") List<Long> orderIds,@Param("organId") Long organId);
|
||||
|
||||
Long selectIsCuttingPlate(@Param("planId") Long planId,@Param("organId") Long organId);
|
||||
|
||||
|
||||
default List<PlanItemDO> selectPlanOrderGoodsList(Long planId, List<Long> orderIds,Long organId) {
|
||||
return selectList( new LambdaQueryWrapperX<PlanItemDO>()
|
||||
.eq(PlanItemDO::getOrganId, organId)
|
||||
.eq(PlanItemDO::getPlanId,planId)
|
||||
.inIfPresent(PlanItemDO::getOrderId,orderIds)
|
||||
.select(PlanItemDO::getGoodsId));
|
||||
}
|
||||
|
||||
List<LabelOrderPlateData> selectLabelOrderPlateDataByPlanId(@Param("planId") Long planId, @Param("organId") Long organId);
|
||||
|
||||
|
||||
|
||||
+3
-12
@@ -31,6 +31,7 @@ import java.math.BigDecimal;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||
|
||||
@@ -121,10 +122,6 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
|
||||
List<PlateGoodsIdVO> selectPlateGoodsListByList(@Param("plates") List<Long> goodsIdList, @Param("orderId") Long orderId, @Param("organId") Long organId);
|
||||
|
||||
|
||||
List<NotPlanOrderPlateRespVO> selectGoodsPage( @Param(Constants.WRAPPER) Wrapper<PlateDO> wrapper);
|
||||
|
||||
|
||||
|
||||
void deletedById(@Param("plateIds") List<Long> plateIds, @Param("organId") Long organId);
|
||||
|
||||
|
||||
@@ -189,23 +186,17 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
|
||||
List<PlateRespVO> selectPlanPlateListDataSource(@Param("filed") String filed, @Param("field2") String field2,@Param("goodsIdList") List<Long> goodsIdList,@Param("orderIds") List<Long> orderIds,@Param("organId") Long organId);
|
||||
|
||||
|
||||
|
||||
default List<PlateDO> selectPlateIdList(List<Long> orderIds,List<Long> goodsIdList, Long organId) {
|
||||
default List<PlateDO> selectSelfincreasePlateIdList(Set<Long> orderIds, List<Long> planIds, Long organId) {
|
||||
return selectList(new LambdaQueryWrapperX<PlateDO>()
|
||||
.eq(PlateDO::getOrganId,organId)
|
||||
.eq(PlateDO::getDeleted,false)
|
||||
.inIfPresent(PlateDO::getOrderId,orderIds)
|
||||
.inIfPresent(PlateDO::getGoodsId,goodsIdList)
|
||||
.inIfPresent(PlateDO::getPlanId, planIds)
|
||||
.eq(PlateDO::getType, OrderPlateTypeEnum.SELFINCREASINGBOARD.getType())
|
||||
.select(PlateDO::getId,PlateDO::getGoodsId));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
List<PlatePage> selectNoPlanPlateList(@Param(Constants.WRAPPER) Wrapper<PlateDO> queryWrapperX2);
|
||||
|
||||
|
||||
void updatePlateOptimized(@Param("orderIdList") List<Long> orderIdList,@Param("ids") List<Long> ids,@Param("organId") Long organId);
|
||||
|
||||
void updatePlateIsOptimized(@Param("orderIdList") List<Long> orderIdList,@Param("ids") List<Long> ids,@Param("plateIds") List<Long> plateIds,@Param("organId") Long organId);
|
||||
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.cf.imes.module.executor.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* 未排订单查询方式枚举
|
||||
*
|
||||
* @author Gqr
|
||||
* @since 2025/7/1 16:39
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public enum OrderPlanQueryTypeEnum {
|
||||
ORDER_GROUP(0, "订单分组"),
|
||||
GOODS_GROUP(1, "板材分组");
|
||||
|
||||
/**
|
||||
* 类型编码
|
||||
*/
|
||||
private final Integer type;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private final String desc;
|
||||
}
|
||||
+50
-39
@@ -1,5 +1,6 @@
|
||||
package com.cf.imes.module.executor.service.optimizeplan;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
@@ -344,9 +345,9 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
AssertUtils.notEmpty(planDO,PLAN_NOT_EXISTS);
|
||||
|
||||
// 查询排单对应的大板信息
|
||||
List<GoodsReqVO> goodsDOS = goodsMapper.selectGoodsListByOrderIds(planId,getUserOrganId());
|
||||
List<GoodsReqVO> goodsDOS = goodsMapper.selectGoodsListByOrderIds(planId, getUserOrganId());
|
||||
|
||||
AssertUtils.notEmpty(goodsDOS,PLAN_GOODS_DATA_ERROR);
|
||||
AssertUtils.notEmpty(goodsDOS, PLAN_GOODS_DATA_ERROR);
|
||||
|
||||
String orderNos = Optional.ofNullable(planDO.getOrderNos()).orElse("[]");
|
||||
|
||||
@@ -358,7 +359,6 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
// 查询排单对应的小板信息
|
||||
List<PlateDetailRespVO> plateDetailRespVOS = planItemMapper.selectPlanPlateDetailList(planId,getUserOrganId());
|
||||
|
||||
|
||||
AssertUtils.notEmpty(plateDetailRespVOS,ORDER_PLAN_PLATE_ERROR);
|
||||
|
||||
for (PlateDetailRespVO plateDetailsRespVO : plateDetailRespVOS) {
|
||||
@@ -379,16 +379,18 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
AssertUtils.notEmpty(orderDOS,ORDER_PLAN_ERROR);
|
||||
|
||||
|
||||
// 造型数据的尺寸长度
|
||||
Integer orderModelSize = plateDetailRespVOS.size();
|
||||
|
||||
// 需要查询小板造型信息的板材ID
|
||||
List<Long> plateIds = plateDetailRespVOS.stream().map(PlateDetailRespVO::getPlateId).toList();
|
||||
|
||||
List<OrderModelDO> orderModelDOS = esUtils.getEsDocument(FIELD_PLATE_ID, plateIds, orderModelSize, ORDER_PLATE_MODEL.getIndex(), OrderModelDO.class);
|
||||
// 每一千块查询一次es
|
||||
List<List<Long>> batchPlateIdsList = batchProcess(plateIds);
|
||||
|
||||
AssertUtils.notEmpty(orderModelDOS,ORDER_PLAN_PLATE_MODEL_DATE_ERROR);
|
||||
List<OrderModelDO> orderModelDOS = new ArrayList<>();
|
||||
for (List<Long> plateIdsList : batchPlateIdsList) {
|
||||
orderModelDOS.addAll(esUtils.getEsDocument(FIELD_PLATE_ID, plateIdsList, plateIdsList.size(), ORDER_PLATE_MODEL.getIndex(), OrderModelDO.class));
|
||||
}
|
||||
|
||||
AssertUtils.notEmpty(orderModelDOS, ORDER_PLAN_PLATE_MODEL_DATE_ERROR);
|
||||
|
||||
|
||||
List<RemainPlateDO> remainPlateDOS = remainPlateMapper.selectByPlanId(planId,getUserOrganId());
|
||||
@@ -397,17 +399,12 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
List<OptimizeRemainPlate> optimizeRemainPlates = BeanUtils.toBean(remainPlateDOS, OptimizeRemainPlate.class);
|
||||
|
||||
|
||||
// 获取混单时选择的实际开料的大板信息
|
||||
List<PlanActualGoodsModelDO> planActualGoodsModelDOS = esUtils.getEsDocument(FIELD_PLAN_ID, planId, PLAN_ACTUAL_GOODS_MODEL.getIndex(), PlanActualGoodsModelDO.class);
|
||||
|
||||
|
||||
// 查询生产单对应的配件信息
|
||||
List<PrintOrderPartsRespVO> printOrderPartsRespVOS = orderPartsMapper.selectPartList(orderIds, getUserOrganId());
|
||||
|
||||
// 查询生产单对应的配件的ES信息
|
||||
List<OrderPartsRemark> orderPartsRemarks = esUtils.getEsDocument(FIELD_ORDER_ID, orderIds, printOrderPartsRespVOS.size(), ORDER_PARTS_REMARK_MODEL.getIndex(), OrderPartsRemark.class);
|
||||
|
||||
|
||||
// 查询生产单对应的包裹信息
|
||||
List<PrintOrderPackReqVO> printOrderPackReqVOS = plateMapper.selectPlanPackList(ids,getUserOrganId());
|
||||
|
||||
@@ -431,7 +428,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
.goodsList(goodsDOS)
|
||||
.plateList(plateDetailRespVOS)
|
||||
.plateModels(orderModelDOS)
|
||||
.planActualGoodsModelDO(CollUtil.isNotEmpty(planActualGoodsModelDOS) ? planActualGoodsModelDOS.get(0) : null)
|
||||
.planActualGoodsModelDO(BeanUtil.copyProperties(goodsDOS.get(0), PlanActualGoodsModelDO.class))
|
||||
.optimizeRemainPlates(optimizeRemainPlates)
|
||||
.orderPartsRespVOS(printOrderPartsRespVOS)
|
||||
.orderPartsRemarks(orderPartsRemarks)
|
||||
@@ -476,6 +473,11 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
processId = optimizeBoardModelDO.getProcessId();
|
||||
}
|
||||
|
||||
// 更新排单对应小板优化属性
|
||||
plateMapper.update(new LambdaUpdateWrapper<PlateDO>()
|
||||
.eq(PlateDO::getPlanId, planId)
|
||||
.eq(PlateDO::getOrganId, getUserOrganId())
|
||||
.set(PlateDO::getIsOptimized, true));
|
||||
|
||||
if(req.getProcessId() != null){
|
||||
|
||||
@@ -507,18 +509,6 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
esUtils.deleteEsDocument(FIELD_PLAN_ID, FIELD_PLAN_CONFIG_ID, planId, req.getPlanConfigId(), ORDER_OPTIMIZE_PLATE_MODEL.getIndex());
|
||||
}
|
||||
|
||||
|
||||
List<PlateDO> plateDOS = planItemMapper.selectOrderPlanPlateListByPlanId(planId,getUserOrganId());
|
||||
|
||||
if(CollUtil.isNotEmpty(plateDOS)) {
|
||||
|
||||
plateDOS.forEach(f -> {
|
||||
f.setIsOptimized(true);
|
||||
});
|
||||
|
||||
plateMapper.updateBatch(plateDOS);
|
||||
}
|
||||
|
||||
boardModelDO.setIsNewInsertPlate(Boolean.FALSE);
|
||||
|
||||
|
||||
@@ -561,15 +551,11 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
List<Long> planConfigIds = schemeModelDOS.stream().map(SaveProcessSchemeModelDO::getPlanConfigId).distinct().toList();
|
||||
|
||||
List<PlateDO> plateDOS = planItemMapper.selectOrderPlanPlateListByPlanId(planId,getUserOrganId());
|
||||
|
||||
|
||||
if(CollUtil.isNotEmpty(plateDOS)) {
|
||||
|
||||
plateDOS.forEach(f -> f.setIsOptimized(true));
|
||||
|
||||
plateMapper.updateBatch(plateDOS);
|
||||
}
|
||||
// 更新排单对应小板优化属性
|
||||
plateMapper.update(new LambdaUpdateWrapper<PlateDO>()
|
||||
.eq(PlateDO::getPlanId, planId)
|
||||
.eq(PlateDO::getOrganId, getUserOrganId())
|
||||
.set(PlateDO::getIsOptimized, true));
|
||||
|
||||
|
||||
// 如果方案组ID不相等,就删除旧的方案组信息,再保存新的加工方案组ID
|
||||
@@ -804,7 +790,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
.index(ORDER_PLATE_MODEL.getIndex())
|
||||
.query(q -> q.bool(b -> b
|
||||
.filter(f -> f.terms(t -> t
|
||||
.field("orderId")
|
||||
.field(FIELD_ORDER_ID)
|
||||
.terms(e -> e.value(orderIds.stream().map(FieldValue::of).toList()))
|
||||
))
|
||||
.filter(f -> f.terms(t -> t
|
||||
@@ -826,12 +812,12 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
.size(1000)
|
||||
.sort(s -> s.field(f -> f.field("id.keyword").order(SortOrder.Asc)))
|
||||
.query(q -> q.bool(b -> b
|
||||
.filter(f -> f.terms(t -> t.field("orderId").terms(e -> e.value(orderIds.stream().map(FieldValue::of).toList()))))
|
||||
.filter(f -> f.terms(t -> t.field(FIELD_ORDER_ID).terms(e -> e.value(orderIds.stream().map(FieldValue::of).toList()))))
|
||||
.filter(f -> f.terms(t -> t.field("plateGoodsId").terms(e -> e.value(orderGoodsIds.stream().map(FieldValue::of).toList()))))
|
||||
))
|
||||
.source(s -> s
|
||||
.filter(f -> f
|
||||
.includes("holeDetail", "sideHoleDetail", "contourDetail", "sideDetail", "id", "plateId", "pointDetail",
|
||||
.includes("holeDetail", "sideHoleDetail", "contourDetail", "sideDetail", "id", FIELD_PLATE_ID, "pointDetail",
|
||||
"rawPointDetail", "splitLength", "splitWidth", "offsetX", "offsetY")
|
||||
)
|
||||
)
|
||||
@@ -1699,5 +1685,30 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 拆分list,每个1000条
|
||||
*
|
||||
* @param dataList
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
private <T> List<List<T>> batchProcess(List<T> dataList) {
|
||||
List<List<T>> resultList = new ArrayList<>();
|
||||
if (CollUtil.isEmpty(dataList)) {
|
||||
return resultList;
|
||||
}
|
||||
|
||||
int total = dataList.size();
|
||||
for (int i = 0; i < total; i += 1000) {
|
||||
int end = Math.min(i + 1000, total);
|
||||
List<T> subList = dataList.subList(i, end);
|
||||
|
||||
if (!subList.isEmpty()) {
|
||||
resultList.add(subList);
|
||||
}
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+408
-336
File diff suppressed because it is too large
Load Diff
+210
-80
@@ -1,12 +1,14 @@
|
||||
package com.cf.imes.module.executor.service.plate;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import co.elastic.clients.elasticsearch.ElasticsearchClient;
|
||||
import co.elastic.clients.elasticsearch._types.FieldValue;
|
||||
import co.elastic.clients.elasticsearch.core.SearchRequest;
|
||||
import co.elastic.clients.elasticsearch.core.SearchResponse;
|
||||
import co.elastic.clients.elasticsearch.core.search.Hit;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||
@@ -16,13 +18,11 @@ import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.es.core.service.ESDocumentService;
|
||||
import com.cf.imes.framework.id.core.util.SnowflakeIdWorker3rd;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.framework.mybatis.core.query.MPJLambdaWrapperX;
|
||||
import com.cf.imes.framework.mybatis.core.query.QueryWrapperX;
|
||||
import com.cf.imes.module.executor.controller.admin.goods.vo.GoodsSaveReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.OrderGoodsResp;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderPlanPlateNumAndAreaRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.PlateResList;
|
||||
import com.cf.imes.module.executor.controller.admin.plate.vo.*;
|
||||
import com.cf.imes.module.executor.dal.dataobject.goods.GoodsDO;
|
||||
@@ -31,7 +31,6 @@ import com.cf.imes.module.executor.dal.dataobject.orderBody.OrderBodyDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderItem.OrderItemDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.ordermodel.OrderModelDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.plan.PlanDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.planitem.PlanItemDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.plate.PlateDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.plate.PlateGoodDO;
|
||||
import com.cf.imes.module.executor.dal.mysql.goods.GoodsMapper;
|
||||
@@ -39,14 +38,11 @@ import com.cf.imes.module.executor.dal.mysql.order.OrderMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.orderBody.OrderBodyMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.orderItem.OrderItemMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.plan.PlanMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.planItem.PlanItemMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.plate.PlateGoodMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.plate.PlateMapper;
|
||||
import com.cf.imes.module.executor.enums.OrderItemType;
|
||||
import com.cf.imes.module.executor.enums.OrderStatusEnum;
|
||||
import com.cf.imes.module.executor.service.order.OrderInputProcessor;
|
||||
import com.cf.imes.module.executor.service.plan.PlanService;
|
||||
import com.cf.imes.module.executor.util.elasticsearch.EsUtils;
|
||||
import com.cf.imes.module.system.enums.ErrorCodeConstants;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -98,9 +94,6 @@ public class PlateServiceImpl implements PlateService {
|
||||
@Resource
|
||||
private OrderMapper orderMapper;
|
||||
|
||||
@Resource
|
||||
private PlanItemMapper planItemMapper;
|
||||
|
||||
|
||||
@Resource
|
||||
private SnowflakeIdWorker3rd idWorker;
|
||||
@@ -108,18 +101,9 @@ public class PlateServiceImpl implements PlateService {
|
||||
@Resource
|
||||
private ElasticsearchClient elasticsearchClient;
|
||||
|
||||
@Resource
|
||||
private PlanService planService;
|
||||
|
||||
@Resource
|
||||
private ESDocumentService esDocumentService;
|
||||
|
||||
@Resource
|
||||
private OrderInputProcessor orderInputProcessor;
|
||||
|
||||
@Resource
|
||||
private EsUtils esUtils;
|
||||
|
||||
@Resource
|
||||
private IdentifierGenerator identifierGenerator;
|
||||
|
||||
@@ -151,7 +135,7 @@ public class PlateServiceImpl implements PlateService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deletePlate(List<Long> plateIds,Long planId) {
|
||||
public void deletePlate(List<Long> plateIds, Long planId) {
|
||||
|
||||
if(CollUtil.isEmpty(plateIds)){
|
||||
return;
|
||||
@@ -207,22 +191,108 @@ public class PlateServiceImpl implements PlateService {
|
||||
orderItemMapper.deleteByPlateId(plateIdList, orderIds, getUserOrganId());
|
||||
|
||||
// 删除添加自增板时新增的大板ID
|
||||
List<Long> plateId = goodsMapper.selectInsertGoodsIds(orderIds, goodsIds, getUserOrganId());
|
||||
|
||||
|
||||
if(CollUtil.isNotEmpty(plateId)){
|
||||
goodsMapper.deleteBatchIds(plateId);
|
||||
List<Long> orderGoodsIdList = goodsMapper.selectInsertGoodsIds(orderIds, goodsIds, getUserOrganId());
|
||||
if(CollUtil.isNotEmpty(orderGoodsIdList)){
|
||||
goodsMapper.deleteBatchIds(orderGoodsIdList);
|
||||
}
|
||||
|
||||
// 统计更新板件数量和面积
|
||||
computePlatePlanAndComputeOrderGoodsInfo(plateDOS.stream()
|
||||
.collect(Collectors.groupingBy(
|
||||
PlateDO::getGoodsId,
|
||||
Collectors.mapping(PlateDO::getId, Collectors.toList())
|
||||
)));
|
||||
computeOrderInfo(orderIds);
|
||||
|
||||
// 删除排单和板材明细的小板信息
|
||||
planItemMapper.delete(new LambdaQueryWrapperX<PlanItemDO>()
|
||||
.eq(PlanItemDO::getOrganId, getUserOrganId())
|
||||
.in(PlanItemDO::getOrderId,orderIds)
|
||||
.in(PlanItemDO::getPlateId,plateIdList)
|
||||
.eq(PlanItemDO::getPlanId, planId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计更新order_goods的小板数量和面积
|
||||
*
|
||||
* @param goodsPlateIdMap
|
||||
*/
|
||||
public void computePlatePlanAndComputeOrderGoodsInfo(Map<Long, List<Long>> goodsPlateIdMap) {
|
||||
for (Map.Entry<Long, List<Long>> entry : goodsPlateIdMap.entrySet()) {
|
||||
Long orderGoodsId = entry.getKey();
|
||||
// 查询version
|
||||
GoodsDO goodsDO = goodsMapper.selectById(orderGoodsId);
|
||||
|
||||
int version = goodsDO.getVersion();
|
||||
// 统计每个order_goods下的未排单面积,更新到order_goods中
|
||||
OrderPlanPlateNumAndAreaRespVO goodsPlateNumAndAreaPlanInfo = goodsMapper.selectPlannedPlateNumAndArea(orderGoodsId);
|
||||
int update = goodsMapper.update(new LambdaUpdateWrapper<GoodsDO>()
|
||||
.eq(GoodsDO::getId, orderGoodsId)
|
||||
.eq(GoodsDO::getVersion, version)
|
||||
.set(GoodsDO::getPlannedPlateArea, goodsPlateNumAndAreaPlanInfo.getArea())
|
||||
.set(GoodsDO::getPlannedPlateNum, goodsPlateNumAndAreaPlanInfo.getNum())
|
||||
.set(GoodsDO::getVersion, version + 1));
|
||||
if (update == 0) {
|
||||
throw ServiceExceptionUtil.exception(com.cf.imes.module.executor.enums.ErrorCodeConstants.GOODS_PLATE_UPDATE_CONCURRENCY_ERROR, orderGoodsId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计更新orders的小板数量和面积
|
||||
*
|
||||
* @param orderIdList
|
||||
*/
|
||||
public void computeOrderInfo(List<Long> orderIdList) {
|
||||
for (Long orderId : orderIdList) {
|
||||
// 统计每个orders下的未排单面积,更新到orders中
|
||||
OrderDO orderDO = orderMapper.selectById(orderId);
|
||||
OrderPlanPlateNumAndAreaRespVO orderPlateNumAndAreaPlanInfo = orderMapper.selectPlannedPlateNumAndArea(orderId);
|
||||
|
||||
// 当前生产单下排单的板件数量
|
||||
Integer num = orderPlateNumAndAreaPlanInfo.getNum();
|
||||
|
||||
int version = orderDO.getVersion();
|
||||
LambdaUpdateWrapper<OrderDO> updateWrapper = new LambdaUpdateWrapper<OrderDO>()
|
||||
.eq(OrderDO::getId, orderId)
|
||||
.eq(OrderDO::getVersion, version)
|
||||
.set(OrderDO::getPlannedPlateArea, orderPlateNumAndAreaPlanInfo.getArea())
|
||||
.set(OrderDO::getPlannedPlateNum, num)
|
||||
.set(OrderDO::getVersion, version + 1);
|
||||
Integer orderDOStatus = orderDO.getStatus();
|
||||
// 更新生产单排单状态
|
||||
if (ObjectUtil.notEqual(orderDOStatus, OrderStatusEnum.IN_PRODUCTION.getStatus()) && ObjectUtil.notEqual(orderDOStatus, OrderStatusEnum.SORTED.getStatus())) {
|
||||
// 如果生产单下已经没有排单板件,更新生产单为新单
|
||||
if (num == 0) {
|
||||
updateWrapper.set(OrderDO::getStatus, OrderStatusEnum.NEW_ORDER.getStatus());
|
||||
} else {
|
||||
updateWrapper.set(OrderDO::getStatus, OrderStatusEnum.SORTED.getStatus());
|
||||
}
|
||||
}
|
||||
int update = orderMapper.update(updateWrapper);
|
||||
if (update == 0) {
|
||||
throw ServiceExceptionUtil.exception(com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_PLATE_UPDATE_CONCURRENCY_ERROR, orderId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 拆分list,每个1000条
|
||||
*
|
||||
* @param dataList
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
private <T> List<List<T>> batchProcess(List<T> dataList) {
|
||||
List<List<T>> resultList = new ArrayList<>();
|
||||
if (CollUtil.isEmpty(dataList)) {
|
||||
return resultList;
|
||||
}
|
||||
|
||||
int total = dataList.size();
|
||||
for (int i = 0; i < total; i += 1000) {
|
||||
int end = Math.min(i + 1000, total);
|
||||
List<T> subList = dataList.subList(i, end);
|
||||
|
||||
if (!subList.isEmpty()) {
|
||||
resultList.add(subList);
|
||||
}
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
private void validatePlateExists(Long id) {
|
||||
@@ -265,7 +335,6 @@ public class PlateServiceImpl implements PlateService {
|
||||
.eq("o.organ_id",organId)
|
||||
.eq("o.deleted",false)
|
||||
.in("o.status",statusList)
|
||||
.isNull("opi.plan_id")
|
||||
.isNotNull("op.id")
|
||||
.eq("op.deleted",false);
|
||||
|
||||
@@ -274,37 +343,40 @@ public class PlateServiceImpl implements PlateService {
|
||||
|
||||
Long planId = pageReqVO.getPlanId();
|
||||
|
||||
List<OrderGoodsResp> goodsRespVOS = planMapper.selectPlanGoodsList(planId, organId);
|
||||
|
||||
AssertUtils.notEmpty(goodsRespVOS,PLAN_NOT_EXISTS);
|
||||
|
||||
PlanDO planDO = planMapper.selectById(planId);
|
||||
|
||||
AssertUtils.notEmpty(planDO,PLAN_NOT_EXISTS);
|
||||
AssertUtils.notEmpty(planDO, PLAN_NOT_EXISTS);
|
||||
|
||||
List<PlateGoodDO> planGoods = plateGoodMapper.selectList(new LambdaQueryWrapper<PlateGoodDO>()
|
||||
.eq(PlateGoodDO::getGoodsId, planDO.getGoodsId())
|
||||
.eq(PlateGoodDO::getOrganId, organId)
|
||||
.eq(PlateGoodDO::getDeleted, false)
|
||||
.orderByAsc(PlateGoodDO::getCreateTime));
|
||||
|
||||
AssertUtils.notEmpty(planGoods, PLAN_NOT_EXISTS);
|
||||
|
||||
List<String> material = goodsRespVOS.stream().map(OrderGoodsResp::getMaterial).distinct().toList();
|
||||
PlateGoodDO planGood = planGoods.get(0);
|
||||
String material = planGood.getMaterial();
|
||||
|
||||
List<String> color = goodsRespVOS.stream().map(OrderGoodsResp::getColor).distinct().toList();
|
||||
String color = planGood.getColor();
|
||||
|
||||
List<String> brand = goodsRespVOS.stream().map(OrderGoodsResp::getBrand).distinct().toList();
|
||||
String brand = planGood.getBrand();
|
||||
|
||||
List<BigDecimal> thickness = goodsRespVOS.stream().map(OrderGoodsResp::getThickness).distinct().toList();
|
||||
Double thickness = planGood.getThickness();
|
||||
|
||||
|
||||
// 混单
|
||||
if(planDO.getType().equals(PlanTypeEnum.MIXEDORDERPLAN.getType())){
|
||||
|
||||
// 混单添加查询条件
|
||||
mixedInsertQuery(pageReqVO,planDO,material,thickness,queryWrapperX);
|
||||
mixedInsertQuery(pageReqVO, planDO, material, thickness, queryWrapperX);
|
||||
|
||||
}
|
||||
// 非混单
|
||||
else {
|
||||
|
||||
// 非混单条件查询条件
|
||||
noMixedInsertQuery(pageReqVO,planDO,material,brand,color,thickness,queryWrapperX);
|
||||
noMixedInsertQuery(pageReqVO, planDO, material, brand, color, thickness, queryWrapperX);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -335,7 +407,7 @@ public class PlateServiceImpl implements PlateService {
|
||||
.eqIfPresent("op.is_sculpt",pageReqVO.getIsSculpt())
|
||||
.eqIfPresent("op.is_row_hole",pageReqVO.getIsRowHole())
|
||||
.likeIfPresent("op.remark",pageReqVO.getRemark())
|
||||
.orderByDesc("o.id");
|
||||
.orderByDesc("o.id, op.id");
|
||||
|
||||
|
||||
Integer pageNo = (pageReqVO.getPageNo() - 1) * pageReqVO.getPageSize();
|
||||
@@ -455,8 +527,6 @@ public class PlateServiceImpl implements PlateService {
|
||||
|
||||
List<OrderItemDO> orderItemDOS = new ArrayList<>();
|
||||
|
||||
List<PlanItemDO> planItemDOS = new ArrayList<>();
|
||||
|
||||
List<InsertPlateRespVO> insertPlateRespVOS = new ArrayList<>();
|
||||
|
||||
List<OrderBodyNumVO> orderBodyNumVOS = new ArrayList<>();
|
||||
@@ -470,13 +540,16 @@ public class PlateServiceImpl implements PlateService {
|
||||
|
||||
List<Long> orderIds = reqVO.stream().map(OptimizationSavePlateReqVO::getOrderId).distinct().toList();
|
||||
|
||||
List<PlanItemDO> planItemDOList = planItemMapper.selectPlanOrderGoodsList(planId, orderIds, getUserOrganId());
|
||||
|
||||
List<Long> goodsId = planItemDOList.stream().map(PlanItemDO::getGoodsId).distinct().toList();
|
||||
// 查询排单下的orderGoodsId列表
|
||||
List<Long> goodsId = planMapper.selectPlanOrderGoodsId(planId,orderIds, getUserOrganId());
|
||||
|
||||
List<GoodsDO> goodsDOS = goodsMapper.selectBatchIds(goodsId);
|
||||
|
||||
Map<Long, OrderPlanPlateNumAndAreaRespVO> orderPlanPlateNumAndAreaRespVOMap = new HashMap<>();
|
||||
|
||||
Map<Long, OrderPlanPlateNumAndAreaRespVO> orderGoodsPlanPlateNumAndAreaRespVOMap = new HashMap<>();
|
||||
|
||||
// 组装新增数据
|
||||
reqVO.forEach(f->{
|
||||
|
||||
Map<String,String> plateIdAndNo = new HashMap<>();
|
||||
@@ -504,6 +577,9 @@ public class PlateServiceImpl implements PlateService {
|
||||
|
||||
plateIdAndNo.put(plateId.toString(),plateNo);
|
||||
|
||||
// 计算面积
|
||||
BigDecimal area = f.getWidth().multiply(f.getHeight()).movePointLeft(6).stripTrailingZeros();
|
||||
|
||||
plateDOS.add(PlateDO.builder()
|
||||
.id(plateId)
|
||||
.orderId(orderId)
|
||||
@@ -515,7 +591,7 @@ public class PlateServiceImpl implements PlateService {
|
||||
.goodsId(goodsDO.getId())
|
||||
.holeFace(f.getPlaceHole())
|
||||
.remark(remake1 + remake2)
|
||||
.area(f.getWidth().multiply(f.getHeight()).movePointLeft(6).stripTrailingZeros())
|
||||
.area(area)
|
||||
.width(f.getWidth())
|
||||
.height(f.getHeight())
|
||||
.texture(f.getTexture())
|
||||
@@ -523,6 +599,7 @@ public class PlateServiceImpl implements PlateService {
|
||||
.sealRight(f.getSealRight())
|
||||
.sealUp(f.getSealUp())
|
||||
.sealDown(f.getSealDown())
|
||||
.planId(f.getPlanId())
|
||||
.build());
|
||||
|
||||
|
||||
@@ -546,21 +623,21 @@ public class PlateServiceImpl implements PlateService {
|
||||
.plateId(plateId)
|
||||
.build());
|
||||
|
||||
planItemDOS.add(PlanItemDO.builder()
|
||||
.planId(f.getPlanId())
|
||||
.goodsId(goodsDO.getId())
|
||||
.orderId(f.getOrderId())
|
||||
.plateId(plateId)
|
||||
.build());
|
||||
|
||||
|
||||
insertPlateRespVOS.add(InsertPlateRespVO.builder()
|
||||
.blockKey(f.getBlockKey())
|
||||
.plateNo(plateIdAndNo)
|
||||
.build());
|
||||
|
||||
});
|
||||
// 累加生产单板数和面积
|
||||
orderPlanPlateNumAndAreaRespVOMap.putIfAbsent(orderId, new OrderPlanPlateNumAndAreaRespVO(0, BigDecimal.ZERO));
|
||||
OrderPlanPlateNumAndAreaRespVO orderPlanPlateNumAndAreaRespVO = orderPlanPlateNumAndAreaRespVOMap.get(orderId);
|
||||
orderPlanPlateNumAndAreaRespVO.setArea(orderPlanPlateNumAndAreaRespVO.getArea().add(area)).setNum(orderPlanPlateNumAndAreaRespVO.getNum() + 1);
|
||||
|
||||
// 累加订单材质板数和面积
|
||||
orderGoodsPlanPlateNumAndAreaRespVOMap.putIfAbsent(orderId, new OrderPlanPlateNumAndAreaRespVO(0, BigDecimal.ZERO));
|
||||
OrderPlanPlateNumAndAreaRespVO orderGoodsPlanPlateNumAndAreaRespVO = orderGoodsPlanPlateNumAndAreaRespVOMap.get(orderId);
|
||||
orderGoodsPlanPlateNumAndAreaRespVO.setArea(orderGoodsPlanPlateNumAndAreaRespVO.getArea().add(area)).setNum(orderGoodsPlanPlateNumAndAreaRespVO.getNum() + 1);
|
||||
});
|
||||
|
||||
plateMapper.insertBatch(plateDOS);
|
||||
|
||||
@@ -584,16 +661,71 @@ public class PlateServiceImpl implements PlateService {
|
||||
|
||||
orderBodyMapper.updateBatch(orderBodyDOS);
|
||||
|
||||
|
||||
planItemMapper.insertBatch(planItemDOS);
|
||||
|
||||
orderItemMapper.insertBatch(orderItemDOS);
|
||||
|
||||
// 更新生产单和材质板数量和面积
|
||||
updateOrdersPlanPlateNumAndArea(orderPlanPlateNumAndAreaRespVOMap);
|
||||
updateOrderGoodsPlanPlateNumAndArea(orderGoodsPlanPlateNumAndAreaRespVOMap);
|
||||
|
||||
orderInputProcessor.batchSaveModel(orderPlateModelDOS);
|
||||
|
||||
return insertPlateRespVOS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新生产单板件数量和面积
|
||||
*
|
||||
* @param orderPlanPlateNumAndAreaRespVOS
|
||||
*/
|
||||
private void updateOrdersPlanPlateNumAndArea(Map<Long, OrderPlanPlateNumAndAreaRespVO> orderPlanPlateNumAndAreaRespVOS) {
|
||||
for (Map.Entry<Long, OrderPlanPlateNumAndAreaRespVO> entry : orderPlanPlateNumAndAreaRespVOS.entrySet()) {
|
||||
Long orderId = entry.getKey();
|
||||
OrderDO orderDO = orderMapper.selectById(orderId);
|
||||
|
||||
OrderPlanPlateNumAndAreaRespVO orderPlateNumAndAreaPlanInfo = entry.getValue();
|
||||
|
||||
int version = orderDO.getVersion();
|
||||
LambdaUpdateWrapper<OrderDO> updateWrapper = new LambdaUpdateWrapper<OrderDO>()
|
||||
.eq(OrderDO::getId, orderId)
|
||||
.eq(OrderDO::getVersion, version)
|
||||
.set(OrderDO::getArea, orderPlateNumAndAreaPlanInfo.getArea().add(BigDecimal.valueOf(orderDO.getArea())))
|
||||
.set(OrderDO::getPlannedPlateArea, orderPlateNumAndAreaPlanInfo.getArea())
|
||||
.set(OrderDO::getPlannedPlateNum, orderPlateNumAndAreaPlanInfo.getNum())
|
||||
.set(OrderDO::getPlateNum, orderPlateNumAndAreaPlanInfo.getNum() + orderDO.getPlateNum())
|
||||
.set(OrderDO::getVersion, version + 1);
|
||||
int update = orderMapper.update(updateWrapper);
|
||||
if (update == 0) {
|
||||
throw ServiceExceptionUtil.exception(com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_PLATE_UPDATE_CONCURRENCY_ERROR, orderId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新订单材质板件数量和面积
|
||||
*
|
||||
* @param orderGoodsPlanPlateNumAndAreaRespVOS
|
||||
*/
|
||||
private void updateOrderGoodsPlanPlateNumAndArea(Map<Long, OrderPlanPlateNumAndAreaRespVO> orderGoodsPlanPlateNumAndAreaRespVOS) {
|
||||
for (Map.Entry<Long, OrderPlanPlateNumAndAreaRespVO> entry : orderGoodsPlanPlateNumAndAreaRespVOS.entrySet()) {
|
||||
Long orderGoodsId = entry.getKey();
|
||||
// 查询version
|
||||
GoodsDO goodsDO = goodsMapper.selectById(orderGoodsId);
|
||||
|
||||
int version = goodsDO.getVersion();
|
||||
OrderPlanPlateNumAndAreaRespVO goodsPlateNumAndAreaPlanInfo = entry.getValue();
|
||||
int update = goodsMapper.update(new LambdaUpdateWrapper<GoodsDO>()
|
||||
.eq(GoodsDO::getId, orderGoodsId)
|
||||
.eq(GoodsDO::getVersion, version)
|
||||
.set(GoodsDO::getArea, goodsPlateNumAndAreaPlanInfo.getArea().add(BigDecimal.valueOf(goodsDO.getArea())))
|
||||
.set(GoodsDO::getPlannedPlateArea, goodsPlateNumAndAreaPlanInfo.getArea().add(BigDecimal.valueOf(goodsDO.getPlannedPlateArea())))
|
||||
.set(GoodsDO::getPlannedPlateNum, goodsPlateNumAndAreaPlanInfo.getNum() + goodsDO.getPlannedPlateNum())
|
||||
.set(GoodsDO::getPlateNum, goodsPlateNumAndAreaPlanInfo.getNum() + goodsDO.getPlateNum())
|
||||
.set(GoodsDO::getVersion, version + 1));
|
||||
if (update == 0) {
|
||||
throw ServiceExceptionUtil.exception(com.cf.imes.module.executor.enums.ErrorCodeConstants.GOODS_PLATE_UPDATE_CONCURRENCY_ERROR, orderGoodsId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -645,8 +777,8 @@ public class PlateServiceImpl implements PlateService {
|
||||
|
||||
private void mixedInsertQuery(NoPlanPlatePageReqVO pageReqVO,
|
||||
PlanDO planDO,
|
||||
List<String> material,
|
||||
List<BigDecimal> thickness,
|
||||
String material,
|
||||
Double thickness,
|
||||
QueryWrapperX<OrderDO> queryWrapperX){
|
||||
|
||||
|
||||
@@ -659,10 +791,10 @@ public class PlateServiceImpl implements PlateService {
|
||||
if(planDO.getFilter().equals(MixConfigTypeEnum.SAMEMATERIALANDTHICKNESS.getType())){
|
||||
|
||||
queryWrapperX
|
||||
.inIfPresent(FIELD_OG_MATERIAL,material)
|
||||
.eqIfPresent(FIELD_OG_MATERIAL,material)
|
||||
.likeIfPresent(FIELD_OG_BRAND,pageReqVO.getBrand())
|
||||
.likeIfPresent(FIELD_OG_COLOR,pageReqVO.getColor())
|
||||
.inIfPresent(FIELD_OP_THICKNESS,thickness);
|
||||
.eqIfPresent(FIELD_OP_THICKNESS,thickness);
|
||||
|
||||
}
|
||||
// 相同厚度
|
||||
@@ -672,7 +804,7 @@ public class PlateServiceImpl implements PlateService {
|
||||
.likeIfPresent(FIELD_OG_MATERIAL,pageReqVO.getMaterial())
|
||||
.likeIfPresent(FIELD_OG_BRAND,pageReqVO.getBrand())
|
||||
.likeIfPresent(FIELD_OG_COLOR,pageReqVO.getColor())
|
||||
.inIfPresent(FIELD_OP_THICKNESS,thickness);
|
||||
.eqIfPresent(FIELD_OP_THICKNESS,thickness);
|
||||
|
||||
}
|
||||
|
||||
@@ -685,10 +817,10 @@ public class PlateServiceImpl implements PlateService {
|
||||
|
||||
private void noMixedInsertQuery(NoPlanPlatePageReqVO pageReqVO,
|
||||
PlanDO planDO,
|
||||
List<String> material,
|
||||
List<String> brand,
|
||||
List<String> color,
|
||||
List<BigDecimal> thickness,
|
||||
String material,
|
||||
String brand,
|
||||
String color,
|
||||
Double thickness,
|
||||
QueryWrapperX<OrderDO> queryWrapperX){
|
||||
|
||||
// 是否开启混单
|
||||
@@ -701,10 +833,10 @@ public class PlateServiceImpl implements PlateService {
|
||||
// 相同材质和厚度 混单
|
||||
if(pageReqVO.getMixedType().equals(MixConfigTypeEnum.SAMEMATERIALANDTHICKNESS.getType())){
|
||||
queryWrapperX
|
||||
.inIfPresent(FIELD_OG_MATERIAL, material)
|
||||
.eqIfPresent(FIELD_OG_MATERIAL, material)
|
||||
.likeIfPresent(FIELD_OG_BRAND, pageReqVO.getBrand())
|
||||
.likeIfPresent(FIELD_OG_COLOR, pageReqVO.getColor())
|
||||
.inIfPresent(FIELD_OP_THICKNESS, thickness);
|
||||
.eqIfPresent(FIELD_OP_THICKNESS, thickness);
|
||||
|
||||
}
|
||||
// 相同厚度 混单
|
||||
@@ -713,21 +845,19 @@ public class PlateServiceImpl implements PlateService {
|
||||
.likeIfPresent(FIELD_OG_MATERIAL, pageReqVO.getMaterial())
|
||||
.likeIfPresent(FIELD_OG_BRAND, pageReqVO.getBrand())
|
||||
.likeIfPresent(FIELD_OG_COLOR, pageReqVO.getColor())
|
||||
.inIfPresent(FIELD_OP_THICKNESS, thickness);
|
||||
.eqIfPresent(FIELD_OP_THICKNESS, thickness);
|
||||
|
||||
}
|
||||
}else {
|
||||
queryWrapperX
|
||||
.inIfPresent(FIELD_OG_MATERIAL, material)
|
||||
.inIfPresent(FIELD_OG_BRAND, brand)
|
||||
.inIfPresent(FIELD_OG_COLOR, color)
|
||||
.inIfPresent(FIELD_OP_THICKNESS, thickness);
|
||||
.eqIfPresent(FIELD_OG_MATERIAL, material)
|
||||
.eqIfPresent(FIELD_OG_BRAND, brand)
|
||||
.eqIfPresent(FIELD_OG_COLOR, color)
|
||||
.eqIfPresent(FIELD_OP_THICKNESS, thickness);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
+18
-5
@@ -110,7 +110,8 @@ public class ApiTypeRealize {
|
||||
ApiDataTypeVo platesData = results.get("plate").get();
|
||||
|
||||
// 判断是不是空单
|
||||
if (order.getOrderDO().getStatus() == 0) {
|
||||
OrderDO orderDO = order.getOrderDO();
|
||||
if (orderDO.getStatus() == 0) {
|
||||
return order;
|
||||
}
|
||||
|
||||
@@ -122,7 +123,8 @@ public class ApiTypeRealize {
|
||||
|
||||
// 小板数据补充,order_goods_id添加造型相关数据判断获取,以及配件中添加goods_id
|
||||
// 用方法实现,小板中添加其他信息,以及更新goods_id
|
||||
updateSmallBoardInfo(goodsData.getMapGoodsDO(),
|
||||
updateSmallBoardInfo(orderDO,
|
||||
goodsData.getMapGoodsDO(),
|
||||
plateDetailData.getMapPlateDetails(),
|
||||
platesData.getMapPlatesInfos(),
|
||||
plateDetailData.getMapPlateDetails());
|
||||
@@ -198,7 +200,7 @@ public class ApiTypeRealize {
|
||||
|
||||
// 结果整理
|
||||
ApiDataTypeVo apiDataTypeVo = new ApiDataTypeVo();
|
||||
apiDataTypeVo.setOrderDO(order.getOrderDO()).setMapGoodsDO(goodsData.getMapGoodsDO()).setMapRawGoodsDO(goodsData.getMapRawGoodsDO())
|
||||
apiDataTypeVo.setOrderDO(orderDO).setMapGoodsDO(goodsData.getMapGoodsDO()).setMapRawGoodsDO(goodsData.getMapRawGoodsDO())
|
||||
.setMapOrderBodyDO(mapOrderBodyDO).setMapOrderGroupDO(mapOrderGroupDO).setMapItem(mapItem)
|
||||
.setMapPartsInfos(partsData.getMapPartsInfos()).setMapPartRemarks(partsData.getMapPartRemarks())
|
||||
.setMapPlateDetails(plateDetailData.getMapPlateDetails()).setMapPlatesInfos(platesData.getMapPlatesInfos());
|
||||
@@ -207,7 +209,8 @@ public class ApiTypeRealize {
|
||||
}
|
||||
|
||||
// 用方法实现,小板中添加其他信息,以及更新goods_id
|
||||
private void updateSmallBoardInfo(Map<String, GoodsDO> mapGoodsDO,
|
||||
private void updateSmallBoardInfo(OrderDO orderDO,
|
||||
Map<String, GoodsDO> mapGoodsDO,
|
||||
Map<String, PlateDetail> mapPlateDetails,
|
||||
Map<String, PlateDO> mapPlatesInfos,
|
||||
Map<String, PlateDetail> mapPlateDetailsRemarks) {
|
||||
@@ -232,7 +235,17 @@ public class ApiTypeRealize {
|
||||
return;
|
||||
}
|
||||
// goods_id更换
|
||||
v.setGoodsId(mapGoodsDO.get(String.valueOf(v.getGoodsId())).getId());
|
||||
GoodsDO goodsDO = mapGoodsDO.get(String.valueOf(v.getGoodsId()));
|
||||
v.setGoodsId(goodsDO.getId());
|
||||
|
||||
// 累加goods板件数量和面积
|
||||
goodsDO.setPlateNum(goodsDO.getPlateNum() + 1);
|
||||
goodsDO.setArea(goodsDO.getArea() + v.getArea().doubleValue());
|
||||
|
||||
// 累加生产单的板件数量和面积
|
||||
orderDO.setPlateNum(orderDO.getPlateNum() + 1);
|
||||
orderDO.setArea(orderDO.getArea() + v.getArea().doubleValue());
|
||||
|
||||
// 添加其他信息
|
||||
// 获取小板对应的造型信息
|
||||
PlateDetail plateDetail = mapPlateDetails.get(k);
|
||||
|
||||
+13
-12
@@ -37,11 +37,11 @@
|
||||
og.remark,
|
||||
orp.id as remainId
|
||||
|
||||
from order_goods og
|
||||
left join order_remain_plate orp on og.organ_id = orp.organ_id and og.id = orp.goods_id
|
||||
left join order_plan_item opi on og.organ_id = opi.organ_id and og.order_id = opi.order_id and og.id = opi.goods_id
|
||||
from order_plan op
|
||||
join order_goods og on op.organ_id = og.organ_id and op.goods_id = og.goods_id
|
||||
left join order_remain_plate orp on og.organ_id = orp.organ_id and og.id = orp.goods_id
|
||||
|
||||
where opi.organ_id = #{organId} and opi.plan_id = #{planId}
|
||||
where op.organ_id = #{organId} and op.id = #{planId}
|
||||
|
||||
|
||||
</select>
|
||||
@@ -309,10 +309,6 @@
|
||||
|
||||
from order_body ob
|
||||
|
||||
left join order_item oi on ob.order_id = oi.order_id and ob.id = oi.body_id and oi.organ_id = #{organId}
|
||||
left join order_plate op on oi.order_id = op.order_id and oi.plate_id = op.id and op.organ_id = #{organId}
|
||||
left join order_plan_item opi on op.order_id = opi.order_id and op.id = opi.plate_id and opi.organ_id = #{organId}
|
||||
|
||||
where ob.organ_id = #{organId}
|
||||
and ob.order_id in
|
||||
<foreach item="orderIds" collection="orderIds" open="(" separator="," close=")">
|
||||
@@ -320,10 +316,6 @@
|
||||
</foreach>
|
||||
|
||||
and ob.deleted = false
|
||||
and op.is_optimized = false
|
||||
and opi.plan_id is null;
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
@@ -572,5 +564,14 @@
|
||||
|
||||
</select>
|
||||
|
||||
<select id="selectPlannedPlateNumAndArea" resultType="com.cf.imes.module.executor.controller.admin.order.vo.order.OrderPlanPlateNumAndAreaRespVO">
|
||||
select count(op.id) as num, IFNULL(sum(op.area), 0) as area
|
||||
from order_goods og
|
||||
join order_plate op on og.organ_id = op.organ_id and og.order_id = op.order_id and og.id = op.goods_id
|
||||
where og.id = #{orderGoodsId}
|
||||
and op.plan_id != 0
|
||||
and op.deleted = false
|
||||
and og.deleted = false
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
+15
-14
@@ -246,7 +246,7 @@
|
||||
|
||||
select distinct
|
||||
o.id,
|
||||
opi.plan_id,
|
||||
op.plan_id,
|
||||
o.order_date,
|
||||
o.delivery_date,
|
||||
o.custom_order_no,
|
||||
@@ -259,17 +259,12 @@
|
||||
o.splitter,
|
||||
o.remark
|
||||
from orders o
|
||||
|
||||
left join order_plan_item opi on o.organ_id = opi.organ_id and o.id = opi.order_id
|
||||
|
||||
where opi.organ_id = #{organId}
|
||||
and opi.plan_id in
|
||||
join order_plate op on o.organ_id = op.organ_id and o.id = op.order_id
|
||||
where op.organ_id = #{organId}
|
||||
and op.plan_id in
|
||||
<foreach collection="planIds" item="ids" open="(" close=")" separator=",">
|
||||
#{ids}
|
||||
</foreach>
|
||||
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
<select id="selectFilterOrderPagePlate"
|
||||
@@ -384,9 +379,8 @@
|
||||
count(op.id)
|
||||
|
||||
from orders o
|
||||
left join order_plate op on o.id = op.order_id and op.organ_id = #{organId}
|
||||
left join order_plate op on o.id = op.order_id and op.organ_id = #{organId} and op.plan_id = 0
|
||||
left join order_goods og on op.order_id = og.order_id and op.goods_id = og.id and og.organ_id = #{organId}
|
||||
left join order_plan_item opi on op.order_id = opi.order_id and op.id = opi.plate_id and opi.organ_id = #{organId}
|
||||
|
||||
${ew.customSqlSegment}
|
||||
|
||||
@@ -425,12 +419,10 @@
|
||||
op.remark as remark
|
||||
|
||||
from orders o
|
||||
left join order_plate op on o.id = op.order_id and op.organ_id = #{organId}
|
||||
left join order_plate op on o.id = op.order_id and op.organ_id = #{organId} and op.plan_id = 0
|
||||
left join order_goods og on op.order_id = og.order_id and op.goods_id = og.id and og.organ_id = #{organId}
|
||||
left join order_plan_item opi on op.order_id = opi.order_id and op.id = opi.plate_id and opi.organ_id = #{organId}
|
||||
|
||||
${ew.customSqlSegment}
|
||||
|
||||
limit #{pageNo},#{pageSize};
|
||||
|
||||
|
||||
@@ -635,4 +627,13 @@
|
||||
|
||||
</select>
|
||||
|
||||
<select id="selectPlannedPlateNumAndArea" resultType="com.cf.imes.module.executor.controller.admin.order.vo.order.OrderPlanPlateNumAndAreaRespVO">
|
||||
select count(op.id) as num, IFNULL(sum(op.area), 0) as area
|
||||
from orders o
|
||||
join order_plate op on o.organ_id = op.organ_id and o.id = op.order_id
|
||||
where o.id = #{orderId}
|
||||
and op.plan_id != 0
|
||||
and op.deleted = false
|
||||
and o.deleted = false
|
||||
</select>
|
||||
</mapper>
|
||||
+3
-4
@@ -264,11 +264,10 @@
|
||||
|
||||
|
||||
select distinct
|
||||
opi.plan_id
|
||||
op.plan_id
|
||||
|
||||
from order_item oi
|
||||
left join order_plate op on oi.organ_id = op.organ_id and oi.order_id = op.order_id and oi.plate_id = op.id
|
||||
left join order_plan_item opi on op.organ_id = opi.organ_id and op.order_id = opi.order_id and op.id = opi.plate_id
|
||||
join order_plate op on oi.organ_id = op.organ_id and oi.order_id = op.order_id and oi.plate_id = op.id
|
||||
|
||||
<where> oi.organ_id = #{organId}
|
||||
and oi.order_id = #{orderId}
|
||||
@@ -282,7 +281,7 @@
|
||||
#{roomIds}
|
||||
</foreach>
|
||||
</if>
|
||||
and opi.plan_id is not null
|
||||
and op.plan_id != 0
|
||||
|
||||
</where>
|
||||
|
||||
|
||||
+47
-18
@@ -15,8 +15,8 @@
|
||||
|
||||
select distinct op.*
|
||||
from order_plan op
|
||||
left join order_plan_item opi on op.organ_id = opi.organ_id and op.id = opi.plan_id
|
||||
left join orders o on opi.organ_id = o.organ_id and opi.order_id = o.id
|
||||
join order_plate opt on op.organ_id = opt.organ_id and op.id = opt.plan_id
|
||||
left join orders o on op.organ_id = o.organ_id and opt.order_id = o.id
|
||||
|
||||
${ew.customSqlSegment}
|
||||
|
||||
@@ -260,23 +260,52 @@
|
||||
|
||||
</select>
|
||||
|
||||
<select id="selectPlanGoodsList"
|
||||
resultType="com.cf.imes.module.executor.controller.admin.plan.vo.OrderGoodsResp">
|
||||
|
||||
|
||||
|
||||
select distinct og.thickness as thickness,
|
||||
og.material as material,
|
||||
og.color as color,
|
||||
og.brand as brand
|
||||
from order_plan_item opi
|
||||
left join order_goods og on opi.goods_id = og.id and og.organ_id = #{organId}
|
||||
where opi.organ_id = #{organId}
|
||||
and opi.plan_id = #{planId};
|
||||
|
||||
|
||||
|
||||
<select id="countDeletePlanPlate" resultType="com.cf.imes.module.executor.controller.admin.plan.vo.OrderPlanPlateStatisticsRespVO">
|
||||
select op.plan_id as planId,
|
||||
count(op.id) as count
|
||||
from order_plate op
|
||||
where
|
||||
op.organ_id = #{organId}
|
||||
and op.plan_id != 0
|
||||
and op.plan_id in
|
||||
<foreach collection="planIds" item="planId" open="(" close=")" separator=",">
|
||||
#{planId}
|
||||
</foreach>
|
||||
and op.order_id in
|
||||
<foreach collection="orderIds" item="orderId" open="(" close=")" separator=",">
|
||||
#{orderId}
|
||||
</foreach>
|
||||
and op.deleted = false
|
||||
group by op.plan_id;
|
||||
</select>
|
||||
|
||||
<select id="selectPlanOrderIds" resultType="com.cf.imes.module.executor.controller.admin.plan.vo.OrderPlanPlateStatisticsRespVO">
|
||||
select distinct op.plan_id, op.order_id
|
||||
from order_plate op
|
||||
where
|
||||
op.organ_id = #{organId}
|
||||
and op.plan_id != 0
|
||||
and op.plan_id in
|
||||
<foreach collection="planIds" item="planId" open="(" close=")" separator=",">
|
||||
#{planId}
|
||||
</foreach>
|
||||
and op.order_id in
|
||||
<foreach collection="orderIds" item="orderId" open="(" close=")" separator=",">
|
||||
#{orderId}
|
||||
</foreach>
|
||||
and op.deleted = false
|
||||
</select>
|
||||
|
||||
<select id="selectPlanOrderGoodsId" resultType="java.lang.Long">
|
||||
select distinct og.id
|
||||
from order_plan p
|
||||
join order_plate op on p.organ_id = op.organ_id and p.id = op.plan_id
|
||||
join order_goods og on p.organ_id = og.organ_id and p.goods_id = p.goods_id and op.order_id = og.order_id and op.goods_id = og.id
|
||||
where p.organ_id = #{organId} and p.id = #{planId}
|
||||
and op.order_id in
|
||||
<foreach collection="orderIds" item="orderId" open="(" close=")" separator=",">
|
||||
#{orderId}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
+92
-190
@@ -19,45 +19,39 @@
|
||||
</resultMap>
|
||||
|
||||
<select id="selectOrderList" resultMap="OrderPageMap">
|
||||
|
||||
|
||||
select distinct
|
||||
select
|
||||
<if test="type != null and type == @com.cf.imes.module.executor.enums.OrderPlanQueryTypeEnum@ORDER_GROUP.getType()">
|
||||
distinct
|
||||
</if>
|
||||
o.id as orderId,
|
||||
<if test="type != null and type == @com.cf.imes.module.executor.enums.OrderPlanQueryTypeEnum@ORDER_GROUP.getType()">
|
||||
o.plate_num - o.planned_plate_num as num,
|
||||
o.area - o.planned_plate_area as area,
|
||||
</if>
|
||||
<if test="type != null and type == @com.cf.imes.module.executor.enums.OrderPlanQueryTypeEnum@GOODS_GROUP.getType()">
|
||||
sum(og.plate_num - og.planned_plate_num) as num,
|
||||
sum(og.area - og.planned_plate_area) as area,
|
||||
</if>
|
||||
|
||||
o.order_date as orderDate,
|
||||
o.delivery_date as deliveryDate,
|
||||
o.customer as customer,
|
||||
o.address as address,
|
||||
o.custom_order_no as defineId,
|
||||
o.status as status,
|
||||
count(op.id) as num,
|
||||
sum(op.area) as area
|
||||
|
||||
from order_plan_item opi
|
||||
right join order_plate op on opi.organ_id = op.organ_id and opi.order_id = op.order_id and opi.goods_id = op.goods_id and opi.plate_id = op.id
|
||||
right join orders o on op.organ_id = o.organ_id and op.order_id = o.id
|
||||
|
||||
${ew.customSqlSegment}
|
||||
|
||||
group by o.id,o.order_date,o.delivery_date,o.customer,o.address,o.custom_order_no,o.status
|
||||
order by o.id desc
|
||||
limit #{pageNo},#{pageSize};
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="selectOrderListCount" resultType="java.lang.Long">
|
||||
|
||||
|
||||
select distinct
|
||||
o.id
|
||||
|
||||
from order_plan_item opi
|
||||
right join order_plate op on opi.organ_id = op.organ_id and opi.order_id = op.order_id and opi.goods_id = op.goods_id and opi.plate_id = op.id
|
||||
right join orders o on op.organ_id = o.organ_id and op.order_id = o.id
|
||||
o.status as status
|
||||
from orders o
|
||||
<if test="type != null and type == @com.cf.imes.module.executor.enums.OrderPlanQueryTypeEnum@GOODS_GROUP.getType()">
|
||||
join order_goods og on og.organ_id = o.organ_id and og.order_id = o.id
|
||||
</if>
|
||||
|
||||
${ew.customSqlSegment}
|
||||
and o.plate_num - o.planned_plate_num > 0
|
||||
<if test="type != null and type == @com.cf.imes.module.executor.enums.OrderPlanQueryTypeEnum@GOODS_GROUP.getType()">
|
||||
and og.plate_num - og.planned_plate_num > 0
|
||||
group by orderId,orderDate,deliveryDate,customer,address,defineId,status
|
||||
</if>
|
||||
|
||||
order by o.id desc;
|
||||
|
||||
</select>
|
||||
|
||||
@@ -72,43 +66,40 @@
|
||||
<result property="thickness" column="thickness"/>
|
||||
<result property="color" column="color"/>
|
||||
<result property="brand" column="brand"/>
|
||||
|
||||
|
||||
<collection property="platePages" ofType="com.cf.imes.module.executor.controller.admin.plan.vo.PlatePage" resultMap="PlatePageMap"/>
|
||||
|
||||
<result property="count" column="count"/>
|
||||
<result property="area" column="area"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<resultMap id="PlatePageMap" type="com.cf.imes.module.executor.controller.admin.plan.vo.PlatePage">
|
||||
|
||||
<result property="plateId" column="plateId"/>
|
||||
<result property="area" column="plateArea"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectOrderPlanPlateList" resultMap="GoodsListMap" parameterType="java.lang.Long">
|
||||
|
||||
select distinct
|
||||
oi.plan_id as planId,
|
||||
select
|
||||
op.plan_id as planId,
|
||||
og.width as width,
|
||||
og.height as height,
|
||||
og.material as material,
|
||||
og.thickness as thickness ,
|
||||
og.color as color,
|
||||
og.brand as brand,
|
||||
oi.plate_id as plateId,
|
||||
op.area as plateArea
|
||||
COUNT(op.id) AS count,
|
||||
SUM(op.area) AS area
|
||||
|
||||
from order_plan_item oi
|
||||
join order_goods og on oi.organ_id = og.organ_id and oi.order_id = og.order_id and oi.goods_id = og.id
|
||||
join order_plate op on oi.organ_id = op.organ_id and oi.order_id = op.order_id and oi.plate_id = op.id
|
||||
from order_plate op
|
||||
join order_goods og on op.organ_id = og.organ_id and op.goods_id = og.id
|
||||
|
||||
where oi.organ_id = #{organId}
|
||||
and oi.plan_id in
|
||||
where op.organ_id = #{organId}
|
||||
and op.plan_id in
|
||||
<foreach collection="planIds" item="planIds" open="(" close=")" separator=",">
|
||||
#{planIds}
|
||||
</foreach>
|
||||
|
||||
|
||||
GROUP BY
|
||||
planId,
|
||||
width,
|
||||
height,
|
||||
material,
|
||||
thickness,
|
||||
color,
|
||||
brand
|
||||
</select>
|
||||
|
||||
|
||||
@@ -137,7 +128,7 @@
|
||||
op.texture,
|
||||
op.is_row_hole,
|
||||
op.remark,
|
||||
opi.plan_id,
|
||||
op.plan_id,
|
||||
oi.room_id,
|
||||
oi.body_id,
|
||||
ob.name as bodyName,
|
||||
@@ -146,11 +137,10 @@
|
||||
op.is_2v as is2v,
|
||||
op.is_side_2v as isSide2v
|
||||
|
||||
from order_plan_item opi
|
||||
join order_goods og on opi.order_id = og.order_id and opi.goods_id = og.id
|
||||
join order_plate op on opi.order_id = op.order_id and opi.goods_id = op.goods_id and opi.plate_id = op.id
|
||||
join order_item oi on op.order_id = oi.order_id and op.id = oi.plate_id
|
||||
join order_body ob on oi.order_id = ob.order_id and oi.body_id = ob.id
|
||||
from order_plate op
|
||||
join order_goods og on op.organ_id = og.organ_id and op.order_id = og.order_id and op.goods_id = og.id
|
||||
join order_item oi on op.organ_id = oi.organ_id and op.order_id = oi.order_id and op.id = oi.plate_id
|
||||
join order_body ob on op.organ_id = ob.organ_id and oi.order_id = ob.order_id and oi.body_id = ob.id
|
||||
|
||||
${ew.customSqlSegment}
|
||||
|
||||
@@ -161,7 +151,7 @@
|
||||
|
||||
|
||||
|
||||
<select id="selectPlateListByPlateId"
|
||||
<select id="selectPlateListByPlanId"
|
||||
resultType="com.cf.imes.module.executor.controller.admin.plan.vo.PlateResList">
|
||||
|
||||
|
||||
@@ -186,18 +176,17 @@
|
||||
op.texture,
|
||||
op.is_row_hole,
|
||||
op.remark,
|
||||
opi.plan_id,
|
||||
op.plan_id,
|
||||
oi.room_id,
|
||||
oi.body_id,
|
||||
ob.name as bodyName,
|
||||
ob.room_name as roomName
|
||||
|
||||
from order_plan_item opi
|
||||
join order_goods og on opi.order_id = og.order_id and opi.goods_id = og.id
|
||||
join order_plate op on opi.order_id = op.order_id and opi.goods_id = op.goods_id and opi.plate_id = op.id
|
||||
join order_item oi on op.order_id = oi.order_id and op.id = oi.plate_id
|
||||
join order_body ob on oi.order_id = ob.order_id and oi.body_id = ob.id
|
||||
where opi.organ_id = #{organId} and opi.plan_id = #{planId}
|
||||
from order_plate op
|
||||
join order_goods og on op.organ_id = og.organ_id and op.order_id = og.order_id and op.goods_id = og.id
|
||||
join order_item oi on op.organ_id = oi.organ_id and op.order_id = oi.order_id and op.id = oi.plate_id
|
||||
join order_body ob on op.organ_id = ob.organ_id and oi.order_id = ob.order_id and oi.body_id = ob.id
|
||||
where op.organ_id = #{organId} and op.plan_id = #{planId}
|
||||
|
||||
</select>
|
||||
|
||||
@@ -212,11 +201,10 @@
|
||||
|
||||
select count(distinct op.id)
|
||||
|
||||
from order_plan_item opi
|
||||
join order_goods og on opi.order_id = og.order_id and opi.goods_id = og.id
|
||||
join order_plate op on opi.order_id = op.order_id and opi.goods_id = op.goods_id and opi.plate_id = op.id
|
||||
join order_item oi on op.order_id = oi.order_id and op.id = oi.plate_id
|
||||
join order_body ob on oi.order_id = ob.order_id and oi.body_id = ob.id
|
||||
from order_plate op
|
||||
join order_goods og on op.organ_id = og.organ_id and op.order_id = og.order_id and op.goods_id = og.id
|
||||
join order_item oi on op.organ_id = oi.organ_id and op.order_id = oi.order_id and op.id = oi.plate_id
|
||||
join order_body ob on op.organ_id = ob.organ_id and oi.order_id = ob.order_id and oi.body_id = ob.id
|
||||
|
||||
${ew.customSqlSegment}
|
||||
|
||||
@@ -256,14 +244,13 @@
|
||||
og.thickness as thickness,
|
||||
og.brand as brand
|
||||
|
||||
from orders o
|
||||
left join order_goods og on o.id = og.order_id and og.organ_id = #{organId}
|
||||
left join order_plate op on og.order_id = op.order_id and og.id = op.goods_id and op.organ_id = #{organId}
|
||||
left join order_item oi on op.order_id = oi.order_id and op.id = oi.plate_id and oi.organ_id = #{organId}
|
||||
left join order_plan_item opi on op.order_id = opi.order_id and op.id = opi.plate_id and opi.organ_id = #{organId}
|
||||
|
||||
from order_item oi
|
||||
join order_plate op on op.order_id = oi.order_id and op.organ_id = oi.organ_id and op.id = oi.plate_id
|
||||
join order_goods og on og.order_id = oi.order_id and og.organ_id = oi.organ_id and og.id = op.goods_id
|
||||
${ew.customSqlSegment}
|
||||
|
||||
and oi.plate_id != 0
|
||||
and og.plate_num - og.planned_plate_num > 0
|
||||
and og.deleted = false
|
||||
</select>
|
||||
|
||||
|
||||
@@ -281,13 +268,12 @@
|
||||
og.brand as brand
|
||||
|
||||
from orders o
|
||||
left join order_goods og on o.id = og.order_id and og.organ_id = #{organId}
|
||||
left join order_plate op on og.order_id = op.order_id and og.id = op.goods_id and op.organ_id = #{organId}
|
||||
left join order_plan_item opi on op.order_id = opi.order_id and op.id = opi.plate_id and opi.organ_id = #{organId}
|
||||
join order_goods og on o.id = og.order_id and og.organ_id = #{organId}
|
||||
|
||||
${ew.customSqlSegment}
|
||||
|
||||
|
||||
and og.plate_num - og.planned_plate_num > 0
|
||||
and og.deleted = false
|
||||
order by thickness desc
|
||||
</select>
|
||||
|
||||
|
||||
@@ -308,32 +294,11 @@
|
||||
og.order_id as orderId
|
||||
|
||||
from orders o
|
||||
left join order_goods og on o.id = og.order_id and og.organ_id = #{organId}
|
||||
left join order_plate op on og.order_id = op.order_id and og.id = op.goods_id and op.organ_id = #{organId}
|
||||
left join order_item oi on op.order_id = oi.order_id and op.id = oi.plate_id and oi.organ_id = #{organId}
|
||||
left join order_plan_item opi on op.order_id = opi.order_id and op.id = opi.plate_id and opi.organ_id = #{organId}
|
||||
join order_goods og on o.id = og.order_id and og.organ_id = #{organId}
|
||||
|
||||
${ew.customSqlSegment}
|
||||
|
||||
|
||||
</select>
|
||||
<select id="selectPlanIncrementPlate"
|
||||
resultType="com.cf.imes.module.executor.controller.admin.plate.vo.OrderPlateIds">
|
||||
|
||||
|
||||
select distinct op.id as plateId,
|
||||
op.order_id asorderId
|
||||
|
||||
from order_plan_item opi
|
||||
left join order_plate op on opi.organ_id = op.organ_id and opi.order_id = op.order_id and opi.plate_id = op.id
|
||||
|
||||
where opi.organ_id = #{organId}
|
||||
and opi.plan_id in
|
||||
<foreach collection="noPlanIds" item="noPlanIds" open="(" close=")" separator=",">
|
||||
#{noPlanIds}
|
||||
</foreach>
|
||||
and op.type = 3
|
||||
|
||||
and og.plate_num - og.planned_plate_num > 0
|
||||
and og.deleted = false
|
||||
|
||||
</select>
|
||||
|
||||
@@ -433,9 +398,6 @@
|
||||
op.width as width,
|
||||
op.height as height,
|
||||
op.thickness as thickness,
|
||||
op.split_width as splitWidth,
|
||||
op.split_height as splitHeight,
|
||||
op.split_thickness as splitThickness,
|
||||
op.seal_left as sealLeft,
|
||||
op.seal_right as sealRight,
|
||||
op.seal_up as sealUp,
|
||||
@@ -443,75 +405,18 @@
|
||||
op.area as area,
|
||||
op.texture as texture,
|
||||
op.hole_face as holeFace,
|
||||
op.hole_arrange as holeArrange,
|
||||
op.unregular_point_count as unregularPointCount,
|
||||
op.front_hole_count as frontHoleCount,
|
||||
op.back_hole_count as backHoleCount,
|
||||
op.side_hole_count as sideHoleCount,
|
||||
op.front_model_count as frontModelCount,
|
||||
op.back_model_count as backModelCount,
|
||||
op.is_door as isDoor,
|
||||
op.open_door_type as openDoorType,
|
||||
op.offset_x as offsetX,
|
||||
op.offset_y as offsetY,
|
||||
op.is_arc_across as isArcAcross,
|
||||
op.module_type_id as moduleTypeId,
|
||||
op.is_special_shaped as isSpecialShaped,
|
||||
op.is_sculpt as isSculpt,
|
||||
op.is_row_hole as hasHole,
|
||||
op.remark as remark,
|
||||
op.filter_type as filterType,
|
||||
op.is_cancel as isCancel,
|
||||
op.is_row_hole as hasHole,
|
||||
op.is_side_sculpt as isSideSculpt,
|
||||
op.is_2v as is2v,
|
||||
op.is_side_2v as isSide2v
|
||||
op.remark as remark
|
||||
|
||||
from order_plan_item opi
|
||||
join order_plate op on opi.organ_id = op.organ_id and opi.order_id = op.order_id and opi.plate_id = op.id
|
||||
left join order_goods ogs on opi.organ_id = ogs.organ_id and opi.order_id = ogs.order_id and opi.goods_id = ogs.id
|
||||
left join order_item oi on opi.organ_id = oi.organ_id and opi.order_id = oi.order_id and opi.plate_id = oi.plate_id
|
||||
left join order_group og on oi.organ_id = og.organ_id and oi.order_id = og.order_id and oi.group_id = og.id
|
||||
left join order_body ob on oi.organ_id = ob.organ_id and oi.order_id = ob.order_id and oi.body_id = ob.id
|
||||
|
||||
where opi.organ_id = #{organId} and opi.plan_id = #{planId}
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="selectOrderPlanPlateListByPlanId"
|
||||
resultType="com.cf.imes.module.executor.dal.dataobject.plate.PlateDO">
|
||||
|
||||
|
||||
select distinct
|
||||
op.*
|
||||
|
||||
from order_plan_item opi
|
||||
left join order_plate op on opi.organ_id = op.organ_id and opi.order_id = op.order_id and opi.plate_id = op.id
|
||||
|
||||
where opi.organ_id = #{organId}
|
||||
and opi.plan_id = #{planId}
|
||||
and op.is_optimized = false
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectOrderPlateList" resultType="java.lang.Long">
|
||||
|
||||
|
||||
select distinct
|
||||
order_id
|
||||
from order_plan_item
|
||||
|
||||
where organ_id = #{organId}
|
||||
and order_id in
|
||||
<foreach collection="orderIds" item="orderIds" open="(" close=")" separator=",">
|
||||
#{orderIds}
|
||||
</foreach>
|
||||
from order_plate op
|
||||
left join order_goods ogs on op.organ_id = ogs.organ_id and op.order_id = ogs.order_id and op.goods_id = ogs.id
|
||||
left join order_item oi on op.organ_id = oi.organ_id and op.order_id = oi.order_id and op.id = oi.plate_id
|
||||
left join order_group og on op.organ_id = og.organ_id and op.order_id = og.order_id and oi.group_id = og.id
|
||||
left join order_body ob on op.organ_id = ob.organ_id and op.order_id = ob.order_id and oi.body_id = ob.id
|
||||
|
||||
where op.organ_id = #{organId} and op.plan_id = #{planId}
|
||||
|
||||
|
||||
</select>
|
||||
@@ -519,12 +424,10 @@
|
||||
<select id="selectIsCuttingPlate" resultType="java.lang.Long">
|
||||
|
||||
select distinct
|
||||
opi.plate_id
|
||||
from order_plan_item opi
|
||||
left join order_plate op on opi.organ_id = op.organ_id and opi.order_id = op.order_id and opi.plate_id = op.id
|
||||
|
||||
where opi.organ_id = #{organId}
|
||||
and opi.plan_id = #{planId}
|
||||
op.plate_id
|
||||
from order_plate op
|
||||
where op.organ_id = #{organId}
|
||||
and op.plan_id = #{planId}
|
||||
and op.is_cutted in (1,2)
|
||||
limit 1;
|
||||
|
||||
@@ -547,7 +450,7 @@
|
||||
ogs.color as plateColor,
|
||||
ogs.material as plateMaterial,
|
||||
op.id as plateId,
|
||||
opi.plan_id as planId,
|
||||
op.plan_id as planId,
|
||||
op.order_id as orderId,
|
||||
ogs.goods_name as goodsPlateName,
|
||||
ogs.raw_goods_id as rawGoodsId,
|
||||
@@ -571,13 +474,12 @@
|
||||
op.seal_down as sealDown,
|
||||
op.remark as plateRemark
|
||||
|
||||
from order_plan_item opi
|
||||
join order_plate op on opi.organ_id = op.organ_id and opi.order_id = op.order_id and opi.plate_id = op.id
|
||||
left join order_goods ogs on opi.organ_id = ogs.organ_id and opi.order_id = ogs.order_id and opi.goods_id = ogs.id
|
||||
left join order_item oi on opi.organ_id = oi.organ_id and opi.order_id = oi.order_id and opi.plate_id = oi.plate_id
|
||||
left join order_body ob on oi.organ_id = ob.organ_id and oi.order_id = ob.order_id and oi.body_id = ob.id
|
||||
from order_plate op
|
||||
left join order_goods ogs on op.organ_id = ogs.organ_id and op.order_id = ogs.order_id and op.goods_id = ogs.id
|
||||
left join order_item oi on op.organ_id = oi.organ_id and op.order_id = oi.order_id and op.plate_id = oi.plate_id
|
||||
left join order_body ob on op.organ_id = ob.organ_id and oi.order_id = ob.order_id and oi.body_id = ob.id
|
||||
|
||||
where opi.organ_id = #{organId} and opi.plan_id = #{planId}
|
||||
where op.organ_id = #{organId} and op.plan_id = #{planId}
|
||||
|
||||
|
||||
|
||||
@@ -597,11 +499,11 @@
|
||||
og.material,
|
||||
og.thickness
|
||||
|
||||
from order_plan_item opi
|
||||
join order_goods og on opi.organ_id = og.organ_id and opi.order_id = og.order_id and opi.goods_id = og.id
|
||||
from order_plan op
|
||||
join order_goods og on op.organ_id = og.organ_id and op.order_id = og.order_id and op.goods_id = og.id
|
||||
|
||||
where opi.organ_id = #{organId}
|
||||
and opi.plan_id = #{planId}
|
||||
where op.organ_id = #{organId}
|
||||
and op.plan_id = #{planId}
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
+4
-51
@@ -278,36 +278,6 @@
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="selectGoodsPage"
|
||||
resultMap="GoodsPageMap">
|
||||
|
||||
|
||||
select distinct
|
||||
c.texture,
|
||||
c.width,
|
||||
c.height,
|
||||
c.thickness,
|
||||
c.goods_name,
|
||||
c.material,
|
||||
c.color,
|
||||
c.brand,
|
||||
|
||||
c.order_id as orderId,
|
||||
c.id as id,
|
||||
c.goods_id as goodsId
|
||||
|
||||
from order_plate a
|
||||
LEFT JOIN order_item oi on a.id = oi.plate_id and a.order_id = oi.order_id and a.organ_id = oi.organ_id
|
||||
LEFT JOIN order_goods c on a.goods_id = c.id and a.organ_id = c.organ_id
|
||||
left join order_plan_item opi on oi.id = opi.item_id and oi.organ_id = opi.organ_id
|
||||
|
||||
${ew.customSqlSegment}
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
<select id="selectPlateTypeByRoomId"
|
||||
resultType="com.cf.imes.module.executor.dal.dataobject.plate.PlateDO" parameterType="java.lang.Long">
|
||||
|
||||
@@ -497,7 +467,6 @@
|
||||
join order_goods ogs on op.organ_id = ogs.organ_id and op.order_id = ogs.order_id and op.goods_id = ogs.id
|
||||
left join order_item oi on op.organ_id = oi.organ_id and op.order_id = oi.order_id and op.id = oi.plate_id and oi.plate_id != 0
|
||||
left join order_group og on oi.organ_id = og.organ_id and oi.order_id = og.order_id and oi.group_id = og.id
|
||||
left join order_plan_item opi on op.organ_id = opi.organ_id and op.order_id = opi.order_id and op.id = opi.plate_id
|
||||
where op.organ_id = #{organId}
|
||||
|
||||
and op.order_id in
|
||||
@@ -512,7 +481,7 @@
|
||||
|
||||
and op.deleted = false
|
||||
|
||||
and opi.plan_id is null
|
||||
and op.plan_id = 0
|
||||
|
||||
|
||||
</select>
|
||||
@@ -535,21 +504,6 @@
|
||||
|
||||
</resultMap>
|
||||
|
||||
<select id="selectNoPlanPlateList" resultMap="PlatePageMap">
|
||||
|
||||
select
|
||||
op.order_id as orderId,
|
||||
op.id as plateId,
|
||||
op.area as area
|
||||
|
||||
from order_plate op
|
||||
left join order_plan_item opi on op.organ_id = opi.organ_id and op.order_id = opi.order_id and op.id = opi.plate_id
|
||||
|
||||
${ew.customSqlSegment}
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<update id="updatePlateOptimized" parameterType="java.lang.Long">
|
||||
@@ -978,7 +932,7 @@
|
||||
ogs.color as plateColor,
|
||||
ogs.material as plateMaterial,
|
||||
op.id as plateId,
|
||||
opi.plan_id as planId,
|
||||
op.plan_id as planId,
|
||||
op.order_id as orderId,
|
||||
ogs.goods_name as goodsPlateName,
|
||||
ogs.raw_goods_id as rawGoodsId,
|
||||
@@ -1002,11 +956,10 @@
|
||||
op.seal_down as sealDown,
|
||||
op.remark as plateRemark
|
||||
|
||||
from order_plate op
|
||||
from order_plate op
|
||||
left join order_goods ogs on op.organ_id = ogs.organ_id and op.order_id = ogs.order_id and op.goods_id = ogs.id
|
||||
left join order_item oi on op.organ_id = oi.organ_id and op.order_id = oi.order_id and op.id = oi.plate_id
|
||||
left join order_body ob on oi.organ_id = ob.organ_id and oi.order_id = ob.order_id and oi.body_id = ob.id
|
||||
left join order_plan_item opi on op.organ_id = opi.organ_id and op.order_id = opi.order_id and op.id = opi.plate_id
|
||||
left join order_body ob on op.organ_id = ob.organ_id and oi.order_id = ob.order_id and oi.body_id = ob.id
|
||||
|
||||
where op.organ_id = #{organId}
|
||||
and op.deleted = false
|
||||
|
||||
Reference in New Issue
Block a user