Commit 6f4934959c79b52ef47d5914b68835848cd313ef

Authored by xumiao
1 parent 831744fb

中间仓库存查询

src/main/java/com/huaheng/pc/agv/controller/AgvInventoryController.java
... ... @@ -11,7 +11,9 @@ import com.huaheng.framework.web.page.TableDataInfo;
11 11 import com.huaheng.framework.web.page.TableSupport;
12 12 import com.huaheng.common.utils.StringUtils;
13 13 import com.huaheng.pc.agv.domain.AgvPort;
  14 +import com.huaheng.pc.agv.domain.WorkStation;
14 15 import com.huaheng.pc.agv.service.IAgvPortService;
  16 +import com.huaheng.pc.agv.service.IWorkStationService;
15 17 import com.huaheng.pc.config.container.domain.Container;
16 18 import com.huaheng.pc.config.container.service.ContainerService;
17 19 import org.apache.shiro.authz.annotation.RequiresPermissions;
... ... @@ -32,6 +34,7 @@ import javax.annotation.Resource;
32 34 import java.util.Arrays;
33 35 import java.util.Date;
34 36 import java.util.List;
  37 +import java.util.stream.Collectors;
35 38  
36 39 /**
37 40 * 【请填写功能名称】 信息操作处理
... ... @@ -53,6 +56,9 @@ public class AgvInventoryController extends BaseController {
53 56 @Resource
54 57 private IAgvInventoryService agvInventoryService;
55 58  
  59 + @Resource
  60 + private IWorkStationService workStationService;
  61 +
56 62 @RequiresPermissions("agv:agvInventory:view")
57 63 @GetMapping()
58 64 public String agvInventory() {
... ... @@ -66,20 +72,28 @@ public class AgvInventoryController extends BaseController {
66 72 @PostMapping("/list")
67 73 @ResponseBody
68 74 public TableDataInfo list(AgvInventory agvInventory) {
  75 + List<String> agvPorts2=null;
69 76 LambdaQueryWrapper<AgvInventory> lambdaQueryWrapper = Wrappers.lambdaQuery();
  77 + if(StringUtils.isNotEmpty(agvInventory.getAgvPortName())){
  78 + List<AgvPort> agvPorts=agvPortService.list(new LambdaQueryWrapper<AgvPort>().like(AgvPort::getName,agvInventory.getAgvPortName()).eq(AgvPort::getType,1));
  79 + agvPorts2= agvPorts.stream().map(a->a.getCode()).collect(Collectors.toList());
  80 + }
70 81 lambdaQueryWrapper
71 82 .eq(StringUtils.isNotNull(agvInventory.getWorkStationId()), AgvInventory::getWorkStationId, agvInventory.getWorkStationId())
72   - .eq(StringUtils.isNotEmpty(agvInventory.getWorkStationCode()), AgvInventory::getWorkStationCode, agvInventory.getWorkStationCode())
73   - .eq(StringUtils.isNotEmpty(agvInventory.getContainerCode()), AgvInventory::getContainerCode, agvInventory.getContainerCode())
  83 +// .eq(StringUtils.isNotEmpty(agvInventory.getWorkStationCode()), AgvInventory::getWorkStationCode, agvInventory.getWorkStationCode())
  84 + .eq(AgvInventory::getWorkStationCode, "ZJC")
  85 + .like(StringUtils.isNotEmpty(agvInventory.getContainerCode()), AgvInventory::getContainerCode, agvInventory.getContainerCode())
74 86 .eq(StringUtils.isNotNull(agvInventory.getAgvPortId()), AgvInventory::getAgvPortId, agvInventory.getAgvPortId())
75   - .eq(StringUtils.isNotEmpty(agvInventory.getAgvPortCode()), AgvInventory::getAgvPortCode, agvInventory.getAgvPortCode())
76   - .eq(StringUtils.isNotEmpty(agvInventory.getMaterialCode()), AgvInventory::getMaterialCode, agvInventory.getMaterialCode())
  87 + .like(StringUtils.isNotEmpty(agvInventory.getAgvPortCode()), AgvInventory::getAgvPortCode, agvInventory.getAgvPortCode())
  88 + .like(StringUtils.isNotEmpty(agvInventory.getMaterialCode()), AgvInventory::getMaterialCode, agvInventory.getMaterialCode())
77 89 .like(StringUtils.isNotEmpty(agvInventory.getMaterialName()), AgvInventory::getMaterialName, agvInventory.getMaterialName())
78 90 .eq(StringUtils.isNotNull(agvInventory.getQty()), AgvInventory::getQty, agvInventory.getQty())
79 91 .eq(StringUtils.isNotNull(agvInventory.getCreated()), AgvInventory::getCreated, agvInventory.getCreated())
80 92 .eq(StringUtils.isNotEmpty(agvInventory.getCreatedBy()), AgvInventory::getCreatedBy, agvInventory.getCreatedBy())
81 93 .eq(StringUtils.isNotNull(agvInventory.getLastUpdated()), AgvInventory::getLastUpdated, agvInventory.getLastUpdated())
82 94 .eq(StringUtils.isNotEmpty(agvInventory.getLastUpdatedBy()), AgvInventory::getLastUpdatedBy, agvInventory.getLastUpdatedBy())
  95 + .in(StringUtils.isNotEmpty(agvPorts2),AgvInventory::getAgvPortCode,agvPorts2)
  96 + .last("order by agvPortCode asc")
83 97 ;
84 98 PageDomain pageDomain = TableSupport.buildPageRequest();
85 99 Integer pageNum = pageDomain.getPageNum();
... ... @@ -88,9 +102,22 @@ public class AgvInventoryController extends BaseController {
88 102 /*使用分页查询*/
89 103 Page<AgvInventory> page = new Page<>(pageNum, pageSize);
90 104 IPage<AgvInventory> iPage = agvInventoryService.page(page, lambdaQueryWrapper);
91   - return getMpDataTable(iPage.getRecords(), iPage.getTotal());
  105 + List<AgvInventory> agvInventoryList =iPage.getRecords();
  106 + agvInventoryList.forEach(a -> {
  107 + AgvPort agvPort= agvPortService.getAgvportByCode(a.getAgvPortCode());
  108 + a.setAgvPortName(agvPort.getName());
  109 + WorkStation workStation= workStationService.getById(agvPort.getWorkStationId());
  110 + a.setWorkStationName(workStation.getName());
  111 + });
  112 + return getMpDataTable(agvInventoryList, iPage.getTotal());
92 113 } else {
93 114 List<AgvInventory> list = agvInventoryService.list(lambdaQueryWrapper);
  115 + list.forEach(a -> {
  116 + AgvPort agvPort= agvPortService.getAgvportByCode(a.getAgvPortCode());
  117 + a.setAgvPortName(agvPort.getName());
  118 + WorkStation workStation= workStationService.getById(agvPort.getWorkStationId());
  119 + a.setWorkStationName(workStation.getName());
  120 + });
94 121 return getDataTable(list);
95 122 }
96 123 }
... ...
src/main/java/com/huaheng/pc/agv/domain/AgvInventory.java
... ... @@ -26,6 +26,9 @@ public class AgvInventory implements Serializable{
26 26 /** 工位编码 */
27 27 @TableField(value = "workStationCode")
28 28 private String workStationCode;
  29 + /** 工位名称 */
  30 + @TableField(exist = false)
  31 + private String workStationName;
29 32 /** 托盘号 */
30 33 @TableField(value = "containerCode")
31 34 private String containerCode;
... ... @@ -35,6 +38,9 @@ public class AgvInventory implements Serializable{
35 38 /** agv点位编码 */
36 39 @TableField(value = "agvPortCode")
37 40 private String agvPortCode;
  41 + /** agv点位名称 */
  42 + @TableField(exist = false)
  43 + private String agvPortName;
38 44 /** 物料编码 */
39 45 @TableField(value = "materialCode")
40 46 private String materialCode;
... ...
src/main/resources/templates/agv/inventory/list.html
... ... @@ -3,172 +3,155 @@
3 3 <meta charset="utf-8">
4 4 <head th:include="include :: header"></head>
5 5 <body class="gray-bg">
6   - <div class="container-div">
7   - <div class="row">
8   - <div class="col-sm-12 select-info">
9   - <form id="formId">
10   - <div class="select-list">
11   - <ul>
12   - <li>
13   - <label>工位id:</label>
14   - <input type="text" name="workstationid"/>
15   - </li>
16   - <li>
17   - <label>工位编码:</label>
18   - <input type="text" name="workstationcode"/>
19   - </li>
20   - <li>
21   - <label>托盘号:</label>
22   - <input type="text" name="containercode"/>
23   - </li>
24   - <li>
25   - <label>agv点位:</label>
26   - <input type="text" name="agvportid"/>
27   - </li>
28   - <li>
29   - <label>agv点位编码:</label>
30   - <input type="text" name="agvportcode"/>
31   - </li>
32   - <li>
33   - <label>物料编码:</label>
34   - <input type="text" name="materialcode"/>
35   - </li>
36   - <li>
37   - <label>物料名称:</label>
38   - <input type="text" name="materialname"/>
39   - </li>
40   - <li>
41   - <label>数量:</label>
42   - <input type="text" name="qty"/>
43   - </li>
44   - <li class="select-time">
45   - <label>创建时间:</label>
46   - <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginCreated]"/>
47   - <span>-</span>
48   - <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endCreated]"/>
49   - </li>
50   - <li>
51   - <label>创建者:</label>
52   - <input type="text" name="createdby"/>
53   - </li>
54   - <li class="select-time">
55   - <label>更新时间:</label>
56   - <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginLastupdated]"/>
57   - <span>-</span>
58   - <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endLastupdated]"/>
59   - </li>
60   - <li>
61   - <label>更新者:</label>
62   - <input type="text" name="lastupdatedby"/>
63   - </li>
64   - <li>
65   - <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
66   - <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
67   - </li>
68   - </ul>
69   - </div>
70   - </form>
71   - </div>
72   - <div class="btn-group hidden-xs" id="toolbar" role="group">
73   - <a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.add()" shiro:hasPermission="agv:agvInventory:add">
74   - <i class="fa fa-plus"></i> 新增
75   - </a>
76   - <a class="btn btn-outline btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="agv:inventory:edit">
77   - <i class="fa fa-edit"></i> 修改
78   - </a>
79   - <a class="btn btn-outline btn-danger btn-rounded multiple disabled" onclick="$.operate.batRemove()" shiro:hasPermission="agv:agvInventory:remove">
80   - <i class="fa fa-trash-o"></i> 删除
81   - </a>
82   - </div>
  6 +<div class="container-div">
  7 + <div class="row">
  8 + <div class="col-sm-12 select-info">
  9 + <form id="formId">
  10 + <div class="select-list">
  11 + <ul>
  12 + <li>
  13 + <label>托盘号:</label>
  14 + <input type="text" name="containerCode"/>
  15 + </li>
  16 + <li>
  17 + <label>agv点位编码:</label>
  18 + <input type="text" name="agvPortCode"/>
  19 + </li>
  20 + <li>
  21 + <label>agv点位名称:</label>
  22 + <input type="text" name="agvPortName"/>
  23 + </li>
  24 + <li>
  25 + <label>物料编码:</label>
  26 + <input type="text" name="materialCode"/>
  27 + </li>
  28 + <li>
  29 + <label>物料名称:</label>
  30 + <input type="text" name="materialName"/>
  31 + </li>
  32 + <li>
  33 + <label>创建者:</label>
  34 + <input type="text" name="createdBy"/>
  35 + </li>
  36 + <li>
  37 + <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
  38 + class="fa fa-search"></i>&nbsp;搜索</a>
  39 + <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
  40 + class="fa fa-refresh"></i>&nbsp;重置</a>
  41 + </li>
  42 + </ul>
  43 + </div>
  44 + </form>
  45 + </div>
  46 + <div class="col-sm-12 select-info">
  47 + <div class="btn-group hidden-xs" id="toolbar" role="group">
  48 + <span style="color:red;">*下面只查询出中间仓的库存数据</span>
  49 + </div>
  50 + <table id="bootstrap-table" data-mobile-responsive="true"
  51 + class="table table-bordered table-hover text-nowrap"></table>
  52 + </div>
  53 + </div>
83 54  
84   - <div class="col-sm-12 select-info table-striped">
85   - <table id="bootstrap-table" data-mobile-responsive="true"></table>
86   - </div>
87   - </div>
  55 +</div>
  56 +<div th:include="include :: footer"></div>
  57 +<script th:inline="javascript">
  58 + var editFlag = [[${@permission.hasPermi('agv:agvInventory:edit')}]];
  59 + var removeFlag = [[${@permission.hasPermi('agv:agvInventory:remove')}]];
  60 + var prefix = ctx + "agv/agvinventory"
88 61  
89   - </div>
90   - <div th:include="include :: footer"></div>
91   - <script th:inline="javascript">
92   - var editFlag = [[${@permission.hasPermi('agv:agvInventory:edit')}]];
93   - var removeFlag = [[${@permission.hasPermi('agv:agvInventory:remove')}]];
94   - var prefix = ctx + "agv/agvInventory"
  62 + $(function () {
  63 + var options = {
  64 + url: prefix + "/list",
  65 + // createUrl: prefix + "/add",
  66 + // updateUrl: prefix + "/edit/{id}",
  67 + // removeUrl: prefix + "/remove",
  68 + // modalName: "【请填写功能名称】",
  69 + sortName: "created",
  70 + sortOrder: "desc",
  71 + search: false,
  72 + showColumns:true, //列选择
  73 + pagination: true, // 是否显示分页(*)
  74 + pageNumber: 1, // 初始化加载第一页,默认第一页
  75 + pageSize: 10, // 每页的记录行数(*)
  76 + pageList: [10, 25, 50, 100],
  77 + toolbar: "toolbar",
  78 + columns: [{
  79 + checkbox: true
  80 + },
  81 + {
  82 + field: 'id',
  83 + title: '更新者',
  84 + visible: false
  85 + },
  86 + {
  87 + field: 'workStationId',
  88 + title: '工位id',
  89 + visible: false
  90 + },
  91 + {
  92 + field: 'workStationCode',
  93 + title: '工位编码',
  94 + visible: false
  95 + },
  96 + {
  97 + field: 'workStationName',
  98 + title: '工位名称'
  99 + },
  100 + {
  101 + field: 'containerCode',
  102 + title: '托盘号'
  103 + },
95 104  
96   - $(function() {
97   - var options = {
98   - url: prefix + "/list",
99   - createUrl: prefix + "/add",
100   - updateUrl: prefix + "/edit/{id}",
101   - removeUrl: prefix + "/remove",
102   - modalName: "【请填写功能名称】",
103   - columns: [{
104   - checkbox: true
105   - },
106   - {
107   - field: 'id',
108   - title: '更新者',
109   - visible: false
110   - },
111   - {
112   - field: 'workstationid',
113   - title: '工位id'
114   - },
115   - {
116   - field: 'workstationcode',
117   - title: '工位编码'
118   - },
119   - {
120   - field: 'containercode',
121   - title: '托盘号'
122   - },
123   - {
124   - field: 'agvportid',
125   - title: 'agv点位'
126   - },
127   - {
128   - field: 'agvportcode',
129   - title: 'agv点位编码'
130   - },
131   - {
132   - field: 'materialcode',
133   - title: '物料编码'
134   - },
135   - {
136   - field: 'materialname',
137   - title: '物料名称'
138   - },
139   - {
140   - field: 'qty',
141   - title: '数量'
142   - },
143   - {
144   - field: 'created',
145   - title: '创建时间'
146   - },
147   - {
148   - field: 'createdby',
149   - title: '创建者'
150   - },
151   - {
152   - field: 'lastupdated',
153   - title: '更新时间'
154   - },
155   - {
156   - field: 'lastupdatedby',
157   - title: '更新者'
158   - },
159   - {
160   - title: '操作',
161   - align: 'center',
162   - formatter: function(value, row, index) {
163   - var actions = [];
164   - actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id+ '\')"><i class="fa fa-edit"></i>编辑</a> ');
  105 + {
  106 + field: 'agvPortId',
  107 + title: 'agv点位',
  108 + visible: false
  109 + },
  110 + {
  111 + field: 'agvPortCode',
  112 + title: 'agv点位编码'
  113 + },
  114 + {
  115 + field: 'agvPortName',
  116 + title: 'agv点位名称'
  117 + },
  118 + {
  119 + field: 'materialCode',
  120 + title: '物料编码'
  121 + },
  122 + {
  123 + field: 'materialName',
  124 + title: '物料名称'
  125 + },
  126 + {
  127 + field: 'qty',
  128 + title: '数量'
  129 + },
  130 + {
  131 + field: 'created',
  132 + title: '创建时间'
  133 + },
  134 + {
  135 + field: 'createdBy',
  136 + title: '创建者'
  137 + },
  138 + {
  139 + field: 'lastUpdated',
  140 + title: '更新时间'
  141 + },
  142 + {
  143 + title: '操作',
  144 + align: 'center',
  145 + formatter: function (value, row, index) {
  146 + var actions = [];
  147 + actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
165 148 actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
166   - return actions.join('');
167   - }
168   - }]
169   - };
170   - $.table.init(options);
171   - });
172   - </script>
  149 + return actions.join('');
  150 + }
  151 + }]
  152 + };
  153 + $.table.init(options);
  154 + });
  155 +</script>
173 156 </body>
174 157 </html>
175 158 \ No newline at end of file
... ...