采购计划-4
This commit is contained in:
1 parent
bc66475a64
commit
509a326fbc
14 files changed
+205
-12
No files matched your search
+1
-1
@@ -78,7 +78,7 @@ public class ErpCgPlanEditDTO {
|
||||
* @Link SmCgPlanEditItemDTO
|
||||
*/
|
||||
@Schema(description="采购计划-item")
|
||||
private List<SmCgPlanSaveItemDTO> items;
|
||||
private List<SmCgPlanEditItemDTO> items;
|
||||
|
||||
|
||||
|
||||
|
||||
+5
-1
@@ -22,7 +22,11 @@ public class SmCgPlanEditItemDTO {
|
||||
@Schema(description="库存商品id")
|
||||
private Long erpSpuId;
|
||||
|
||||
|
||||
/**
|
||||
* 采购id
|
||||
*/
|
||||
@Schema(description="采购id")
|
||||
private Long planId;
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.bsd.pjcloud.supermarket.vo.purchase;
|
||||
package com.bsd.pjcloud.supermarket.vo.cgplan;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.bsd.pjcloud.supermarket.vo.purchase;
|
||||
package com.bsd.pjcloud.supermarket.vo.cgplan;
|
||||
|
||||
import com.bsd.pjcloud.common.core.util.MoneyDeserializer;
|
||||
import com.bsd.pjcloud.common.core.util.MoneySerializer;
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
package com.bsd.pjcloud.supermarket.vo.cgplan;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "采购根据id查询-编辑回显 vo")
|
||||
@Data
|
||||
public class SmErpCgPlanVo {
|
||||
|
||||
@Schema(description ="id")
|
||||
private Long id;
|
||||
/**
|
||||
* 采购计划编号
|
||||
*/
|
||||
@Schema(description="采购计划编号")
|
||||
private String planCode;
|
||||
|
||||
/**
|
||||
* 采购计划单据日期
|
||||
*/
|
||||
@Schema(description="采购计划单据日期")
|
||||
private LocalDate planDate;
|
||||
|
||||
/**
|
||||
* 仓库id
|
||||
*/
|
||||
@Schema(description="仓库id")
|
||||
private String warehouseId;
|
||||
|
||||
/**
|
||||
* 经办人id
|
||||
*/
|
||||
@Schema(description="经办人id")
|
||||
private Long handlerUserId;
|
||||
|
||||
|
||||
/**
|
||||
* 累计进货数量
|
||||
*/
|
||||
@Schema(description="累计进货数量")
|
||||
private Integer totalNumber;
|
||||
|
||||
/**
|
||||
* 累计总金额
|
||||
*/
|
||||
@Schema(description="累计总金额")
|
||||
private Integer totalAmount;
|
||||
|
||||
/**
|
||||
* 货商
|
||||
*/
|
||||
@Schema(description="货商")
|
||||
private Long supplierId;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Schema(description="备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
@Schema(description="订单编号")
|
||||
private String orderNumber;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description="创建人")
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description="创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 审批状态
|
||||
*/
|
||||
@Schema(description="审批状态")
|
||||
private String checkStatus;
|
||||
|
||||
/**
|
||||
* @Link SmErpCgPlanVo
|
||||
*/
|
||||
@Schema(description="采购计划-item")
|
||||
private List<SmeErpCgPlanItemVo> items;
|
||||
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
package com.bsd.pjcloud.supermarket.vo.cgplan;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 采购计划-item
|
||||
*
|
||||
* @author zjf
|
||||
* @date 2025-02-11 17:11:41
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "采购计划-item")
|
||||
public class SmeErpCgPlanItemVo {
|
||||
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 库存商品id
|
||||
*/
|
||||
@Schema(description="库存商品id")
|
||||
private Long erpSpuId;
|
||||
|
||||
/**
|
||||
* 采购id
|
||||
*/
|
||||
@Schema(description="采购id")
|
||||
private Long planId;
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
@Schema(description="数量")
|
||||
private Integer quantity;
|
||||
|
||||
/**
|
||||
* 进价
|
||||
*/
|
||||
@Schema(description="进价")
|
||||
private Integer unitPrice;
|
||||
|
||||
/**
|
||||
* 累计总金额
|
||||
*/
|
||||
@Schema(description="累计总金额")
|
||||
private Integer totalAmount;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Schema(description="备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 包装单位id
|
||||
*/
|
||||
@Schema(description="包装单位id")
|
||||
private Long unitId;
|
||||
|
||||
}
|
||||
+19
-2
@@ -6,14 +6,19 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.util.BeanUtils;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.supermarket.dto.cgplan.ErpCgPlanDTO;
|
||||
import com.bsd.pjcloud.supermarket.dto.cgplan.ErpCgPlanEditDTO;
|
||||
import com.bsd.pjcloud.supermarket.dto.cgplan.ErpCgPlanSaveDTO;
|
||||
import com.bsd.pjcloud.supermarket.entity.SmErpCgPlanEntity;
|
||||
import com.bsd.pjcloud.supermarket.entity.SmErpCgPlanItemEntity;
|
||||
import com.bsd.pjcloud.supermarket.service.SmErpCgPlanItemService;
|
||||
import com.bsd.pjcloud.supermarket.service.SmErpCgPlanService;
|
||||
import com.bsd.pjcloud.supermarket.service.SmErpSpuService;
|
||||
import com.bsd.pjcloud.supermarket.vo.cgplan.SmErpCgPlanVo;
|
||||
import com.bsd.pjcloud.supermarket.vo.cgplan.SmeErpCgPlanItemVo;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
@@ -22,6 +27,7 @@ import org.springframework.http.HttpHeaders;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
@@ -44,6 +50,8 @@ public class SmErpCgPlanController {
|
||||
|
||||
private final SmErpSpuService smErpSpuService;
|
||||
|
||||
private final SmErpCgPlanItemService smErpCgPlanItemService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页对象
|
||||
@@ -98,7 +106,13 @@ public class SmErpCgPlanController {
|
||||
@GetMapping("/{id}" )
|
||||
@PreAuthorize("@pms.hasPermission('supermarket_smErpCgPlan_view')" )
|
||||
public R getById(@PathVariable("id" ) Long id) {
|
||||
return R.ok(smErpCgPlanService.getById(id));
|
||||
SmErpCgPlanEntity smErpCgPlanEntity = smErpCgPlanService.getById(id);
|
||||
List<SmErpCgPlanItemEntity> list = smErpCgPlanItemService.list(new LambdaQueryWrapper<SmErpCgPlanItemEntity>()
|
||||
.eq(SmErpCgPlanItemEntity::getPlanId, id));
|
||||
BeanUtils.toBean(smErpCgPlanEntity, SmErpCgPlanVo.class, (source) -> {
|
||||
source.setItems(BeanUtils.toBean(list, SmeErpCgPlanItemVo.class));
|
||||
});
|
||||
return R.ok(smErpCgPlanEntity);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -123,8 +137,11 @@ public class SmErpCgPlanController {
|
||||
@SysLog("通过id删除采购计划" )
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@pms.hasPermission('supermarket_smErpCgPlan_del')" )
|
||||
@Transactional
|
||||
public R removeById(@RequestBody Long[] ids) {
|
||||
return R.ok(smErpCgPlanService.removeBatchByIds(CollUtil.toList(ids)));
|
||||
boolean b = smErpCgPlanService.removeBatchByIds(CollUtil.toList(ids));
|
||||
smErpCgPlanItemService.remove(Wrappers.lambdaQuery(SmErpCgPlanItemEntity.class).in(SmErpCgPlanItemEntity::getPlanId, ids));
|
||||
return R.ok(b);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ import com.bsd.pjcloud.supermarket.dto.SupermarketSpuQueryDTO;
|
||||
import com.bsd.pjcloud.supermarket.dto.SupermarketSpuUpdateStockReqDTO;
|
||||
import com.bsd.pjcloud.supermarket.dto.cgplan.ErpCgPlanDTO;
|
||||
import com.bsd.pjcloud.supermarket.entity.SmErpSpuEntity;
|
||||
import com.bsd.pjcloud.supermarket.vo.purchase.ErpSpuWithUnitPageVo;
|
||||
import com.bsd.pjcloud.supermarket.vo.cgplan.ErpSpuWithUnitPageVo;
|
||||
import com.bsd.pjcloud.supermarket.vo.sm.smspu.SmErpPageScopeVo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
+15
-3
@@ -7,9 +7,11 @@ import com.bsd.pjcloud.common.security.util.SecurityUtils;
|
||||
import com.bsd.pjcloud.common.sequence.sequence.Sequence;
|
||||
import com.bsd.pjcloud.supermarket.dto.cgplan.ErpCgPlanEditDTO;
|
||||
import com.bsd.pjcloud.supermarket.dto.cgplan.ErpCgPlanSaveDTO;
|
||||
import com.bsd.pjcloud.supermarket.dto.cgplan.SmCgPlanEditItemDTO;
|
||||
import com.bsd.pjcloud.supermarket.dto.cgplan.SmCgPlanSaveItemDTO;
|
||||
import com.bsd.pjcloud.supermarket.entity.SmErpCgPlanEntity;
|
||||
import com.bsd.pjcloud.supermarket.entity.SmErpCgPlanItemEntity;
|
||||
import com.bsd.pjcloud.supermarket.entity.SmErpUnitEntity;
|
||||
import com.bsd.pjcloud.supermarket.mapper.SmErpCgPlanItemMapper;
|
||||
import com.bsd.pjcloud.supermarket.mapper.SmErpCgPlanMapper;
|
||||
import com.bsd.pjcloud.supermarket.service.SmErpCgPlanService;
|
||||
@@ -19,6 +21,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 采购计划
|
||||
@@ -57,12 +60,21 @@ public class SmErpCgPlanServiceImpl extends ServiceImpl<SmErpCgPlanMapper, SmErp
|
||||
//todo 后期确定是否要开启审批,审批成功的采购计划,不允许再次修改
|
||||
|
||||
SmErpCgPlanEntity smErpCgPlanEntity = BeanUtils.toBean(erpCgPlanEditDTO, SmErpCgPlanEntity.class);
|
||||
baseMapper.updateById(smErpCgPlanEntity);
|
||||
int i = baseMapper.updateById(smErpCgPlanEntity);
|
||||
|
||||
//更新采购计划-item
|
||||
List<SmCgPlanSaveItemDTO> items = erpCgPlanEditDTO.getItems();
|
||||
List<SmCgPlanEditItemDTO> items = erpCgPlanEditDTO.getItems();
|
||||
List<SmErpCgPlanItemEntity> cgPlanItemEntities = BeanUtils.toBean(items, SmErpCgPlanItemEntity.class);
|
||||
|
||||
// List<SmErpCgPlanItemEntity> insertCollect = cgPlanItemEntities.stream()
|
||||
// .filter(supermarketUnitEntity -> supermarketUnitEntity.getId() == null).collect(Collectors.toList());
|
||||
// insertCollect.forEach(c -> c.setPlanId(smErpCgPlanEntity.getId()));
|
||||
//
|
||||
// List<SmErpCgPlanItemEntity> updateCollect = cgPlanItemEntities.stream()
|
||||
// .filter(supermarketUnitEntity -> supermarketUnitEntity.getId() != null).collect(Collectors.toList());
|
||||
// smErpCgPlanItemMapper.updateById(updateCollect);
|
||||
smErpCgPlanItemMapper.insertOrUpdate(cgPlanItemEntities);
|
||||
|
||||
return null;
|
||||
return R.ok(i);
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -23,8 +23,8 @@ import com.bsd.pjcloud.supermarket.vo.app.SupermarketAppUnitVo;
|
||||
import com.bsd.pjcloud.supermarket.vo.erp.SmErpAuxiliaryCodeVo;
|
||||
import com.bsd.pjcloud.supermarket.vo.erp.SmErpSpuVo;
|
||||
import com.bsd.pjcloud.supermarket.vo.erp.SmErpUnitVo;
|
||||
import com.bsd.pjcloud.supermarket.vo.purchase.ErpSpuWithUnitPageVo;
|
||||
import com.bsd.pjcloud.supermarket.vo.purchase.ErpUnitVo;
|
||||
import com.bsd.pjcloud.supermarket.vo.cgplan.ErpSpuWithUnitPageVo;
|
||||
import com.bsd.pjcloud.supermarket.vo.cgplan.ErpUnitVo;
|
||||
import com.bsd.pjcloud.supermarket.vo.sm.smspu.SmErpPageScopeVo;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
|
||||
Reference in new issue
Block a user