Browse Source

计算在途的修改

master
lzh 2 years ago
parent
commit
1cb05e7a20
  1. 155
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinstorage/GdInstorageCountService.java

155
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinstorage/GdInstorageCountService.java

@ -28,6 +28,7 @@ package com.yxt.supervise.portal.biz.gdinstorage;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.poi.excel.ExcelUtil;
import cn.hutool.poi.excel.ExcelWriter;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -110,37 +111,6 @@ public class GdInstorageCountService extends ServiceImpl<GdInstorageCountMapper,
FileUtil.copy(srcFile, file, true);
ExcelWriter writer = ExcelUtil.getWriter(file);
// 供应商到货汇总表
writer.setSheet(0);
writer.writeCellValue(0, 1, "编号:gysdhhzb" + dfmt1);
writer.writeCellValue(2, 1, "上报时间:" + dfmt +" 11:00");
List<Map<String, Object>> list1 = baseMapper.gysdhhzb();
if (list1 == null || list1.isEmpty())
return rb.setMsg("供应商到货汇总表 数据为空!");
int size = list1.size();
int countRow = size + 3;
double cbilltotalprice = 0, cprodvalue = 0, cwdhjz = 0, ccchjz = 0;
for (int y = 3; y < countRow; y++) {
Map<String, Object> map = list1.get(y - 3);
writer.writeCellValue(0, y, map.get("name"));
writer.writeCellValue(1, y, "");
writer.writeCellValue(2, y, map.get("billtotalprice"));
cbilltotalprice = cbilltotalprice + ExcelTool.toDouble(map.get("billtotalprice"));
writer.writeCellValue(3, y, map.get("prodvalue"));
cprodvalue = cprodvalue + ExcelTool.toDouble(map.get("prodvalue"));
writer.writeCellValue(4, y, map.get("wdhjz"));
cwdhjz = cwdhjz + ExcelTool.toDouble(map.get("wdhjz"));
writer.writeCellValue(5, y, map.get("cchjz"));
ccchjz = ccchjz + ExcelTool.toDouble(map.get("cchjz"));
writer.writeCellValue(6, y, map.get("arrivaldate"));
writer.writeCellValue(7, y, map.get("sfyq"));
}
writer.writeCellValue(0, countRow, "合计");
writer.writeCellValue(2, countRow, cbilltotalprice);
writer.writeCellValue(3, countRow, cprodvalue);
writer.writeCellValue(4, countRow, cwdhjz);
writer.writeCellValue(5, countRow, ccchjz);
// 商品到货明细表
writer.setSheet(1);
writer.writeCellValue(0, 1, "编号:spdhmxb" + dfmt1);
@ -172,7 +142,7 @@ public class GdInstorageCountService extends ServiceImpl<GdInstorageCountMapper,
writer.writeCellValue(9, y, map.get("ztprodValue2"));
cztprodValue2 = cztprodValue2 + ExcelTool.toDouble(map.get("ztprodValue2"));
}
writer.writeCellValue(0, countRow2, "合计");
writer.merge(countRow2, countRow2, 0, 2, "合计", false);
writer.writeCellValue(3, countRow2, Math.round(cnumber));
writer.writeCellValue(4, countRow2, cptotalPrice);
writer.writeCellValue(5, countRow2, Math.round(cprodNum));
@ -203,8 +173,11 @@ public class GdInstorageCountService extends ServiceImpl<GdInstorageCountMapper,
writer.writeCellValue(4, y, map.get("billDate"));
writer.writeCellValue(5, y, map.get("arrivalDate"));
}
writer.writeCellValue(1, countRow3, "合计金额");
// writer.writeCellValue(1, countRow3, "合计金额");
writer.merge(countRow3, countRow3, 0, 2, "合计金额", false);
writer.writeCellValue(3, countRow3, cbillTotalPrice);
writer.writeCellValue(4, countRow3, "");
writer.writeCellValue(5, countRow3, "");
// 烟草商品到货明细表
writer.setSheet(3);
@ -214,7 +187,7 @@ public class GdInstorageCountService extends ServiceImpl<GdInstorageCountMapper,
if (list4 != null && !list4.isEmpty()) {
int size4 = list4.size();
int countRow4 = size4 + 3;
double ccddspjz = 0, cccolq16 = 0,sjdhjz=0, ccztprodValue1 = 0, ccztprodValue2 = 0;
double ccddspjz = 0, cccolq16 = 0, sjdhjz = 0, ccztprodValue1 = 0, ccztprodValue2 = 0;
for (int y = 3; y < countRow4; y++) {
Map<String, Object> map = list4.get(y - 3);
writer.writeCellValue(0, y, "市烟草");
@ -230,7 +203,8 @@ public class GdInstorageCountService extends ServiceImpl<GdInstorageCountMapper,
writer.writeCellValue(6, y, map.get("ztprodValue2"));
ccztprodValue2 = ccztprodValue2 + ExcelTool.toDouble(map.get("ztprodValue2"));
}
writer.writeCellValue(1, countRow4, "合计");
// writer.writeCellValue(1, countRow4, "合计");
writer.merge(countRow4, countRow4, 0, 1, "合计", false);
writer.writeCellValue(2, countRow4, ccddspjz);
writer.writeCellValue(3, countRow4, cccolq16);
writer.writeCellValue(4, countRow4, sjdhjz);
@ -243,32 +217,91 @@ public class GdInstorageCountService extends ServiceImpl<GdInstorageCountMapper,
writer.writeCellValue(0, 1, "编号:ycddmxb" + dfmt1);
writer.writeCellValue(7, 1, "上报时间:" + dfmt);
List<Map<String, Object>> list5 = baseMapper.ycddmxb();
if (list5 != null && !list5.isEmpty()) {
int size5 = list5.size();
int countRow5 = size5 + 3;
xh = 0;
double cPrice = 0,cghje=0,cztje=0;
for (int y = 3; y < countRow5; y++) {
Map<String, Object> map = list5.get(y - 3);
xh++;
writer.writeCellValue(0, y, xh);
writer.writeCellValue(1, y, "市烟草");
writer.writeCellValue(2, y, map.get("code"));
writer.writeCellValue(3, y, map.get("ddje"));
writer.writeCellValue(4, y, map.get("ddje"));
cPrice = cPrice + ExcelTool.toDouble(map.get("ddje"));
writer.writeCellValue(5, y, map.get("purchasedate"));
writer.writeCellValue(6, y, map.get("arrivaldate"));
writer.writeCellValue(7, y, map.get("dddhjz"));
cghje = cghje + ExcelTool.toDouble(map.get("dddhjz"));
writer.writeCellValue(8, y, map.get("zthjz"));
cztje = cztje + ExcelTool.toDouble(map.get("zthjz"));
// if (list5 != null && !list5.isEmpty()) {
int size5 = list5.size();
int countRow5 = size5 + 3;
String maxDate = "";
xh = 0;
double cPrice = 0, cghje = 0, cztje = 0;
for (int y = 3; y < countRow5; y++) {
Map<String, Object> map = list5.get(y - 3);
xh++;
writer.writeCellValue(0, y, xh);
writer.writeCellValue(1, y, "市烟草");
writer.writeCellValue(2, y, map.get("code"));
writer.writeCellValue(3, y, map.get("ddje"));
writer.writeCellValue(4, y, map.get("ddje"));
cPrice = cPrice + ExcelTool.toDouble(map.get("ddje"));
writer.writeCellValue(5, y, map.get("purchasedate"));
writer.writeCellValue(6, y, map.get("arrivaldate"));
if (StrUtil.isBlank(maxDate)) {
maxDate = "" + map.get("arrivaldate");
} else {
String ccDate = "" + map.get("arrivaldate");
if (maxDate.compareTo(ccDate) < 0) {
maxDate = ccDate;
}
}
writer.writeCellValue(1, countRow5, "合计金额");
writer.writeCellValue(4, countRow5, cPrice);
writer.writeCellValue(7, countRow5, cghje);
writer.writeCellValue(8, countRow5, cztje);
writer.writeCellValue(7, y, map.get("dddhjz"));
cghje = cghje + ExcelTool.toDouble(map.get("dddhjz"));
writer.writeCellValue(8, y, map.get("zthjz"));
cztje = cztje + ExcelTool.toDouble(map.get("zthjz"));
}
// writer.writeCellValue(1, countRow5, "合计金额");
writer.merge(countRow5, countRow5, 0, 2, "合计金额", false);
writer.writeCellValue(3, countRow5, "");
writer.writeCellValue(4, countRow5, cPrice);
writer.writeCellValue(5, countRow5, "");
writer.writeCellValue(6, countRow5, "");
writer.writeCellValue(7, countRow5, cghje);
writer.writeCellValue(8, countRow5, cztje);
// }
// 供应商到货汇总表
writer.setSheet(0);
writer.writeCellValue(0, 1, "编号:gysdhhzb" + dfmt1);
writer.writeCellValue(2, 1, "上报时间:" + dfmt + " 11:00");
List<Map<String, Object>> list1 = baseMapper.gysdhhzb();
if (list1 == null || list1.isEmpty())
return rb.setMsg("供应商到货汇总表 数据为空!");
int size = list1.size();
int countRow = size + 3;
double cbilltotalprice = 0, cprodvalue = 0, cwdhjz = 0, ccchjz = 0;
for (int y = 3; y < countRow; y++) {
Map<String, Object> map = list1.get(y - 3);
writer.writeCellValue(0, y, map.get("name"));
writer.writeCellValue(1, y, "");
writer.writeCellValue(2, y, map.get("billtotalprice"));
cbilltotalprice = cbilltotalprice + ExcelTool.toDouble(map.get("billtotalprice"));
writer.writeCellValue(3, y, map.get("prodvalue"));
cprodvalue = cprodvalue + ExcelTool.toDouble(map.get("prodvalue"));
writer.writeCellValue(4, y, map.get("wdhjz"));
cwdhjz = cwdhjz + ExcelTool.toDouble(map.get("wdhjz"));
writer.writeCellValue(5, y, map.get("cchjz"));
ccchjz = ccchjz + ExcelTool.toDouble(map.get("cchjz"));
writer.writeCellValue(6, y, map.get("arrivaldate"));
writer.writeCellValue(7, y, map.get("sfyq"));
}
writer.writeCellValue(0, countRow, "市烟草");
writer.writeCellValue(1, countRow, "");
writer.writeCellValue(2, countRow, cPrice);
cbilltotalprice = cbilltotalprice + cPrice;
writer.writeCellValue(3, countRow, cghje);
cprodvalue = cprodvalue + cghje;
writer.writeCellValue(4, countRow, cwdhjz);
cwdhjz = cwdhjz + cztje;
writer.writeCellValue(5, countRow, "0.0");
writer.writeCellValue(6, countRow, maxDate);
writer.writeCellValue(7, countRow, "否");
writer.writeCellValue(0, countRow + 1, "合计");
writer.writeCellValue(1, countRow + 1, "");
writer.writeCellValue(2, countRow + 1, cbilltotalprice);
writer.writeCellValue(3, countRow + 1, cprodvalue);
writer.writeCellValue(4, countRow + 1, cwdhjz);
writer.writeCellValue(5, countRow + 1, ccchjz);
writer.writeCellValue(6, countRow + 1, "");
writer.writeCellValue(7, countRow + 1, "");
writer.flush();
writer.close();
@ -288,9 +321,9 @@ public class GdInstorageCountService extends ServiceImpl<GdInstorageCountMapper,
public double amountZaituYc() {
double wdhjz = 0;
List<Map<String, Object>> list = baseMapper.ycspdhmxb();
List<Map<String, Object>> list = baseMapper.ycddmxb();
for (Map<String, Object> map : list) {
wdhjz = wdhjz + ExcelTool.toDouble(map.get("ztprodValue1"));
wdhjz = wdhjz + ExcelTool.toDouble(map.get("zthjz"));
}
return wdhjz;
}

Loading…
Cancel
Save