Merge pull request 'develop' (#5) from develop into master

Reviewed-on: http://git.xdadan.loc/tanex/emis-service/pulls/5
This commit is contained in:
smshen 2025-04-25 16:18:03 +08:00
commit b74e5e6fcb
8 changed files with 605 additions and 19 deletions

View File

@ -11,13 +11,21 @@
package com.xdadan.erp.web.emis;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.map.MapUtil;
import com.aliyun.tea.utils.IOUtils;
import com.xdadan.erp.common.annotation.filter.jackson.JacksonFilter;
import com.xdadan.erp.emis.domain.WarehouseInExport;
import com.xdadan.erp.emis.domain.exception.EmisBizError;
import com.xdadan.erp.emis.service.excelCellStrategy.ImageExcelHandler;
import com.xdadan.erp.emis.utils.WaybillHelper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -201,4 +209,60 @@ public class EmisWarehouseInController extends EmisBaseController
{
return toAjax(emisWarehouseInService.deleteEmisWarehouseInByIds(ids));
}
/**
* 导出进仓单详细信息
*/
@PreAuthorize("@ss.hasPermi('emis:exportWarehouseInInfo:export')")
@Log(title = "导出进仓单详细信息", businessType = BusinessType.EXPORT)
@PostMapping("/exportWarehouseInInfo")
public void exportWarehouseInInfo(HttpServletResponse response, @RequestBody List<String> inNos) {
try {
List<WarehouseInExport> list = emisWarehouseInService.selectWarehouseInExportData(inNos);
// 转换为Object数组列表
List<Object[]> dataList = list.stream()
.map(item -> new Object[] {
item.getInNo(),
item.getBillCode(),
item.getOrderSn(),
item.getEntryDate(),
item.getTotalParcelQty(),
item.getTotalWeight(),
item.getTotalVolume(),
item.getPrepareInExpress(),
item.getPrepareInBillCode(),
item.getGoodsName(),
item.getPrepareInSupplier(),
item.getImageUrls()
})
.collect(Collectors.toList());
// 生成Excel文件
byte[] excelBytes = ImageExcelHandler.generateExcel(dataList);
String fileName = "进仓货物详细信息_" + UUID.randomUUID().toString() + ".xlsx";
response.setHeader("Content-Disposition",
"attachment;filename*=utf-8''" + URLEncoder.encode(fileName, StandardCharsets.UTF_8.name()));
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
ServletOutputStream outputStream = response.getOutputStream();
outputStream.write(excelBytes);
outputStream.flush();
IOUtils.closeQuietly(outputStream);
// 清理临时文件
list.forEach(item -> {
if (item.getImageFiles() != null) {
item.getImageFiles().forEach(file -> {
if (file != null && file.exists()) {
file.delete();
}
});
}
});
} catch (Exception e) {
throw new RuntimeException("导出进仓单数据失败:" + e.getMessage());
}
}
}

View File

@ -0,0 +1,50 @@
package com.xdadan.erp.emis.domain;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
import com.alibaba.excel.annotation.ExcelIgnore;
import java.io.File;
import java.util.List;
@Data
public class WarehouseInExport {
@ExcelProperty("进仓单号")
private String inNo;
@ExcelProperty("运单号")
private String billCode;
@ExcelProperty("订单号")
private String orderSn;
@ExcelProperty("进仓时间")
private String entryDate;
@ExcelProperty("件数")
private Integer totalParcelQty;
@ExcelProperty("重量")
private String totalWeight;
@ExcelProperty("体积")
private String totalVolume;
@ExcelProperty("快递公司")
private String prepareInExpress;
@ExcelProperty("快递单号")
private String prepareInBillCode;
@ExcelProperty("品名")
private String goodsName;
@ExcelProperty("供应商")
private String prepareInSupplier;
@ExcelProperty("图片")
private String imageUrls;
@ExcelIgnore
private List<File> imageFiles;
}

View File

@ -31,6 +31,14 @@ public interface EmisWarehouseInMapper extends BaseMapper<EmisWarehouseIn>
public EmisWarehouseIn selectEmisWarehouseInByInNo(String inNo);
/**
* 批量查询进仓单信息
*
* @param inNos 进仓单号列表
* @return 进仓单信息列表
*/
List<EmisWarehouseIn> selectEmisWarehouseInByInNos(List<String> inNos);
/**
* 查询列表
*

View File

@ -11,6 +11,7 @@ package com.xdadan.erp.emis.service;
import java.util.List;
import com.xdadan.erp.emis.domain.EmisWarehouseIn;
import com.xdadan.erp.emis.domain.WarehouseInExport;
import com.xdadan.erp.emis.domain.exception.EmisBizError;
/**
@ -71,4 +72,9 @@ public interface IEmisWarehouseInService
* @return 结果
*/
public int deleteEmisWarehouseInById(Long id);
/**
* 根据进仓单号列表查询导出数据
*/
List<WarehouseInExport> selectWarehouseInExportData(List<String> inNos) throws EmisBizError;
}

View File

@ -0,0 +1,248 @@
package com.xdadan.erp.emis.service.excelCellStrategy;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.ss.util.RegionUtil;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.apache.poi.util.Units;
import org.apache.commons.io.IOUtils;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.List;
public class ImageExcelHandler {
private static final int IMAGE_COLUMN_START = 11; // 图片起始列
private static final int ROW_HEIGHT = 80; // 行高(像素)
private static final int IMAGE_COLUMN_WIDTH = 15; // 每个图片列的宽度
public static byte[] generateExcel(List<Object[]> data) throws IOException {
try (Workbook workbook = new XSSFWorkbook()) {
Sheet sheet = workbook.createSheet("进仓货物信息");
// 创建样式
CellStyle headerStyle = createHeaderStyle(workbook);
CellStyle dataStyle = createDataStyle(workbook);
CellStyle mergedHeaderStyle = createMergedHeaderStyle(workbook); // 新增合并单元格的样式
// 首先计算最大图片数量
int maxImageCount = 1;
for (Object[] rowData : data) {
if (rowData[rowData.length - 1] != null) {
String[] imageUrls = rowData[rowData.length - 1].toString().split(",");
maxImageCount = Math.max(maxImageCount, imageUrls.length);
}
}
// 设置列宽
sheet.setColumnWidth(0, 15 * 256); // 进仓单号
sheet.setColumnWidth(1, 15 * 256); // 运单号
sheet.setColumnWidth(2, 15 * 256); // 订单号
sheet.setColumnWidth(3, 20 * 256); // 进仓时间
sheet.setColumnWidth(4, 10 * 256); // 件数
sheet.setColumnWidth(5, 10 * 256); // 重量
sheet.setColumnWidth(6, 10 * 256); // 体积
sheet.setColumnWidth(7, 15 * 256); // 快递公司
sheet.setColumnWidth(8, 15 * 256); // 快递单号
sheet.setColumnWidth(9, 20 * 256); // 品名
sheet.setColumnWidth(10, 15 * 256); // 供应商
// 设置所有图片列的宽度
for (int i = 0; i < maxImageCount; i++) {
sheet.setColumnWidth(IMAGE_COLUMN_START + i, IMAGE_COLUMN_WIDTH * 256);
}
// 创建标题行
Row headerRow = sheet.createRow(0);
headerRow.setHeight((short) (30 * 20)); // 设置标题行高
String[] headers = { "进仓单号", "运单号", "订单号", "进仓时间", "件数", "重量", "体积", "快递公司", "快递单号", "品名", "供应商", "图片" };
// 创建标题单元格
for (int i = 0; i < headers.length; i++) {
Cell cell = headerRow.createCell(i);
cell.setCellValue(headers[i]);
if (i == IMAGE_COLUMN_START) {
cell.setCellStyle(mergedHeaderStyle);
} else {
cell.setCellStyle(headerStyle);
}
}
// 创建数据行
for (int i = 0; i < data.size(); i++) {
Object[] rowData = data.get(i);
Row row = sheet.createRow(i + 1);
row.setHeight((short) (ROW_HEIGHT * 20)); // 设置行高
// 填充数据
for (int j = 0; j < rowData.length - 1; j++) {
Cell cell = row.createCell(j);
if (rowData[j] != null) {
cell.setCellValue(rowData[j].toString());
}
cell.setCellStyle(dataStyle);
}
// 为所有可能的图片列创建单元格(即使没有图片)
for (int j = 0; j < maxImageCount; j++) {
Cell imageCell = row.createCell(IMAGE_COLUMN_START + j);
imageCell.setCellStyle(dataStyle);
}
// 处理图片
if (rowData[rowData.length - 1] != null) {
String[] imageUrls = rowData[rowData.length - 1].toString().split(",");
Drawing<?> drawing = sheet.createDrawingPatriarch();
for (int j = 0; j < imageUrls.length; j++) {
try {
String imageUrl = imageUrls[j].trim();
if (imageUrl.isEmpty()) {
continue;
}
URL url = new URL(imageUrl);
try (InputStream inputStream = url.openStream()) {
byte[] imageBytes = IOUtils.toByteArray(inputStream);
if (imageBytes.length == 0) {
System.err.println("Empty image data for URL: " + imageUrl);
continue;
}
// 添加图片到工作簿
int pictureIdx;
if (imageUrl.toLowerCase().endsWith(".png")) {
pictureIdx = workbook.addPicture(imageBytes, Workbook.PICTURE_TYPE_PNG);
} else {
pictureIdx = workbook.addPicture(imageBytes, Workbook.PICTURE_TYPE_JPEG);
}
// 计算当前图片的列
int currentColumn = IMAGE_COLUMN_START + j;
// 创建锚点,使用相对位置以实现居中
ClientAnchor anchor = drawing.createAnchor(
Units.EMU_PER_PIXEL * 10, // dx1 - 左边距
Units.EMU_PER_PIXEL * 5, // dy1 - 上边距
-Units.EMU_PER_PIXEL * 10, // dx2 - 右边距
-Units.EMU_PER_PIXEL * 5, // dy2 - 下边距
currentColumn, // col1
i + 1, // row1
currentColumn + 1, // col2
i + 2 // row2
);
anchor.setAnchorType(ClientAnchor.AnchorType.MOVE_AND_RESIZE);
// 创建图片并居中显示
Picture picture = drawing.createPicture(anchor, pictureIdx);
picture.resize(0.99); // 调整图片大小以保持边距
}
} catch (Exception e) {
System.err.println("Error processing image: " + e.getMessage());
e.printStackTrace();
}
}
}
}
// 合并图片列的表头
CellRangeAddress mergedRegion = new CellRangeAddress(
0, // 起始行
0, // 结束行
IMAGE_COLUMN_START, // 起始列
IMAGE_COLUMN_START + maxImageCount - 1 // 结束列
);
sheet.addMergedRegion(mergedRegion);
// 为合并后的单元格设置边框
RegionUtil.setBorderTop(BorderStyle.MEDIUM, mergedRegion, sheet);
RegionUtil.setBorderBottom(BorderStyle.MEDIUM, mergedRegion, sheet);
RegionUtil.setBorderLeft(BorderStyle.MEDIUM, mergedRegion, sheet);
RegionUtil.setBorderRight(BorderStyle.MEDIUM, mergedRegion, sheet);
RegionUtil.setBottomBorderColor(IndexedColors.BLACK.getIndex(), mergedRegion, sheet);
RegionUtil.setTopBorderColor(IndexedColors.BLACK.getIndex(), mergedRegion, sheet);
RegionUtil.setLeftBorderColor(IndexedColors.BLACK.getIndex(), mergedRegion, sheet);
RegionUtil.setRightBorderColor(IndexedColors.BLACK.getIndex(), mergedRegion, sheet);
// 写入到字节数组
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
workbook.write(outputStream);
return outputStream.toByteArray();
}
}
private static CellStyle createMergedHeaderStyle(Workbook workbook) {
CellStyle style = workbook.createCellStyle();
// 设置背景色
style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
// 设置边框
style.setBorderTop(BorderStyle.MEDIUM);
style.setBorderBottom(BorderStyle.MEDIUM);
style.setBorderLeft(BorderStyle.MEDIUM);
style.setBorderRight(BorderStyle.MEDIUM);
// 设置边框颜色
style.setTopBorderColor(IndexedColors.BLACK.getIndex());
style.setBottomBorderColor(IndexedColors.BLACK.getIndex());
style.setLeftBorderColor(IndexedColors.BLACK.getIndex());
style.setRightBorderColor(IndexedColors.BLACK.getIndex());
// 设置对齐方式
style.setAlignment(HorizontalAlignment.CENTER);
style.setVerticalAlignment(VerticalAlignment.CENTER);
// 设置字体
Font font = workbook.createFont();
font.setBold(true);
font.setFontHeightInPoints((short) 12);
style.setFont(font);
return style;
}
private static CellStyle createHeaderStyle(Workbook workbook) {
CellStyle style = workbook.createCellStyle();
// 设置背景色
style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
// 设置边框
style.setBorderTop(BorderStyle.MEDIUM);
style.setBorderBottom(BorderStyle.MEDIUM);
style.setBorderLeft(BorderStyle.MEDIUM);
style.setBorderRight(BorderStyle.MEDIUM);
// 设置边框颜色
style.setTopBorderColor(IndexedColors.BLACK.getIndex());
style.setBottomBorderColor(IndexedColors.BLACK.getIndex());
style.setLeftBorderColor(IndexedColors.BLACK.getIndex());
style.setRightBorderColor(IndexedColors.BLACK.getIndex());
// 设置对齐方式
style.setAlignment(HorizontalAlignment.CENTER);
style.setVerticalAlignment(VerticalAlignment.CENTER);
// 设置字体
Font font = workbook.createFont();
font.setBold(true);
font.setFontHeightInPoints((short) 12);
style.setFont(font);
return style;
}
private static CellStyle createDataStyle(Workbook workbook) {
CellStyle style = workbook.createCellStyle();
// 设置边框
style.setBorderTop(BorderStyle.THIN);
style.setBorderBottom(BorderStyle.THIN);
style.setBorderLeft(BorderStyle.THIN);
style.setBorderRight(BorderStyle.THIN);
// 设置边框颜色
style.setTopBorderColor(IndexedColors.BLACK.getIndex());
style.setBottomBorderColor(IndexedColors.BLACK.getIndex());
style.setLeftBorderColor(IndexedColors.BLACK.getIndex());
style.setRightBorderColor(IndexedColors.BLACK.getIndex());
// 设置对齐方式
style.setAlignment(HorizontalAlignment.CENTER);
style.setVerticalAlignment(VerticalAlignment.CENTER);
// 设置自动换行
style.setWrapText(true);
return style;
}
}

View File

@ -895,9 +895,9 @@ public class EmisSettleBillServiceImpl extends EmisBaseService implements IEmisS
log.info("get textMap is success, textMap,{}", textMap);
// 出账日期
String date = DateUtils.parseDateToStr("yyyy.M.dd", list.get(0).getBillDate());
String year = DateUtils.parseDateToStr("yyyy", list.get(0).getBillDate());
String month = DateUtils.parseDateToStr("M", list.get(0).getBillDate());
String date = DateUtils.parseDateToStr("yyyy.M.dd", bill.getCreateTime());
String year = DateUtils.parseDateToStr("yyyy", DateUtils.parseDate(bill.getBillMonth(),"yyyy-MM"));
String month = DateUtils.parseDateToStr("M", DateUtils.parseDate(bill.getBillMonth(),"yyyy-MM"));
// String filePath = "D:\\log\\stduent_01.xlsx";
ServletOutputStream outputStream = response.getOutputStream();

View File

@ -8,23 +8,33 @@
* @Description: <p> 进仓单 实体类 </p>
*/
package com.xdadan.erp.emis.service.impl;
package com.xdadan.erp.emis.service.impl;
import java.math.BigDecimal;
import java.util.List;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import com.xdadan.erp.emis.domain.EmisWarehouseInBatch;
import com.xdadan.erp.emis.domain.EmisWaybill;
import com.xdadan.erp.emis.domain.enumtype.EmisBizErrorType;
import com.xdadan.erp.emis.domain.exception.EmisBizError;
import com.xdadan.erp.emis.mapper.EmisWarehouseInBatchMapper;
import com.xdadan.erp.emis.mapper.EmisWaybillMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.xdadan.erp.emis.domain.EmisWarehouseIn;
import com.xdadan.erp.emis.mapper.EmisWarehouseInMapper;
import com.xdadan.erp.emis.service.IEmisWarehouseInService;
import org.springframework.util.CollectionUtils;
import com.xdadan.erp.common.utils.DateUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import java.io.File;
import org.apache.commons.io.FileUtils;
import com.xdadan.erp.emis.domain.*;
import com.xdadan.erp.emis.domain.enumtype.EmisBizErrorType;
import com.xdadan.erp.emis.domain.exception.EmisBizError;
import com.xdadan.erp.emis.mapper.EmisWarehouseInBatchMapper;
import com.xdadan.erp.emis.mapper.EmisWaybillMapper;
import jodd.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.xdadan.erp.emis.mapper.EmisWarehouseInMapper;
import com.xdadan.erp.emis.service.IEmisWarehouseInService;
import org.springframework.util.CollectionUtils;
/**
* 进仓单Service业务层处理
@ -33,6 +43,7 @@ import org.springframework.util.CollectionUtils;
* @date 2024-05-22 00:20:31
*/
@Service
@Slf4j
public class EmisWarehouseInServiceImpl implements IEmisWarehouseInService
{
@Autowired
@ -185,4 +196,138 @@ public class EmisWarehouseInServiceImpl implements IEmisWarehouseInService
return emisWarehouseInMapper.deleteEmisWarehouseInById(id);
}
/**
* 下载图片到临时文件
*/
private File downloadImage(String imageUrl) {
HttpURLConnection connection = null;
InputStream inputStream = null;
File tempFile = null;
try {
// 创建临时文件
String fileExt = imageUrl.substring(imageUrl.lastIndexOf("."));
if (!fileExt.matches("\\.(jpg|jpeg|png|gif)$")) {
fileExt = ".jpg"; // 默认扩展名
}
tempFile = File.createTempFile("warehouse_in_", fileExt);
tempFile.deleteOnExit(); // 程序退出时删除临时文件
// 下载图片
URL url = new URL(imageUrl);
connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setConnectTimeout(5000);
connection.setReadTimeout(5000);
if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {
inputStream = connection.getInputStream();
FileUtils.copyInputStreamToFile(inputStream, tempFile);
return tempFile;
}
} catch (Exception e) {
log.error("下载图片失败: {}", imageUrl, e);
if (tempFile != null && tempFile.exists()) {
tempFile.delete();
}
} finally {
IOUtils.closeQuietly(inputStream);
if (connection != null) {
connection.disconnect();
}
}
return null;
}
@Override
public List<WarehouseInExport> selectWarehouseInExportData(List<String> inNos) {
log.info("开始导出进仓单数据,进仓单号:{}", inNos);
if (CollectionUtils.isEmpty(inNos)) {
log.warn("进仓单号列表为空");
return new ArrayList<>();
}
// 批量查询所有进仓单数据
List<EmisWarehouseIn> warehouseInList = emisWarehouseInMapper.selectEmisWarehouseInByInNos(inNos);
if (CollectionUtils.isEmpty(warehouseInList)) {
log.warn("未查询到进仓单数据,进仓单号:{}", inNos);
return new ArrayList<>();
}
log.info("查询到{}条进仓单数据", warehouseInList.size());
List<WarehouseInExport> exportList = new ArrayList<>();
warehouseInList.forEach(warehouseIn -> {
if (warehouseIn.getStockInBatchList() != null) {
warehouseIn.getStockInBatchList().forEach(batch -> {
try {
WarehouseInExport exportDTO = new WarehouseInExport();
// 进仓单号
exportDTO.setInNo(warehouseIn.getInNo());
// 运单号
exportDTO.setBillCode(warehouseIn.getBillCode());
// 订单号
exportDTO.setOrderSn(warehouseIn.getOrderSn());
// 进仓时间
exportDTO.setEntryDate(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",batch.getEntryDate()));
// 件数
exportDTO.setTotalParcelQty(batch.getTotalParcelQty());
// 重量
exportDTO.setTotalWeight(batch.getTotalWeight().stripTrailingZeros().toPlainString());
// 体积
exportDTO.setTotalVolume(batch.getTotalVolume().stripTrailingZeros().toPlainString());
// 快递公司
exportDTO.setPrepareInExpress(batch.getPrepareInExpress());
// 快递单号
exportDTO.setPrepareInBillCode(batch.getPrepareInBillCode());
// 品名
String goodsName = batch.getCargoList().stream()
.map(EmisWarehouseInDtl::getGoodsName)
.distinct()
.filter(i -> StringUtil.isNotEmpty(i))
.collect(Collectors.joining(","));
if (StringUtil.isNotEmpty(goodsName)) {
exportDTO.setGoodsName(goodsName);
}
// 供应商
exportDTO.setPrepareInSupplier(batch.getPrepareInSupplier());
// 处理图片 - 处理所有图片
if (StringUtil.isNotEmpty(batch.getPicUrl())) {
String[] urls = batch.getPicUrl().split(",");
List<File> imageFiles = new ArrayList<>();
StringBuilder imageUrlsBuilder = new StringBuilder();
for (String url : urls) {
File imageFile = downloadImage(url.trim());
if (imageFile != null) {
imageFiles.add(imageFile);
if (imageUrlsBuilder.length() > 0) {
imageUrlsBuilder.append(",");
}
imageUrlsBuilder.append(url.trim());
}
}
if (!imageFiles.isEmpty()) {
exportDTO.setImageFiles(imageFiles);
exportDTO.setImageUrls(imageUrlsBuilder.toString());
}
}
exportList.add(exportDTO);
} catch (Exception e) {
log.error("处理进仓单数据失败,进仓单号:{},批次信息:{}", warehouseIn.getInNo(), batch, e);
}
});
}
});
log.info("数据处理完成,共处理{}条数据", exportList.size());
return exportList;
}
}

View File

@ -33,7 +33,38 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<!-- <resultMap id="EmisWarehouseInDetailWithBatchListResult" type="EmisWarehouseIn" extends="BaseEmisWarehouseInResult" >-->
<!-- 结果映射 -->
<resultMap id="SelectEmisWarehouseInByInNosResult" type="EmisWarehouseIn">
<id property="id" column="id"/>
<result property="inNo" column="in_no"/>
<result property="billCode" column="bill_code"/>
<result property="orderSn" column="order_sn"/>
<result property="confirmStatus" column="confirm_status"/>
<result property="entryDate" column="entry_date"/>
<result property="totalParcelQty" column="total_parcel_qty"/>
<result property="totalWeight" column="total_weight"/>
<result property="totalVolume" column="total_volume"/>
<collection property="stockInBatchList" ofType="EmisWarehouseInBatch">
<id property="id" column="batch_id"/>
<result property="inNo" column="batch_in_no"/>
<result property="entryDate" column="batch_entry_date"/>
<result property="totalParcelQty" column="batch_total_parcel_qty"/>
<result property="totalWeight" column="batch_total_weight"/>
<result property="totalVolume" column="batch_total_volume"/>
<result property="prepareInExpress" column="prepare_in_express"/>
<result property="prepareInBillCode" column="prepare_in_bill_code"/>
<result property="prepareInSupplier" column="prepare_in_supplier"/>
<result property="picUrl" column="pic_url"/>
<collection property="cargoList" ofType="EmisWarehouseInDtl">
<id property="id" column="dtl_id"/>
<result property="goodsName" column="goods_name"/>
</collection>
</collection>
</resultMap>
<!-- <resultMap id="EmisWarehouseInDetailWithBatchListResult" type="EmisWarehouseIn" extends="BaseEmisWarehouseInResult" >-->
<!-- <association property="stockInBatchList"-->
<!-- column="in_no"-->
<!-- select="com.xdadan.erp.emis.mapper.EmisWarehouseInBatchMapper.selectInBatchListByInNo"-->
@ -260,6 +291,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where a.in_no = #{inNo} limit 1
</select>
<!-- 批量查询进仓单信息 -->
<select id="selectEmisWarehouseInByInNos" resultMap="SelectEmisWarehouseInByInNosResult">
SELECT
wi.id,
wi.in_no,
wi.bill_code,
wi.order_sn,
wi.confirm_status,
wi.entry_date,
wi.total_parcel_qty,
wi.total_weight,
wi.total_volume,
wib.id as batch_id,
wib.in_no as batch_in_no,
wib.entry_date as batch_entry_date,
wib.total_parcel_qty as batch_total_parcel_qty,
wib.total_weight as batch_total_weight,
wib.total_volume as batch_total_volume,
wib.prepare_in_express,
wib.prepare_in_bill_code,
wib.prepare_in_supplier,
wib.pic_url,
wid.id as dtl_id,
wid.goods_name
FROM emis_warehouse_in wi
LEFT JOIN emis_warehouse_in_batch wib ON wi.in_no = wib.in_no
LEFT JOIN emis_warehouse_in_dtl wid ON wib.serial_no = wid.in_serial_no
WHERE wi.in_no IN
<foreach collection="list" item="inNo" open="(" separator="," close=")">
#{inNo}
</foreach>
ORDER BY wi.id, wib.id, wid.id
</select>
<insert id="insertEmisWarehouseIn" parameterType="EmisWarehouseIn" useGeneratedKeys="true" keyProperty="id">
insert into emis_warehouse_in
<trim prefix="(" suffix=")" suffixOverrides=",">