Commit 205d54318995c878b7eb786ab4cac355b43e1ebf

Authored by 谭毅彬
1 parent d6f96566

库位比较提交(1)

Signed-off-by: TanYibin <5491541@qq.com>
ant-design-vue-jeecg/src/views/system/inventory/InventoryHeaderList.vue
... ... @@ -121,8 +121,8 @@
121 121  
122 122 <span slot="action" slot-scope="text, record">
123 123 <a v-has="'inventoryHeader:edit'" @click="handleEdit(record)">编辑<a-divider type="vertical"/></a>
124   - <a-dropdown>
125   -<!-- <a class="ant-dropdown-link" >更多 <a-icon type="down"/></a>-->
  124 + <!-- <a-dropdown>
  125 + <a class="ant-dropdown-link" >更多 <a-icon type="down"/></a>
126 126 <a-menu slot="overlay" v-has="'inventoryHeader:delete'">
127 127 <a-menu-item>
128 128 <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
... ... @@ -130,7 +130,7 @@
130 130 </a-popconfirm>
131 131 </a-menu-item>
132 132 </a-menu>
133   - </a-dropdown>
  133 + </a-dropdown> -->
134 134 </span>
135 135  
136 136 </a-table>
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/system/entity/SystemAuthenticationDto.java
1 1 package org.jeecg.modules.wms.api.system.entity;
2 2  
  3 +import java.math.BigDecimal;
  4 +
  5 +import javax.validation.constraints.DecimalMin;
  6 +import javax.validation.constraints.Digits;
3 7 import javax.validation.constraints.NotNull;
4 8 import javax.validation.constraints.Pattern;
5 9  
... ... @@ -19,4 +23,14 @@ public class SystemAuthenticationDto {
19 23 + "((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8]))))|((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|"
20 24 + "[3579][26])00))-02-29))\\s+([0-1]?[0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$")
21 25 private String expirationTime;
  26 +
  27 +// @Digits(integer = 9, fraction = 1, message = "amount format error")
  28 +// @DecimalMin(value = "0.0", message = "qty value is wrong")
  29 +// @NotNull(message = "qty is empty")
  30 +// private BigDecimal qty;
  31 +//
  32 +// @Digits(integer = 9, fraction = 1, message = "taskQty format error")
  33 +// @DecimalMin(value = "0.1", message = "taskQty value is wrong")
  34 +// @NotNull(message = "taskQty is empty")
  35 +// private BigDecimal taskQty;
22 36 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/controller/LocationController.java
... ... @@ -13,6 +13,7 @@ import org.jeecg.common.aspect.annotation.AutoLog;
13 13 import org.jeecg.common.system.base.controller.JeecgController;
14 14 import org.jeecg.common.system.query.QueryGenerator;
15 15 import org.jeecg.modules.wms.config.container.service.IContainerService;
  16 +import org.jeecg.modules.wms.config.location.dto.CompareLocationDto;
16 17 import org.jeecg.modules.wms.config.location.entity.BatchLocation;
17 18 import org.jeecg.modules.wms.config.location.entity.Location;
18 19 import org.jeecg.modules.wms.config.location.service.ILocationService;
... ... @@ -20,6 +21,7 @@ import org.jeecg.utils.HuahengJwtUtil;
20 21 import org.jeecg.utils.StringUtils;
21 22 import org.jeecg.utils.constant.QuantityConstant;
22 23 import org.springframework.beans.factory.annotation.Autowired;
  24 +import org.springframework.validation.annotation.Validated;
23 25 import org.springframework.web.bind.annotation.*;
24 26 import org.springframework.web.servlet.ModelAndView;
25 27  
... ... @@ -254,4 +256,18 @@ public class LocationController extends JeecgController&lt;Location, ILocationServi
254 256 List<Location> locationList = locationService.getContainerInLocation(containerCode, QuantityConstant.STATUS_CONTAINER_MANY, locationCode, warehouseCode);
255 257 return Result.OK(locationList);
256 258 }
  259 +
  260 + /**
  261 + * WCS库位信息比较
  262 + * @param location
  263 + * @return
  264 + */
  265 + @AutoLog(value = "WCS库位信息比较")
  266 + @ApiOperation(value = "库位管理-WCS库位信息比较", notes = "库位管理-WCS库位信息比较")
  267 + @GetMapping(value = "/compareWcsLocation")
  268 + public Result compareWcsLocation(@RequestBody @Validated CompareLocationDto compareLocationDto, HttpServletRequest request) {
  269 + HuahengJwtUtil.setWarehouseCode(request, compareLocationDto);
  270 + List<CompareLocationDto> compareLocationList = locationService.compareWcsLocation(compareLocationDto);
  271 + return Result.OK(compareLocationList);
  272 + }
257 273 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/dto/CompareLocationDto.java 0 → 100644
  1 +package org.jeecg.modules.wms.config.location.dto;
  2 +
  3 +import lombok.Data;
  4 +
  5 +@Data
  6 +public class CompareLocationDto {
  7 +
  8 + /** 仓库编码 */
  9 + private String warehouseCode;
  10 +
  11 + /** 库位编码 */
  12 + private String locationCode;
  13 +
  14 + /** 库位表托盘编码 */
  15 + private String locationContainerCode;
  16 +
  17 + /** 托盘表托盘编码 */
  18 + private String containerContainerCode;
  19 +
  20 + /** 库存表托盘编码 */
  21 + private String inventoryContainerCode;
  22 +
  23 + /** WCS库位托盘编码 */
  24 + private String wcsContainerCode;
  25 +
  26 + /** 库位状态 */
  27 + private String locationStatus;
  28 +
  29 + /** 托盘状态 */
  30 + private String containerStatus;
  31 +
  32 + /** 库存状态 */
  33 + private String inventoryStatus;
  34 +
  35 + /** WCS库位状态 */
  36 + private String wcsLocationStatus;
  37 +
  38 +}
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/dto/WcsLocationDto.java 0 → 100644
  1 +package org.jeecg.modules.wms.config.location.dto;
  2 +
  3 +import lombok.Data;
  4 +
  5 +@Data
  6 +public class WcsLocationDto {
  7 +
  8 + /** 仓库编码 */
  9 + private String warehouseCode;
  10 +
  11 + /** 库位编码 */
  12 + private String locationCode;
  13 +
  14 + /** 托盘编码 */
  15 + private String containerCode;
  16 +
  17 + /** 巷道 */
  18 + private Integer roadWay;
  19 +
  20 + /** 库位状态 */
  21 + private Integer status;
  22 +
  23 +}
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/dto/WcsResultDto.java 0 → 100644
  1 +package org.jeecg.modules.wms.config.location.dto;
  2 +
  3 +import io.swagger.annotations.ApiModelProperty;
  4 +import lombok.Data;
  5 +
  6 +@Data
  7 +public class WcsResultDto<T> {
  8 +
  9 + /** 返回消息体 */
  10 + private T data;
  11 +
  12 + /** 返回处理消息 */
  13 + private String message;
  14 +
  15 + /** 返回代码 */
  16 + private Integer code;
  17 +
  18 + /** 返回 错误代码 */
  19 + private Integer errorCode;
  20 +}
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/service/ILocationService.java
... ... @@ -2,7 +2,10 @@ package org.jeecg.modules.wms.config.location.service;
2 2  
3 3 import java.util.List;
4 4  
  5 +import javax.servlet.http.HttpServletRequest;
  6 +
5 7 import org.jeecg.common.api.vo.Result;
  8 +import org.jeecg.modules.wms.config.location.dto.CompareLocationDto;
6 9 import org.jeecg.modules.wms.config.location.entity.BatchLocation;
7 10 import org.jeecg.modules.wms.config.location.entity.Location;
8 11 import org.jeecg.modules.wms.config.location.entity.LocationInfo;
... ... @@ -66,4 +69,6 @@ public interface ILocationService extends IService&lt;Location&gt; {
66 69  
67 70 List<Location> getContainerInLocation(String containerCode, String containerStatus, String locationCode, String warehouseCode);
68 71  
  72 + List<CompareLocationDto> compareWcsLocation(CompareLocationDto compareLocationDto);
  73 +
69 74 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/service/impl/LocationServiceImpl.java
... ... @@ -4,15 +4,24 @@ import java.text.MessageFormat;
4 4 import java.util.ArrayList;
5 5 import java.util.Collections;
6 6 import java.util.Comparator;
  7 +import java.util.HashMap;
  8 +import java.util.HashSet;
7 9 import java.util.List;
  10 +import java.util.Map;
  11 +import java.util.Set;
  12 +import java.util.function.Function;
8 13 import java.util.stream.Collectors;
9 14  
10 15 import javax.annotation.Resource;
11 16  
12 17 import org.jeecg.common.api.vo.Result;
13 18 import org.jeecg.common.exception.JeecgBootException;
  19 +import org.jeecg.modules.wms.config.address.service.IAddressService;
14 20 import org.jeecg.modules.wms.config.container.entity.Container;
15 21 import org.jeecg.modules.wms.config.container.service.IContainerService;
  22 +import org.jeecg.modules.wms.config.location.dto.CompareLocationDto;
  23 +import org.jeecg.modules.wms.config.location.dto.WcsLocationDto;
  24 +import org.jeecg.modules.wms.config.location.dto.WcsResultDto;
16 25 import org.jeecg.modules.wms.config.location.entity.BatchLocation;
17 26 import org.jeecg.modules.wms.config.location.entity.Location;
18 27 import org.jeecg.modules.wms.config.location.entity.LocationInfo;
... ... @@ -22,12 +31,17 @@ import org.jeecg.modules.wms.config.locationType.entity.LocationType;
22 31 import org.jeecg.modules.wms.config.locationType.service.ILocationTypeService;
23 32 import org.jeecg.modules.wms.config.zone.entity.Zone;
24 33 import org.jeecg.modules.wms.config.zone.service.IZoneService;
  34 +import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail;
  35 +import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService;
25 36 import org.jeecg.modules.wms.task.taskHeader.service.ITaskHeaderService;
  37 +import org.jeecg.utils.OkHttpUtils;
26 38 import org.jeecg.utils.StringUtils;
27 39 import org.jeecg.utils.constant.QuantityConstant;
28 40 import org.springframework.stereotype.Service;
29 41 import org.springframework.transaction.annotation.Transactional;
30 42  
  43 +import com.alibaba.fastjson.JSON;
  44 +import com.alibaba.fastjson.TypeReference;
31 45 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
32 46 import com.baomidou.mybatisplus.core.metadata.IPage;
33 47 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
... ... @@ -45,15 +59,25 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
45 59  
46 60 @Resource
47 61 private ITaskHeaderService taskHeaderService;
  62 +
48 63 @Resource
49 64 private ILocationTypeService locationTypeService;
  65 +
50 66 @Resource
51 67 private IZoneService zoneService;
  68 +
52 69 @Resource
53 70 private LocationMapper locationMapper;
  71 +
54 72 @Resource
55 73 private IContainerService containerService;
56 74  
  75 + @Resource
  76 + private IAddressService addressService;
  77 +
  78 + @Resource
  79 + private IInventoryDetailService inventoryDetailService;
  80 +
57 81 @Override
58 82 public Location getLocationByCode(String locationCode, String warehouseCode) {
59 83 LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery();
... ... @@ -409,4 +433,127 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
409 433 }
410 434 return true;
411 435 }
  436 +
  437 + @Override
  438 + public List<CompareLocationDto> compareWcsLocation(CompareLocationDto queryLocationDto) {
  439 + // 初始化数据
  440 + Set<String> locationCodes = new HashSet<String>();
  441 + Map<String, Location> locationMap = new HashMap<String, Location>();
  442 + Map<String, Container> containerMap = new HashMap<String, Container>();
  443 + Map<String, List<InventoryDetail>> inventoryDetailMap = new HashMap<String, List<InventoryDetail>>();
  444 + Map<String, WcsLocationDto> wcsLocationMap = new HashMap<String, WcsLocationDto>();
  445 +
  446 + // 1.获取WMS库位表库位信息
  447 + LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery();
  448 + locationLambdaQueryWrapper.select(Location::getWarehouseCode, Location::getCode, Location::getContainerCode, Location::getStatus)
  449 + .eq(Location::getWarehouseCode, queryLocationDto.getWarehouseCode())
  450 + .eq(StringUtils.isNotEmpty(queryLocationDto.getLocationCode()), Location::getCode, queryLocationDto.getLocationCode())
  451 + .eq(StringUtils.isNotEmpty(queryLocationDto.getLocationContainerCode()), Location::getContainerCode, queryLocationDto.getLocationContainerCode());
  452 + List<Location> locationList = list(locationLambdaQueryWrapper);
  453 + if (locationList != null && locationList.size() > 0) {
  454 + locationMap.putAll(locationList.stream().collect(Collectors.toMap(Location::getCode, Function.identity(), (key1, key2) -> key2)));
  455 + locationCodes.addAll(locationList.stream().map(t -> t.getCode()).collect(Collectors.toSet()));
  456 + }
  457 +
  458 + // 2.获取WMS托盘表库位信息
  459 + LambdaQueryWrapper<Container> containerLambdaQueryWrapper = Wrappers.lambdaQuery();
  460 + containerLambdaQueryWrapper.select(Container::getWarehouseCode, Container::getLocationCode, Container::getCode, Container::getStatus)
  461 + .eq(Container::getWarehouseCode, queryLocationDto.getWarehouseCode())
  462 + .eq(StringUtils.isNotEmpty(queryLocationDto.getLocationCode()), Container::getLocationCode, queryLocationDto.getLocationCode())
  463 + .eq(StringUtils.isNotEmpty(queryLocationDto.getLocationContainerCode()), Container::getCode, queryLocationDto.getLocationContainerCode());
  464 + List<Container> containerList = containerService.list(containerLambdaQueryWrapper);
  465 + if (containerList != null && containerList.size() > 0) {
  466 + containerMap.putAll(containerList.stream().collect(Collectors.toMap(Container::getLocationCode, Function.identity(), (key1, key2) -> key2)));
  467 + locationCodes.addAll(containerList.stream().map(t -> t.getLocationCode()).collect(Collectors.toSet()));
  468 + }
  469 +
  470 + // 3.获取WMS库存表库位信息
  471 + LambdaQueryWrapper<InventoryDetail> inventoryDetailLambdaQueryWrapper = Wrappers.lambdaQuery();
  472 + inventoryDetailLambdaQueryWrapper
  473 + .select(InventoryDetail::getWarehouseCode, InventoryDetail::getLocationCode, InventoryDetail::getContainerCode, InventoryDetail::getInventoryStatus)
  474 + .eq(InventoryDetail::getWarehouseCode, queryLocationDto.getWarehouseCode())
  475 + .eq(StringUtils.isNotEmpty(queryLocationDto.getLocationCode()), InventoryDetail::getLocationCode, queryLocationDto.getLocationCode())
  476 + .eq(StringUtils.isNotEmpty(queryLocationDto.getLocationContainerCode()), InventoryDetail::getContainerCode, queryLocationDto.getLocationContainerCode());
  477 + List<InventoryDetail> inventoryDetailList = inventoryDetailService.list(inventoryDetailLambdaQueryWrapper);
  478 + if (inventoryDetailList != null && inventoryDetailList.size() > 0) {
  479 + inventoryDetailMap.putAll(inventoryDetailList.stream().collect(Collectors.groupingBy(InventoryDetail::getLocationCode)));
  480 + locationCodes.addAll(inventoryDetailList.stream().map(t -> t.getLocationCode()).collect(Collectors.toSet()));
  481 + }
  482 +
  483 + // 4.获取WCS库位信息
  484 + String url = addressService.getUrlByParam(QuantityConstant.ADDRESS_WCS_LOCATION_INFO);
  485 + Map<String, Object> queryParamMap = new HashMap<String, Object>();
  486 + if (StringUtils.isNotEmpty(queryLocationDto.getWarehouseCode())) {
  487 + queryParamMap.put("warehouseCode", queryLocationDto.getWarehouseCode());
  488 + }
  489 + if (StringUtils.isNotEmpty(queryLocationDto.getLocationCode())) {
  490 + queryParamMap.put("locations", Collections.singletonList(queryLocationDto.getLocationCode()));
  491 + }
  492 + String jsonStringResult = OkHttpUtils.sendPostByJsonStr(url, JSON.toJSONString(queryParamMap));
  493 + WcsResultDto<List<WcsLocationDto>> wcsResult = JSON.parseObject(jsonStringResult, new TypeReference<WcsResultDto<List<WcsLocationDto>>>() {});
  494 + List<WcsLocationDto> wcsLocationList = wcsResult.getData();
  495 + if (wcsLocationList != null && wcsLocationList.size() > 0) {
  496 + if (StringUtils.isNotEmpty(queryLocationDto.getLocationContainerCode())) {
  497 + wcsLocationList =
  498 + wcsLocationList.stream().filter(t -> queryLocationDto.getLocationContainerCode().equals(t.getContainerCode())).collect(Collectors.toList());
  499 + }
  500 + wcsLocationMap.putAll(wcsLocationList.stream().collect(Collectors.toMap(WcsLocationDto::getLocationCode, Function.identity(), (key1, key2) -> key2)));
  501 + locationCodes.addAll(wcsLocationList.stream().map(t -> t.getLocationCode()).collect(Collectors.toSet()));
  502 + }
  503 +
  504 + // 对返回数据进行组装
  505 + List<CompareLocationDto> compareLocationDtoList = new ArrayList<CompareLocationDto>();
  506 + if (locationCodes.size() > 0) {
  507 + for (String locationCode : locationCodes) {
  508 + if (StringUtils.isEmpty(locationCode)) {
  509 + continue;
  510 + }
  511 + CompareLocationDto compareLocationDto = new CompareLocationDto();
  512 + Location location = locationMap.get(locationCode);
  513 + if (location != null) {
  514 + compareLocationDto.setWarehouseCode(location.getWarehouseCode());
  515 + compareLocationDto.setLocationCode(location.getCode());
  516 + compareLocationDto.setLocationContainerCode(location.getContainerCode());
  517 + compareLocationDto.setLocationStatus(location.getStatus());
  518 + }
  519 + Container container = containerMap.get(locationCode);
  520 + if (container != null) {
  521 + compareLocationDto.setContainerContainerCode(container.getCode());
  522 + compareLocationDto.setContainerStatus(container.getStatus());
  523 + }
  524 + List<InventoryDetail> detailList = inventoryDetailMap.get(locationCode);
  525 + if (detailList != null && detailList.size() > 0) {
  526 + Set<String> containerCodes = detailList.stream().map(t -> t.getContainerCode()).collect(Collectors.toSet());
  527 + Set<String> inventoryStatus = detailList.stream().map(t -> t.getInventoryStatus()).collect(Collectors.toSet());
  528 + compareLocationDto.setInventoryContainerCode(StringUtils.join(containerCodes, ","));
  529 + compareLocationDto.setInventoryStatus(StringUtils.join(inventoryStatus, ","));
  530 + }
  531 + WcsLocationDto wcsLocationDto = wcsLocationMap.get(locationCode);
  532 + if (wcsLocationDto != null) {
  533 + compareLocationDto.setWarehouseCode(wcsLocationDto.getWarehouseCode());
  534 + compareLocationDto.setLocationCode(wcsLocationDto.getLocationCode());
  535 + compareLocationDto.setWcsContainerCode(wcsLocationDto.getContainerCode());
  536 + compareLocationDto.setWcsLocationStatus(wcsLocationDto.getStatus() + "");
  537 + }
  538 + compareLocationDtoList.add(compareLocationDto);
  539 + }
  540 + }
  541 + if (StringUtils.isNotEmpty(queryLocationDto.getLocationStatus())) {
  542 + compareLocationDtoList =
  543 + compareLocationDtoList.stream().filter(t -> queryLocationDto.getLocationStatus().equals(t.getLocationStatus())).collect(Collectors.toList());
  544 + }
  545 + if (StringUtils.isNotEmpty(queryLocationDto.getContainerStatus())) {
  546 + compareLocationDtoList =
  547 + compareLocationDtoList.stream().filter(t -> queryLocationDto.getContainerStatus().equals(t.getContainerStatus())).collect(Collectors.toList());
  548 + }
  549 + if (StringUtils.isNotEmpty(queryLocationDto.getInventoryStatus())) {
  550 + compareLocationDtoList =
  551 + compareLocationDtoList.stream().filter(t -> queryLocationDto.getInventoryStatus().equals(t.getInventoryStatus())).collect(Collectors.toList());
  552 + }
  553 + if (StringUtils.isNotEmpty(queryLocationDto.getWcsLocationStatus())) {
  554 + compareLocationDtoList =
  555 + compareLocationDtoList.stream().filter(t -> queryLocationDto.getWcsLocationStatus().equals(t.getWcsLocationStatus())).collect(Collectors.toList());
  556 + }
  557 + return compareLocationDtoList;
  558 + }
412 559 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/utils/constant/QuantityConstant.java
... ... @@ -20,12 +20,9 @@ package org.jeecg.utils.constant;
20 20 * @author ricard
21 21 */
22 22 public class QuantityConstant {
23   - /**
24   -
25   - */
26   -
  23 +
27 24 // 1、入库单状态
28   -
  25 +
29 26 // 新建
30 27 public static final Integer RECEIPT_HEADER_BUILD = 0;
31 28  
... ... @@ -375,6 +372,8 @@ public class QuantityConstant {
375 372 // 16、请求类型
376 373 public static final String WMS_TYPE = "WMS";
377 374  
  375 + // WCS库位信息查询
  376 + public static final String ADDRESS_WCS_LOCATION_INFO = "WCS_LOCATION_INFO";
378 377 // WCS任务下发
379 378 public static final String ADDRESS_WCS_TASK_ASSIGN = "WCS_TASK_ASSIGN";
380 379 // WCS任务取消
... ... @@ -396,11 +395,11 @@ public class QuantityConstant {
396 395 // 获取可用站台
397 396 public static final String ADDRESS_WCS_GET_FROM_PORT = "WCS_GET_FROM_PORT";
398 397  
399   - // WCS任务下发
  398 + // AGV任务下发
400 399 public static final String ADDRESS_AGV_TASK_ASSIGN = "AGV_TASK_ASSIGN";
401   - // WCS任务取消
  400 + // AGV任务取消
402 401 public static final String ADDRESS_AGV_TASK_CANCEL = "AGV_TASK_CANCEL";
403   - // WCS任务更新
  402 + // AGV任务更新
404 403 public static final String ADDRESS_AGV_TASK_UPDATE = "AGV_TASK_UPDATE";
405 404  
406 405 // 回传ERP入库单
... ... @@ -409,7 +408,7 @@ public class QuantityConstant {
409 408 public static final String ADDRESS_ERP_BACK_SHIPMENT = "ERP_BACK_SHIPMENT";
410 409 // 回传MES入库单
411 410 public static final String ADDRESS_MES_BACK_RECEIPT = "MES_BACK_RECEIPT";
412   - // 回传ERP出库单
  411 + // 回传MES出库单
413 412 public static final String ADDRESS_MES_BACK_SHIPMENT = "MES_BACK_SHIPMENT";
414 413  
415 414 public static final String PLATFORM_CODING = "赋码系统";
... ...