库存导出时附加物料信息

This commit is contained in:
陆一凡 2025-03-21 13:46:18 +08:00
parent 2f9a65ed5c
commit 9b3f8e27db
4 changed files with 49 additions and 52 deletions

View File

@ -8,12 +8,14 @@ import com.wms.model.entity.table.*;
import com.wms.service.*;
import com.wms.utils.HttpUtils;
import com.wms.utils.StringUtils;
import com.wms.utils.excel.ExcelUtils;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
@ -84,6 +86,17 @@ public class ExcelController extends BaseController {
for (Stock stock : stocks) {
StockExcel stockExcel = new StockExcel();
BeanUtils.copyProperties(stock,stockExcel);
// 查询零件信息
Goods goods = goodsService.selGoodsByGoodsId(stock.getGoodsId());
// 设置零件信息
if (goods != null){
if (!StringUtils.isEmpty(goods.getGoodsName()) ) {
stockExcel.setGoodsUnit(goods.getGoodsUnit());
}
if (!StringUtils.isEmpty(goods.getSingleWeight())){
stockExcel.setSingleWeight(Double.valueOf(goods.getSingleWeight()));
}
}
stockExcelList.add(stockExcel);
}
ExcelUtils.export(response, "库存报表", stockExcelList,StockExcel.class);

View File

@ -47,51 +47,34 @@ public class StockExcel {
@ExcelExport("物料号")
private String goodsId;
// /**
// * 物料名称
// */
// @ExcelExport("零件名称")
// private String goodsName;
/**
* 规格型号
*/
@ExcelExport("规格型号")
private String goodsUnit;
// /**
// * 批次号
// */
// @ExcelExport("批次号")
// private String batchNo;
/**
* 可用数量
*/
@ExcelExport("可用数量")
@ExcelExport("库存数量")
private Integer availableNum;
// /**
// * 剩余数量
// */
// @ExcelExport("剩余数量")
// private Integer remainNum;
// /**
// * 实际数量
// * 生产日期
// */
// @ExcelExport("实际数量")
// private Integer realNum;
/**
* 生产日期
*/
@ExcelExport("生产日期")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date productionDate;
/**
* 过期日期
*/
@ExcelExport("过期日期")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date expirationDate;
// @ExcelExport("生产日期")
// @DateTimeFormat(pattern = "yyyy-MM-dd")
// @JsonFormat(pattern = "yyyy-MM-dd")
// private Date productionDate;
// /**
// * 过期日期
// */
// @ExcelExport("过期日期")
// @DateTimeFormat(pattern = "yyyy-MM-dd")
// @JsonFormat(pattern = "yyyy-MM-dd")
// private Date expirationDate;
/**
* 库存状态
* 正常出库中锁定
@ -106,23 +89,17 @@ public class StockExcel {
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/**
* 最后更新时间
*/
@ExcelExport("最后更新时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date lastUpdateTime;
/**
* 最后更新用户
*/
@ExcelExport("上架人")
private String lastUpdateUser;
/**
* 备注
*/
@ExcelExport("备注")
private String remark;
// /**
// * 最后更新用户
// */
// @ExcelExport("上架人")
// private String lastUpdateUser;
// /**
// * 备注
// */
// @ExcelExport("备注")
// private String remark;
@ExcelExport("单重")

View File

@ -43,4 +43,6 @@ public interface GoodsService {
void clearGoodsInfo();
Goods selGoodsByGoodsId(String goodsId);
}

View File

@ -47,4 +47,9 @@ public class GoodsServiceImplements implements GoodsService {
public void clearGoodsInfo() {
this.goodsMapper.clearGoodsInfo();
}
@Override
public Goods selGoodsByGoodsId(String goodsId) {
return this.goodsMapper.selGoodsByGoodsName(goodsId);
}
}