Commit 45eb239bf64952aa0b8b1b614292ff7b1947072a

Authored by pengyongcheng
1 parent 6045c5f9

fix: 库存物料汇总BUG修复

src/main/java/com/huaheng/pc/inventory/InventoryMaterialSummary/controller/InventoryMaterialSummaryController.java
1 1 package com.huaheng.pc.inventory.InventoryMaterialSummary.controller;
2 2  
3 3 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  4 +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  5 +import com.baomidou.mybatisplus.core.metadata.IPage;
4 6 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  7 +import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5 8 import com.huaheng.common.utils.StringUtils;
6 9 import com.huaheng.common.utils.security.ShiroUtils;
7 10 import com.huaheng.framework.aspectj.lang.annotation.Log;
8 11 import com.huaheng.framework.aspectj.lang.constant.BusinessType;
9 12 import com.huaheng.framework.web.controller.BaseController;
  13 +import com.huaheng.framework.web.page.PageDomain;
10 14 import com.huaheng.framework.web.page.TableDataInfo;
  15 +import com.huaheng.framework.web.page.TableSupport;
11 16 import com.huaheng.pc.config.company.domain.Company;
12 17 import com.huaheng.pc.config.company.service.CompanyService;
13 18 import com.huaheng.pc.inventory.InventoryMaterialSummary.domain.InventoryMaterialSummary;
... ... @@ -60,7 +65,7 @@ public class InventoryMaterialSummaryController extends BaseController {
60 65 /**
61 66 * 库存汇总列表
62 67 */
63   - @RequiresPermissions("inventory:cycleCountDetail:list")
  68 + /*@RequiresPermissions("inventory:cycleCountDetail:list")
64 69 @PostMapping("/list")
65 70 @Log(title = "库存-库存汇总", operating = "库存汇总主表", action = BusinessType.GRANT)
66 71 @ResponseBody
... ... @@ -89,13 +94,48 @@ public class InventoryMaterialSummaryController extends BaseController {
89 94 }
90 95 //筛选库存汇总数据的专用方法
91 96 return inventoryMaterialSummaryService.duplicateRemoval(list);
  97 + }*/
  98 +
  99 + /**
  100 + * 库存汇总列表
  101 + */
  102 + @RequiresPermissions("inventory:cycleCountDetail:list")
  103 + @PostMapping("/list")
  104 + @Log(title = "库存-库存汇总", operating = "库存汇总主表", action = BusinessType.GRANT)
  105 + @ResponseBody
  106 + public TableDataInfo list(InventoryDetail inventoryDetail, String createdBegin, String createdEnd) {
  107 + if (StringUtils.isNotEmpty(createdEnd)) {
  108 + createdEnd = LocalDate.parse(createdEnd).plusDays(1).toString();
  109 + }
  110 + PageDomain pageDomain = TableSupport.buildPageRequest();
  111 + Integer pageNum = pageDomain.getPageNum();
  112 + Integer pageSize = pageDomain.getPageSize();
  113 + QueryWrapper<InventoryDetail> queryWrapper = Wrappers.query();
  114 + queryWrapper
  115 + .select("zoneCode, companyCode, materialCode, materialName, materialUnit, SUM(qty) as qty")
  116 + .ge(StringUtils.isNotEmpty(createdBegin), "created", createdBegin)
  117 + .lt(StringUtils.isNotEmpty(createdEnd), "created", createdEnd)
  118 + .eq(StringUtils.isNotEmpty(inventoryDetail.getZoneCode()), "zoneCode", inventoryDetail.getZoneCode())
  119 + .eq(StringUtils.isNotEmpty(inventoryDetail.getMaterialCode()), "materialCode", inventoryDetail.getMaterialCode())
  120 + .eq(StringUtils.isNotEmpty(inventoryDetail.getMaterialName()), "materialName", inventoryDetail.getMaterialName())
  121 + .eq(StringUtils.isNotEmpty(inventoryDetail.getOrderCode()), "orderCode", inventoryDetail.getOrderCode());
  122 + queryWrapper.groupBy("zoneCode", "companyCode", "materialCode", "materialName", "materialUnit");
  123 + if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) {
  124 + //分页查询
  125 + Page<InventoryDetail> page = new Page<>(pageNum, pageSize);
  126 + IPage<InventoryDetail> iPage = inventoryDetailService.page(page, queryWrapper);
  127 + return getMpDataTable(iPage.getRecords(), iPage.getTotal());
  128 + } else {
  129 + List<InventoryDetail> list = inventoryDetailService.list(queryWrapper);
  130 + return getDataTable(list);
  131 + }
92 132 }
93 133  
94 134  
95 135 /**
96 136 * 库存汇总子单列表
97 137 */
98   - @PostMapping("/inventoryMaterialSummaryChild")
  138 + /*@PostMapping("/inventoryMaterialSummaryChild")
99 139 @Log(title = "库存-库存汇总", operating = "库存汇总明细子单", action = BusinessType.GRANT)
100 140 @ResponseBody
101 141 public TableDataInfo inventoryMaterialSummaryChild(InventoryMaterialSummary inventoryMaterialSummaryChild) {
... ... @@ -113,6 +153,22 @@ public class InventoryMaterialSummaryController extends BaseController {
113 153 }
114 154 return getDataTable(list);
115 155  
  156 + }*/
  157 +
  158 + @PostMapping("/inventoryMaterialSummaryChild")
  159 + @Log(title = "库存-库存汇总", operating = "库存汇总明细子单", action = BusinessType.GRANT)
  160 + @ResponseBody
  161 + public TableDataInfo inventoryMaterialSummaryChild(InventoryDetail inventoryDetail) {
  162 + LambdaQueryWrapper<InventoryMaterialSummary> lambdaQueryWrapper = Wrappers.lambdaQuery();
  163 + lambdaQueryWrapper
  164 + .eq(InventoryMaterialSummary::getMaterialCode, inventoryDetail.getMaterialCode())
  165 + .eq(StringUtils.isNotEmpty(inventoryDetail.getZoneCode()), InventoryMaterialSummary::getZoneCode, inventoryDetail.getZoneCode());
  166 + List<InventoryMaterialSummary> list = inventoryMaterialSummaryService.list(lambdaQueryWrapper);
  167 + if (list == null) {
  168 + list = Collections.emptyList();
  169 + }
  170 + return getDataTable(list);
  171 +
116 172 }
117 173  
118 174 /**
... ...
src/main/resources/templates/inventory/inventoryHeader/cbgReplenish.html
... ... @@ -26,7 +26,7 @@
26 26 <div class="form-group">
27 27 <label class="col-sm-3 control-label">上料口:</label>
28 28 <div class="col-sm-8">
29   - <select id="fromPort" name="fromPort" class="form-control">
  29 + <select id="fromPort" name="fromPort" class="form-control" disabled>
30 30 <option>请选择上料口</option>
31 31 <option th:each="item : ${stations}"
32 32 th:text="${item['name']}"
... ...
src/main/resources/templates/inventory/inventoryMaterialSummary/inventoryMaterialSummary.html
... ... @@ -23,10 +23,10 @@
23 23 <label>物料编码:</label>
24 24 <input id="materialCode" name="materialCode" placeholder="请输入物料编码" type="text"/>
25 25 </li>
26   - <li>
  26 + <!-- <li>
27 27 <label>固化时间(h):</label>
28 28 <input name="solidifyTime" min="0" placeholder="请输入固化时间(h)" type="number"/>
29   - </li>
  29 + </li>-->
30 30 <li>
31 31 <label>所属工单号:</label>
32 32 <input name="orderCode" placeholder="请输入工单号" type="text"/>
... ... @@ -215,6 +215,10 @@
215 215 title: '物料名称'
216 216 },
217 217 {
  218 + field: 'flowCode',
  219 + title: '工序号'
  220 + },
  221 + {
218 222 field: 'materialSpec',
219 223 title: '物料规格'
220 224 },
... ...