feat(inventory): 添加发货详情导出功能

- 移除了 edit.html 中的调试代码 debugger
- 新增 InventoryDeliveryDetailExcelDto 类用于发货详情数据导出
- 在 InventoryDeliveryController 中增加了发货详情导出接口 /detail/export- 实现了 InventoryDeliveryServiceImpl 中的 detailExport 方法以支持详情导出逻辑
- 扩展了 InventoryInfoMapper 和对应的 XML 文件,新增 listByProductSnList 查询方法
- 修改了 InventoryOuterMapper.xml,增加对 projectCode 和 projectName 的查询条件支持
- 在前端页面 outer.html 中添加了项目编号、合同编号及项目名称的搜索框
- 在 view.html 页面中加入了导出按钮并实现对应的 JavaScript 导出函数- 为订单财务页面 orderFinance.html 添加了完结状态字段显示
dev_1.0.0
chenhao 2025-10-30 09:07:30 +08:00
parent c590a42e83
commit ecff189fe2
12 changed files with 147 additions and 4 deletions

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('修改产品库存')" />
<th:block th:include="include :: datetimepicker-css" />
@ -72,6 +72,11 @@
</table>
</form>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-warning" onclick="exportDetail()" shiro:hasPermission="inventory:delivery:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<form id="query-product-sn">
<input type="hidden" name="inventoryStatus" value="1">
<input type="hidden" name="deliveryId" th:value="${inventoryDelivery.id}">
@ -91,6 +96,22 @@
focusCleanup: true
});
function exportDetail() {
let data={
id: [[${inventoryDelivery.id}]]
}
$.modal.loading("正在导出数据,请稍候...");
$.post(prefix+"/detail/export", data, function (result) {
if (result.code == web_status.SUCCESS) {
window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true;
} else if (result.code == web_status.WARNING) {
$.modal.alertWarning(result.msg)
} else {
$.modal.alertError(result.msg);
}
$.modal.closeLoading();
});
}
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-delivery-edit').serialize());

View File

@ -475,7 +475,6 @@
return;
}
let arrays = []
debugger
if (productSnData.length <= 0) {
arrays = $.table.selectColumns("productSn");
// if (arrays.length != quantity) {

View File

@ -14,6 +14,18 @@
<label>出库单号:</label>
<input type="text" name="outerCode"/>
</li>
<li>
<label>项目编号:</label>
<input type="text" name="projectCode"/>
</li>
<li>
<label>合同编号:</label>
<input type="text" name="orderCode"/>
</li>
<li>
<label>项目名称:</label>
<input type="text" name="projectName"/>
</li>
<li>
<label>发货状态:</label>
<select name="deliveryStatus" class="form-control" th:with="type=${@dict.getType('outer_delivery_status')}">

View File

@ -272,6 +272,14 @@
return $.table.selectDictLabel([[${@dict.getType('order_status')}]], value);
}
},
{
field: 'financeStatus',
title: '完结状态',
width: 100,
formatter: function (value, row, index) {
return value=='1'?'完结':'未完结';
}
},
{
field: 'agentName',
title: '代表处',

View File

@ -6,6 +6,7 @@ import java.util.stream.Collectors;
import cn.hutool.core.collection.CollUtil;
import com.ruoyi.sip.domain.OmsInventoryDeliveryDetail;
import com.ruoyi.sip.dto.inventory.InventoryDeliveryDetailExcelDto;
import com.ruoyi.sip.service.IInventoryAuthService;
import com.ruoyi.sip.service.IOmsInventoryDeliveryDetailService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
@ -83,7 +84,16 @@ public class InventoryDeliveryController extends BaseController
ExcelUtil<InventoryDelivery> util = new ExcelUtil<InventoryDelivery>(InventoryDelivery.class);
return util.exportExcel(list, "发货记录数据");
}
@RequiresPermissions("inventory:delivery:export")
@Log(title = "发货记录", businessType = BusinessType.EXPORT)
@PostMapping("/detail/export")
@ResponseBody
public AjaxResult detailExport(InventoryDelivery inventoryDelivery)
{
List<InventoryDeliveryDetailExcelDto> list = inventoryDeliveryService.detailExport(inventoryDelivery);
ExcelUtil<InventoryDeliveryDetailExcelDto> util = new ExcelUtil<InventoryDeliveryDetailExcelDto>(InventoryDeliveryDetailExcelDto.class);
return util.exportExcel(list, "发货详情记录数据");
}
/**
*
*/

View File

@ -0,0 +1,52 @@
package com.ruoyi.sip.dto.inventory;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.sip.domain.InventoryInfo;
import lombok.Data;
import lombok.Getter;
import lombok.ToString;
import java.util.Date;
import java.util.List;
/**
* oms_inventory_delivery
*
* @author ruoyi
* @date 2025-08-12
*/
@Data
@ToString
public class InventoryDeliveryDetailExcelDto extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** SN码 */
@Excel(name = "SN码")
private String productSn;
@Excel(name = "产品编码")
private String productCode;
@Excel(name = "产品型号")
private String model;
@Excel(name = "描述")
private String productDesc;
@Excel(name = "仓库")
private String warehouseName;
@Excel(name = "物流单号")
private String logisticsCode;
@Excel(name = "发货方式",dictType = "delivery_type")
private String deliveryType;
@Excel(name = "物流公司",dictType = "logistics_company")
private String logisticsCompany;
@Excel(name = "发货人")
private String createByName;
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Excel(name = "发货时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date deliveryTime;
}

View File

@ -74,4 +74,6 @@ public interface InventoryInfoMapper
void recallByOrderCode(List<String> orderCode);
List<InventoryInfo> listByProductSnList(List<String> productSnList);
}

View File

@ -3,6 +3,7 @@ package com.ruoyi.sip.service;
import java.util.List;
import com.ruoyi.sip.domain.InventoryDelivery;
import com.ruoyi.sip.dto.ApiDataQueryDto;
import com.ruoyi.sip.dto.inventory.InventoryDeliveryDetailExcelDto;
import com.ruoyi.sip.vo.DeliveryInfoVo;
/**
@ -69,4 +70,5 @@ public interface IInventoryDeliveryService
void recall(Long id);
List<InventoryDeliveryDetailExcelDto> detailExport(InventoryDelivery inventoryDelivery);
}

View File

@ -11,6 +11,7 @@ import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.sip.domain.*;
import com.ruoyi.sip.dto.ApiDataQueryDto;
import com.ruoyi.sip.dto.inventory.InventoryDeliveryDetailExcelDto;
import com.ruoyi.sip.mapper.InventoryOuterMapper;
import com.ruoyi.sip.service.*;
import com.ruoyi.sip.vo.DeliveryInfoVo;
@ -292,6 +293,33 @@ public class InventoryDeliveryServiceImpl implements IInventoryDeliveryService {
}
@Override
public List<InventoryDeliveryDetailExcelDto> detailExport(InventoryDelivery inventoryDelivery) {
InventoryDelivery dbData = inventoryDeliveryMapper.selectInventoryDeliveryById(inventoryDelivery.getId());
List<OmsInventoryDeliveryDetail> omsInventoryDeliveryDetails = deliveryDetailService.selectOmsInventoryDeliveryDetailByDeliveryId(dbData.getId());
InventoryInfo queryParams = new InventoryInfo();
if (CollUtil.isNotEmpty(omsInventoryDeliveryDetails)){
queryParams.setProductSnList(omsInventoryDeliveryDetails.stream()
.map(OmsInventoryDeliveryDetail::getProductSn).collect(Collectors.toList()));
}
queryParams.setOuterCode(dbData.getOuterCode());
List<InventoryInfo> inventoryInfos = inventoryInfoService.selectInventoryInfoList(queryParams);
return inventoryInfos.stream().map(item->{
InventoryDeliveryDetailExcelDto detailExcelDto = new InventoryDeliveryDetailExcelDto();
detailExcelDto.setProductSn(item.getProductSn());
detailExcelDto.setProductCode(item.getProductCode());
detailExcelDto.setProductDesc(item.getProductDesc());
detailExcelDto.setModel(item.getModel());
detailExcelDto.setWarehouseName(item.getWarehouseName());
detailExcelDto.setDeliveryTime(dbData.getDeliveryTime());
detailExcelDto.setLogisticsCode(dbData.getLogisticsCode());
detailExcelDto.setDeliveryType(dbData.getDeliveryType());
detailExcelDto.setLogisticsCompany(dbData.getLogisticsCompany());
detailExcelDto.setCreateByName(dbData.getCreateByName());
return detailExcelDto;
}).collect(Collectors.toList());
}
/**
* DeliveryInfoVo
*/

View File

@ -71,7 +71,7 @@ public class InventoryInfoServiceImpl implements IInventoryInfoService {
@Override
public List<InventoryInfo> listByProductSnList(List<String> productSnList) {
return Collections.emptyList();
return inventoryInfoMapper.listByProductSnList(productSnList);
}
/**

View File

@ -87,6 +87,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
)
</select>
<select id="listByProductSnList" resultType="com.ruoyi.sip.domain.InventoryInfo">
<include refid="selectInventoryInfoVo"/>
where t1.product_sn in
<foreach item="item" index="index" collection="list" separator="," open="(" close=")">
#{item}
</foreach>
</select>
<insert id="insertInventoryInfo" parameterType="InventoryInfo" useGeneratedKeys="true" keyProperty="id">

View File

@ -83,6 +83,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</if>
<if test="quantity != null ">and t1.quantity = #{quantity}</if>
<if test="projectCode != null and projectCode!=''">and t4.project_code = #{projectCode}</if>
<if test="projectName != null and projectName!=''">and t4.project_name like concat('%' ,#{projectName},'%') </if>
<if test="outerStatus != null and outerStatus != ''">and t1.outer_status = #{outerStatus}</if>
<if test="outerStatusList != null and outerStatusList.size>0">and t1.outer_status in
<foreach collection="outerStatusList" open="(" close=")" item="item" separator=",">