diff --git a/base-ui/README-zh.md b/base-ui/README-zh.md index e69de29b..675df47a 100644 --- a/base-ui/README-zh.md +++ b/base-ui/README-zh.md @@ -0,0 +1,2 @@ +如果NodeJS高版本,需要加以下配置 + // "dev": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve", \ No newline at end of file diff --git a/base-ui/src/views/kucun/kcxxcx/index.vue b/base-ui/src/views/kucun/kcxxcx/index.vue index 1e3be654..a8ba6c11 100644 --- a/base-ui/src/views/kucun/kcxxcx/index.vue +++ b/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" > 选取文件 上传到服务器 -
上传 《库存信息查询.xlsx》文件
+
上传 《库存信息查询.xlsx》文件
+
+

文件上传结果

+ +
{{ uploadResultMesssage }}
+
+
+
+

库存汇总数据

+ +
{{ uploadResultMesssage }}
+
+
@@ -29,7 +43,8 @@ export default { return { updateAction: process.env.VUE_APP_BASE_API + '/kucun/uploadGdData', name: '库存数据导入', - fileList: [] + fileList: [], + uploadResultMesssage: '' } }, created() { diff --git a/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryOkMapper.java b/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryOkMapper.java index f3ffd07f..8ff7feb7 100644 --- a/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryOkMapper.java +++ b/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
* File: GdInventoryOkMapper.java
@@ -63,4 +66,20 @@ public interface GdInventoryOkMapper extends BaseMapper { @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> listOfWarehouse(); + + @Select("select warehouseCode, warehouseName, warehouseType, prodCode, prodBarCode, prodName, prodNum, prodValue from gd_inventory_ok") + List> listOfProd(); } diff --git a/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryOkService.java b/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryOkService.java index fc846e1d..43f6a7c5 100644 --- a/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryOkService.java +++ b/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
* File: GdInventoryOkService.java
@@ -44,17 +56,95 @@ import org.springframework.stereotype.Service; */ @Service public class GdInventoryOkService extends ServiceImpl { + @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> 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 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> 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 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(); } } diff --git a/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/resources/xlsx-tmpl/库存汇总表.xlsx b/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/resources/xlsx-tmpl/库存汇总表.xlsx new file mode 100644 index 00000000..b638d576 Binary files /dev/null and b/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/resources/xlsx-tmpl/库存汇总表.xlsx differ