liujie
2025-09-02 ce68c2f8913bdb3634b705e425b5a0271b3ec052
供应商erp
6个文件已修改
90 ■■■■■ 已修改文件
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpClinicWarehousingController.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TErpSupplierWarehousingMapper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/query/TErpGoodsWarehouseQuery.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpSupplierWarehousingServiceImpl.java 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/vo/TErpGoodsWarehouseRecordLastVO.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/TErpSupplierWarehousingMapper.xml 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpClinicWarehousingController.java
@@ -20,6 +20,7 @@
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
/**
@@ -74,7 +75,7 @@
     */
    @ApiOperation(value = "供应商获取库存记录列表")
    @PostMapping(value = "/pageWarehouseList")
    public R<PageInfo<TErpGoodsWarehouseRecordLastVO>> pageWarehouseList(@RequestBody TErpGoodsWarehouseQuery query) {
    public R<PageInfo<TErpGoodsWarehouseRecordLastVO>> pageWarehouseList(@RequestBody @Valid TErpGoodsWarehouseQuery query) {
        SysUser user = tokenService.getLoginUser().getUser();
        return R.ok(erpSupplierWarehousingService.pageWarehouseList(query,user));
    }
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TErpSupplierWarehousingMapper.java
@@ -24,5 +24,5 @@
    List<TErpGoodsVO> pageList(@Param("query") TErpGoodsQuery query, @Param("pageInfo") PageInfo<TErpGoodsVO> pageInfo, @Param("user") SysUser user);
    List<TErpGoodsWarehouseRecordLastVO> pageWarehouseList(@Param("query") TErpGoodsWarehouseQuery query, @Param("pageInfo") PageInfo<TErpGoodsWarehouseRecordLastVO> pageInfo, @Param("user") SysUser user);
    List<TErpGoodsWarehouseRecordLastVO> pageWarehouseList(@Param("query") TErpGoodsWarehouseQuery query, @Param("pageInfo") PageInfo<TErpGoodsWarehouseRecordLastVO> pageInfo, @Param("user") SysUser user, @Param("sTime") String sTime, @Param("eTime") String eTime);
}
ruoyi-system/src/main/java/com/ruoyi/system/query/TErpGoodsWarehouseQuery.java
@@ -5,6 +5,8 @@
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
@Data
@ApiModel(value = "erp商品库存记录查询参数query")
public class TErpGoodsWarehouseQuery extends BasePage {
@@ -18,5 +20,8 @@
    @ApiModelProperty(value = "操作时间  2022-02-02 - 2023-03-03")
    private String time;
    @ApiModelProperty(value = "商品id")
    @NotBlank(message = "商品id不能为空")
    private String goodsId;
}
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpSupplierWarehousingServiceImpl.java
@@ -138,10 +138,48 @@
    @Override
    public PageInfo<TErpGoodsWarehouseRecordLastVO> pageWarehouseList(TErpGoodsWarehouseQuery query, SysUser user) {
        TErpGoods goods = erpGoodsMapper.selectById(query.getGoodsId());
        PageInfo<TErpGoodsWarehouseRecordLastVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize());
        List<TErpGoodsWarehouseRecordLastVO> list = this.baseMapper.pageWarehouseList(query,pageInfo,user);
        String sTime=null;
        String eTime =null;
        if(query.getTime()!=null && !query.getTime().isEmpty()){
            String[] split = query.getTime().split(" - ");
            sTime = split[0] + " 00:00:00";
            eTime = split[1] + " 23:59:59";
        }
        List<TErpGoodsWarehouseRecordLastVO> list = this.baseMapper.pageWarehouseList(query,pageInfo,user,sTime,eTime);
        for (TErpGoodsWarehouseRecordLastVO tErpGoodsWarehouseRecordLastVO : list) {
            ArrayList<TErpGoodsWarehouseVO> tErpGoodsWarehouseVOS = new ArrayList<>();
            if(tErpGoodsWarehouseRecordLastVO.getCategory()==1){
                List<TErpSupplierWarehousingBatch> tErpSupplierWarehousingBatches = erpSupplierWarehousingBatchMapper.selectList(new LambdaQueryWrapper<TErpSupplierWarehousingBatch>().eq(TErpSupplierWarehousingBatch::getWarehousingId, tErpGoodsWarehouseRecordLastVO.getId()));
                for (TErpSupplierWarehousingBatch tErpSupplierWarehousingBatch : tErpSupplierWarehousingBatches) {
                    TErpGoodsWarehouseVO tErpGoodsWarehouseVO = new TErpGoodsWarehouseVO();
                    tErpGoodsWarehouseVO.setBatchNumber(tErpSupplierWarehousingBatch.getBatchNumber());
                    tErpGoodsWarehouseVO.setProductionDate(tErpSupplierWarehousingBatch.getProductionDate());
                    tErpGoodsWarehouseVO.setExpiryDate(tErpSupplierWarehousingBatch.getExpiryDate());
                    tErpGoodsWarehouseVO.setNowNum(tErpSupplierWarehousingBatch.getWarehousingNumber());
                    tErpGoodsWarehouseVOS.add(tErpGoodsWarehouseVO);
                }
            }else {
                List<TErpSupplierOutboundGoods> tErpSupplierOutboundGoods = erpSupplierOutboundGoodsMapper.selectList(new LambdaQueryWrapper<TErpSupplierOutboundGoods>().eq(TErpSupplierOutboundGoods::getOutboundId, tErpGoodsWarehouseRecordLastVO.getId()));
                for (TErpSupplierOutboundGoods tErpSupplierOutboundGoods1 : tErpSupplierOutboundGoods) {
                    TErpGoodsWarehouseVO tErpGoodsWarehouseVO = new TErpGoodsWarehouseVO();
                    String warehousingBatchId = tErpSupplierOutboundGoods1.getWarehousingBatchId();
                    TErpSupplierWarehousingBatch tErpSupplierWarehousingBatch = erpSupplierWarehousingBatchMapper.selectById(warehousingBatchId);
                    tErpGoodsWarehouseVO.setBatchNumber(tErpSupplierWarehousingBatch.getBatchNumber());
                    tErpGoodsWarehouseVO.setExpiryDate(tErpSupplierWarehousingBatch.getExpiryDate());
                    tErpGoodsWarehouseVO.setProductionDate(tErpSupplierWarehousingBatch.getProductionDate());
                    tErpGoodsWarehouseVO.setNowNum(tErpSupplierOutboundGoods1.getOutboundCount());
                    tErpGoodsWarehouseVOS.add(tErpGoodsWarehouseVO);
                }
            }
            tErpGoodsWarehouseRecordLastVO.setAllNum(tErpGoodsWarehouseVOS.stream().mapToInt(TErpGoodsWarehouseVO::getNowNum).sum());
            tErpGoodsWarehouseRecordLastVO.setWarningInventory(goods.getWarningInventory());
            tErpGoodsWarehouseRecordLastVO.setList(tErpGoodsWarehouseVOS);
        return null;
        }
        pageInfo.setRecords( list);
        return pageInfo;
    }
}
ruoyi-system/src/main/java/com/ruoyi/system/vo/TErpGoodsWarehouseRecordLastVO.java
@@ -28,7 +28,7 @@
    private Integer warningInventory;
    @ApiModelProperty(value = "1入库 2出库")
    private Integer type;
    private Integer category;
    @ApiModelProperty(value = "操作时间")
    private LocalDateTime operationTime;
@@ -36,10 +36,12 @@
    @ApiModelProperty(value = "出库原因")
    private String outboundReason;
    @ApiModelProperty(value = "出库类型1=报损 2=到期 3=失效 4=召回 5=其他 6=盘点出库 7=购买出库")
    private Integer outboundType;
    @ApiModelProperty(value = "出库类型1=报损 2=到期 3=失效 4=召回 5=其他 6=盘点出库 7=购买出库 (1正常入库 2盘点入库)")
    private Integer type;
    @ApiModelProperty(value = "id")
    private String id;
    @ApiModelProperty("二级信息")
ruoyi-system/src/main/resources/mapper/system/TErpSupplierWarehousingMapper.xml
@@ -66,7 +66,35 @@
    <select id="pageWarehouseList" resultType="com.ruoyi.system.vo.TErpGoodsWarehouseRecordLastVO">
        select t1.warehouse_id houseId,t2.warehouse_name houseName,t1.total_money allTotalPrice,t1.outbound_type
        select * from (
        select t1.id,t1.warehouse_id houseId,t2.warehouse_name houseName,t1.total_price allTotalPrice,t1.type,1 category,null as outboundReason,t1.create_time operationTime
        from t_erp_supplier_warehousing t1 left join t_crm_warehouse t2 on t1.warehouse_id = t2.id
        where t1.disabled = 0 and t1.goods_id = #{query.goodsId}  and t1.supplier_id =#{user.userId}
        <if test="query.warehouseName != null and query.warehouseName != ''">
            and t2.warehouse_name =#{query.warehouseName}
        </if>
        <if test="sTime != null and eTime !=null ">
            and t1.create_time between #{sTime} and #{eTime}
        </if>
        union all
        select t1.id,t1.warehouse_id houseId,t2.warehouse_name houseName,t1.total_money allTotalPrice,t1.outbound_type as type,2 category,t1.outbound_reason as outboundReason,t1.create_time operationTime
        from t_erp_supplier_outbound t1 left join t_crm_warehouse t2 on t1.warehouse_id = t2.id
        where t1.disabled = 0 and t1.goods_id = #{query.goodsId} and t1.supplier_id =#{user.userId}
        <if test="query.warehouseName != null and query.warehouseName != ''">
            and t2.warehouse_name =#{query.warehouseName}
        </if>
        <if test="sTime != null and eTime !=null ">
            and t1.create_time between #{sTime} and #{eTime}
        </if>
        ) as o where 1=1
        <if test="query.type != null">
            and o.type = #{query.type}
        </if>
        order by o.operationTime desc
    </select>