Commit 33c2222f69e08dc8f4be17dd9aeefd817fe67e01

Authored by Leslie
1 parent 32c1ebc6

feat:空库位数量增加表location_idle,完成接口以及功能自测

src/main/java/com/huaheng/common/config/FastJsonConfig.java 0 → 100644
  1 +package com.huaheng.common.config;
  2 +
  3 +import com.alibaba.fastjson.JSON;
  4 +import com.alibaba.fastjson.serializer.SerializerFeature;
  5 +import org.springframework.context.annotation.Configuration;
  6 +
  7 +/**
  8 + * @author puff
  9 + */
  10 +@Configuration
  11 +public class FastJsonConfig {
  12 + static {
  13 + //全局配置关闭 Fastjson 循环引用
  14 + JSON.DEFAULT_GENERATE_FEATURE |= SerializerFeature.DisableCircularReferenceDetect.getMask();
  15 + }
  16 +}
... ...
src/main/java/com/huaheng/pc/config/location/controller/LocationController.java
... ... @@ -25,6 +25,8 @@ import com.huaheng.pc.config.location.service.LocationService;
25 25 import com.huaheng.pc.config.material.service.MaterialService;
26 26 import com.huaheng.pc.inventory.inventoryDetail.domain.InventoryDetail;
27 27 import com.huaheng.pc.inventory.inventoryDetail.service.InventoryDetailService;
  28 +import com.huaheng.pc.monitor.idle.domain.LocationIdle;
  29 +import com.huaheng.pc.monitor.idle.service.ILocationIdleService;
28 30 import io.swagger.annotations.Api;
29 31 import io.swagger.annotations.ApiOperation;
30 32 import io.swagger.annotations.ApiParam;
... ... @@ -45,328 +47,347 @@ import java.util.stream.Collectors;
45 47 @RequestMapping("/config/location")
46 48 public class LocationController extends BaseController {
47 49  
48   - private String prefix = "config/location";
49   -
50   - @Resource
51   - private ContainerService containerService;
52   - @Resource
53   - private LocationService locationService;
54   - @Resource
55   - private InventoryDetailService inventoryDetailService;
56   - @Resource
57   - private MaterialService materialService;
58   - @Resource
59   - private DataSource dataSource;
60   - @Resource
61   - private Print print;
62   -
63   - @RequiresPermissions("config:location:view")
64   - @GetMapping()
65   - public String location () {
66   - return prefix + "/location";
67   - }
68   -
69   - /**
70   - * 查询库位列表
71   - */
72   - @ApiOperation(value = "查看库位列表",
73   - notes = "根据行、列、层、格、库位类型、库区、库位状态、容器编码、库位名称、库位编码、创建时间获取库位的详细信息",
74   - httpMethod = "POST")
75   - @RequiresPermissions("config:location:list")
76   - @Log(title = "配置-库存资料-库位管理", operating = "查看库位列表", action = BusinessType.GRANT)
77   - @PostMapping("/list")
78   - @ResponseBody
79   - public TableDataInfo list (
80   - @ApiParam(name = "location", value = "行、列、层、格、库位类型、库区、库位状态、容器编码、库位名称、库位编码") Location location,
81   - @ApiParam(name = "createdBegin", value = "起止时间") String createdBegin,
82   - @ApiParam(name = "createdEnd", value = "结束时间") String createdEnd) {
83   - LambdaQueryWrapper<Location> lambdaQueryWrapper = Wrappers.lambdaQuery();
84   - PageDomain pageDomain = TableSupport.buildPageRequest();
85   - Integer pageNum = pageDomain.getPageNum();
86   - Integer pageSize = pageDomain.getPageSize();
87   - lambdaQueryWrapper.gt(StringUtils.isNotEmpty(createdBegin), Location::getCreated, createdBegin)
88   - .lt(StringUtils.isNotEmpty(createdEnd), Location::getCreated, createdEnd)
89   - .eq(Location::getWarehouseCode, ShiroUtils.getWarehouseCode())
90   - .eq(StringUtils.isNotEmpty(location.getCode()), Location::getCode, location.getCode())
91   - .eq(StringUtils.isNotEmpty(location.getName()), Location::getName, location.getName())
92   - .eq(StringUtils.isNotEmpty(location.getContainerCode()), Location::getContainerCode, location.getContainerCode())
93   - .eq(StringUtils.isNotNull(location.getSystemCreated()), Location::getStatus, location.getStatus())
94   - .eq(StringUtils.isNotEmpty(location.getZoneCode()), Location::getZoneCode, location.getZoneCode())
95   - .eq(StringUtils.isNotNull(location.getIRow()), Location::getIRow, location.getIRow())
96   - .eq(StringUtils.isNotNull(location.getIColumn()), Location::getIColumn, location.getIColumn())
97   - .eq(StringUtils.isNotNull(location.getIGrid()), Location::getIGrid, location.getIGrid())
98   - .eq(StringUtils.isNotNull(location.getILayer()), Location::getILayer, location.getILayer())
99   - .eq(StringUtils.isNotEmpty(location.getStatus()), Location::getStatus, location.getStatus())
100   - .eq(StringUtils.isNotEmpty(location.getLocationType()), Location::getLocationType, location.getLocationType())
101   - .eq(Location::getDeleted, false)
102   - .orderByDesc(Location::getId);
103   -
104   - if(StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) {
105   - /*使用分页查询*/
106   - Page<Location> page = new Page<>(pageNum, pageSize);
107   - IPage<Location> iPage = locationService.page(page, lambdaQueryWrapper);
108   - return getMpDataTable(iPage.getRecords(), iPage.getTotal());
109   - } else {
110   - List<Location> list = locationService.list(lambdaQueryWrapper);
111   - return getDataTable(list);
  50 + private String prefix = "config/location";
  51 +
  52 + @Resource
  53 + private ContainerService containerService;
  54 + @Resource
  55 + private LocationService locationService;
  56 + @Resource
  57 + private InventoryDetailService inventoryDetailService;
  58 + @Resource
  59 + private MaterialService materialService;
  60 + @Resource
  61 + private DataSource dataSource;
  62 + @Resource
  63 + private Print print;
  64 +
  65 + @RequiresPermissions("config:location:view")
  66 + @GetMapping()
  67 + public String location() {
  68 + return prefix + "/location";
112 69 }
113   - }
114   -
115   - /**
116   - * 查询库位列表
117   - */
118   - @Log(title = "配置-库存资料-库位管理", operating = "查看库位列表", action = BusinessType.GRANT)
119   - @PostMapping("/getAllLocation")
120   - @ResponseBody
121   - public AjaxResult getAllLocation (String type) {
122   - if(StringUtils.isEmpty(type)) {
123   - return AjaxResult.error("type不能为空");
  70 +
  71 + /**
  72 + * 查询库位列表
  73 + */
  74 + @ApiOperation(value = "查看库位列表",
  75 + notes = "根据行、列、层、格、库位类型、库区、库位状态、容器编码、库位名称、库位编码、创建时间获取库位的详细信息",
  76 + httpMethod = "POST")
  77 + @RequiresPermissions("config:location:list")
  78 + @Log(title = "配置-库存资料-库位管理", operating = "查看库位列表", action = BusinessType.GRANT)
  79 + @PostMapping("/list")
  80 + @ResponseBody
  81 + public TableDataInfo list(
  82 + @ApiParam(name = "location", value = "行、列、层、格、库位类型、库区、库位状态、容器编码、库位名称、库位编码") Location location,
  83 + @ApiParam(name = "createdBegin", value = "起止时间") String createdBegin,
  84 + @ApiParam(name = "createdEnd", value = "结束时间") String createdEnd) {
  85 + LambdaQueryWrapper<Location> lambdaQueryWrapper = Wrappers.lambdaQuery();
  86 + PageDomain pageDomain = TableSupport.buildPageRequest();
  87 + Integer pageNum = pageDomain.getPageNum();
  88 + Integer pageSize = pageDomain.getPageSize();
  89 + lambdaQueryWrapper.gt(StringUtils.isNotEmpty(createdBegin), Location::getCreated, createdBegin)
  90 + .lt(StringUtils.isNotEmpty(createdEnd), Location::getCreated, createdEnd)
  91 + .eq(Location::getWarehouseCode, ShiroUtils.getWarehouseCode())
  92 + .eq(StringUtils.isNotEmpty(location.getCode()), Location::getCode, location.getCode())
  93 + .eq(StringUtils.isNotEmpty(location.getName()), Location::getName, location.getName())
  94 + .eq(StringUtils.isNotEmpty(location.getContainerCode()), Location::getContainerCode, location.getContainerCode())
  95 + .eq(StringUtils.isNotNull(location.getSystemCreated()), Location::getStatus, location.getStatus())
  96 + .eq(StringUtils.isNotEmpty(location.getZoneCode()), Location::getZoneCode, location.getZoneCode())
  97 + .eq(StringUtils.isNotNull(location.getIRow()), Location::getIRow, location.getIRow())
  98 + .eq(StringUtils.isNotNull(location.getIColumn()), Location::getIColumn, location.getIColumn())
  99 + .eq(StringUtils.isNotNull(location.getIGrid()), Location::getIGrid, location.getIGrid())
  100 + .eq(StringUtils.isNotNull(location.getILayer()), Location::getILayer, location.getILayer())
  101 + .eq(StringUtils.isNotEmpty(location.getStatus()), Location::getStatus, location.getStatus())
  102 + .eq(StringUtils.isNotEmpty(location.getLocationType()), Location::getLocationType, location.getLocationType())
  103 + .eq(Location::getDeleted, false)
  104 + .orderByDesc(Location::getId);
  105 +
  106 + if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) {
  107 + /*使用分页查询*/
  108 + Page<Location> page = new Page<>(pageNum, pageSize);
  109 + IPage<Location> iPage = locationService.page(page, lambdaQueryWrapper);
  110 + return getMpDataTable(iPage.getRecords(), iPage.getTotal());
  111 + } else {
  112 + List<Location> list = locationService.list(lambdaQueryWrapper);
  113 + return getDataTable(list);
  114 + }
  115 + }
  116 +
  117 + /**
  118 + * 查询库位列表
  119 + */
  120 + @Log(title = "配置-库存资料-库位管理", operating = "查看库位列表", action = BusinessType.GRANT)
  121 + @PostMapping("/getAllLocation")
  122 + @ResponseBody
  123 + public AjaxResult getAllLocation(String type) {
  124 + if (StringUtils.isEmpty(type)) {
  125 + return AjaxResult.error("type不能为空");
  126 + }
  127 +
  128 + return AjaxResult.success(locationService.getAllLocation(type));
124 129 }
125 130  
126   - return AjaxResult.success(locationService.getAllLocation(type));
127   - }
128   -
129   -
130   - /**
131   - * 新增库位
132   - */
133   - @GetMapping("/add")
134   - public String add () {
135   - return prefix + "/add";
136   - }
137   -
138   - /**
139   - * 新增保存库位
140   - */
141   - @ApiOperation(value = "新增库位", notes = "新增单个库位", httpMethod = "POST")
142   - @RequiresPermissions("config:location:add")
143   - @Log(title = "配置-库存资料-库位管理", operating = "新增库位", action = BusinessType.INSERT)
144   - @PostMapping("/add")
145   - @ResponseBody
146   - public AjaxResult addSave (Location location) {
147   - AjaxResult result = locationService.addsave(location);
148   - return result;
149   - }
150   -
151   -
152   - /**
153   - * 批量新增库位
154   - */
155   -
156   - @GetMapping("/addBatch")
157   - public String addBatch () {
158   - return prefix + "/addBatch";
159   - }
160   -
161   -
162   - /**
163   - * 批量新增保存库位
164   - */
165   - @RequiresPermissions("config:location:add")
166   - @ApiOperation(value = "新增库位", notes = "批量新增库位", httpMethod = "POST")
167   - @Log(title = "配置-库存资料-库位管理", operating = "新增库位", action = BusinessType.INSERT)
168   - @PostMapping("/addBatchSave")
169   - @ResponseBody
170   - public AjaxResult addBatchSave (String prefix, String firstRow, String lastRow, String firstColumn, String lastColumn, String firstLayer, String lastLayer,
171   - String firstGrid, String lastGrid, String roadway, String status, String zoneCode, String locationType, String high) {
172   -
173   - return toAjax(locationService.addBatchSave(prefix, Integer.parseInt(firstRow), Integer.parseInt(lastRow),
174   - Integer.parseInt(firstColumn), Integer.parseInt(lastColumn), Integer.parseInt(firstLayer), Integer.parseInt(lastLayer),
175   - Integer.parseInt(firstGrid), Integer.parseInt(lastGrid), roadway, status, zoneCode, locationType, high));
176   - }
177   -
178   - /**
179   - * 修改库位
180   - */
181   - @GetMapping("/edit/{id}")
182   - public String edit (@PathVariable("id") Integer id, ModelMap mmap) {
183   - Location location = locationService.getById(id);
184   - mmap.put("location", location);
185   - return prefix + "/edit";
186   - }
187   -
188   - /**
189   - * 修改物料
190   - */
191   - @GetMapping("/editBatch/{ids}")
192   - public String editBatch (@PathVariable("ids") String ids, ModelMap mmap) {
193   - mmap.put("ids", ids);
194   - return prefix + "/editBatch";
195   - }
196   -
197   - /**
198   - * 修改保存库位
199   - */
200   - @RequiresPermissions("config:location:edit")
201   - @ApiOperation(value = "修改库位", notes = "批量修改库位", httpMethod = "POST")
202   - @Log(title = "配置-库存资料-库位管理", operating = "修改库位", action = BusinessType.UPDATE)
203   - @PostMapping("/edit")
204   - @ResponseBody
205   - public AjaxResult editSave (Location location) {
206   - String containerCode = location.getContainerCode();
207   - if (StringUtils.isNotEmpty(containerCode)) {
208   - Container container = containerService.getContainerByCode(containerCode);
209   - if (container == null) {
210   - return AjaxResult.error("容器编码输入错误");
211   - }
  131 +
  132 + /**
  133 + * 新增库位
  134 + */
  135 + @GetMapping("/add")
  136 + public String add() {
  137 + return prefix + "/add";
212 138 }
213   - location.setLastUpdatedBy(ShiroUtils.getName());
214   - return toAjax(locationService.updateById(location));
215   - }
216   -
217   - /**
218   - * 修改保存物料
219   - */
220   - @ApiOperation(value = "批量修改库位", notes = "批量修改库位", httpMethod = "POST")
221   - @RequiresPermissions("config:location:edit")
222   - @Log(title = "通用-库位管理", operating = "批量修改库位", action = BusinessType.UPDATE)
223   - @PostMapping("/editBatchSave")
224   - @ResponseBody
225   - public AjaxResult editBatchSave (String ids, String materialAreaCode, Integer high, String status) {
226   - String[] idArray = Convert.toStrArray(ids);
227   - LambdaUpdateWrapper<Location> wrapper = Wrappers.lambdaUpdate();
228   - wrapper.in(Location::getId, idArray)
229   - .set(Location::getMaterialAreaCode, materialAreaCode)
230   - .set(Location::getHigh, high)
231   - .set(Location::getStatus, status);
232   - return toAjax(locationService.update(wrapper));
233   - }
234   -
235   - /**
236   - * 删除库位
237   - */
238   - @RequiresPermissions("config:location:remove")
239   - @Log(title = "配置库存资料-库位管理", operating = "删除库位", action = BusinessType.DELETE)
240   - @ApiOperation(value = "删除库位", notes = "批量删除库位", httpMethod = "POST")
241   - @PostMapping("/remove")
242   - @ResponseBody
243   - public AjaxResult remove (String ids) {
244   - if(StringUtils.isEmpty(ids)) {
245   - return AjaxResult.error("id不能为空");
  139 +
  140 + /**
  141 + * 新增保存库位
  142 + */
  143 + @ApiOperation(value = "新增库位", notes = "新增单个库位", httpMethod = "POST")
  144 + @RequiresPermissions("config:location:add")
  145 + @Log(title = "配置-库存资料-库位管理", operating = "新增库位", action = BusinessType.INSERT)
  146 + @PostMapping("/add")
  147 + @ResponseBody
  148 + public AjaxResult addSave(Location location) {
  149 + AjaxResult result = locationService.addsave(location);
  150 + return result;
246 151 }
247   - for (Integer id : Convert.toIntArray(ids)) {
248   - Location location = locationService.getById(id);
249   - if(StringUtils.isEmpty(location.getContainerCode())) {
250   - locationService.removeById(locationService.getById(id));
251   - } else {
252   - return AjaxResult.error("库位(" + location.getCode() + ")不是空,或者有容器,不能删除成功!");
253   - }
  152 +
  153 +
  154 + /**
  155 + * 批量新增库位
  156 + */
  157 +
  158 + @GetMapping("/addBatch")
  159 + public String addBatch() {
  160 + return prefix + "/addBatch";
254 161 }
255   - return AjaxResult.success("删除成功!");
256   - }
257   -
258   - /**
259   - * 查询库位列表
260   - */
261   - @Log(title = "配置-库存资料-库位管理", operating = "查看库位列表", action = BusinessType.GRANT)
262   - @PostMapping("/getLocationInfo")
263   - @ResponseBody
264   - public AjaxResult getLocationInfo (String type, String row, String line, String layer, String grid) {
265   - if(StringUtils.isEmpty(type)) {
266   - return AjaxResult.error("type不能为空");
  162 +
  163 +
  164 + /**
  165 + * 批量新增保存库位
  166 + */
  167 + @RequiresPermissions("config:location:add")
  168 + @ApiOperation(value = "新增库位", notes = "批量新增库位", httpMethod = "POST")
  169 + @Log(title = "配置-库存资料-库位管理", operating = "新增库位", action = BusinessType.INSERT)
  170 + @PostMapping("/addBatchSave")
  171 + @ResponseBody
  172 + public AjaxResult addBatchSave(String prefix, String firstRow, String lastRow, String firstColumn, String lastColumn, String firstLayer, String lastLayer,
  173 + String firstGrid, String lastGrid, String roadway, String status, String zoneCode, String locationType, String high) {
  174 +
  175 + return toAjax(locationService.addBatchSave(prefix, Integer.parseInt(firstRow), Integer.parseInt(lastRow),
  176 + Integer.parseInt(firstColumn), Integer.parseInt(lastColumn), Integer.parseInt(firstLayer), Integer.parseInt(lastLayer),
  177 + Integer.parseInt(firstGrid), Integer.parseInt(lastGrid), roadway, status, zoneCode, locationType, high));
267 178 }
268 179  
269   - /* 查询库位信息*/
270   - LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery();
271   - locationLambdaQueryWrapper.eq(StringUtils.isNotEmpty(row), Location::getIRow, row)
272   - .eq(StringUtils.isNotEmpty(line), Location::getIColumn, line)
273   - .eq(StringUtils.isNotEmpty(layer), Location::getILayer, layer)
274   - .eq(Location::getIGrid, 1) //
275   - .eq(StringUtils.isNotEmpty(type), Location::getLocationType, type)
276   - .eq(Location::getWarehouseCode, ShiroUtils.getWarehouseCode())
277   - .eq(StringUtils.isNotEmpty(type), Location::getZoneCode, type);
278   - List<Location> locations = locationService.list(locationLambdaQueryWrapper);
279   - List<Location> locationList = new ArrayList<>();
280   -
281   - /* 查询库存明细*/
282   - LambdaQueryWrapper<InventoryDetail> inventoryDetailLambda = Wrappers.lambdaQuery();
283   - inventoryDetailLambda.eq(InventoryDetail::getWarehouseCode, ShiroUtils.getWarehouseCode());
284   - List<InventoryDetail> inventoryDetailList = inventoryDetailService.list(inventoryDetailLambda);
285   -
286   - for (Location location1 : locations) {
287   - InventoryDetail inventoryDetail = null;
288   - String materialName = null;
289   - for (InventoryDetail inventoryDetail2 : inventoryDetailList) {
290   - if(location1.getCode().equals(inventoryDetail2.getLocationCode())) {
291   - inventoryDetail = inventoryDetail2;
  180 + /**
  181 + * 修改库位
  182 + */
  183 + @GetMapping("/edit/{id}")
  184 + public String edit(@PathVariable("id") Integer id, ModelMap mmap) {
  185 + Location location = locationService.getById(id);
  186 + mmap.put("location", location);
  187 + return prefix + "/edit";
  188 + }
  189 +
  190 + /**
  191 + * 修改物料
  192 + */
  193 + @GetMapping("/editBatch/{ids}")
  194 + public String editBatch(@PathVariable("ids") String ids, ModelMap mmap) {
  195 + mmap.put("ids", ids);
  196 + return prefix + "/editBatch";
  197 + }
  198 +
  199 + /**
  200 + * 修改保存库位
  201 + */
  202 + @RequiresPermissions("config:location:edit")
  203 + @ApiOperation(value = "修改库位", notes = "批量修改库位", httpMethod = "POST")
  204 + @Log(title = "配置-库存资料-库位管理", operating = "修改库位", action = BusinessType.UPDATE)
  205 + @PostMapping("/edit")
  206 + @ResponseBody
  207 + public AjaxResult editSave(Location location) {
  208 + String containerCode = location.getContainerCode();
  209 + if (StringUtils.isNotEmpty(containerCode)) {
  210 + Container container = containerService.getContainerByCode(containerCode);
  211 + if (container == null) {
  212 + return AjaxResult.error("容器编码输入错误");
  213 + }
292 214 }
293   - }
294   - List<InventoryDetail> inventoryDetails = inventoryDetailList.stream().filter(inventoryDetail1 ->
295   - inventoryDetail1.getLocationCode().equals(location1.getCode())).collect(Collectors.toList());
296   -
297   - int userDef3 = 0;
298   - String status = location1.getStatus();
299   - String containerCode = location1.getContainerCode();
300   - List<String> materialNameList = inventoryDetails.stream().map(InventoryDetail::getMaterialName).collect(Collectors.toList());
301   - List<String> batchList = inventoryDetails.stream().map(InventoryDetail::getBatch).collect(Collectors.toList());
302   - List<String> materialCodeList = inventoryDetails.stream().map(InventoryDetail::getMaterialCode).collect(Collectors.toList());
303   - List<BigDecimal> qtyList = inventoryDetails.stream().map(InventoryDetail::getQty).collect(Collectors.toList());
304   - if(QuantityConstant.STATUS_LOCATION_EMPTY.equals(status)) {
305   - if(StringUtils.isEmpty(containerCode)) {
306   - userDef3 = LocationStatus.IDLE_EMPTY_LOCATION;
307   - } else {
308   - if(inventoryDetail == null) {
309   - userDef3 = LocationStatus.IDLE_EMPTY_CONTAINER;
310   - } else {
311   - location1.setMaterialName(materialNameList);
312   - location1.setMaterialCode(materialCodeList);
313   - location1.setBatch(batchList);
314   - location1.setQty(qtyList);
315   - userDef3 = LocationStatus.IDLE_FULL_CONTAINER;
316   - }
  215 + location.setLastUpdatedBy(ShiroUtils.getName());
  216 + return toAjax(locationService.updateById(location));
  217 + }
  218 +
  219 + /**
  220 + * 修改保存物料
  221 + */
  222 + @ApiOperation(value = "批量修改库位", notes = "批量修改库位", httpMethod = "POST")
  223 + @RequiresPermissions("config:location:edit")
  224 + @Log(title = "通用-库位管理", operating = "批量修改库位", action = BusinessType.UPDATE)
  225 + @PostMapping("/editBatchSave")
  226 + @ResponseBody
  227 + public AjaxResult editBatchSave(String ids, String materialAreaCode, Integer high, String status) {
  228 + String[] idArray = Convert.toStrArray(ids);
  229 + LambdaUpdateWrapper<Location> wrapper = Wrappers.lambdaUpdate();
  230 + wrapper.in(Location::getId, idArray)
  231 + .set(Location::getMaterialAreaCode, materialAreaCode)
  232 + .set(Location::getHigh, high)
  233 + .set(Location::getStatus, status);
  234 + return toAjax(locationService.update(wrapper));
  235 + }
  236 +
  237 + /**
  238 + * 删除库位
  239 + */
  240 + @RequiresPermissions("config:location:remove")
  241 + @Log(title = "配置库存资料-库位管理", operating = "删除库位", action = BusinessType.DELETE)
  242 + @ApiOperation(value = "删除库位", notes = "批量删除库位", httpMethod = "POST")
  243 + @PostMapping("/remove")
  244 + @ResponseBody
  245 + public AjaxResult remove(String ids) {
  246 + if (StringUtils.isEmpty(ids)) {
  247 + return AjaxResult.error("id不能为空");
317 248 }
318   - } else if(QuantityConstant.STATUS_LOCATION_LOCK.equals(status)) {
319   - if(StringUtils.isEmpty(containerCode)) {
320   - userDef3 = LocationStatus.LOCK_EMPTY_LOCATION;
321   - } else {
322   - if(inventoryDetail == null) {
323   - userDef3 = LocationStatus.LOCK_EMPTY_CONTAINER;
324   - } else {
325   - location1.setMaterialName(materialNameList);
326   - location1.setMaterialCode(materialCodeList);
327   - location1.setBatch(batchList);
328   - location1.setQty(qtyList);
329   - userDef3 = LocationStatus.LOCK_FULL_CONTAINER;
330   - }
  249 + for (Integer id : Convert.toIntArray(ids)) {
  250 + Location location = locationService.getById(id);
  251 + if (StringUtils.isEmpty(location.getContainerCode())) {
  252 + locationService.removeById(locationService.getById(id));
  253 + } else {
  254 + return AjaxResult.error("库位(" + location.getCode() + ")不是空,或者有容器,不能删除成功!");
  255 + }
331 256 }
332   - }
  257 + return AjaxResult.success("删除成功!");
  258 + }
333 259  
334   - if(location1.getDeleted()) {
335   - if(StringUtils.isEmpty(containerCode)) {
336   - userDef3 = LocationStatus.DISABLE_EMPTY_LOCATION;
337   - } else {
338   - if(inventoryDetail == null) {
339   - userDef3 = LocationStatus.DISABLE_EMPTY_CONTAINER;
340   - } else {
341   - location1.setMaterialName(materialNameList);
342   - location1.setMaterialCode(materialCodeList);
343   - location1.setBatch(batchList);
344   - location1.setQty(qtyList);
345   - userDef3 = LocationStatus.DISABLE_FULL_CONTAINER;
346   - }
  260 + /**
  261 + * 查询库位列表
  262 + */
  263 + @Log(title = "配置-库存资料-库位管理", operating = "查看库位列表", action = BusinessType.GRANT)
  264 + @PostMapping("/getLocationInfo")
  265 + @ResponseBody
  266 + public AjaxResult getLocationInfo(String type, String row, String line, String layer, String grid) {
  267 + if (StringUtils.isEmpty(type)) {
  268 + return AjaxResult.error("type不能为空");
347 269 }
348   - }
349 270  
350   - location1.setUserDef3(String.valueOf(userDef3));
351   - locationList.add(location1);
  271 + /* 查询库位信息*/
  272 + LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery();
  273 + locationLambdaQueryWrapper.eq(StringUtils.isNotEmpty(row), Location::getIRow, row)
  274 + .eq(StringUtils.isNotEmpty(line), Location::getIColumn, line)
  275 + .eq(StringUtils.isNotEmpty(layer), Location::getILayer, layer)
  276 + .eq(Location::getIGrid, 1) //
  277 + .eq(StringUtils.isNotEmpty(type), Location::getLocationType, type)
  278 + .eq(Location::getWarehouseCode, ShiroUtils.getWarehouseCode())
  279 + .eq(StringUtils.isNotEmpty(type), Location::getZoneCode, type);
  280 + List<Location> locations = locationService.list(locationLambdaQueryWrapper);
  281 + List<Location> locationList = new ArrayList<>();
  282 +
  283 + /* 查询库存明细*/
  284 + LambdaQueryWrapper<InventoryDetail> inventoryDetailLambda = Wrappers.lambdaQuery();
  285 + inventoryDetailLambda.eq(InventoryDetail::getWarehouseCode, ShiroUtils.getWarehouseCode());
  286 + List<InventoryDetail> inventoryDetailList = inventoryDetailService.list(inventoryDetailLambda);
  287 +
  288 + for (Location location1 : locations) {
  289 + InventoryDetail inventoryDetail = null;
  290 + String materialName = null;
  291 + for (InventoryDetail inventoryDetail2 : inventoryDetailList) {
  292 + if (location1.getCode().equals(inventoryDetail2.getLocationCode())) {
  293 + inventoryDetail = inventoryDetail2;
  294 + }
  295 + }
  296 + List<InventoryDetail> inventoryDetails = inventoryDetailList.stream().filter(inventoryDetail1 ->
  297 + inventoryDetail1.getLocationCode().equals(location1.getCode())).collect(Collectors.toList());
  298 +
  299 + int userDef3 = 0;
  300 + String status = location1.getStatus();
  301 + String containerCode = location1.getContainerCode();
  302 + List<String> materialNameList = inventoryDetails.stream().map(InventoryDetail::getMaterialName).collect(Collectors.toList());
  303 + List<String> batchList = inventoryDetails.stream().map(InventoryDetail::getBatch).collect(Collectors.toList());
  304 + List<String> materialCodeList = inventoryDetails.stream().map(InventoryDetail::getMaterialCode).collect(Collectors.toList());
  305 + List<BigDecimal> qtyList = inventoryDetails.stream().map(InventoryDetail::getQty).collect(Collectors.toList());
  306 + if (QuantityConstant.STATUS_LOCATION_EMPTY.equals(status)) {
  307 + if (StringUtils.isEmpty(containerCode)) {
  308 + userDef3 = LocationStatus.IDLE_EMPTY_LOCATION;
  309 + } else {
  310 + if (inventoryDetail == null) {
  311 + userDef3 = LocationStatus.IDLE_EMPTY_CONTAINER;
  312 + } else {
  313 + location1.setMaterialName(materialNameList);
  314 + location1.setMaterialCode(materialCodeList);
  315 + location1.setBatch(batchList);
  316 + location1.setQty(qtyList);
  317 + userDef3 = LocationStatus.IDLE_FULL_CONTAINER;
  318 + }
  319 + }
  320 + } else if (QuantityConstant.STATUS_LOCATION_LOCK.equals(status)) {
  321 + if (StringUtils.isEmpty(containerCode)) {
  322 + userDef3 = LocationStatus.LOCK_EMPTY_LOCATION;
  323 + } else {
  324 + if (inventoryDetail == null) {
  325 + userDef3 = LocationStatus.LOCK_EMPTY_CONTAINER;
  326 + } else {
  327 + location1.setMaterialName(materialNameList);
  328 + location1.setMaterialCode(materialCodeList);
  329 + location1.setBatch(batchList);
  330 + location1.setQty(qtyList);
  331 + userDef3 = LocationStatus.LOCK_FULL_CONTAINER;
  332 + }
  333 + }
  334 + }
  335 +
  336 + if (location1.getDeleted()) {
  337 + if (StringUtils.isEmpty(containerCode)) {
  338 + userDef3 = LocationStatus.DISABLE_EMPTY_LOCATION;
  339 + } else {
  340 + if (inventoryDetail == null) {
  341 + userDef3 = LocationStatus.DISABLE_EMPTY_CONTAINER;
  342 + } else {
  343 + location1.setMaterialName(materialNameList);
  344 + location1.setMaterialCode(materialCodeList);
  345 + location1.setBatch(batchList);
  346 + location1.setQty(qtyList);
  347 + userDef3 = LocationStatus.DISABLE_FULL_CONTAINER;
  348 + }
  349 + }
  350 + }
  351 +
  352 + location1.setUserDef3(String.valueOf(userDef3));
  353 + locationList.add(location1);
  354 + }
  355 + return AjaxResult.success(locations);
352 356 }
353   - return AjaxResult.success(locations);
354   - }
355 357  
356 358  
357   - @Log(title = "配置-库存资料-库位条码", operating = "库位条码打印", action = BusinessType.OTHER)
358   - // @ResponseBody // 错误1ajax是json数据而没有添加该注解返回值不为json所以不能够返回common.ajaxSetup.textStatus= "parsererror"报错
359   - @GetMapping("/print/{ids}")
360   - public void print (@PathVariable("ids") Integer[] ids, ModelMap mmap) // arg1:物料id arg2:会话对象不需要直接返回
361   - {
362   - print.jasperPrint(ids, prefix);// 不用返回json打印
363   - }
  359 + @Log(title = "配置-库存资料-库位条码", operating = "库位条码打印", action = BusinessType.OTHER)
  360 + // @ResponseBody // 错误1ajax是json数据而没有添加该注解返回值不为json所以不能够返回common.ajaxSetup.textStatus= "parsererror"报错
  361 + @GetMapping("/print/{ids}")
  362 + public void print(@PathVariable("ids") Integer[] ids, ModelMap mmap) // arg1:物料id arg2:会话对象不需要直接返回
  363 + {
  364 + print.jasperPrint(ids, prefix);// 不用返回json打印
  365 + }
364 366  
  367 + @Resource
  368 + private ILocationIdleService iLocationIdleService;
365 369  
366 370 @Log(title = "监控-库位空闲监控-库位管理", operating = "查看库位空闲结果", action = BusinessType.GRANT)
367 371 @PostMapping("/getIdleLocation")
368 372 @ResponseBody
369   - public AjaxResult<?> getIdleLocation() {
370   - return AjaxResult.success(locationService.getIdleLocation());
  373 + public TableDataInfo getIdleLocation(LocationIdle locationIdle) {
  374 + // 同步数据
  375 + locationService.getIdleLocation();
  376 + // 查询
  377 + LambdaQueryWrapper<LocationIdle> lambdaQueryWrapper = Wrappers.lambdaQuery();
  378 + lambdaQueryWrapper
  379 + .eq(StringUtils.isNotNull(locationIdle.getRoadway()), LocationIdle::getRoadway, locationIdle.getRoadway());
  380 + PageDomain pageDomain = TableSupport.buildPageRequest();
  381 + Integer pageNum = pageDomain.getPageNum();
  382 + Integer pageSize = pageDomain.getPageSize();
  383 + if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) {
  384 + /*使用分页查询*/
  385 + Page<LocationIdle> page = new Page<>(pageNum, pageSize);
  386 + IPage<LocationIdle> iPage = iLocationIdleService.page(page, lambdaQueryWrapper);
  387 + return getMpDataTable(iPage.getRecords(), iPage.getTotal());
  388 + } else {
  389 + List<LocationIdle> list = iLocationIdleService.list(lambdaQueryWrapper);
  390 + return getDataTable(list);
  391 + }
371 392 }
372 393 }
... ...
src/main/java/com/huaheng/pc/config/location/domain/bo/LocationIdleBO.java
1 1 package com.huaheng.pc.config.location.domain.bo;
2 2  
3 3 import io.swagger.annotations.ApiModelProperty;
  4 +import io.swagger.models.auth.In;
4 5 import lombok.Builder;
5 6 import lombok.Data;
6 7  
... ... @@ -18,6 +19,8 @@ public class LocationIdleBO implements Serializable {
18 19 private String ilayer;
19 20 @ApiModelProperty(value = "巷道")
20 21 private String roadway;
  22 + @ApiModelProperty(value = "高低库位")
  23 + private Integer high;
21 24 @ApiModelProperty(value = "行数")
22 25 private Integer irow;
23 26 @ApiModelProperty(value = "空闲数")
... ...
src/main/java/com/huaheng/pc/config/location/domain/vo/LocationIdleInfoVO.java 0 → 100644
  1 +package com.huaheng.pc.config.location.domain.vo;
  2 +
  3 +import io.swagger.annotations.ApiModelProperty;
  4 +import lombok.Builder;
  5 +import lombok.Data;
  6 +
  7 +import java.io.Serializable;
  8 +
  9 +/**
  10 + * @author puff
  11 + * @date 2023-06-25
  12 + */
  13 +@Data
  14 +@Builder
  15 +public class LocationIdleInfoVO implements Serializable {
  16 +
  17 + @ApiModelProperty(value = "当前行")
  18 + private Integer irow;
  19 + @ApiModelProperty(value = "低库位数量")
  20 + private Integer lowCount;
  21 + @ApiModelProperty(value = "高库位数量")
  22 + private Integer highCount;
  23 + @ApiModelProperty(value = "总共空闲库位数量")
  24 + private Integer allCount;
  25 +}
... ...
src/main/java/com/huaheng/pc/config/location/domain/vo/LocationIdleVO.java
... ... @@ -5,6 +5,7 @@ import lombok.Builder;
5 5 import lombok.Data;
6 6  
7 7 import java.io.Serializable;
  8 +import java.util.List;
8 9  
9 10 /**
10 11 * @author puff
... ... @@ -15,8 +16,6 @@ public class LocationIdleVO implements Serializable {
15 16  
16 17 @ApiModelProperty(value = "巷道")
17 18 private String roadway;
18   - @ApiModelProperty(value = "行数")
19   - private Integer irow;
20   - @ApiModelProperty(value = "空闲数")
21   - private Integer idleCount;
  19 + @ApiModelProperty(value = "空闲库位详情")
  20 + private List<LocationIdleInfoVO> idleList;
22 21 }
... ...
src/main/java/com/huaheng/pc/config/location/mapper/LocationMapper.java
... ... @@ -35,5 +35,9 @@ public interface LocationMapper extends BaseMapper&lt;Location&gt; {
35 35  
36 36 int updateStatusNew(@Param("code") String code, @Param("warehouseCode") String warehouseCode,@Param("status") String status, @Param("oldStatus") String oldStatus);
37 37  
  38 + /**
  39 + * 获取空闲库位
  40 + * @return
  41 + */
38 42 List<LocationIdleBO> getIdleLocation();
39 43 }
... ...
src/main/java/com/huaheng/pc/config/location/service/LocationService.java
... ... @@ -124,6 +124,6 @@ public interface LocationService extends IService&lt;Location&gt;{
124 124 * 查询空闲库位数量
125 125 * @return
126 126 */
127   - List<LocationIdleVO> getIdleLocation();
  127 + Void getIdleLocation();
128 128  
129 129 }
... ...
src/main/java/com/huaheng/pc/config/location/service/LocationServiceImpl.java
1 1 package com.huaheng.pc.config.location.service;
2 2  
3 3 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  4 +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 5 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
5 6 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
6 7 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
... ... @@ -10,15 +11,23 @@ import com.huaheng.common.exception.service.ServiceException;
10 11 import com.huaheng.common.utils.StringUtils;
11 12 import com.huaheng.common.utils.security.ShiroUtils;
12 13 import com.huaheng.framework.web.domain.AjaxResult;
  14 +import com.huaheng.framework.web.service.ConfigService;
  15 +import com.huaheng.framework.web.service.DictService;
13 16 import com.huaheng.pc.config.location.domain.Location;
14 17 import com.huaheng.pc.config.location.domain.LocationInfo;
15 18 import com.huaheng.pc.config.location.domain.bo.LocationIdleBO;
  19 +import com.huaheng.pc.config.location.domain.vo.LocationIdleInfoVO;
16 20 import com.huaheng.pc.config.location.domain.vo.LocationIdleVO;
17 21 import com.huaheng.pc.config.location.mapper.LocationMapper;
18 22 import com.huaheng.pc.config.locationType.domain.LocationType;
19 23 import com.huaheng.pc.config.locationType.service.LocationTypeService;
20 24 import com.huaheng.pc.config.zone.domain.Zone;
21 25 import com.huaheng.pc.config.zone.service.ZoneService;
  26 +import com.huaheng.pc.monitor.idle.domain.LocationIdle;
  27 +import com.huaheng.pc.monitor.idle.mapper.LocationIdleMapper;
  28 +import com.huaheng.pc.monitor.idle.service.ILocationIdleService;
  29 +import com.huaheng.pc.system.config.service.IConfigService;
  30 +import com.huaheng.pc.system.dict.service.IDictTypeService;
22 31 import com.huaheng.pc.task.taskHeader.service.TaskHeaderService;
23 32 import io.swagger.models.auth.In;
24 33 import org.springframework.stereotype.Service;
... ... @@ -42,6 +51,9 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
42 51 @Resource
43 52 private TaskHeaderService taskHeaderService;
44 53  
  54 + @Resource
  55 + private IConfigService configService;
  56 +
45 57 /**
46 58 * //新增库位,需要建立code,并判断是否重复
47 59 * 1. 库区和库位没有绝对关系。 先建立库区,然后在库区的位置进行建立库位类型。
... ... @@ -675,25 +687,66 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
675 687 return 0;
676 688 }
677 689  
  690 +
  691 + @Resource
  692 + private ILocationIdleService iLocationIdleService;
  693 + @Resource
  694 + private LocationIdleMapper locationIdleMapper;
  695 +
678 696 @Override
679   - public List<LocationIdleVO> getIdleLocation() {
  697 + public Void getIdleLocation() {
680 698 List<LocationIdleBO> idleBOList = locationMapper.getIdleLocation();
681   - return idleBOList.stream()
682   - .collect(Collectors.groupingBy(LocationIdleBO::getRoadway)) // 以巷道分组
683   - .entrySet().stream()
684   - .flatMap(entry -> entry.getValue().stream()
685   - .collect(Collectors.groupingBy(LocationIdleBO::getIrow)) // 获取当前巷道分组下的行级别数据
686   - .entrySet().stream()
687   - .map(rowEntry -> {
688   - Integer idleCount = rowEntry.getValue().stream()
689   - .mapToInt(LocationIdleBO::getIdleCount)
690   - .sum(); // 计算空闲库位数量
691   - LocationIdleVO idleInfo = new LocationIdleVO();
692   - idleInfo.setRoadway(entry.getKey());
693   - idleInfo.setIrow(rowEntry.getKey());
694   - idleInfo.setIdleCount(idleCount);
695   - return idleInfo;
696   - }))
697   - .collect(Collectors.toList());
  699 + List<LocationIdleVO> idleVOList = idleBOList.stream()
  700 + .collect(Collectors.groupingBy(LocationIdleBO::getRoadway))
  701 + .entrySet()
  702 + .stream()
  703 + .map(entry -> {
  704 + LocationIdleVO idleInfo = new LocationIdleVO();
  705 + idleInfo.setRoadway(entry.getKey());
  706 +
  707 + List<LocationIdleInfoVO> infoVOList = entry.getValue().stream()
  708 + .collect(Collectors.groupingBy(LocationIdleBO::getIrow))
  709 + .entrySet()
  710 + .stream()
  711 + .map(rowEntry -> {
  712 + List<LocationIdleBO> countList = rowEntry.getValue();
  713 + Map<Integer, Integer> countByAttributeMap = countList.stream()
  714 + .collect(Collectors.groupingBy(LocationIdleBO::getHigh, Collectors.summingInt(LocationIdleBO::getIdleCount)));
  715 +
  716 + int highCount = countByAttributeMap.getOrDefault(1, 0);
  717 + int lowCount = countByAttributeMap.getOrDefault(0, 0);
  718 + int allCount = highCount + lowCount;
  719 +
  720 + return LocationIdleInfoVO.builder()
  721 + .irow(rowEntry.getKey())
  722 + .highCount(highCount)
  723 + .lowCount(lowCount)
  724 + .allCount(allCount)
  725 + .build();
  726 + }).collect(Collectors.toList());
  727 +
  728 + idleInfo.setIdleList(infoVOList);
  729 + return idleInfo;
  730 + }).collect(Collectors.toList());
  731 +
  732 +
  733 + locationIdleMapper.deleteUserTemp();
  734 + List<LocationIdle> idleListBatch = new ArrayList<>();
  735 + String doubleForkReserveLocation = configService.selectConfigByKey("doubleForkReserveLocation");
  736 + idleVOList.forEach(resp ->{
  737 + String roadway = resp.getRoadway();
  738 + List<LocationIdleInfoVO> idleList = resp.getIdleList();
  739 + int hignCount = idleList.stream().mapToInt(LocationIdleInfoVO::getHighCount).sum();
  740 + int lowCount = idleList.stream().mapToInt(LocationIdleInfoVO::getLowCount).sum();
  741 + int allCount = idleList.stream().mapToInt(LocationIdleInfoVO::getAllCount).sum();
  742 + LocationIdle locationIdle = new LocationIdle();
  743 + locationIdle.setRoadway(Integer.valueOf(roadway));
  744 + locationIdle.setAllCount(allCount - (Integer.parseInt(doubleForkReserveLocation) * 2));
  745 + locationIdle.setHighCount(hignCount - Integer.parseInt(doubleForkReserveLocation));
  746 + locationIdle.setLowCount(lowCount - Integer.parseInt(doubleForkReserveLocation));
  747 + idleListBatch.add(locationIdle);
  748 + });
  749 + iLocationIdleService.saveBatch(idleListBatch);
  750 + return null;
698 751 }
699 752 }
... ...
src/main/java/com/huaheng/pc/monitor/idle/domain/LocationIdle.java 0 → 100644
  1 +package com.huaheng.pc.monitor.idle.domain;
  2 +
  3 +import com.baomidou.mybatisplus.annotation.IdType;
  4 +import com.baomidou.mybatisplus.annotation.TableField;
  5 +import com.baomidou.mybatisplus.annotation.TableId;
  6 +import com.baomidou.mybatisplus.annotation.TableName;
  7 +import lombok.Builder;
  8 +import lombok.Data;
  9 +import org.apache.commons.lang3.builder.ToStringBuilder;
  10 +import org.apache.commons.lang3.builder.ToStringStyle;
  11 +import io.swagger.annotations.ApiModelProperty;
  12 +
  13 +import javax.validation.constraints.*;
  14 +import java.io.Serializable;
  15 +import java.math.BigDecimal;
  16 +import java.util.Date;
  17 +
  18 +/**
  19 + * 空闲库位数量表 location_idle
  20 + *
  21 + * @author huaheng
  22 + * @date 2023-06-25
  23 + */
  24 +@TableName(value = "location_idle")
  25 +@Data
  26 +public class LocationIdle implements Serializable {
  27 + private static final long serialVersionUID = 1L;
  28 +
  29 + /**
  30 + * 参数主键
  31 + */
  32 + @TableId(value = "id", type = IdType.AUTO)
  33 + private Long id;
  34 + /**
  35 + * 巷道
  36 + */
  37 + @TableField(value = "roadway")
  38 + private Integer roadway;
  39 + /**
  40 + * 空闲总数
  41 + */
  42 + @TableField(value = "allCount")
  43 + private Integer allCount;
  44 + /**
  45 + * 高库位数量
  46 + */
  47 + @TableField(value = "highCount")
  48 + private Integer highCount;
  49 + /**
  50 + * 低库位数量
  51 + */
  52 + @TableField(value = "lowCount")
  53 + private Integer lowCount;
  54 + /**
  55 + * 第几行
  56 + */
  57 + @TableField(value = "irow")
  58 + private Integer irow;
  59 +
  60 +}
... ...
src/main/java/com/huaheng/pc/monitor/idle/mapper/LocationIdleMapper.java 0 → 100644
  1 +package com.huaheng.pc.monitor.idle.mapper;
  2 +
  3 +import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  4 +import com.huaheng.pc.monitor.idle.domain.LocationIdle;
  5 +import org.apache.ibatis.annotations.Mapper;
  6 +import org.apache.ibatis.annotations.Update;
  7 +
  8 +import java.util.List;
  9 +
  10 +/**
  11 + * 空闲库位数量 数据层
  12 + *
  13 + * @author huaheng
  14 + * @date 2023-06-25
  15 + */
  16 +@Mapper
  17 +public interface LocationIdleMapper extends BaseMapper<LocationIdle> {
  18 +
  19 + /**
  20 + * 每次调用时执行清空操作
  21 + */
  22 + @Update("truncate table location_idle")
  23 + void deleteUserTemp();
  24 +}
  25 +
... ...
src/main/java/com/huaheng/pc/monitor/idle/service/ILocationIdleService.java 0 → 100644
  1 +package com.huaheng.pc.monitor.idle.service;
  2 +
  3 +import com.baomidou.mybatisplus.extension.service.IService;
  4 +import com.huaheng.pc.monitor.idle.domain.LocationIdle;
  5 +
  6 +import java.util.List;
  7 +
  8 +/**
  9 + * 空闲库位数量 服务层
  10 + *
  11 + * @author huaheng
  12 + * @date 2023-06-25
  13 + */
  14 +public interface ILocationIdleService extends IService<LocationIdle> {
  15 +
  16 +}
  17 +
  18 +
... ...
src/main/java/com/huaheng/pc/monitor/idle/service/impl/LocationIdleServiceImpl.java 0 → 100644
  1 +package com.huaheng.pc.monitor.idle.service.impl;
  2 +
  3 +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  4 +import com.huaheng.pc.monitor.idle.domain.LocationIdle;
  5 +import com.huaheng.pc.monitor.idle.mapper.LocationIdleMapper;
  6 +import com.huaheng.pc.monitor.idle.service.ILocationIdleService;
  7 +import org.springframework.stereotype.Service;
  8 +
  9 +
  10 +/**
  11 + * 空闲库位数量 服务层实现
  12 + *
  13 + * @author huaheng
  14 + * @date 2023-06-25
  15 + */
  16 +@Service
  17 +public class LocationIdleServiceImpl extends ServiceImpl<LocationIdleMapper, LocationIdle> implements ILocationIdleService {
  18 +
  19 +}
... ...
src/main/java/com/huaheng/pc/monitor/locationstatus/controller/IdleController.java 0 → 100644
  1 +package com.huaheng.pc.monitor.locationstatus.controller;
  2 +
  3 +import com.huaheng.framework.web.controller.BaseController;
  4 +import org.apache.shiro.authz.annotation.RequiresPermissions;
  5 +import org.springframework.stereotype.Controller;
  6 +import org.springframework.web.bind.annotation.GetMapping;
  7 +import org.springframework.web.bind.annotation.RequestMapping;
  8 +
  9 +/**
  10 + * @author justshitver
  11 + */
  12 +@Controller
  13 +@RequestMapping("/monitor/idleLocation")
  14 +public class IdleController extends BaseController {
  15 +
  16 + private String prefix = "config/location";
  17 +
  18 + @RequiresPermissions("monitor:idleLocation:view")
  19 + @GetMapping()
  20 + public String locationStatus() {
  21 + return prefix + "/idleLocation";
  22 + }
  23 +
  24 +}
... ...
src/main/resources/mybatis/config/LocationMapper.xml
... ... @@ -36,6 +36,7 @@
36 36 <resultMap id="BaseResultLocationIdleBOMap" type="com.huaheng.pc.config.location.domain.bo.LocationIdleBO">
37 37 <result column="ilayer" jdbcType="VARCHAR" property="ilayer" />
38 38 <result column="roadway" jdbcType="VARCHAR" property="roadway" />
  39 + <result column="high" jdbcType="INTEGER" property="high"/>
39 40 <result column="irow" jdbcType="INTEGER" property="irow" />
40 41 <result column="count" jdbcType="INTEGER" property="idleCount" />
41 42 </resultMap>
... ... @@ -56,8 +57,8 @@
56 57 </select>
57 58  
58 59 <select id="getIdleLocation" resultMap="BaseResultLocationIdleBOMap">
59   - select ilayer ,roadway, irow, COUNT(*) AS idleCount
60   - FROM location
  60 + SELECT ilayer, roadway, high, irow, COUNT(*) AS count
  61 + FROM wms_shandonghaiwang.location
61 62 WHERE area = '1' -- 区域
62 63 AND warehouseCode = 'CS0001' -- 仓库
63 64 AND roadway IN ('1', '2', '3', '4') -- 巷道
... ... @@ -65,7 +66,7 @@
65 66 AND high IN (0, 1) -- 0 是低库位,1 是高库位
66 67 AND locationType IN ('L') -- 货位类型
67 68 AND containerCode = '' -- 容器编码
68   - GROUP BY ilayer, irow
  69 + GROUP BY ilayer, roadway, high, irow
69 70 ORDER BY ilayer, irow;
70 71 </select>
71 72  
... ...
src/main/resources/mybatis/monitor/LocationIdleMapper.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8" ?>
  2 +<!DOCTYPE mapper
  3 +PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4 +"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5 +<mapper namespace="com.huaheng.pc.monitor.idle.mapper.LocationIdleMapper">
  6 +
  7 + <resultMap type="com.huaheng.pc.monitor.idle.domain.LocationIdle" id="locationIdleResult">
  8 + <result property="id" column="id" />
  9 + <result property="roadway" column="roadway" />
  10 + <result property="allCount" column="allCount" />
  11 + <result property="highCount" column="highCount" />
  12 + <result property="lowCount" column="lowCount" />
  13 + <result property="irow" column="irow" />
  14 + </resultMap>
  15 + <sql id="selectlocationIdleVo">
  16 + select id, roadway, allCount, highCount, lowCount, irow from location_idle
  17 + </sql>
  18 +
  19 +</mapper>
0 20 \ No newline at end of file
... ...
src/main/resources/templates/config/location/idleLocation.html 0 → 100644
  1 +<!DOCTYPE HTML>
  2 +<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
  3 +<meta charset="utf-8">
  4 +<head th:include="include :: header"></head>
  5 +<body class="gray-bg">
  6 +<div class="container-div">
  7 + <div class="col-sm-12 select-info">
  8 + <form id="formId">
  9 + <div class="select-list">
  10 + <ul>
  11 + <li>
  12 + <label>巷道:</label>
  13 + <input type="text" name="roadway"/>
  14 + </li>
  15 + <li>
  16 + <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
  17 + class="fa fa-search"></i>&nbsp;搜索</a>
  18 + <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
  19 + class="fa fa-refresh"></i>&nbsp;重置</a>
  20 + </li>
  21 + </ul>
  22 + </div>
  23 + </form>
  24 + </div>
  25 +
  26 + <div class="col-sm-12 select-info table-striped">
  27 + <table id="bootstrap-table" data-mobile-responsive="true"></table>
  28 + </div>
  29 +</div>
  30 +<div th:include="include :: footer"></div>
  31 +<script th:inline="javascript">
  32 + var prefix = ctx + "config/location"
  33 + $(function () {
  34 + var options = {
  35 + url: prefix + "/getIdleLocation",
  36 + modalName: "空闲库位数量",
  37 + columns: [{
  38 + checkbox: true
  39 + },
  40 + {
  41 + field: 'id',
  42 + title: '参数主键',
  43 + visible: false
  44 + },
  45 + {
  46 + field: 'roadway',
  47 + title: '巷道'
  48 + },
  49 + // {
  50 + // field: 'irow',
  51 + // title: '第几行'
  52 + // },
  53 + {
  54 + field: 'allCount',
  55 + title: '空库库位(每个巷道预留的8个高库位和8个低库位)'
  56 + },
  57 + {
  58 + field: 'highCount',
  59 + title: '高库位数量'
  60 + },
  61 + {
  62 + field: 'lowCount',
  63 + title: '低库位数量'
  64 + }]
  65 + };
  66 + $.table.init(options);
  67 + });
  68 +</script>
  69 +</body>
  70 +</html>
0 71 \ No newline at end of file
... ...
src/main/resources/templates/inventory/cyclecountDetail/add.html
... ... @@ -14,9 +14,9 @@
14 14 <li>
15 15 <input type="hidden" id="cycleCountHeadCode" name="cycleCountHeadCode" th:value="${cycleCountHeadCode}" readonly="readonly"/>
16 16 </li>
17   - <li>
18   - 仓库:<input id="warehouseCode" type="text" name="warehouseCode" th:value="${warehouseCode}" readonly="readonly" />
19   - </li>
  17 +<!-- <li>-->
  18 +<!-- 仓库:<input id="warehouseCode" type="text" name="warehouseCode" th:value="${warehouseCode}" readonly="readonly" />-->
  19 +<!-- </li>-->
20 20 <li>
21 21 库位:<input id="locationCode" type="text" name="locationCode" />
22 22 </li>
... ... @@ -38,6 +38,8 @@
38 38 </div>
39 39 </form>
40 40 </div>
  41 +
  42 +
41 43 <div class="col-sm-12 select-info">
42 44 <a class="btn btn-success btn-sm" onclick="addDetails()" style="float: left; margin-top: 12px"
43 45 shiro:hasPermission="inventory:cyclecountDetail:add">
... ... @@ -45,6 +47,10 @@
45 47 <table id="bootstrap-table" class ="table table-bordered table-hover"></table>
46 48 </div>
47 49 </div>
  50 +
  51 +
  52 +
  53 +
48 54 <!--</div>-->
49 55 </div>
50 56 <div th:include="include::footer"></div>
... ... @@ -58,6 +64,8 @@
58 64 var report = [[${@permission.hasPermi('inventoryHeader:adjustHeader:report')}]];
59 65 var datas = [[${@dict.getType('sys_normal_disable')}]];
60 66 var inventoryStatus = [[${@dict.getType('inventorySts')}]];
  67 + var containerStatus = [[${@dict.getType('containerStatus')}]];
  68 + var zone =[[${@zone.getCode()}]];
61 69 /*var status2 = [[${@dict.getType('adjustType')}]];*/
62 70  
63 71 $(function () {
... ... @@ -68,7 +76,7 @@
68 76 modalName: "库存头",
69 77 sortName: "id",
70 78 sortOrder: "desc",
71   - pagination: false, //取消分页
  79 + pagination: true,
72 80 search: false,
73 81 showSearch: false,
74 82 showRefresh: false,
... ... @@ -85,17 +93,27 @@
85 93 {
86 94 field: 'id',
87 95 title: '库存头ID',
88   - sortable: true
  96 + // sortable: true
89 97 },
90 98 {
91   - field: 'warehouseCode',
92   - title: '仓库 ',
93   - visible: true
  99 + field: 'zoneCode',
  100 + title: '库区',
  101 + align: 'center',
  102 + formatter: function(value, row, index) {
  103 + var actions = [];
  104 + $.each(zone, function(index, dict) {
  105 + if (dict.code == value) {
  106 + actions.push("<span class='badge badge-info'>" + dict.name + "</span>");
  107 + return false;
  108 + }
  109 + });
  110 + return actions.join('');
  111 + }
94 112 },
95 113 {
96 114 field: 'companyCode',
97 115 title: ' 货主',
98   - visible: true
  116 + visible: false
99 117 },
100 118 {
101 119 field: 'locationCode',
... ... @@ -108,11 +126,15 @@
108 126 {
109 127 field: 'containerStatus',
110 128 title: ' 容器状态',
111   - visible: false
  129 + formatter: function (value, row, index) {
  130 + return $.table.selectDictLabel(containerStatus, value);
  131 + },
  132 + align: 'center',
112 133 },
113 134 {
114 135 field: 'totalWeight',
115   - title: ' 总重量'
  136 + title: ' 总重量',
  137 + visible: false
116 138 },
117 139 {
118 140 field: 'materialSkuQty',
... ... @@ -126,7 +148,7 @@
126 148 {
127 149 field: 'totalLines',
128 150 title: '总行',
129   - visible: false
  151 + visible: true
130 152 },
131 153 /*{
132 154 field: 'projectNos',
... ... @@ -145,7 +167,7 @@
145 167 {
146 168 field: 'locking',
147 169 title: ' 锁定',
148   - visible: true
  170 + visible: false
149 171 },
150 172 {
151 173 field: 'lockRemark',
... ... @@ -163,12 +185,12 @@
163 185 {
164 186 field: 'lastUpdated',
165 187 title: ' 更新时间',
166   - visible: false
  188 + visible: true
167 189 },
168 190 {
169 191 field: 'lastUpdatedBy',
170 192 title: ' 更新用户',
171   - visible: false
  193 + visible: true
172 194 },
173 195 {
174 196 field: 'userDef1',
... ... @@ -216,7 +238,7 @@
216 238 {
217 239 field: 'id',
218 240 title: '明细ID',
219   - sortable: true,
  241 + // sortable: true,
220 242 width: 80
221 243 },
222 244 {
... ... @@ -243,12 +265,12 @@
243 265 {
244 266 field: 'materialName',
245 267 title: '物料名称',
246   - width: 150
  268 + // width: 150
247 269 },
248 270 {
249 271 field: 'materialSpec',
250 272 title: '物料规格',
251   - visible: false
  273 + visible: true
252 274 },
253 275 {
254 276 field: 'materialUnit',
... ... @@ -264,7 +286,7 @@
264 286 {
265 287 field: 'taskQty',
266 288 title: '预定执行数量',
267   - visible: false,
  289 + visible: true,
268 290 width: 90
269 291 },
270 292 {
... ... @@ -278,11 +300,11 @@
278 300 visible: true,
279 301 width: 150
280 302 },
281   - {
282   - field: 'companyCode',
283   - title: '货主编码',
284   - width: 80
285   - },
  303 + // {
  304 + // field: 'companyCode',
  305 + // title: '货主编码',
  306 + // width: 80
  307 + // },
286 308 {
287 309 field: 'receiptDetailId',
288 310 title: '入库单明细ID',
... ... @@ -292,7 +314,7 @@
292 314 field: 'batch',
293 315 title: '批次',
294 316 sortable: false,
295   - visible: true
  317 + visible: false
296 318 },
297 319 {
298 320 field: 'lot',
... ... @@ -388,7 +410,7 @@
388 410 {
389 411 field: 'created',
390 412 title: '入库日期',
391   - sortable: true,
  413 + sortable: false,
392 414 visible: true,
393 415 width: 150
394 416 },
... ... @@ -442,7 +464,7 @@
442 464 success : function(data) {
443 465 if(data.code=="200"){
444 466 $.modal.closeLoading();
445   - $.modal.alertSuccess("添加盘点成功");
  467 + $.modal.alertSuccess("添加盤點成功");
446 468 $.table.refresh();
447 469 }else{
448 470 $.modal.closeLoading();
... ...