mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
禅道Bug:400,356修改
This commit is contained in:
+1
-1
@@ -5,7 +5,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
@Schema(description = "小板优化的数据信息")
|
||||
@Schema(description = "小板优化的数据信息-部分")
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
public class BlockPlaceInfo {
|
||||
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
package com.cf.imes.module.executor.controller.admin.plan.saveOptimize;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
|
||||
@Schema(description = "小板优化的数据信息-全部")
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
public class PlatePlaceInfo {
|
||||
|
||||
|
||||
|
||||
@Schema(description = "自增板信息")
|
||||
private Object abInfo;
|
||||
|
||||
@Schema(description = "大板ID")
|
||||
private Long bi;
|
||||
|
||||
|
||||
@Schema(description = "小板编号")
|
||||
private String bo;
|
||||
|
||||
|
||||
@Schema(description = "位置X")
|
||||
private Object x;
|
||||
|
||||
|
||||
@Schema(description = "位置Y")
|
||||
private Object y;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "优化顺序")
|
||||
private Object pi;
|
||||
|
||||
|
||||
@Schema(description = "放置方式")
|
||||
private Object ps;
|
||||
|
||||
|
||||
@Schema(description = "开料顺序")
|
||||
private Object co;
|
||||
|
||||
|
||||
@Schema(description = "下刀点位置")
|
||||
private Object cr;
|
||||
|
||||
|
||||
@Schema(description = "下刀点")
|
||||
private Object cp;
|
||||
|
||||
|
||||
@Schema(description = "未移动")
|
||||
private Object ia;
|
||||
|
||||
|
||||
@Schema(description = "是否重叠")
|
||||
private Object io;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "是否排钻")
|
||||
private Object dh;
|
||||
|
||||
|
||||
@Schema(description = "是否造型")
|
||||
private Object dm;
|
||||
|
||||
|
||||
@Schema(description = "超限板标识")
|
||||
private Object of;
|
||||
|
||||
|
||||
@Schema(description = "板类型: 0普通 1自增, 2余料(失效)")
|
||||
private Object type;
|
||||
|
||||
|
||||
@Schema(description = "点列表")
|
||||
private Object points;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "原造型偏移信息")
|
||||
private Object orgSizeExpand;
|
||||
|
||||
|
||||
@Schema(description = "尺寸扩展信息(造型)")
|
||||
private Object sizeExpand;
|
||||
|
||||
|
||||
@Schema(description = "跟优化位置的漂移量x")
|
||||
private Object placeOffsetX;
|
||||
|
||||
|
||||
@Schema(description = "跟优化位置的漂移量y")
|
||||
private Object placeOffsetY;
|
||||
|
||||
|
||||
|
||||
}
|
||||
+26
-26
@@ -1,35 +1,32 @@
|
||||
package com.cf.imes.module.executor.controller.admin.plate;
|
||||
|
||||
import com.cf.imes.module.executor.dal.dataobject.ordermodel.OrderModelDO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import com.cf.imes.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import com.cf.imes.framework.operatelog.core.annotations.OperateLog;
|
||||
import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import com.cf.imes.module.executor.controller.admin.plate.vo.*;
|
||||
import com.cf.imes.module.executor.dal.dataobject.plate.PlateDO;
|
||||
import com.cf.imes.module.executor.service.plate.PlateService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||
import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Tag(name = "管理后台 - 生产单板件")
|
||||
@RestController
|
||||
@@ -57,10 +54,13 @@ public class PlateController {
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除生产单板件")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "板材ID", required = true),
|
||||
@Parameter(name = "planId", description = "排单ID", required = true)
|
||||
})
|
||||
@PreAuthorize("@ss.hasAnyPermissions('executor:plate:delete','placeorder:optimize')")
|
||||
public CommonResult<Boolean> deletePlate(@RequestParam("id") Long id) {
|
||||
plateService.deletePlate(id);
|
||||
public CommonResult<Boolean> deletePlate(@RequestParam("id") Long id, @RequestParam("planId") Long planId) {
|
||||
plateService.deletePlate(id,planId);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ public class PlateController {
|
||||
@PostMapping("/insertPlate")
|
||||
@Operation(summary = "优化生产创建板材")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('executor:plate:create','placeorder:optimize')")
|
||||
public CommonResult<List<Long>> createNewPlate(@Valid @RequestBody OptimizationSavePlateReqVO reqVO) {
|
||||
public CommonResult<List<String>> createNewPlate(@Valid @RequestBody OptimizationSavePlateReqVO reqVO) {
|
||||
return success(plateService.createNewPlate(reqVO));
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ import java.math.BigDecimal;
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Schema(description = "管理后台 - 优化生产时新增的小板信息")
|
||||
public class OptimizationSavePlateReqVO {
|
||||
public class OptimizationSavePlateReqVO {
|
||||
|
||||
|
||||
@Schema(description = "柜体号")
|
||||
|
||||
+10
-9
@@ -112,16 +112,17 @@ public interface GoodsMapper extends BaseMapperX<GoodsDO> {
|
||||
List<GoodsDO> selectPlanGoodsDataSource(@Param("filed") String filed,@Param("planId") Long planId ,@Param("organId") Long organId);
|
||||
|
||||
|
||||
default GoodsDO selectGoodsId(Long orderId, String goodsId, Long organId) {
|
||||
return selectOne(new LambdaQueryWrapperX<GoodsDO>()
|
||||
.eq(GoodsDO::getOrganId, organId)
|
||||
.eq(GoodsDO::getDeleted, false)
|
||||
.eq(GoodsDO::getGoodsId, goodsId)
|
||||
.eq(GoodsDO::getOrderId, orderId)
|
||||
.select(GoodsDO::getId));
|
||||
|
||||
}
|
||||
// default GoodsDO selectGoodsId(Long orderId, String goodsId, Long organId) {
|
||||
// return selectOne(new LambdaQueryWrapperX<GoodsDO>()
|
||||
// .eq(GoodsDO::getOrganId, organId)
|
||||
// .eq(GoodsDO::getDeleted, false)
|
||||
// .eq(GoodsDO::getGoodsId, goodsId)
|
||||
// .eq(GoodsDO::getOrderId, orderId)
|
||||
// .select(GoodsDO::getId));
|
||||
//
|
||||
// }
|
||||
|
||||
GoodsDO selectGoodsId(@Param("orderId") Long orderId,@Param("goodsId") String goodsId,@Param("organId") Long organId);
|
||||
|
||||
|
||||
List<PlateInfoVO> selectOrderGoodsPlateList(@Param("planIds") List<Long> planIds, @Param("organId") Long organId);
|
||||
|
||||
+17
@@ -76,6 +76,13 @@ public interface OrderItemMapper extends BaseMapperX<OrderItemDO> {
|
||||
}
|
||||
|
||||
|
||||
default int deleteByPlateId(Long plateId,Long orderId, Long organId) {
|
||||
return delete(new LambdaQueryWrapperX<OrderItemDO>()
|
||||
.eq(OrderItemDO::getOrganId, organId)
|
||||
.eq(OrderItemDO::getOrderId, orderId)
|
||||
.eq(OrderItemDO::getPlateId, plateId));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -89,6 +96,16 @@ public interface OrderItemMapper extends BaseMapperX<OrderItemDO> {
|
||||
}
|
||||
|
||||
|
||||
default OrderItemDO selectPlateList(Long plateId,Long orderId, Long organId) {
|
||||
return selectOne(new LambdaQueryWrapperX<OrderItemDO>()
|
||||
.eq(OrderItemDO::getOrganId,organId)
|
||||
.eqIfPresent(OrderItemDO::getOrderId,orderId)
|
||||
.eqIfPresent(OrderItemDO::getPlateId, plateId)
|
||||
.select(OrderItemDO::getBodyId));
|
||||
|
||||
}
|
||||
|
||||
|
||||
default List<OrderItemDO> selectPackId(Long orderId,List<Long> bodyIds, Long organId) {
|
||||
return selectList(new LambdaQueryWrapperX<OrderItemDO>()
|
||||
.eq(OrderItemDO::getOrganId,organId)
|
||||
|
||||
+6
@@ -461,6 +461,12 @@ public class OrderServiceImpl implements OrderService {
|
||||
|
||||
}
|
||||
|
||||
List<PlateDO> plateDOS = plateMapper.selectPlateIsOptimized(orderId, getUserOrganId());
|
||||
|
||||
if(!plateDOS.isEmpty()){
|
||||
return;
|
||||
}
|
||||
|
||||
// 生产单柜体数量判断
|
||||
if (orderBodyMapper.selectCountByOrderId(orderId, getUserOrganId(), OrderDeletedEnum.NOT_DELETED.getStatus()) == 0) {
|
||||
orderMapper.updateOrderStatus(orderId, OrderStatusEnum.EMPTY.getStatus(), getUserOrganId());
|
||||
|
||||
-18
@@ -1100,24 +1100,6 @@ public class PlanServiceImpl implements PlanService {
|
||||
}
|
||||
|
||||
|
||||
private List<OptimizeBoardModelDO> buildBoardByPlanId(Long planId, String index,Integer size) {
|
||||
SearchRequest.Builder builder = new SearchRequest.Builder();
|
||||
builder.index(index);
|
||||
builder.size(size);
|
||||
builder.query(q -> q.term(b -> b.field(FIELD_PLANID).value(planId)));
|
||||
try {
|
||||
SearchResponse<OptimizeBoardModelDO> search = elasticsearchClient.search(builder.build(), OptimizeBoardModelDO.class);
|
||||
List<Hit<OptimizeBoardModelDO>> hits = search.hits().hits();
|
||||
if (CollUtil.isNotEmpty(hits)) {
|
||||
return hits.stream().map(Hit::source).collect(Collectors.toList());
|
||||
}
|
||||
return new ArrayList<>();
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage());
|
||||
throw new ServiceException(INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void validatePlan(Long id) {
|
||||
|
||||
|
||||
+7
-7
@@ -1,13 +1,13 @@
|
||||
package com.cf.imes.module.executor.service.plate;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.module.executor.controller.admin.goods.vo.GoodsSaveReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plate.vo.*;
|
||||
import com.cf.imes.module.executor.dal.dataobject.ordermodel.OrderModelDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.plate.PlateDO;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 生产单板件 Service 接口
|
||||
@@ -36,7 +36,7 @@ public interface PlateService {
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deletePlate(Long id);
|
||||
void deletePlate(Long id,Long planId);
|
||||
|
||||
/**
|
||||
* 获得生产单板件
|
||||
@@ -92,6 +92,6 @@ public interface PlateService {
|
||||
|
||||
List<BodyPlateDetailVO> getPlateModelByPlateId(List<Long> bodyIds);
|
||||
|
||||
List<Long> createNewPlate(OptimizationSavePlateReqVO reqVO);
|
||||
List<String> createNewPlate(OptimizationSavePlateReqVO reqVO);
|
||||
|
||||
}
|
||||
+128
-39
@@ -9,28 +9,39 @@ import co.elastic.clients.elasticsearch.core.search.Hit;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||
import com.cf.imes.framework.common.enums.OrderPlateTypeEnum;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||
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.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import com.cf.imes.module.executor.controller.admin.goods.vo.GoodsSaveReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.saveOptimize.PlatePlaceInfo;
|
||||
import com.cf.imes.module.executor.controller.admin.plate.vo.*;
|
||||
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.orderBody.OrderBodyDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderItem.OrderItemDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.ordermodel.OrderModelDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.plan.PlanDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.plate.PlateDO;
|
||||
import com.cf.imes.module.executor.dal.mysql.goods.GoodsMapper;
|
||||
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.planitem.PlanItemMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.plan.PlanMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.plate.PlateMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.processStepItem.ProcessStepItemMapper;
|
||||
import com.cf.imes.module.executor.enums.OrderItemType;
|
||||
import com.cf.imes.module.executor.service.plan.PlanService;
|
||||
import com.cf.imes.module.executor.util.fileConversion.admin.SnowflakeIdWorker3rd;
|
||||
import com.cf.imes.module.system.enums.ErrorCodeConstants;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -42,13 +53,12 @@ import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.ES_ERROR_UPDATE;
|
||||
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR;
|
||||
import static com.cf.imes.framework.common.exception.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.REMAIN_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 实现类
|
||||
*
|
||||
@@ -69,7 +79,7 @@ public class PlateServiceImpl implements PlateService {
|
||||
private GoodsMapper goodsMapper;
|
||||
|
||||
@Resource
|
||||
private PlanItemMapper planItemMapper;
|
||||
private PlanMapper planMapper;
|
||||
|
||||
@Resource
|
||||
private OrderBodyMapper orderBodyMapper;
|
||||
@@ -82,7 +92,12 @@ public class PlateServiceImpl implements PlateService {
|
||||
private ElasticsearchClient elasticsearchClient;
|
||||
|
||||
@Resource
|
||||
private ProcessStepItemMapper processStepItemMapper;
|
||||
private PlanService planService;
|
||||
|
||||
@Resource
|
||||
private ESDocumentService esDocumentService;
|
||||
|
||||
String ORDER_REMAIN_PLATE_MODEL = "imes_order_optimize_plate_model";
|
||||
|
||||
@Override
|
||||
public Long createPlate(PlateSaveReqVO createReqVO) {
|
||||
@@ -103,9 +118,82 @@ public class PlateServiceImpl implements PlateService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePlate(Long id) {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deletePlate(Long id,Long planId) {
|
||||
|
||||
PlanDO planDO = planMapper.selectById(planId);
|
||||
PlateDO plateDO = plateMapper.selectById(id);
|
||||
|
||||
// 校验存在
|
||||
validatePlateExists(id);
|
||||
AssertUtils.notEmpty(plateDO,REMAIN_PLATE_NOT_EXISTS);
|
||||
AssertUtils.notEmpty(planDO,ORDER_PLAN_DATE_ERROR);
|
||||
|
||||
if(!plateDO.getType().equals(OrderPlateTypeEnum.SELFINCREASINGBOARD.getType())){
|
||||
throw exception(PLATE_IS_SOURCE);
|
||||
}
|
||||
|
||||
|
||||
if(plateDO.getIsOptimized()) {
|
||||
|
||||
List<OptimizeBoardModelDO> optimizeBoardModelDOS = buildBoardByPlanId(planId, ORDER_REMAIN_PLATE_MODEL, 11);
|
||||
|
||||
if (!optimizeBoardModelDOS.isEmpty()) {
|
||||
|
||||
// todo 目前只解决了非混单的情况
|
||||
OptimizeBoardModelDO optimizeBoardModelDO = optimizeBoardModelDOS.get(0);
|
||||
|
||||
try {
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
// 解析 JSON 字符串
|
||||
JsonNode jsonNode = mapper.readTree(optimizeBoardModelDO.getBlockPlaceInfo());
|
||||
|
||||
Long placeBlockNumber = optimizeBoardModelDO.getPlaceBlockNumber() - 1;
|
||||
|
||||
List<PlatePlaceInfo> asJsonObject = mapper.convertValue(jsonNode, new TypeReference<>() {});
|
||||
|
||||
|
||||
String blockPlaceInfo = JsonUtils.toJsonString(
|
||||
asJsonObject.stream()
|
||||
.filter(f -> !f.getBo().equals(plateDO.getPlateNo()))
|
||||
.toList());
|
||||
|
||||
HashMap<String, Object> objectObjectHashMap = new HashMap<>();
|
||||
|
||||
|
||||
objectObjectHashMap.put("blockPlaceInfo",blockPlaceInfo);
|
||||
|
||||
objectObjectHashMap.put("placeBlockNumber",placeBlockNumber);
|
||||
|
||||
esDocumentService.updateById(ORDER_REMAIN_PLATE_MODEL, optimizeBoardModelDO.getId(), HashMap.class, objectObjectHashMap);
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
log.error(e.getMessage());
|
||||
throw new ServiceException(ES_ERROR_UPDATE);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Long bodyId = orderItemMapper.selectPlateList(id, plateDO.getOrderId(), plateDO.getOrganId()).getBodyId();
|
||||
|
||||
OrderBodyDO orderBodyDO = orderBodyMapper.selectById(bodyId);
|
||||
|
||||
orderBodyDO.setPlateNum(orderBodyDO.getPlateNum() - 1);
|
||||
orderBodyMapper.updateById(orderBodyDO);
|
||||
|
||||
|
||||
orderItemMapper.deleteByPlateId(id, plateDO.getOrderId(), plateDO.getOrganId());
|
||||
|
||||
|
||||
// todo 还需考虑下是否需要和包裹关联,预打包优化数据是否需要关联
|
||||
|
||||
|
||||
|
||||
// 删除
|
||||
plateMapper.deleteById(id);
|
||||
}
|
||||
@@ -243,15 +331,15 @@ public class PlateServiceImpl implements PlateService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<Long> createNewPlate(OptimizationSavePlateReqVO reqVO) {
|
||||
public List<String> createNewPlate(OptimizationSavePlateReqVO reqVO) {
|
||||
|
||||
if(reqVO.getRoomId() == null || reqVO.getBodyId() == null){
|
||||
|
||||
throw exception(THE_CURRENT_BOARD_IS_NOT_SELECTED);
|
||||
AssertUtils.notEmpty(reqVO.getRoomId(),ORDER_ROOM_ERROR);
|
||||
AssertUtils.notEmpty(reqVO.getBodyId(),ORDER_BODY_ERROR);
|
||||
AssertUtils.notEmpty(reqVO.getOrderId(),ORDER_ERROR);
|
||||
|
||||
}
|
||||
GoodsDO goodsDO = goodsMapper.selectGoodsId(reqVO.getOrderId(), reqVO.getGoodsId(), getUserOrganId());
|
||||
|
||||
Long goodsId = goodsMapper.selectGoodsId(reqVO.getOrderId(), reqVO.getGoodsId(), getUserOrganId()).getId();
|
||||
|
||||
List<PlateDO> plateDOS = new ArrayList<>();
|
||||
|
||||
@@ -265,9 +353,11 @@ public class PlateServiceImpl implements PlateService {
|
||||
|
||||
plateDO.setRemark(reqVO.getRemake1() +","+ reqVO.getRemake2());
|
||||
plateDO.setHoleArrange(reqVO.getPlaceHole());
|
||||
plateDO.setGoodsId(goodsId);
|
||||
plateDO.setIsOptimized(true);
|
||||
plateDO.setGoodsId(goodsDO.getId());
|
||||
plateDO.setThickness(goodsDO.getThickness());
|
||||
plateDO.setIsOptimized(false);
|
||||
plateDO.setPlateNo((obtainingTime) + Long.toString(plateNo).substring(2));
|
||||
plateDO.setType(OrderPlateTypeEnum.SELFINCREASINGBOARD.getType());
|
||||
|
||||
plateDO.setArea(reqVO.getWidth().multiply(reqVO.getHeight()).movePointLeft(4).stripTrailingZeros());
|
||||
|
||||
@@ -280,7 +370,7 @@ public class PlateServiceImpl implements PlateService {
|
||||
// 生产单柜体表新增数据
|
||||
OrderBodyDO orderBodyDO = orderBodyMapper.selectById(reqVO.getBodyId());
|
||||
|
||||
orderBodyDO.setPlateNum(reqVO.getMultiple());
|
||||
orderBodyDO.setPlateNum(reqVO.getMultiple()+orderBodyDO.getPlateNum());
|
||||
|
||||
orderBodyMapper.updateById(orderBodyDO);
|
||||
|
||||
@@ -302,32 +392,11 @@ public class PlateServiceImpl implements PlateService {
|
||||
orderItemMapper.insertBatch(orderItemDOS);
|
||||
|
||||
|
||||
// List<PlanItemDO> planItemDOS = new ArrayList<>();
|
||||
//
|
||||
// orderItemDOS.forEach(orderItemDO ->{
|
||||
//
|
||||
// PlanItemDO planItemDO = PlanItemDO.builder()
|
||||
// .planId(reqVO.getPlanId())
|
||||
// .itemId(orderItemDO.getId())
|
||||
// .build();
|
||||
// planItemDOS.add(planItemDO);
|
||||
// });
|
||||
//
|
||||
// // 排单明细表新增数据
|
||||
// planItemMapper.insertBatch(planItemDOS);
|
||||
|
||||
return plateDOS.stream().map(PlateDO::getId).toList();
|
||||
return plateDOS.stream().map(PlateDO::getPlateNo).toList();
|
||||
}
|
||||
|
||||
|
||||
private List<OrderModelDO> buildRespByPlateIds(Collection<Long> plateIds, String index) {
|
||||
//
|
||||
|
||||
|
||||
// // 使用Stream API将 Collection<Long> 转换成 Collection<String>
|
||||
// Collection<String> stringPlateIds = plateIds.stream()
|
||||
// .map(String::valueOf) // 将Long类型的元素转换成String类型
|
||||
// .collect(Collectors.toList()); // 收集到一个新的List中
|
||||
|
||||
List<FieldValue> fieldValues = plateIds.stream().map(FieldValue::of).toList();
|
||||
SearchRequest.Builder builder = new SearchRequest.Builder();
|
||||
@@ -348,4 +417,24 @@ public class PlateServiceImpl implements PlateService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
private List<OptimizeBoardModelDO> buildBoardByPlanId(Long planId, String index, Integer size) {
|
||||
SearchRequest.Builder builder = new SearchRequest.Builder();
|
||||
builder.index(index);
|
||||
builder.size(size);
|
||||
builder.query(q -> q.term(b -> b.field("planId").value(planId)));
|
||||
try {
|
||||
SearchResponse<OptimizeBoardModelDO> search = elasticsearchClient.search(builder.build(), OptimizeBoardModelDO.class);
|
||||
List<Hit<OptimizeBoardModelDO>> hits = search.hits().hits();
|
||||
if (CollUtil.isNotEmpty(hits)) {
|
||||
return hits.stream().map(Hit::source).collect(Collectors.toList());
|
||||
}
|
||||
return new ArrayList<>();
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage());
|
||||
throw new ServiceException(INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+17
@@ -410,4 +410,21 @@
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectGoodsId" resultType="com.cf.imes.module.executor.dal.dataobject.goods.GoodsDO">
|
||||
|
||||
select id,thickness
|
||||
|
||||
from order_goods
|
||||
|
||||
where organ_id = #{organId}
|
||||
and deleted = false
|
||||
and order_id = #{orderId}
|
||||
and goods_id = #{goodsId}
|
||||
and plan_id !=0
|
||||
limit 1;
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
-1
@@ -6,7 +6,6 @@ import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "预打包的优化结构")
|
||||
|
||||
+6
-2
@@ -249,12 +249,13 @@ public class ErrorCodeConstants {
|
||||
public static final ErrorCode PLATE_IMPORT_LIST_IS_EMPTY = new ErrorCode(1_002_033_001, "导入板材数据不能为空!");
|
||||
public static final ErrorCode PLATE_EXISTS = new ErrorCode(1_002_033_002, "板材存在");
|
||||
public static final ErrorCode THE_CURRENT_BOARD_IS_NOT_SELECTED = new ErrorCode(1_002_033_003, "当前板材没有选择房间和柜体,请选择");
|
||||
public static final ErrorCode THE_BOARD_HAS_BEEN_CUT_INTO_PIECES = new ErrorCode(1_002_033_004, "当前排单已有板材开料,禁止修改");
|
||||
public static final ErrorCode THE_BOARD_HAS_BEEN_CUT_INTO_PIECES = new ErrorCode(1_002_033_004, "当前排单已有板材开料,禁止删除");
|
||||
public static final ErrorCode REMAIN_PLATE_NOT_EXISTS = new ErrorCode(1_002_033_005, "板材不存在");
|
||||
public static final ErrorCode RAW_GOODS_NOT_EXISTS = new ErrorCode(1_002_033_006, "设计板材不存在");
|
||||
public static final ErrorCode RAW_GOODS_IMPORT_LIST_IS_EMPTY = new ErrorCode(1_002_033_007, "生产板材导入数据不可以为空");
|
||||
public static final ErrorCode PLATENO_ERROR = new ErrorCode(1_002_033_008, "当前板编号无对应包裹信息");
|
||||
public static final ErrorCode PLATE_GOODS_ID_NOT_SAME = new ErrorCode(1_002_033_009, "板材商品编号存在,请重新命名商品编号");
|
||||
public static final ErrorCode PLATE_IS_SOURCE = new ErrorCode(1_002_033_010, "当前板材为源小板,无法删除");
|
||||
|
||||
|
||||
|
||||
@@ -304,7 +305,10 @@ public class ErrorCodeConstants {
|
||||
public static final ErrorCode ORDER_BODY_DATA_ERROR = new ErrorCode(1_002_041_012, "当前柜体对应的板材数据为空,无法删除");
|
||||
public static final ErrorCode ORDER_PLAN_NO_OPTIMIZE_ERROR = new ErrorCode(1_002_041_013, "当前排单还未保存优化结果,无法进行开料");
|
||||
public static final ErrorCode ORDER_PLAN_NO_OPTIMIZE_UPDATE_ERROR = new ErrorCode(1_002_041_014, "当前排单还未保存优化结果,无法对开料结果进行修改");
|
||||
public static final ErrorCode ORDER_NO_DATA_ERROR = new ErrorCode(1_002_041_001, "生产单信息错误,请重新进行拆包");
|
||||
public static final ErrorCode ORDER_NO_DATA_ERROR = new ErrorCode(1_002_041_015, "生产单信息错误,请重新进行拆包");
|
||||
public static final ErrorCode ORDER_ROOM_ERROR = new ErrorCode(1_002_041_015, "当前板材没有选择房间,请选择");
|
||||
public static final ErrorCode ORDER_BODY_ERROR = new ErrorCode(1_002_041_015, "当前板材没有选择柜体,请选择");
|
||||
public static final ErrorCode ORDER_ERROR = new ErrorCode(1_002_041_015, "当前板材没有选择生产单,请选择");
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user