Browse Source

库存汇总表

master
lzh 3 years ago
parent
commit
ecc4221aac
  1. 2
      base-ui/README-zh.md
  2. 19
      base-ui/src/views/kucun/kcxxcx/index.vue
  3. 19
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryOkMapper.java
  4. 94
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryOkService.java
  5. BIN
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/resources/xlsx-tmpl/库存汇总表.xlsx

2
base-ui/README-zh.md

@ -0,0 +1,2 @@
如果NodeJS高版本,需要加以下配置
// "dev": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",

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

@ -11,12 +11,26 @@
:on-remove="handleRemove"
:file-list="fileList"
:auto-upload="false"
:multiple="false"
:limit="1"
>
<el-button slot="trigger" size="small" type="primary">选取文件</el-button>
<el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">上传到服务器</el-button>
<div slot="tip" class="el-upload__tip">上传 库存信息查询.xlsx文件 </div>
<div slot="tip" class="el-upload__tip">上传 库存信息查询.xlsx文件</div>
</el-upload>
</div>
<div>
<h3>文件上传结果</h3>
<el-card class="box-card">
<div>{{ uploadResultMesssage }}</div>
</el-card>
</div>
<div>
<h3>库存汇总数据</h3>
<el-card class="box-card">
<div>{{ uploadResultMesssage }}</div>
</el-card>
</div>
</el-card>
</div>
</template>
@ -29,7 +43,8 @@ export default {
return {
updateAction: process.env.VUE_APP_BASE_API + '/kucun/uploadGdData',
name: '库存数据导入',
fileList: []
fileList: [],
uploadResultMesssage: ''
}
},
created() {

19
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryOkMapper.java

@ -30,6 +30,9 @@ import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
/**
* Project: yxt_supervise <br/>
* File: GdInventoryOkMapper.java <br/>
@ -63,4 +66,20 @@ public interface GdInventoryOkMapper extends BaseMapper<GdInventoryOk> {
@Select("select count(1) from gd_inventory_ok where warehouseType='2'")
int countProd2();
@Select("select sum(prodValue) from gd_inventory_ok where warehouseCode='112'")
double countVal112();
@Select("select sum(prodValue) from gd_inventory_ok where warehouseType='1' and warehouseCode<>'112'")
double countVal1Not112();
@Select("select sum(prodValue) from gd_inventory_ok where warehouseType='2'")
double countVal2();
@Select("select warehouseName,warehouseType,count(1) as coun,sum(prodValue) as su from gd_inventory_ok gio group by warehouseCode")
List<Map<String, Object>> listOfWarehouse();
@Select("select warehouseCode, warehouseName, warehouseType, prodCode, prodBarCode, prodName, prodNum, prodValue from gd_inventory_ok")
List<Map<String, Object>> listOfProd();
}

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

@ -25,10 +25,22 @@
*********************************************************/
package com.yxt.supervise.portal.biz.gdinventory;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.io.resource.ResourceUtil;
import cn.hutool.poi.excel.ExcelUtil;
import cn.hutool.poi.excel.ExcelWriter;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yxt.common.core.result.ResultBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.io.File;
import java.net.URL;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* Project: yxt_supervise <br/>
* File: GdInventoryOkService.java <br/>
@ -44,17 +56,95 @@ import org.springframework.stereotype.Service;
*/
@Service
public class GdInventoryOkService extends ServiceImpl<GdInventoryOkMapper, GdInventoryOk> {
@Value("${image.upload.path:static/upload/}")
private String uploadPath;
public void clearData() {
baseMapper.clearData();
}
/**
* 库存汇总
*
* @return
*/
public ResultBean kchz() {
int type1 = baseMapper.countWarehouseType1Not112();
int type2 = baseMapper.countWarehouseType2();
int prod112 = baseMapper.countProd112();
int prod1Not112 = baseMapper.countProd1Not112();
int prod2 = baseMapper.countProd2();
int prod1Not112 = baseMapper.countProd1Not112();
int prod2 = baseMapper.countProd2();
double val112 = baseMapper.countVal112();
double val1Not112 = baseMapper.countVal1Not112();
double val2 = baseMapper.countVal2();
Date curDate = new Date();
String timestr = DateUtil.format(curDate, "yyyyMMddHHmmssSSS");
String dfmt = DateUtil.format(curDate, "yyyy-MM-dd");
String datefmt1 = DateUtil.format(curDate, "yyyy-MM-dd HH:mm");
String datefmt2 = DateUtil.format(curDate, "yyyy/MM/dd HH:mm");
URL resource = ResourceUtil.getResource("xlsx-tmpl/库存汇总表.xlsx");
String toFileName = uploadPath + "kchzb/库存汇总表" + dfmt + ".xlsx";
File file = FileUtil.file(toFileName);
FileUtil.copy(FileUtil.file(resource), file, true);
ExcelWriter writer = ExcelUtil.getWriter(file);
writer.setSheet(0);
writer.writeCellValue(0, 1, "编号:" + timestr);
writer.writeCellValue(3, 1, datefmt1);
writer.writeCellValue(1, 3, 1);
writer.writeCellValue(1, 4, type1);
writer.writeCellValue(1, 5, type2);
writer.writeCellValue(2, 3, prod112);
writer.writeCellValue(2, 4, prod1Not112);
writer.writeCellValue(2, 5, prod2);
writer.writeCellValue(3, 3, val112);
writer.writeCellValue(3, 4, val1Not112);
writer.writeCellValue(3, 5, val2);
// writer.flush();
// writer.close();
List<Map<String, Object>> list = baseMapper.listOfWarehouse();
// writer = ExcelUtil.getWriter(file);
writer.setSheet(1);
writer.writeCellValue(0, 1, "编号:" + timestr);
writer.writeCellValue(3, 1, datefmt1);
int size = list.size();
int countRow = size + 3;
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"));
}
writer.writeCellValue(0, countRow, "合计");
// writer.flush();
// writer.close();
List<Map<String, Object>> listp = baseMapper.listOfProd();
// writer = ExcelUtil.getWriter(file);
writer.setSheet(2);
writer.writeCellValue(0, 1, "编号:" + timestr);
writer.writeCellValue(6, 1, datefmt2);
int sizep = listp.size();
int countRowp = sizep + 3;
for (int y = 3; y < countRowp; y++) {
Map<String, Object> map = listp.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"));
}
writer.flush();
writer.close();
return ResultBean.fireSuccess();
}
}

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

Binary file not shown.
Loading…
Cancel
Save