优化相关报表的扩展字段,使其分为3个字段分别展示

This commit is contained in:
jishenghua 2025-03-27 22:18:39 +08:00
parent 3c267b1ef6
commit b39fd7840a
4 changed files with 36 additions and 57 deletions

View File

@ -332,7 +332,7 @@ public class DepotItemController {
@RequestParam("beginTime") String beginTime, @RequestParam("beginTime") String beginTime,
@RequestParam("endTime") String endTime, @RequestParam("endTime") String endTime,
@RequestParam("materialParam") String materialParam, @RequestParam("materialParam") String materialParam,
@RequestParam("mpList") String mpList, @RequestParam(value = "mpList", required = false) String mpList,
HttpServletRequest request)throws Exception { HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo(); BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
@ -347,7 +347,6 @@ public class DepotItemController {
List<Long> depotList = parseListByDepotIds(depotIds); List<Long> depotList = parseListByDepotIds(depotIds);
List<DepotItemVo4WithInfoEx> dataList = depotItemService.getInOutStock(StringUtil.toNull(materialParam), List<DepotItemVo4WithInfoEx> dataList = depotItemService.getInOutStock(StringUtil.toNull(materialParam),
categoryIdList, endTime,(currentPage-1)*pageSize, pageSize); categoryIdList, endTime,(currentPage-1)*pageSize, pageSize);
String[] mpArr = mpList.split(",");
int total = depotItemService.getInOutStockCount(StringUtil.toNull(materialParam), categoryIdList, endTime); int total = depotItemService.getInOutStockCount(StringUtil.toNull(materialParam), categoryIdList, endTime);
map.put("total", total); map.put("total", total);
//存放数据json数组 //存放数据json数组
@ -364,8 +363,9 @@ public class DepotItemController {
item.put("materialMfrs", diEx.getMMfrs()); item.put("materialMfrs", diEx.getMMfrs());
item.put("materialBrand", diEx.getBrand()); item.put("materialBrand", diEx.getBrand());
//扩展信息 //扩展信息
String materialOther = depotItemService.getOtherInfo(mpArr, diEx); item.put("otherField1", diEx.getMOtherField1());
item.put("materialOther", materialOther); item.put("otherField2", diEx.getMOtherField2());
item.put("otherField3", diEx.getMOtherField3());
item.put("unitId", diEx.getUnitId()); item.put("unitId", diEx.getUnitId());
item.put("unitName", null!=diEx.getUnitId() ? diEx.getMaterialUnit()+"[多单位]" : diEx.getMaterialUnit()); item.put("unitName", null!=diEx.getUnitId() ? diEx.getMaterialUnit()+"[多单位]" : diEx.getMaterialUnit());
BigDecimal prevSum = depotItemService.getStockByParamWithDepotList(depotList,mId,null,beginTime); BigDecimal prevSum = depotItemService.getStockByParamWithDepotList(depotList,mId,null,beginTime);
@ -509,7 +509,7 @@ public class DepotItemController {
@RequestParam(value = "categoryId", required = false) Long categoryId, @RequestParam(value = "categoryId", required = false) Long categoryId,
@RequestParam(value = "organizationId", required = false) Long organizationId, @RequestParam(value = "organizationId", required = false) Long organizationId,
@RequestParam("materialParam") String materialParam, @RequestParam("materialParam") String materialParam,
@RequestParam("mpList") String mpList, @RequestParam(value = "mpList",required = false) String mpList,
HttpServletRequest request)throws Exception { HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo(); BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
@ -529,7 +529,6 @@ public class DepotItemController {
Boolean forceFlag = systemConfigService.getForceApprovalFlag(); Boolean forceFlag = systemConfigService.getForceApprovalFlag();
List<DepotItemVo4WithInfoEx> dataList = depotItemService.getListWithBuyOrSale(StringUtil.toNull(materialParam), List<DepotItemVo4WithInfoEx> dataList = depotItemService.getListWithBuyOrSale(StringUtil.toNull(materialParam),
"buy", beginTime, endTime, creatorArray, organId, organArray, categoryList, depotList, forceFlag, (currentPage-1)*pageSize, pageSize); "buy", beginTime, endTime, creatorArray, organId, organArray, categoryList, depotList, forceFlag, (currentPage-1)*pageSize, pageSize);
String[] mpArr = mpList.split(",");
int total = depotItemService.getListWithBuyOrSaleCount(StringUtil.toNull(materialParam), int total = depotItemService.getListWithBuyOrSaleCount(StringUtil.toNull(materialParam),
"buy", beginTime, endTime, creatorArray, organId, organArray, categoryList, depotList, forceFlag); "buy", beginTime, endTime, creatorArray, organId, organArray, categoryList, depotList, forceFlag);
map.put("total", total); map.put("total", total);
@ -548,8 +547,9 @@ public class DepotItemController {
item.put("materialModel", diEx.getMModel()); item.put("materialModel", diEx.getMModel());
item.put("materialStandard", diEx.getMStandard()); item.put("materialStandard", diEx.getMStandard());
//扩展信息 //扩展信息
String materialOther = depotItemService.getOtherInfo(mpArr, diEx); item.put("otherField1", diEx.getMOtherField1());
item.put("materialOther", materialOther); item.put("otherField2", diEx.getMOtherField2());
item.put("otherField3", diEx.getMOtherField3());
item.put("materialColor", diEx.getMColor()); item.put("materialColor", diEx.getMColor());
item.put("materialBrand", diEx.getBrand()); item.put("materialBrand", diEx.getBrand());
item.put("materialMfrs", diEx.getMMfrs()); item.put("materialMfrs", diEx.getMMfrs());
@ -602,7 +602,7 @@ public class DepotItemController {
@RequestParam(value = "categoryId", required = false) Long categoryId, @RequestParam(value = "categoryId", required = false) Long categoryId,
@RequestParam(value = "organizationId", required = false) Long organizationId, @RequestParam(value = "organizationId", required = false) Long organizationId,
@RequestParam("materialParam") String materialParam, @RequestParam("materialParam") String materialParam,
@RequestParam("mpList") String mpList, @RequestParam(value = "mpList", required = false) String mpList,
HttpServletRequest request)throws Exception { HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo(); BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
@ -622,7 +622,6 @@ public class DepotItemController {
Boolean forceFlag = systemConfigService.getForceApprovalFlag(); Boolean forceFlag = systemConfigService.getForceApprovalFlag();
List<DepotItemVo4WithInfoEx> dataList = depotItemService.getListWithBuyOrSale(StringUtil.toNull(materialParam), List<DepotItemVo4WithInfoEx> dataList = depotItemService.getListWithBuyOrSale(StringUtil.toNull(materialParam),
"retail", beginTime, endTime, creatorArray, organId, organArray, categoryList, depotList, forceFlag, (currentPage-1)*pageSize, pageSize); "retail", beginTime, endTime, creatorArray, organId, organArray, categoryList, depotList, forceFlag, (currentPage-1)*pageSize, pageSize);
String[] mpArr = mpList.split(",");
int total = depotItemService.getListWithBuyOrSaleCount(StringUtil.toNull(materialParam), int total = depotItemService.getListWithBuyOrSaleCount(StringUtil.toNull(materialParam),
"retail", beginTime, endTime, creatorArray, organId, organArray, categoryList, depotList, forceFlag); "retail", beginTime, endTime, creatorArray, organId, organArray, categoryList, depotList, forceFlag);
map.put("total", total); map.put("total", total);
@ -641,8 +640,9 @@ public class DepotItemController {
item.put("materialModel", diEx.getMModel()); item.put("materialModel", diEx.getMModel());
item.put("materialStandard", diEx.getMStandard()); item.put("materialStandard", diEx.getMStandard());
//扩展信息 //扩展信息
String materialOther = depotItemService.getOtherInfo(mpArr, diEx); item.put("otherField1", diEx.getMOtherField1());
item.put("materialOther", materialOther); item.put("otherField2", diEx.getMOtherField2());
item.put("otherField3", diEx.getMOtherField3());
item.put("materialColor", diEx.getMColor()); item.put("materialColor", diEx.getMColor());
item.put("materialBrand", diEx.getBrand()); item.put("materialBrand", diEx.getBrand());
item.put("materialMfrs", diEx.getMMfrs()); item.put("materialMfrs", diEx.getMMfrs());
@ -696,7 +696,7 @@ public class DepotItemController {
@RequestParam(value = "categoryId", required = false) Long categoryId, @RequestParam(value = "categoryId", required = false) Long categoryId,
@RequestParam(value = "organizationId", required = false) Long organizationId, @RequestParam(value = "organizationId", required = false) Long organizationId,
@RequestParam("materialParam") String materialParam, @RequestParam("materialParam") String materialParam,
@RequestParam("mpList") String mpList, @RequestParam(value = "mpList", required = false) String mpList,
HttpServletRequest request)throws Exception { HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo(); BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
@ -716,7 +716,6 @@ public class DepotItemController {
Boolean forceFlag = systemConfigService.getForceApprovalFlag(); Boolean forceFlag = systemConfigService.getForceApprovalFlag();
List<DepotItemVo4WithInfoEx> dataList = depotItemService.getListWithBuyOrSale(StringUtil.toNull(materialParam), List<DepotItemVo4WithInfoEx> dataList = depotItemService.getListWithBuyOrSale(StringUtil.toNull(materialParam),
"sale", beginTime, endTime, creatorArray, organId, organArray, categoryList, depotList, forceFlag, (currentPage-1)*pageSize, pageSize); "sale", beginTime, endTime, creatorArray, organId, organArray, categoryList, depotList, forceFlag, (currentPage-1)*pageSize, pageSize);
String[] mpArr = mpList.split(",");
int total = depotItemService.getListWithBuyOrSaleCount(StringUtil.toNull(materialParam), int total = depotItemService.getListWithBuyOrSaleCount(StringUtil.toNull(materialParam),
"sale", beginTime, endTime, creatorArray, organId, organArray, categoryList, depotList, forceFlag); "sale", beginTime, endTime, creatorArray, organId, organArray, categoryList, depotList, forceFlag);
map.put("total", total); map.put("total", total);
@ -735,8 +734,9 @@ public class DepotItemController {
item.put("materialModel", diEx.getMModel()); item.put("materialModel", diEx.getMModel());
item.put("materialStandard", diEx.getMStandard()); item.put("materialStandard", diEx.getMStandard());
//扩展信息 //扩展信息
String materialOther = depotItemService.getOtherInfo(mpArr, diEx); item.put("otherField1", diEx.getMOtherField1());
item.put("materialOther", materialOther); item.put("otherField2", diEx.getMOtherField2());
item.put("otherField3", diEx.getMOtherField3());
item.put("materialColor", diEx.getMColor()); item.put("materialColor", diEx.getMColor());
item.put("materialBrand", diEx.getBrand()); item.put("materialBrand", diEx.getBrand());
item.put("materialMfrs", diEx.getMMfrs()); item.put("materialMfrs", diEx.getMMfrs());
@ -796,7 +796,7 @@ public class DepotItemController {
@RequestParam("materialParam") String materialParam, @RequestParam("materialParam") String materialParam,
@RequestParam(value = "depotId", required = false) Long depotId, @RequestParam(value = "depotId", required = false) Long depotId,
@RequestParam(value = "categoryId", required = false) Long categoryId, @RequestParam(value = "categoryId", required = false) Long categoryId,
@RequestParam("mpList") String mpList)throws Exception { @RequestParam(value = "mpList", required = false) String mpList)throws Exception {
BaseResponseInfo res = new BaseResponseInfo(); BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
try { try {
@ -824,7 +824,6 @@ public class DepotItemController {
diEx.setMOtherField1(disw.getMOtherField1()); diEx.setMOtherField1(disw.getMOtherField1());
diEx.setMOtherField2(disw.getMOtherField2()); diEx.setMOtherField2(disw.getMOtherField2());
diEx.setMOtherField3(disw.getMOtherField3()); diEx.setMOtherField3(disw.getMOtherField3());
disw.setMaterialOther(depotItemService.getOtherInfo(mpArr, diEx));
disw.setMaterialUnit(getUName(disw.getMaterialUnit(), disw.getUnitName())); disw.setMaterialUnit(getUName(disw.getMaterialUnit(), disw.getUnitName()));
if(null!=disw.getLowSafeStock() && disw.getCurrentNumber().compareTo(disw.getLowSafeStock())<0) { if(null!=disw.getLowSafeStock() && disw.getCurrentNumber().compareTo(disw.getLowSafeStock())<0) {
disw.setLowCritical(disw.getLowSafeStock().subtract(disw.getCurrentNumber())); disw.setLowCritical(disw.getLowSafeStock().subtract(disw.getCurrentNumber()));

View File

@ -1416,15 +1416,14 @@ public class DepotHeadService {
//导出明细数据 //导出明细数据
if(idList.size()>0) { if(idList.size()>0) {
List<DepotItemVo4WithInfoEx> dataList = depotItemMapperEx.getBillDetailListByIds(idList); List<DepotItemVo4WithInfoEx> dataList = depotItemMapperEx.getBillDetailListByIds(idList);
String[] mpArr = mpList.split(",");
String twoTip = ""; String twoTip = "";
String sheetTwoStr = ""; String sheetTwoStr = "";
if ("采购".equals(subType)) { if ("采购".equals(subType)) {
twoTip = "供应商单据明细"; twoTip = "供应商单据明细";
sheetTwoStr = "供应商,单据编号,单据日期,仓库名称,条码,名称,规格,型号,颜色,品牌,制造商,扩展信息,单位,序列号,批号,有效期,多属性,数量,单价,金额,税率(%),税额,价税合计,重量,备注"; sheetTwoStr = "供应商,单据编号,单据日期,仓库名称,条码,名称,规格,型号,颜色,品牌,制造商," + mpList + ",单位,序列号,批号,有效期,多属性,数量,单价,金额,税率(%),税额,价税合计,重量,备注";
} else if ("销售".equals(subType)) { } else if ("销售".equals(subType)) {
twoTip = "客户单据明细"; twoTip = "客户单据明细";
sheetTwoStr = "客户,单据编号,单据日期,仓库名称,条码,名称,规格,型号,颜色,品牌,制造商,扩展信息,单位,序列号,批号,有效期,多属性,数量,单价,金额,税率(%),税额,价税合计,重量,备注"; sheetTwoStr = "客户,单据编号,单据日期,仓库名称,条码,名称,规格,型号,颜色,品牌,制造商," + mpList + ",单位,序列号,批号,有效期,多属性,数量,单价,金额,税率(%),税额,价税合计,重量,备注";
} }
if (StringUtil.isNotEmpty(beginTime) && StringUtil.isNotEmpty(endTime)) { if (StringUtil.isNotEmpty(beginTime) && StringUtil.isNotEmpty(endTime)) {
twoTip = twoTip + "" + beginTime + "" + endTime + ""; twoTip = twoTip + "" + beginTime + "" + endTime + "";
@ -1446,21 +1445,23 @@ public class DepotHeadService {
objs[8] = diEx.getMColor(); objs[8] = diEx.getMColor();
objs[9] = diEx.getBrand(); objs[9] = diEx.getBrand();
objs[10] = diEx.getMMfrs(); objs[10] = diEx.getMMfrs();
objs[11] = depotItemService.getOtherInfo(mpArr, diEx); objs[11] = diEx.getMOtherField1();
objs[12] = diEx.getMaterialUnit(); objs[12] = diEx.getMOtherField2();
objs[13] = diEx.getSnList(); objs[13] = diEx.getMOtherField3();
objs[14] = diEx.getBatchNumber(); objs[14] = diEx.getMaterialUnit();
objs[15] = Tools.parseDateToStr(diEx.getExpirationDate()); objs[15] = diEx.getSnList();
objs[16] = diEx.getSku(); objs[16] = diEx.getBatchNumber();
objs[17] = parseDecimalToStr(diEx.getOperNumber(), 2); objs[17] = Tools.parseDateToStr(diEx.getExpirationDate());
objs[18] = parseDecimalToStr(roleService.parseBillPriceByLimit(diEx.getUnitPrice(), billCategory, priceLimit, request), 2); objs[18] = diEx.getSku();
objs[19] = parseDecimalToStr(roleService.parseBillPriceByLimit(diEx.getAllPrice(), billCategory, priceLimit, request), 2); objs[19] = parseDecimalToStr(diEx.getOperNumber(), 2);
objs[20] = parseDecimalToStr(roleService.parseBillPriceByLimit(diEx.getTaxRate(), billCategory, priceLimit, request), 2); objs[20] = parseDecimalToStr(roleService.parseBillPriceByLimit(diEx.getUnitPrice(), billCategory, priceLimit, request), 2);
objs[21] = parseDecimalToStr(roleService.parseBillPriceByLimit(diEx.getTaxMoney(), billCategory, priceLimit, request), 2); objs[21] = parseDecimalToStr(roleService.parseBillPriceByLimit(diEx.getAllPrice(), billCategory, priceLimit, request), 2);
objs[22] = parseDecimalToStr(roleService.parseBillPriceByLimit(diEx.getTaxLastMoney(), billCategory, priceLimit, request), 2); objs[22] = parseDecimalToStr(roleService.parseBillPriceByLimit(diEx.getTaxRate(), billCategory, priceLimit, request), 2);
objs[23] = parseDecimalToStr(roleService.parseBillPriceByLimit(diEx.getTaxMoney(), billCategory, priceLimit, request), 2);
objs[24] = parseDecimalToStr(roleService.parseBillPriceByLimit(diEx.getTaxLastMoney(), billCategory, priceLimit, request), 2);
BigDecimal allWeight = diEx.getBasicNumber() == null || diEx.getWeight() == null ? BigDecimal.ZERO : diEx.getBasicNumber().multiply(diEx.getWeight()); BigDecimal allWeight = diEx.getBasicNumber() == null || diEx.getWeight() == null ? BigDecimal.ZERO : diEx.getBasicNumber().multiply(diEx.getWeight());
objs[23] = parseDecimalToStr(allWeight, 2); objs[25] = parseDecimalToStr(allWeight, 2);
objs[24] = diEx.getRemark(); objs[26] = diEx.getRemark();
billDetail.add(objs); billDetail.add(objs);
} }
ExcelUtils.exportObjectsManySheet(wtwb, twoTip, sheetTwoArr, "单据明细", 1, billDetail); ExcelUtils.exportObjectsManySheet(wtwb, twoTip, sheetTwoArr, "单据明细", 1, billDetail);

View File

@ -1409,25 +1409,4 @@ public class DepotItemService {
BigDecimal stock = depotItemMapperEx.getCurrentStockByParam(depotId, mId); BigDecimal stock = depotItemMapperEx.getCurrentStockByParam(depotId, mId);
return stock!=null? stock: BigDecimal.ZERO; return stock!=null? stock: BigDecimal.ZERO;
} }
/**
* 获取扩展信息
*
* @return
*/
public String getOtherInfo(String[] mpArr, DepotItemVo4WithInfoEx diEx)throws Exception {
String materialOther = "";
for (int i = 0; i < mpArr.length; i++) {
if (mpArr[i].equals("自定义1")) {
materialOther = materialOther + ((diEx.getMOtherField1() == null || diEx.getMOtherField1().equals("")) ? "" : "(" + diEx.getMOtherField1() + ")");
}
if (mpArr[i].equals("自定义2")) {
materialOther = materialOther + ((diEx.getMOtherField2() == null || diEx.getMOtherField2().equals("")) ? "" : "(" + diEx.getMOtherField2() + ")");
}
if (mpArr[i].equals("自定义3")) {
materialOther = materialOther + ((diEx.getMOtherField3() == null || diEx.getMOtherField3().equals("")) ? "" : "(" + diEx.getMOtherField3() + ")");
}
}
return materialOther;
}
} }

View File

@ -480,7 +480,7 @@ public class MaterialService {
otherMaterialMap.putIfAbsent(me.getMaterialId(), me); otherMaterialMap.putIfAbsent(me.getMaterialId(), me);
} }
String nameStr = "名称*,规格,型号,颜色,品牌,类别,基础重量(kg),保质期(天),基本单位*,副单位,基本条码*,副条码,比例,多属性," + String nameStr = "名称*,规格,型号,颜色,品牌,类别,基础重量(kg),保质期(天),基本单位*,副单位,基本条码*,副条码,比例,多属性," +
"采购价,零售价,销售价,最低售价,状态*,序列号,批号,仓位货架,制造商,自定义1,自定义2,自定义3,备注"; "采购价,零售价,销售价,最低售价,状态*,序列号,批号,仓位货架,制造商,扩展1,扩展2,扩展3,备注";
List<String> nameList = StringUtil.strToStringList(nameStr); List<String> nameList = StringUtil.strToStringList(nameStr);
//仓库列表 //仓库列表
List<Depot> depotList = depotService.getAllList(); List<Depot> depotList = depotService.getAllList();