From 6f4934959c79b52ef47d5914b68835848cd313ef Mon Sep 17 00:00:00 2001 From: xumiao <1365304440@qq.com> Date: Thu, 12 Jan 2023 18:02:55 +0800 Subject: [PATCH] 中间仓库存查询 --- src/main/java/com/huaheng/pc/agv/controller/AgvInventoryController.java | 37 ++++++++++++++++++++++++++++++++----- src/main/java/com/huaheng/pc/agv/domain/AgvInventory.java | 6 ++++++ src/main/resources/templates/agv/inventory/list.html | 309 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3 files changed, 184 insertions(+), 168 deletions(-) diff --git a/src/main/java/com/huaheng/pc/agv/controller/AgvInventoryController.java b/src/main/java/com/huaheng/pc/agv/controller/AgvInventoryController.java index 04fa2f0..c9b9f34 100644 --- a/src/main/java/com/huaheng/pc/agv/controller/AgvInventoryController.java +++ b/src/main/java/com/huaheng/pc/agv/controller/AgvInventoryController.java @@ -11,7 +11,9 @@ import com.huaheng.framework.web.page.TableDataInfo; import com.huaheng.framework.web.page.TableSupport; import com.huaheng.common.utils.StringUtils; import com.huaheng.pc.agv.domain.AgvPort; +import com.huaheng.pc.agv.domain.WorkStation; import com.huaheng.pc.agv.service.IAgvPortService; +import com.huaheng.pc.agv.service.IWorkStationService; import com.huaheng.pc.config.container.domain.Container; import com.huaheng.pc.config.container.service.ContainerService; import org.apache.shiro.authz.annotation.RequiresPermissions; @@ -32,6 +34,7 @@ import javax.annotation.Resource; import java.util.Arrays; import java.util.Date; import java.util.List; +import java.util.stream.Collectors; /** * 【请填写功能名称】 信息操作处理 @@ -53,6 +56,9 @@ public class AgvInventoryController extends BaseController { @Resource private IAgvInventoryService agvInventoryService; + @Resource + private IWorkStationService workStationService; + @RequiresPermissions("agv:agvInventory:view") @GetMapping() public String agvInventory() { @@ -66,20 +72,28 @@ public class AgvInventoryController extends BaseController { @PostMapping("/list") @ResponseBody public TableDataInfo list(AgvInventory agvInventory) { + List<String> agvPorts2=null; LambdaQueryWrapper<AgvInventory> lambdaQueryWrapper = Wrappers.lambdaQuery(); + if(StringUtils.isNotEmpty(agvInventory.getAgvPortName())){ + List<AgvPort> agvPorts=agvPortService.list(new LambdaQueryWrapper<AgvPort>().like(AgvPort::getName,agvInventory.getAgvPortName()).eq(AgvPort::getType,1)); + agvPorts2= agvPorts.stream().map(a->a.getCode()).collect(Collectors.toList()); + } lambdaQueryWrapper .eq(StringUtils.isNotNull(agvInventory.getWorkStationId()), AgvInventory::getWorkStationId, agvInventory.getWorkStationId()) - .eq(StringUtils.isNotEmpty(agvInventory.getWorkStationCode()), AgvInventory::getWorkStationCode, agvInventory.getWorkStationCode()) - .eq(StringUtils.isNotEmpty(agvInventory.getContainerCode()), AgvInventory::getContainerCode, agvInventory.getContainerCode()) +// .eq(StringUtils.isNotEmpty(agvInventory.getWorkStationCode()), AgvInventory::getWorkStationCode, agvInventory.getWorkStationCode()) + .eq(AgvInventory::getWorkStationCode, "ZJC") + .like(StringUtils.isNotEmpty(agvInventory.getContainerCode()), AgvInventory::getContainerCode, agvInventory.getContainerCode()) .eq(StringUtils.isNotNull(agvInventory.getAgvPortId()), AgvInventory::getAgvPortId, agvInventory.getAgvPortId()) - .eq(StringUtils.isNotEmpty(agvInventory.getAgvPortCode()), AgvInventory::getAgvPortCode, agvInventory.getAgvPortCode()) - .eq(StringUtils.isNotEmpty(agvInventory.getMaterialCode()), AgvInventory::getMaterialCode, agvInventory.getMaterialCode()) + .like(StringUtils.isNotEmpty(agvInventory.getAgvPortCode()), AgvInventory::getAgvPortCode, agvInventory.getAgvPortCode()) + .like(StringUtils.isNotEmpty(agvInventory.getMaterialCode()), AgvInventory::getMaterialCode, agvInventory.getMaterialCode()) .like(StringUtils.isNotEmpty(agvInventory.getMaterialName()), AgvInventory::getMaterialName, agvInventory.getMaterialName()) .eq(StringUtils.isNotNull(agvInventory.getQty()), AgvInventory::getQty, agvInventory.getQty()) .eq(StringUtils.isNotNull(agvInventory.getCreated()), AgvInventory::getCreated, agvInventory.getCreated()) .eq(StringUtils.isNotEmpty(agvInventory.getCreatedBy()), AgvInventory::getCreatedBy, agvInventory.getCreatedBy()) .eq(StringUtils.isNotNull(agvInventory.getLastUpdated()), AgvInventory::getLastUpdated, agvInventory.getLastUpdated()) .eq(StringUtils.isNotEmpty(agvInventory.getLastUpdatedBy()), AgvInventory::getLastUpdatedBy, agvInventory.getLastUpdatedBy()) + .in(StringUtils.isNotEmpty(agvPorts2),AgvInventory::getAgvPortCode,agvPorts2) + .last("order by agvPortCode asc") ; PageDomain pageDomain = TableSupport.buildPageRequest(); Integer pageNum = pageDomain.getPageNum(); @@ -88,9 +102,22 @@ public class AgvInventoryController extends BaseController { /*使用分页查询*/ Page<AgvInventory> page = new Page<>(pageNum, pageSize); IPage<AgvInventory> iPage = agvInventoryService.page(page, lambdaQueryWrapper); - return getMpDataTable(iPage.getRecords(), iPage.getTotal()); + List<AgvInventory> agvInventoryList =iPage.getRecords(); + agvInventoryList.forEach(a -> { + AgvPort agvPort= agvPortService.getAgvportByCode(a.getAgvPortCode()); + a.setAgvPortName(agvPort.getName()); + WorkStation workStation= workStationService.getById(agvPort.getWorkStationId()); + a.setWorkStationName(workStation.getName()); + }); + return getMpDataTable(agvInventoryList, iPage.getTotal()); } else { List<AgvInventory> list = agvInventoryService.list(lambdaQueryWrapper); + list.forEach(a -> { + AgvPort agvPort= agvPortService.getAgvportByCode(a.getAgvPortCode()); + a.setAgvPortName(agvPort.getName()); + WorkStation workStation= workStationService.getById(agvPort.getWorkStationId()); + a.setWorkStationName(workStation.getName()); + }); return getDataTable(list); } } diff --git a/src/main/java/com/huaheng/pc/agv/domain/AgvInventory.java b/src/main/java/com/huaheng/pc/agv/domain/AgvInventory.java index 1a1c7fd..a864961 100644 --- a/src/main/java/com/huaheng/pc/agv/domain/AgvInventory.java +++ b/src/main/java/com/huaheng/pc/agv/domain/AgvInventory.java @@ -26,6 +26,9 @@ public class AgvInventory implements Serializable{ /** 工位编码 */ @TableField(value = "workStationCode") private String workStationCode; + /** 工位名称 */ + @TableField(exist = false) + private String workStationName; /** 托盘号 */ @TableField(value = "containerCode") private String containerCode; @@ -35,6 +38,9 @@ public class AgvInventory implements Serializable{ /** agv点位编码 */ @TableField(value = "agvPortCode") private String agvPortCode; + /** agv点位名称 */ + @TableField(exist = false) + private String agvPortName; /** 物料编码 */ @TableField(value = "materialCode") private String materialCode; diff --git a/src/main/resources/templates/agv/inventory/list.html b/src/main/resources/templates/agv/inventory/list.html index 5d75169..5ba57d3 100644 --- a/src/main/resources/templates/agv/inventory/list.html +++ b/src/main/resources/templates/agv/inventory/list.html @@ -3,172 +3,155 @@ <meta charset="utf-8"> <head th:include="include :: header"></head> <body class="gray-bg"> - <div class="container-div"> - <div class="row"> - <div class="col-sm-12 select-info"> - <form id="formId"> - <div class="select-list"> - <ul> - <li> - <label>工位id:</label> - <input type="text" name="workstationid"/> - </li> - <li> - <label>工位编码:</label> - <input type="text" name="workstationcode"/> - </li> - <li> - <label>托盘号:</label> - <input type="text" name="containercode"/> - </li> - <li> - <label>agv点位:</label> - <input type="text" name="agvportid"/> - </li> - <li> - <label>agv点位编码:</label> - <input type="text" name="agvportcode"/> - </li> - <li> - <label>物料编码:</label> - <input type="text" name="materialcode"/> - </li> - <li> - <label>物料名称:</label> - <input type="text" name="materialname"/> - </li> - <li> - <label>数量:</label> - <input type="text" name="qty"/> - </li> - <li class="select-time"> - <label>创建时间:</label> - <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginCreated]"/> - <span>-</span> - <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endCreated]"/> - </li> - <li> - <label>创建者:</label> - <input type="text" name="createdby"/> - </li> - <li class="select-time"> - <label>更新时间:</label> - <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginLastupdated]"/> - <span>-</span> - <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endLastupdated]"/> - </li> - <li> - <label>更新者:</label> - <input type="text" name="lastupdatedby"/> - </li> - <li> - <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a> - <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i> 重置</a> - </li> - </ul> - </div> - </form> - </div> - <div class="btn-group hidden-xs" id="toolbar" role="group"> - <a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.add()" shiro:hasPermission="agv:agvInventory:add"> - <i class="fa fa-plus"></i> 新增 - </a> - <a class="btn btn-outline btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="agv:inventory:edit"> - <i class="fa fa-edit"></i> 修改 - </a> - <a class="btn btn-outline btn-danger btn-rounded multiple disabled" onclick="$.operate.batRemove()" shiro:hasPermission="agv:agvInventory:remove"> - <i class="fa fa-trash-o"></i> 删除 - </a> - </div> +<div class="container-div"> + <div class="row"> + <div class="col-sm-12 select-info"> + <form id="formId"> + <div class="select-list"> + <ul> + <li> + <label>托盘号:</label> + <input type="text" name="containerCode"/> + </li> + <li> + <label>agv点位编码:</label> + <input type="text" name="agvPortCode"/> + </li> + <li> + <label>agv点位名称:</label> + <input type="text" name="agvPortName"/> + </li> + <li> + <label>物料编码:</label> + <input type="text" name="materialCode"/> + </li> + <li> + <label>物料名称:</label> + <input type="text" name="materialName"/> + </li> + <li> + <label>创建者:</label> + <input type="text" name="createdBy"/> + </li> + <li> + <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i + class="fa fa-search"></i> 搜索</a> + <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i + class="fa fa-refresh"></i> 重置</a> + </li> + </ul> + </div> + </form> + </div> + <div class="col-sm-12 select-info"> + <div class="btn-group hidden-xs" id="toolbar" role="group"> + <span style="color:red;">*下面只查询出中间仓的库存数据</span> + </div> + <table id="bootstrap-table" data-mobile-responsive="true" + class="table table-bordered table-hover text-nowrap"></table> + </div> + </div> - <div class="col-sm-12 select-info table-striped"> - <table id="bootstrap-table" data-mobile-responsive="true"></table> - </div> - </div> +</div> +<div th:include="include :: footer"></div> +<script th:inline="javascript"> + var editFlag = [[${@permission.hasPermi('agv:agvInventory:edit')}]]; + var removeFlag = [[${@permission.hasPermi('agv:agvInventory:remove')}]]; + var prefix = ctx + "agv/agvinventory" - </div> - <div th:include="include :: footer"></div> - <script th:inline="javascript"> - var editFlag = [[${@permission.hasPermi('agv:agvInventory:edit')}]]; - var removeFlag = [[${@permission.hasPermi('agv:agvInventory:remove')}]]; - var prefix = ctx + "agv/agvInventory" + $(function () { + var options = { + url: prefix + "/list", + // createUrl: prefix + "/add", + // updateUrl: prefix + "/edit/{id}", + // removeUrl: prefix + "/remove", + // modalName: "【请填写功能名称】", + sortName: "created", + sortOrder: "desc", + search: false, + showColumns:true, //列选择 + pagination: true, // 是否显示分页(*) + pageNumber: 1, // 初始化加载第一页,默认第一页 + pageSize: 10, // 每页的记录行数(*) + pageList: [10, 25, 50, 100], + toolbar: "toolbar", + columns: [{ + checkbox: true + }, + { + field: 'id', + title: '更新者', + visible: false + }, + { + field: 'workStationId', + title: '工位id', + visible: false + }, + { + field: 'workStationCode', + title: '工位编码', + visible: false + }, + { + field: 'workStationName', + title: '工位名称' + }, + { + field: 'containerCode', + title: '托盘号' + }, - $(function() { - var options = { - url: prefix + "/list", - createUrl: prefix + "/add", - updateUrl: prefix + "/edit/{id}", - removeUrl: prefix + "/remove", - modalName: "【请填写功能名称】", - columns: [{ - checkbox: true - }, - { - field: 'id', - title: '更新者', - visible: false - }, - { - field: 'workstationid', - title: '工位id' - }, - { - field: 'workstationcode', - title: '工位编码' - }, - { - field: 'containercode', - title: '托盘号' - }, - { - field: 'agvportid', - title: 'agv点位' - }, - { - field: 'agvportcode', - title: 'agv点位编码' - }, - { - field: 'materialcode', - title: '物料编码' - }, - { - field: 'materialname', - title: '物料名称' - }, - { - field: 'qty', - title: '数量' - }, - { - field: 'created', - title: '创建时间' - }, - { - field: 'createdby', - title: '创建者' - }, - { - field: 'lastupdated', - title: '更新时间' - }, - { - field: 'lastupdatedby', - title: '更新者' - }, - { - title: '操作', - align: 'center', - formatter: function(value, row, index) { - var actions = []; - actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id+ '\')"><i class="fa fa-edit"></i>编辑</a> '); + { + field: 'agvPortId', + title: 'agv点位', + visible: false + }, + { + field: 'agvPortCode', + title: 'agv点位编码' + }, + { + field: 'agvPortName', + title: 'agv点位名称' + }, + { + field: 'materialCode', + title: '物料编码' + }, + { + field: 'materialName', + title: '物料名称' + }, + { + field: 'qty', + title: '数量' + }, + { + field: 'created', + title: '创建时间' + }, + { + field: 'createdBy', + title: '创建者' + }, + { + field: 'lastUpdated', + title: '更新时间' + }, + { + title: '操作', + align: 'center', + formatter: function (value, row, index) { + var actions = []; + actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> '); actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>'); - return actions.join(''); - } - }] - }; - $.table.init(options); - }); - </script> + return actions.join(''); + } + }] + }; + $.table.init(options); + }); +</script> </body> </html> \ No newline at end of file -- libgit2 0.22.2