mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-13 05:12:07 +08:00
优化生产大板字段类型更改,未排单接口查询速度优化
This commit is contained in:
+7
-6
@@ -1,12 +1,13 @@
|
||||
package com.cf.imes.module.executor.controller.admin.goods.vo;
|
||||
|
||||
import lombok.*;
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
@@ -24,7 +25,7 @@ public class GoodsPageReqVO extends PageParam {
|
||||
private Long rawGoodsId;
|
||||
|
||||
@Schema(description = "商品 ID", example = "243")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
@Schema(description = "商品名称", example = "晨丰")
|
||||
private String goodsName;
|
||||
|
||||
+4
-6
@@ -1,14 +1,12 @@
|
||||
package com.cf.imes.module.executor.controller.admin.goods.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 生产单商品 Response VO")
|
||||
@Data
|
||||
@@ -29,7 +27,7 @@ public class GoodsRespVO {
|
||||
|
||||
@Schema(description = "商品 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "243")
|
||||
@ExcelProperty("商品 ID")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
@Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰")
|
||||
@ExcelProperty("商品名称")
|
||||
|
||||
+2
-4
@@ -1,11 +1,9 @@
|
||||
package com.cf.imes.module.executor.controller.admin.goods.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 生产单商品新增/修改 Request VO")
|
||||
@Data
|
||||
@@ -21,7 +19,7 @@ public class GoodsSaveReqVO {
|
||||
private Long rawGoodsId;
|
||||
|
||||
@Schema(description = "商品 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "243")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
@Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰")
|
||||
private String goodsName;
|
||||
|
||||
-8
@@ -128,13 +128,5 @@ public class OptimizePlanController {
|
||||
}
|
||||
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "ES批量删除测试")
|
||||
@PreAuthorize("@ss.hasPermission('placeorder:delete')")
|
||||
public CommonResult<String> deleteTest(@RequestParam("id") List<Long> id) {
|
||||
return success(optimizePlanService.deleteTest(id));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ public class PlanController {
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建排单")
|
||||
@PreAuthorize("@ss.hasPermission('placeorder:create')")
|
||||
public CommonResult<Map<Long,Long>> createPlan(@Validated(CreateGroup.class) @RequestBody PlanSaveReqVO createReqVO) {
|
||||
public CommonResult<Map<String,Long>> createPlan(@Validated(CreateGroup.class) @RequestBody PlanSaveReqVO createReqVO) {
|
||||
return success(planService.createPlan(createReqVO));
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ public class OrderIds {
|
||||
|
||||
|
||||
@Schema(description = "商品ID-板材库对应的大板ID")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ public class NotPlanGoodsRespVO {
|
||||
|
||||
|
||||
@Schema(description = "商品ID-板材库对应的大板ID")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
|
||||
@Schema(description = "商品名称")
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ public class OptimizeRemainPlate {
|
||||
|
||||
|
||||
@Schema(description = "商品ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
|
||||
|
||||
|
||||
-66
@@ -1,66 +0,0 @@
|
||||
package com.cf.imes.module.executor.controller.admin.plan.saveOptimize;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
import static com.cf.imes.framework.common.util.date.DateUtils.TIME_ZONE_DEFAULT;
|
||||
|
||||
@Data
|
||||
@Schema(description = "优化后的生产单数据")
|
||||
public class SaveOrderReqVO {
|
||||
|
||||
@Schema(description = "生产单id")
|
||||
private Long orderId;
|
||||
|
||||
@Schema(description = "父id")
|
||||
private Long parentNo;
|
||||
|
||||
@Schema(description = "自定义单号")
|
||||
private String customOrderNo;
|
||||
|
||||
@Schema(description = "客户")
|
||||
private String customer;
|
||||
|
||||
@Schema(description = "地址")
|
||||
private String address;
|
||||
|
||||
@Schema(description = "客户电话")
|
||||
private String phoneNumber;
|
||||
|
||||
@Schema(description = "经销商")
|
||||
private String dealer;
|
||||
|
||||
@Schema(description = "经销商电话")
|
||||
private String dealerPhoneNumber;
|
||||
|
||||
@Schema(description = "业务员")
|
||||
private String salesman;
|
||||
|
||||
@Schema(description = "拆单员")
|
||||
private String splitter;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "交付日期")
|
||||
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT)
|
||||
private Date deliveryDate;
|
||||
|
||||
@Schema(description = "生产单类型,1主单 2子单")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "生产单排序号")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "CAD数据类型,1CAD 2WebCAD 3Excel")
|
||||
private Integer dataType;
|
||||
|
||||
@Schema(description = "订单状态,0未排单1已排单2生产中3加工完成4打包完成5入库完成6出库完成")
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
+1
-1
@@ -30,7 +30,7 @@ public class GoodsReqVO {
|
||||
private Long rawGoodsId;
|
||||
|
||||
@Schema(description = "商品 ID-大板的实际ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "243")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
@Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰")
|
||||
private String goodsName;
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ public class NotPlanOrderPlateRespVO {
|
||||
private List<OrderIds> orderIdList;
|
||||
|
||||
@Schema(description = "商品ID-板材库对应的大板ID")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
@Schema(description = "商品名称")
|
||||
private String goodsName;
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ public class OrderGoodsResp {
|
||||
@Schema(description = "生产单id")
|
||||
private List<OrderIds> orderIds;
|
||||
@Schema(description = "商品id-商品编号")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
@Schema(description = "商品名称")
|
||||
private String goodsName;
|
||||
@Schema(description = "商品材质")
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@ public class OrderPageReqVOCopy extends PageParam {
|
||||
|
||||
// todo 目前商品ID的数据筛选只解决了非混单的情况(非混单,数据类型为Long即可,混单情况需要改变),混单数据筛选待解决
|
||||
@Schema(description = "商品ID-板材库对应的大板ID")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
@Schema(description = "大板分类ID")
|
||||
private List<Long> ids;
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ public class OrderRespVOCopy {
|
||||
@Schema(description = "平方")
|
||||
private BigDecimal area = new BigDecimal("0");
|
||||
@Schema(description = "商品id")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
// @Schema(description = "商品名称")
|
||||
// private String goodsName;
|
||||
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ import java.math.BigDecimal;
|
||||
public class PlanGoodsVO {
|
||||
|
||||
@Schema(description = "商品id")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
@Schema(description = "商品名称")
|
||||
private String goodsName;
|
||||
@Schema(description = "材质")
|
||||
|
||||
+1
-1
@@ -78,7 +78,7 @@ public class PlanSaveReqVO {
|
||||
|
||||
@Schema(description = "板材库大板id")
|
||||
@NotNull
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
@Schema(description = "余料板ID")
|
||||
@NotNull
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ public class PlateDetialRespVO {
|
||||
|
||||
|
||||
@Schema(description = "大板实际ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
@Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String goodsName;
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ public class PlateInfoVO {
|
||||
|
||||
|
||||
@Schema(description = "板材库对应的大板ID-大板实际ID")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
|
||||
@Schema(description = "材质:颗粒板、欧松板、多层板、生态板、禾香板、密度板、实木、铝蜂窝板、铝塑板", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ public class PlatePage {
|
||||
@Schema(description = "生产单id")
|
||||
private Long orderId;
|
||||
@Schema(description = "商品id")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
@Schema(description = "板名称")
|
||||
private String name;
|
||||
@Schema(description = "商品名称")
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ public class OptimizationSavePlateReqVO {
|
||||
|
||||
|
||||
@Schema(description = "商品ID-大板的实际ID")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
@Schema(description = "纹路类型,0 正纹 1 可翻转 2 反纹")
|
||||
private Integer texture;
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ public class OptimizeBoardModelDO extends ESDocument {
|
||||
|
||||
|
||||
@Schema(description = "大板的实际ID")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
|
||||
@Schema(description = "生产单已优化小板数量")
|
||||
|
||||
+6
-15
@@ -9,7 +9,6 @@ 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.goods.vo.GoodsPageReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.bo.OrderRoomBodyList;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.saveOptimize.NotPlanGoodsRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.*;
|
||||
import com.cf.imes.module.executor.dal.dataobject.goods.GoodsDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@@ -80,14 +79,9 @@ public interface GoodsMapper extends BaseMapperX<GoodsDO> {
|
||||
void deletedById(@Param("ids") List<Long> ids, @Param("organId") Long organId);
|
||||
|
||||
|
||||
IPage<OrderGoodsResp> selectGoods(@Param("page") IPage page, @Param("goodsIds") List<Long> goodsIds, @Param("organId") Long organId);
|
||||
|
||||
|
||||
|
||||
List<NotPlanGoodsRespVO> selectGoodsPlateList(@Param("goodIds") List<Long> goodIds,@Param("organId") Long organId);
|
||||
|
||||
|
||||
default List<GoodsDO> selectListByGoodsId(Long goodsId, Long organId) {
|
||||
default List<GoodsDO> selectListByGoodsId(String goodsId, Long organId) {
|
||||
return selectList(new LambdaQueryWrapperX<GoodsDO>()
|
||||
.eq(GoodsDO::getOrganId, organId)
|
||||
.eq(GoodsDO::getDeleted, false)
|
||||
@@ -112,7 +106,7 @@ public interface GoodsMapper extends BaseMapperX<GoodsDO> {
|
||||
|
||||
|
||||
|
||||
default List<GoodsDO> selectListByGoodsIdList(List<Long> goodsIds,List<Long> orderIds, Long organId) {
|
||||
default List<GoodsDO> selectListByGoodsIdList(List<String> goodsIds,List<Long> orderIds, Long organId) {
|
||||
return selectList(new LambdaQueryWrapperX<GoodsDO>()
|
||||
.eq(GoodsDO::getOrganId, organId)
|
||||
.eq(GoodsDO::getDeleted, false)
|
||||
@@ -122,10 +116,10 @@ public interface GoodsMapper extends BaseMapperX<GoodsDO> {
|
||||
}
|
||||
|
||||
|
||||
List<GoodsDO> seleTestSQL(@Param("filed") String filed,@Param("goodsIds") List<Long> goodsIds ,@Param("organId") Long organId);
|
||||
List<GoodsDO> seleTestSQL(@Param("filed") String filed,@Param("goodsIds") List<String> goodsIds ,@Param("organId") Long organId);
|
||||
|
||||
|
||||
default GoodsDO selectGoodsId(Long orderId, Long goodsId, Long organId) {
|
||||
default GoodsDO selectGoodsId(Long orderId, String goodsId, Long organId) {
|
||||
return selectOne(new LambdaQueryWrapperX<GoodsDO>()
|
||||
.eq(GoodsDO::getOrganId, organId)
|
||||
.eq(GoodsDO::getDeleted, false)
|
||||
@@ -135,11 +129,6 @@ public interface GoodsMapper extends BaseMapperX<GoodsDO> {
|
||||
|
||||
}
|
||||
|
||||
default PageResult<GoodsDO> selectTestSQL(OrderPageReqVOCopy pageReqVO) {
|
||||
return selectPage(pageReqVO, new LambdaQueryWrapperX<GoodsDO>()
|
||||
.eq(GoodsDO::getOrganId, getUserOrganId())
|
||||
.orderByDesc(GoodsDO::getId));
|
||||
}
|
||||
|
||||
|
||||
IPage<OrderGoodsResp> selectOrderGoodsList(@Param("page") IPage page, @Param(Constants.WRAPPER) Wrapper<GoodsDO> wrapper);
|
||||
@@ -204,4 +193,6 @@ public interface GoodsMapper extends BaseMapperX<GoodsDO> {
|
||||
|
||||
|
||||
List<OrderRoomBodyList> selectNoPlanRoomBody(@Param("orderIds") List<Long> orderIds, @Param("organId") Long organId);
|
||||
|
||||
IPage<OrderRespVOCopy> selectOrderPlate(@Param("page") IPage page,@Param("organId") Long organId);
|
||||
}
|
||||
+10
-1
@@ -201,10 +201,11 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
|
||||
|
||||
|
||||
|
||||
default List<PlateDO> selectPlateIdList(List<Long> goodsIdList, Long organId) {
|
||||
default List<PlateDO> selectPlateIdList(List<Long> orderIds,List<Long> goodsIdList, Long organId) {
|
||||
return selectList(new LambdaQueryWrapperX<PlateDO>()
|
||||
.eq(PlateDO::getOrganId,organId)
|
||||
.eq(PlateDO::getDeleted,false)
|
||||
.inIfPresent(PlateDO::getOrderId,orderIds)
|
||||
.inIfPresent(PlateDO::getGoodsId,goodsIdList)
|
||||
.eq(PlateDO::getType, OrderPlateTypeEnum.SELFINCREASINGBOARD.getType())
|
||||
.select(PlateDO::getId));
|
||||
@@ -223,6 +224,14 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
|
||||
|
||||
}
|
||||
|
||||
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 updateNoPlateOptimized(@Param("orderIdList") List<Long> orderIdList,@Param("ids") List<Long> ids,@Param("organId") Long organId);
|
||||
|
||||
|
||||
// List<PlateDO> selectTestSQL(@Param("sql") String sql);
|
||||
|
||||
|
||||
+1
-4
@@ -5,7 +5,6 @@ import com.cf.imes.module.executor.controller.admin.plan.saveOptimize.CuttingSta
|
||||
import com.cf.imes.module.executor.controller.admin.plan.saveOptimize.SavePlanPlateResultReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.AddRemainReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.GetSourceDataReq;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.OrderPageReqVOCopy;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.PlateOptimize;
|
||||
import com.cf.imes.module.executor.dal.dataobject.goods.OptimizeBoardModelDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.ordermodel.OrderModelDO;
|
||||
@@ -18,7 +17,7 @@ public interface OptimizePlanService {
|
||||
|
||||
String ORDER_PLATE_MODEL = "imes_order_plate_model";
|
||||
|
||||
String ORDER_REMAIN_PLATE_MODEL = "imes_order_remain_plate_model";
|
||||
String ORDER_REMAIN_PLATE_MODEL = "imes_order_optimize_plate_model";
|
||||
|
||||
List<PlateOptimize> getPlateListByPlanId(Long planId);
|
||||
|
||||
@@ -49,6 +48,4 @@ public interface OptimizePlanService {
|
||||
List<OptimizeBoardModelDO> buildBoardByOrderIds(Collection<Long> orderIds, String index, Integer size);
|
||||
|
||||
|
||||
String deleteTest(List<Long> id);
|
||||
|
||||
}
|
||||
|
||||
-18
@@ -14,7 +14,6 @@ import com.cf.imes.framework.common.enums.PlanStatusEnum;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.es.core.service.ESDocumentService;
|
||||
import com.cf.imes.framework.mybatis.core.query.MPJLambdaWrapperX;
|
||||
import com.cf.imes.framework.security.core.LoginUser;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.bo.OrderSource;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.bo.ProcessGroupList;
|
||||
@@ -23,13 +22,10 @@ import com.cf.imes.module.executor.controller.admin.plan.bo.ProcessStepSalaryIds
|
||||
import com.cf.imes.module.executor.controller.admin.plan.saveOptimize.*;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.*;
|
||||
import com.cf.imes.module.executor.dal.dataobject.goods.CutedBoardInfo;
|
||||
import com.cf.imes.module.executor.dal.dataobject.goods.GoodsDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.goods.OptimizeBoardModelDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderBody.OrderBodyDO;
|
||||
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.processStep.ProcessStepDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.remainplaten.RemainPlateDO;
|
||||
@@ -986,20 +982,6 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String deleteTest(List<Long> orderIds) {
|
||||
|
||||
Long a = 1801515154546884609L;
|
||||
|
||||
|
||||
List<OptimizeBoardModelDO> optimizeBoardModelDOS = buildBoardByPlanId(a, ORDER_REMAIN_PLATE_MODEL, 999);
|
||||
|
||||
System.out.println("哈哈哈哈哈1 "+optimizeBoardModelDOS);
|
||||
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ public interface PlanService {
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Map<Long,Long> createPlan(@Valid PlanSaveReqVO createReqVO);
|
||||
Map<String,Long> createPlan(@Valid PlanSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新生产单开料排单
|
||||
|
||||
+92
-110
@@ -109,7 +109,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
@Resource
|
||||
private IdentifierGenerator identifierGenerator;
|
||||
|
||||
String ORDER_REMAIN_PLATE_MODEL = "imes_order_remain_plate_model";
|
||||
String ORDER_REMAIN_PLATE_MODEL = "imes_order_optimize_plate_model";
|
||||
|
||||
@Resource
|
||||
private ElasticsearchClient elasticsearchClient;
|
||||
@@ -119,7 +119,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Map<Long,Long> createPlan(PlanSaveReqVO createReqVO) {
|
||||
public Map<String,Long> createPlan(PlanSaveReqVO createReqVO) {
|
||||
|
||||
// todo 目前只考虑了非混单的情况,混单的情况待考虑
|
||||
List<PlanSaveReqVO.Item> itemList = createReqVO.getItemList();
|
||||
@@ -128,22 +128,30 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
List<GoodsDO> goodsDOS = new ArrayList<>();
|
||||
|
||||
// <大板实际ID,排单ID>
|
||||
Map<Long,Long> goodsPlanId = new HashMap<>();
|
||||
List<Long> ids = new ArrayList<>();
|
||||
|
||||
Map<Long, List<PlanSaveReqVO.Item>> groupedItems = itemList.stream()
|
||||
List<Long> orderIdList = new ArrayList<>();
|
||||
|
||||
// <大板实际ID,排单ID>
|
||||
Map<String,Long> goodsPlanId = new HashMap<>();
|
||||
|
||||
Map<String, List<PlanSaveReqVO.Item>> groupedItems = itemList.stream()
|
||||
.collect(Collectors.groupingBy(PlanSaveReqVO.Item::getGoodsId));
|
||||
|
||||
|
||||
for (Map.Entry<Long, List<PlanSaveReqVO.Item>> entry : groupedItems.entrySet()) {
|
||||
for (Map.Entry<String, List<PlanSaveReqVO.Item>> entry : groupedItems.entrySet()) {
|
||||
|
||||
List<PlanSaveReqVO.Item> items = entry.getValue();
|
||||
|
||||
List<Long> orderIds = items.stream().map(PlanSaveReqVO.Item::getOrderId).distinct().toList();
|
||||
|
||||
orderIdList.addAll(orderIds);
|
||||
|
||||
// 创建计划
|
||||
PlanDO plan = BeanUtils.toBean(createReqVO, PlanDO.class);
|
||||
plan.setId(identifierGenerator.nextId(plan).longValue());
|
||||
plan.setSort(0L);
|
||||
String orderNos = items.stream().map(PlanSaveReqVO.Item::getOrderId).distinct().toList().toString();
|
||||
String orderNos = orderIds.toString();
|
||||
plan.setOrderNos(orderNos);
|
||||
plan.setProduceTime(null);
|
||||
|
||||
@@ -155,6 +163,8 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
List<GoodsDO> goodsDOList = goodsMapper.selectPlanGoodsList(goodsIds, getUserOrganId()).stream().map(m -> m.setPlanId(plan.getId())).toList();
|
||||
|
||||
ids.addAll(goodsDOList.stream().map(GoodsDO::getId).toList());
|
||||
|
||||
goodsDOS.addAll(goodsDOList);
|
||||
|
||||
|
||||
@@ -166,6 +176,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
goodsMapper.updateBatch(goodsDOS);
|
||||
|
||||
plateMapper.updatePlateOptimized(orderIdList,ids,getUserOrganId());
|
||||
|
||||
return goodsPlanId;
|
||||
|
||||
@@ -185,11 +196,11 @@ public class PlanServiceImpl implements PlanService {
|
||||
if(!(updateReqVO.getItemList() == null)){
|
||||
|
||||
// todo 目前之解决非混单的情况,混单的情况待解决
|
||||
Long goodsId = updateReqVO.getItemList().stream().map(PlanSaveReqVO.Item::getGoodsId).distinct().toList().get(0);
|
||||
String goodsId = updateReqVO.getItemList().stream().map(PlanSaveReqVO.Item::getGoodsId).distinct().toList().get(0);
|
||||
|
||||
|
||||
// todo 目前只解决非混单的情况
|
||||
Long goodsIds = BeanUtils.toBean(goodsMapper.selectPlanGoods(plan.getId(), getUserOrganId()).stream().map(GoodsDO::getGoodsId).toList(), Long.class).get(0);
|
||||
String goodsIds = goodsMapper.selectPlanGoods(plan.getId(), getUserOrganId()).stream().map(GoodsDO::getGoodsId).toList().get(0);
|
||||
|
||||
if(!goodsId.equals(goodsIds)){
|
||||
throw exception(PLATE_ERROR);
|
||||
@@ -200,12 +211,26 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
List<Long> ids = updateReqVO.getItemList().stream().map(PlanSaveReqVO.Item::getId).toList();
|
||||
|
||||
List<Long> orderIds = updateReqVO.getItemList().stream().map(PlanSaveReqVO.Item::getOrderId).toList();
|
||||
|
||||
// 修改新增的大板对应的板材为已优化
|
||||
plateMapper.updatePlateOptimized(orderIds,ids,getUserOrganId());
|
||||
|
||||
List<GoodsDO> goodsDOS = new ArrayList<>(goodsMapper.selectPlanGoodsList(ids, getUserOrganId())
|
||||
.stream().map(m -> m.setPlanId(plan.getId())).toList());
|
||||
|
||||
if (!updateReqVO.getDeleteIds().isEmpty()){
|
||||
|
||||
goodsDOS.addAll(goodsMapper.selectPlanGoodsList(updateReqVO.getDeleteIds(), getUserOrganId()).stream().map(m -> m.setPlanId(null)).toList());
|
||||
List<GoodsDO> goodsDOList = goodsMapper.selectPlanGoodsList(updateReqVO.getDeleteIds(), getUserOrganId());
|
||||
|
||||
List<Long> goodsIdList = goodsDOList.stream().map(GoodsDO::getId).distinct().toList();
|
||||
|
||||
List<Long> orderIdList = goodsDOList.stream().map(GoodsDO::getOrderId).distinct().toList();
|
||||
|
||||
// 修改删除的大板对应的小板为未优化
|
||||
plateMapper.updateNoPlateOptimized(orderIdList,goodsIdList,getUserOrganId());
|
||||
|
||||
goodsDOS.addAll(goodsDOList.stream().map(m -> m.setPlanId(null)).toList());
|
||||
|
||||
}
|
||||
|
||||
@@ -297,25 +322,25 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
}
|
||||
|
||||
// 删除排单信息,商品表里的 planId , ES优化数据,更新排单对应的余料板的排单ID为0
|
||||
// 删除排单信息, ES优化数据,更新排单对应的余料板的排单ID为0
|
||||
planMapper.deleteBatchIds(ids);
|
||||
// planItemMapper.delete(new LambdaQueryWrapperX<PlanItemDO>().in(PlanItemDO::getPlanId, ids));
|
||||
goodsMapper.deletePlanGoods(ids,getUserOrganId());
|
||||
remainPlateMapper.deletePlanRemainPlate(ids,getUserOrganId());
|
||||
|
||||
remainPlateMapper.deletePlanRemainPlate(ids,getUserOrganId());
|
||||
|
||||
|
||||
// 排单对应的自增板的删除 todo 目前值解决了非混单的情况
|
||||
List<OptimizeBoardModelDO> boardModelDOS = buildBoardByPlanIds(ids, ORDER_REMAIN_PLATE_MODEL, ids.size());
|
||||
if(!boardModelDOS.isEmpty()) {
|
||||
|
||||
// List<Long> goodsIds = boardModelDOS.stream().map(OptimizeBoardModelDO::getGoodsId).toList();
|
||||
|
||||
// List<Long> goodsIdList = goodsMapper.selectListByGoodsIdList(goodsIds, orderIds, getUserOrganId()).stream().map(GoodsDO::getId).toList();
|
||||
|
||||
List<Long> goodsIdList = goodsMapper.selectPlanGoodsListByPlanIdList(ids, getUserOrganId()).stream().map(GoodsDO::getId).toList();
|
||||
|
||||
List<PlateDO> plateDOS = plateMapper.selectPlateIdList(goodsIdList, getUserOrganId());
|
||||
|
||||
// 修改删除的大板对应的小板为未优化
|
||||
plateMapper.updateNoPlateOptimized(orderIds,goodsIdList,getUserOrganId());
|
||||
|
||||
|
||||
List<PlateDO> plateDOS = plateMapper.selectPlateIdList(orderIds,goodsIdList, getUserOrganId());
|
||||
if(!plateDOS.isEmpty()) {
|
||||
List<Long> plateIds = plateDOS.stream().map(PlateDO::getId).toList();
|
||||
|
||||
@@ -331,6 +356,9 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
}
|
||||
|
||||
// 删除商品表里的 planId
|
||||
goodsMapper.deletePlanGoods(ids,getUserOrganId());
|
||||
|
||||
List<Long> orderIdList = new ArrayList<>();
|
||||
|
||||
List<Long> diff;
|
||||
@@ -402,31 +430,6 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
return BeanUtils.toBean(planDO, PlanRespVO.class);
|
||||
|
||||
// MPJLambdaWrapper<OrderItemDO> wrapper = new MPJLambdaWrapperX<OrderItemDO>().select(OrderItemDO::getOrderId)
|
||||
// .rightJoin(PlanItemDO.class, PlanItemDO::getItemId, OrderItemDO::getId)
|
||||
// .isNotNull(OrderItemDO::getId);
|
||||
// Set<Long> orderIds = orderItemMapper.selectJoinList(OrderItemDO.class, wrapper).stream().map(OrderItemDO::getOrderId).collect(Collectors.toSet());
|
||||
//
|
||||
// /*Set<Long> orderIds = planOrderMapper.selectList(new LambdaQueryWrapperX<PlanOrderDO>().eq(PlanOrderDO::getPlanId, planDO.getPlanNo()))
|
||||
// .stream()
|
||||
// .map(e -> e.getOrderId())
|
||||
// .collect(Collectors.toSet());*/
|
||||
// List<GoodsDO> goodsDOS = goodsMapper.selectList(new LambdaQueryWrapperX<GoodsDO>()
|
||||
// .eq(GoodsDO::getOrganId,getUserOrganId())
|
||||
// .in(GoodsDO::getOrderId, orderIds));
|
||||
// List<PlateDO> plateDOS = plateMapper.selectList(new LambdaQueryWrapperX<PlateDO>()
|
||||
// .eq(PlateDO::getOrganId,getUserOrganId())
|
||||
// .in(PlateDO::getGoodsId, goodsDOS.stream().map(GoodsDO::getGoodsId).collect(Collectors.toSet())));
|
||||
// List<PlateInfoVO> plateInfoVOS = goodsDOS.stream().map(e -> PlateInfoVO.builder()
|
||||
// .material(e.getMaterial())
|
||||
// .width(e.getWidth())
|
||||
// .height(e.getHeight())
|
||||
// .thickness(e.getThickness())
|
||||
// .area(e.getHeight().multiply(e.getWidth()).setScale(2, RoundingMode.HALF_UP))
|
||||
// .count(plateDOS.stream().filter(f -> Objects.equals(f.getGoodsId(), e.getGoodsId())).collect(Collectors.toSet()).size())
|
||||
// .build())
|
||||
// .collect(Collectors.toList());
|
||||
// respVO.setPlateInfoList(plateInfoVOS);
|
||||
|
||||
}
|
||||
|
||||
@@ -577,25 +580,28 @@ public class PlanServiceImpl implements PlanService {
|
||||
PageDTO<OrderRespVOCopy> page = new PageDTO<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
|
||||
|
||||
List<Integer> statusList = new ArrayList<>();
|
||||
List<Long> goodsIds = new ArrayList<>();
|
||||
statusList.add(OrderStatusEnum.NEW_ORDER.getStatus());
|
||||
statusList.add(OrderStatusEnum.IN_PRODUCTION.getStatus());
|
||||
statusList.add(OrderStatusEnum.SORTED.getStatus());
|
||||
|
||||
// todo 修改排单数据筛选,目前只解决了非混单的情况,混单情况待解决
|
||||
List<GoodsDO> goodsDOS = goodsMapper.selectListByGoodsId(pageReqVO.getGoodsId(), getUserOrganId());
|
||||
|
||||
if(pageReqVO.getGoodsId() != null) {
|
||||
List<GoodsDO> goodsDOS = goodsMapper.selectListByGoodsId(pageReqVO.getGoodsId(), getUserOrganId());
|
||||
goodsIds.addAll(goodsDOS.stream().map(GoodsDO::getId).toList());
|
||||
}
|
||||
|
||||
QueryWrapperX<OrderDO> queryWrapperX = new QueryWrapperX<>();
|
||||
queryWrapperX
|
||||
.eq("o.organ_id",getUserOrganId())
|
||||
.eq("o.deleted",false)
|
||||
.in("o.status",statusList)
|
||||
.eq("og.organ_id",getUserOrganId())
|
||||
.eq("og.plan_id",0)
|
||||
.eq("og.deleted",false)
|
||||
// .eq("og.organ_id",getUserOrganId())
|
||||
// .eq("og.plan_id",0)
|
||||
// .eq("og.deleted",false)
|
||||
// .isNull("opi.item_id")
|
||||
// todo 修改排单数据筛选,目前只解决了非混单的情况,混单情况待解决
|
||||
.inIfPresent("og.id",goodsDOS.isEmpty() ? null :goodsDOS.stream().map(GoodsDO::getId).toList())
|
||||
.inIfPresent("og.id",goodsIds)
|
||||
.inIfPresent("o.id",pageReqVO.getOrderIds())
|
||||
.likeIfPresent("o.id", pageReqVO.getOrderId() != null ? pageReqVO.getOrderId().toString() : null)
|
||||
.inIfPresent("og.id",pageReqVO.getIds())
|
||||
@@ -609,8 +615,8 @@ public class PlanServiceImpl implements PlanService {
|
||||
.eqIfPresent("op.is_door", pageReqVO.getIsDoor())
|
||||
.betweenIfPresent("op.height", new BigDecimal[]{pageReqVO.getLongMinRang(), pageReqVO.getLongMaxRang()})
|
||||
.betweenIfPresent("op.width", new BigDecimal[]{pageReqVO.getWidthMinRang(), pageReqVO.getWidthMaxRang()})
|
||||
.groupBy("o.id", " o.order_date", "o.delivery_date", "o.customer", "o.address", "o.custom_order_no","o.status")
|
||||
.having("count(op.id) != 0")
|
||||
// .groupBy("o.id", " o.order_date", "o.delivery_date", "o.customer", "o.address", "o.custom_order_no","o.status")
|
||||
// .having("count(op.id) != 0")
|
||||
.orderByDesc("o.order_date");
|
||||
|
||||
String filterTypes = "";
|
||||
@@ -627,12 +633,6 @@ public class PlanServiceImpl implements PlanService {
|
||||
queryWrapperX.likeIfPresent("op.filter_type", insertSeparator(filterTypes));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// todo 目前修改一半,速度无法再进行特别的优化,需等后面修改表结构再进行优化
|
||||
IPage<OrderRespVOCopy> orderRespVOCopies = orderMapper.selectOrderPage(page,queryWrapperX);
|
||||
|
||||
@@ -640,16 +640,34 @@ public class PlanServiceImpl implements PlanService {
|
||||
return new PageResult<>();
|
||||
}
|
||||
|
||||
// List<OrderRespVOCopy> records = orderRespVOCopies.getRecords();
|
||||
//
|
||||
// orderRespVOCopies.setRecords(records.stream().peek(m -> {
|
||||
//
|
||||
// m.setNum((int) m.getPlatePages().stream().map(PlatePage::getPlateId).count());
|
||||
//
|
||||
// m.setArea(m.getPlatePages().stream().map(PlatePage::getArea).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||
// m.setPlatePages(null);
|
||||
//
|
||||
// }).toList());
|
||||
List<OrderRespVOCopy> records = orderRespVOCopies.getRecords();
|
||||
|
||||
List<Long> orderIds = records.stream().map(OrderRespVOCopy::getOrderId).toList();
|
||||
|
||||
|
||||
QueryWrapperX<PlateDO> queryWrapperX2 = new QueryWrapperX<>();
|
||||
queryWrapperX2
|
||||
.eq("organ_id",getUserOrganId())
|
||||
.eq("deleted",false)
|
||||
.in("order_id",orderIds)
|
||||
.eq("isOptimized",false)
|
||||
.inIfPresent("goods_id",goodsIds)
|
||||
.inIfPresent("goods_id",pageReqVO.getIds())
|
||||
.eqIfPresent("is_special_shaped", pageReqVO.getRectangle() != null ? false: null)
|
||||
.eqIfPresent("is_special_shaped", pageReqVO.getSpecialShaped())
|
||||
.eqIfPresent("is_sculpt", pageReqVO.getSculpt())
|
||||
.eqIfPresent("is_door", pageReqVO.getIsDoor())
|
||||
.betweenIfPresent("height", new BigDecimal[]{pageReqVO.getLongMinRang(), pageReqVO.getLongMaxRang()})
|
||||
.betweenIfPresent("width", new BigDecimal[]{pageReqVO.getWidthMinRang(), pageReqVO.getWidthMaxRang()});
|
||||
|
||||
List<PlatePage> plateList = plateMapper.selectNoPlanPlateList(queryWrapperX2);
|
||||
|
||||
|
||||
orderRespVOCopies.setRecords(records.stream().peek(m->{
|
||||
m.setNum((int) plateList.stream().filter(f->f.getOrderId().equals(m.getOrderId())).map(PlatePage::getPlateId).count());
|
||||
|
||||
m.setArea(plateList.stream().filter(f->f.getOrderId().equals(m.getOrderId())).map(PlatePage::getArea).reduce(BigDecimal.ZERO,BigDecimal::add));
|
||||
}).toList());
|
||||
|
||||
|
||||
return new PageResult<>(orderRespVOCopies.getRecords(), orderRespVOCopies.getTotal());
|
||||
@@ -796,9 +814,9 @@ public class PlanServiceImpl implements PlanService {
|
||||
.eq("o.organ_id",getUserOrganId())
|
||||
.eq("o.deleted",false)
|
||||
.in("o.status",statusList)
|
||||
.eq("og.organ_id",getUserOrganId())
|
||||
.eq("og.plan_id",0)
|
||||
.eq("og.deleted",false)
|
||||
// .eq("og.organ_id",getUserOrganId())
|
||||
// .eq("og.plan_id",0)
|
||||
// .eq("og.deleted",false)
|
||||
|
||||
.inIfPresent("og.order_id", pageReqVO.getOrderIds())
|
||||
.inIfPresent("og.id", pageReqVO.getIds())
|
||||
@@ -834,9 +852,6 @@ public class PlanServiceImpl implements PlanService {
|
||||
IPage<OrderGoodsResp> orderGoodsResps = orderMapper.selectOrderIds(page,queryWrapperX);
|
||||
|
||||
|
||||
// IPage<OrderGoodsResp> orderGoodsResps = goodsMapper.selectOrderGoodsList(page, queryWrapperX);
|
||||
|
||||
|
||||
if (CollectionUtil.isEmpty(orderGoodsResps.getRecords())) {
|
||||
return new PageResult<>();
|
||||
}
|
||||
@@ -845,7 +860,8 @@ public class PlanServiceImpl implements PlanService {
|
||||
List<OrderGoodsResp> records = orderGoodsResps.getRecords();
|
||||
|
||||
|
||||
List<Long> goodsIdList = records.stream().map(OrderGoodsResp::getGoodsId).toList();
|
||||
List<String> goodsIdList = records.stream().map(OrderGoodsResp::getGoodsId).toList();
|
||||
|
||||
|
||||
queryWrapperX.in("og.goods_id", goodsIdList);
|
||||
|
||||
@@ -853,33 +869,12 @@ public class PlanServiceImpl implements PlanService {
|
||||
List<OrderGoodsResp> goodsResp = orderMapper.selectGoodsListByGoodsId(queryWrapperX);
|
||||
|
||||
|
||||
//
|
||||
// Map<Long, List<OrderGoodsResp>> collect = records.stream().collect(Collectors.groupingBy(OrderGoodsResp::getGoodsId));
|
||||
|
||||
|
||||
// for (OrderGoodsResp orderGoodsResp : goodsResp) {
|
||||
//
|
||||
// List<OrderGoodsResp> orderGoodsResps1 = collect.get(orderGoodsResp.getGoodsId());
|
||||
//
|
||||
//
|
||||
// if (orderGoodsResps1 != null) {
|
||||
// // 合并 otherObjectList 到 obj1 副本中
|
||||
// orderGoodsResps1.get().addAll(obj2.getOtherObjectList());
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
|
||||
for (OrderGoodsResp record : records) {
|
||||
|
||||
|
||||
List<OrderIds> orderIdsList = new ArrayList<>();
|
||||
|
||||
|
||||
List<List<OrderIds>> list = goodsResp.stream().filter(f -> f.getGoodsId().equals(record.getGoodsId())).map(OrderGoodsResp::getOrderIds).toList();
|
||||
|
||||
|
||||
if(!list.isEmpty()){
|
||||
|
||||
orderIdsList = list.stream().flatMap(Collection::stream).toList();
|
||||
@@ -887,24 +882,11 @@ public class PlanServiceImpl implements PlanService {
|
||||
}
|
||||
|
||||
record.setOrderIds(orderIdsList);
|
||||
|
||||
}
|
||||
|
||||
|
||||
orderGoodsResps.setRecords(records);
|
||||
|
||||
// for (Map.Entry<Long, List<OrderGoodsResp>> entry : collect.entrySet()) {
|
||||
//
|
||||
// List<List<OrderIds>> list = entry.getValue().stream().map(OrderGoodsResp::getOrderIds).toList();
|
||||
//
|
||||
// List<OrderIds> orderds = list.stream().flatMap(Collection::stream).toList();
|
||||
//
|
||||
// List<OrderGoodsResp> list1 = records.stream().filter(f -> f.getGoodsId().equals(entry.getKey())).map(m -> m.setOrderIds(orderds)).toList();
|
||||
//
|
||||
// orderGoodsResps.setRecords(list1);
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
return new PageResult<>(orderGoodsResps.getRecords(), orderGoodsResps.getTotal());
|
||||
|
||||
@@ -969,6 +951,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
}
|
||||
|
||||
queryWrapperX.eq("og.organ_id",getUserOrganId())
|
||||
.eq("og.deleted",false)
|
||||
.in("og.plan_id", vo.getPlanIds())
|
||||
.eqIfPresent("op.is_door", vo.getIsDoor())
|
||||
.eqIfPresent("op.is_special_shaped", vo.getRectangle() != null ? false: null)
|
||||
@@ -976,8 +959,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
.eqIfPresent("op.is_sculpt", vo.getSculpt())
|
||||
.betweenIfPresent("op.width", new BigDecimal[]{vo.getWidthMinRang(), vo.getWidthMaxRang()})
|
||||
.betweenIfPresent("op.height", new BigDecimal[]{vo.getLongMinRang(), vo.getLongMaxRang()})
|
||||
.likeIfPresent("op.filter_type", insertSeparator(filterTypes))
|
||||
.orderByDesc("op.order_id");
|
||||
.likeIfPresent("op.filter_type", insertSeparator(filterTypes));
|
||||
|
||||
PageDTO<PlateResList> page = new PageDTO<>(vo.getPageNo(), vo.getPageSize());
|
||||
|
||||
|
||||
+2
-3
@@ -48,8 +48,7 @@ import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConsta
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||
import static com.cf.imes.module.executor.service.optimizeplan.OptimizePlanService.ORDER_PLATE_MODEL;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.PLATE_NOT_EXISTS;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.THE_CURRENT_BOARD_IS_NOT_SELECTED;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 生产单板件 Service 实现类
|
||||
@@ -114,7 +113,7 @@ public class PlateServiceImpl implements PlateService {
|
||||
|
||||
private void validatePlateExists(Long id) {
|
||||
if (plateMapper.selectById(id) == null) {
|
||||
throw exception(PLATE_NOT_EXISTS);
|
||||
throw exception(REMAIN_PLATE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+16
-57
@@ -58,63 +58,6 @@
|
||||
</delete>
|
||||
|
||||
|
||||
<select id="selectGoods" resultType="com.cf.imes.module.executor.controller.admin.plan.vo.OrderGoodsResp" parameterType="map">
|
||||
|
||||
|
||||
select distinct
|
||||
c.goods_id as goodsId,
|
||||
c.width as width,
|
||||
c.height as height,
|
||||
c.thickness as thickness,
|
||||
c.goods_name as goodsName,
|
||||
c.material as material,
|
||||
c.color as color
|
||||
|
||||
from order_goods c
|
||||
|
||||
where
|
||||
c.organ_id = 1
|
||||
and c.goods_id in
|
||||
<foreach item="goodsIds" collection="goodsIds" open="(" separator="," close=")">
|
||||
#{goodsIds}
|
||||
</foreach>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
<select id="selectGoodsPlateList"
|
||||
resultType="com.cf.imes.module.executor.controller.admin.plan.saveOptimize.NotPlanGoodsRespVO">
|
||||
|
||||
select distinct
|
||||
og.goods_id,
|
||||
og.height,
|
||||
og.width,
|
||||
og.color,
|
||||
og.goods_name,
|
||||
og.thickness,
|
||||
og.spec,
|
||||
count(distinct op.id) as plateNum
|
||||
from order_goods og
|
||||
left join order_plate op on og.id = op.goods_id and og.organ_id = op.organ_id
|
||||
|
||||
where og.organ_id = #{organId} and og.goods_id in
|
||||
|
||||
<foreach item="goodIds" collection="goodIds" open="(" separator="," close=")">
|
||||
#{goodIds}
|
||||
</foreach>
|
||||
|
||||
group by og.goods_id,og.height,og.width,og.color,og.goods_name,og.thickness,og.spec ;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
<select id="seleTestSQL" resultType="java.util.Map">
|
||||
|
||||
@@ -359,6 +302,7 @@
|
||||
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
|
||||
|
||||
where og.organ_id = #{organId}
|
||||
and og.deleted = false
|
||||
and og.plan_id in
|
||||
<foreach collection="planIds" item="planIds" open="(" close=")" separator=",">
|
||||
#{planIds}
|
||||
@@ -421,6 +365,21 @@
|
||||
|
||||
|
||||
|
||||
</select>
|
||||
<select id="selectOrderPlate"
|
||||
resultType="com.cf.imes.module.executor.controller.admin.plan.vo.OrderRespVOCopy">
|
||||
|
||||
|
||||
|
||||
select distinct order_id,
|
||||
create_time as updateTime
|
||||
from order_goods
|
||||
where organ_id = #{organId}
|
||||
and deleted = false
|
||||
and plan_id = 0
|
||||
order by create_time;
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
+30
-77
@@ -35,21 +35,17 @@
|
||||
<select id="selectOrderPage" resultMap="OrderPageMap">
|
||||
|
||||
select distinct
|
||||
o.id as orderId,
|
||||
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
|
||||
o.id as orderId,
|
||||
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
|
||||
|
||||
from orders o
|
||||
|
||||
left join order_goods og on o.organ_id = og.organ_id and o.id = og.order_id
|
||||
|
||||
left join order_plate op on og.organ_id = op.organ_id and og.id = op.goods_id and og.deleted = op.deleted
|
||||
join order_goods og on o.organ_id = og.organ_id and o.id = og.order_id and og.plan_id = 0 and o.deleted = og.deleted
|
||||
join order_plate op on o.organ_id = op.organ_id and o.deleted = op.deleted and o.id = op.order_id and op.isOptimized = false
|
||||
|
||||
${ew.customSqlSegment}
|
||||
|
||||
@@ -57,70 +53,23 @@
|
||||
</select>
|
||||
|
||||
|
||||
<!-- <where>
|
||||
a.deleted = false
|
||||
<!-- select distinct
|
||||
o.id as orderId,
|
||||
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
|
||||
|
||||
and a.organ_id = #{organId}
|
||||
from orders o
|
||||
|
||||
and ( a.status = 3 or a.status = 2 or a.status = 1 )
|
||||
left join order_goods og on o.organ_id = og.organ_id and o.id = og.order_id
|
||||
|
||||
and opi.item_id is null
|
||||
left join order_plate op on og.organ_id = op.organ_id and og.id = op.goods_id and og.deleted = op.deleted-->
|
||||
|
||||
<if test="pageReqVO.ids !=null">
|
||||
|
||||
and op.goods_id in
|
||||
<foreach collection="pageReqVO.ids" item="pageReqVO.ids" open="(" close=")" separator=",">
|
||||
#{pageReqVO.ids}
|
||||
</foreach>
|
||||
|
||||
</if>
|
||||
|
||||
<if test="pageReqVO.orderId !=null">
|
||||
and a.id like concat('%',#{pageReqVO.orderId},'%')
|
||||
</if>
|
||||
|
||||
<if test="pageReqVO.consignee !=null">
|
||||
and a.customer like concat('%',#{pageReqVO.consignee},'%')
|
||||
</if>
|
||||
|
||||
<if test="pageReqVO.defaultId !=null">
|
||||
and a.custom_order_no like concat('%',#{pageReqVO.defaultId},'%')
|
||||
</if>
|
||||
|
||||
<if test="pageReqVO.consigneeAddress !=null">
|
||||
and a.address like concat('%',#{pageReqVO.consigneeAddress},'%')
|
||||
</if>
|
||||
|
||||
<if test="pageReqVO.createTime !=null">
|
||||
between #{pageReqVO.createTime.[0]} and #{pageReqVO.createTime.[1]}
|
||||
</if>
|
||||
|
||||
</where>
|
||||
|
||||
group by a.id, a.order_date, a.delivery_date, a.customer, a.address, a.custom_order_no,a.create_time,a.update_time,a.status
|
||||
order by a.update_time desc ;-->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- select distinct a.id
|
||||
|
||||
from `orders` a
|
||||
left join order_item oi on a.id = oi.order_id and a.organ_id = oi.organ_id
|
||||
inner join order_plate op on oi.plate_id = op.id and oi.organ_id = op.organ_id
|
||||
|
||||
${ew.customSqlSegment}-->
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- inner join order_goods og on op.goods_id = og.id and op.organ_id = og.organ_id
|
||||
left join order_plan_item opi on oi.id = opi.item_id and oi.organ_id = opi.organ_id
|
||||
-->
|
||||
<select id="selectDynamicSqlString" resultType="java.util.Map">
|
||||
${sqlStr}
|
||||
</select>
|
||||
@@ -305,8 +254,10 @@
|
||||
og.spec
|
||||
|
||||
from orders o
|
||||
left join order_goods og on o.organ_id = og.organ_id and o.id = og.order_id
|
||||
left join order_plate op on og.organ_id = op.organ_id and og.id = op.goods_id and og.deleted = op.deleted
|
||||
|
||||
join order_goods og on o.organ_id = og.organ_id and o.id = og.order_id and og.plan_id = 0 and o.deleted = og.deleted
|
||||
|
||||
join order_plate op on o.organ_id = op.organ_id and o.deleted = op.deleted and o.id = op.order_id and op.isOptimized = false
|
||||
|
||||
${ew.customSqlSegment}
|
||||
|
||||
@@ -324,8 +275,10 @@
|
||||
og.order_id as orderId,
|
||||
og.id as id
|
||||
from orders o
|
||||
left join order_goods og on o.organ_id = og.organ_id and o.id = og.order_id
|
||||
left join order_plate op on og.organ_id = op.organ_id and og.id = op.goods_id and og.deleted = op.deleted
|
||||
|
||||
join order_goods og on o.organ_id = og.organ_id and o.id = og.order_id and og.plan_id = 0 and o.deleted = og.deleted
|
||||
|
||||
join order_plate op on o.organ_id = op.organ_id and o.deleted = op.deleted and o.id = op.order_id and op.isOptimized = false
|
||||
|
||||
${ew.customSqlSegment}
|
||||
|
||||
|
||||
+72
@@ -410,6 +410,7 @@
|
||||
AND organ_id = #{organId} and order_id = #{orderId}
|
||||
</update>
|
||||
|
||||
|
||||
<delete id="deletedById">
|
||||
DELETE FROM order_plate
|
||||
WHERE id IN
|
||||
@@ -865,4 +866,75 @@
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<resultMap id="PlatePageMap" type="com.cf.imes.module.executor.controller.admin.plan.vo.PlatePage">
|
||||
|
||||
<result property="orderId" column="orderId"/>
|
||||
<result property="plateId" column="plateId"/>
|
||||
<result property="area" column="area"/>
|
||||
|
||||
|
||||
</resultMap>
|
||||
|
||||
<select id="selectNoPlanPlateList" resultMap="PlatePageMap">
|
||||
|
||||
select
|
||||
order_id as orderId,
|
||||
id as plateId,
|
||||
area as area
|
||||
|
||||
from order_plate
|
||||
|
||||
${ew.customSqlSegment}
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<update id="updatePlateOptimized" parameterType="java.lang.Long">
|
||||
|
||||
update order_plate
|
||||
|
||||
set isOptimized = true
|
||||
|
||||
where organ_id = #{organId}
|
||||
and deleted = false
|
||||
|
||||
and order_id in
|
||||
<foreach item="orderIdList" collection="orderIdList" open="(" separator="," close=")">
|
||||
#{orderIdList}
|
||||
</foreach>
|
||||
|
||||
and goods_id in
|
||||
<foreach item="ids" collection="ids" open="(" separator="," close=")">
|
||||
#{ids}
|
||||
</foreach>
|
||||
|
||||
and isOptimized = false
|
||||
|
||||
</update>
|
||||
|
||||
<update id="updateNoPlateOptimized">
|
||||
|
||||
update order_plate
|
||||
|
||||
set isOptimized = false
|
||||
|
||||
where organ_id = #{organId}
|
||||
and deleted = false
|
||||
and order_id in
|
||||
<foreach item="orderIdList" collection="orderIdList" open="(" separator="," close=")">
|
||||
#{orderIdList}
|
||||
</foreach>
|
||||
and goods_id in
|
||||
<foreach item="ids" collection="ids" open="(" separator="," close=")">
|
||||
#{ids}
|
||||
</foreach>
|
||||
|
||||
and isOptimized = true
|
||||
|
||||
</update>
|
||||
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user