Commit 351fb9c00a4206883c6d749e5ddde753a39c950e

Authored by 易文鹏
1 parent cfba899f

feat: 将一厂二期5号巷道、二厂的自建单据库位、可燃物料和其他双伸位各自写一个方法实现分配库位逻辑。

src/main/java/com/huaheng/api/wcs/service/overrideHandle/OverrideHandleServiceImpl.java
... ... @@ -147,7 +147,7 @@ public class OverrideHandleServiceImpl implements OverrideHandleService {
147 147 }
148 148 }
149 149  
150   - String locationCode = locationAllocationService.allocation(high, area, roadWay, containerCode, frequencyLocation, onlyEmptyContainer, isSelfCreated, isFlammable, false, taskNo);
  150 + String locationCode = locationAllocationService.allocation(high, area, roadWay, containerCode, frequencyLocation, onlyEmptyContainer, isSelfCreated, isFlammable, taskNo);
151 151 if (StringUtils.isEmpty(locationCode)) {
152 152 return AjaxResult.error("没有库位可分配");
153 153 }
... ...
src/main/java/com/huaheng/api/wcs/service/taskAssignService/TaskAssignServiceImpl.java
... ... @@ -170,7 +170,7 @@ public class TaskAssignServiceImpl implements TaskAssignService {
170 170 }
171 171 //移库分配库位
172 172 String destinationLocationCode = locationAllocationService.allocation(insideLocation.getHigh(), insideLocation.getArea(), "5",
173   - containerCode, insideLocation.getFrequencyLocation(), insideLocation.getOnlyEmptyContainer(), isSelfCreated, isFlammable, true, "");
  173 + containerCode, insideLocation.getFrequencyLocation(), insideLocation.getOnlyEmptyContainer(), isSelfCreated, isFlammable, "");
174 174 if (StringUtils.isEmpty(destinationLocationCode)) {
175 175 return AjaxResult.error("移库没有剩余库位");
176 176 } else if (destinationLocationCode.length() > 10) {
... ...
src/main/java/com/huaheng/api/wcs/service/warecellAllocation/LocationAllocationService.java
... ... @@ -9,13 +9,15 @@ public interface LocationAllocationService {
9 9  
10 10  
11 11 String allocation(int high, String area, String roadWay, String containerCode, Integer frequencyLocation,
12   - Integer emptyContainerTask, Integer isSelfCreated, boolean isFlammable, boolean transfer, String taskNo);
  12 + Integer emptyContainerTask, Integer isSelfCreated, boolean isFlammable, String taskNo);
13 13  
14   - String fiveStacker(int high, String containerCode, boolean isFlammable, boolean transfer, String taskNo);
  14 + String fiveStacker(int high, String containerCode, boolean isFlammable, String taskNo);
15 15  
16 16 void setTemporaryLocationType(Location location, boolean isBigContainer);
17 17  
18   - String doubleRk(String area, String roadWay, int high, Integer frequencyLocation, Integer emptyContainerTask, boolean isFlammable);
  18 + String doubleRk(String roadWay, int high, Integer frequencyLocation, Integer emptyContainerTask, boolean isFlammable, String taskNo);
19 19  
20 20 String isSelfCreated(String roadWay, int high, Integer frequencyLocation);
  21 +
  22 + String isFlammable(String roadWay, int high, Integer frequencyLocation, String taskNo);
21 23 }
... ...
src/main/java/com/huaheng/api/wcs/service/warecellAllocation/LocationAllocationServiceImpl.java
... ... @@ -57,15 +57,17 @@ public class LocationAllocationServiceImpl implements LocationAllocationService
57 57 @Override
58 58 @Transactional(rollbackFor = Exception.class)
59 59 public String allocation(int high, String area, String roadWay, String containerCode, Integer frequencyLocation,
60   - Integer emptyContainerTask, Integer isSelfCreated, boolean isFlammable, boolean transfer, String taskNo) {
  60 + Integer emptyContainerTask, Integer isSelfCreated, boolean isFlammable, String taskNo) {
61 61  
62   - //二期5号巷道
63   - if (roadWay.equals(DYNAMIC_ROADWAY)) {
64   - return locationAllocationService.fiveStacker(high, containerCode, isFlammable, transfer, taskNo);
  62 +
  63 + if (roadWay.equals(DYNAMIC_ROADWAY)) {//二期5号巷道
  64 + return locationAllocationService.fiveStacker(high, containerCode, isFlammable, taskNo);
65 65 } else if (isSelfCreated == 1) { //二厂的自建单据库位
66 66 return locationAllocationService.isSelfCreated(roadWay, high, frequencyLocation);
  67 + } else if (isFlammable) { //可燃物料
  68 + return locationAllocationService.isFlammable(roadWay, high, frequencyLocation, taskNo);
67 69 } else {
68   - return locationAllocationService.doubleRk(area, roadWay, high, frequencyLocation, emptyContainerTask, isFlammable);
  70 + return locationAllocationService.doubleRk(roadWay, high, frequencyLocation, emptyContainerTask, isFlammable, taskNo);
69 71 }
70 72 }
71 73  
... ... @@ -74,7 +76,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService
74 76 //分配库位排序,(层-外侧-内侧-列)
75 77 @Override
76 78 @Transactional(rollbackFor = Exception.class)
77   - public String fiveStacker(int high, String containerCode, boolean isFlammable, boolean transfer, String taskNo) {
  79 + public String fiveStacker(int high, String containerCode, boolean isFlammable, String taskNo) {
78 80 boolean entry = false;//入库任务
79 81 TaskHeader taskHeader = taskHeaderService.getById(taskNo);
80 82 if (taskHeader != null) {//空托盘入库和整托入库
... ... @@ -249,7 +251,18 @@ public class LocationAllocationServiceImpl implements LocationAllocationService
249 251 */
250 252 @Override
251 253 @Transactional(rollbackFor = Exception.class)
252   - public String doubleRk(String area, String roadWay, int high, Integer frequencyLocation, Integer emptyContainerTask, boolean isFlammable) {
  254 + public String doubleRk(String roadWay, int high, Integer frequencyLocation, Integer emptyContainerTask, boolean isFlammable, String taskNo) {
  255 + boolean SORTINGSHIPMENT = false;//分拣任务回库不需要判断预留库位
  256 + TaskHeader taskHeader = taskHeaderService.getById(taskNo);
  257 + if (taskHeader != null) {
  258 + if (taskHeader.getTaskType().equals(TASK_TYPE_SORTINGSHIPMENT)) {
  259 + SORTINGSHIPMENT = true;
  260 + }
  261 + }
  262 + int reserveNumber = 0;
  263 + if (!SORTINGSHIPMENT) {
  264 + reserveNumber = getReserveNumber();
  265 + }
253 266 //如果是二厂的空托盘入库任务,优先分配空托盘库位,没有了再分配其他的库位
254 267 if (emptyContainerTask == 1) {
255 268 LambdaQueryWrapper<Location> wrapper = Wrappers.lambdaQuery();
... ... @@ -264,7 +277,6 @@ public class LocationAllocationServiceImpl implements LocationAllocationService
264 277 }
265 278 }
266 279  
267   - int reserveNumber = getReserveNumber();// 获取双伸位预留库位数
268 280 // 移除掉可用库位数小于预留库位数的巷道
269 281 LambdaQueryWrapper<Location> wrapper = Wrappers.lambdaQuery();
270 282 wrapper.eq(Location::getRoadway, roadWay)
... ... @@ -290,30 +302,11 @@ public class LocationAllocationServiceImpl implements LocationAllocationService
290 302 .eq(Location::getContainerCode, "")
291 303 .eq(Location::getSelfCreated, NO_TSELFCREATED)
292 304 .eq(Location::getOnlyEmptyContainer, NO_EMPTY_CONTAINER_LOCATION)
  305 + .orderByAsc(Location::getHigh)
  306 + .orderByAsc(Location::getILayer)
  307 + .orderByAsc(Location::getId)
293 308 .last(" limit 20");
294 309  
295   - //频繁库位
296   - String str;
297   - if (frequencyLocation == 1) {
298   - str = "frequencyLocation asc";
299   - //locationLambda.orderByAsc(Location::getFrequencyLocation); //升序
300   - } else if (frequencyLocation == 2) {
301   - //常用
302   - locationLambda.ge(Location::getFrequencyLocation, 2);//大于等于2
303   - str = "frequencyLocation asc";
304   - //locationLambda.orderByAsc(Location::getFrequencyLocation);
305   - } else {
306   - //不常用
307   - str = "frequencyLocation desc";
308   - //locationLambda.orderByDesc(Location::getFrequencyLocation);//倒序
309   - }
310   -
311   - //可燃物料
312   - if (isFlammable) {
313   - locationLambda.orderByAsc(Location::getILayer);
314   - } else {
315   - locationLambda.last("ORDER BY " + str + ", (CASE WHEN iLayer > 2 THEN iLayer ELSE iLayer + 20 END) ASC");
316   - }
317 310 List<Location> locationList = locationService.list(locationLambda);
318 311 List<Location> removeLocaationList = new ArrayList<>();
319 312 if (locationList != null && !locationList.isEmpty()) {
... ... @@ -338,25 +331,11 @@ public class LocationAllocationServiceImpl implements LocationAllocationService
338 331 .eq(Location::getContainerCode, "")
339 332 .eq(Location::getSelfCreated, NO_TSELFCREATED)
340 333 .eq(Location::getOnlyEmptyContainer, NO_EMPTY_CONTAINER_LOCATION)
  334 + .orderByAsc(Location::getHigh)
  335 + .orderByAsc(Location::getILayer)
  336 + .orderByAsc(Location::getId)
341 337 .last(" limit 20");
342 338  
343   - //频繁库位
344   - //if (frequencyLocation == 1) {
345   - // locationLambda.orderByAsc(Location::getFrequencyLocation); //升序
346   - //} else if (frequencyLocation == 2) {
347   - // //常用
348   - // locationLambda.ge(Location::getFrequencyLocation, 2);//大于等于2
349   - // locationLambda.orderByAsc(Location::getFrequencyLocation);
350   - //} else {
351   - // //不常用
352   - // locationLambda.orderByDesc(Location::getFrequencyLocation);//倒序
353   - //}
354   - //可燃物料(空托盘不用进来判断)
355   - if (isFlammable) {
356   - locationLambda.orderByAsc(Location::getILayer);
357   - } else {
358   - locationLambda.last("ORDER BY " + str + ", (CASE WHEN iLayer > 2 THEN iLayer ELSE iLayer + 20 END) ASC");
359   - }
360 339 locationList = locationService.list(locationLambda);
361 340 removeLocaationList = new ArrayList<>();
362 341 if (locationList != null && !locationList.isEmpty()) {
... ... @@ -378,13 +357,15 @@ public class LocationAllocationServiceImpl implements LocationAllocationService
378 357 return location.getCode();
379 358 }
380 359  
  360 +
381 361 //自建单据
382 362 @Override
383 363 public String isSelfCreated(String roadWay, int high, Integer frequencyLocation) {
384 364 int reserveNumber = getReserveNumber();// 获取双伸位预留库位数
385 365 // 移除掉可用库位数小于预留库位数的巷道
386 366 LambdaQueryWrapper<Location> wrapper = Wrappers.lambdaQuery();
387   - wrapper.eq(Location::getRoadway, roadWay)
  367 + wrapper
  368 + .eq(Location::getRoadway, roadWay)
388 369 .eq(Location::getStatus, STATUS_LOCATION_EMPTY)
389 370 .eq(Location::getHigh, high)
390 371 .eq(Location::getContainerCode, "")
... ... @@ -407,6 +388,9 @@ public class LocationAllocationServiceImpl implements LocationAllocationService
407 388 .eq(Location::getContainerCode, "")
408 389 .eq(Location::getSelfCreated, SELFCREATED)
409 390 .eq(Location::getOnlyEmptyContainer, NO_EMPTY_CONTAINER_LOCATION)
  391 + .orderByAsc(Location::getHigh)
  392 + .orderByAsc(Location::getILayer)
  393 + .orderByAsc(Location::getId)
410 394 .last(" limit 20");
411 395  
412 396  
... ... @@ -427,13 +411,17 @@ public class LocationAllocationServiceImpl implements LocationAllocationService
427 411 // 如果没有外侧库位可分配了,再查内侧的库位
428 412 if (locationList == null || locationList.isEmpty()) {
429 413 locationLambda = Wrappers.lambdaQuery();
430   - locationLambda.eq(StringUtils.isNotEmpty(roadWay), Location::getRoadway, roadWay)
  414 + locationLambda
  415 + .eq(StringUtils.isNotEmpty(roadWay), Location::getRoadway, roadWay)
431 416 .eq(Location::getStatus, STATUS_LOCATION_EMPTY)
432 417 .eq(Location::getHigh, high)
433 418 .eq(Location::getRowFlag, ROW_IN)
434 419 .eq(Location::getContainerCode, "")
435 420 .eq(Location::getSelfCreated, SELFCREATED)
436 421 .eq(Location::getOnlyEmptyContainer, NO_EMPTY_CONTAINER_LOCATION)
  422 + .orderByAsc(Location::getHigh)
  423 + .orderByAsc(Location::getILayer)
  424 + .orderByAsc(Location::getId)
437 425 .last(" limit 20");
438 426  
439 427 locationList = locationService.list(locationLambda);
... ... @@ -458,6 +446,97 @@ public class LocationAllocationServiceImpl implements LocationAllocationService
458 446 }
459 447  
460 448  
  449 + //可燃物料
  450 + @Override
  451 + public String isFlammable(String roadWay, int high, Integer frequencyLocation, String taskNo) {
  452 + int flammableLayer = 3;
  453 +
  454 + boolean SORTINGSHIPMENT = false;//分拣任务回库不需要判断预留库位
  455 + TaskHeader taskHeader = taskHeaderService.getById(taskNo);
  456 + if (taskHeader != null) {
  457 + if (taskHeader.getTaskType().equals(TASK_TYPE_SORTINGSHIPMENT)) {
  458 + SORTINGSHIPMENT = true;
  459 + }
  460 + }
  461 + int reserveNumber = 0;
  462 + if (!SORTINGSHIPMENT) {
  463 + reserveNumber = getReserveNumber();
  464 + }
  465 +
  466 + // 移除掉可用库位数小于预留库位数的巷道
  467 + LambdaQueryWrapper<Location> wrapper = Wrappers.lambdaQuery();
  468 + wrapper.eq(Location::getRoadway, roadWay)
  469 + .eq(Location::getStatus, STATUS_LOCATION_EMPTY)
  470 + .eq(Location::getHigh, high)
  471 + .eq(Location::getContainerCode, "")
  472 + .eq(Location::getSelfCreated, NO_TSELFCREATED)
  473 + .eq(Location::getOnlyEmptyContainer, NO_EMPTY_CONTAINER_LOCATION)
  474 + .last(" limit 20");
  475 +
  476 + List<Location> totalLocationList = locationService.list(wrapper);
  477 + //双伸位预留库位数不够了就排除掉该巷道
  478 + if (totalLocationList.size() <= reserveNumber) {
  479 + return "可能是库位不够用了,请检查预留库位数";
  480 + }
  481 +
  482 + // 查找外侧的库位
  483 + LambdaQueryWrapper<Location> locationLambda = Wrappers.lambdaQuery();
  484 + locationLambda.eq(Location::getRoadway, roadWay)
  485 + .eq(Location::getStatus, STATUS_LOCATION_EMPTY)
  486 + .eq(Location::getHigh, high)
  487 + .eq(Location::getRowFlag, ROW_OUT)//外侧
  488 + .eq(Location::getContainerCode, "")
  489 + .eq(Location::getSelfCreated, NO_TSELFCREATED)
  490 + .eq(Location::getOnlyEmptyContainer, NO_EMPTY_CONTAINER_LOCATION)
  491 + .last("ORDER BY (CASE WHEN iLayer > " + flammableLayer + " THEN iLayer ELSE iLayer + 20 END) ASC LIMIT 20");
  492 +
  493 + List<Location> locationList = locationService.list(locationLambda);
  494 + List<Location> removeLocaationList = new ArrayList<>();
  495 + if (locationList != null && !locationList.isEmpty()) {
  496 + for (Location location1 : locationList) {
  497 + //库位内侧,有未完成的任务就去掉这个库位
  498 + if (taskHeaderService.getUncompleteTaskInNear(location1) > 0) {
  499 + removeLocaationList.add(location1);
  500 + }
  501 + }
  502 + }
  503 + if (locationList != null) {
  504 + locationList.removeAll(removeLocaationList);
  505 + }
  506 +
  507 + // 如果没有外侧库位可分配了,再查内侧的库位
  508 + if (locationList == null || locationList.isEmpty()) {
  509 + locationLambda = Wrappers.lambdaQuery();
  510 + locationLambda.eq(StringUtils.isNotEmpty(roadWay), Location::getRoadway, roadWay)
  511 + .eq(Location::getStatus, STATUS_LOCATION_EMPTY)
  512 + .eq(Location::getHigh, high)
  513 + .eq(Location::getRowFlag, ROW_IN)
  514 + .eq(Location::getContainerCode, "")
  515 + .eq(Location::getSelfCreated, NO_TSELFCREATED)
  516 + .eq(Location::getOnlyEmptyContainer, NO_EMPTY_CONTAINER_LOCATION)
  517 + .last("ORDER BY (CASE WHEN iLayer > " + flammableLayer + " THEN iLayer ELSE iLayer + 20 END) ASC LIMIT 20");
  518 + locationList = locationService.list(locationLambda);
  519 + removeLocaationList = new ArrayList<>();
  520 + if (locationList != null && !locationList.isEmpty()) {
  521 + for (Location location1 : locationList) {
  522 + if (taskHeaderService.getUncompleteTaskInNear(location1) > 0) {
  523 + removeLocaationList.add(location1);
  524 + }
  525 + }
  526 + }
  527 + if (locationList != null) {
  528 + locationList.removeAll(removeLocaationList);
  529 + }
  530 + }
  531 + // 如果没有符合条件的库位可分配,返回null
  532 + if (locationList == null || locationList.isEmpty()) {
  533 + return null;
  534 + }
  535 + Location location = locationList.stream().findFirst().orElse(null);
  536 + return location.getCode();
  537 + }
  538 +
  539 +
461 540 //获取双伸位预留库位数
462 541 private int getReserveNumber() {
463 542 String value = configService.getKey(DOUBLE_FORK_RESERVE_LOCATION);
... ... @@ -471,6 +550,20 @@ public class LocationAllocationServiceImpl implements LocationAllocationService
471 550 return StringUtils.isNotEmpty(value) ? Integer.parseInt(value) : 0;
472 551 }
473 552  
  553 +
  554 + //频繁库位
  555 + //if (frequencyLocation == 1) {
  556 + // locationLambda.orderByAsc(Location::getFrequencyLocation); //升序
  557 + //} else if (frequencyLocation == 2) {
  558 + // //常用
  559 + // locationLambda.ge(Location::getFrequencyLocation, 2);//大于等于2
  560 + // locationLambda.orderByAsc(Location::getFrequencyLocation);
  561 + //} else {
  562 + // //不常用
  563 + // locationLambda.orderByDesc(Location::getFrequencyLocation);//倒序
  564 + //}
  565 +
  566 +
474 567 /**
475 568 * 单伸位库位入库分配库位
476 569 */
... ...
src/main/java/com/huaheng/api/wcs/service/warecellAllocation/WarecellAllocationServiceImpl.java
... ... @@ -213,7 +213,7 @@ public class WarecellAllocationServiceImpl implements WarecellAllocationService
213 213 //巷道
214 214 String roadWay = roadWays.get(0);
215 215 //分配库位
216   - locationCode = locationAllocationService.allocation(high, area, roadWay, containerCode, frequencyLocation, emptyContainerTask, isSelfCreated, isFlammable, false, taskNo);
  216 + locationCode = locationAllocationService.allocation(high, area, roadWay, containerCode, frequencyLocation, emptyContainerTask, isSelfCreated, isFlammable, taskNo);
217 217  
218 218 if (StringUtils.isEmpty(locationCode)) {
219 219 return AjaxResult.error("没有库位可分配");
... ... @@ -258,7 +258,7 @@ public class WarecellAllocationServiceImpl implements WarecellAllocationService
258 258 Location destinationLocation;
259 259 if (roadWay.equals("5") || isSelfCreated == 1) {//5号巷道、自建单据库位
260 260 //分配库位
261   - String destinationLocationCode = locationAllocationService.allocation(high, area, roadWay, containerCode, frequencyLocation, emptyContainerTask, isSelfCreated, isFlammable, true, taskNo);
  261 + String destinationLocationCode = locationAllocationService.allocation(high, area, roadWay, containerCode, frequencyLocation, emptyContainerTask, isSelfCreated, isFlammable, taskNo);
262 262 if (StringUtils.isEmpty(destinationLocationCode)) {
263 263 return AjaxResult.error("移库没有剩余库位");
264 264 } else if (destinationLocationCode.length() > 10) {
... ...
src/main/java/com/huaheng/pc/config/location/controller/LocationController.java
... ... @@ -45,7 +45,9 @@ import javax.annotation.Resource;
45 45 import javax.sql.DataSource;
46 46 import java.math.BigDecimal;
47 47 import java.util.ArrayList;
  48 +import java.util.HashMap;
48 49 import java.util.List;
  50 +import java.util.Map;
49 51 import java.util.stream.Collectors;
50 52  
51 53 @Api(tags = {"库位操作类"})
... ... @@ -310,7 +312,6 @@ public class LocationController extends BaseController {
310 312 .eq(StringUtils.isNotEmpty(type), Location::getLocationType, type)
311 313 .eq(StringUtils.isNotEmpty(type), Location::getZoneCode, type);
312 314 List<Location> locations = locationService.list(locationLambdaQueryWrapper);
313   -
314 315 List<InventoryDetail> inventoryDetailList = inventoryDetailService.list();
315 316  
316 317 for (Location location1 : locations) {
... ... @@ -327,7 +328,6 @@ public class LocationController extends BaseController {
327 328 String status = location1.getStatus();
328 329 String containerCode = location1.getContainerCode();
329 330 List<String> materialNameList = inventoryDetails.stream().map(InventoryDetail::getMaterialName).collect(Collectors.toList());
330   - List<String> batchList = inventoryDetails.stream().map(InventoryDetail::getBatch).collect(Collectors.toList());
331 331 List<String> materialCodeList = inventoryDetails.stream().map(InventoryDetail::getMaterialCode).collect(Collectors.toList());
332 332 List<BigDecimal> qtyList = inventoryDetails.stream().map(InventoryDetail::getQty).collect(Collectors.toList());
333 333 if (QuantityConstant.STATUS_LOCATION_EMPTY.equals(status)) {
... ... @@ -339,7 +339,6 @@ public class LocationController extends BaseController {
339 339 } else {
340 340 location1.setMaterialName(materialNameList);
341 341 location1.setMaterialCode(materialCodeList);
342   - location1.setBatch(batchList);
343 342 location1.setQty(qtyList);
344 343 userDef3 = LocationStatus.IDLE_FULL_CONTAINER;
345 344 }
... ... @@ -353,7 +352,6 @@ public class LocationController extends BaseController {
353 352 } else {
354 353 location1.setMaterialName(materialNameList);
355 354 location1.setMaterialCode(materialCodeList);
356   - location1.setBatch(batchList);
357 355 location1.setQty(qtyList);
358 356 userDef3 = LocationStatus.LOCK_FULL_CONTAINER;
359 357 }
... ... @@ -367,7 +365,6 @@ public class LocationController extends BaseController {
367 365 } else {
368 366 location1.setMaterialName(materialNameList);
369 367 location1.setMaterialCode(materialCodeList);
370   - location1.setBatch(batchList);
371 368 location1.setQty(qtyList);
372 369 userDef3 = LocationStatus.DISABLE_FULL_CONTAINER;
373 370 }
... ... @@ -383,7 +380,6 @@ public class LocationController extends BaseController {
383 380 } else {
384 381 location1.setMaterialName(materialNameList);
385 382 location1.setMaterialCode(materialCodeList);
386   - location1.setBatch(batchList);
387 383 location1.setQty(qtyList);
388 384 userDef3 = LocationStatus.DISABLE_FULL_CONTAINER;
389 385 }
... ...
src/main/java/com/huaheng/pc/shipment/shipmentHeader/controller/ShipmentHeaderController.java
... ... @@ -133,6 +133,7 @@ public class ShipmentHeaderController extends BaseController {
133 133 public TableDataInfo list(ShipmentHeader shipmentHeader, String createdBegin, String createdEnd, String deliveryDate,
134 134 @ApiParam(name = "completeTimeBegin", value = "开始时间") String completeTimeBegin,
135 135 @ApiParam(name = "completeTimeEnd", value = "完成时间") String completeTimeEnd,
  136 + String warehouseTypeDocument,
136 137 String startDate, String importDate, String isAsc) {
137 138 LambdaQueryWrapper<ShipmentHeader> lambdaQueryWrapper = Wrappers.lambdaQuery();
138 139 PageDomain pageDomain = TableSupport.buildPageRequest();
... ... @@ -229,7 +230,6 @@ public class ShipmentHeaderController extends BaseController {
229 230 //物料搜索
230 231 .inSql(StringUtils.isNotEmpty(shipmentHeader.getMaterialName()), ShipmentHeader::getId, "SELECT shipmentId FROM shipment_detail WHERE materialName LIKE '%" + shipmentHeader.getMaterialName() + "%'")
231 232 .inSql(StringUtils.isNotEmpty(shipmentHeader.getMaterialCode()), ShipmentHeader::getId, "SELECT shipmentId FROM shipment_detail WHERE materialCode LIKE '%" + shipmentHeader.getMaterialCode() + "%'")
232   -
233 233 .orderByAsc(ShipmentHeader::getLastStatus)
234 234 .orderByAsc(ShipmentHeader::getRequestedStartDate)
235 235 .orderByAsc(ShipmentHeader::getCreated);
... ... @@ -237,13 +237,43 @@ public class ShipmentHeaderController extends BaseController {
237 237 if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) {
238 238 Page<ShipmentHeader> page = new Page<>(pageNum, pageSize);
239 239 IPage<ShipmentHeader> iPage = shipmentHeaderService.page(page, lambdaQueryWrapper);
240   - return getMpDataTable(iPage.getRecords(), iPage.getTotal());
  240 + //仓库类型单据过滤
  241 + if (StringUtils.isNotEmpty(warehouseTypeDocument)) {
  242 + List<ShipmentHeader> list = warehouseTypeDocumentFilter(iPage.getRecords(), warehouseTypeDocument);
  243 + return getMpDataTable(list, iPage.getTotal());
  244 + } else {
  245 + return getMpDataTable(iPage.getRecords(), iPage.getTotal());
  246 + }
  247 +
241 248 } else {
242 249 List<ShipmentHeader> list = shipmentHeaderService.list(lambdaQueryWrapper);
243 250 return getDataTable(list);
244 251 }
245 252 }
246 253  
  254 + private List<ShipmentHeader> warehouseTypeDocumentFilter(List<ShipmentHeader> shipmentHeaderList, String warehouseTypeDocument) {
  255 + List<ShipmentHeader> list = new ArrayList<>();
  256 + for (ShipmentHeader shipmentHeader : shipmentHeaderList) {
  257 + List<ShipmentDetail> shipmentDetailList = shipmentDetailService.list(new LambdaQueryWrapper<ShipmentDetail>().eq(ShipmentDetail::getShipmentId, shipmentHeader.getId()));
  258 +
  259 + for (ShipmentDetail shipmentDetail : shipmentDetailList) {
  260 + if (warehouseTypeDocument.equals("0")) {//立库
  261 + List<InventoryDetail> inventoryDetails = inventoryDetailService.list(new LambdaQueryWrapper<InventoryDetail>().eq(InventoryDetail::getMaterialCode, shipmentDetail.getMaterialCode()).eq(InventoryDetail::getZoneCode, "L"));
  262 + if (!inventoryDetails.isEmpty()) {
  263 + list.add(shipmentHeader);
  264 + break;
  265 + }
  266 + } else {//平库
  267 + List<InventoryDetail> inventoryDetails = inventoryDetailService.list(new LambdaQueryWrapper<InventoryDetail>().eq(InventoryDetail::getMaterialCode, shipmentDetail.getMaterialCode()).ne(InventoryDetail::getZoneCode, "L"));
  268 + if (!inventoryDetails.isEmpty()) {
  269 + list.add(shipmentHeader);
  270 + }
  271 + }
  272 + }
  273 + }
  274 + return list;
  275 + }
  276 +
247 277 /**
248 278 * 新增出库单主
249 279 */
... ...
src/main/java/com/huaheng/pc/shipment/shipmentHeader/domain/ShipmentPrintVo.java
... ... @@ -35,7 +35,13 @@ public class ShipmentPrintVo {
35 35 data.unionCode = unionCode;//合并单号
36 36 data.recordCode = shipmentHeader.getRecordCode();//合并前单号
37 37 data.zoneInfo = zoneInfo;//库区
38   - data.materialColor = shipmentHeader.getMaterialColor().substring(12);//颜色
  38 + String materialColor = shipmentHeader.getMaterialColor();
  39 + if (materialColor.length() > 12) {
  40 + data.materialColor = materialColor.substring(12);
  41 + } else {
  42 + data.materialColor = materialColor;
  43 + }
  44 +
39 45 data.pageNumber = pageNumber;//页码
40 46 if (shipmentHeader.getShipmentType().equals("208")) {
41 47 data.footRight = "形态转换单据得重新维护编码,并重新入库";
... ... @@ -62,7 +68,12 @@ public class ShipmentPrintVo {
62 68 voDetail.roadway = roadway;//巷道
63 69 voDetail.recordCode = taskDetail.getRecordCode();//合并前单号
64 70 voDetail.port = port;//出库口
65   - voDetail.materialColor = taskDetail.getMaterialColor();//颜色
  71 + String materialColor = taskDetail.getMaterialColor();
  72 + if (materialColor.length() > 12) {
  73 + data.materialColor = materialColor.substring(12);
  74 + } else {
  75 + data.materialColor = materialColor;
  76 + }
66 77 voDetail.paintStatus = taskDetail.getPaintStatus();//喷漆状态
67 78 data.details.add(voDetail);
68 79 return voDetail;
... ...
src/main/resources/templates/shipment/shipmentHeader/shipmentHeader.html
... ... @@ -49,6 +49,13 @@
49 49 th:value="${e['dictValue']}"></option>
50 50 </select>
51 51 </li>
  52 + <!-- <li>-->
  53 + <!-- 仓库类型单据:<select id="warehouseTypeDocument" name="warehouseTypeDocument">-->
  54 + <!-- <option value="">所有</option>-->
  55 + <!-- <option value="0">立库</option>-->
  56 + <!-- <option value="1">平库</option>-->
  57 + <!-- </select>-->
  58 + <!-- </li>-->
52 59 <li>
53 60 生产车间:<input type="text" name="workshop"/>
54 61 </li>
... ...