sgj
2025-12-22 c216a6a9ee53ef3f6b683d20a91d72a3ad236a08
添加库存报表
已添加5个文件
已修改1个文件
743 ■■■■■ 文件已修改
fzzy-igdss-core/src/main/java/com/fzzy/igds/data/SuperInventoryReportData.java 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fzzy-igdss-core/src/main/java/com/fzzy/igds/data/SuperInventoryReportParam.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fzzy-igdss-core/src/main/java/com/fzzy/igds/domain/DepotStore.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fzzy-igdss-core/src/main/java/com/fzzy/igds/service/SuperInventoryReportService.java 282 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fzzy-igdss-view/src/main/java/com/fzzy/igds/SuperInventoryReport.view.xml 287 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fzzy-igdss-view/src/main/java/com/fzzy/igds/SuperInventoryReportPR.java 73 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fzzy-igdss-core/src/main/java/com/fzzy/igds/data/SuperInventoryReportData.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,70 @@
package com.fzzy.igds.data;
import lombok.Data;
import java.io.Serializable;
/**
 *监管库存报表数据
 *
 * @author sgj
 * @date 2025/12/19
 */
@Data
public class SuperInventoryReportData implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * æ”¶å‚¨å…¬å¸
     */
    private String customerName;
    /**
     * æ‰€å±žåº“区
     */
    private String deptId;
    /**
     * æ‰€å±žä»“库
     */
    private String depotId;
    /**
     * æœŸåˆæ•°é‡(单位KG)
     */
    private Double initialWeight = 0.0;
    /**
     * å…¥åº“数量(单位KG)
     */
    private Double recordInWeight = 0.0;
    /**
     * å€’入数量(单位KG)
     */
    private Double changeInWeight = 0.0;
    /**
     * å‡ºåº“数量(单位KG)
     */
    private Double recordOutWeight = 0.0;
    /**
     * å€’出数量(单位KG)
     */
    private Double changeOutWeight = 0.0;
    /**
     * æŸè€—数量(单位KG)
     */
    private Double lossWeight = 0.0;
    /**
     * æœŸæœ«æ•°é‡(单位KG)
     */
    private Double finalWeight = 0.0;
}
fzzy-igdss-core/src/main/java/com/fzzy/igds/data/SuperInventoryReportParam.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,27 @@
package com.fzzy.igds.data;
import lombok.Data;
/**
 *监管库存报表查询实体类
 *
 * @author sgj
 * @date 2025/12/19
 */
@Data
public class SuperInventoryReportParam extends IgdsBaseParam {
    //    æ”¶å‚¨å…¬å¸
    private String customerName;
    private String title;
    private String timeDesc;
    private String createUser;
    private String createTime;
}
fzzy-igdss-core/src/main/java/com/fzzy/igds/domain/DepotStore.java
@@ -56,8 +56,8 @@
    @TableField("food_level")
    private String foodLevel;
    @Column(name = "food_locationId", columnDefinition = "varchar(40) COMMENT '粮食产地'")
    @TableField("food_locationId")
    @Column(name = "food_location_id", columnDefinition = "varchar(40) COMMENT '粮食产地'")
    @TableField("food_location_id")
    private String foodLocationId;
    @Column(name = "food_location", columnDefinition = "varchar(40) COMMENT '粮食产地'")
fzzy-igdss-core/src/main/java/com/fzzy/igds/service/SuperInventoryReportService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,282 @@
package com.fzzy.igds.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fzzy.igds.constant.Constant;
import com.fzzy.igds.data.SuperInventoryReportData;
import com.fzzy.igds.data.SuperInventoryReportParam;
import com.fzzy.igds.domain.*;
import com.fzzy.igds.mapper.*;
import com.fzzy.igds.utils.ContextUtil;
import com.fzzy.igds.utils.DateUtil;
import com.ruoyi.common.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
/**
 * ç›‘管库存报表Service
 *
 * @author sgj
 * @date 2025/12/19
 */
@Slf4j
@Service
public class SuperInventoryReportService {
    @Resource
    private DepotStoreMapper depotStoreMapper;
    @Resource
    private InoutRecordMapper inoutRecordMapper;
    @Resource
    private InoutStockChangeMapper inoutStockChangeMapper;
    @Resource
    private CoreCompanyMapper coreCompanyMapper;
    @Resource
    private InoutLossOverMapper inoutLossOverMapper;
    @Resource
    private CoreDeptService coreDeptService;
    @Resource
    private DepotService depotService;
    /**
     * æŸ¥è¯¢æŠ¥è¡¨æ•°æ®
     *
     * @author sgj
     * @date 2025/12/19
     * @param param
     */
    public List<SuperInventoryReportData> listSuperInventoryReportData(SuperInventoryReportParam param) {
        //1.获取查询得起止时间,如果没有则,默认截止时间为当天,起始时间为30天前
        Date end = new Date();
        Date start = DateUtil.getNewByDay(end, -30);
        if (null == param.getStart()) {
            param.setStart(DateUtil.getCurZero(start));
        }
        if (null == param.getEnd()) {
            param.setEnd(DateUtil.getCurZero(end));
        }
        //默认组织编码
        String companyId = ContextUtil.getCompanyId();
        //默认库区编码
        String deptId = ContextUtil.subDeptId(null);
        param.setCompanyId(companyId);
        if (StringUtils.isEmpty(param.getDeptId())) {
            param.setDeptId(deptId);
        }
        //region åˆå§‹åŒ–需要范围的数据
        Map<String, SuperInventoryReportData> resultMap = new HashMap<>();
        //查询当前用户下属的所有库区
        List<Dept> deptList = coreDeptService.getDeptData();
        if (null == deptList || deptList.isEmpty()) {
            return new ArrayList<>();
        }
        //预加载所有部门下的仓库信息,减少重复查询
        Map<String, List<Depot>> deptDepotsMap = new HashMap<>();
        Map<String, Company> companyCache = new HashMap<>();
        for (Dept dept : deptList) {
            //获取库区下所有仓库
            List<Depot> depotList = depotService.getData(companyId, dept.getId(), true);
            if (null == depotList || depotList.isEmpty()) {
                continue;
            }
            deptDepotsMap.put(dept.getId(), depotList);
            //缓存公司信息
            int deptIdLength = dept.getId().length();
            String companyCode = dept.getId().substring(0, deptIdLength - 3);
            if (!companyCache.containsKey(companyCode)) {
                Company company = coreCompanyMapper.selectById(companyCode);
                companyCache.put(companyCode, company);
            }
        }
        //构建结果数据
        for (Map.Entry<String, List<Depot>> entry : deptDepotsMap.entrySet()) {
            String deptIdKey = entry.getKey();
            Company company = companyCache.get(deptIdKey.substring(0, deptIdKey.length() - 3));
            for (Depot depot : entry.getValue()) {
                //库区编码+仓库编码组成唯一键
                String key = deptIdKey + "_" + depot.getId();
                SuperInventoryReportData data = new SuperInventoryReportData();
                data.setCustomerName(Optional.ofNullable(company)
                        .map(Company::getId)
                        .orElse("-"));
                data.setDeptId(deptIdKey);
                data.setDepotId(depot.getId());
                resultMap.put(key, data);
            }
        }
        //endregion
        if (resultMap.isEmpty()) {
            return new ArrayList<>();
        }
        //2.查询时间范围内的各种数据
        List<DepotStore> depotStores = queryDepotStores(param);
        List<InoutRecord> inoutRecords = queryInoutRecords(param);
        List<InoutStockChange> inoutStockChanges = queryInoutStockChanges(param);
        List<InoutLossOver> inoutLossOvers = queryInoutLossOvers(param);
        //3. æ•°æ®åˆ†ç»„预处理,提高后续查找效率
        Map<String, List<DepotStore>> storeGroupMap = depotStores.stream()
                .collect(Collectors.groupingBy(store -> store.getDeptId() + "_" + store.getDepotId()));
        Map<String, List<InoutRecord>> recordGroupMap = inoutRecords.stream()
                .collect(Collectors.groupingBy(record -> record.getDeptId() + "_" + record.getDepotId()));
        //4. æ ¹æ®åº“区、仓库为唯一键,组装报表数据
        Date todayZero = DateUtil.getCurZero(new Date());
        boolean isEndDateBeforeToday = param.getEnd().before(todayZero);
        for (SuperInventoryReportData data : resultMap.values()) {
            String dataKey = data.getDeptId() + "_" + data.getDepotId();
            //获取库存数据
            List<DepotStore> depotStoreList = storeGroupMap.getOrDefault(dataKey, new ArrayList<>());
            if (depotStoreList.isEmpty()) {
                continue;
            }
            //排序库存数据
            depotStoreList.sort(Comparator.comparing(DepotStore::getCreateTime));
            //获取出入库记录
            List<InoutRecord> recordList = recordGroupMap.getOrDefault(dataKey, new ArrayList<>());
            Map<Boolean, List<InoutRecord>> recordPartition = recordList.stream()
                    .collect(Collectors.partitioningBy(record -> Constant.TYPE_IN.equals(record.getType())));
            List<InoutRecord> recordInList = recordPartition.get(true);
            List<InoutRecord> recordOutList = recordPartition.get(false);
            //获取倒仓数据
            Map<Boolean, List<InoutStockChange>> stockChangePartition = inoutStockChanges.stream()
                    .filter(change -> data.getDeptId().equals(change.getDeptId()))
                    .collect(Collectors.partitioningBy(change -> data.getDepotId().equals(change.getDepotIdIn())));
            List<InoutStockChange> stockChangeInList = new ArrayList<>();
            List<InoutStockChange> stockChangeOutList = new ArrayList<>();
            //倒入数据
            stockChangeInList.addAll(stockChangePartition.get(true).stream()
                    .filter(change -> data.getDepotId().equals(change.getDepotIdIn()))
                    .collect(Collectors.toList()));
            //倒出数据
            stockChangeOutList.addAll(stockChangePartition.get(false).stream()
                    .filter(change -> data.getDepotId().equals(change.getDepotIdOut()))
                    .collect(Collectors.toList()));
            //损益数据
            List<InoutLossOver> lossOverList = inoutLossOvers.stream()
                    .filter(loss -> data.getDeptId().equals(loss.getDeptId())
                            && data.getDepotId().equals(loss.getDepotId()))
                    .collect(Collectors.toList());
            //计算各项统计数据
            double sumRecordIn = recordInList.stream()
                    .mapToDouble(InoutRecord::getRecordWeight)
                    .sum();
            double sumRecordOut = recordOutList.stream()
                    .mapToDouble(InoutRecord::getRecordWeight)
                    .sum();
            double sumStockChangeIn = stockChangeInList.stream()
                    .mapToDouble(InoutStockChange::getNumber)
                    .sum();
            double sumStockChangeOut = stockChangeOutList.stream()
                    .mapToDouble(InoutStockChange::getNumber)
                    .sum();
            double sumLossOver = lossOverList.stream()
                    .mapToDouble(lossOver -> Constant.TYPE_LOSS.equals(lossOver.getType())
                            ? -lossOver.getAmount()
                            : lossOver.getAmount())
                    .sum();
            //计算期初期末重量
            Double initialWeight = depotStoreList.get(0).getStorageReal();
            Double finalWeight;
            if (isEndDateBeforeToday) {
                //如果截止时间为昨天(当天的0点0分0秒0毫秒)及之前,则最后一条数据为期末数量
                finalWeight = depotStoreList.get(depotStoreList.size() - 1).getStorageReal();
            } else {
                //如果截止时间为今天及之后,则需要结合入出库记录数据来计算期末数量,规则:期末数量 = æœŸåˆæ•°é‡ + å…¥åº“数量 - å‡ºåº“数量 + å€’入数量 - å€’出数量+ æŸç›Šæ•°æ®
                finalWeight = initialWeight + sumRecordIn - sumRecordOut + sumStockChangeIn - sumStockChangeOut + sumLossOver;
            }
            //设置数据
            data.setInitialWeight(initialWeight);
            data.setRecordInWeight(sumRecordIn);
            data.setChangeInWeight(sumStockChangeIn);
            data.setRecordOutWeight(sumRecordOut);
            data.setChangeOutWeight(sumStockChangeOut);
            data.setLossWeight(sumLossOver);
            data.setFinalWeight(finalWeight);
        }
        return new ArrayList<>(resultMap.values());
    }
    /**
     * æŸ¥è¯¢åº“存数据
     */
    private List<DepotStore> queryDepotStores(SuperInventoryReportParam param) {
        QueryWrapper<DepotStore> depotStoreQueryWrapper = new QueryWrapper<>();
        depotStoreQueryWrapper.eq("company_id", param.getCompanyId());
        depotStoreQueryWrapper.eq("dept_id", param.getDeptId());
        depotStoreQueryWrapper.between("create_time", param.getStart(), param.getEnd());
        depotStoreQueryWrapper.orderByAsc("create_time");
        return depotStoreMapper.selectList(depotStoreQueryWrapper);
    }
    /**
     * æŸ¥è¯¢å‡ºå…¥åº“记录数据
     */
    private List<InoutRecord> queryInoutRecords(SuperInventoryReportParam param) {
        QueryWrapper<InoutRecord> inoutRecordQueryWrapper = new QueryWrapper<>();
        inoutRecordQueryWrapper.eq("company_id", param.getCompanyId());
        inoutRecordQueryWrapper.eq("dept_id", param.getDeptId());
        inoutRecordQueryWrapper.between("create_time", param.getStart(), param.getEnd());
        inoutRecordQueryWrapper.orderByAsc("create_time");
        return inoutRecordMapper.selectList(inoutRecordQueryWrapper);
    }
    /**
     * æŸ¥è¯¢å€’仓数据
     */
    private List<InoutStockChange> queryInoutStockChanges(SuperInventoryReportParam param) {
        QueryWrapper<InoutStockChange> inoutStockChangeQueryWrapper = new QueryWrapper<>();
        inoutStockChangeQueryWrapper.eq("company_id", param.getCompanyId());
        inoutStockChangeQueryWrapper.eq("dept_id", param.getDeptId());
        inoutStockChangeQueryWrapper.between("create_time", param.getStart(), param.getEnd());
        inoutStockChangeQueryWrapper.orderByAsc("create_time");
        return inoutStockChangeMapper.selectList(inoutStockChangeQueryWrapper);
    }
    /**
     * æŸ¥è¯¢æŸç›Šæ•°æ®
     */
    private List<InoutLossOver> queryInoutLossOvers(SuperInventoryReportParam param) {
        QueryWrapper<InoutLossOver> inoutLossOverQueryWrapper = new QueryWrapper<>();
        inoutLossOverQueryWrapper.eq("company_id", param.getCompanyId());
        inoutLossOverQueryWrapper.eq("dept_id", param.getDeptId());
        inoutLossOverQueryWrapper.between("create_time", param.getStart(), param.getEnd());
        inoutLossOverQueryWrapper.orderByAsc("create_time");
        return inoutLossOverMapper.selectList(inoutLossOverQueryWrapper);
    }
}
fzzy-igdss-view/src/main/java/com/fzzy/igds/SuperInventoryReport.view.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,287 @@
<?xml version="1.0" encoding="UTF-8"?>
<ViewConfig>
  <Arguments/>
  <Context/>
  <Model>
    <DataType name="dtMain">
      <Property name="creationType">com.fzzy.igds.data.SuperInventoryReportData</Property>
      <PropertyDef name="customerName">
        <Property name="label">收储公司</Property>
        <Property name="mapping">
          <Property name="mapValues">${dorado.getDataProvider(&quot;companyPR#getData&quot;).getResult()}</Property>
          <Property name="keyProperty">id</Property>
          <Property name="valueProperty">dwmc</Property>
        </Property>
      </PropertyDef>
      <PropertyDef name="deptId">
        <Property name="label">所属库区</Property>
        <Property name="mapping">
          <Property name="mapValues">${dorado.getDataProvider(&quot;deptPR#getAllData&quot;).getResult()}</Property>
          <Property name="keyProperty">id</Property>
          <Property name="valueProperty">kqmc</Property>
        </Property>
      </PropertyDef>
      <PropertyDef name="depotId">
        <Property name="label">所属仓库</Property>
        <Property name="mapping">
          <Property name="mapValues">${dorado.getDataProvider(&quot;depotPR#getAllCache&quot;).getResult()}</Property>
          <Property name="keyProperty">id</Property>
          <Property name="valueProperty">name</Property>
        </Property>
      </PropertyDef>
      <PropertyDef name="initialWeight">
        <Property name="label">期初数量</Property>
        <Property name="displayFormat">0.0 KG</Property>
        <Property name="dataType">Double</Property>
      </PropertyDef>
      <PropertyDef name="recordInWeight">
        <Property name="label">入库数量</Property>
        <Property name="dataType">Double</Property>
        <Property name="displayFormat">0.0 KG</Property>
      </PropertyDef>
      <PropertyDef name="changeInWeight">
        <Property name="label">倒入数量</Property>
        <Property name="dataType">Double</Property>
        <Property name="displayFormat">0.0 KG</Property>
      </PropertyDef>
      <PropertyDef name="recordOutWeight">
        <Property name="label">出库数量</Property>
        <Property name="dataType">Double</Property>
        <Property name="displayFormat">0.0 KG</Property>
      </PropertyDef>
      <PropertyDef name="changeOutWeight">
        <Property name="label">倒出数量</Property>
        <Property name="dataType">Double</Property>
        <Property name="displayFormat">0.0 KG</Property>
      </PropertyDef>
      <PropertyDef name="lossWeight">
        <Property name="label">损耗数量</Property>
        <Property name="dataType">Double</Property>
        <Property name="displayFormat">0.0 KG</Property>
      </PropertyDef>
      <PropertyDef name="finalWeight">
        <Property name="label">期末数量</Property>
        <Property name="dataType">Double</Property>
        <Property name="displayFormat">0.0 KG</Property>
      </PropertyDef>
    </DataType>
    <DataType name="dtQuery">
      <Property name="creationType">com.fzzy.igds.data.SuperInventoryReportParam</Property>
      <PropertyDef name="deptId">
        <Property></Property>
        <Property name="label">所属库区</Property>
        <Property name="mapping">
          <Property name="mapValues">${dorado.getDataProvider(&quot;deptPR#getAllData&quot;).getResult()}</Property>
          <Property name="keyProperty">id</Property>
          <Property name="valueProperty">kqmc</Property>
        </Property>
      </PropertyDef>
      <PropertyDef name="depotId">
        <Property></Property>
        <Property name="label">装卸仓库</Property>
        <Property name="mapping">
          <Property name="mapValues">${dorado.getDataProvider(&quot;depotPR#getAllCache&quot;).getResult()}</Property>
          <Property name="keyProperty">id</Property>
          <Property name="valueProperty">name</Property>
        </Property>
      </PropertyDef>
      <PropertyDef name="start">
        <Property name="label">开始时间</Property>
        <Property name="dataType">Date</Property>
      </PropertyDef>
      <PropertyDef name="end">
        <Property name="label">截止时间</Property>
        <Property name="dataType">Date</Property>
      </PropertyDef>
      <PropertyDef name="customerName">
        <Property></Property>
        <Property name="label">收储公司</Property>
        <Property name="mapping">
          <Property name="mapValues">${dorado.getDataProvider(&quot;companyPR#getData&quot;).getResult()}</Property>
          <Property name="keyProperty">id</Property>
          <Property name="valueProperty">dwmc</Property>
        </Property>
      </PropertyDef>
      <PropertyDef name="timeDesc">
        <Property></Property>
        <Property name="label">时间</Property>
      </PropertyDef>
      <PropertyDef name="title">
        <Property></Property>
      </PropertyDef>
      <PropertyDef name="createUser">
        <Property name="label">创建人</Property>
      </PropertyDef>
      <PropertyDef name="createTime">
        <Property name="label">创建时间</Property>
      </PropertyDef>
    </DataType>
  </Model>
  <View layout="padding:10">
    <ClientEvent name="onReady">var deptId = window.parent.DEPT_ID;//父页面中的分库编码&#xD;
&#xD;
&#xD;
//默认查询查询提条件&#xD;
view.get(&quot;#dsQuery&quot;).insert({&#xD;
    deptId:deptId&#xD;
});&#xD;
&#xD;
query = function(){&#xD;
    var data = view.get(&quot;#dsQuery.data&quot;);&#xD;
    view.get(&quot;#dsQuery&quot;).set(&quot;parameter&quot;,data).flushAsync();&#xD;
};&#xD;
query();</ClientEvent>
    <Property name="packages">font-awesome,css-common</Property>
    <DataSet id="dsMain">
      <Property name="dataType">[dtMain]</Property>
      <Property name="dataProvider">superInventoryReportPR#getReportData</Property>
      <Property name="loadMode">manual</Property>
    </DataSet>
    <DataSet id="dsQuery">
      <Property name="dataType">dtQuery</Property>
      <Property></Property>
      <Property name="loadMode">manual</Property>
      <Property name="dataProvider">superInventoryReportPR#getQuery</Property>
    </DataSet>
    <Container>
      <Property name="className">c-param</Property>
      <AutoForm>
        <Property name="cols">*,*,*,*,90,90,140</Property>
        <Property name="dataSet">dsQuery</Property>
        <Property name="labelSeparator">:</Property>
        <Property name="labelAlign">right</Property>
        <Property name="labelWidth">110</Property>
        <Property name="exClassName">bg-color</Property>
        <AutoFormElement>
          <Property name="property">customerName</Property>
          <Property name="name">customerName</Property>
        </AutoFormElement>
        <AutoFormElement>
          <Property name="name">deptId</Property>
          <Property name="property">deptId</Property>
          <Editor/>
        </AutoFormElement>
        <AutoFormElement>
          <Property name="name">start</Property>
          <Property name="property">start</Property>
          <Editor/>
        </AutoFormElement>
        <AutoFormElement>
          <Property name="name">end</Property>
          <Property name="property">end</Property>
          <Editor/>
        </AutoFormElement>
        <Button>
          <ClientEvent name="onClick">var data = view.get(&quot;#dsQuery.data&quot;);&#xD;
view.get(&quot;#dsMain&quot;).set(&quot;parameter&quot;,data).flushAsync();</ClientEvent>
          <Property name="caption">搜索</Property>
          <Property name="exClassName">btn-q1</Property>
          <Property name="iconClass">fa fa-search</Property>
        </Button>
        <Button>
          <ClientEvent name="onClick">view.get(&quot;#dsQuery&quot;).flushAsync();</ClientEvent>
          <Property name="exClassName">btn-q2</Property>
          <Property name="iconClass">fa fa-refresh</Property>
          <Property name="caption">重置</Property>
        </Button>
        <Button layoutConstraint="left">
          <Property name="caption">导出EXCEL</Property>
          <Property name="exClassName">btn-q2</Property>
          <Property name="width">140</Property>
          <Property name="iconClass">fa fa-file-excel-o</Property>
        </Button>
      </AutoForm>
    </Container>
    <Container>
      <Property name="className">c-data</Property>
      <AutoForm id="autoForm1" layoutConstraint="top">
        <Property name="cols">*,*,*,*</Property>
        <Property name="dataSet">dsQuery</Property>
        <Property name="labelAlign">right</Property>
        <Property name="showHint">false</Property>
        <Property name="labelWidth">120</Property>
        <AutoFormElement layoutConstraint="colSpan:4">
          <Property name="name">title</Property>
          <Property name="property">title</Property>
          <Property name="showLabel">false</Property>
          <Property name="editorType">Label</Property>
          <Property name="style">
            <Property name="font">bold 30px Georgia, serif;</Property>
            <Property name="text-align">center</Property>
          </Property>
          <Editor/>
        </AutoFormElement>
        <AutoFormElement>
          <Property name="name">timeDesc</Property>
          <Property name="property">timeDesc</Property>
          <Property name="editorType">Label</Property>
          <Editor/>
        </AutoFormElement>
        <AutoFormElement>
          <Property name="visible">false</Property>
          <Property name="name">depotId</Property>
          <Property name="property">depotId</Property>
          <Editor/>
        </AutoFormElement>
        <AutoFormElement>
          <Property name="name">createUser</Property>
          <Property name="property">createUser</Property>
          <Property name="editorType">Label</Property>
          <Editor/>
        </AutoFormElement>
        <AutoFormElement>
          <Property name="name">createTime</Property>
          <Property name="property">createTime</Property>
          <Property name="editorType">Label</Property>
          <Editor/>
        </AutoFormElement>
      </AutoForm>
      <DataGrid id="dataGridMain" layoutConstraint="padding:8">
        <Property name="dataSet">dsMain</Property>
        <Property name="readOnly">true</Property>
        <Property name="highlightCurrentRow">false</Property>
        <Property name="hideMode">visibility</Property>
        <Property name="headerRowHeight">30</Property>
        <Property name="rowHeight">50</Property>
        <RowNumColumn/>
        <DataColumn name="customerName">
          <Property name="property">customerName</Property>
        </DataColumn>
        <DataColumn name="deptId">
          <Property name="property">deptId</Property>
        </DataColumn>
        <DataColumn name="depotId">
          <Property name="property">depotId</Property>
        </DataColumn>
        <DataColumn name="initialWeight">
          <Property name="property">initialWeight</Property>
        </DataColumn>
        <DataColumn name="recordInWeight">
          <Property name="property">recordInWeight</Property>
        </DataColumn>
        <DataColumn name="changeInWeight">
          <Property name="property">changeInWeight</Property>
        </DataColumn>
        <DataColumn name="recordOutWeight">
          <Property name="property">recordOutWeight</Property>
        </DataColumn>
        <DataColumn name="changeOutWeight">
          <Property name="property">changeOutWeight</Property>
        </DataColumn>
        <DataColumn name="lossWeight">
          <Property name="property">lossWeight</Property>
        </DataColumn>
        <DataColumn name="finalWeight">
          <Property name="property">finalWeight</Property>
        </DataColumn>
      </DataGrid>
      <ToolBar id="tool" layoutConstraint="bottom">
        <Fill/>
        <DataPilot layoutConstraint="right">
          <Property name="itemCodes">pageSize,pages</Property>
          <Property name="dataSet">dsMain</Property>
        </DataPilot>
      </ToolBar>
    </Container>
  </View>
</ViewConfig>
fzzy-igdss-view/src/main/java/com/fzzy/igds/SuperInventoryReportPR.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,73 @@
package com.fzzy.igds;
import com.bstek.dorado.annotation.DataProvider;
import com.fzzy.igds.data.SuperInventoryReportData;
import com.fzzy.igds.data.SuperInventoryReportParam;
import com.fzzy.igds.service.SuperInventoryReportService;
import com.fzzy.igds.service.SysDeptService;
import com.fzzy.igds.utils.ContextUtil;
import com.fzzy.igds.utils.DateUtil;
import com.ruoyi.common.core.domain.entity.SysDept;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
/**
 * åº“存报表
 *
 * @author sgj
 * @date 2025/12/22
 */
@Component
public class SuperInventoryReportPR {
    @Resource
    private SuperInventoryReportService superInventoryReportService;
    @Resource
    private SysDeptService sysDeptService;
    /**
     * superInventoryReportPR#getQuery
     *
     * @return
     */
    @DataProvider
    public SuperInventoryReportParam getQuery() {
        SuperInventoryReportParam result = new SuperInventoryReportParam();
        SysDept subDept = sysDeptService.getCacheDept(null, ContextUtil.subDeptId(null));
        result.setTitle("库存报表");
        if (null != subDept) {
            result.setTitle(subDept.getDeptName() + "库存报表");
            result.setDeptId(String.valueOf(subDept.getDeptId()));
        }
        result.setTimeDesc("检测时间");
        result.setEnd(new Date());
        Date start = DateUtil.getNewByDay(new Date(), -30);
        result.setStart(start);
        result.setTimeDesc(
                DateFormatUtils.format(start, "yyyy-MM-dd") + "   æˆªè‡³ï¼š"
                        + DateFormatUtils.format(new Date(), "yyyy-MM-dd"));
        result.setCreateUser(ContextUtil.getLoginUserName());
        result.setCreateTime(DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
        return result;
    }
    /**
     * superInventoryReportPR#getReportData
     *
     * @param param
     */
    @DataProvider
    public List<SuperInventoryReportData> getReportData(SuperInventoryReportParam param) {
        if (null == param) {
            param = new SuperInventoryReportParam();
        }
        List<SuperInventoryReportData> superInventoryReportData = superInventoryReportService.listSuperInventoryReportData(param);
        return superInventoryReportData;
    }
}