|
|
@ -32,6 +32,8 @@ import cn.hutool.poi.excel.ExcelWriter; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
import com.yxt.common.core.result.ResultBean; |
|
|
|
import com.yxt.supervise.portal.extexcel.ExcelTool; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
@ -63,6 +65,9 @@ public class GdInventoryOkService extends ServiceImpl<GdInventoryOkMapper, GdInv |
|
|
|
@Value("${image.xlsxtmpl:static/upload/}") |
|
|
|
private String xlsxtmplPath; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private GdInventoryYcService gdInventoryYcService; |
|
|
|
|
|
|
|
public void clearData() { |
|
|
|
baseMapper.clearData(); |
|
|
|
} |
|
|
@ -88,6 +93,12 @@ public class GdInventoryOkService extends ServiceImpl<GdInventoryOkMapper, GdInv |
|
|
|
// double val1Not112 = baseMapper.countVal1Not112();
|
|
|
|
double val2 = baseMapper.countVal2(); |
|
|
|
|
|
|
|
int typeYc = gdInventoryYcService.typeYc(); |
|
|
|
int prodYc = gdInventoryYcService.prodYc(); |
|
|
|
double valYc = gdInventoryYcService.valYc(); |
|
|
|
|
|
|
|
double hj0 = val112 + val101 + val199 + val2 + valYc; |
|
|
|
|
|
|
|
Date curDate = new Date(); |
|
|
|
String timestr = DateUtil.format(curDate, "yyyyMMddHHmmssSSS"); |
|
|
|
String dfmt = DateUtil.format(curDate, "yyyy-MM-dd"); |
|
|
@ -104,6 +115,8 @@ public class GdInventoryOkService extends ServiceImpl<GdInventoryOkMapper, GdInv |
|
|
|
// FileUtil.copy(FileUtil.file(resource), file, true);
|
|
|
|
FileUtil.copy(srcFile, file, true); |
|
|
|
ExcelWriter writer = ExcelUtil.getWriter(file); |
|
|
|
|
|
|
|
// 库存汇总日报表
|
|
|
|
writer.setSheet(0); |
|
|
|
writer.writeCellValue(0, 1, "编号:" + timestr); |
|
|
|
writer.writeCellValue(3, 1, datefmt1); |
|
|
@ -124,17 +137,22 @@ public class GdInventoryOkService extends ServiceImpl<GdInventoryOkMapper, GdInv |
|
|
|
} |
|
|
|
// writer.writeCellValue(1, 4, type1);
|
|
|
|
writer.writeCellValue(1, 6, type2); |
|
|
|
writer.writeCellValue(1, 7, typeYc); |
|
|
|
writer.writeCellValue(2, 3, prod112); |
|
|
|
writer.writeCellValue(2, 4, prod101); |
|
|
|
writer.writeCellValue(2, 5, prod199); |
|
|
|
writer.writeCellValue(2, 6, prod2); |
|
|
|
writer.writeCellValue(2, 7, prodYc); |
|
|
|
writer.writeCellValue(3, 3, val112); |
|
|
|
writer.writeCellValue(3, 4, val101); |
|
|
|
writer.writeCellValue(3, 5, val199); |
|
|
|
writer.writeCellValue(3, 6, val2); |
|
|
|
writer.writeCellValue(3, 7, valYc); |
|
|
|
writer.writeCellValue(3, 8, hj0); |
|
|
|
// writer.flush();
|
|
|
|
// writer.close();
|
|
|
|
|
|
|
|
// 仓库库存明细表
|
|
|
|
List<Map<String, Object>> list = baseMapper.listOfWarehouse(); |
|
|
|
// writer = ExcelUtil.getWriter(file);
|
|
|
|
writer.setSheet(1); |
|
|
@ -142,17 +160,21 @@ public class GdInventoryOkService extends ServiceImpl<GdInventoryOkMapper, GdInv |
|
|
|
writer.writeCellValue(3, 1, datefmt1); |
|
|
|
int size = list.size(); |
|
|
|
int countRow = size + 3; |
|
|
|
double hz1 = 0; |
|
|
|
for (int y = 3; y < countRow; y++) { |
|
|
|
Map<String, Object> map = list.get(y - 3); |
|
|
|
writer.writeCellValue(0, y, map.get("warehouseName")); |
|
|
|
writer.writeCellValue(1, y, map.get("warehouseType")); |
|
|
|
writer.writeCellValue(2, y, map.get("coun")); |
|
|
|
writer.writeCellValue(3, y, map.get("su")); |
|
|
|
hz1 = hz1 + ExcelTool.toDouble(map.get("su")); |
|
|
|
} |
|
|
|
writer.writeCellValue(0, countRow, "合计"); |
|
|
|
writer.writeCellValue(3, countRow, hz1); |
|
|
|
// writer.flush();
|
|
|
|
// writer.close();
|
|
|
|
|
|
|
|
// 仓库商品明细表
|
|
|
|
List<Map<String, Object>> listp = baseMapper.listOfProd(); |
|
|
|
// writer = ExcelUtil.getWriter(file);
|
|
|
|
writer.setSheet(2); |
|
|
@ -160,6 +182,7 @@ public class GdInventoryOkService extends ServiceImpl<GdInventoryOkMapper, GdInv |
|
|
|
writer.writeCellValue(6, 1, datefmt2); |
|
|
|
int sizep = listp.size(); |
|
|
|
int countRowp = sizep + 3; |
|
|
|
double hz2 = 0; |
|
|
|
for (int y = 3; y < countRowp; y++) { |
|
|
|
Map<String, Object> map = listp.get(y - 3); |
|
|
|
writer.writeCellValue(0, y, map.get("warehouseCode")); |
|
|
@ -170,7 +193,53 @@ public class GdInventoryOkService extends ServiceImpl<GdInventoryOkMapper, GdInv |
|
|
|
writer.writeCellValue(5, y, map.get("prodName")); |
|
|
|
writer.writeCellValue(6, y, map.get("prodNum")); |
|
|
|
writer.writeCellValue(7, y, map.get("prodValue")); |
|
|
|
hz2 = hz2 + ExcelTool.toDouble(map.get("prodValue")); |
|
|
|
} |
|
|
|
writer.writeCellValue(0, countRowp, "合计"); |
|
|
|
writer.writeCellValue(7, countRowp, hz2); |
|
|
|
|
|
|
|
// 烟草仓库库存明细表
|
|
|
|
List<Map<String, Object>> listyc = gdInventoryYcService.listOfWarehouse(); |
|
|
|
writer.setSheet(3); |
|
|
|
writer.writeCellValue(0, 1, "编号:" + timestr); |
|
|
|
writer.writeCellValue(3, 1, datefmt1); |
|
|
|
int sizeyc = listyc.size(); |
|
|
|
int countRowyc = sizeyc + 3; |
|
|
|
double hj3 = 0; |
|
|
|
for (int y = 3; y < countRowyc; y++) { |
|
|
|
Map<String, Object> map = listyc.get(y - 3); |
|
|
|
writer.writeCellValue(0, y, map.get("warehouseName")); |
|
|
|
writer.writeCellValue(1, y, map.get("warehouseType")); |
|
|
|
writer.writeCellValue(2, y, map.get("coun")); |
|
|
|
writer.writeCellValue(3, y, map.get("su")); |
|
|
|
hj3 = hj3 + ExcelTool.toDouble(map.get("su")); |
|
|
|
} |
|
|
|
writer.writeCellValue(0, countRowyc, "合计"); |
|
|
|
writer.writeCellValue(3, countRowyc, hj3); |
|
|
|
|
|
|
|
// 烟草仓库商品明细表
|
|
|
|
List<Map<String, Object>> listpyc = gdInventoryYcService.listOfProd(); |
|
|
|
writer.setSheet(4); |
|
|
|
writer.writeCellValue(0, 1, "编号:" + timestr); |
|
|
|
writer.writeCellValue(6, 1, datefmt2); |
|
|
|
int sizepyc = listpyc.size(); |
|
|
|
int countRowpyc = sizepyc + 3; |
|
|
|
double hz4 = 0; |
|
|
|
for (int y = 3; y < countRowpyc; y++) { |
|
|
|
Map<String, Object> map = listpyc.get(y - 3); |
|
|
|
writer.writeCellValue(0, y, map.get("warehouseCode")); |
|
|
|
writer.writeCellValue(1, y, map.get("warehouseName")); |
|
|
|
writer.writeCellValue(2, y, map.get("warehouseType")); |
|
|
|
writer.writeCellValue(3, y, map.get("prodCode")); |
|
|
|
writer.writeCellValue(4, y, map.get("prodBarCode")); |
|
|
|
writer.writeCellValue(5, y, map.get("prodName")); |
|
|
|
writer.writeCellValue(6, y, map.get("prodNum")); |
|
|
|
writer.writeCellValue(7, y, map.get("prodValue")); |
|
|
|
hz4 = hz4 + ExcelTool.toDouble(map.get("prodValue")); |
|
|
|
} |
|
|
|
writer.writeCellValue(0, countRowpyc, "合计"); |
|
|
|
writer.writeCellValue(7, countRowpyc, hz4); |
|
|
|
|
|
|
|
writer.flush(); |
|
|
|
writer.close(); |
|
|
|
|
|
|
|