feat: 一些优化

This commit is contained in:
曹鹏飞 2025-10-13 09:56:17 +08:00
parent bc39437a8b
commit 5548591b84
4 changed files with 20 additions and 33 deletions

29
.gitignore vendored
View File

@ -1,17 +1,6 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
logs/
*.log
### IntelliJ IDEA ###
.idea
@ -19,17 +8,5 @@ target/
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
/dev_jco_rfc.log
logs
.vscode/

View File

@ -12,7 +12,10 @@ import com.nflg.wms.common.pojo.ApiResult;
import com.nflg.wms.common.pojo.PageData;
import com.nflg.wms.common.pojo.dto.*;
import com.nflg.wms.common.pojo.qo.*;
import com.nflg.wms.common.pojo.vo.*;
import com.nflg.wms.common.pojo.vo.ComponentOutboundEditVO;
import com.nflg.wms.common.pojo.vo.ComponentOutboundItemVO;
import com.nflg.wms.common.pojo.vo.ComponentOutboundVO;
import com.nflg.wms.common.pojo.vo.ScanCodeVO;
import com.nflg.wms.common.util.PageUtil;
import com.nflg.wms.common.util.UserUtil;
import com.nflg.wms.common.util.VUtil;
@ -24,7 +27,6 @@ import com.nflg.wms.repository.service.IWmsComponentOutboundItemService;
import com.nflg.wms.repository.service.IWmsComponentOutboundService;
import com.nflg.wms.repository.service.IWmsComponentPackingItemService;
import com.nflg.wms.repository.service.IWmsComponentPackingService;
import com.nflg.wms.starter.annotation.ApiMark;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
@ -32,9 +34,9 @@ import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Stream;
/**
@ -170,8 +172,7 @@ public class ComponentOutboundController {
.eq(WmsComponentOutbound::getVbelv, packing.getVbelv())
.eq(WmsComponentOutbound::getIsReverse, false)
.one();
VUtil.trueThrowBusinessError(Objects.nonNull(outboundSelect))
.throwMessage("交货单已出库,单号为【" + outboundSelect.getOutboundNo() + "");
VUtil.trueThrowBusinessError(Objects.nonNull(outboundSelect), () -> "交货单已出库,单号为【" + outboundSelect.getOutboundNo() + "");
//判断数量是否一致且已经存在了相同的收货单了
for (WmsComponentPackingItem item : packingItems) {
List<ComponentOutboundItemInputQO> items = request.getItems()

View File

@ -1225,6 +1225,7 @@ public class SapService {
JCoFunction function = exec("ZWM3A20", parameters, tables);
JCoStructure structure = function.getExportParameterList().getStructure("OUTPUT");
print("输出参数OUTPUT", structure);
VUtil.trueThrowBusinessError(!StrUtil.equals(structure.getString("TYPE"), "S"))
.throwMessage("SAP错误" + structure.getString("MSG"));
return Pair.of(structure.getString("MAT_DOC"), structure.getString("DOC_YEAR"));

View File

@ -7,6 +7,8 @@ import com.nflg.wms.common.function.ThrowBusinessExceptionFunction;
import com.nflg.wms.common.function.ThrowExceptionFunction;
import com.nflg.wms.common.function.TrueHandleFunction;
import java.util.function.Supplier;
public class VUtil {
public static ThrowBusinessExceptionFunction trueThrowBusinessError(boolean flag) {
@ -18,6 +20,12 @@ public class VUtil {
};
}
public static void trueThrowBusinessError(boolean flag, Supplier<String> supplier) {
if (flag) {
throw new NflgException(STATE.BusinessError, supplier.get());
}
}
public static ThrowExceptionFunction trueThrow(boolean flag) {
return (state,errorMessage) -> {