src/main/java/com/zy/asrs/controller/MapController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/zy/asrs/controller/OrderCheckController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/zy/asrs/entity/LocCheck.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/webapp/static/js/orderCheck/orderCheck.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/webapp/views/orderCheck/orderCheck.html | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/zy/asrs/controller/MapController.java
@@ -35,10 +35,11 @@ @ManagerAuth public String getMapData(@PathVariable("lev") Integer lev) { try { // String mapFilename = "map.json"; String mapFilename = "map.json"; // String fileName ="file:" + new ClassPathResource(mapFilename).getPath(); // String fileName = this.getClass().getClassLoader().getResource(mapFilename).getPath();//获取文件路径 File file = new File("D:\\workspace\\zy-asrs\\src\\main\\resources\\map.json"); String fileName = this.getClass().getClassLoader().getResource(mapFilename).getPath();//获取文件路径 // File file = new File("D:\\workspace\\zy-asrs\\src\\main\\resources\\map.json"); File file = new File(fileName); StringBuffer stringBuffer = new StringBuffer(); if (file.isFile() && file.exists()) { InputStreamReader isr = new InputStreamReader(new FileInputStream(file), "GBK"); src/main/java/com/zy/asrs/controller/OrderCheckController.java
@@ -1,5 +1,8 @@ package com.zy.asrs.controller; import com.alibaba.excel.EasyExcel; import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.mapper.Wrapper; @@ -25,9 +28,11 @@ import org.springframework.web.bind.annotation.*; import javax.imageio.ImageIO; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import java.awt.image.BufferedImage; import java.io.IOException; import java.net.URLEncoder; import java.util.*; @RestController @@ -509,5 +514,37 @@ } @RequestMapping(value = "/orderCheck/printExport/auth") // @ManagerAuth(memo = "盘点单导出") public void export(HttpServletResponse response,@RequestParam String orderNo) throws IOException { //从数据库查询数据 EntityWrapper<LocCheck> locCheckEntityWrapper = new EntityWrapper<>(); locCheckEntityWrapper.eq("order_no",orderNo); List<LocCheck> list = locCheckService.selectList(locCheckEntityWrapper); for (LocCheck locCheck:list){ locCheck.setRealAnfme(null); } response.setContentType("application/vnd.ms-excel"); response.setCharacterEncoding("utf-8"); String fileName = URLEncoder.encode("盘点单", "UTF-8"); response.setHeader("Content-disposition", "attachment;filename=" + fileName+ orderNo + ".xlsx"); Set<String> includeColumnFiledNames = new HashSet<String>(); includeColumnFiledNames.add("orderNo"); includeColumnFiledNames.add("matnr"); includeColumnFiledNames.add("maktx"); includeColumnFiledNames.add("locNo"); includeColumnFiledNames.add("anfme"); includeColumnFiledNames.add("owner"); includeColumnFiledNames.add("payment"); includeColumnFiledNames.add("createTime"); includeColumnFiledNames.add("realAnfme"); EasyExcel.write(response.getOutputStream(), LocCheck.class) .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) .includeColumnFiledNames(includeColumnFiledNames) .sheet("表1") .doWrite(list); } } src/main/java/com/zy/asrs/entity/LocCheck.java
@@ -1,5 +1,6 @@ package com.zy.asrs.entity; import com.alibaba.excel.annotation.ExcelProperty; import com.core.common.Cools;import com.baomidou.mybatisplus.annotations.TableId; import com.baomidou.mybatisplus.enums.IdType; import com.baomidou.mybatisplus.annotations.TableField; @@ -28,12 +29,14 @@ */ @ApiModelProperty(value= "唯一ID") @TableId(value = "id", type = IdType.AUTO) @ExcelProperty("id") private Long id; /** * 状态 1: 盘点中 2: 盘点结束 */ @ApiModelProperty(value= "状态 1: 盘点中 2: 盘点结束 ") @ExcelProperty({"盘点单", "单据状态"}) private Integer type; /** @@ -41,39 +44,39 @@ */ @ApiModelProperty(value= "库位号") @TableField("loc_no") @ExcelProperty({"盘点单", "库位号"}) private String locNo; /** * 物料号 */ @ApiModelProperty(value= "物料号") @ExcelProperty({"盘点单", "物料号"}) private String matnr; /** * 物料号 */ @ApiModelProperty(value= "物料名") @ExcelProperty({"盘点单", "物料名"}) private String maktx; /** * 盘点前数量 */ @ApiModelProperty(value= "盘点前数量") @ExcelProperty({"盘点单", "盘点前数量"}) @TableField("anfme") private Double anfme; /** * 真实数量 */ @ApiModelProperty(value= "真实数量") @TableField("real_anfme") private Double realAnfme; /** * 创建人 */ @ApiModelProperty(value= "创建人") @TableField("create_by") @ExcelProperty({"盘点单", "创建人"}) private Long createBy; /** @@ -82,6 +85,7 @@ @ApiModelProperty(value= "创建时间") @TableField("create_time") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @ExcelProperty({"盘点单", "创建时间"}) private Date createTime; /** @@ -89,6 +93,7 @@ */ @ApiModelProperty(value= "修改人") @TableField("update_by") @ExcelProperty({"盘点单", "修改人"}) private Long updateBy; /** @@ -97,34 +102,49 @@ @ApiModelProperty(value= "修改时间") @TableField("update_time") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @ExcelProperty({"盘点单", "修改时间"}) private Date updateTime; /** * 备注 */ @ApiModelProperty(value= "备注") @ExcelProperty({"盘点单", "备注"}) private String memo; @ApiModelProperty(value= "差异量") @TableField("diff_anfme") @ExcelProperty({"盘点单", "差异量"}) private Double diffAnfme; @ApiModelProperty(value= "单据号") @TableField("order_no") @ExcelProperty({"盘点单", "单据号"}) private String orderNo; @ApiModelProperty(value= "审核") @ExcelProperty({"盘点单", "审核"}) private Integer examine; @ApiModelProperty(value= "拥有者 1: 杰克 ") @ExcelProperty({"盘点单", "货主"}) private Integer owner; /** * 货物形态:0:代采、1:仓储 */ @ApiModelProperty(value= "货物形态:0:代采、1:仓储") @ExcelProperty({"盘点单", "货物形态"}) private Integer payment; /** * 真实数量 */ @ApiModelProperty(value= "真实数量") @TableField("real_anfme") @ExcelProperty({"盘点单", "真实数量"}) private Double realAnfme; public String getOwner$(){ LocOwnerService service = SpringUtils.getBean(LocOwnerService.class); LocOwner locOwner = service.selectById(this.owner); src/main/webapp/static/js/orderCheck/orderCheck.js
@@ -168,6 +168,8 @@ }); }else if (layEvent === 'wrkTrace'){ showWrkTrace(data.id); }else if (layEvent === 'printExcel'){ printExcel(data); } }); //单据明细表 审核按钮 @@ -764,5 +766,16 @@ console.log(obj.data) }) function printExcel(data){ layer.confirm('确定导出Excel吗', {shadeClose: true}, function(){ // window.open("http://localhost:8082/stwms/orderCheck/printExport/auth?orderNo="+data.orderNo); layer.closeAll(); layer.load(1, {shade: [0.1,'#fff']}); location.href = "http://localhost:8082/stwms/orderCheck/printExport/auth?orderNo="+data.orderNo; layer.closeAll('loading'); }); } }); src/main/webapp/views/orderCheck/orderCheck.html
@@ -94,6 +94,7 @@ <!-- 表格操作列 --> <script type="text/html" id="operate"> <a class="layui-btn layui-btn-primary layui-border-blue layui-btn-xs btn-complete" lay-event="btnPrint">打印</a> <a class="layui-btn layui-btn-primary layui-border-blue layui-btn-xs btn-complete" lay-event="printExcel">导出Excel</a> {{# if (d.settle == 0 || d.settle == 1) { }} <a class="layui-btn layui-btn-primary layui-btn-xs btn-edit" lay-event="edit">修改</a> <a class="layui-btn layui-btn-danger layui-btn-xs btn-delete" lay-event="del">删除</a>