|
|
|
@ -6,6 +6,8 @@ import cn.hutool.core.map.MapUtil;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
|
|
|
import com.deepoove.poi.data.RowRenderData;
|
|
|
|
|
|
|
|
import com.deepoove.poi.data.Rows;
|
|
|
|
import com.github.yulichang.toolkit.JoinWrappers;
|
|
|
|
import com.github.yulichang.toolkit.JoinWrappers;
|
|
|
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
@ -382,30 +384,27 @@ public class WmsShippingBillServiceImpl implements IWmsShippingBillService {
|
|
|
|
// 发货方联系电话
|
|
|
|
// 发货方联系电话
|
|
|
|
data.put("contactNumber", StringUtils.blankToDefault(vo.getContactNumber(), ""));
|
|
|
|
data.put("contactNumber", StringUtils.blankToDefault(vo.getContactNumber(), ""));
|
|
|
|
|
|
|
|
|
|
|
|
// === 明细列表 ===
|
|
|
|
// === 明细列表(使用 DynamicTableRenderPolicy 动态表格渲染) ===
|
|
|
|
// 对应 Word 模板中的 {{#details}}...{{/details}} 循环表格:
|
|
|
|
// 对应 Word 模板中的 {{detailsTable}} 占位符,由 WmsShippingDetailTablePolicy 策略处理
|
|
|
|
// - seq → {{seq}} (行号)
|
|
|
|
// 表格列顺序:序号、名称、数量、单位、备注
|
|
|
|
// - materialName → {{materialName}}(物料名称)
|
|
|
|
List<RowRenderData> detailRows = new ArrayList<>();
|
|
|
|
// - quantity → {{quantity}} (发货数量)
|
|
|
|
|
|
|
|
// - unit → {{unit}} (计量单位)
|
|
|
|
|
|
|
|
// - remark → {{remark}} (备注)
|
|
|
|
|
|
|
|
// 如需在模板中添加单价、金额、合计行等字段,可在此处扩展 row 中的字段,并在 data 中追加 totalQuantity、totalAmount 等汇总字段。
|
|
|
|
|
|
|
|
List<Map<String, Object>> details = new ArrayList<>();
|
|
|
|
|
|
|
|
List<WmsShippingDetailsVo> itemsVo = vo.getItemsVo();
|
|
|
|
List<WmsShippingDetailsVo> itemsVo = vo.getItemsVo();
|
|
|
|
if (CollUtil.isNotEmpty(itemsVo)) {
|
|
|
|
if (CollUtil.isNotEmpty(itemsVo)) {
|
|
|
|
int seq = 1;
|
|
|
|
int seq = 1;
|
|
|
|
for (WmsShippingDetailsVo item : itemsVo) {
|
|
|
|
for (WmsShippingDetailsVo item : itemsVo) {
|
|
|
|
Map<String, Object> row = new HashMap<>();
|
|
|
|
// 构建行数据:序号、名称、数量、单位、备注(poi-tl 1.12.x 使用 Rows.of().create())
|
|
|
|
row.put("seq", String.valueOf(seq++));
|
|
|
|
RowRenderData row = Rows.of(
|
|
|
|
row.put("materialName", StringUtils.blankToDefault(item.getMaterialName(), ""));
|
|
|
|
String.valueOf(seq++),
|
|
|
|
row.put("quantity", item.getShippingStockAmount() != null ? item.getShippingStockAmount().toPlainString() : "");
|
|
|
|
StringUtils.blankToDefault(item.getMaterialName(), ""),
|
|
|
|
row.put("unit", StringUtils.blankToDefault(item.getUnitName(), ""));
|
|
|
|
item.getShippingStockAmount() != null ? item.getShippingStockAmount().toPlainString() : "",
|
|
|
|
row.put("remark", StringUtils.blankToDefault(item.getRemark(), ""));
|
|
|
|
StringUtils.blankToDefault(item.getUnitName(), ""),
|
|
|
|
details.add(row);
|
|
|
|
StringUtils.blankToDefault(item.getRemark(), "")
|
|
|
|
|
|
|
|
).create();
|
|
|
|
|
|
|
|
detailRows.add(row);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// poi-tl 列表占位符,对应 Word 模板中的 {{#details}}...{{/details}}
|
|
|
|
// DynamicTableRenderPolicy 表格占位符,由 WmsShippingDetailTablePolicy 渲染
|
|
|
|
data.put("details", details);
|
|
|
|
data.put("detailsTable", detailRows);
|
|
|
|
|
|
|
|
|
|
|
|
return data;
|
|
|
|
return data;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|