Browse Source

合并库存汇总表

master
lzh 2 years ago
parent
commit
9159ff123c
  1. 28
      base-ui/src/views/kucun/kcxxcx/index.vue
  2. 4
      base-ui/vue.config.js
  3. 69
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryOkService.java
  4. 21
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryYcService.java
  5. 4
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/extexcel/ExcelTool.java
  6. BIN
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/resources/xlsx-tmpl/库存汇总表-20230109.xlsx
  7. BIN
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/resources/xlsx-tmpl/库存汇总表.xlsx

28
base-ui/src/views/kucun/kcxxcx/index.vue

@ -36,8 +36,8 @@
<el-card class="box-card">
<div>{{ hzResultMesssage }}</div>
<div>
<el-button :disabled="!hzFilePath" size="small" type="primary" @click="doDownloadHz">下载汇总文件</el-button>
<el-button :disabled="!ychzFilePath" size="small" type="primary" @click="doDownloadHzYc">下载烟草汇总文件</el-button>
<el-button :disabled="!hzFilePath" size="small" type="primary" @click="doDownloadHz">下载库存汇总文件</el-button>
<!-- <el-button :disabled="!ychzFilePath" size="small" type="primary" @click="doDownloadHzYc">下载烟草汇总文件</el-button> -->
</div>
</el-card>
</div>
@ -46,7 +46,7 @@
</template>
<script>
import { kchz, kchzyc, resetAllCache } from '@/api/kucun/kucun'
import { kchz, resetAllCache } from '@/api/kucun/kucun'
export default {
name: 'KucunKcxxcxIndex',
// components: { },
@ -126,17 +126,17 @@ export default {
if (this.fullscreenloading) this.fullscreenloading.close()
this.fullscreenloading = null
})
kchzyc()
.then(res => {
if (this.fullscreenloading) this.fullscreenloading.close()
this.fullscreenloading = null
console.log('444', res)
_this.ychzFilePath = res.data
})
.catch(e => {
if (this.fullscreenloading) this.fullscreenloading.close()
this.fullscreenloading = null
})
// kchzyc()
// .then(res => {
// if (this.fullscreenloading) this.fullscreenloading.close()
// this.fullscreenloading = null
// console.log('444', res)
// _this.ychzFilePath = res.data
// })
// .catch(e => {
// if (this.fullscreenloading) this.fullscreenloading.close()
// this.fullscreenloading = null
// })
},
doDownloadHz() {
window.open(this.hzFilePath, '_blank')

4
base-ui/vue.config.js

@ -41,9 +41,9 @@ module.exports = {
proxy: {
'/api': { // 匹配所有以 '/api'开头的请求路径
// target: 'http://26077a35f5.wicp.vip',
// target: process.env.VUE_APP_URL, // 代理目标的基础路径
target: process.env.VUE_APP_URL, // 代理目标的基础路径
// target: "http://192.168.1.102:4523/mock/613533", // 代理目标的基础路径
target: "http://127.0.0.1:4523/m1/1913288-0-default",
// target: "http://127.0.0.1:4523/m1/1913288-0-default",
changeOrigin: true, // 支持跨域
pathRewrite: { // 重写路径: 去掉路径中开头的'/api'
'^/api': ''

69
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryOkService.java

@ -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();

21
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryYcService.java

@ -60,10 +60,31 @@ public class GdInventoryYcService extends ServiceImpl<GdInventoryYcMapper, GdInv
private String urlPrefix;
@Value("${image.xlsxtmpl:static/upload/}")
private String xlsxtmplPath;
public void clearData() {
baseMapper.clearData();
}
public int typeYc() {
return baseMapper.countType2();
}
public int prodYc() {
return baseMapper.countProd2();
}
public double valYc() {
return baseMapper.countVal2();
}
public List<Map<String, Object>> listOfWarehouse() {
return baseMapper.listOfWarehouse();
}
public List<Map<String, Object>> listOfProd() {
return baseMapper.listOfProd();
}
public ResultBean kchzyc() {
ResultBean rb = ResultBean.fireFail();

4
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/extexcel/ExcelTool.java

@ -66,7 +66,7 @@ public class ExcelTool {
public static int toInt(Object obj) {
if (obj == null)
return 0;
String s = ""+ obj;
String s = "" + obj;
if (StringUtils.isBlank(s))
return 0;
int rs = 0;
@ -81,6 +81,8 @@ public class ExcelTool {
public static double toDouble(Object obj) {
if (obj == null)
return 0;
if (obj instanceof Double)
return (Double) obj;
String s = obj.toString();
if (StringUtils.isBlank(s))
return 0;

BIN
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/resources/xlsx-tmpl/库存汇总表-20230109.xlsx

Binary file not shown.

BIN
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/resources/xlsx-tmpl/库存汇总表.xlsx

Binary file not shown.
Loading…
Cancel
Save