Commit 8f460d3cc0ec2ea7abc456c9313ae3072416cf6b

Authored by xqs
1 parent 3e1906dd

库存汇总数据筛选

src/main/java/com/huaheng/pc/inventory/InventoryMaterialSummary/controller/InventoryMaterialSummaryController.java
... ... @@ -29,13 +29,11 @@ import java.util.List;
29 29  
30 30  
31 31 /**
32   - *库存物料汇总,
  32 + * 库存物料汇总,
33 33 * 父子页面表
34   - *
  34 + * <p>
35 35 * 无表,查询筛选数据后直接展示到页面
36   - *
37   - *
38   - * */
  36 + */
39 37 @Controller
40 38 @RequestMapping("/inventory/inventoryMaterialSummary")
41 39 public class InventoryMaterialSummaryController extends BaseController {
... ... @@ -45,22 +43,16 @@ public class InventoryMaterialSummaryController extends BaseController {
45 43 private InventoryMaterialSummaryService inventoryMaterialSummaryService;
46 44  
47 45  
48   -
49   -
50   -
51   -
52 46 private String prefix = "inventory/inventoryMaterialSummary";
53 47  
54 48  
55   -
56 49 /**
57 50 * 页面
58   - * */
  51 + */
59 52 @RequiresPermissions("inventory:inventoryMaterialSummary:view")
60 53 @GetMapping()
61   - public String inventoryMaterialSummary( ModelMap m)
62   - {
63   - m.put("warehouseCode",ShiroUtils.getWarehouseCode());
  54 + public String inventoryMaterialSummary(ModelMap m) {
  55 + m.put("warehouseCode", ShiroUtils.getWarehouseCode());
64 56 return prefix + "/inventoryMaterialSummary";
65 57 }
66 58  
... ... @@ -69,89 +61,60 @@ public class InventoryMaterialSummaryController extends BaseController {
69 61 */
70 62 @RequiresPermissions("inventory:cycleCountDetail:list")
71 63 @PostMapping("/list")
72   - @Log(title = "库存-盘点",operating = "查看盘点明细", action = BusinessType.GRANT)
  64 + @Log(title = "库存-库存汇总", operating = "库存汇总主表", action = BusinessType.GRANT)
73 65 @ResponseBody
74   - public TableDataInfo list(InventoryMaterialSummary inventoryMaterialSummary, String createdBegin, String createdEnd) {
  66 + public List<InventoryMaterialSummary> list(InventoryMaterialSummary inventoryMaterialSummary, String createdBegin, String createdEnd) {
75 67  
76 68 LambdaQueryWrapper<InventoryMaterialSummary> lambdaQueryWrapper = Wrappers.lambdaQuery();
77   - PageDomain pageDomain = TableSupport.buildPageRequest();
78   - Integer pageNum = pageDomain.getPageNum();
79   - Integer pageSize = pageDomain.getPageSize();
80   - lambdaQueryWrapper
81   - //仓库
82   - .eq(InventoryMaterialSummary::getWarehouseCode, ShiroUtils.getWarehouseCode())
83   - //物料编码
84   - .eq(StringUtils.isNotEmpty(inventoryMaterialSummary.getMaterialCode()),InventoryMaterialSummary::getMaterialCode,inventoryMaterialSummary.getMaterialCode())
85   - //物料名称
86   - .eq(StringUtils.isNotEmpty(inventoryMaterialSummary.getMaterialName()),InventoryMaterialSummary::getMaterialName,inventoryMaterialSummary.getMaterialName());
87   - //.orderByAsc(InventoryMaterialSummary::getMaterialCode);
88   -
89   - if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) {
90   - //分页查询
91   - Page<InventoryMaterialSummary> page = new Page<>(pageNum, pageSize);
92   - IPage<InventoryMaterialSummary> iPage = inventoryMaterialSummaryService.page(page, lambdaQueryWrapper);
93   - //筛选库存汇总数据的专用方法
94   - List<InventoryMaterialSummary> ipages = inventoryMaterialSummaryService.inventoryMaterialSummarySelect(iPage.getRecords()) ;
95   - return getMpDataTable(ipages, iPage.getTotal());
96   - } else {
97   - List<InventoryMaterialSummary> list = inventoryMaterialSummaryService.list(lambdaQueryWrapper);
98   - //筛选库存汇总数据的专用方法
99   - List<InventoryMaterialSummary> details = inventoryMaterialSummaryService.inventoryMaterialSummarySelect(list) ;
100   - if(details == null){
101   - details = Collections.emptyList();
102   - }
103   - return getDataTable(details);
104   - }
105   - //空List
106   - //return getDataTable(Collections.emptyList());
  69 +
  70 + lambdaQueryWrapper.ge(
  71 + StringUtils.isNotEmpty(createdBegin), InventoryMaterialSummary::getCreated, createdBegin)
  72 + .le(StringUtils.isNotEmpty(createdEnd), InventoryMaterialSummary::getCreated, createdEnd)//创建时间范围
  73 + //货主
  74 + .in(InventoryMaterialSummary::getCompanyCode, ShiroUtils.getCompanyCodeList())
  75 + //仓库
  76 + .eq(InventoryMaterialSummary::getWarehouseCode, ShiroUtils.getWarehouseCode())
  77 + //物料编码
  78 + .eq(StringUtils.isNotEmpty(inventoryMaterialSummary.getMaterialCode()), InventoryMaterialSummary::getMaterialCode, inventoryMaterialSummary.getMaterialCode())
  79 + //物料名称
  80 + .eq(StringUtils.isNotEmpty(inventoryMaterialSummary.getMaterialName()), InventoryMaterialSummary::getMaterialName, inventoryMaterialSummary.getMaterialName());
  81 + //.orderByAsc(InventoryMaterialSummary::getMaterialCode);
  82 +
  83 +
  84 + List<InventoryMaterialSummary> list = inventoryMaterialSummaryService.list(lambdaQueryWrapper);
  85 + //筛选库存汇总数据的专用方法
  86 + List<InventoryMaterialSummary> details = inventoryMaterialSummaryService.inventoryMaterialSummarySelect(list);
  87 + if (details == null) {
  88 + details = Collections.emptyList();
  89 + }
  90 + return details;
  91 +
  92 +
107 93 }
108 94  
109 95  
110 96 /**
111 97 * 库存汇总子单列表
112 98 */
113   - @PostMapping("/cycleCountDetailChild")
114   - @Log(title = "库存-盘点",operating = "查看盘点明细子单", action = BusinessType.GRANT)
  99 + @PostMapping("/inventoryMaterialSummaryChild")
  100 + @Log(title = "库存-库存汇总", operating = "库存汇总明细子单", action = BusinessType.GRANT)
115 101 @ResponseBody
116   - public TableDataInfo cycleCountDetailChild(InventoryMaterialSummary inventoryMaterialSummaryChild, String createdBegin, String createdEnd) {
117   -
  102 + public TableDataInfo inventoryMaterialSummaryChild(InventoryMaterialSummary inventoryMaterialSummaryChild) {
118 103 LambdaQueryWrapper<InventoryMaterialSummary> lambdaQueryWrapper = Wrappers.lambdaQuery();
119   - PageDomain pageDomain = TableSupport.buildPageRequest();
120   - Integer pageNum = pageDomain.getPageNum();
121   - Integer pageSize = pageDomain.getPageSize();
122 104 lambdaQueryWrapper
123 105 //仓库
124 106 .eq(InventoryMaterialSummary::getWarehouseCode, ShiroUtils.getWarehouseCode())
125 107 //物料编码
126   - .eq(InventoryMaterialSummary::getMaterialCode,inventoryMaterialSummaryChild.getMaterialCode());
127   - //.orderByDesc(InventoryMaterialSummary::getId);
128   -
129   - if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) {
130   - //分页查询
131   - Page<InventoryMaterialSummary> page = new Page<>(pageNum, pageSize);
132   - IPage<InventoryMaterialSummary> iPage = inventoryMaterialSummaryService.page(page, lambdaQueryWrapper);
133   - return getMpDataTable(iPage.getRecords(), iPage.getTotal());
134   - } else {
135   - List<InventoryMaterialSummary> list = inventoryMaterialSummaryService.list(lambdaQueryWrapper);
136   - return getDataTable(list);
  108 + .eq(InventoryMaterialSummary::getMaterialCode, inventoryMaterialSummaryChild.getMaterialCode());
  109 + //.orderByDesc(InventoryMaterialSummary::getId);
  110 +
  111 + List<InventoryMaterialSummary> list = inventoryMaterialSummaryService.list(lambdaQueryWrapper);
  112 + if (list == null) {
  113 + list = Collections.emptyList();
137 114 }
  115 + return getDataTable(list);
138 116  
139 117 }
140 118  
141 119  
142   -
143   -
144   -
145   -
146   -
147   -
148   -
149   -
150   -
151   -
152   -
153   -
154   -
155   -
156   -
157 120 }
... ...
src/main/java/com/huaheng/pc/inventory/InventoryMaterialSummary/service/InventoryMaterialSummaryChildService.java deleted
1   -package com.huaheng.pc.inventory.InventoryMaterialSummary.service;
2   -
3   -import com.baomidou.mybatisplus.extension.service.IService;
4   -import com.huaheng.pc.inventory.InventoryMaterialSummary.domain.InventoryMaterialSummary;
5   -
6   -public interface InventoryMaterialSummaryChildService extends IService<InventoryMaterialSummary> {
7   -
8   -
9   -
10   -
11   -
12   -
13   -
14   -
15   -}
src/main/java/com/huaheng/pc/inventory/InventoryMaterialSummary/service/InventoryMaterialSummaryChildServiceImpl.java deleted
1   -package com.huaheng.pc.inventory.InventoryMaterialSummary.service;
2   -
3   -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4   -import com.huaheng.pc.inventory.InventoryMaterialSummary.domain.InventoryMaterialSummary;
5   -import com.huaheng.pc.inventory.InventoryMaterialSummary.mapper.InventoryMaterialSummaryMapper;
6   -import org.springframework.stereotype.Service;
7   -
8   -
9   -@Service
10   -public class InventoryMaterialSummaryChildServiceImpl extends ServiceImpl<InventoryMaterialSummaryMapper, InventoryMaterialSummary> implements InventoryMaterialSummaryChildService{
11   -
12   -
13   -
14   -
15   -
16   -
17   -
18   -
19   -}
src/main/java/com/huaheng/pc/inventory/InventoryMaterialSummary/service/InventoryMaterialSummaryServiceImpl.java
... ... @@ -5,6 +5,8 @@ import com.huaheng.pc.inventory.InventoryMaterialSummary.domain.InventoryMateria
5 5 import com.huaheng.pc.inventory.InventoryMaterialSummary.mapper.InventoryMaterialSummaryMapper;
6 6 import org.springframework.stereotype.Service;
7 7  
  8 +import java.util.ArrayList;
  9 +import java.util.HashMap;
8 10 import java.util.List;
9 11  
10 12  
... ... @@ -22,9 +24,22 @@ public class InventoryMaterialSummaryServiceImpl extends ServiceImpl&lt;InventoryMa
22 24 @Override
23 25 public List<InventoryMaterialSummary> inventoryMaterialSummarySelect(List<InventoryMaterialSummary> inventoryMaterialSummaryList) {
24 26  
25   -
26   -
27   - return null;
  27 + /*以物料为条件把同物料数量全部相加,去重再展示*/
  28 +
  29 + HashMap<String, InventoryMaterialSummary> map = new HashMap<String, InventoryMaterialSummary>();
  30 + for (InventoryMaterialSummary bean : inventoryMaterialSummaryList) {
  31 + //单物料条件,
  32 + //货主和物料条件(!!!)
  33 + if (map.containsKey(bean.getMaterialCode())) {
  34 + bean.setQty(map.get(bean.getMaterialCode()).getQty().add(bean.getQty()));
  35 + }
  36 + map.put(bean.getMaterialCode(), bean);
  37 + }
  38 +// inventorys.clear();//清空list
  39 + List<InventoryMaterialSummary> inventoryList = new ArrayList<>();
  40 + inventoryList.addAll(map.values());
  41 +
  42 + return inventoryList;
28 43 }
29 44  
30 45  
... ...
src/main/resources/templates/inventory/inventoryMaterialSummary/inventoryMaterialSummary.html
... ... @@ -19,6 +19,14 @@
19 19 <li>
20 20 物料名称:<input id="materialName" type="text" name="materialName" />
21 21 </li>
  22 + <li class="time">
  23 + <label>创建时间: </label>
  24 + <input type="text" class="time-input" id="startTime" placeholder="开始时间"
  25 + name="createdBegin"/>
  26 + <span>-</span>
  27 + <input type="text" class="time-input" id="endTime" placeholder="结束时间"
  28 + name="createdEnd"/>
  29 + </li>
22 30 <li>
23 31 <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
24 32 </li>
... ... @@ -27,9 +35,9 @@
27 35 </form>
28 36 </div>
29 37 <div class="btn-group hidden-xs" id="toolbar" role="group">
30   - <a class="btn btn-outline btn-danger btn-rounded" onclick="batRemove()">
  38 + <!--<a class="btn btn-outline btn-danger btn-rounded" onclick="batRemove()">
31 39 <i class="fa fa-trash-o"></i> 删除
32   - </a>
  40 + </a>-->
33 41 </div>
34 42 <div class="col-sm-12 select-info">
35 43 <table id="bootstrap-table" data-mobile-responsive="true" class="table table-bordered table-hover"></table>
... ... @@ -42,26 +50,31 @@
42 50 var prefix = ctx + "inventory/inventoryMaterialSummary";
43 51  
44 52 $(function () {
45   - var options = {
  53 + let options = {
46 54 url: prefix + "/list",
  55 + contentType: "application/x-www-form-urlencoded", // 编码类型
  56 + method: 'post', // 请求方式(*)
47 57 modalName: "库存汇总",
  58 + sortStable: true,
48 59 sortName: "materialCode",
49 60 sortOrder: "asc",
50   - pagination: true, //是否分页
51 61 search: false,
52 62 showSearch: false,
53 63 showRefresh: true,
54 64 refresh:true,
  65 + showToggle: false,
  66 + showColumns: false,
  67 + showExport: true, //是否添加导出按钮
55 68 detailView: true,
56   -
57   - queryParams : {
58   - //传值
59   - warehouseCode : $('#warehouseCode').val(),
60   -
61   - },
  69 + pagination: true,
  70 + sidePagination: "client", //前端分页
  71 + queryParams : queryParams,
62 72 onExpandRow : function(index, row, $detail) {
63 73 detailChildTable(index, row, $detail);
64 74 },
  75 + responseHandler: function (res) {
  76 + return res;
  77 + },
65 78 columns: [
66 79 {
67 80 radio: true
... ... @@ -76,8 +89,8 @@
76 89 title: '货主编码'
77 90 },*/
78 91 {
79   - field: 'total',
80   - title: '库存总数量'
  92 + field: 'qty',
  93 + title: '库存总数'
81 94 },
82 95 {
83 96 field: 'materialCode',
... ... @@ -104,15 +117,13 @@
104 117 align: 'center',
105 118 formatter: function (value, row, index) {
106 119 var actions = [];
107   - if(row.enableStatus === 1 ){
108   - //actions.push('<a class="btn btn-primary btn-xs ' + createTaskFalg + '" href="#" onclick="outcheck(\'' + row.id + '\')"><i class="fa fa-gbp"></i>生成盘点单</a> ');
109   - }
  120 + //actions.push('<a class="btn btn-primary btn-xs ' + createTaskFalg + '" href="#" onclick="outcheck(\'' + row.id + '\')"><i class="fa fa-gbp"></i>生成盘点单</a> ');
110 121 return actions.join('');
111 122 }
112 123 }
113 124 ]
114 125 };
115   - $.table.init(options);
  126 + $("#bootstrap-table").bootstrapTable(options);
116 127 });
117 128  
118 129 //子表
... ... @@ -123,7 +134,7 @@
123 134 method: 'post',
124 135 sortName: "id",
125 136 sortOrder: "desc",
126   -
  137 + sidePagination: "server",
127 138 contentType: "application/x-www-form-urlencoded",
128 139 //页面渲染
129 140 responseHandler: responseHandler,
... ... @@ -136,21 +147,21 @@
136 147 columns: [
137 148 {
138 149 field: 'id',
139   - title: '库存ID',
  150 + title: '库存明细ID',
140 151 sortable: true,
141 152 width: 80
142 153 },
143 154 {
144 155 field: 'locationCode',
145   - title: '库位编',
  156 + title: '库位编',
146 157 visible: true,
147   - width: 200
  158 + width: 120
148 159 },
149 160 {
150 161 field: 'containerCode',
151   - title: '容器编',
  162 + title: '容器编',
152 163 visible: true,
153   - width: 150
  164 + width: 100
154 165 },
155 166 {
156 167 field: 'companyCode',
... ... @@ -161,12 +172,12 @@
161 172 {
162 173 field: 'materialCode',
163 174 title: '物料编码',
164   - width: 200
  175 + width: 150
165 176 },
166 177 {
167 178 field: 'materialName',
168 179 title: '物料名称',
169   - width: 200
  180 + width: 150
170 181 },
171 182 {
172 183 field: 'materialSpec',
... ... @@ -175,12 +186,14 @@
175 186 },
176 187 {
177 188 field: 'qty',
178   - title: '库存数量'
  189 + title: '库存数量',
  190 + width: 80
179 191 },
180 192 {
181 193 field: 'materialUnit',
182   - title: '物料单位',
183   - visible: false,
  194 + title: '单位',
  195 + visible: true,
  196 + width: 50
184 197  
185 198 },
186 199 {
... ... @@ -204,7 +217,19 @@
204 217 {
205 218 field: 'receiptCode',
206 219 title: '入库单编码',
207   - visible: false
  220 + visible: true
  221 + },
  222 + {
  223 + field: 'created',
  224 + title: '入库日期',
  225 + visible: true,
  226 + sortable: true,
  227 + width: 90
  228 + },{
  229 + field: 'weight',
  230 + title: '重量',
  231 + visible: true,
  232 + width: 50
208 233 },
209 234 /*{
210 235 title: '操作',
... ... @@ -263,6 +288,13 @@
263 288 }
264 289 }
265 290  
  291 + function queryParams (params) {
  292 + var curParams = {
  293 + // 传递参数查询参数
  294 + warehouseCode: $('#warehouseCode').val(),
  295 + };
  296 + return curParams;
  297 + }
266 298  
267 299 </script>
268 300 </body>
... ...