Commit 111cdcfc2206ece6b4fcfb4bd13429724fbf0cfe
1 parent
235f8f25
盘点明细导出
Showing
3 changed files
with
62 additions
and
23 deletions
src/main/java/com/huaheng/pc/inventory/cycleCountDetail/controller/CycleCountDetailController.java
... | ... | @@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
7 | 7 | import com.huaheng.common.constant.QuantityConstant; |
8 | 8 | import com.huaheng.common.support.Convert; |
9 | 9 | import com.huaheng.common.utils.StringUtils; |
10 | +import com.huaheng.common.utils.poi.ExcelUtil; | |
10 | 11 | import com.huaheng.common.utils.security.ShiroUtils; |
11 | 12 | import com.huaheng.framework.aspectj.lang.annotation.Log; |
12 | 13 | import com.huaheng.framework.aspectj.lang.constant.BusinessType; |
... | ... | @@ -22,6 +23,7 @@ import com.huaheng.pc.inventory.cycleCountDetail.domain.CycleCountDetail; |
22 | 23 | import com.huaheng.pc.inventory.cycleCountDetail.domain.CycleCountDetailChild; |
23 | 24 | import com.huaheng.pc.inventory.cycleCountDetail.service.CycleCountDetailChildService; |
24 | 25 | import com.huaheng.pc.inventory.cycleCountDetail.service.CycleCountDetailService; |
26 | +import com.huaheng.pc.system.user.domain.User; | |
25 | 27 | import com.huaheng.pc.task.taskHeader.service.CycleCountTaskService; |
26 | 28 | import org.apache.shiro.authz.annotation.RequiresPermissions; |
27 | 29 | import org.springframework.stereotype.Controller; |
... | ... | @@ -343,19 +345,28 @@ public class CycleCountDetailController extends BaseController { |
343 | 345 | newChild.setUserDef3("manual");//手动添加库存 |
344 | 346 | return toAjax(cycleCountDetailChildService.save(newChild)); |
345 | 347 | } |
346 | - | |
347 | - | |
348 | - | |
349 | - | |
350 | - | |
351 | - | |
352 | - | |
353 | - | |
354 | - | |
355 | - | |
356 | - | |
357 | - | |
358 | - | |
359 | - | |
360 | - | |
348 | + @Log(title = "库存-盘点-导出", operating = "导出盘点明细 ", action = BusinessType.EXPORT) | |
349 | + @RequiresPermissions("inventory:cyclecountDetail:export") | |
350 | + @PostMapping("/export") | |
351 | + @ResponseBody | |
352 | + public AjaxResult export(CycleCountDetailChild cycleCountDetailChild) | |
353 | + { | |
354 | + try | |
355 | + { | |
356 | + LambdaQueryWrapper<CycleCountDetailChild> lambdaQueryWrapper = Wrappers.lambdaQuery(); | |
357 | + lambdaQueryWrapper | |
358 | + .eq(CycleCountDetailChild::getCycleCountDetailId,cycleCountDetailChild.getCycleCountDetailId()) | |
359 | + .eq(CycleCountDetailChild::getCycleCountHeadCode,cycleCountDetailChild.getCycleCountHeadCode())//盘点主单 | |
360 | + .eq(StringUtils.isNotEmpty(cycleCountDetailChild.getLocationCode()), CycleCountDetailChild::getLocationCode, cycleCountDetailChild.getLocationCode()) //库位 | |
361 | + .eq(StringUtils.isNotEmpty(cycleCountDetailChild.getContainerCode()), CycleCountDetailChild::getContainerCode,cycleCountDetailChild.getContainerCode()) //容器 | |
362 | + .orderByDesc(CycleCountDetailChild::getId); | |
363 | + List<CycleCountDetailChild> list = cycleCountDetailChildService.list(lambdaQueryWrapper); | |
364 | + ExcelUtil<CycleCountDetailChild> util = new ExcelUtil<>(CycleCountDetailChild.class); | |
365 | + return util.exportExcel(list, "盘点明细列表"); | |
366 | + } | |
367 | + catch (Exception e) | |
368 | + { | |
369 | + return error("导出Excel失败,请联系网站管理员!"); | |
370 | + } | |
371 | + } | |
361 | 372 | } |
... | ... |
src/main/java/com/huaheng/pc/inventory/cycleCountDetail/domain/CycleCountDetailChild.java
... | ... | @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.IdType; |
5 | 5 | import com.baomidou.mybatisplus.annotation.TableField; |
6 | 6 | import com.baomidou.mybatisplus.annotation.TableId; |
7 | 7 | import com.baomidou.mybatisplus.annotation.TableName; |
8 | +import com.huaheng.framework.aspectj.lang.annotation.Excel; | |
8 | 9 | import io.swagger.annotations.ApiModel; |
9 | 10 | import io.swagger.annotations.ApiModelProperty; |
10 | 11 | |
... | ... | @@ -57,6 +58,7 @@ public class CycleCountDetailChild implements Serializable { |
57 | 58 | /** |
58 | 59 | * 物料 |
59 | 60 | */ |
61 | + @Excel(name = "物料编码") | |
60 | 62 | @TableField(value = "materialCode") |
61 | 63 | @ApiModelProperty(value="物料") |
62 | 64 | private String materialCode; |
... | ... | @@ -64,6 +66,7 @@ public class CycleCountDetailChild implements Serializable { |
64 | 66 | /** |
65 | 67 | * 物料名称 |
66 | 68 | */ |
69 | + @Excel(name = "物料名称") | |
67 | 70 | @TableField(value = "materialName") |
68 | 71 | @ApiModelProperty(value="物料名称") |
69 | 72 | private String materialName; |
... | ... | @@ -78,6 +81,7 @@ public class CycleCountDetailChild implements Serializable { |
78 | 81 | /** |
79 | 82 | * 物料单位 |
80 | 83 | */ |
84 | + @Excel(name = "物料单位") | |
81 | 85 | @TableField(value = "materialUnit") |
82 | 86 | @ApiModelProperty(value="物料单位") |
83 | 87 | private String materialUnit; |
... | ... | @@ -85,6 +89,7 @@ public class CycleCountDetailChild implements Serializable { |
85 | 89 | /** |
86 | 90 | * 系统数量 |
87 | 91 | */ |
92 | + @Excel(name = "系统数") | |
88 | 93 | @TableField(value = "systemQty") |
89 | 94 | @ApiModelProperty(value="系统数量") |
90 | 95 | private BigDecimal systemQty; |
... | ... | @@ -92,6 +97,7 @@ public class CycleCountDetailChild implements Serializable { |
92 | 97 | /** |
93 | 98 | * 实盘数量 |
94 | 99 | */ |
100 | + @Excel(name = "实盘数") | |
95 | 101 | @TableField(value = "countedQty") |
96 | 102 | @ApiModelProperty(value="实盘数量") |
97 | 103 | private BigDecimal countedQty; |
... | ... | @@ -99,13 +105,23 @@ public class CycleCountDetailChild implements Serializable { |
99 | 105 | /** |
100 | 106 | * 差异数量 |
101 | 107 | */ |
108 | + @Excel(name = "差异数") | |
102 | 109 | @TableField(value = "gapQty") |
103 | 110 | @ApiModelProperty(value="差异数量") |
104 | 111 | private BigDecimal gapQty; |
105 | 112 | |
106 | 113 | /** |
114 | + * 盘点明细子单状态 | |
115 | + */ | |
116 | + @Excel(name = "子单状态",readConverterExp="1=新建,5=盘点任务生成,10=执行中,15=已登记,30=审核,99=关闭,100=盘点完成,110=已生成调整单,105=盘点差异") | |
117 | + @TableField(value = "childStatus") | |
118 | + @ApiModelProperty(value="盘点明细子单状态") | |
119 | + private Integer childStatus; | |
120 | + | |
121 | + /** | |
107 | 122 | * 创建时间 |
108 | 123 | */ |
124 | + @Excel(name = "创建时间",dateFormat = "yyyy-MM-dd HH:mm:ss") | |
109 | 125 | @TableField(value = "created") |
110 | 126 | @ApiModelProperty(value="创建时间") |
111 | 127 | private Date created; |
... | ... | @@ -113,6 +129,7 @@ public class CycleCountDetailChild implements Serializable { |
113 | 129 | /** |
114 | 130 | * 创建用户 |
115 | 131 | */ |
132 | + @Excel(name = "创建用户") | |
116 | 133 | @TableField(value = "createdBy") |
117 | 134 | @ApiModelProperty(value="创建用户") |
118 | 135 | private String createdBy; |
... | ... | @@ -120,6 +137,7 @@ public class CycleCountDetailChild implements Serializable { |
120 | 137 | /** |
121 | 138 | * 实盘登记用户 |
122 | 139 | */ |
140 | + @Excel(name = "实盘登记人") | |
123 | 141 | @TableField(value = "countedBy") |
124 | 142 | @ApiModelProperty(value="实盘登记用户") |
125 | 143 | private String countedBy; |
... | ... | @@ -145,12 +163,6 @@ public class CycleCountDetailChild implements Serializable { |
145 | 163 | @ApiModelProperty(value="自定义字段3") |
146 | 164 | private String userDef3; |
147 | 165 | |
148 | - /** | |
149 | - * 盘点明细子单状态 | |
150 | - */ | |
151 | - @TableField(value = "childStatus") | |
152 | - @ApiModelProperty(value="盘点明细子单状态") | |
153 | - private Integer childStatus; | |
154 | 166 | |
155 | 167 | /** |
156 | 168 | * 库存明细ID |
... | ... |
src/main/resources/templates/inventory/cycleCountDetail/cycleCountDetail.html
... | ... | @@ -100,8 +100,8 @@ |
100 | 100 | createUrl: prefix + "/add", |
101 | 101 | updateUrl: prefix + "/edit/{id}", |
102 | 102 | removeUrl: prefix + "/remove", |
103 | + exportUrl: prefix + "/export", | |
103 | 104 | modalName: "盘点明细头", |
104 | - sortName: "id", | |
105 | 105 | sortOrder: "desc", |
106 | 106 | // height:610, |
107 | 107 | pagination: true, //是否分页 |
... | ... | @@ -140,6 +140,7 @@ |
140 | 140 | if(row.enableStatus > 1 && row.enableStatus < 100){ |
141 | 141 | actions.push('<a class="btn btn-warning btn-xs ' + addInvDetailFalg + '" href="#" onclick="addInvDetail(\'' + row.id + '\')"><i class="fa fa-gbp"></i>添加托盘库存</a> '); |
142 | 142 | } |
143 | + actions.push('<a class="btn btn-success btn-rounded btn-sm" onclick="exportExcels(\'' + row.id + '\',\'' + row.containerCode + '\')"><i class="fa fa-download"></i> 导出</a>'); | |
143 | 144 | return actions.join(''); |
144 | 145 | } |
145 | 146 | }, |
... | ... | @@ -539,6 +540,22 @@ |
539 | 540 | }; |
540 | 541 | |
541 | 542 | /*__________*/ |
543 | + function exportExcels(id,containerCode) { | |
544 | + let data = { | |
545 | + //传值 | |
546 | + cycleCountHeadCode : $('#cycleCountHeadCode').val(), | |
547 | + cycleCountDetailId: id, | |
548 | + containerCode: containerCode, | |
549 | + }; | |
550 | + $.post(ctx + "inventory/cycleCountDetail/export", data, function (result) { | |
551 | + if (result.code == web_status.SUCCESS) { | |
552 | + window.location.href = ctx + "common/download?fileName=" + result.msg + "&delete=" + true; | |
553 | + } else { | |
554 | + $.modal.alertError(result.msg); | |
555 | + } | |
556 | + $.modal.closeLoading(); | |
557 | + }); | |
558 | + } | |
542 | 559 | |
543 | 560 | function add() { |
544 | 561 | var cycleCountHeadCode = $('#cycleCountHeadCode').val(); |
... | ... | @@ -676,7 +693,6 @@ |
676 | 693 | }); |
677 | 694 | $.modal.closeLoading(); |
678 | 695 | layer.close(index); |
679 | - detailChildTable(); | |
680 | 696 | //layer.closeAll(); |
681 | 697 | } |
682 | 698 | }); |
... | ... |