更新采购计划-1
This commit is contained in:
1 parent
c5ca3b88cc
commit
bc66475a64
7 files changed
+179
-6
No files matched your search
+86
@@ -0,0 +1,86 @@
|
||||
package com.bsd.pjcloud.supermarket.dto.cgplan;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* 新增一个采购计划
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "采购计划保存对象")
|
||||
public class ErpCgPlanEditDTO {
|
||||
|
||||
|
||||
@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;
|
||||
|
||||
|
||||
/**
|
||||
* @Link SmCgPlanEditItemDTO
|
||||
*/
|
||||
@Schema(description="采购计划-item")
|
||||
private List<SmCgPlanSaveItemDTO> items;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
+5
-1
@@ -9,6 +9,7 @@ import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* 新增一个采购计划
|
||||
*/
|
||||
@Data
|
||||
@@ -72,8 +73,11 @@ public class ErpCgPlanSaveDTO {
|
||||
private String orderNumber;
|
||||
|
||||
|
||||
/**
|
||||
* @Link SmCgPlanSaveItemDTO
|
||||
*/
|
||||
@Schema(description="采购计划-item")
|
||||
private List<ErpCgPlanSaveDTO> items;
|
||||
private List<SmCgPlanSaveItemDTO> items;
|
||||
|
||||
|
||||
|
||||
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
package com.bsd.pjcloud.supermarket.dto.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 SmCgPlanEditItemDTO {
|
||||
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 库存商品id
|
||||
*/
|
||||
@Schema(description="库存商品id")
|
||||
private Long erpSpuId;
|
||||
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
@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;
|
||||
|
||||
}
|
||||
-1
@@ -16,7 +16,6 @@ import java.time.LocalDateTime;
|
||||
* @date 2025-02-11 17:11:41
|
||||
*/
|
||||
@Data
|
||||
@TableName("sm_erp_cg_plan_item")
|
||||
@Schema(description = "采购计划-item")
|
||||
public class SmCgPlanSaveItemDTO {
|
||||
|
||||
|
||||
+4
-3
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
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.service.SmErpCgPlanService;
|
||||
@@ -102,15 +103,15 @@ public class SmErpCgPlanController {
|
||||
|
||||
/**
|
||||
* 修改采购计划
|
||||
* @param smErpCgPlan 采购计划
|
||||
* @param erpCgPlanEditDTO 采购计划
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "修改采购计划" , description = "修改采购计划" )
|
||||
@SysLog("修改采购计划" )
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('supermarket_smErpCgPlan_edit')" )
|
||||
public R updateById(@RequestBody SmErpCgPlanEntity smErpCgPlan) {
|
||||
return R.ok(smErpCgPlanService.updateById(smErpCgPlan));
|
||||
public R updateById(@RequestBody ErpCgPlanEditDTO erpCgPlanEditDTO) {
|
||||
return smErpCgPlanService.updateByErpCgPlanEditDTO(erpCgPlanEditDTO);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+9
@@ -1,6 +1,8 @@
|
||||
package com.bsd.pjcloud.supermarket.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.supermarket.dto.cgplan.ErpCgPlanEditDTO;
|
||||
import com.bsd.pjcloud.supermarket.dto.cgplan.ErpCgPlanSaveDTO;
|
||||
import com.bsd.pjcloud.supermarket.entity.SmErpCgPlanEntity;
|
||||
|
||||
@@ -13,4 +15,11 @@ public interface SmErpCgPlanService extends IService<SmErpCgPlanEntity> {
|
||||
* @return
|
||||
*/
|
||||
Object saveCgplan(ErpCgPlanSaveDTO erpCgPlanSaveDTO);
|
||||
|
||||
/**
|
||||
* 修改采购计划
|
||||
* @param erpCgPlanEditDTO
|
||||
* @return
|
||||
*/
|
||||
R updateByErpCgPlanEditDTO(ErpCgPlanEditDTO erpCgPlanEditDTO);
|
||||
}
|
||||
+19
-1
@@ -2,9 +2,12 @@ package com.bsd.pjcloud.supermarket.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.common.core.util.BeanUtils;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
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.SmCgPlanSaveItemDTO;
|
||||
import com.bsd.pjcloud.supermarket.entity.SmErpCgPlanEntity;
|
||||
import com.bsd.pjcloud.supermarket.entity.SmErpCgPlanItemEntity;
|
||||
import com.bsd.pjcloud.supermarket.mapper.SmErpCgPlanItemMapper;
|
||||
@@ -39,7 +42,7 @@ public class SmErpCgPlanServiceImpl extends ServiceImpl<SmErpCgPlanMapper, SmErp
|
||||
smErpCgPlanEntity.setCheckStatus("0");
|
||||
int insert = baseMapper.insert(smErpCgPlanEntity);
|
||||
|
||||
List<ErpCgPlanSaveDTO> items = erpCgPlanSaveDTO.getItems();
|
||||
List<SmCgPlanSaveItemDTO> items = erpCgPlanSaveDTO.getItems();
|
||||
List<SmErpCgPlanItemEntity> cgPlanItemEntities = BeanUtils.toBean(items, SmErpCgPlanItemEntity.class);
|
||||
for (SmErpCgPlanItemEntity cgPlanItemEntity : cgPlanItemEntities) {
|
||||
cgPlanItemEntity.setPlanId(smErpCgPlanEntity.getId());
|
||||
@@ -47,4 +50,19 @@ public class SmErpCgPlanServiceImpl extends ServiceImpl<SmErpCgPlanMapper, SmErp
|
||||
smErpCgPlanItemMapper.insert(cgPlanItemEntities);
|
||||
return insert;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public R updateByErpCgPlanEditDTO(ErpCgPlanEditDTO erpCgPlanEditDTO) {
|
||||
//todo 后期确定是否要开启审批,审批成功的采购计划,不允许再次修改
|
||||
|
||||
SmErpCgPlanEntity smErpCgPlanEntity = BeanUtils.toBean(erpCgPlanEditDTO, SmErpCgPlanEntity.class);
|
||||
baseMapper.updateById(smErpCgPlanEntity);
|
||||
|
||||
//更新采购计划-item
|
||||
List<SmCgPlanSaveItemDTO> items = erpCgPlanEditDTO.getItems();
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user