mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
1.添加新增板材接口,2.goodsId改成string
This commit is contained in:
+2
-2
@@ -16,10 +16,10 @@ import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH
|
||||
public class GoodsPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "生产单号")
|
||||
private Long orderNo;
|
||||
private Long orderId;
|
||||
|
||||
@Schema(description = "商品 ID", example = "18975")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
@Schema(description = "商品 ID", example = "王五")
|
||||
private String goodsName;
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ public class GoodsRespVO {
|
||||
|
||||
@Schema(description = "商品 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "18975")
|
||||
@ExcelProperty("商品 ID")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
@Schema(description = "商品 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
||||
@ExcelProperty("商品名称")
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ public class GoodsSaveReqVO {
|
||||
|
||||
@Schema(description = "商品 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "18975")
|
||||
@NotNull(message = "商品 ID不能为空")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
@Schema(description = "商品 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
||||
@NotEmpty(message = "商品名称不能为空")
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ public class OrderPartsPageReqVO extends PageParam {
|
||||
private Long orderNo;
|
||||
|
||||
@Schema(description = "商品ID", example = "1195")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
@Schema(description = "配件名称", example = "晨丰")
|
||||
private String name;
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ public class OrderPartsRespVO {
|
||||
|
||||
@Schema(description = "商品ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1195")
|
||||
@ExcelProperty("商品ID")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
@Schema(description = "配件名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰")
|
||||
@ExcelProperty("配件名称")
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ public class OrderPartsSaveReqVO {
|
||||
|
||||
@Schema(description = "商品ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1195")
|
||||
@NotNull(message = "商品ID不能为空")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
@Schema(description = "配件名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰")
|
||||
@NotEmpty(message = "配件名称不能为空")
|
||||
|
||||
+7
@@ -93,6 +93,13 @@ public class PlanController {
|
||||
return success(planService.getNotPlanPlateListPage(pageVO));
|
||||
}
|
||||
|
||||
@PostMapping("addPlate")
|
||||
@Operation(summary = "添加板材")
|
||||
@PreAuthorize("@ss.hasPermission('executor:plan:update')")
|
||||
public CommonResult<Boolean> addPlate(@Valid @RequestBody AddPlateReq req) {
|
||||
return success(planService.addPlate(req));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出排单 Excel")
|
||||
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package com.cf.imes.module.executor.controller.admin.plan.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.NonNull;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author there
|
||||
*/
|
||||
@Data
|
||||
public class AddPlateReq {
|
||||
|
||||
@NotNull(message = "排单id")
|
||||
@Schema(description = "排单id")
|
||||
private Long planId;
|
||||
|
||||
@NotEmpty(message = "列表不能空")
|
||||
@JsonProperty("list")
|
||||
private List<Obj> list;
|
||||
|
||||
@Valid
|
||||
@Data
|
||||
public static class Obj {
|
||||
@NotNull(message = "生产单id不能空")
|
||||
@Schema(description = "生产单id")
|
||||
private Long orderId;
|
||||
@NotNull(message = "板材id不能空")
|
||||
@Schema(description = "板材id")
|
||||
private Long plateId;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -22,7 +22,7 @@ public class OrderPageReqVO extends PageParam {
|
||||
@Schema(description = "生产单id")
|
||||
private Long orderId;
|
||||
@Schema(description = "商品id")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
@Schema(description = "自定义id")
|
||||
private String defaultId;
|
||||
@Schema(description = "客户")
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ public class OrderRespVO {
|
||||
@Schema(description = "平方")
|
||||
private BigDecimal area = new BigDecimal("0");
|
||||
@Schema(description = "商品id")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
@Schema(description = "商品名称")
|
||||
private String goodsName;
|
||||
@Schema(description = "颜色")
|
||||
|
||||
+5
-4
@@ -8,6 +8,7 @@ import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author there
|
||||
@@ -21,17 +22,17 @@ public class PlateInfoVO {
|
||||
private String material;
|
||||
|
||||
@Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Double width;
|
||||
private BigDecimal width;
|
||||
|
||||
@Schema(description = "高度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "高度不能为空")
|
||||
private Double height;
|
||||
private BigDecimal height;
|
||||
|
||||
@Schema(description = "厚度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Double thickness;
|
||||
private BigDecimal thickness;
|
||||
|
||||
@Schema(description = "面积")
|
||||
private Double area;
|
||||
private BigDecimal area;
|
||||
|
||||
@Schema(description = "数量")
|
||||
private Integer count;
|
||||
|
||||
+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
@@ -12,5 +12,5 @@ public class PlateReqPageVO extends PageParam {
|
||||
@Schema(description = "生产单id")
|
||||
private Long orderId;
|
||||
@Schema(description = "商品id")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
}
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ public class PlatePageReqVO extends PageParam {
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "商品 ID", example = "28756")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
@Schema(description = "宽度")
|
||||
private Double width;
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ public class PlateRespVO {
|
||||
|
||||
@Schema(description = "商品 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "28756")
|
||||
@ExcelProperty("商品 ID")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
@Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("宽度")
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ public class PlateSaveReqVO {
|
||||
|
||||
@Schema(description = "商品 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "28756")
|
||||
@NotNull(message = "商品 ID不能为空")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
@Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "宽度不能为空")
|
||||
|
||||
+8
-6
@@ -1,6 +1,8 @@
|
||||
package com.cf.imes.module.executor.dal.dataobject.goods;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
@@ -30,11 +32,11 @@ public class GoodsDO extends BaseDO {
|
||||
/**
|
||||
* 生产单号
|
||||
*/
|
||||
private Long orderNo;
|
||||
private Long orderId;
|
||||
/**
|
||||
* 商品 ID
|
||||
*/
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
@@ -50,19 +52,19 @@ public class GoodsDO extends BaseDO {
|
||||
/**
|
||||
* 宽度
|
||||
*/
|
||||
private Double width;
|
||||
private BigDecimal width;
|
||||
/**
|
||||
* 高度
|
||||
*/
|
||||
private Double height;
|
||||
private BigDecimal height;
|
||||
/**
|
||||
* 厚度
|
||||
*/
|
||||
private Double thickness;
|
||||
private BigDecimal thickness;
|
||||
/**
|
||||
* 价格
|
||||
*/
|
||||
private Double price;
|
||||
private BigDecimal price;
|
||||
/**
|
||||
* 品牌
|
||||
*/
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ public class OrderPartsDO extends BaseDO {
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
/**
|
||||
* 配件名称
|
||||
*/
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ public class PlateDO extends BaseDO {
|
||||
/**
|
||||
* 商品 ID
|
||||
*/
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
/**
|
||||
* 宽度
|
||||
*/
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ public interface GoodsMapper extends BaseMapperX<GoodsDO> {
|
||||
|
||||
default PageResult<GoodsDO> selectPage(GoodsPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<GoodsDO>()
|
||||
.eqIfPresent(GoodsDO::getOrderNo, reqVO.getOrderNo())
|
||||
.eqIfPresent(GoodsDO::getOrderId, reqVO.getOrderId())
|
||||
.eqIfPresent(GoodsDO::getGoodsId, reqVO.getGoodsId())
|
||||
.likeIfPresent(GoodsDO::getGoodsName, reqVO.getGoodsName())
|
||||
.eqIfPresent(GoodsDO::getMaterial, reqVO.getMaterial())
|
||||
|
||||
+1
-1
@@ -60,6 +60,6 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
|
||||
.orderByDesc(PlateDO::getId));
|
||||
}
|
||||
|
||||
IPage<PlatePage> selectPlatePage(@Param("page") IPage<PlatePage> page, @Param("orderId")Long organId, @Param("goodsId") Long goodsId);
|
||||
IPage<PlatePage> selectPlatePage(@Param("page") IPage<PlatePage> page, @Param("orderId")Long organId, @Param("goodsId") String goodsId);
|
||||
|
||||
}
|
||||
+2
@@ -55,4 +55,6 @@ public interface PlanService {
|
||||
PageResult<OrderRespVO> getOrderPage(OrderPageReqVO pageReqVO);
|
||||
|
||||
PageResult<PlatePage> getNotPlanPlateListPage(PlateReqPageVO pageVO);
|
||||
|
||||
Boolean addPlate(AddPlateReq req);
|
||||
}
|
||||
+44
-9
@@ -74,6 +74,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
@Resource
|
||||
private PlateMapper plateMapper;
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long createPlan(PlanSaveReqVO createReqVO) {
|
||||
@@ -165,14 +166,22 @@ public class PlanServiceImpl implements PlanService {
|
||||
@Override
|
||||
public PlanRespVO getPlan(Long id) {
|
||||
PlanDO planDO = planMapper.selectById(id);
|
||||
Set<Long> orderIds = planOrderMapper.selectList(new LambdaQueryWrapperX<PlanOrderDO>().eq(PlanOrderDO::getPlanId, planDO.getPlanNo()))
|
||||
.stream()
|
||||
.map(e -> e.getOrderId())
|
||||
.collect(Collectors.toSet());
|
||||
PlanRespVO respVO = BeanUtils.toBean(planDO, PlanRespVO.class);
|
||||
List<GoodsDO> goodsDOS = goodsMapper.selectList(new LambdaQueryWrapperX<GoodsDO>().eq(GoodsDO::getOrderNo, planDO.getId()));
|
||||
List<GoodsDO> goodsDOS = goodsMapper.selectList(new LambdaQueryWrapperX<GoodsDO>().in(GoodsDO::getOrderId, orderIds));
|
||||
List<PlateDO> plateDOS = plateMapper.selectList(new LambdaQueryWrapperX<PlateDO>().in(PlateDO::getGoodsId, goodsDOS.stream().map(e -> e.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() * e.getWidth())
|
||||
.build()).collect(Collectors.toList());
|
||||
.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);
|
||||
return respVO;
|
||||
}
|
||||
@@ -180,17 +189,22 @@ public class PlanServiceImpl implements PlanService {
|
||||
@Override
|
||||
public PageResult<PlanRespVO> getPlanPage(PlanPageReqVO pageReqVO) {
|
||||
PageResult<PlanDO> planDOPageResult = planMapper.selectPage(pageReqVO);
|
||||
if (CollectionUtil.isEmpty(planDOPageResult.getList())) {
|
||||
return new PageResult<>();
|
||||
}
|
||||
Set<Long> ids = planDOPageResult.getList().stream().map(e -> e.getId()).collect(Collectors.toSet());
|
||||
List<GoodsDO> goodsDOS = goodsMapper.selectList(new LambdaQueryWrapperX<GoodsDO>().in(GoodsDO::getOrderNo, ids));
|
||||
List<GoodsDO> goodsDOS = goodsMapper.selectList(new LambdaQueryWrapperX<GoodsDO>().in(GoodsDO::getOrderId, ids));
|
||||
List<PlateDO> plateDOS = plateMapper.selectList(new LambdaQueryWrapperX<PlateDO>().in(PlateDO::getGoodsId, goodsDOS.stream().map(e -> e.getGoodsId()).collect(Collectors.toSet())));
|
||||
PageResult<PlanRespVO> planRespVOPageResult = BeanUtils.toBean(planDOPageResult, PlanRespVO.class);
|
||||
planRespVOPageResult.getList().stream().forEach(e -> {
|
||||
e.setPlateInfoList(goodsDOS.stream()
|
||||
.filter(f -> Objects.equals(f.getOrderNo(), e.getId()))
|
||||
.filter(f -> Objects.equals(f.getOrderId(), e.getId()))
|
||||
.map(p -> PlateInfoVO.builder()
|
||||
.width(p.getWidth())
|
||||
.height(p.getHeight())
|
||||
.thickness(p.getThickness())
|
||||
.area(p.getHeight() * p.getWidth())
|
||||
.area(p.getHeight().multiply(p.getWidth()).setScale(2, RoundingMode.HALF_UP))
|
||||
.count(plateDOS.stream().filter(f -> Objects.equals(f.getGoodsId(), p.getGoodsId())).collect(Collectors.toSet()).size())
|
||||
.build())
|
||||
.collect(Collectors.toList()));
|
||||
});
|
||||
@@ -215,8 +229,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
.eqIfPresent(OrderDO::getCustomer, pageReqVO.getConsignee())
|
||||
.eqIfPresent(OrderDO::getAddress, pageReqVO.getConsigneeAddress())
|
||||
.eqIfPresent(OrderDO::getCustomOrderNo, pageReqVO.getDefaultId())
|
||||
.betweenIfPresent(OrderDO::getDeliveryDate, new Date[]{pageReqVO.getBeginDate(), pageReqVO.getEndDate()})
|
||||
;
|
||||
.betweenIfPresent(OrderDO::getDeliveryDate, new Date[]{pageReqVO.getBeginDate(), pageReqVO.getEndDate()});
|
||||
|
||||
IPage<OrderRespVO> orderDOPageResult = orderMapper.selectOrderPage(page, queryWrapperX);
|
||||
if (CollectionUtil.isEmpty(orderDOPageResult.getRecords())) {
|
||||
@@ -227,10 +240,32 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
@Override
|
||||
public PageResult<PlatePage> getNotPlanPlateListPage(PlateReqPageVO pageVO) {
|
||||
//todo 获取未排单的板材分页列表
|
||||
PageDTO<PlatePage> page = new PageDTO<>(pageVO.getPageNo(), pageVO.getPageSize());
|
||||
IPage<PlatePage> pageRes = plateMapper.selectPlatePage(page, pageVO.getOrderId(), pageVO.getGoodsId());
|
||||
return new PageResult<PlatePage>(pageRes.getRecords(), pageRes.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean addPlate(AddPlateReq req) {
|
||||
List<OrderItemDO> orderItemDOS = new ArrayList<>();
|
||||
List<PlanItemDO> planItemDOS = new ArrayList<>();
|
||||
for (AddPlateReq.Obj obj : req.getList()) {
|
||||
orderItemDOS.add(OrderItemDO.builder()
|
||||
.planId(req.getPlanId())
|
||||
.orderId(obj.getOrderId())
|
||||
.dataId(obj.getPlateId())
|
||||
.type(1)
|
||||
.build());
|
||||
|
||||
planItemDOS.add(PlanItemDO.builder()
|
||||
.planId(req.getPlanId())
|
||||
.itemId(obj.getPlateId())
|
||||
.build());
|
||||
}
|
||||
orderItemMapper.insertBatch(orderItemDOS);
|
||||
planItemMapper.insertBatch(planItemDOS);
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
<if test="orderId !=null">
|
||||
and a.order_id = #{orderId}
|
||||
</if>
|
||||
<if test="goodsId !=null">
|
||||
<if test="goodsId !=null and goodsId != '' ">
|
||||
and c.id = #{goodsId}
|
||||
</if>
|
||||
</where>
|
||||
|
||||
Reference in New Issue
Block a user