mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
1、订单详情get-module补充部件数据;2、新增删除/恢复部件接口;
This commit is contained in:
+4
@@ -24,6 +24,7 @@ public class ErrorCodeConstants {
|
||||
public static final ErrorCode CREATE_PLAN_GOODS_UPDATE_CONCURRENCY_ERROR = new ErrorCode(1_003_107_011, "创建排单失败:材质【{}】板件数量已发生改变,请刷新后重新创建单排");
|
||||
public static final ErrorCode ORDER_PLATE_UPDATE_CONCURRENCY_ERROR = new ErrorCode(1_003_107_012, "更新生产单状态失败:生产单号【{}】板件数量已发生改变,请刷新后重新操作");
|
||||
public static final ErrorCode GOODS_PLATE_UPDATE_CONCURRENCY_ERROR = new ErrorCode(1_003_107_013, "更新材质状态失败:材质【{}】板件数量已发生改变,请刷新后重新操作");
|
||||
public static final ErrorCode BODY_PLATE_UPDATE_CONCURRENCY_ERROR = new ErrorCode(1_003_107_014, "更新柜体状态失败:柜体【{}】板件数量已发生改变,请刷新后重新操作");
|
||||
|
||||
|
||||
// ========== 生产单商品 TODO 补充编号 ==========
|
||||
@@ -186,4 +187,7 @@ public class ErrorCodeConstants {
|
||||
|
||||
//=========== 部件管理 1-003-010-000 ============
|
||||
public static final ErrorCode ORDER_COMPONENT_NOT_EXIST = new ErrorCode(1_003_010_000, "order.component.not.exist");
|
||||
public static final ErrorCode ORDER_COMPONENT_DELETE_PLATE_IN_PLAN = new ErrorCode(1_003_010_001, "order.component.delete.plate.in.plan");
|
||||
public static final ErrorCode ORDER_COMPONENT_RESTORE_PARENT_IS_DELETED = new ErrorCode(1_003_010_002, "order.component.restore.parent.is.deleted");
|
||||
public static final ErrorCode ORDER_COMPONENT_NO_NEED_TO_RESTORE = new ErrorCode(1_003_010_003, "order.component.no.need.to.restore");
|
||||
}
|
||||
|
||||
+4
@@ -1,5 +1,6 @@
|
||||
package com.cf.imes.module.executor.controller.admin.order.vo.order;
|
||||
|
||||
import com.cf.imes.module.executor.controller.admin.ordercomponent.vo.OrderComponentRespVO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -25,4 +26,7 @@ public class OrderModuleDetailRespVO {
|
||||
|
||||
@Schema(description = "组件列表")
|
||||
private List<OrderPlatesDetailRespVO> component;
|
||||
|
||||
@Schema(description = "部件列表")
|
||||
private List<OrderComponentRespVO> section;
|
||||
}
|
||||
|
||||
+17
@@ -12,7 +12,10 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@@ -58,4 +61,18 @@ public class OrderComponentController {
|
||||
public CommonResult<List<OrderViewPlatePageRespVO>> getComponentViewPlates(@Valid @RequestBody OrderDetailComponentPageReqVO pageReqVO) {
|
||||
return success(orderComponentService.getViewComponentPlatesCadInfo(pageReqVO));
|
||||
}
|
||||
|
||||
@DeleteMapping("/{orderId}/{id}")
|
||||
@Operation(summary = "删除订单部件")
|
||||
public CommonResult<Boolean> deleteOrderComponent(@PathVariable("orderId") Long orderId, @PathVariable("id") Long id) {
|
||||
orderComponentService.deleteOrderComponent(orderId, id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PutMapping("/{orderId}/{id}")
|
||||
@Operation(summary = "恢复订单部件")
|
||||
public CommonResult<Boolean> restoreOrderComponent(@PathVariable("orderId") Long orderId, @PathVariable("id") Long id) {
|
||||
orderComponentService.restoreOrderComponent(orderId, id);
|
||||
return success(true);
|
||||
}
|
||||
}
|
||||
|
||||
-3
@@ -40,9 +40,6 @@ public class OrderDetailComponentListReqVO {
|
||||
@Size(max = 200, message = "{order.detail.component.list.query.componentIds.max}")
|
||||
private Set<Long> componentIds;
|
||||
|
||||
@Schema(description = "部件编号", example = "1")
|
||||
private Long componentId;
|
||||
|
||||
@Schema(description = "部件名称", example = "部件")
|
||||
private String name;
|
||||
|
||||
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package com.cf.imes.module.executor.dal.dataobject.goods;
|
||||
|
||||
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 OrderGoodsPlateNumAndAreaDO {
|
||||
/**
|
||||
* 订单商品id
|
||||
*/
|
||||
private Long orderGoodsId;
|
||||
|
||||
/**
|
||||
* 板件数量
|
||||
*/
|
||||
private Integer num;
|
||||
|
||||
/**
|
||||
* 板件面积
|
||||
*/
|
||||
private BigDecimal area;
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package com.cf.imes.module.executor.dal.dataobject.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 OrderPlateNumAndAreaDO {
|
||||
/**
|
||||
* 板件数量
|
||||
*/
|
||||
private Integer num;
|
||||
|
||||
/**
|
||||
* 板件面积
|
||||
*/
|
||||
private BigDecimal area;
|
||||
}
|
||||
+5
@@ -86,4 +86,9 @@ public class OrderBodyDO extends BaseDO {
|
||||
* cad图纸数据文件id
|
||||
*/
|
||||
private Long cadViewFileId;
|
||||
|
||||
/**
|
||||
* 版本号:乐观锁用
|
||||
*/
|
||||
private int version;
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package com.cf.imes.module.executor.dal.dataobject.orderBody;
|
||||
|
||||
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 OrderBodyPlateNumAndAreaDO {
|
||||
/**
|
||||
* 柜体id
|
||||
*/
|
||||
private Long orderBodyId;
|
||||
|
||||
/**
|
||||
* 板件数量
|
||||
*/
|
||||
private Integer num;
|
||||
|
||||
/**
|
||||
* 板件面积
|
||||
*/
|
||||
private BigDecimal area;
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.cf.imes.module.executor.dal.dataobject.ordecomponent;
|
||||
package com.cf.imes.module.executor.dal.dataobject.ordercomponent;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
+10
@@ -16,11 +16,13 @@ import com.cf.imes.module.executor.controller.admin.plan.vo.GoodsReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.PlateInfoVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.PlateResList;
|
||||
import com.cf.imes.module.executor.dal.dataobject.goods.GoodsDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.goods.OrderGoodsPlateNumAndAreaDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||
|
||||
@@ -200,4 +202,12 @@ public interface GoodsMapper extends BaseMapperX<GoodsDO> {
|
||||
* @return
|
||||
*/
|
||||
OrderPlanPlateNumAndAreaRespVO selectPlannedPlateNumAndArea(@Param("orderGoodsId") Long orderGoodsId);
|
||||
|
||||
/**
|
||||
* 查询订单材质下的板件数量和面积
|
||||
*
|
||||
* @param orderGoodsIds
|
||||
* @return
|
||||
*/
|
||||
List<OrderGoodsPlateNumAndAreaDO> selectPlateNumAndArea(@Param("orderGoodsIds") Set<Long> orderGoodsIds);
|
||||
}
|
||||
+14
-5
@@ -23,6 +23,7 @@ import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderPlanPlat
|
||||
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;
|
||||
import com.cf.imes.module.executor.dal.dataobject.order.OrderPlateNumAndAreaDO;
|
||||
import com.cf.imes.module.executor.enums.OrderDeletedEnum;
|
||||
import com.cf.imes.module.executor.enums.OrderStatusEnum;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@@ -100,7 +101,7 @@ 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<OrderRespVOCopy> page, @Param(Constants.WRAPPER) Wrapper<OrderDO> wrapper);
|
||||
|
||||
|
||||
Map<String, Object> selectDynamicSqlString(@Param("sqlStr") String sqlStr);
|
||||
@@ -224,7 +225,7 @@ public interface OrderMapper extends BaseMapperX<OrderDO> {
|
||||
default List<Long> selectOrderListByUpdateTime() {
|
||||
return selectList(new LambdaQueryWrapper<OrderDO>()
|
||||
.eq(OrderDO::getDeleted, OrderDeletedEnum.DELETED.getStatus())
|
||||
.lt(OrderDO::getUpdateTime, LocalDateTime.now().minusDays(30))).stream().map(OrderDO::getId).collect(Collectors.toList());
|
||||
.lt(OrderDO::getUpdateTime, LocalDateTime.now().minusDays(30))).stream().map(OrderDO::getId).toList();
|
||||
}
|
||||
|
||||
default int updateOrderListStatus(List<Long> orderIds, Integer status,Long organId) {
|
||||
@@ -256,13 +257,13 @@ public interface OrderMapper extends BaseMapperX<OrderDO> {
|
||||
List<PlanOrderRespVO> selectPlanOrderList(@Param("planIds") List<Long> planIds, @Param("organId") Long organId);
|
||||
|
||||
|
||||
IPage<OrderRespVOCopy> selectFilterOrderPagePlate(@Param("page") IPage page, @Param(Constants.WRAPPER) Wrapper<OrderDO> wrapper);
|
||||
IPage<OrderRespVOCopy> selectFilterOrderPagePlate(@Param("page") IPage<OrderRespVOCopy> page, @Param(Constants.WRAPPER) Wrapper<OrderDO> wrapper);
|
||||
|
||||
List<Long> selectFilterOrderPlateList(@Param(Constants.WRAPPER) QueryWrapperX<OrderDO> queryWrapperX);
|
||||
|
||||
List<OrderIds> selectFilterGoodsPlateList(@Param(Constants.WRAPPER) QueryWrapperX<OrderDO> queryWrapperX);
|
||||
|
||||
IPage<OrderGoodsResp> selectFilterGoodsPlatePage(@Param("page") IPage page,@Param(Constants.WRAPPER) QueryWrapperX<OrderDO> queryWrapperX);
|
||||
IPage<OrderGoodsResp> selectFilterGoodsPlatePage(@Param("page") IPage<OrderGoodsResp> page,@Param(Constants.WRAPPER) QueryWrapperX<OrderDO> queryWrapperX);
|
||||
|
||||
|
||||
List<Long> selectNoPlanOrderPlateCount(@Param(Constants.WRAPPER) Wrapper<OrderDO> wrapper,@Param("organId") Long organId);
|
||||
@@ -299,7 +300,7 @@ public interface OrderMapper extends BaseMapperX<OrderDO> {
|
||||
|
||||
|
||||
|
||||
IPage<PackRespVO> selectOrderIdList(@Param("page") IPage page, @Param("pageReqVO") PackPageReqVO pageReqVO, @Param("organId") Long organId);
|
||||
IPage<PackRespVO> selectOrderIdList(@Param("page") IPage<PackRespVO> page, @Param("pageReqVO") PackPageReqVO pageReqVO, @Param("organId") Long organId);
|
||||
|
||||
|
||||
List<LabelOrderData> selectLabelOrderData(@Param("orderIds") List<Long> orderIds,@Param("organId") Long organId);
|
||||
@@ -311,4 +312,12 @@ public interface OrderMapper extends BaseMapperX<OrderDO> {
|
||||
* @return
|
||||
*/
|
||||
OrderPlanPlateNumAndAreaRespVO selectPlannedPlateNumAndArea(@Param("orderId") Long orderId);
|
||||
|
||||
/**
|
||||
* 查询订单下板件数量和面积
|
||||
*
|
||||
* @param orderId
|
||||
* @return
|
||||
*/
|
||||
OrderPlateNumAndAreaDO selectPlateNumAndArea(@Param("orderId") Long orderId);
|
||||
}
|
||||
|
||||
+8
-1
@@ -7,6 +7,7 @@ import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderModuleRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.product.OrderRoomBodyRespVO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderBody.OrderBodyDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderBody.OrderBodyPlateNumAndAreaDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@@ -196,5 +197,11 @@ public interface OrderBodyMapper extends BaseMapperX<OrderBodyDO> {
|
||||
.select(OrderBodyDO::getId,OrderBodyDO::getName,OrderBodyDO::getRoomName));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询柜体下的板件数量和面积
|
||||
*
|
||||
* @param orderBodyIds
|
||||
* @return
|
||||
*/
|
||||
List<OrderBodyPlateNumAndAreaDO> selectPlateNumAndArea(@Param("orderBodyIds") Set<Long> orderBodyIds);
|
||||
}
|
||||
+37
-1
@@ -2,7 +2,7 @@ package com.cf.imes.module.executor.dal.mysql.ordercomponent;
|
||||
|
||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.cf.imes.module.executor.controller.admin.ordercomponent.vo.OrderDetailComponentListReqVO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.ordecomponent.OrderComponentDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.ordercomponent.OrderComponentDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@@ -28,8 +28,44 @@ public interface OrderComponentMapper extends BaseMapperX<OrderComponentDO> {
|
||||
|
||||
/**
|
||||
* 查询id列表中每个节点上同一棵树的所有父级
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
List<OrderComponentDO> getTopComponentListIn(@Param("ids") List<Long> ids);
|
||||
|
||||
/**
|
||||
* 查询订单topid下的所有大于level层级的部件列表
|
||||
* @param orderId
|
||||
* @param topId
|
||||
* @param level
|
||||
* @return
|
||||
*/
|
||||
List<OrderComponentDO> getComponentListOnTopLevel(@Param("orderId") Long orderId,
|
||||
@Param("topId") Long topId,
|
||||
@Param("level") int level,
|
||||
@Param("deleted") boolean deleted);
|
||||
|
||||
/**
|
||||
* 查询是否有部件板件在排单中
|
||||
*
|
||||
* @param componentIds
|
||||
* @return
|
||||
*/
|
||||
boolean selectOrderComponentPlateInPlan(@Param("componentIds") List<Long> componentIds);
|
||||
|
||||
/**
|
||||
* 根据id查询,忽略逻辑删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
OrderComponentDO selectByIdIgnoreDeleted(@Param("id") Long id);
|
||||
|
||||
/**
|
||||
* 恢复部件
|
||||
*
|
||||
* @param componentIds
|
||||
*/
|
||||
void restoreOrderComponents(@Param("orderId") Long orderId, @Param("componentIds") List<Long> componentIds);
|
||||
}
|
||||
+27
-9
@@ -1,9 +1,7 @@
|
||||
package com.cf.imes.module.executor.dal.mysql.plate;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.cf.imes.framework.common.enums.OrderPlateCutStatusEnum;
|
||||
import com.cf.imes.framework.common.enums.OrderPlateTypeEnum;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
@@ -15,9 +13,7 @@ import com.cf.imes.module.executor.controller.admin.manage.process.vo.PlateDetai
|
||||
import com.cf.imes.module.executor.controller.admin.manage.query.vo.pack.PackageDetailsRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.LabelOrderPlateData;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.saveOptimize.PrintOrderPackReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.NotPlanOrderPlateRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.PlateDetailRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.PlatePage;
|
||||
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateGoodsIdVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateGoodsRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plate.vo.PlatePageReqVO;
|
||||
@@ -156,10 +152,6 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
|
||||
|
||||
|
||||
|
||||
// List<PlateInfoVO> selectPlateArea(@Param("orderIdsList") List<OrderIds> orderIdsList,@Param("organId") Long organId);
|
||||
|
||||
|
||||
|
||||
default List<PlateDO> selectPlateByPlateNo(List<Long> orderIdList,List<String> plateNo, Long organId) {
|
||||
return selectList(new LambdaQueryWrapperX<PlateDO>()
|
||||
.eq(PlateDO::getOrganId,organId)
|
||||
@@ -304,8 +296,34 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
|
||||
|
||||
List<PlateDetailsRespVO> selectOrderPackPlateList(@Param("orderIds") List<Long> orderIds, @Param("organId") Long organId);
|
||||
|
||||
IPage<PackageDetailsRespVO> selectPackPlateList(@Param("page") IPage page, @Param("packageId") Long packageId, @Param("organId") Long organId);
|
||||
IPage<PackageDetailsRespVO> selectPackPlateList(@Param("page") IPage<PackageDetailsRespVO> page, @Param("packageId") Long packageId, @Param("organId") Long organId);
|
||||
|
||||
List<LabelOrderPlateData> selectLabelOrderPlateDataByOrderId(@Param("orderId") Long orderId,@Param("organId") Long organId);
|
||||
|
||||
/**
|
||||
* 更新订单部件板件
|
||||
*
|
||||
* @param orderId
|
||||
* @param componentIds
|
||||
* @param deleted true:删除,false恢复
|
||||
* @return
|
||||
*/
|
||||
int updateOrderComponentPlate(@Param("orderId") Long orderId, @Param("componentIds") List<Long> componentIds, @Param("deleted") boolean deleted);
|
||||
|
||||
/**
|
||||
* 查询部件下板件用到的order_goods id
|
||||
*
|
||||
* @param componentIds
|
||||
* @return
|
||||
*/
|
||||
List<Long> selectOrderComponentGoodsIds(@Param("orderId") Long orderId, @Param("componentIds") List<Long> componentIds, @Param("deleted") boolean deleted);
|
||||
|
||||
/**
|
||||
* 查询部件下板件用到的柜体id
|
||||
*
|
||||
* @param orderId
|
||||
* @param componentIds
|
||||
* @return
|
||||
*/
|
||||
List<Long> selectOrderComponentBodyIds(@Param("orderId") Long orderId, @Param("componentIds") List<Long> componentIds, @Param("deleted") boolean deleted);
|
||||
}
|
||||
+8
-3
@@ -30,6 +30,8 @@ import com.cf.imes.module.executor.controller.admin.order.vo.type.PlateByRoomBod
|
||||
import com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsPrintRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsRemark;
|
||||
import com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.ordercomponent.vo.OrderComponentRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.ordercomponent.vo.OrderDetailComponentListReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.OrderRespVOCopy;
|
||||
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateGoodsRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateRespVO;
|
||||
@@ -289,8 +291,11 @@ public class OrderServiceImpl implements OrderService {
|
||||
types.add(CategoryEnum.EDGING.getValue());
|
||||
List<OrderPlatesDetailRespVO> orderItemDOS = orderItemMapper.selectPartsByOrderId(orderId, getUserOrganId(), deleted, types);
|
||||
|
||||
// 板材
|
||||
List<OrderGoodsRespVO> orderGoodsRespVOS = orderItemMapper.selectGoodsByOrderId(orderId, getUserOrganId(), deleted);
|
||||
// 部件
|
||||
OrderDetailComponentListReqVO componentListReqVO = new OrderDetailComponentListReqVO();
|
||||
componentListReqVO.setOrderId(orderId);
|
||||
componentListReqVO.setDeleted(deleted == 1 ? true : false);
|
||||
List<OrderComponentRespVO> orderComponentList = orderComponentService.getOrderComponentList(componentListReqVO);
|
||||
|
||||
// 组件
|
||||
types.clear();
|
||||
@@ -300,8 +305,8 @@ public class OrderServiceImpl implements OrderService {
|
||||
OrderModuleDetailRespVO orderModuleDetailRespVO = new OrderModuleDetailRespVO();
|
||||
orderModuleDetailRespVO.setModule(orderModuleRespVOList);
|
||||
orderModuleDetailRespVO.setParts(orderItemDOS);
|
||||
orderModuleDetailRespVO.setGoods(orderGoodsRespVOS);
|
||||
orderModuleDetailRespVO.setComponent(orderComponentRespVOS);
|
||||
orderModuleDetailRespVO.setSection(orderComponentList);
|
||||
return orderModuleDetailRespVO;
|
||||
}
|
||||
|
||||
|
||||
+15
@@ -44,4 +44,19 @@ public interface OrderComponentService {
|
||||
* @return
|
||||
*/
|
||||
List<OrderViewPlatePageRespVO> getViewComponentPlatesCadInfo(OrderDetailComponentPageReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 删除部件
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
void deleteOrderComponent(Long orderId, Long id);
|
||||
|
||||
/**
|
||||
* 恢复部件
|
||||
*
|
||||
* @param orderId
|
||||
* @param id
|
||||
*/
|
||||
void restoreOrderComponent(Long orderId, Long id);
|
||||
}
|
||||
+336
-11
@@ -3,27 +3,45 @@ package com.cf.imes.module.executor.service.ordercomponent;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.module.executor.controller.admin.ordercomponent.vo.OrderComponentRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.ordercomponent.vo.OrderDetailComponentListReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.ordercomponent.vo.OrderDetailComponentPageReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plate.vo.OrderViewPlatePageRespVO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.ordecomponent.OrderComponentDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.goods.GoodsDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.goods.OrderGoodsPlateNumAndAreaDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.ordercomponent.OrderComponentDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.order.OrderPlateNumAndAreaDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderBody.OrderBodyDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderBody.OrderBodyPlateNumAndAreaDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderItem.OrderBodyViewPlatesPageDO;
|
||||
import com.cf.imes.module.executor.dal.mysql.goods.GoodsMapper;
|
||||
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.ordercomponent.OrderComponentMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.plate.PlateMapper;
|
||||
import com.cf.imes.module.executor.enums.ErrorCodeConstants;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Deque;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -32,7 +50,11 @@ import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_COMPONENT_DELETE_PLATE_IN_PLAN;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_COMPONENT_NOT_EXIST;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_COMPONENT_NO_NEED_TO_RESTORE;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_COMPONENT_RESTORE_PARENT_IS_DELETED;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 订单部件服务实现类 ServiceImpl
|
||||
@@ -49,6 +71,18 @@ public class OrderComponentServiceImpl implements OrderComponentService {
|
||||
@Resource
|
||||
private OrderItemMapper orderItemMapper;
|
||||
|
||||
@Resource
|
||||
private OrderMapper orderMapper;
|
||||
|
||||
@Resource
|
||||
private PlateMapper plateMapper;
|
||||
|
||||
@Resource
|
||||
private GoodsMapper goodsMapper;
|
||||
|
||||
@Resource
|
||||
private OrderBodyMapper orderBodyMapper;
|
||||
|
||||
@Override
|
||||
public List<OrderComponentRespVO> getOrderComponentList(OrderDetailComponentListReqVO reqVO) {
|
||||
List<OrderComponentRespVO> resultList = new ArrayList<>();
|
||||
@@ -87,19 +121,21 @@ public class OrderComponentServiceImpl implements OrderComponentService {
|
||||
|
||||
@Override
|
||||
public List<OrderComponentRespVO> getComponentListOnTopId(OrderDetailComponentListReqVO reqVO) {
|
||||
Long componentId = reqVO.getComponentId();
|
||||
Set<Long> componentIds = reqVO.getComponentIds();
|
||||
Long orderId = reqVO.getOrderId();
|
||||
|
||||
// 1、查询部件
|
||||
OrderComponentDO componentDO = orderComponentMapper.selectById(componentId);
|
||||
if (ObjectUtil.isNull(componentDO)) {
|
||||
List<OrderComponentDO> componentDOS = orderComponentMapper.selectByIds(componentIds);
|
||||
if (CollUtil.isEmpty(componentDOS) || componentDOS.size() != componentIds.size()) {
|
||||
throw new ServiceException(ORDER_COMPONENT_NOT_EXIST);
|
||||
}
|
||||
List<Long> topIds = componentDOS.stream()
|
||||
.map(OrderComponentDO::getTopId)
|
||||
.toList();
|
||||
|
||||
// 2、根据部件的topid查询树上所有节点
|
||||
List<OrderComponentDO> topComponentList = orderComponentMapper.selectList(new LambdaQueryWrapperX<OrderComponentDO>()
|
||||
.eq(OrderComponentDO::getTopId, componentDO.getTopId())
|
||||
.eq(OrderComponentDO::getOrganId, componentDO.getOrganId())
|
||||
.in(OrderComponentDO::getTopId, topIds)
|
||||
.eq(OrderComponentDO::getOrderId, orderId)
|
||||
.eqIfPresent(OrderComponentDO::getDeleted, reqVO.isDeleted())
|
||||
.likeIfPresent(OrderComponentDO::getName, reqVO.getName())
|
||||
@@ -120,7 +156,7 @@ public class OrderComponentServiceImpl implements OrderComponentService {
|
||||
throw new ServiceException(ORDER_COMPONENT_NOT_EXIST);
|
||||
}
|
||||
|
||||
if(CollUtil.isEmpty(componentIds)) {
|
||||
if (CollUtil.isEmpty(componentIds)) {
|
||||
// 2、把下级部件id作为查询条件
|
||||
List<OrderComponentDO> orderComponentDOS = orderComponentMapper.selectList(new LambdaQueryWrapperX<OrderComponentDO>()
|
||||
.eq(OrderComponentDO::getTopId, componentDO.getTopId())
|
||||
@@ -128,7 +164,7 @@ public class OrderComponentServiceImpl implements OrderComponentService {
|
||||
.eq(OrderComponentDO::getOrderId, orderId)
|
||||
.eqIfPresent(OrderComponentDO::getDeleted, pageReqVO.isDeleted())
|
||||
.select(OrderComponentDO::getId));
|
||||
if(CollUtil.isNotEmpty(orderComponentDOS)) {
|
||||
if (CollUtil.isNotEmpty(orderComponentDOS)) {
|
||||
componentIds = orderComponentDOS.stream().map(OrderComponentDO::getId).collect(Collectors.toSet());
|
||||
} else {
|
||||
return new PageResult<>();
|
||||
@@ -141,7 +177,7 @@ public class OrderComponentServiceImpl implements OrderComponentService {
|
||||
// 分页查询板件
|
||||
PageDTO<OrderComponentRespVO> page = new PageDTO<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
|
||||
IPage<OrderBodyViewPlatesPageDO> pageRes = orderItemMapper.selectBodyViewPlatesPage(page, orderId, null,
|
||||
null, null, getUserOrganId(), componentIds, false);
|
||||
null, null, getUserOrganId(), componentIds, false);
|
||||
return new PageResult<>(BeanUtil.copyToList(pageRes.getRecords(), OrderViewPlatePageRespVO.class), pageRes.getTotal());
|
||||
}
|
||||
|
||||
@@ -158,7 +194,7 @@ public class OrderComponentServiceImpl implements OrderComponentService {
|
||||
}
|
||||
Long cadViewFileId = componentDO.getCadViewFileId();
|
||||
|
||||
if(CollUtil.isEmpty(componentIds)) {
|
||||
if (CollUtil.isEmpty(componentIds)) {
|
||||
// 2、把下级部件id作为查询条件
|
||||
List<OrderComponentDO> orderComponentDOS = orderComponentMapper.selectList(new LambdaQueryWrapperX<OrderComponentDO>()
|
||||
.eq(OrderComponentDO::getTopId, componentDO.getTopId())
|
||||
@@ -166,7 +202,7 @@ public class OrderComponentServiceImpl implements OrderComponentService {
|
||||
.eq(OrderComponentDO::getOrderId, orderId)
|
||||
.eqIfPresent(OrderComponentDO::getDeleted, pageReqVO.isDeleted())
|
||||
.select(OrderComponentDO::getId));
|
||||
if(CollUtil.isNotEmpty(orderComponentDOS)) {
|
||||
if (CollUtil.isNotEmpty(orderComponentDOS)) {
|
||||
componentIds = orderComponentDOS.stream().map(OrderComponentDO::getId).collect(Collectors.toSet());
|
||||
} else {
|
||||
return Collections.emptyList();
|
||||
@@ -194,4 +230,293 @@ public class OrderComponentServiceImpl implements OrderComponentService {
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteOrderComponent(Long orderId, Long id) {
|
||||
// 校验自身
|
||||
OrderDO orderDO = orderMapper.selectById(orderId);
|
||||
AssertUtils.notEmpty(orderDO, ORDER_NOT_EXISTS);
|
||||
|
||||
OrderComponentDO componentDO = orderComponentMapper.selectById(id);
|
||||
AssertUtils.notEmpty(componentDO, ORDER_COMPONENT_NOT_EXIST);
|
||||
|
||||
// 查询top树下层级以下的所有部件
|
||||
List<OrderComponentDO> componentOnTop = orderComponentMapper.getComponentListOnTopLevel(orderId, componentDO.getTopId(), componentDO.getLevel(), false);
|
||||
|
||||
// 整理出所属的下级,整理成id集合
|
||||
Set<Long> deleteIds = getChildrenIds(componentDO, componentOnTop);
|
||||
|
||||
// 需要重新累计数量的order_goods id
|
||||
Set<Long> deleteGoodsIds = new HashSet<>();
|
||||
// 需要重新累计数量的柜体 id
|
||||
Set<Long> deleteBodyIds = new HashSet<>();
|
||||
// 删除的板件总数量
|
||||
int deleteRowsTotal = 0;
|
||||
|
||||
// 分批处理:删除对应的板件
|
||||
List<List<Long>> split = CollUtil.split(deleteIds, 10);
|
||||
for (List<Long> ids : split) {
|
||||
// 5、部件下是否有在排单中的板件,有则终止删除
|
||||
boolean plateInPlan = orderComponentMapper.selectOrderComponentPlateInPlan(ids);
|
||||
if (plateInPlan) {
|
||||
throw new ServiceException(ORDER_COMPONENT_DELETE_PLATE_IN_PLAN);
|
||||
}
|
||||
|
||||
// 删除前累计goods_id
|
||||
List<Long> batchDeleteGoodsIds = plateMapper.selectOrderComponentGoodsIds(orderId, ids, false);
|
||||
deleteGoodsIds.addAll(batchDeleteGoodsIds);
|
||||
|
||||
// 删除前累计body_id
|
||||
List<Long> batchDeleteBodyIds = plateMapper.selectOrderComponentBodyIds(orderId, ids, false);
|
||||
deleteBodyIds.addAll(batchDeleteBodyIds);
|
||||
|
||||
// 删除部件下的板件
|
||||
int deletedRows;
|
||||
do {
|
||||
// 调用 Mapper 批量删除
|
||||
deletedRows = plateMapper.updateOrderComponentPlate(orderId, ids, true);
|
||||
// 循环直到没有删除
|
||||
deleteRowsTotal += deletedRows;
|
||||
} while (deletedRows > 0);
|
||||
|
||||
// 删除部件
|
||||
orderComponentMapper.deleteByIds(ids);
|
||||
|
||||
// TODO 打包解包
|
||||
}
|
||||
|
||||
if (deleteRowsTotal == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 更新影响的柜体
|
||||
updateOrderBodyPlateNum(deleteBodyIds);
|
||||
// 更新影响的订单商品
|
||||
updateOrderGoodsPlateNumAndArea(deleteGoodsIds);
|
||||
// 更新订单
|
||||
updateOrderPlateNumAndArea(orderDO);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void restoreOrderComponent(Long orderId, Long id) {
|
||||
// 校验自身
|
||||
OrderDO orderDO = orderMapper.selectById(orderId);
|
||||
AssertUtils.notEmpty(orderDO, ORDER_NOT_EXISTS);
|
||||
|
||||
OrderComponentDO componentDO = orderComponentMapper.selectByIdIgnoreDeleted(id);
|
||||
AssertUtils.notEmpty(componentDO, ORDER_COMPONENT_NOT_EXIST);
|
||||
AssertUtils.equals(componentDO.getDeleted(), false, ORDER_COMPONENT_NO_NEED_TO_RESTORE);
|
||||
|
||||
// 非顶级需要校验上级是否恢复
|
||||
if (OrderComponentDO.PARENT_ID_ROOT.equals(componentDO.getPid())) {
|
||||
OrderComponentDO parent = orderComponentMapper.selectByIdIgnoreDeleted(componentDO.getPid());
|
||||
if(parent != null && parent.getDeleted()) {
|
||||
throw new ServiceException(ORDER_COMPONENT_RESTORE_PARENT_IS_DELETED);
|
||||
}
|
||||
}
|
||||
|
||||
// 查询top树下层级以下的所有部件
|
||||
List<OrderComponentDO> componentOnTop = orderComponentMapper.getComponentListOnTopLevel(orderId, componentDO.getTopId(), componentDO.getLevel(), true);
|
||||
|
||||
// 整理出所属的下级,整理成id集合
|
||||
Set<Long> restoreIds = getChildrenIds(componentDO, componentOnTop);
|
||||
|
||||
// 需要重新累计数量的order_goods id
|
||||
Set<Long> restoreGoodsIds = new HashSet<>();
|
||||
// 需要重新累计数量的柜体 id
|
||||
Set<Long> restoreBodyIds = new HashSet<>();
|
||||
// 删除的板件总数量
|
||||
int restoreRowsTotal = 0;
|
||||
|
||||
// 分批处理:删除对应的板件
|
||||
List<List<Long>> split = CollUtil.split(restoreIds, 10);
|
||||
for (List<Long> ids : split) {
|
||||
// 5、部件下是否有在排单中的板件,有则终止恢复
|
||||
boolean plateInPlan = orderComponentMapper.selectOrderComponentPlateInPlan(ids);
|
||||
if (plateInPlan) {
|
||||
throw new ServiceException(ORDER_COMPONENT_DELETE_PLATE_IN_PLAN);
|
||||
}
|
||||
|
||||
// 恢复前累计goods_id
|
||||
List<Long> batchDeleteGoodsIds = plateMapper.selectOrderComponentGoodsIds(orderId, ids, true);
|
||||
restoreGoodsIds.addAll(batchDeleteGoodsIds);
|
||||
|
||||
// 恢复前累计body_id
|
||||
List<Long> batchDeleteBodyIds = plateMapper.selectOrderComponentBodyIds(orderId, ids, true);
|
||||
restoreBodyIds.addAll(batchDeleteBodyIds);
|
||||
|
||||
// 恢复部件下的板件
|
||||
int restoreRows;
|
||||
do {
|
||||
// 批量恢复
|
||||
restoreRows = plateMapper.updateOrderComponentPlate(orderId, ids, false);
|
||||
// 循环直到没有影响
|
||||
restoreRowsTotal += restoreRows;
|
||||
} while (restoreRows > 0);
|
||||
|
||||
// 恢复部件
|
||||
orderComponentMapper.restoreOrderComponents(orderId, ids);
|
||||
|
||||
// TODO 打包解包
|
||||
}
|
||||
|
||||
if (restoreRowsTotal == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 更新影响的柜体
|
||||
updateOrderBodyPlateNum(restoreBodyIds);
|
||||
// 更新影响的订单商品
|
||||
updateOrderGoodsPlateNumAndArea(restoreGoodsIds);
|
||||
// 更新订单
|
||||
updateOrderPlateNumAndArea(orderDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新影响的柜体的 板件数量
|
||||
*
|
||||
* @param orderBodyIds
|
||||
*/
|
||||
private void updateOrderBodyPlateNum(Set<Long> orderBodyIds) {
|
||||
// 查询删除涉及的柜体
|
||||
Map<Long, OrderBodyDO> bodyMap = orderBodyMapper.selectByIds(orderBodyIds)
|
||||
.stream()
|
||||
.collect(Collectors.toMap(OrderBodyDO::getId, Function.identity()));
|
||||
|
||||
// 统计删除涉及的柜体下的数量和面积、更新到order_body
|
||||
Map<Long, OrderBodyPlateNumAndAreaDO> bodyStatMap = orderBodyMapper.selectPlateNumAndArea(orderBodyIds)
|
||||
.stream()
|
||||
.collect(Collectors.toMap(
|
||||
OrderBodyPlateNumAndAreaDO::getOrderBodyId,
|
||||
Function.identity()
|
||||
));
|
||||
for (Long orderBodyId : orderBodyIds) {
|
||||
|
||||
OrderBodyDO orderBodyDO = bodyMap.get(orderBodyId);
|
||||
int version = orderBodyDO.getVersion();
|
||||
OrderBodyPlateNumAndAreaDO stat =
|
||||
bodyStatMap.getOrDefault(orderBodyId,
|
||||
new OrderBodyPlateNumAndAreaDO(orderBodyId, 0, BigDecimal.ZERO));
|
||||
|
||||
int update = orderBodyMapper.update(new LambdaUpdateWrapper<OrderBodyDO>()
|
||||
.eq(OrderBodyDO::getId, orderBodyId)
|
||||
.eq(OrderBodyDO::getVersion, version)
|
||||
.set(OrderBodyDO::getPlateNum, stat.getNum())
|
||||
.set(OrderBodyDO::getVersion, version + 1));
|
||||
|
||||
if (update == 0) {
|
||||
throw new ServiceException(ErrorCodeConstants.BODY_PLATE_UPDATE_CONCURRENCY_ERROR, orderBodyId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新影响的订单商品的 板件数量和面积
|
||||
*
|
||||
* @param orderGoodsIds
|
||||
*/
|
||||
private void updateOrderGoodsPlateNumAndArea(Set<Long> orderGoodsIds) {
|
||||
// 查询删除涉及的order_goods
|
||||
Map<Long, GoodsDO> goodsMap =
|
||||
goodsMapper.selectByIds(orderGoodsIds)
|
||||
.stream()
|
||||
.collect(Collectors.toMap(GoodsDO::getId, Function.identity()));
|
||||
|
||||
// 统计删除涉及的order_goods下的数量和面积、更新到order_goods
|
||||
Map<Long, OrderGoodsPlateNumAndAreaDO> goodStatMap =
|
||||
goodsMapper.selectPlateNumAndArea(orderGoodsIds)
|
||||
.stream()
|
||||
.collect(Collectors.toMap(
|
||||
OrderGoodsPlateNumAndAreaDO::getOrderGoodsId,
|
||||
Function.identity()
|
||||
));
|
||||
|
||||
for (Long orderGoodsId : orderGoodsIds) {
|
||||
|
||||
GoodsDO goodsDO = goodsMap.get(orderGoodsId);
|
||||
|
||||
OrderGoodsPlateNumAndAreaDO stat =
|
||||
goodStatMap.getOrDefault(orderGoodsId,
|
||||
new OrderGoodsPlateNumAndAreaDO(orderGoodsId, 0, BigDecimal.ZERO));
|
||||
|
||||
int version = goodsDO.getVersion();
|
||||
int update = goodsMapper.update(new LambdaUpdateWrapper<GoodsDO>()
|
||||
.eq(GoodsDO::getId, orderGoodsId)
|
||||
.eq(GoodsDO::getVersion, version)
|
||||
.set(GoodsDO::getArea, stat.getArea())
|
||||
.set(GoodsDO::getPlateNum, stat.getNum())
|
||||
.set(GoodsDO::getVersion, version + 1));
|
||||
|
||||
if (update == 0) {
|
||||
throw new ServiceException(ErrorCodeConstants.GOODS_PLATE_UPDATE_CONCURRENCY_ERROR, orderGoodsId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateOrderPlateNumAndArea(OrderDO orderDO) {
|
||||
Long orderId = orderDO.getId();
|
||||
// 重新计算订单数量
|
||||
// 统计每个orders下的未排单面积,更新到orders中
|
||||
OrderPlateNumAndAreaDO orderPlateNumAndAreaDO = orderMapper.selectPlateNumAndArea(orderId);
|
||||
|
||||
// 当前生产单下排单的板件数量
|
||||
Integer num = orderPlateNumAndAreaDO.getNum();
|
||||
|
||||
int version = orderDO.getVersion();
|
||||
LambdaUpdateWrapper<OrderDO> updateWrapper = new LambdaUpdateWrapper<OrderDO>()
|
||||
.eq(OrderDO::getId, orderId)
|
||||
.eq(OrderDO::getVersion, version)
|
||||
.set(OrderDO::getPlannedPlateArea, orderPlateNumAndAreaDO.getArea())
|
||||
.set(OrderDO::getPlannedPlateNum, num)
|
||||
.set(OrderDO::getVersion, version + 1);
|
||||
int update = orderMapper.update(updateWrapper);
|
||||
if (update == 0) {
|
||||
throw new ServiceException(com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_PLATE_UPDATE_CONCURRENCY_ERROR, orderId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 整理出需要删除的部件id列表
|
||||
*
|
||||
* @param componentDO
|
||||
* @param componentOnTop
|
||||
* @return
|
||||
*/
|
||||
private Set<Long> getChildrenIds(OrderComponentDO componentDO, List<OrderComponentDO> componentOnTop) {
|
||||
// 3、整理出真正的下级(通过 pid 逐级确认)
|
||||
Set<Long> needDeleteIds = new HashSet<>();
|
||||
needDeleteIds.add(componentDO.getId());
|
||||
|
||||
if (CollUtil.isNotEmpty(componentOnTop)) {
|
||||
|
||||
// 先构建 pid -> children 映射
|
||||
Map<Long, List<OrderComponentDO>> childrenMap = componentOnTop.stream()
|
||||
.collect(Collectors.groupingBy(OrderComponentDO::getPid));
|
||||
|
||||
// 用队列逐级往下找
|
||||
Deque<Long> queue = new ArrayDeque<>();
|
||||
queue.add(componentDO.getId());
|
||||
|
||||
while (!queue.isEmpty()) {
|
||||
Long parentId = queue.poll();
|
||||
|
||||
List<OrderComponentDO> children = childrenMap.get(parentId);
|
||||
if (CollUtil.isEmpty(children)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (OrderComponentDO child : children) {
|
||||
Long childId = child.getId();
|
||||
if (needDeleteIds.add(childId)) { // 防重复
|
||||
queue.add(childId); // 继续往下找
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return needDeleteIds;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+14
@@ -575,4 +575,18 @@
|
||||
and og.deleted = false
|
||||
</select>
|
||||
|
||||
<select id="selectPlateNumAndArea" resultType="com.cf.imes.module.executor.dal.dataobject.goods.OrderGoodsPlateNumAndAreaDO">
|
||||
SELECT
|
||||
op.goods_id as order_goods_id,
|
||||
COUNT(*) AS num,
|
||||
IFNULL(SUM(op.area),0) AS area
|
||||
FROM order_plate op
|
||||
WHERE op.goods_id IN
|
||||
<foreach collection="orderGoodsIds" item="orderGoodsId" open="(" close=")" separator=",">
|
||||
#{orderGoodsId}
|
||||
</foreach>
|
||||
AND op.deleted = false
|
||||
GROUP BY op.goods_id
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
+10
-3
@@ -16,9 +16,6 @@
|
||||
<result property="area" column="area"/>
|
||||
|
||||
|
||||
<!-- <collection property="platePages" ofType="com.cf.imes.module.executor.controller.admin.plan.vo.PlatePage" resultMap="PlatePageMap"/>-->
|
||||
|
||||
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="PlatePageMap" type="com.cf.imes.module.executor.controller.admin.plan.vo.PlatePage">
|
||||
@@ -636,4 +633,14 @@
|
||||
and op.deleted = false
|
||||
and o.deleted = false
|
||||
</select>
|
||||
|
||||
<select id="selectPlateNumAndArea" resultType="com.cf.imes.module.executor.dal.dataobject.order.OrderPlateNumAndAreaDO">
|
||||
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>
|
||||
+19
@@ -71,4 +71,23 @@
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
<select id="selectPlateNumAndArea" resultType="com.cf.imes.module.executor.dal.dataobject.orderBody.OrderBodyPlateNumAndAreaDO">
|
||||
SELECT
|
||||
oi.body_id AS order_body_id,
|
||||
COUNT(*) AS num,
|
||||
IFNULL(SUM(op.area),0) AS area
|
||||
FROM order_item oi
|
||||
JOIN order_plate op
|
||||
ON op.organ_id = oi.organ_id
|
||||
AND op.order_id = oi.order_id
|
||||
AND op.id = oi.plate_id
|
||||
AND op.plan_id != 0
|
||||
AND op.deleted = false
|
||||
WHERE oi.body_id IN
|
||||
<foreach collection="orderBodyIds" item="orderBodyId" open="(" close=")" separator=",">
|
||||
#{orderBodyId}
|
||||
</foreach>
|
||||
GROUP BY oi.body_id
|
||||
</select>
|
||||
</mapper>
|
||||
+42
-24
@@ -21,7 +21,7 @@
|
||||
</select>
|
||||
|
||||
<select id="getTopComponentListIn"
|
||||
resultType="com.cf.imes.module.executor.dal.dataobject.ordecomponent.OrderComponentDO">
|
||||
resultType="com.cf.imes.module.executor.dal.dataobject.ordercomponent.OrderComponentDO">
|
||||
select distinct p.id, p.name
|
||||
from order_component p
|
||||
join order_component c
|
||||
@@ -32,28 +32,46 @@
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="getOrderDetailComponentList" resultType="com.cf.imes.module.executor.dal.dataobject.ordecomponent.OrderComponentDO">
|
||||
select
|
||||
ob.room_id,
|
||||
oc.body_id,
|
||||
oc.order_id
|
||||
oc.id,
|
||||
oc.name
|
||||
from order_component oc
|
||||
left join order_body ob on oc.body_id = ob.id
|
||||
where oc.order_id in
|
||||
<foreach collection="orderIds"
|
||||
item="orderId"
|
||||
open="("
|
||||
separator=","
|
||||
close=")">
|
||||
#{orderId}
|
||||
</foreach>
|
||||
<if test="name !=null and name != ''">
|
||||
and oc.name = #{name}
|
||||
</if>
|
||||
<if test="processStatus != null">
|
||||
and oc.process_status = #{processStatus}
|
||||
</if>
|
||||
<select id="getComponentListOnTopLevel"
|
||||
resultType="com.cf.imes.module.executor.dal.dataobject.ordercomponent.OrderComponentDO">
|
||||
select * from order_component oc
|
||||
where oc.order_id = #{orderId}
|
||||
and oc.top_id = #{topId}
|
||||
and oc.deleted = #{deleted}
|
||||
and oc.level > #{level}
|
||||
</select>
|
||||
|
||||
<select id="selectOrderComponentPlateInPlan" resultType="boolean">
|
||||
select exists (
|
||||
select 1
|
||||
from order_item oi
|
||||
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.comp_id in
|
||||
<foreach item="componentId" collection="componentIds" open="(" separator="," close=")">
|
||||
#{componentId}
|
||||
</foreach>
|
||||
and oi.plate_id != 0
|
||||
and op.plan_id != 0
|
||||
)
|
||||
</select>
|
||||
|
||||
<select id="selectByIdIgnoreDeleted"
|
||||
resultType="com.cf.imes.module.executor.dal.dataobject.ordercomponent.OrderComponentDO">
|
||||
select *
|
||||
from order_component
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<update id="restoreOrderComponents">
|
||||
update order_component
|
||||
set deleted = false
|
||||
where
|
||||
order_id = #{orderId}
|
||||
and id in
|
||||
<foreach item="componentId" collection="componentIds" open="(" close=")" separator=",">
|
||||
#{componentId}
|
||||
</foreach>
|
||||
and deleted = true
|
||||
</update>
|
||||
</mapper>
|
||||
+60
@@ -967,6 +967,66 @@
|
||||
|
||||
</select>
|
||||
|
||||
<update id="updateOrderComponentPlate">
|
||||
UPDATE order_plate op
|
||||
SET op.deleted = #{deleted}
|
||||
WHERE op.deleted != #{deleted}
|
||||
AND op.order_id = #{orderId}
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM order_item oi
|
||||
WHERE oi.plate_id = op.id
|
||||
AND oi.organ_id = op.organ_id
|
||||
AND oi.order_id = op.order_id
|
||||
AND oi.comp_id IN (
|
||||
<foreach item="componentId" collection="componentIds" separator=",">
|
||||
#{componentId}
|
||||
</foreach>
|
||||
)
|
||||
)
|
||||
ORDER BY op.id
|
||||
LIMIT 1000;
|
||||
</update>
|
||||
|
||||
<select id="selectOrderComponentGoodsIds" resultType="java.lang.Long">
|
||||
SELECT op.goods_id
|
||||
FROM order_plate op
|
||||
WHERE op.order_id = #{orderId}
|
||||
AND op.deleted = #{deleted}
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM order_item oi
|
||||
WHERE oi.plate_id = op.id
|
||||
AND oi.organ_id = op.organ_id
|
||||
AND oi.order_id = op.order_id
|
||||
AND oi.comp_id IN
|
||||
<foreach item="componentId" collection="componentIds" open="(" separator="," close=")">
|
||||
#{componentId}
|
||||
</foreach>
|
||||
AND oi.plate_id != 0
|
||||
)
|
||||
GROUP BY op.goods_id
|
||||
</select>
|
||||
|
||||
<select id="selectOrderComponentBodyIds" resultType="java.lang.Long">
|
||||
SELECT oi.body_id
|
||||
FROM order_item oi
|
||||
WHERE oi.order_id = #{orderId}
|
||||
AND oi.comp_id IN
|
||||
<foreach item="componentId" collection="componentIds" open="(" separator="," close=")">
|
||||
#{componentId}
|
||||
</foreach>
|
||||
AND oi.plate_id != 0
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM order_plate op
|
||||
WHERE op.id = oi.plate_id
|
||||
AND op.organ_id = oi.organ_id
|
||||
AND op.order_id = oi.order_id
|
||||
AND op.deleted = #{deleted}
|
||||
)
|
||||
GROUP BY oi.body_id
|
||||
</select>
|
||||
|
||||
<resultMap id="orderItemMap" type="com.cf.imes.module.executor.controller.admin.manage.query.vo.pack.PackageDetailsRespVO">
|
||||
<result property="orderId" column="orderId"/>
|
||||
|
||||
+4
-1
@@ -26,4 +26,7 @@ veneer.org.classification.name.empty=组织下分类名称不存在,请前往
|
||||
veneer.import.template.download.error=导入模版下载失败
|
||||
veneer.import.org.classification.name.not.exist=第{0}行分类名称{1}不存在,请前往 [新增] 窗口维护分类名称
|
||||
|
||||
order.component.not.exist=订单部件不存在
|
||||
order.component.not.exist=订单部件不存在
|
||||
order.component.delete.plate.in.plan=部件下存在已排单的板件,请移除部件后再次进行删除
|
||||
order.component.restore.parent.is.deleted=该部件上级已被删除,请先恢复上级部件
|
||||
order.component.no.need.to.restore=该部件未删除,无需恢复
|
||||
+4
-1
@@ -26,4 +26,7 @@ veneer.org.classification.name.empty=組織下分類名稱不存在,請前往
|
||||
veneer.import.template.download.error=導入模版下載失敗
|
||||
veneer.import.org.classification.name.not.exist=第{0}行分類名稱{1}不存在,請前往[新增]視窗維護分類名稱
|
||||
|
||||
order.component.not.exist=訂單部件不存在
|
||||
order.component.not.exist=訂單部件不存在
|
||||
order.component.delete.plate.in.plan=部件下存在已排單的板件,請移除部件後再次進行删除
|
||||
order.component.restore.parent.is.deleted=該部件上級已被删除,請先恢復上級部件
|
||||
order.component.no.need.to.restore=該部件未删除,無需恢復
|
||||
+4
-1
@@ -26,4 +26,7 @@ veneer.org.classification.name.empty=The classification name does not exist unde
|
||||
veneer.import.template.download.error=Import template download failed
|
||||
veneer.import.org.classification.name.not.exist=The classification name {1} does not exist in line {0}, please go to the [Add] window to maintain the classification name
|
||||
|
||||
order.component.not.exist=The order component does not exist
|
||||
order.component.not.exist=The order component does not exist
|
||||
order.component.delete.plate.in.plan=There are already listed boards under the component. Please remove the component and delete it again
|
||||
order.component.restore.parent.is.deleted=The upper level of this component has been deleted. Please restore the upper level component first
|
||||
order.component.no.need.to.restore=This component has not been deleted and does not need to be restored
|
||||
Reference in New Issue
Block a user