修复erp部分,添加出入库明细接口
This commit is contained in:
1 parent
c985458b13
commit
860aecf208
11 files changed
+291
-2
No files matched your search
+28
@@ -0,0 +1,28 @@
|
||||
package com.bsd.pjcloud.supermarket.dto.inventoryrecords;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
|
||||
@Data
|
||||
@Schema(description = "出入库明细条件查询")
|
||||
public class InventoryDetailQueryDTO {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@Schema(description="关键字")
|
||||
private String key;
|
||||
|
||||
/**
|
||||
* 单据日期
|
||||
*/
|
||||
@Schema(description="单据日期")
|
||||
private LocalDate ddDate;
|
||||
|
||||
@Schema(description="1入库 2出库")
|
||||
private Integer orderType;
|
||||
}
|
||||
+1
-1
@@ -64,7 +64,7 @@ public class ErpSpuWithUnitPageVo {
|
||||
*/
|
||||
@Schema(description="库存")
|
||||
@TableField(exist = false)
|
||||
private Integer stock;
|
||||
private Double stock;
|
||||
|
||||
/**
|
||||
* 部门id
|
||||
|
||||
+7
@@ -16,6 +16,13 @@ public class ErpUnitVo {
|
||||
|
||||
@Schema(description="包装单位id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 条码
|
||||
*/
|
||||
@Schema(description="条码")
|
||||
private String barCode;
|
||||
|
||||
/**
|
||||
* 规格
|
||||
*/
|
||||
|
||||
+135
@@ -0,0 +1,135 @@
|
||||
package com.bsd.pjcloud.supermarket.vo.inventoryrecord;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.bsd.pjcloud.common.core.util.MoneyDeserializer;
|
||||
import com.bsd.pjcloud.common.core.util.MoneySerializer;
|
||||
import com.bsd.pjcloud.supermarket.vo.cgplan.ErpUnitVo;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
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 = "出入库明细分页vo")
|
||||
@Data
|
||||
public class InventoryRecordPageVo {
|
||||
|
||||
@Schema(description ="包装单位id")
|
||||
private Long id;
|
||||
|
||||
|
||||
@Schema(description="编号")
|
||||
private String inventoryCode;
|
||||
|
||||
/**
|
||||
* 采购计划单据日期
|
||||
*/
|
||||
@Schema(description="单据日期")
|
||||
private LocalDate inventoryDate;
|
||||
|
||||
|
||||
@Schema(description="商品名称")
|
||||
private String productName;
|
||||
|
||||
|
||||
|
||||
@Schema(description="供应商id")
|
||||
private Long supplierId;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Schema(description="备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description="创建人")
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description="创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 审批状态
|
||||
*/
|
||||
@Schema(description="审批状态")
|
||||
private String checkStatus;
|
||||
|
||||
|
||||
@Schema(description="关联码")
|
||||
private String linkCode;
|
||||
|
||||
|
||||
/**
|
||||
* 库存商品id
|
||||
*/
|
||||
@Schema(description="库存商品id")
|
||||
private Long erpSpuId;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
@Schema(description="数量")
|
||||
private Integer quantity;
|
||||
|
||||
/**
|
||||
* 进价
|
||||
*/
|
||||
@Schema(description="进价")
|
||||
@JsonSerialize(using = MoneySerializer.class) // 分 -> 元
|
||||
@JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分
|
||||
private Integer unitPrice;
|
||||
|
||||
/**
|
||||
* 累计总金额
|
||||
*/
|
||||
@Schema(description="累计总金额")
|
||||
@JsonSerialize(using = MoneySerializer.class) // 分 -> 元
|
||||
@JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分
|
||||
private Integer totalAmount;
|
||||
|
||||
|
||||
/**
|
||||
* 包装单位id
|
||||
*/
|
||||
@Schema(description="包装单位id")
|
||||
private Long unitId;
|
||||
|
||||
|
||||
/**
|
||||
* 规格
|
||||
*/
|
||||
@Schema(description="规格")
|
||||
private String spec;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
@Schema(description="单位")
|
||||
private String unit;
|
||||
|
||||
/**
|
||||
* 装数
|
||||
*/
|
||||
@Schema(description="装数")
|
||||
private Integer packageNum;
|
||||
|
||||
/**
|
||||
* 进价(分为单位)
|
||||
*/
|
||||
@Schema(description="进价(分为单位)")
|
||||
@JsonSerialize(using = MoneySerializer.class) // 分 -> 元
|
||||
@JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分
|
||||
private Integer purchasePrice;
|
||||
}
|
||||
+27
@@ -13,6 +13,7 @@ import com.bsd.pjcloud.common.security.util.SecurityUtils;
|
||||
import com.bsd.pjcloud.supermarket.dto.cgdd.CGPlanLinkQueryDTO;
|
||||
import com.bsd.pjcloud.supermarket.dto.cgplan.ErpCgPlanDTO;
|
||||
import com.bsd.pjcloud.supermarket.dto.inventoryrecords.CGDdLinkQueryDTO;
|
||||
import com.bsd.pjcloud.supermarket.dto.inventoryrecords.InventoryDetailQueryDTO;
|
||||
import com.bsd.pjcloud.supermarket.dto.inventoryrecords.InventoryLinkQueryDTO;
|
||||
import com.bsd.pjcloud.supermarket.dto.inventoryrecords.InventoryRecordSaveDTO;
|
||||
import com.bsd.pjcloud.supermarket.entity.*;
|
||||
@@ -20,6 +21,7 @@ import com.bsd.pjcloud.supermarket.service.*;
|
||||
import com.bsd.pjcloud.supermarket.vo.cgplan.ErpUnitVo;
|
||||
import com.bsd.pjcloud.supermarket.vo.inventoryrecord.InventoryRecordItemVo;
|
||||
import com.bsd.pjcloud.supermarket.vo.inventoryrecord.InventoryRecordVo;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
@@ -64,9 +66,13 @@ public class SmErpInventoryRecordsController {
|
||||
@GetMapping("/page" )
|
||||
@PreAuthorize("@pms.hasPermission('supermarket_smErpInventoryRecords_view')" )
|
||||
public R getSmErpInventoryRecordsPage(@ParameterObject Page page, @ParameterObject SmErpInventoryRecordsEntity smErpInventoryRecords) {
|
||||
if (smErpInventoryRecords.getInventoryType() == null){
|
||||
return R.failed("缺失参数!");
|
||||
}
|
||||
LambdaQueryWrapper<SmErpInventoryRecordsEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.eq(Objects.nonNull(smErpInventoryRecords.getHandlerUserId()),SmErpInventoryRecordsEntity::getHandlerUserId,smErpInventoryRecords.getHandlerUserId());
|
||||
wrapper.eq(StrUtil.isNotBlank(smErpInventoryRecords.getCheckStatus()),SmErpInventoryRecordsEntity::getCheckStatus,smErpInventoryRecords.getCheckStatus());
|
||||
wrapper.eq(SmErpInventoryRecordsEntity::getInventoryType, smErpInventoryRecords.getInventoryType());
|
||||
return R.ok(smErpInventoryRecordsService.pageScope(page, wrapper));
|
||||
}
|
||||
|
||||
@@ -243,4 +249,25 @@ public class SmErpInventoryRecordsController {
|
||||
// wrapper.eq(SmErpCgPlanEntity::getCheckStatus,);
|
||||
return R.ok(smErpInventoryRecordsService.pageInventoryScope(page, wrapper));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页对象
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "分页获取出入库明细" , description = "出库明细,入库明细" )
|
||||
@GetMapping("/inventoryDetail/page" )
|
||||
public R getInventoryDetailPage(@ParameterObject Page page, @ParameterObject InventoryDetailQueryDTO inventoryDetailQueryDTO) {
|
||||
|
||||
LambdaQueryWrapper<SmErpInventoryRecordsEntity> wrapper = Wrappers.lambdaQuery();
|
||||
if (StringUtils.isNotBlank(inventoryDetailQueryDTO.getKey())){
|
||||
wrapper.like(SmErpInventoryRecordsEntity::getProductName,inventoryDetailQueryDTO.getKey());
|
||||
}
|
||||
wrapper.eq(Objects.nonNull(inventoryDetailQueryDTO.getDdDate()),SmErpInventoryRecordsEntity::getInventoryDate,inventoryDetailQueryDTO.getDdDate());
|
||||
wrapper.eq(SmErpInventoryRecordsEntity::getOrderType,inventoryDetailQueryDTO.getOrderType());
|
||||
//todo 审核成功条件
|
||||
// wrapper.eq(SmErpCgPlanEntity::getCheckStatus,);
|
||||
return R.ok(smErpInventoryRecordsService.getInventoryDetailPage(page, inventoryDetailQueryDTO));
|
||||
}
|
||||
}
|
||||
+13
@@ -1,11 +1,24 @@
|
||||
package com.bsd.pjcloud.supermarket.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import com.bsd.pjcloud.supermarket.dto.inventoryrecords.InventoryDetailQueryDTO;
|
||||
import com.bsd.pjcloud.supermarket.entity.SmErpInventoryRecordsEntity;
|
||||
import com.bsd.pjcloud.supermarket.vo.inventoryrecord.InventoryRecordPageVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@Mapper
|
||||
public interface SmErpInventoryRecordsMapper extends PjcloudBaseMapper<SmErpInventoryRecordsEntity> {
|
||||
|
||||
|
||||
/**
|
||||
* 分页获取出入库明细分页
|
||||
* @param inventoryDetailQueryDTO
|
||||
* @param of
|
||||
* @return
|
||||
*/
|
||||
Page<InventoryRecordPageVo> getInventoryDetailPageByScope(@Param("inventoryDetailQueryDTO") InventoryDetailQueryDTO inventoryDetailQueryDTO, DataScope of);
|
||||
}
|
||||
+7
@@ -1,8 +1,12 @@
|
||||
package com.bsd.pjcloud.supermarket.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import com.bsd.pjcloud.supermarket.dto.inventoryrecords.InventoryDetailQueryDTO;
|
||||
import com.bsd.pjcloud.supermarket.entity.SmErpUnitEntity;
|
||||
import com.bsd.pjcloud.supermarket.vo.erp.SmErpUnitWithSpuVo;
|
||||
import com.bsd.pjcloud.supermarket.vo.inventoryrecord.InventoryRecordPageVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
@@ -17,4 +21,7 @@ public interface SmErpUnitMapper extends PjcloudBaseMapper<SmErpUnitEntity> {
|
||||
* @return
|
||||
*/
|
||||
List<SmErpUnitWithSpuVo> getSupermarketUnitsWithSpu(List<Long> ids);
|
||||
|
||||
|
||||
|
||||
}
|
||||
+10
@@ -3,6 +3,7 @@ package com.bsd.pjcloud.supermarket.service;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.supermarket.dto.inventoryrecords.InventoryDetailQueryDTO;
|
||||
import com.bsd.pjcloud.supermarket.dto.inventoryrecords.InventoryRecordSaveDTO;
|
||||
import com.bsd.pjcloud.supermarket.entity.SmErpInventoryRecordsEntity;
|
||||
|
||||
@@ -32,4 +33,13 @@ public interface SmErpInventoryRecordsService extends IService<SmErpInventoryRec
|
||||
* @return
|
||||
*/
|
||||
Object pageInventoryScope(Page page, LambdaQueryWrapper<SmErpInventoryRecordsEntity> wrapper);
|
||||
|
||||
|
||||
/**
|
||||
* 出库入库明细查询
|
||||
* @param page
|
||||
* @param inventoryDetailQueryDTO
|
||||
* @return
|
||||
*/
|
||||
Object getInventoryDetailPage(Page page, InventoryDetailQueryDTO inventoryDetailQueryDTO);
|
||||
}
|
||||
+11
@@ -10,6 +10,7 @@ import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.security.util.SecurityUtils;
|
||||
import com.bsd.pjcloud.supermarket.constant.OrderTypeEnum;
|
||||
import com.bsd.pjcloud.supermarket.dto.cgdd.SmCgDDSaveItemDTO;
|
||||
import com.bsd.pjcloud.supermarket.dto.inventoryrecords.InventoryDetailQueryDTO;
|
||||
import com.bsd.pjcloud.supermarket.dto.inventoryrecords.InventoryRecordSaveDTO;
|
||||
import com.bsd.pjcloud.supermarket.dto.inventoryrecords.InventoryRecordSaveItemDTO;
|
||||
import com.bsd.pjcloud.supermarket.dto.inventoryrecords.UpdateStockDTO;
|
||||
@@ -20,6 +21,7 @@ import com.bsd.pjcloud.supermarket.service.SmErpStockService;
|
||||
import com.bsd.pjcloud.supermarket.vo.cgplan.SmErpCgPlanItemVo;
|
||||
import com.bsd.pjcloud.supermarket.vo.cgplan.SmErpCgPlanVo;
|
||||
import com.bsd.pjcloud.supermarket.vo.inventoryrecord.InventoryRecordItemVo;
|
||||
import com.bsd.pjcloud.supermarket.vo.inventoryrecord.InventoryRecordPageVo;
|
||||
import com.bsd.pjcloud.supermarket.vo.inventoryrecord.InventoryRecordVo;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -229,4 +231,13 @@ public class SmErpInventoryRecordsServiceImpl extends ServiceImpl<SmErpInventory
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Object getInventoryDetailPage(Page page, InventoryDetailQueryDTO inventoryDetailQueryDTO) {
|
||||
Page<InventoryRecordPageVo> pagedata=baseMapper.getInventoryDetailPageByScope(inventoryDetailQueryDTO, DataScope.of());
|
||||
|
||||
return pagedata;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+15
-1
@@ -340,9 +340,23 @@ public class SmErpSpuServiceImpl extends ServiceImpl<SmErpSpuMapper, SmErpSpuEnt
|
||||
|
||||
List<SmErpUnitEntity> unitList = smErpUnitService.list(new LambdaQueryWrapper<SmErpUnitEntity>().in(SmErpUnitEntity::getSpuId, spuIds));
|
||||
|
||||
// 批量查询库存信息
|
||||
List<SmErpStockEntity> stocks = smErpStockMapper.selectList(
|
||||
new LambdaQueryWrapper<SmErpStockEntity>()
|
||||
.in(SmErpStockEntity::getErpSpuId, spuIds));
|
||||
|
||||
// 建立SPU ID与库存的映射关系
|
||||
Map<Long, SmErpStockEntity> stockMap = stocks.stream()
|
||||
.collect(Collectors.toMap(SmErpStockEntity::getErpSpuId, smErpStockEntity -> smErpStockEntity));
|
||||
|
||||
|
||||
voList.stream().forEach(vo -> {
|
||||
List<SmErpUnitEntity> unitEntities = unitList.stream().filter(unit -> unit.getSpuId().equals(vo.getId())).collect(Collectors.toList());
|
||||
vo.setErpUnitVos(BeanUtils.toBean(unitEntities, ErpUnitVo.class));
|
||||
List<ErpUnitVo> bean = BeanUtils.toBean(unitEntities, ErpUnitVo.class);
|
||||
vo.setErpUnitVos(bean);
|
||||
//库存
|
||||
SmErpStockEntity smErpStockEntity = stockMap.get(vo.getId());
|
||||
vo.setStock(smErpStockEntity != null ? smErpStockEntity.getCurrentStock() : 0);
|
||||
});
|
||||
|
||||
// 创建新的 Page 对象并设置数据
|
||||
|
||||
+37
@@ -28,4 +28,41 @@
|
||||
<result property="tenantId" column="tenant_id"/>
|
||||
<result property="deviceType" column="device_type"/>
|
||||
</resultMap>
|
||||
<select id="getInventoryDetailPageByScope"
|
||||
resultType="com.bsd.pjcloud.supermarket.vo.inventoryrecord.InventoryRecordPageVo">
|
||||
SELECT r.inventory_code,
|
||||
u.bar_code,
|
||||
sp.product_name,
|
||||
u.spec,
|
||||
u.unit,
|
||||
u.package_num,
|
||||
u.retail_price,
|
||||
supp.supplier_name,
|
||||
r.inventory_date
|
||||
FROM sm_erp_inventory_records_item i
|
||||
LEFT JOIN sm_erp_inventory_records r
|
||||
on i.inventory_id = r.id
|
||||
LEFT JOIN sm_erp_unit u
|
||||
on i.unit_id = u.id
|
||||
LEFT JOIN sm_erp_spu sp
|
||||
on sp.id = i.erp_spu_id
|
||||
LEFT JOIN sm_erp_stock st
|
||||
on st.erp_spu_id = sp.id
|
||||
LEFT JOIN sm_erp_supplier supp
|
||||
on r.supplier_id = supp.supplier_id
|
||||
<where>
|
||||
r.del_flag = 0
|
||||
<if test="inventoryDetailQueryDTO.orderType != null and inventoryDetailQueryDTO.orderType != ''">
|
||||
and r.order_type = #{inventoryDetailQueryDTO.orderType}
|
||||
</if>
|
||||
<if test="inventoryDetailQueryDTO.inventoryDate != null and inventoryDetailQueryDTO.inventoryDate != ''">
|
||||
and r.inventory_date = #{inventoryDetailQueryDTO.inventoryDate}
|
||||
</if>
|
||||
<if test="inventoryDetailQueryDTO.key != null and inventoryDetailQueryDTO.key != ''">
|
||||
and (r.inventory_code like concat('%',#{inventoryDetailQueryDTO.key},'%')
|
||||
or sp.product_name like concat('%',#{inventoryDetailQueryDTO.key},'%')
|
||||
or supp.supplier_name like concat('%',#{inventoryDetailQueryDTO.key},'%'))
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in new issue
Block a user