一些优化
This commit is contained in:
parent
d75952664d
commit
75af7a687b
|
|
@ -51,7 +51,7 @@ import java.util.stream.Collectors;
|
||||||
public class BinControllerService {
|
public class BinControllerService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private IWmsBinService binService;
|
private IWmsBinService wmsBinService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private IWmsWarehouseService wmsWarehouseService;
|
private IWmsWarehouseService wmsWarehouseService;
|
||||||
|
|
@ -63,26 +63,26 @@ public class BinControllerService {
|
||||||
WmsBin bin = Convert.convert(WmsBin.class, request);
|
WmsBin bin = Convert.convert(WmsBin.class, request);
|
||||||
bin.setCreateBy(UserUtil.getUserName());
|
bin.setCreateBy(UserUtil.getUserName());
|
||||||
bin.setCreateTime(LocalDateTime.now());
|
bin.setCreateTime(LocalDateTime.now());
|
||||||
binService.add(bin);
|
wmsBinService.add(bin);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update(@Valid BinUpdateQO request) {
|
public void update(@Valid BinUpdateQO request) {
|
||||||
WmsBin bin = Convert.convert(WmsBin.class, request);
|
WmsBin bin = Convert.convert(WmsBin.class, request);
|
||||||
bin.setUpdateBy(UserUtil.getUserName());
|
bin.setUpdateBy(UserUtil.getUserName());
|
||||||
bin.setUpdateTime(LocalDateTime.now());
|
bin.setUpdateTime(LocalDateTime.now());
|
||||||
binService.update(bin);
|
wmsBinService.update(bin);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void delete(@Valid @NotNull Long id) {
|
public void delete(@Valid @NotNull Long id) {
|
||||||
binService.delete(id);
|
wmsBinService.delete(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void enable(@Valid EnableQO request) {
|
public void enable(@Valid EnableQO request) {
|
||||||
binService.enable(request);
|
wmsBinService.enable(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IPage<BinVO> search(@Valid BinSearchQO request) {
|
public IPage<BinVO> search(@Valid BinSearchQO request) {
|
||||||
return binService.search(request);
|
return wmsBinService.search(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
|
|
@ -121,7 +121,7 @@ public class BinControllerService {
|
||||||
if (Objects.isNull(warehouse)){
|
if (Objects.isNull(warehouse)){
|
||||||
sb.append("仓库编号无效;");
|
sb.append("仓库编号无效;");
|
||||||
}else {
|
}else {
|
||||||
bin = binService.lambdaQuery().eq(WmsBin::getNo, dto.getNo()).eq(WmsBin::getWarehouseId, warehouse.getId()).one();
|
bin = wmsBinService.lambdaQuery().eq(WmsBin::getNo, dto.getNo()).eq(WmsBin::getWarehouseId, warehouse.getId()).one();
|
||||||
if (Objects.isNull(bin)) {
|
if (Objects.isNull(bin)) {
|
||||||
bin = new WmsBin()
|
bin = new WmsBin()
|
||||||
.setNo(dto.getNo())
|
.setNo(dto.getNo())
|
||||||
|
|
@ -145,14 +145,14 @@ public class BinControllerService {
|
||||||
bins.add(bin);
|
bins.add(bin);
|
||||||
}
|
}
|
||||||
if (data.stream().noneMatch(it -> StrUtil.isNotBlank(it.getError()))) {
|
if (data.stream().noneMatch(it -> StrUtil.isNotBlank(it.getError()))) {
|
||||||
binService.saveOrUpdateBatch(bins);
|
wmsBinService.saveOrUpdateBatch(bins);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void exportSelect(HttpServletResponse response, List<Long> ids) throws IOException {
|
public void exportSelect(HttpServletResponse response, List<Long> ids) throws IOException {
|
||||||
List<BinVO> binVOS = CollectionUtil.isNotEmpty(ids) ? binService.getList(ids) : new ArrayList<>();
|
List<BinVO> binVOS = CollectionUtil.isNotEmpty(ids) ? wmsBinService.getList(ids) : new ArrayList<>();
|
||||||
List<BinExcelExportDTO> datas = binVOS.stream().map(bin -> Convert.convert(BinExcelExportDTO.class, bin)).collect(Collectors.toList());
|
List<BinExcelExportDTO> datas = binVOS.stream().map(bin -> Convert.convert(BinExcelExportDTO.class, bin)).collect(Collectors.toList());
|
||||||
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||||
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + URLEncoder.encode("储位导出.xlsx", StandardCharsets.UTF_8));
|
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + URLEncoder.encode("储位导出.xlsx", StandardCharsets.UTF_8));
|
||||||
|
|
@ -168,7 +168,7 @@ public class BinControllerService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void exportSearch(HttpServletResponse response, @Valid BinSearchQO request) throws IOException {
|
public void exportSearch(HttpServletResponse response, @Valid BinSearchQO request) throws IOException {
|
||||||
List<BinVO> binVOS = binService.searchNonPage(request);
|
List<BinVO> binVOS = wmsBinService.searchNonPage(request);
|
||||||
List<BinExcelExportDTO> datas = binVOS.stream().map(bin -> Convert.convert(BinExcelExportDTO.class, bin)).collect(Collectors.toList());
|
List<BinExcelExportDTO> datas = binVOS.stream().map(bin -> Convert.convert(BinExcelExportDTO.class, bin)).collect(Collectors.toList());
|
||||||
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||||
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + URLEncoder.encode("储位导出.xlsx", StandardCharsets.UTF_8));
|
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + URLEncoder.encode("储位导出.xlsx", StandardCharsets.UTF_8));
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ package com.nflg.wms.admin.service;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import com.nflg.wms.common.pojo.ApiResult;
|
|
||||||
import com.nflg.wms.common.pojo.dto.C_MaterialReturnDTO;
|
import com.nflg.wms.common.pojo.dto.C_MaterialReturnDTO;
|
||||||
import com.nflg.wms.common.pojo.dto.C_MaterialReturnQueryDTO;
|
import com.nflg.wms.common.pojo.dto.C_MaterialReturnQueryDTO;
|
||||||
import com.nflg.wms.common.pojo.dto.SAPSyncFromDTO;
|
import com.nflg.wms.common.pojo.dto.SAPSyncFromDTO;
|
||||||
|
|
@ -84,7 +83,7 @@ public class CenterReturnControllerService {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 调用SAP服务获取仓库详细信息
|
// 调用SAP服务获取仓库详细信息
|
||||||
List<SAPSyncFromDTO> warehouseList = sapService.zwm3a01(werks, warehouseNos, materialNos, null, null);
|
List<SAPSyncFromDTO> warehouseList = sapService.zwm3A01(werks, warehouseNos, materialNos, null, null);
|
||||||
if (CollectionUtil.isNotEmpty(warehouseList)) {
|
if (CollectionUtil.isNotEmpty(warehouseList)) {
|
||||||
allWarehouse.addAll(warehouseList);
|
allWarehouse.addAll(warehouseList);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ public class StorageControllerService {
|
||||||
private BomMaterialService bomMaterialService;
|
private BomMaterialService bomMaterialService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private IWmsBinService binService;
|
private IWmsBinService wmsBinService;
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void add(@Valid StorageAddQO request) {
|
public void add(@Valid StorageAddQO request) {
|
||||||
|
|
@ -108,7 +108,7 @@ public class StorageControllerService {
|
||||||
{
|
{
|
||||||
List<String> binNos = StrUtil.split(storageVO.getBinNos(), ",");
|
List<String> binNos = StrUtil.split(storageVO.getBinNos(), ",");
|
||||||
if (CollectionUtil.isNotEmpty(binNos)) {
|
if (CollectionUtil.isNotEmpty(binNos)) {
|
||||||
storageVO.setBinIds(binService.lambdaQuery().select(WmsBin::getId).in(WmsBin::getNo, binNos).list().stream().map(WmsBin::getId).toList());
|
storageVO.setBinIds(wmsBinService.lambdaQuery().select(WmsBin::getId).in(WmsBin::getNo, binNos).list().stream().map(WmsBin::getId).toList());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return page;
|
return page;
|
||||||
|
|
@ -168,7 +168,7 @@ public class StorageControllerService {
|
||||||
sb.append("储位编号不能为空;");
|
sb.append("储位编号不能为空;");
|
||||||
} else {
|
} else {
|
||||||
List<String> binNos = StrUtil.split(dto.getBinNos(), ",");
|
List<String> binNos = StrUtil.split(dto.getBinNos(), ",");
|
||||||
List<WmsBin> bins = binService.lambdaQuery().in(WmsBin::getNo, binNos).list();
|
List<WmsBin> bins = wmsBinService.lambdaQuery().in(WmsBin::getNo, binNos).list();
|
||||||
List<String> bs = bins.stream().map(WmsBin::getNo).toList();
|
List<String> bs = bins.stream().map(WmsBin::getNo).toList();
|
||||||
binNos.removeAll(bs);
|
binNos.removeAll(bs);
|
||||||
if (CollectionUtil.isNotEmpty(binNos)) {
|
if (CollectionUtil.isNotEmpty(binNos)) {
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ public class WmsWarehouseServiceImpl extends ServiceImpl<WmsWarehouseMapper, Wms
|
||||||
private IAuditLogService auditLogService;
|
private IAuditLogService auditLogService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private IWmsBinService binService;
|
private IWmsBinService wmsBinService;
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -63,7 +63,7 @@ public class WmsWarehouseServiceImpl extends ServiceImpl<WmsWarehouseMapper, Wms
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public void delete(Long id) {
|
public void delete(Long id) {
|
||||||
VUtil.trueThrowBusinessError(binService.lambdaQuery().eq(WmsBin::getWarehouseId, id).exists())
|
VUtil.trueThrowBusinessError(wmsBinService.lambdaQuery().eq(WmsBin::getWarehouseId, id).exists())
|
||||||
.throwMessage("删除失败,仓库已绑定储位");
|
.throwMessage("删除失败,仓库已绑定储位");
|
||||||
WmsWarehouse old = getById(id);
|
WmsWarehouse old = getById(id);
|
||||||
VUtil.trueThrowBusinessError(Objects.isNull(old)).throwMessage("仓库不存在");
|
VUtil.trueThrowBusinessError(Objects.isNull(old)).throwMessage("仓库不存在");
|
||||||
|
|
|
||||||
|
|
@ -13,10 +13,6 @@
|
||||||
<description>SRM订单接收服务</description>
|
<description>SRM订单接收服务</description>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
|
||||||
<groupId>com.nflg</groupId>
|
|
||||||
<artifactId>nflg-wms-common</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.nflg</groupId>
|
<groupId>com.nflg</groupId>
|
||||||
<artifactId>nflg-wms-starter</artifactId>
|
<artifactId>nflg-wms-starter</artifactId>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue