初版作成
This commit is contained in:
commit
d76fb877f4
34
.gitignore
vendored
Normal file
34
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
HELP.md
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
.log
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
BIN
.mvn/wrapper/maven-wrapper.jar
vendored
Normal file
BIN
.mvn/wrapper/maven-wrapper.jar
vendored
Normal file
Binary file not shown.
2
.mvn/wrapper/maven-wrapper.properties
vendored
Normal file
2
.mvn/wrapper/maven-wrapper.properties
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip
|
||||
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar
|
||||
316
mvnw
vendored
Normal file
316
mvnw
vendored
Normal file
|
|
@ -0,0 +1,316 @@
|
|||
#!/bin/sh
|
||||
# ----------------------------------------------------------------------------
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Maven Start Up Batch script
|
||||
#
|
||||
# Required ENV vars:
|
||||
# ------------------
|
||||
# JAVA_HOME - location of a JDK home dir
|
||||
#
|
||||
# Optional ENV vars
|
||||
# -----------------
|
||||
# M2_HOME - location of maven2's installed home dir
|
||||
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||
# e.g. to debug Maven itself, use
|
||||
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
if [ -z "$MAVEN_SKIP_RC" ] ; then
|
||||
|
||||
if [ -f /usr/local/etc/mavenrc ] ; then
|
||||
. /usr/local/etc/mavenrc
|
||||
fi
|
||||
|
||||
if [ -f /etc/mavenrc ] ; then
|
||||
. /etc/mavenrc
|
||||
fi
|
||||
|
||||
if [ -f "$HOME/.mavenrc" ] ; then
|
||||
. "$HOME/.mavenrc"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
# OS specific support. $var _must_ be set to either true or false.
|
||||
cygwin=false;
|
||||
darwin=false;
|
||||
mingw=false
|
||||
case "`uname`" in
|
||||
CYGWIN*) cygwin=true ;;
|
||||
MINGW*) mingw=true;;
|
||||
Darwin*) darwin=true
|
||||
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
|
||||
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
|
||||
if [ -z "$JAVA_HOME" ]; then
|
||||
if [ -x "/usr/libexec/java_home" ]; then
|
||||
export JAVA_HOME="`/usr/libexec/java_home`"
|
||||
else
|
||||
export JAVA_HOME="/Library/Java/Home"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "$JAVA_HOME" ] ; then
|
||||
if [ -r /etc/gentoo-release ] ; then
|
||||
JAVA_HOME=`java-config --jre-home`
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$M2_HOME" ] ; then
|
||||
## resolve links - $0 may be a link to maven's home
|
||||
PRG="$0"
|
||||
|
||||
# need this for relative symlinks
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG="`dirname "$PRG"`/$link"
|
||||
fi
|
||||
done
|
||||
|
||||
saveddir=`pwd`
|
||||
|
||||
M2_HOME=`dirname "$PRG"`/..
|
||||
|
||||
# make it fully qualified
|
||||
M2_HOME=`cd "$M2_HOME" && pwd`
|
||||
|
||||
cd "$saveddir"
|
||||
# echo Using m2 at $M2_HOME
|
||||
fi
|
||||
|
||||
# For Cygwin, ensure paths are in UNIX format before anything is touched
|
||||
if $cygwin ; then
|
||||
[ -n "$M2_HOME" ] &&
|
||||
M2_HOME=`cygpath --unix "$M2_HOME"`
|
||||
[ -n "$JAVA_HOME" ] &&
|
||||
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
||||
[ -n "$CLASSPATH" ] &&
|
||||
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
|
||||
fi
|
||||
|
||||
# For Mingw, ensure paths are in UNIX format before anything is touched
|
||||
if $mingw ; then
|
||||
[ -n "$M2_HOME" ] &&
|
||||
M2_HOME="`(cd "$M2_HOME"; pwd)`"
|
||||
[ -n "$JAVA_HOME" ] &&
|
||||
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
|
||||
fi
|
||||
|
||||
if [ -z "$JAVA_HOME" ]; then
|
||||
javaExecutable="`which javac`"
|
||||
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
|
||||
# readlink(1) is not available as standard on Solaris 10.
|
||||
readLink=`which readlink`
|
||||
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
|
||||
if $darwin ; then
|
||||
javaHome="`dirname \"$javaExecutable\"`"
|
||||
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
|
||||
else
|
||||
javaExecutable="`readlink -f \"$javaExecutable\"`"
|
||||
fi
|
||||
javaHome="`dirname \"$javaExecutable\"`"
|
||||
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
|
||||
JAVA_HOME="$javaHome"
|
||||
export JAVA_HOME
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$JAVACMD" ] ; then
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
else
|
||||
JAVACMD="`\\unset -f command; \\command -v java`"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
echo "Error: JAVA_HOME is not defined correctly." >&2
|
||||
echo " We cannot execute $JAVACMD" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$JAVA_HOME" ] ; then
|
||||
echo "Warning: JAVA_HOME environment variable is not set."
|
||||
fi
|
||||
|
||||
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
|
||||
|
||||
# traverses directory structure from process work directory to filesystem root
|
||||
# first directory with .mvn subdirectory is considered project base directory
|
||||
find_maven_basedir() {
|
||||
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo "Path not specified to find_maven_basedir"
|
||||
return 1
|
||||
fi
|
||||
|
||||
basedir="$1"
|
||||
wdir="$1"
|
||||
while [ "$wdir" != '/' ] ; do
|
||||
if [ -d "$wdir"/.mvn ] ; then
|
||||
basedir=$wdir
|
||||
break
|
||||
fi
|
||||
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
|
||||
if [ -d "${wdir}" ]; then
|
||||
wdir=`cd "$wdir/.."; pwd`
|
||||
fi
|
||||
# end of workaround
|
||||
done
|
||||
echo "${basedir}"
|
||||
}
|
||||
|
||||
# concatenates all lines of a file
|
||||
concat_lines() {
|
||||
if [ -f "$1" ]; then
|
||||
echo "$(tr -s '\n' ' ' < "$1")"
|
||||
fi
|
||||
}
|
||||
|
||||
BASE_DIR=`find_maven_basedir "$(pwd)"`
|
||||
if [ -z "$BASE_DIR" ]; then
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
##########################################################################################
|
||||
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
||||
# This allows using the maven wrapper in projects that prohibit checking in binary data.
|
||||
##########################################################################################
|
||||
if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo "Found .mvn/wrapper/maven-wrapper.jar"
|
||||
fi
|
||||
else
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
|
||||
fi
|
||||
if [ -n "$MVNW_REPOURL" ]; then
|
||||
jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
|
||||
else
|
||||
jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
|
||||
fi
|
||||
while IFS="=" read key value; do
|
||||
case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
|
||||
esac
|
||||
done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo "Downloading from: $jarUrl"
|
||||
fi
|
||||
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
|
||||
if $cygwin; then
|
||||
wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
|
||||
fi
|
||||
|
||||
if command -v wget > /dev/null; then
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo "Found wget ... using wget"
|
||||
fi
|
||||
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||
wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
|
||||
else
|
||||
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
|
||||
fi
|
||||
elif command -v curl > /dev/null; then
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo "Found curl ... using curl"
|
||||
fi
|
||||
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||
curl -o "$wrapperJarPath" "$jarUrl" -f
|
||||
else
|
||||
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
|
||||
fi
|
||||
|
||||
else
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo "Falling back to using Java to download"
|
||||
fi
|
||||
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
|
||||
# For Cygwin, switch paths to Windows format before running javac
|
||||
if $cygwin; then
|
||||
javaClass=`cygpath --path --windows "$javaClass"`
|
||||
fi
|
||||
if [ -e "$javaClass" ]; then
|
||||
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo " - Compiling MavenWrapperDownloader.java ..."
|
||||
fi
|
||||
# Compiling the Java class
|
||||
("$JAVA_HOME/bin/javac" "$javaClass")
|
||||
fi
|
||||
if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
|
||||
# Running the downloader
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo " - Running MavenWrapperDownloader.java ..."
|
||||
fi
|
||||
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
##########################################################################################
|
||||
# End of extension
|
||||
##########################################################################################
|
||||
|
||||
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo $MAVEN_PROJECTBASEDIR
|
||||
fi
|
||||
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin; then
|
||||
[ -n "$M2_HOME" ] &&
|
||||
M2_HOME=`cygpath --path --windows "$M2_HOME"`
|
||||
[ -n "$JAVA_HOME" ] &&
|
||||
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
|
||||
[ -n "$CLASSPATH" ] &&
|
||||
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
|
||||
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
|
||||
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
|
||||
fi
|
||||
|
||||
# Provide a "standardized" way to retrieve the CLI args that will
|
||||
# work with both Windows and non-Windows executions.
|
||||
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
|
||||
export MAVEN_CMD_LINE_ARGS
|
||||
|
||||
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||
|
||||
exec "$JAVACMD" \
|
||||
$MAVEN_OPTS \
|
||||
$MAVEN_DEBUG_OPTS \
|
||||
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
|
||||
"-Dmaven.home=${M2_HOME}" \
|
||||
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
|
||||
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
|
||||
188
mvnw.cmd
vendored
Normal file
188
mvnw.cmd
vendored
Normal file
|
|
@ -0,0 +1,188 @@
|
|||
@REM ----------------------------------------------------------------------------
|
||||
@REM Licensed to the Apache Software Foundation (ASF) under one
|
||||
@REM or more contributor license agreements. See the NOTICE file
|
||||
@REM distributed with this work for additional information
|
||||
@REM regarding copyright ownership. The ASF licenses this file
|
||||
@REM to you under the Apache License, Version 2.0 (the
|
||||
@REM "License"); you may not use this file except in compliance
|
||||
@REM with the License. You may obtain a copy of the License at
|
||||
@REM
|
||||
@REM https://www.apache.org/licenses/LICENSE-2.0
|
||||
@REM
|
||||
@REM Unless required by applicable law or agreed to in writing,
|
||||
@REM software distributed under the License is distributed on an
|
||||
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@REM KIND, either express or implied. See the License for the
|
||||
@REM specific language governing permissions and limitations
|
||||
@REM under the License.
|
||||
@REM ----------------------------------------------------------------------------
|
||||
|
||||
@REM ----------------------------------------------------------------------------
|
||||
@REM Maven Start Up Batch script
|
||||
@REM
|
||||
@REM Required ENV vars:
|
||||
@REM JAVA_HOME - location of a JDK home dir
|
||||
@REM
|
||||
@REM Optional ENV vars
|
||||
@REM M2_HOME - location of maven2's installed home dir
|
||||
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
|
||||
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
|
||||
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||
@REM e.g. to debug Maven itself, use
|
||||
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||
@REM ----------------------------------------------------------------------------
|
||||
|
||||
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
|
||||
@echo off
|
||||
@REM set title of command window
|
||||
title %0
|
||||
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
|
||||
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
|
||||
|
||||
@REM set %HOME% to equivalent of $HOME
|
||||
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
|
||||
|
||||
@REM Execute a user defined script before this one
|
||||
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
|
||||
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
|
||||
if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
|
||||
if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
|
||||
:skipRcPre
|
||||
|
||||
@setlocal
|
||||
|
||||
set ERROR_CODE=0
|
||||
|
||||
@REM To isolate internal variables from possible post scripts, we use another setlocal
|
||||
@setlocal
|
||||
|
||||
@REM ==== START VALIDATION ====
|
||||
if not "%JAVA_HOME%" == "" goto OkJHome
|
||||
|
||||
echo.
|
||||
echo Error: JAVA_HOME not found in your environment. >&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
||||
echo location of your Java installation. >&2
|
||||
echo.
|
||||
goto error
|
||||
|
||||
:OkJHome
|
||||
if exist "%JAVA_HOME%\bin\java.exe" goto init
|
||||
|
||||
echo.
|
||||
echo Error: JAVA_HOME is set to an invalid directory. >&2
|
||||
echo JAVA_HOME = "%JAVA_HOME%" >&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
||||
echo location of your Java installation. >&2
|
||||
echo.
|
||||
goto error
|
||||
|
||||
@REM ==== END VALIDATION ====
|
||||
|
||||
:init
|
||||
|
||||
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
|
||||
@REM Fallback to current working directory if not found.
|
||||
|
||||
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
|
||||
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
|
||||
|
||||
set EXEC_DIR=%CD%
|
||||
set WDIR=%EXEC_DIR%
|
||||
:findBaseDir
|
||||
IF EXIST "%WDIR%"\.mvn goto baseDirFound
|
||||
cd ..
|
||||
IF "%WDIR%"=="%CD%" goto baseDirNotFound
|
||||
set WDIR=%CD%
|
||||
goto findBaseDir
|
||||
|
||||
:baseDirFound
|
||||
set MAVEN_PROJECTBASEDIR=%WDIR%
|
||||
cd "%EXEC_DIR%"
|
||||
goto endDetectBaseDir
|
||||
|
||||
:baseDirNotFound
|
||||
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
|
||||
cd "%EXEC_DIR%"
|
||||
|
||||
:endDetectBaseDir
|
||||
|
||||
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
|
||||
|
||||
@setlocal EnableExtensions EnableDelayedExpansion
|
||||
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
|
||||
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
|
||||
|
||||
:endReadAdditionalConfig
|
||||
|
||||
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
|
||||
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
|
||||
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||
|
||||
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
|
||||
|
||||
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
|
||||
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
|
||||
)
|
||||
|
||||
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
||||
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
|
||||
if exist %WRAPPER_JAR% (
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Found %WRAPPER_JAR%
|
||||
)
|
||||
) else (
|
||||
if not "%MVNW_REPOURL%" == "" (
|
||||
SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
|
||||
)
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Couldn't find %WRAPPER_JAR%, downloading it ...
|
||||
echo Downloading from: %DOWNLOAD_URL%
|
||||
)
|
||||
|
||||
powershell -Command "&{"^
|
||||
"$webclient = new-object System.Net.WebClient;"^
|
||||
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
|
||||
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
|
||||
"}"^
|
||||
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
|
||||
"}"
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Finished downloading %WRAPPER_JAR%
|
||||
)
|
||||
)
|
||||
@REM End of extension
|
||||
|
||||
@REM Provide a "standardized" way to retrieve the CLI args that will
|
||||
@REM work with both Windows and non-Windows executions.
|
||||
set MAVEN_CMD_LINE_ARGS=%*
|
||||
|
||||
%MAVEN_JAVA_EXE% ^
|
||||
%JVM_CONFIG_MAVEN_PROPS% ^
|
||||
%MAVEN_OPTS% ^
|
||||
%MAVEN_DEBUG_OPTS% ^
|
||||
-classpath %WRAPPER_JAR% ^
|
||||
"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
|
||||
%WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
|
||||
if ERRORLEVEL 1 goto error
|
||||
goto end
|
||||
|
||||
:error
|
||||
set ERROR_CODE=1
|
||||
|
||||
:end
|
||||
@endlocal & set ERROR_CODE=%ERROR_CODE%
|
||||
|
||||
if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
|
||||
@REM check for post script, once with legacy .bat ending and once with .cmd ending
|
||||
if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
|
||||
if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
|
||||
:skipRcPost
|
||||
|
||||
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
|
||||
if "%MAVEN_BATCH_PAUSE%"=="on" pause
|
||||
|
||||
if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
|
||||
|
||||
cmd /C exit /B %ERROR_CODE%
|
||||
179
pom.xml
Normal file
179
pom.xml
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>3.0.2</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>com</groupId>
|
||||
<artifactId>WMS</artifactId>
|
||||
<version>3.0</version>
|
||||
<name>WMS</name>
|
||||
<description>WMS</description>
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.mybatis.spring.boot</groupId>-->
|
||||
<!-- <artifactId>mybatis-spring-boot-starter</artifactId>-->
|
||||
<!-- <version>3.0.0</version>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
|
||||
<version>3.5.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>dynamic-datasource-spring-boot3-starter</artifactId>
|
||||
<version>4.3.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter-test</artifactId>
|
||||
<version>3.5.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
<version>8.2.0</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<!-- 自定义验证注解 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.8.25</version>
|
||||
</dependency>
|
||||
<!--常用工具类 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- JSON工具类 -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/com.alibaba/fastjson -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>2.0.21</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.5.13</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper</artifactId>
|
||||
<version>6.1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.jsqlparser</groupId>
|
||||
<artifactId>jsqlparser</artifactId>
|
||||
<version>4.9</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpmime -->
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpmime</artifactId>
|
||||
<version>4.5.14</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>5.2.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
<version>5.2.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.oltu.oauth2/org.apache.oltu.oauth2.client -->
|
||||
<dependency>
|
||||
<groupId>org.apache.oltu.oauth2</groupId>
|
||||
<artifactId>org.apache.oltu.oauth2.client</artifactId>
|
||||
<version>1.0.2</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/com.auth0/java-jwt -->
|
||||
<dependency>
|
||||
<groupId>com.auth0</groupId>
|
||||
<artifactId>java-jwt</artifactId>
|
||||
<version>4.4.0</version>
|
||||
</dependency>
|
||||
<!--Swagger-->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</dependency>
|
||||
<!-- MAP工具 -->
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>32.0.0-android</version>
|
||||
</dependency>
|
||||
<!-- aop切面 -->
|
||||
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-aop -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
<version>3.2.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>16</source>
|
||||
<target>16</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
3
src/main/java/META-INF/MANIFEST.MF
Normal file
3
src/main/java/META-INF/MANIFEST.MF
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
Manifest-Version: 1.0
|
||||
Main-Class: com.wuxiShenNan_W8.WmsTestversionApplication
|
||||
|
||||
42
src/main/java/com/wms/WmsApplication.java
Normal file
42
src/main/java/com/wms/WmsApplication.java
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
package com.wms;
|
||||
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
@SpringBootApplication()
|
||||
@EnableScheduling
|
||||
@EnableTransactionManagement
|
||||
@EnableAsync
|
||||
public class WmsApplication {
|
||||
/**
|
||||
* 用于重启程序的上下文
|
||||
*/
|
||||
private static ConfigurableApplicationContext context;
|
||||
|
||||
/**
|
||||
* 主函数,程序的入口
|
||||
*
|
||||
* @param args 命令行参数,以字符串数组形式传入
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
context = SpringApplication.run(WmsApplication.class, args);
|
||||
}
|
||||
|
||||
/**
|
||||
* 重启程序
|
||||
*/
|
||||
public static void restart() {
|
||||
ApplicationArguments args = context.getBean(ApplicationArguments.class);
|
||||
Thread thread = new Thread(() -> {
|
||||
context.close();
|
||||
context = SpringApplication.run(WmsApplication.class, args.getSourceArgs());
|
||||
});
|
||||
thread.setDaemon(false);
|
||||
thread.start();
|
||||
}
|
||||
}
|
||||
23
src/main/java/com/wms/annotation/MyLog.java
Normal file
23
src/main/java/com/wms/annotation/MyLog.java
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
package com.wms.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 日志注解
|
||||
*/
|
||||
@Target({ ElementType.PARAMETER, ElementType.METHOD })
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface MyLog {
|
||||
/**
|
||||
* 日志标题
|
||||
*/
|
||||
String logTitle() default "";
|
||||
|
||||
/**
|
||||
* 方法名
|
||||
*/
|
||||
String logMethod() default "";
|
||||
}
|
||||
133
src/main/java/com/wms/annotation/MyLogAspect.java
Normal file
133
src/main/java/com/wms/annotation/MyLogAspect.java
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
package com.wms.annotation;
|
||||
|
||||
import com.wms.entity.table.WmsLog;
|
||||
import com.wms.service.LogService;
|
||||
import com.wms.utils.HttpUtils;
|
||||
import com.wms.utils.WmsUtils;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.aspectj.lang.JoinPoint;
|
||||
import org.aspectj.lang.annotation.*;
|
||||
import org.aspectj.lang.reflect.MethodSignature;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.context.request.RequestAttributes;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Aspect
|
||||
@Component
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class MyLogAspect {
|
||||
private final LogService logService;
|
||||
// 为了记录运行时间
|
||||
ThreadLocal<Long> startTime = new ThreadLocal<>();
|
||||
|
||||
/**
|
||||
* 设置操作日志切入点,这里介绍两种方式:
|
||||
* 1、基于注解切入(也就是打了自定义注解的方法才会切入)
|
||||
* //@Pointcut("@annotation(com.wms.annotation.MyLog)")
|
||||
* 2、基于包扫描切入
|
||||
* //@Pointcut("execution(public * com.wms.controller..*.*(..))")
|
||||
*/
|
||||
@Pointcut("@annotation(com.wms.annotation.MyLog)")//在注解的位置切入代码
|
||||
public void operLogPointCut() {
|
||||
}
|
||||
@Before("operLogPointCut()")
|
||||
public void beforeMethod(JoinPoint point){
|
||||
startTime.set(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置操作异常切入点记录异常日志 扫描所有controller包下操作
|
||||
*/
|
||||
@Pointcut("execution(* com.wms.controller..*.*(..))")
|
||||
public void operExceptionLogPointCut() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 正常返回通知,拦截用户操作日志,连接点正常执行完成后执行, 如果连接点抛出异常,则不会执行
|
||||
* @param joinPoint 切入点
|
||||
* @param result 返回结果
|
||||
*/
|
||||
@AfterReturning(value = "operLogPointCut()", returning = "result")
|
||||
public void saveOperLog(JoinPoint joinPoint, Object result) {
|
||||
// 获取RequestAttributes
|
||||
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
|
||||
// 从获取RequestAttributes中获取HttpServletRequest的信息
|
||||
HttpServletRequest request = null;
|
||||
if (requestAttributes != null) {
|
||||
request = (HttpServletRequest) requestAttributes.resolveReference(RequestAttributes.REFERENCE_REQUEST);
|
||||
}
|
||||
try {
|
||||
// 从切面织入点处通过反射机制获取织入点处的方法
|
||||
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
||||
// 获取切入点所在的方法
|
||||
Method method = signature.getMethod();
|
||||
// 获取操作
|
||||
MyLog myLog = method.getAnnotation(MyLog.class);
|
||||
WmsLog wmsLog = new WmsLog();
|
||||
wmsLog.setLogId(WmsUtils.generateId("LOG_"));
|
||||
if (myLog != null) {
|
||||
wmsLog.setLogTitle(myLog.logTitle());
|
||||
wmsLog.setLogMethod(myLog.logMethod());
|
||||
}
|
||||
// 设置日志表详情
|
||||
wmsLog.setLogRequest(joinPoint.getArgs());
|
||||
wmsLog.setLogResponse(result);
|
||||
if (request != null) {
|
||||
wmsLog.setLogIp(HttpUtils.getIpAddr(request));
|
||||
}
|
||||
wmsLog.setLogTime(LocalDateTime.now());
|
||||
// TODO 操作人员姓名待实现
|
||||
wmsLog.setLogUser("");
|
||||
logService.save(wmsLog);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 异常返回通知,用于拦截异常日志信息
|
||||
* @param joinPoint 切点
|
||||
* @param e 异常
|
||||
*/
|
||||
@AfterThrowing(pointcut = "operExceptionLogPointCut()", throwing = "e")
|
||||
public void saveExceptionLog(JoinPoint joinPoint, Throwable e) {
|
||||
// 获取RequestAttributes
|
||||
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
|
||||
// 从获取RequestAttributes中获取HttpServletRequest的信息
|
||||
HttpServletRequest request = null;
|
||||
if (requestAttributes != null) {
|
||||
request = (HttpServletRequest) requestAttributes.resolveReference(RequestAttributes.REFERENCE_REQUEST);
|
||||
}
|
||||
try {
|
||||
// 从切面织入点处通过反射机制获取织入点处的方法
|
||||
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
||||
// 获取切入点所在的方法
|
||||
Method method = signature.getMethod();
|
||||
// 获取操作
|
||||
MyLog myLog = method.getAnnotation(MyLog.class);
|
||||
WmsLog wmsLog = new WmsLog();
|
||||
wmsLog.setLogId(WmsUtils.generateId("LOG_"));
|
||||
if (myLog != null) {
|
||||
wmsLog.setLogTitle(myLog.logTitle());
|
||||
wmsLog.setLogMethod(myLog.logMethod());
|
||||
}
|
||||
// 设置日志表详情
|
||||
wmsLog.setLogRequest(joinPoint.getArgs());
|
||||
wmsLog.setLogResponse(e);
|
||||
if (request != null) {
|
||||
wmsLog.setLogIp(HttpUtils.getIpAddr(request));
|
||||
}
|
||||
wmsLog.setLogTime(LocalDateTime.now());
|
||||
// TODO 操作人员姓名待实现
|
||||
wmsLog.setLogUser("");
|
||||
logService.save(wmsLog);
|
||||
} catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
38
src/main/java/com/wms/config/InitLocalConfig.java
Normal file
38
src/main/java/com/wms/config/InitLocalConfig.java
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
package com.wms.config;
|
||||
|
||||
import com.wms.entity.table.Config;
|
||||
import com.wms.service.ConfigService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
@Order(1)
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class InitLocalConfig implements ApplicationRunner {
|
||||
/**
|
||||
* 配置类
|
||||
*/
|
||||
private final ConfigService configService;
|
||||
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
public static Map<String, String> configMap = new HashMap<String, String>();
|
||||
@Override
|
||||
public void run(ApplicationArguments args) {
|
||||
List<Config> configs = configService.selectConfigs("");
|
||||
if (configs.size() > 0) {
|
||||
for (Config config : configs) {
|
||||
configMap.put(config.getConfigKey(), config.getConfigValue());
|
||||
logger.info("导入系统配置成功---{}:{}", config.getConfigName(), config.getConfigValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
27
src/main/java/com/wms/config/MybatisPlusConfig.java
Normal file
27
src/main/java/com/wms/config/MybatisPlusConfig.java
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
package com.wms.config;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.DbType;
|
||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringBootConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* mp配置类
|
||||
*/
|
||||
@SpringBootConfiguration
|
||||
@MapperScan("com.wms.mapper")
|
||||
public class MybatisPlusConfig {
|
||||
@Bean
|
||||
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
||||
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||
// 添加分页插件
|
||||
PaginationInnerInterceptor pageInnerInterceptor = new PaginationInnerInterceptor();
|
||||
pageInnerInterceptor.setDbType(DbType.MYSQL);
|
||||
pageInnerInterceptor.setMaxLimit(1000L);
|
||||
interceptor.addInnerInterceptor(pageInnerInterceptor);
|
||||
return interceptor;
|
||||
}
|
||||
}
|
||||
24
src/main/java/com/wms/config/PageHelperConfig.java
Normal file
24
src/main/java/com/wms/config/PageHelperConfig.java
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
package com.wms.config;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import org.springframework.boot.SpringBootConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
@SpringBootConfiguration
|
||||
public class PageHelperConfig {
|
||||
@Bean
|
||||
public PageHelper pageHelper() {
|
||||
PageHelper pageHelper = new PageHelper();
|
||||
//添加配置,也可以指定文件路径
|
||||
Properties p = new Properties();
|
||||
p.setProperty("helperDialect", "mysql");
|
||||
p.setProperty("reasonable", "true");
|
||||
p.setProperty("supportMethodsArguments", "true");
|
||||
p.setProperty("params", "count=countSql");
|
||||
pageHelper.setProperties(p);
|
||||
return pageHelper;
|
||||
}
|
||||
}
|
||||
37
src/main/java/com/wms/config/ThreadPoolConfig.java
Normal file
37
src/main/java/com/wms/config/ThreadPoolConfig.java
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
package com.wms.config;
|
||||
|
||||
import org.springframework.boot.SpringBootConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.task.TaskExecutor;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
|
||||
/**
|
||||
* 线程池配置
|
||||
*/
|
||||
@SpringBootConfiguration
|
||||
public class ThreadPoolConfig {
|
||||
@Bean
|
||||
// @Bean("pool1")
|
||||
public TaskExecutor taskExecutor() {
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
// 设置核心线程数
|
||||
executor.setCorePoolSize(10);
|
||||
// 设置最大线程数
|
||||
executor.setMaxPoolSize(20);
|
||||
// 设置队列容量
|
||||
executor.setQueueCapacity(100);
|
||||
// 设置线程活跃时间(秒)
|
||||
executor.setKeepAliveSeconds(60);
|
||||
// 设置线程默认名称前缀
|
||||
executor.setThreadNamePrefix("wmsThreadPool-");
|
||||
// 设置拒绝策略
|
||||
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
// 等待所有任务结束后关闭线程池
|
||||
executor.setWaitForTasksToCompleteOnShutdown(true);
|
||||
|
||||
return executor;
|
||||
}
|
||||
}
|
||||
18
src/main/java/com/wms/constants/WmsConstants.java
Normal file
18
src/main/java/com/wms/constants/WmsConstants.java
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
package com.wms.constants;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.wms.constants.enums.WcsTaskStatus;
|
||||
import com.wms.constants.enums.WmsTaskStatus;
|
||||
|
||||
/**
|
||||
* WMS系统所需的常量
|
||||
* @author 梁州
|
||||
* @date 2023/2/13
|
||||
*/
|
||||
public class WmsConstants {
|
||||
public static String EMPTY_STRING = "";
|
||||
public static String ROOT_MENU_ID = "0";
|
||||
}
|
||||
13
src/main/java/com/wms/constants/enums/ConfigMapKeyEnum.java
Normal file
13
src/main/java/com/wms/constants/enums/ConfigMapKeyEnum.java
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
package com.wms.constants.enums;
|
||||
|
||||
public enum ConfigMapKeyEnum {
|
||||
MAX_WEIGHT("MAX_WEIGHT"),
|
||||
URL_WCS_TASK("URL_WCS_TASK");
|
||||
private final String configKey;
|
||||
ConfigMapKeyEnum(String configKey) {
|
||||
this.configKey = configKey;
|
||||
}
|
||||
public String getConfigKey() {
|
||||
return configKey;
|
||||
}
|
||||
}
|
||||
29
src/main/java/com/wms/constants/enums/GoodsStatus.java
Normal file
29
src/main/java/com/wms/constants/enums/GoodsStatus.java
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
package com.wms.constants.enums;
|
||||
|
||||
/**
|
||||
* 物料状态枚举
|
||||
*/
|
||||
public enum GoodsStatus {
|
||||
OK(0, "合格"),
|
||||
BAD(1, "不合格"),
|
||||
DELAY(2, "延期"),
|
||||
OVERDUE(3, "过期"),
|
||||
SCRAP(5, "长时间未使用");
|
||||
|
||||
private final Integer code;
|
||||
|
||||
private final String value;
|
||||
|
||||
GoodsStatus(Integer code, String value) {
|
||||
this.code = code;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
25
src/main/java/com/wms/constants/enums/KateTaskStatus.java
Normal file
25
src/main/java/com/wms/constants/enums/KateTaskStatus.java
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
package com.wms.constants.enums;
|
||||
|
||||
public enum KateTaskStatus {
|
||||
NEW(0, "待下发"),
|
||||
WAIT(1, "已下发"),
|
||||
RUN(2, "执行中"),
|
||||
PICKING(3, "正在拣货"),
|
||||
FINISH(5, "任务完成");
|
||||
|
||||
private final Integer code;
|
||||
private final String name;
|
||||
|
||||
KateTaskStatus(Integer code, String name) {
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
27
src/main/java/com/wms/constants/enums/LocationStatus.java
Normal file
27
src/main/java/com/wms/constants/enums/LocationStatus.java
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
package com.wms.constants.enums;
|
||||
|
||||
/**
|
||||
* 库位状态枚举
|
||||
* /// 托盘状态和站台状态通用
|
||||
*/
|
||||
public enum LocationStatus {
|
||||
EMPTY(0, "空闲"),
|
||||
OCCUPY(1, "占用");
|
||||
|
||||
private final Integer code;
|
||||
|
||||
private final String value;
|
||||
|
||||
LocationStatus(Integer code, String value) {
|
||||
this.code = code;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
27
src/main/java/com/wms/constants/enums/MesStatus.java
Normal file
27
src/main/java/com/wms/constants/enums/MesStatus.java
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
package com.wms.constants.enums;
|
||||
|
||||
/**
|
||||
* 向mes反馈的任务状态码
|
||||
*/
|
||||
public enum MesStatus {
|
||||
WAIT(0, "等待执行"),
|
||||
RUN(1, "执行中"),
|
||||
FINISH(2, "执行完成"),
|
||||
EXCEPTION(3, "任务异常");
|
||||
|
||||
private final Integer statusCode;
|
||||
private final String statusInfo;
|
||||
|
||||
MesStatus(Integer statusCode, String statusInfo) {
|
||||
this.statusCode = statusCode;
|
||||
this.statusInfo = statusInfo;
|
||||
}
|
||||
|
||||
public Integer getStatusCode() {
|
||||
return statusCode;
|
||||
}
|
||||
|
||||
public String getStatusInfo() {
|
||||
return statusInfo;
|
||||
}
|
||||
}
|
||||
27
src/main/java/com/wms/constants/enums/ResponseCode.java
Normal file
27
src/main/java/com/wms/constants/enums/ResponseCode.java
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
package com.wms.constants.enums;
|
||||
|
||||
/**
|
||||
* 接口响应码枚举
|
||||
*/
|
||||
public enum ResponseCode {
|
||||
OK(0, "正常"),
|
||||
WARNING(200, "警告"),
|
||||
ERROR(999, "异常");
|
||||
|
||||
private final Integer code;
|
||||
|
||||
private final String value;
|
||||
|
||||
ResponseCode(Integer code, String value) {
|
||||
this.code = code;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
26
src/main/java/com/wms/constants/enums/StandStatus.java
Normal file
26
src/main/java/com/wms/constants/enums/StandStatus.java
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
package com.wms.constants.enums;
|
||||
|
||||
/**
|
||||
* 站台状态的枚举
|
||||
*/
|
||||
public enum StandStatus {
|
||||
OK(0, "可用"),
|
||||
OCCUPY(1, "占用");
|
||||
|
||||
private final Integer code;
|
||||
|
||||
private final String value;
|
||||
|
||||
StandStatus(Integer code, String value) {
|
||||
this.code = code;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
30
src/main/java/com/wms/constants/enums/StockStatus.java
Normal file
30
src/main/java/com/wms/constants/enums/StockStatus.java
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
package com.wms.constants.enums;
|
||||
|
||||
/**
|
||||
* 库存状态枚举
|
||||
*/
|
||||
public enum StockStatus {
|
||||
OK(0, "库存正常"),
|
||||
OUT(1, "出库中"),
|
||||
INVENTORY(2, "盘点中"),
|
||||
MOVE(3, "移库中"),
|
||||
PICKING(4, "拣选中"),
|
||||
LOCK(9, "库存锁定");
|
||||
|
||||
private final Integer code;
|
||||
|
||||
private final String value;
|
||||
|
||||
StockStatus(Integer code, String value) {
|
||||
this.code = code;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.wms.constants.enums;
|
||||
|
||||
/**
|
||||
* 入库验证信息枚举
|
||||
*/
|
||||
public enum TaskInValidationEnum {
|
||||
OK(""),
|
||||
NO_REQUEST_BODY("请求参数为空"),
|
||||
NO_VEHICLE_ID("载具号为空"),
|
||||
DUPLICATE_VEHICLE_ID("载具号重复入库"),
|
||||
NO_IN_POINT("起点站台为空"),
|
||||
ERROR_IN_POINT("错误的起点站台"),
|
||||
NO_GOODS_ID("带料入库物料信息为空"),
|
||||
ERROR_GOODS_ID("错误的物料编号"),
|
||||
ERROR_GOODS_NUM("带料入库数量为空"),
|
||||
NO_WEIGHT("重量信息为空"),
|
||||
OVER_WEIGHT("超重");
|
||||
|
||||
private final String errorMessage;
|
||||
TaskInValidationEnum(String errorMessage) {
|
||||
this.errorMessage = errorMessage;
|
||||
}
|
||||
public String getErrorMessage() {
|
||||
return errorMessage;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.wms.constants.enums;
|
||||
|
||||
/**
|
||||
* 入库验证信息枚举
|
||||
*/
|
||||
public enum TaskOutValidationEnum {
|
||||
OK(""),
|
||||
NO_REQUEST_BODY("请求参数为空"),
|
||||
LACK_REQUIRED_PARAM("缺少必须参数:物料、载具、起始库位至少需要一个"),
|
||||
ERROR_VEHICLE_ID("不存在的载具号"),
|
||||
ERROR_VEHICLE_STATUS("载具不是在库状态,不可出库"),
|
||||
ERROR_ORIGIN_POINT("错误的起始库位"),
|
||||
LOCKED_LOCATION("库位锁定,无法出库"),
|
||||
ERROR_ORIGIN_POINT_STATUS("起始库位无货,不允许出库"),
|
||||
ERROR_DESTINATION_POINT("错误的终点站台"),
|
||||
NO_PICK_STAND("拣选任务无拣选站台"),
|
||||
ERROR_PICK_STAND("错误的拣选站台"),
|
||||
NO_STOCK("请求的物料无库存"),
|
||||
ERROR_GOODS_NUM("错误的出库数量");
|
||||
|
||||
private final String errorMessage;
|
||||
TaskOutValidationEnum(String errorMessage) {
|
||||
this.errorMessage = errorMessage;
|
||||
}
|
||||
public String getErrorMessage() {
|
||||
return errorMessage;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.wms.constants.enums;
|
||||
|
||||
/**
|
||||
* 任务结果反馈验证信息枚举
|
||||
*/
|
||||
public enum TaskResultValidationEnum {
|
||||
OK(""),
|
||||
NO_REQUEST_BODY("请求参数为空。"),
|
||||
LACK_REQUIRED_PARAM("缺少必须参数:任务号、载具号、任务状态。"),
|
||||
ERROR_TASK_GROUP("反馈的任务号错误,查询不到对应任务"),
|
||||
ERROR_TASK_STATUS("反馈的任务状态错误");
|
||||
|
||||
private final String errorMessage;
|
||||
TaskResultValidationEnum(String errorMessage) {
|
||||
this.errorMessage = errorMessage;
|
||||
}
|
||||
public String getErrorMessage() {
|
||||
return errorMessage;
|
||||
}
|
||||
}
|
||||
28
src/main/java/com/wms/constants/enums/TaskType.java
Normal file
28
src/main/java/com/wms/constants/enums/TaskType.java
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
package com.wms.constants.enums;
|
||||
|
||||
/**
|
||||
* 任务类型枚举
|
||||
*/
|
||||
public enum TaskType {
|
||||
IN(1, "入库"),
|
||||
OUT(2, "出库"),
|
||||
INVENTORY(10, "盘点"),
|
||||
MOVE(9, "移库");
|
||||
|
||||
private final Integer code;
|
||||
|
||||
private final String value;
|
||||
|
||||
TaskType(Integer code, String value) {
|
||||
this.code = code;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
22
src/main/java/com/wms/constants/enums/UrlEnums.java
Normal file
22
src/main/java/com/wms/constants/enums/UrlEnums.java
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
package com.wms.constants.enums;
|
||||
|
||||
public enum UrlEnums {
|
||||
URL_WMS_TO_WCS_SEND_TASK("WMS向WCS发送任务", "/api/Wms/WmsTask/SetStackerTask"),
|
||||
URL_WMS_TO_WCS_CHANGE_TASK("WMS请求变更任务状态", "/api/Wms/WmsTask/ChangeTaskStatus");
|
||||
|
||||
private final String description;
|
||||
private final String value;
|
||||
|
||||
UrlEnums(String description, String value) {
|
||||
this.description = description;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
28
src/main/java/com/wms/constants/enums/VehicleStatus.java
Normal file
28
src/main/java/com/wms/constants/enums/VehicleStatus.java
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
package com.wms.constants.enums;
|
||||
|
||||
/**
|
||||
* 载具状态
|
||||
*/
|
||||
public enum VehicleStatus {
|
||||
IN(1, "入库中"),
|
||||
ON(2, "在库中"),
|
||||
OUT(3, "出库中"),
|
||||
MOVE(4, "移库中");
|
||||
|
||||
private final Integer code;
|
||||
|
||||
private final String value;
|
||||
|
||||
VehicleStatus(Integer code, String value) {
|
||||
this.code = code;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.wms.constants.enums;
|
||||
|
||||
/**
|
||||
* 向Wcs发送任务变更时的任务状态枚举
|
||||
*/
|
||||
public enum WcsChangeTaskStatus {
|
||||
FINISH(0, "重新执行任务"),
|
||||
CANCEL(1, "取消/删除任务"),
|
||||
EXCEPTION(2, "完成任务");
|
||||
|
||||
private final Integer code;
|
||||
private final String message;
|
||||
|
||||
WcsChangeTaskStatus(Integer code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
}
|
||||
31
src/main/java/com/wms/constants/enums/WcsTaskStatus.java
Normal file
31
src/main/java/com/wms/constants/enums/WcsTaskStatus.java
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
package com.wms.constants.enums;
|
||||
|
||||
/**
|
||||
* Wcs任务状态的枚举
|
||||
*/
|
||||
public enum WcsTaskStatus {
|
||||
WAIT(1, "任务排队中"),
|
||||
RUN(2, "任务开始执行"),
|
||||
LEAVE(3, "任务已经离开初始位置"),
|
||||
PARK(4, "任务到达中间点"),
|
||||
ARRIVE(5, "任务到达目的地"),
|
||||
FINISH(100, "任务完成"),
|
||||
CANCEL(998, "任务取消"),
|
||||
EXCEPTION(999, "任务异常");
|
||||
|
||||
private final Integer code;
|
||||
private final String name;
|
||||
|
||||
WcsTaskStatus(Integer code, String name) {
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
34
src/main/java/com/wms/constants/enums/WmsTaskStatus.java
Normal file
34
src/main/java/com/wms/constants/enums/WmsTaskStatus.java
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
package com.wms.constants.enums;
|
||||
|
||||
/**
|
||||
* Wms任务状态的枚举
|
||||
*/
|
||||
public enum WmsTaskStatus {
|
||||
TEMP(-1, "暂存任务"),
|
||||
NEW(0, "任务新建,待下发"),
|
||||
WAIT(1, "任务已下发"),
|
||||
RUN(2, "任务开始执行"),
|
||||
OUT_FINISHED(3, "出库完成"),
|
||||
TRANS(4, "环线运输"),
|
||||
PICKING(8, "拣选中"),
|
||||
INVENTORY(9, "盘点中"),
|
||||
FINISH(100, "任务完成"),
|
||||
CANCEL(998, "任务取消"),
|
||||
EXCEPTION(999, "任务异常");
|
||||
|
||||
private final Integer code;
|
||||
private final String name;
|
||||
|
||||
WmsTaskStatus(Integer code, String name) {
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
83
src/main/java/com/wms/controller/ConfigController.java
Normal file
83
src/main/java/com/wms/controller/ConfigController.java
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
package com.wms.controller;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.wms.constants.enums.ResponseCode;
|
||||
import com.wms.entity.app.ResponseEntity;
|
||||
import com.wms.entity.table.Config;
|
||||
import com.wms.service.ConfigService;
|
||||
import com.wms.utils.HttpUtils;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.transaction.annotation.Isolation;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* WMS系统配置控制类
|
||||
* @author 梁州
|
||||
* @date 2023/3/23
|
||||
*/
|
||||
@Controller
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = "/wms/config")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class ConfigController{
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
/**
|
||||
* 系统配置服务
|
||||
*/
|
||||
private final ConfigService configService;
|
||||
/**
|
||||
* 请求头部信息
|
||||
*/
|
||||
private final HttpServletRequest servletRequest;
|
||||
|
||||
/**
|
||||
* 查找所有配置
|
||||
* @return 配置
|
||||
*/
|
||||
@GetMapping("/getConfigs")
|
||||
@ResponseBody
|
||||
public List<Config> getConfigs(){
|
||||
logger.info("查询系统配置,查询ip:{}", HttpUtils.getIpAddr(servletRequest));
|
||||
return configService.selectConfigs("");
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新系统配置
|
||||
*
|
||||
* @param config 配置
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/updateConfig")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
public String updateConfig(@RequestBody Config config) {
|
||||
logger.info("更新系统配置,{}:{},请求ip:{}", config.getConfigName(), config.getConfigValue(), HttpUtils.getIpAddr(servletRequest));
|
||||
// 创建响应信息
|
||||
ResponseEntity rsp = new ResponseEntity();
|
||||
try {
|
||||
configService.updateConfig(config);
|
||||
} catch (Exception e) {
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
logger.info("更新系统配置错误:{}", e.getMessage());
|
||||
// 返回其他异常
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage(e.getMessage());
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
// 返回成功
|
||||
rsp.setCode(ResponseCode.OK.getCode());
|
||||
rsp.setMessage("更新系统配置成功!");
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
}
|
||||
121
src/main/java/com/wms/controller/ExcelController.java
Normal file
121
src/main/java/com/wms/controller/ExcelController.java
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
package com.wms.controller;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.wms.constants.enums.*;
|
||||
import com.wms.entity.app.ResponseEntity;
|
||||
import com.wms.entity.app.dto.StockDto;
|
||||
import com.wms.entity.app.dto.TaskRecordDto;
|
||||
import com.wms.entity.app.request.StockQuery;
|
||||
import com.wms.entity.app.request.TaskRecordQuery;
|
||||
import com.wms.service.*;
|
||||
import com.wms.utils.excel.ExcelUtils;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.transaction.annotation.Isolation;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.wms.utils.HttpUtils.getIpAddr;
|
||||
import static com.wms.utils.StringUtils.convertJsonString;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@CrossOrigin
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
@RequestMapping(value = "/wms/excel")
|
||||
public class ExcelController {
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
private final StockService stockService;// 库存服务
|
||||
private final HttpServletRequest servletRequest;// 请求服务
|
||||
private final TaskRecordService taskRecordService;// 任务记录服务
|
||||
|
||||
/**
|
||||
* 导入库存信息
|
||||
*
|
||||
* @param file 文件
|
||||
* @return 导入结果
|
||||
*/
|
||||
@PostMapping("/uploadStocks")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
public String uploadStocks(@RequestPart("file") MultipartFile file) {
|
||||
logger.info("导入库存,请求ip:{}", getIpAddr(servletRequest));
|
||||
ResponseEntity response = new ResponseEntity();
|
||||
try {
|
||||
response.setCode(ResponseCode.OK.getCode());
|
||||
response.setMessage("导入库存成功");
|
||||
response.setReturnData(file);
|
||||
} catch (Exception e) {
|
||||
convertJsonString(e);
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage(e.getMessage());
|
||||
}
|
||||
return JSON.toJSONString(response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出库存数据
|
||||
*
|
||||
* @param response 请求
|
||||
*/
|
||||
@GetMapping("/downloadStockExcel")
|
||||
@ResponseBody
|
||||
public void downloadStockExcel(@RequestParam("stockQuery") StockQuery query, HttpServletResponse response) {
|
||||
logger.info("导出库存记录,请求ip:{}", getIpAddr(servletRequest));
|
||||
List<StockDto> stocks = stockService.selectStocks(query.toStockPO());
|
||||
ExcelUtils.export(response, "库存报表", stocks, StockDto.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出入库记录
|
||||
*
|
||||
* @param response 请求
|
||||
*/
|
||||
@GetMapping("/downloadInRecordExcel")
|
||||
@ResponseBody
|
||||
public void downloadInRecordExcel(@RequestParam("recordQuery") TaskRecordQuery query, HttpServletResponse response) {
|
||||
logger.info("导出入库记录,请求ip:{}", getIpAddr(servletRequest));
|
||||
List<TaskRecordDto> inRecord = taskRecordService.selectInTaskRecord(query.toTaskRecordPO());
|
||||
ExcelUtils.export(response, "入库记录报表", inRecord, TaskRecordDto.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出入库记录
|
||||
*
|
||||
* @param response 请求
|
||||
*/
|
||||
@GetMapping("/downloadOutRecordExcel")
|
||||
@ResponseBody
|
||||
public void downloadOutRecordExcel(@RequestParam("recordQuery") TaskRecordQuery query, HttpServletResponse response) {
|
||||
logger.info("导出出库记录,请求ip:{}", getIpAddr(servletRequest));
|
||||
List<TaskRecordDto> outRecord = taskRecordService.selectOutTaskRecord(query.toTaskRecordPO());
|
||||
ExcelUtils.export(response, "出库记录报表", outRecord, TaskRecordDto.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出盘点记录
|
||||
*
|
||||
* @param response 请求
|
||||
*/
|
||||
@GetMapping("/downloadInventoryRecordExcel")
|
||||
@ResponseBody
|
||||
public void downloadInventoryRecordExcel(@RequestParam("recordQuery") TaskRecordQuery query, HttpServletResponse response) {
|
||||
logger.info("导出盘点记录,请求ip:{}", getIpAddr(servletRequest));
|
||||
List<TaskRecordDto> inventoryRecord = taskRecordService.selectInventoryTaskRecord(query.toTaskRecordPO());
|
||||
ExcelUtils.export(response, "盘点记录报表", inventoryRecord, TaskRecordDto.class);
|
||||
}
|
||||
}
|
||||
240
src/main/java/com/wms/controller/GoodsController.java
Normal file
240
src/main/java/com/wms/controller/GoodsController.java
Normal file
|
|
@ -0,0 +1,240 @@
|
|||
package com.wms.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.wms.annotation.MyLog;
|
||||
import com.wms.constants.enums.ResponseCode;
|
||||
import com.wms.entity.app.ResponseEntity;
|
||||
import com.wms.entity.app.dto.GoodsDto;
|
||||
import com.wms.entity.app.dto.PageDto;
|
||||
import com.wms.entity.app.request.GoodsQuery;
|
||||
import com.wms.entity.app.vo.GoodsVo;
|
||||
import com.wms.entity.table.Goods;
|
||||
import com.wms.service.GoodsService;
|
||||
import com.wms.utils.HttpUtils;
|
||||
import com.wms.utils.StringUtils;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.transaction.annotation.Isolation;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.wms.utils.StringUtils.convertJsonString;
|
||||
|
||||
/**
|
||||
* WMS物料控制类
|
||||
* @author 梁州
|
||||
* @date 2023/3/9
|
||||
*/
|
||||
@Controller
|
||||
@CrossOrigin
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
@RequestMapping(value = "/wms/goods")
|
||||
public class GoodsController {
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
/**
|
||||
* 物料服务
|
||||
*/
|
||||
private final GoodsService goodsService;
|
||||
/**
|
||||
* 请求头部信息
|
||||
*/
|
||||
private final HttpServletRequest servletRequest;
|
||||
|
||||
/**
|
||||
* 查找所有物料
|
||||
*/
|
||||
@PostMapping("/getGoodsInfoByPage")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
public String getGoodsInfoByPage(@RequestBody GoodsQuery goodsQuery){
|
||||
logger.info("接收到查询物料数据请求:{},请求ip:{}", convertJsonString(goodsQuery), HttpUtils.getIpAddr(servletRequest));
|
||||
ResponseEntity response = new ResponseEntity();
|
||||
try {
|
||||
Page<Goods> page = goodsQuery.toMpPage();
|
||||
Page<Goods> goodsPage = goodsService.page(page, new LambdaQueryWrapper<Goods>()
|
||||
.like(StringUtils.isNotEmpty(goodsQuery.getGoodsId()), Goods::getGoodsId, goodsQuery.getGoodsId())
|
||||
.like(StringUtils.isNotEmpty(goodsQuery.getGoodsName()), Goods::getGoodsName, goodsQuery.getGoodsName()));
|
||||
|
||||
PageDto<GoodsVo> pageDto = PageDto.of(goodsPage, goods -> BeanUtil.copyProperties(goods, GoodsVo.class));
|
||||
response.setCode(ResponseCode.OK.getCode());
|
||||
response.setMessage("查询成功");
|
||||
response.setReturnData(pageDto);
|
||||
return convertJsonString(response);
|
||||
} catch (Exception e) {
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
logger.error("查询物料信息发生异常");
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("查询物料发生异常");
|
||||
return convertJsonString(response);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新物料信息
|
||||
*
|
||||
* @param goods 物料信息
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/updateGoodsInfo")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
@MyLog(logTitle = "更新物料信息", logMethod = "updateGoodsInfo")
|
||||
public String updateGoodsInfo(@RequestBody GoodsDto goods) {
|
||||
logger.info("接收到更新物料信息请求:{},请求ip:{}", convertJsonString(goods), HttpUtils.getIpAddr(servletRequest));
|
||||
// 创建响应信息
|
||||
ResponseEntity rsp = new ResponseEntity();
|
||||
try {
|
||||
if (StringUtils.isEmpty(goods.getGoodsId())) {// 物料编码为空,不执行
|
||||
logger.error("请求更新的物料编号为空");
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("请求更新的物料编号为空");
|
||||
return convertJsonString(rsp);
|
||||
}
|
||||
if (goodsService.update(BeanUtil.copyProperties(goods, Goods.class),
|
||||
new LambdaUpdateWrapper<Goods>().eq(Goods::getGoodsId, goods.getGoodsId()))) {
|
||||
// 返回成功
|
||||
logger.info("更新物料信息成功");
|
||||
rsp.setCode(ResponseCode.OK.getCode());
|
||||
rsp.setMessage("更新物料信息成功");
|
||||
} else {
|
||||
logger.error("更新物料信息失败");
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("更新物料信息失败");
|
||||
}
|
||||
return convertJsonString(rsp);
|
||||
} catch (Exception e) {
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
logger.error("更新物料信息发生异常:{}", convertJsonString(e));
|
||||
// 返回其他异常
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("更新物料信息发生异常");
|
||||
return convertJsonString(rsp);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询物料信息
|
||||
* @param goodsQuery 参数
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/getGoodsInfo")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
public String getGoodsInfo(@RequestBody GoodsQuery goodsQuery) {
|
||||
logger.info("接收到查询物料信息请求:{},请求ip地址:{}", convertJsonString(goodsQuery), HttpUtils.getIpAddr(servletRequest));
|
||||
ResponseEntity rsp = new ResponseEntity();
|
||||
try {
|
||||
LambdaQueryWrapper<Goods> goodsLambdaQueryWrapper = new LambdaQueryWrapper<Goods>()
|
||||
.eq(StringUtils.isNotEmpty(goodsQuery.getGoodsId()), Goods::getGoodsId, goodsQuery.getGoodsId())
|
||||
.eq(StringUtils.isNotEmpty(goodsQuery.getGoodsName()), Goods::getGoodsName, goodsQuery.getGoodsName());
|
||||
|
||||
List<GoodsVo> goodsList = BeanUtil.copyToList(goodsService.list(goodsLambdaQueryWrapper), GoodsVo.class);
|
||||
// 返回成功
|
||||
rsp.setCode(ResponseCode.OK.getCode());
|
||||
rsp.setMessage("查询物料信息成功");
|
||||
rsp.setReturnData(goodsList);
|
||||
return convertJsonString(rsp);
|
||||
} catch (Exception e) {
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
// 返回其他异常
|
||||
logger.error("查询物料信息发生错误:{}", e.getMessage());
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("查询物料发生异常");
|
||||
return convertJsonString(rsp);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动补全物料编码信息---根据物料编号查询物料信息
|
||||
* @param goodsQuery 参数
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/getGoodsInfoByGoodsId")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
public String getGoodsInfoByGoodsId(@RequestBody GoodsQuery goodsQuery) {
|
||||
logger.info("接收到查询物料信息请求:{},请求ip地址:{}", convertJsonString(goodsQuery), HttpUtils.getIpAddr(servletRequest));
|
||||
ResponseEntity rsp = new ResponseEntity();
|
||||
if (goodsQuery == null || StringUtils.isEmpty(goodsQuery.getGoodsId())) {
|
||||
// 返回其他异常
|
||||
rsp.setCode(ResponseCode.OK.getCode());
|
||||
rsp.setMessage("请求查询的参数为空");
|
||||
return convertJsonString(rsp);
|
||||
}
|
||||
try {
|
||||
LambdaQueryWrapper<Goods> goodsLambdaQueryWrapper = new LambdaQueryWrapper<Goods>()
|
||||
.like(Goods::getGoodsId, goodsQuery.getGoodsId());
|
||||
rsp.setCode(ResponseCode.OK.getCode());
|
||||
rsp.setMessage("查询成功");
|
||||
rsp.setReturnData(goodsService.list(goodsLambdaQueryWrapper));
|
||||
return convertJsonString(rsp);
|
||||
} catch (Exception e) {
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
// 返回其他异常
|
||||
logger.error("查询物料信息发生错误:{}", e.getMessage());
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("查询物料发生异常");
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除当前物料信息
|
||||
*
|
||||
* @param goodsQuery 待删除的物料
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/deleteGoodsInfo")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
@MyLog(logTitle = "删除物料信息", logMethod = "deleteGoodsInfo")
|
||||
public String deleteVehicle(@RequestBody GoodsQuery goodsQuery) {
|
||||
logger.info("接收到删除物料信息请求:{},请求ip地址:{}", convertJsonString(goodsQuery), HttpUtils.getIpAddr(servletRequest));
|
||||
// 创建响应信息
|
||||
ResponseEntity rsp = new ResponseEntity();
|
||||
try {
|
||||
if (StringUtils.isEmpty(goodsQuery.getGoodsId())) {// 物料编码为空,不做处理
|
||||
logger.error("请求删除的物料编码为空");
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("请求删除的物料编码为空");
|
||||
return convertJsonString(rsp);
|
||||
}
|
||||
if (goodsService.remove(new LambdaQueryWrapper<Goods>().eq(Goods::getGoodsId, goodsQuery.getGoodsId()))) {
|
||||
logger.info("删除物料信息成功");
|
||||
rsp.setCode(ResponseCode.OK.getCode());
|
||||
rsp.setMessage("删除物料信息成功");
|
||||
} else {
|
||||
// 返回其他异常
|
||||
logger.error("删除物料信息成功");
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("删除物料信息失败");
|
||||
}
|
||||
return convertJsonString(rsp);
|
||||
} catch (Exception e) {
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
logger.error("发生异常:{}", e.getMessage());
|
||||
// 返回其他异常
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("删除物料信息发生异常");
|
||||
return convertJsonString(rsp);
|
||||
}
|
||||
}
|
||||
}
|
||||
189
src/main/java/com/wms/controller/JobComponent.java
Normal file
189
src/main/java/com/wms/controller/JobComponent.java
Normal file
|
|
@ -0,0 +1,189 @@
|
|||
package com.wms.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.wms.constants.enums.*;
|
||||
import com.wms.entity.app.ResponseEntity;
|
||||
import com.wms.entity.app.dto.TaskDto;
|
||||
import com.wms.entity.app.wcs.WcsTaskRequest;
|
||||
import com.wms.entity.table.Task;
|
||||
import com.wms.entity.table.WmsLog;
|
||||
import com.wms.service.*;
|
||||
import com.wms.utils.HttpUtils;
|
||||
import com.wms.utils.StringUtils;
|
||||
import com.wms.utils.WmsUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
import static com.wms.utils.StringUtils.convertJsonString;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
||||
import static com.wms.config.InitLocalConfig.configMap;
|
||||
|
||||
/**
|
||||
* 定期任务类
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class JobComponent {
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
/**
|
||||
* 任务服务
|
||||
*/
|
||||
private final TaskService taskService;
|
||||
/**
|
||||
* 库存服务
|
||||
*/
|
||||
private final StockService stockService;
|
||||
/**
|
||||
* 任务记录服务
|
||||
*/
|
||||
private final TaskRecordService taskRecordService;
|
||||
/**
|
||||
* 日志服务
|
||||
*/
|
||||
private final LogService logService;
|
||||
|
||||
|
||||
/**
|
||||
* 向Wcs下发任务
|
||||
* 每2秒执行一次
|
||||
*/
|
||||
@Scheduled(fixedDelay = 2000)
|
||||
public void executeTasks() {
|
||||
try {
|
||||
// 检索任务表---新建未下发的任务
|
||||
LambdaQueryWrapper<Task> waitForDistributeTaskQuery = new LambdaQueryWrapper<Task>()
|
||||
.eq(Task::getTaskStatus, WmsTaskStatus.NEW.getCode());
|
||||
List<TaskDto> allTasks = BeanUtil.copyToList(taskService.list(waitForDistributeTaskQuery), TaskDto.class);
|
||||
// 需要发送给wcs的任务列表
|
||||
List<WcsTaskRequest> request = new ArrayList<>();
|
||||
// 已经下发的任务组列表
|
||||
List<String> taskGroupIds = new ArrayList<>();
|
||||
if (!allTasks.isEmpty()) {
|
||||
for (TaskDto task : allTasks) {
|
||||
if (StringUtils.isNotEmpty(task.getPreTask())) {// 当前任务具有前置任务
|
||||
// 查询一下前置的任务有没有存在,存在则不下发
|
||||
if (taskService.exists(new LambdaQueryWrapper<Task>().eq(Task::getTaskId, task.getPreTask()))) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (taskGroupIds.contains(task.getTaskGroup())) {
|
||||
// 已经发送过的任务组,直接设置状态
|
||||
task.setTaskStatus(WmsTaskStatus.WAIT.getCode());
|
||||
}
|
||||
// 创建发送的任务
|
||||
WcsTaskRequest tempTask = new WcsTaskRequest();
|
||||
tempTask.setTaskId(task.getTaskGroup());
|
||||
if (Objects.equals(task.getTaskType(), TaskType.INVENTORY.getCode())) {
|
||||
tempTask.setTaskType(TaskType.OUT.getCode());
|
||||
} else {
|
||||
tempTask.setTaskType(task.getTaskType());
|
||||
}
|
||||
tempTask.setOrigin(task.getOrigin());
|
||||
tempTask.setDestination(task.getDestination());
|
||||
tempTask.setVehicleNo(task.getVehicleId());
|
||||
tempTask.setVehicleSize(task.getVehicleSize());
|
||||
tempTask.setWeight(task.getWeight());
|
||||
tempTask.setPriority(task.getTaskPriority());
|
||||
request.add(tempTask);
|
||||
task.setTaskStatus(WmsTaskStatus.WAIT.getCode());
|
||||
// 已经发送过的任务组
|
||||
taskGroupIds.add(task.getTaskGroup());
|
||||
}
|
||||
if (request.size() == 0) {
|
||||
return;
|
||||
}
|
||||
// 发送任务
|
||||
String url = configMap.get(ConfigMapKeyEnum.URL_WCS_TASK.getConfigKey());
|
||||
if (url != null) {
|
||||
logger.info("向WCS发送任务,地址:{},请求详情:{}", url, convertJsonString(request));
|
||||
ResponseEntity result = JSON.parseObject(HttpUtils.sendHttpPostWithoutToken(url, convertJsonString(request)), ResponseEntity.class);
|
||||
try {
|
||||
logService.save(new WmsLog(WmsUtils.generateId("LOG_"), "向WCS发送任务", "SetStackerTask", JSON.toJSONString(request), JSON.toJSONString(result), url, LocalDateTime.now(), "WMS"));
|
||||
} catch (Exception e) {
|
||||
logger.error("插入日志错误");
|
||||
}
|
||||
if (result != null && Objects.equals(ResponseCode.OK.getCode(), result.getCode())) {
|
||||
taskService.saveBatch(BeanUtil.copyToList(allTasks, Task.class));
|
||||
} else {
|
||||
if (result != null) {
|
||||
logger.error("存在错误:{}", result.getMessage());
|
||||
} else {
|
||||
logger.error("请求无返回");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logger.error("WCS发送任务地址为空");
|
||||
}
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
logger.error("查询等待任务发生异常:{}", convertJsonString(exception));
|
||||
}
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 每天查询一次是否有过期的库存
|
||||
// * 每天晚上8点执行一次
|
||||
// */
|
||||
//// @Scheduled(cron = "0 0 20 * * ?")
|
||||
// public void detectOutOfDateStock() {
|
||||
// logger.info("执行定时任务:查询过期库存");
|
||||
// List<StockDto> outOfDateStocks = stockService.selStockOutOfDate();
|
||||
// if (outOfDateStocks.size() > 0) {
|
||||
// logger.info("过期库存数量不为0,准备更新过期库存");
|
||||
// for (StockDto outOfDateStock : outOfDateStocks) {
|
||||
// try {
|
||||
// outOfDateStock.setGoodsStatus(GoodsStatus.OVERDUE.getCode());
|
||||
// stockService.modifyStock(outOfDateStock);
|
||||
// logger.info("过期库存更新成功");
|
||||
// } catch (Exception e) {
|
||||
// logger.error("过期库存更新异常:{}", e.getMessage());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 每天查询一次是否有入库后长期未使用的库存
|
||||
// * 每天晚上9点执行一次
|
||||
// */
|
||||
//// @Scheduled(cron = "0 0 21 * * ?")
|
||||
// public void detectStockLongTimeNoUse() {
|
||||
// logger.info("执行定时任务:查询是否有入库后长期未使用的库存");
|
||||
// List<StockDto> stocksLongTimeNoUse = stockService.selStockLongTimeNoUse(7);
|
||||
// if (stocksLongTimeNoUse.size() > 0) {
|
||||
// logger.info("有入库后长期未使用的库存, 准备更新库存状态");
|
||||
// for (StockDto stockLongTimeNoUse : stocksLongTimeNoUse) {
|
||||
// try {
|
||||
// stockLongTimeNoUse.setGoodsStatus(GoodsStatus.SCRAP.getCode());
|
||||
// stockService.modifyStock(stockLongTimeNoUse);
|
||||
// logger.info("长时间未使用库存状态更新成功");
|
||||
// } catch (Exception e) {
|
||||
// logger.error("长时间未使用库存状态更新异常:{}", e.getMessage());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 每天查询一次是否有过期记录
|
||||
// * 每天晚上10点执行一次
|
||||
// */
|
||||
//// @Scheduled(cron = "0 0 22 * * ?")
|
||||
// public void deleteOutOfDateData() {
|
||||
// logger.info("执行定时任务:删除过期数据");
|
||||
// taskRecordService.deleteTaskRecordRegularly();
|
||||
// if (logService.deleteWmsLogsRegularly(90)) {
|
||||
// logger.info("删除过期日志数据成功");
|
||||
// } else {
|
||||
// logger.info("删除过期日志数据失败");
|
||||
// }
|
||||
// }
|
||||
}
|
||||
298
src/main/java/com/wms/controller/LocationController.java
Normal file
298
src/main/java/com/wms/controller/LocationController.java
Normal file
|
|
@ -0,0 +1,298 @@
|
|||
package com.wms.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.wms.annotation.MyLog;
|
||||
import com.wms.constants.enums.ResponseCode;
|
||||
import com.wms.entity.app.dto.PageDto;
|
||||
import com.wms.entity.app.request.LocationQuery;
|
||||
import com.wms.entity.app.request.VehicleQuery;
|
||||
import com.wms.entity.app.ResponseEntity;
|
||||
import com.wms.entity.app.vo.VehicleVO;
|
||||
import com.wms.entity.table.Location;
|
||||
import com.wms.entity.table.Vehicle;
|
||||
import com.wms.service.LocationService;
|
||||
import com.wms.service.VehicleService;
|
||||
import com.wms.utils.HttpUtils;
|
||||
import com.wms.utils.StringUtils;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.transaction.annotation.Isolation;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import static com.wms.utils.StringUtils.convertJsonString;
|
||||
|
||||
/**
|
||||
* WMS库位控制类
|
||||
*
|
||||
* @author 梁州
|
||||
* @date 2023/3/6
|
||||
*/
|
||||
@Controller
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = "/wms/location")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class LocationController {
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
/**
|
||||
* 库位服务
|
||||
*/
|
||||
private final LocationService locationService;
|
||||
/**
|
||||
* 料箱服务
|
||||
*/
|
||||
private final VehicleService vehicleService;
|
||||
/**
|
||||
* 请求头部信息
|
||||
*/
|
||||
private final HttpServletRequest servletRequest;
|
||||
|
||||
|
||||
// /**
|
||||
// * 查询库位
|
||||
// *
|
||||
// * @param locationQuery 查询参数
|
||||
// * @return 结果
|
||||
// */
|
||||
// @PostMapping("/getLocations")
|
||||
// @ResponseBody
|
||||
// @Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
// @MyLog(logTitle = "删除物料信息", logMethod = "getLocations")
|
||||
// public String getLocations(@RequestBody LocationQuery locationQuery) {
|
||||
// // 创建响应信息
|
||||
// ResponseEntity rsp = new ResponseEntity();
|
||||
// try {
|
||||
// // 查询出所有符合条件的库位
|
||||
// List<LocationDto> locations = locationService.selLocations(location);
|
||||
// if (locations.size() < 1) {
|
||||
// logger.error("查询库位发生错误:库位不存在");
|
||||
// // 返回错误
|
||||
// rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
// rsp.setMessage("查询库位发生错误:库位不存在");
|
||||
// return JSON.toJSONString(rsp);
|
||||
// }
|
||||
// List<RowLocation> rowLocations = new LinkedList<>();
|
||||
// // 查找到最大的排
|
||||
// locations.sort(Comparator.comparing(LocationDto::getQueue).reversed());
|
||||
// int maxRow = locations.get(0).getQueue();
|
||||
// // 按排查找库位
|
||||
// for (int i = 0; i < maxRow; i++) {
|
||||
// int finalI = i;
|
||||
// List<LocationDto> currentRowLocations = new ArrayList<>(locations.stream()
|
||||
// .filter(l -> l.getQueue().equals(finalI + 1))
|
||||
// .toList());
|
||||
// // 先查找每一层的库位
|
||||
// List<LayerLocation> layerLocations = new LinkedList<>();
|
||||
// // 找到这一排最大的层
|
||||
// currentRowLocations.sort(Comparator.comparing(LocationDto::getLayer).reversed());
|
||||
// int maxLayer = currentRowLocations.get(0).getLayer();
|
||||
// // 按照每一列查找库位
|
||||
// for (int j = 0; j < maxLayer; j++) {
|
||||
// int finalJ = j;
|
||||
// List<LocationDto> currentLayerLocations = currentRowLocations.stream()
|
||||
// .filter(l -> l.getLayer().equals(finalJ + 1))
|
||||
// .toList();
|
||||
// LayerLocation tempLayerLocation = new LayerLocation();
|
||||
// tempLayerLocation.setLayer(finalJ + 1);
|
||||
// tempLayerLocation.setCurrentColLocations(currentLayerLocations);
|
||||
// layerLocations.add(tempLayerLocation);
|
||||
// }
|
||||
// RowLocation tempRowLocation = new RowLocation();
|
||||
// tempRowLocation.setRow(finalI + 1);
|
||||
// tempRowLocation.setCurrentLayerLocations(layerLocations);
|
||||
// rowLocations.add(tempRowLocation);
|
||||
// }
|
||||
// logger.info("查询库位数据成功,库区:{}", location.getAreaId());
|
||||
// // 设置最终数据
|
||||
// rsp.setReturnData(rowLocations);
|
||||
// // 返回成功
|
||||
// rsp.setCode(ResponseCode.OK.getCode());
|
||||
// rsp.setMessage("查询库位成功");
|
||||
// return JSON.toJSONString(rsp);
|
||||
// } catch (Exception e) {
|
||||
// logger.info("查询库位发生错误:{}", e.getMessage());
|
||||
// // 返回其他异常
|
||||
// rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
// rsp.setMessage(e.getMessage());
|
||||
// return JSON.toJSONString(rsp);
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* 更新库位信息
|
||||
*
|
||||
* @param locationQuery 库位
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/updateLocation")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
@MyLog(logTitle = "更新库位信息", logMethod = "updateLocation")
|
||||
public String updateLocation(@RequestBody LocationQuery locationQuery) {
|
||||
logger.info("接收到更新库位信息请求:{},请求ip地址:{}", convertJsonString(locationQuery), HttpUtils.getIpAddr(servletRequest));
|
||||
// 创建响应信息
|
||||
ResponseEntity rsp = new ResponseEntity();
|
||||
try {
|
||||
if (StringUtils.isEmpty(locationQuery.getLocationId())) {
|
||||
logger.error("缺少库位编号");
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("缺少库位编号!");
|
||||
return convertJsonString(rsp);
|
||||
}
|
||||
if (locationService.update(locationQuery.toLocationPO(), new LambdaQueryWrapper<Location>().eq(Location::getLocationId, locationQuery.getLocationId()))) {
|
||||
// 返回成功
|
||||
logger.info("更新库位信息成功");
|
||||
rsp.setCode(ResponseCode.OK.getCode());
|
||||
rsp.setMessage("更新库位信息成功");
|
||||
} else {
|
||||
// 返回失败
|
||||
logger.error("更新库位信息失败");
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("更新库位信息失败");
|
||||
}
|
||||
|
||||
return convertJsonString(rsp);
|
||||
} catch (Exception e) {
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
logger.info("更新库位信息发生异常:{}", convertJsonString(e));
|
||||
// 返回其他异常
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("Exception Occurred: 发生异常");
|
||||
return convertJsonString(rsp);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询料箱信息
|
||||
* @param vehicleQuery 查询参数
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/getVehiclesByPage")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
@MyLog(logTitle = "查询载具信息", logMethod = "getVehiclesByPage")
|
||||
public String getVehiclesByPage(@RequestBody VehicleQuery vehicleQuery) {
|
||||
logger.info("接收到查询载具信息请求:{},请求ip:{}", convertJsonString(vehicleQuery), HttpUtils.getIpAddr(servletRequest));
|
||||
ResponseEntity response = new ResponseEntity();
|
||||
try {
|
||||
Page<Vehicle> page = vehicleQuery.toMpPage();
|
||||
Page<Vehicle> vehiclePage = vehicleService.page(page, new LambdaQueryWrapper<Vehicle>()
|
||||
.like(StringUtils.isNotEmpty(vehicleQuery.getVehicleId()), Vehicle::getVehicleId, vehicleQuery.getVehicleId())
|
||||
.eq(vehicleQuery.getVehicleStatus() == null, Vehicle::getVehicleStatus, vehicleQuery.getVehicleStatus())
|
||||
.eq(vehicleQuery.getIsEmpty() == null, Vehicle::getIsEmpty, vehicleQuery.getIsEmpty()));
|
||||
|
||||
PageDto<VehicleVO> pageDto = PageDto.of(vehiclePage, vehicle -> BeanUtil.copyProperties(vehicle, VehicleVO.class));
|
||||
response.setCode(ResponseCode.OK.getCode());
|
||||
response.setMessage("查询成功");
|
||||
response.setReturnData(pageDto);
|
||||
return convertJsonString(response);
|
||||
} catch (Exception e) {
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
logger.error("查询载具信息发生异常");
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("查询载具信息发生异常");
|
||||
return convertJsonString(response);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新料箱信息
|
||||
*
|
||||
* @param vehicleQuery 料箱
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/updateVehicleInfo")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
@MyLog(logTitle = "更新载具信息", logMethod = "updateVehicleInfo")
|
||||
public String updateVehicleInfo(@RequestBody VehicleQuery vehicleQuery) {
|
||||
logger.info("接收到更新载具信息信息请求:{},请求ip:{}", convertJsonString(vehicleQuery), HttpUtils.getIpAddr(servletRequest));
|
||||
// 创建响应信息
|
||||
ResponseEntity rsp = new ResponseEntity();
|
||||
try {
|
||||
if (StringUtils.isEmpty(vehicleQuery.getVehicleId())) {// 载具号为空
|
||||
logger.error("缺少载具号");
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("缺少载具号");
|
||||
return convertJsonString(rsp);
|
||||
}
|
||||
if (vehicleService.update(vehicleQuery.toVehiclePO(), new LambdaQueryWrapper<Vehicle>().eq(Vehicle::getVehicleId, vehicleQuery.getVehicleId()))) {
|
||||
// 返回成功
|
||||
logger.info("更新载具信息成功");
|
||||
rsp.setCode(ResponseCode.OK.getCode());
|
||||
rsp.setMessage("更新载具信息成功");
|
||||
} else {
|
||||
// 返回失败
|
||||
logger.error("更新载具信息失败");
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("更新载具信息失败");
|
||||
}
|
||||
|
||||
return convertJsonString(rsp);
|
||||
} catch (Exception e) {
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
logger.info("更新载具信息发生异常:{}", convertJsonString(e));
|
||||
// 返回其他异常
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("更新载具信息发生异常");
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除当前料箱信息
|
||||
*
|
||||
* @param vehicleQuery 料箱
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/deleteVehicle")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
@MyLog(logTitle = "删除载具信息", logMethod = "deleteVehicle")
|
||||
public String deleteVehicle(@RequestBody VehicleQuery vehicleQuery) {
|
||||
logger.info("接收到删除载具信息信息请求:{},请求ip:{}", convertJsonString(vehicleQuery), HttpUtils.getIpAddr(servletRequest));
|
||||
// 创建响应信息
|
||||
ResponseEntity rsp = new ResponseEntity();
|
||||
try {
|
||||
if (StringUtils.isEmpty(vehicleQuery.getVehicleId())) {// 箱号为空,不执行
|
||||
logger.error("缺少载具号");
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("缺少载具号");
|
||||
return convertJsonString(rsp);
|
||||
}
|
||||
if (vehicleService.remove(new LambdaQueryWrapper<Vehicle>().eq(Vehicle::getVehicleId, vehicleQuery.getVehicleId()))) {
|
||||
// 返回成功
|
||||
logger.info("删除载具成功");
|
||||
rsp.setCode(ResponseCode.OK.getCode());
|
||||
rsp.setMessage("删除载具成功");
|
||||
} else {
|
||||
// 返回失败
|
||||
logger.error("删除载具失败");
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("删除载具失败");
|
||||
}
|
||||
|
||||
return convertJsonString(rsp);
|
||||
} catch (Exception e) {
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
logger.info("发生异常:{}", e.getMessage());
|
||||
// 返回其他异常
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage(e.getMessage());
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
}
|
||||
}
|
||||
82
src/main/java/com/wms/controller/RecordController.java
Normal file
82
src/main/java/com/wms/controller/RecordController.java
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
package com.wms.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.wms.constants.enums.ResponseCode;
|
||||
import com.wms.entity.app.ResponseEntity;
|
||||
import com.wms.entity.app.dto.PageDto;
|
||||
import com.wms.entity.app.request.TaskRecordQuery;
|
||||
import com.wms.entity.app.vo.TaskRecordVO;
|
||||
import com.wms.entity.table.TaskRecord;
|
||||
import com.wms.service.TaskRecordService;
|
||||
import com.wms.utils.HttpUtils;
|
||||
import com.wms.utils.StringUtils;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.transaction.annotation.Isolation;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import static com.wms.utils.StringUtils.convertJsonString;
|
||||
|
||||
/**
|
||||
* WMS记录控制类
|
||||
*
|
||||
* @author 梁州
|
||||
*/
|
||||
@Controller
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = "/wms/record")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class RecordController {
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
/**
|
||||
* 任务记录服务
|
||||
*/
|
||||
private final TaskRecordService taskRecordService;
|
||||
/**
|
||||
* 请求头部信息
|
||||
*/
|
||||
private final HttpServletRequest servletRequest;
|
||||
|
||||
/**
|
||||
* 查找所有物料
|
||||
*/
|
||||
@PostMapping("/getTaskRecordByPage")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
public String getGoodsInfoByPage(@RequestBody TaskRecordQuery taskRecordQuery){
|
||||
logger.info("接收到查询任务记录请求:{},请求ip:{}", convertJsonString(taskRecordQuery), HttpUtils.getIpAddr(servletRequest));
|
||||
ResponseEntity response = new ResponseEntity();
|
||||
try {
|
||||
Page<TaskRecord> page = taskRecordQuery.toMpPage();
|
||||
//更新条件
|
||||
LambdaQueryWrapper<TaskRecord> lambdaQueryWrapper = new LambdaQueryWrapper<TaskRecord>()
|
||||
.eq(taskRecordQuery.getTaskType() != null, TaskRecord::getTaskType, taskRecordQuery.getTaskType())
|
||||
.like(StringUtils.isNotEmpty(taskRecordQuery.getVehicleId()), TaskRecord::getVehicleId, taskRecordQuery.getVehicleId())
|
||||
.apply(StringUtils.isNotEmpty(taskRecordQuery.getGoodsId()), "goods_related ->> '$.goodsId' like concat('%', {0}, '%')", taskRecordQuery.getGoodsId())
|
||||
.apply(StringUtils.isNotEmpty(taskRecordQuery.getGoodsName()), "goods_related ->> '$.goodsName' like concat('%', {0}, '%')", taskRecordQuery.getGoodsName());
|
||||
Page<TaskRecord> taskRecordPage = taskRecordService.page(page, lambdaQueryWrapper);
|
||||
// 生成数据
|
||||
PageDto<TaskRecordVO> pageDto = PageDto.of(taskRecordPage, records -> BeanUtil.copyProperties(records, TaskRecordVO.class));
|
||||
response.setCode(ResponseCode.OK.getCode());
|
||||
response.setMessage("查询成功");
|
||||
response.setReturnData(pageDto);
|
||||
return convertJsonString(response);
|
||||
} catch (Exception e) {
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
logger.error("查询物料信息发生异常");
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("查询物料发生异常");
|
||||
return convertJsonString(response);
|
||||
}
|
||||
}
|
||||
}
|
||||
133
src/main/java/com/wms/controller/StandController.java
Normal file
133
src/main/java/com/wms/controller/StandController.java
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
package com.wms.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.wms.annotation.MyLog;
|
||||
import com.wms.constants.enums.ResponseCode;
|
||||
import com.wms.entity.app.ResponseEntity;
|
||||
import com.wms.entity.app.dto.PageDto;
|
||||
import com.wms.entity.app.dto.StandDto;
|
||||
import com.wms.entity.app.request.StandQuery;
|
||||
import com.wms.entity.app.vo.StandVo;
|
||||
import com.wms.entity.table.Stand;
|
||||
import com.wms.service.StandService;
|
||||
import com.wms.utils.HttpUtils;
|
||||
import com.wms.utils.StringUtils;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.transaction.annotation.Isolation;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import static com.wms.utils.StringUtils.convertJsonString;
|
||||
|
||||
/**
|
||||
* 站台控制类
|
||||
*/
|
||||
@Controller
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = "/wms/stand")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class StandController {
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
/**
|
||||
* 站台服务
|
||||
*/
|
||||
private final StandService standService;
|
||||
/**
|
||||
* 请求头部信息
|
||||
*/
|
||||
private final HttpServletRequest servletRequest;
|
||||
|
||||
/**
|
||||
* 查找所有站台信息
|
||||
*/
|
||||
@PostMapping("/getStandsByPage")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
public String getStandsByPage(@RequestBody StandQuery standQuery){
|
||||
logger.info("接收到查询站台信息请求:{},请求ip:{}", convertJsonString(standQuery), HttpUtils.getIpAddr(servletRequest));
|
||||
ResponseEntity response = new ResponseEntity();
|
||||
try {
|
||||
Page<Stand> page = standQuery.toMpPage();
|
||||
LambdaQueryWrapper<Stand> lambdaQueryWrapper = new LambdaQueryWrapper<Stand>()
|
||||
.like(StringUtils.isNotEmpty(standQuery.getStandId()), Stand::getStandId, standQuery.getStandId())
|
||||
.eq(standQuery.getStandStatus() != null, Stand::getStandStatus, standQuery.getStandStatus())
|
||||
.eq(standQuery.getIsLock() != null, Stand::getIsLock, standQuery.getIsLock())
|
||||
.eq(standQuery.getEquipmentType() != null, Stand::getStandType, standQuery.getEquipmentType());
|
||||
if (standQuery.getStandType() != null) {
|
||||
if (standQuery.getStandType() == 1) {// 入库
|
||||
lambdaQueryWrapper.eq(Stand::getAllowIn, 1);// 入库
|
||||
} else if (standQuery.getStandType() == 2) {// 出库
|
||||
lambdaQueryWrapper.eq(Stand::getAllowOut, 1);// 出库
|
||||
}
|
||||
}
|
||||
Page<Stand> standPage = standService.page(page, lambdaQueryWrapper);
|
||||
|
||||
PageDto<StandVo> pageDto = PageDto.of(standPage, stand -> BeanUtil.copyProperties(stand, StandVo.class));
|
||||
response.setCode(ResponseCode.OK.getCode());
|
||||
response.setMessage("查询站台成功");
|
||||
response.setReturnData(pageDto);
|
||||
return convertJsonString(response);
|
||||
} catch (Exception e) {
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
logger.error("查询站台发生异常:{}", convertJsonString(e));
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("查询站台发生异常");
|
||||
return convertJsonString(response);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新站台信息
|
||||
*
|
||||
* @param stand 站台信息
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/updateStandInfo")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
@MyLog(logTitle = "更新站台信息", logMethod = "updateStandInfo")
|
||||
public String updateGoodsInfo(@RequestBody StandDto stand) {
|
||||
logger.info("接收到更新站台信息请求:{},请求ip:{}", convertJsonString(stand), HttpUtils.getIpAddr(servletRequest));
|
||||
// 创建响应信息
|
||||
ResponseEntity rsp = new ResponseEntity();
|
||||
try {
|
||||
if (StringUtils.isEmpty(stand.getStandId())) {// 站台id为空,不允许更新
|
||||
logger.error("请求更新的站台id为空");
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("请求更新的站台id为空");
|
||||
return convertJsonString(rsp);
|
||||
}
|
||||
if (standService.update(BeanUtil.copyProperties(stand, Stand.class),
|
||||
new LambdaUpdateWrapper<Stand>().eq(Stand::getStandId, stand.getStandId()))) {
|
||||
// 返回成功
|
||||
logger.info("更新站台信息成功");
|
||||
rsp.setCode(ResponseCode.OK.getCode());
|
||||
rsp.setMessage("更新站台信息成功");
|
||||
} else {
|
||||
logger.error("更新站台信息失败");
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("更新站台信息失败");
|
||||
}
|
||||
return convertJsonString(rsp);
|
||||
} catch (Exception e) {
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
logger.error("更新站台信息发生异常:{}", convertJsonString(e));
|
||||
// 返回其他异常
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("更新站台信息发生异常");
|
||||
return convertJsonString(rsp);
|
||||
}
|
||||
}
|
||||
}
|
||||
190
src/main/java/com/wms/controller/StockController.java
Normal file
190
src/main/java/com/wms/controller/StockController.java
Normal file
|
|
@ -0,0 +1,190 @@
|
|||
package com.wms.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.wms.annotation.MyLog;
|
||||
import com.wms.constants.enums.ResponseCode;
|
||||
import com.wms.entity.app.ResponseEntity;
|
||||
import com.wms.entity.app.dto.PageDto;
|
||||
import com.wms.entity.app.dto.StockDto;
|
||||
import com.wms.entity.app.request.StockQuery;
|
||||
import com.wms.entity.app.vo.StockVo;
|
||||
import com.wms.entity.table.Stock;
|
||||
import com.wms.service.StockService;
|
||||
import com.wms.utils.HttpUtils;
|
||||
import com.wms.utils.StringUtils;
|
||||
import com.wms.utils.WmsUtils;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.transaction.annotation.Isolation;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import static com.wms.utils.StringUtils.convertJsonString;
|
||||
|
||||
/**
|
||||
* WMS库存控制类
|
||||
*
|
||||
* @author 梁州
|
||||
* @date 2023/2/14
|
||||
*/
|
||||
@Controller
|
||||
@CrossOrigin
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
@RequestMapping(value = "/wms/stock")
|
||||
public class StockController {
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
/**
|
||||
* 库存服务
|
||||
*/
|
||||
private final StockService stockService;
|
||||
|
||||
/**
|
||||
* 请求头部信息
|
||||
*/
|
||||
private final HttpServletRequest servletRequest;
|
||||
|
||||
/**
|
||||
* 查找所有物料
|
||||
*/
|
||||
@PostMapping("/getAllStocks")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
public String getAllStocks(@RequestBody StockQuery stockQuery) {
|
||||
logger.info("接收到查询库存数据请求:{},请求ip:{}", convertJsonString(stockQuery), HttpUtils.getIpAddr(servletRequest));
|
||||
ResponseEntity response = new ResponseEntity();
|
||||
try {
|
||||
Page<Stock> page = stockQuery.toMpPage();
|
||||
Page<Stock> stockPage = stockService.page(page, new LambdaQueryWrapper<Stock>()
|
||||
.like(StringUtils.isNotEmpty(stockQuery.getVehicleId()), Stock::getVehicleId, stockQuery.getVehicleId())
|
||||
.eq(StringUtils.isNotEmpty(stockQuery.getLocationId()), Stock::getLocationId, stockQuery.getLocationId())
|
||||
.eq(stockQuery.getStockStatus() != null, Stock::getStockStatus, stockQuery.getStockStatus())
|
||||
.apply(StringUtils.isNotEmpty(stockQuery.getGoodsId()), "goods_related ->> '$.goodsId' like concat('%', {0}, '%')", stockQuery.getGoodsId())
|
||||
.apply(StringUtils.isNotEmpty(stockQuery.getGoodsName()), "goods_related ->> '$.goodsId' like concat('%', {0}, '%')", stockQuery.getGoodsName()));
|
||||
|
||||
PageDto<StockVo> pageDto = PageDto.of(stockPage, stock -> BeanUtil.copyProperties(stock, StockVo.class));
|
||||
response.setCode(ResponseCode.OK.getCode());
|
||||
response.setMessage("查询库存成功");
|
||||
response.setReturnData(pageDto);
|
||||
return convertJsonString(response);
|
||||
} catch (Exception e) {
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
logger.error("查询库存发生异常:{}", convertJsonString(e));
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("查询库存发生异常");
|
||||
return convertJsonString(response);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 更新库存信息
|
||||
*
|
||||
* @param stock 库存
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/updateStockInfo")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
@MyLog(logTitle = "更新库存信息", logMethod = "updateStockInfo")
|
||||
public String updateStockInfo(@RequestBody StockDto stock) {
|
||||
logger.info("接收到更新库存信息请求:{},请求ip:{}", convertJsonString(stock), HttpUtils.getIpAddr(servletRequest));
|
||||
// 创建响应信息
|
||||
ResponseEntity rsp = new ResponseEntity();
|
||||
try {
|
||||
if (StringUtils.isEmpty(stock.getStockId())) {// 库存编号为空,不允许执行
|
||||
logger.error("请求的库存编号为空,不允许修改");
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("请求的库存编号为空,不允许修改");
|
||||
return convertJsonString(rsp);
|
||||
}
|
||||
LambdaQueryWrapper<Stock> stockLambdaQueryWrapper = new LambdaQueryWrapper<Stock>().eq(Stock::getStockId, stock.getStockId());
|
||||
if (stock.getGoodsRelated().getRemainNum().compareTo(BigDecimal.ZERO) <= 0) {
|
||||
if (stockService.remove(stockLambdaQueryWrapper)) {
|
||||
// 返回成功
|
||||
logger.info("数量为0,删除库存成功");
|
||||
rsp.setCode(ResponseCode.OK.getCode());
|
||||
rsp.setMessage("数量为0,删除库存成功");
|
||||
} else {
|
||||
// 返回失败
|
||||
logger.error("数量为0,删除库存失败");
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("数量为0,删除库存失败");
|
||||
}
|
||||
} else {
|
||||
if (stockService.update(BeanUtil.copyProperties(stock, Stock.class), stockLambdaQueryWrapper)) {
|
||||
// 返回成功
|
||||
logger.info("更新库存信息成功");
|
||||
rsp.setCode(ResponseCode.OK.getCode());
|
||||
rsp.setMessage("更新库存信息成功");
|
||||
return JSON.toJSONString(rsp);
|
||||
} else {
|
||||
// 返回失败
|
||||
logger.error("更新库存信息失败");
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("更新库存信息失败");
|
||||
}
|
||||
}
|
||||
return convertJsonString(rsp);
|
||||
} catch (Exception e) {
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
logger.info("更新库存信息发生异常:{}", convertJsonString(e));
|
||||
// 返回其他异常
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("更新库存信息发生异常");
|
||||
return convertJsonString(rsp);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增库存
|
||||
*
|
||||
* @param stock 库存
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/addNewStock")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
@MyLog(logTitle = "添加库存信息", logMethod = "addNewStock")
|
||||
public String addNewStock(@RequestBody StockDto stock) {
|
||||
logger.info("接收到添加信息请求:{},请求ip:{}", convertJsonString(stock), HttpUtils.getIpAddr(servletRequest));
|
||||
// 创建响应信息
|
||||
ResponseEntity rsp = new ResponseEntity();
|
||||
try {
|
||||
StockDto tempStock = new StockDto();
|
||||
tempStock.setStockId(WmsUtils.generateId("ST"));
|
||||
if (stockService.save(BeanUtil.copyProperties(stock, Stock.class))) {
|
||||
// 返回成功
|
||||
logger.info("添加库存信息成功");
|
||||
rsp.setCode(ResponseCode.OK.getCode());
|
||||
rsp.setMessage("添加库存信息成功");
|
||||
} else {
|
||||
// 返回失败
|
||||
logger.error("添加库存信息失败");
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("添加库存信息失败");
|
||||
}
|
||||
return JSON.toJSONString(rsp);
|
||||
} catch (Exception e) {
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
logger.info("发生异常:{}", e.getMessage());
|
||||
// 返回其他异常
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage(e.getMessage());
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
}
|
||||
}
|
||||
89
src/main/java/com/wms/controller/SystemController.java
Normal file
89
src/main/java/com/wms/controller/SystemController.java
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
package com.wms.controller;
|
||||
|
||||
import com.wms.constants.enums.ResponseCode;
|
||||
import com.wms.entity.app.ResponseEntity;
|
||||
import com.wms.entity.app.request.UserQuery;
|
||||
import com.wms.system_service.ISystemService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.transaction.annotation.Isolation;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import static com.wms.utils.StringUtils.convertJsonString;
|
||||
|
||||
@Controller
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = "/wms/system")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class SystemController {
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
/**
|
||||
* 系统服务
|
||||
*/
|
||||
private final ISystemService systemService;
|
||||
|
||||
/**
|
||||
* 重启系统
|
||||
*
|
||||
* @param user 用户
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/restartSystem")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
public String restartSystem(@RequestBody UserQuery user) {
|
||||
logger.info("接收到重启系统请求:{}", convertJsonString(user));
|
||||
ResponseEntity response = new ResponseEntity();
|
||||
if (user == null || user.getRoleId() != 1) {// 不是管理员不允许重启
|
||||
logger.error("非管理员不允许重启");
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("非管理员不允许重启");
|
||||
return convertJsonString(response);
|
||||
}
|
||||
if (systemService.restartSystem()) {
|
||||
logger.info("重启成功");
|
||||
response.setCode(ResponseCode.OK.getCode());
|
||||
response.setMessage("重启成功");
|
||||
} else {
|
||||
logger.error("重启失败");
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("重启失败");
|
||||
}
|
||||
return convertJsonString(response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 重新载入配置
|
||||
*
|
||||
* @param user 用户
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/reloadConfig")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
public String reloadConfig(@RequestBody UserQuery user) {
|
||||
logger.info("接收到重载配置请求:{}", convertJsonString(user));
|
||||
ResponseEntity response = new ResponseEntity();
|
||||
if (user == null || user.getRoleId() != 1) {// 不是管理员不允许重启
|
||||
logger.error("非管理员不允许重载配置");
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("非管理员不允许重载配置");
|
||||
return convertJsonString(response);
|
||||
}
|
||||
if (systemService.reloadConfig()) {
|
||||
logger.info("重载配置成功");
|
||||
response.setCode(ResponseCode.OK.getCode());
|
||||
response.setMessage("重载配置成功");
|
||||
} else {
|
||||
logger.error("重载配置失败");
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("重载配置失败");
|
||||
}
|
||||
return convertJsonString(response);
|
||||
}
|
||||
}
|
||||
931
src/main/java/com/wms/controller/TaskController.java
Normal file
931
src/main/java/com/wms/controller/TaskController.java
Normal file
|
|
@ -0,0 +1,931 @@
|
|||
package com.wms.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.wms.annotation.MyLog;
|
||||
import com.wms.constants.enums.*;
|
||||
import com.wms.entity.app.*;
|
||||
import com.wms.entity.app.dto.TaskDto;
|
||||
import com.wms.entity.app.dto.extend.StockDetailInfo;
|
||||
import com.wms.entity.app.dto.extend.TaskDetailInfo;
|
||||
import com.wms.entity.app.request.GoodsInRequest;
|
||||
import com.wms.entity.app.request.TaskInRequest;
|
||||
import com.wms.entity.app.request.TaskOutRequest;
|
||||
import com.wms.entity.app.request.WcsTaskResultRequest;
|
||||
import com.wms.entity.table.*;
|
||||
import com.wms.service.*;
|
||||
import com.wms.utils.HttpUtils;
|
||||
import com.wms.utils.StringUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.transaction.annotation.Isolation;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
||||
import static com.wms.config.InitLocalConfig.configMap;
|
||||
import static com.wms.utils.StringUtils.convertJsonString;
|
||||
import static com.wms.utils.WmsUtils.generateId;
|
||||
|
||||
/**
|
||||
* WMS任务控制类
|
||||
*
|
||||
* @author 梁州
|
||||
* @date 2023/2/14
|
||||
*/
|
||||
@Controller
|
||||
@CrossOrigin
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
@RequestMapping(value = "/wms/task")
|
||||
@Api(value = "WMS任务控制类")
|
||||
public class TaskController {
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
/**
|
||||
* 任务服务
|
||||
*/
|
||||
private final TaskService taskService;
|
||||
/**
|
||||
* 库存服务
|
||||
*/
|
||||
private final StockService stockService;
|
||||
/**
|
||||
* 库位服务
|
||||
*/
|
||||
private final LocationService locationService;
|
||||
/**
|
||||
* 任务记录服务
|
||||
*/
|
||||
private final TaskRecordService taskRecordService;
|
||||
/**
|
||||
* 站台服务
|
||||
*/
|
||||
private final StandService standService;
|
||||
/**
|
||||
* 物料服务
|
||||
*/
|
||||
private final GoodsService goodsService;
|
||||
/**
|
||||
* 载具服务
|
||||
*/
|
||||
private final VehicleService vehicleService;
|
||||
/**
|
||||
* 请求头部信息
|
||||
*/
|
||||
private final HttpServletRequest servletRequest;
|
||||
|
||||
/**
|
||||
* 接收入库任务请求
|
||||
*
|
||||
* @param taskInRequest 入库任务
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/requestIn")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
@MyLog(logTitle = "入库请求", logMethod = "requestIn")
|
||||
@ApiOperation(value = "请求入库")
|
||||
public String receiveTaskInRequest(@RequestBody TaskInRequest taskInRequest) {
|
||||
logger.info("接收到入库请求:{},ip地址:{}", JSON.toJSONString(taskInRequest), HttpUtils.getIpAddr(servletRequest));
|
||||
// 创建响应信息
|
||||
ResponseEntity response = new ResponseEntity();
|
||||
try {
|
||||
// 验证入库请求
|
||||
String validationInfo = validateTaskInRequest(taskInRequest);
|
||||
if (!Objects.equals(validationInfo, TaskInValidationEnum.OK.getErrorMessage())) {
|
||||
logger.error("入库请求验证错误!{}", validationInfo);
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("入库请求验证错误!" + validationInfo);
|
||||
return convertJsonString(response);
|
||||
}
|
||||
Map<String, String> nextLocationMap = new HashMap<>();
|
||||
// 请求可用库位
|
||||
for (int i = 0; i < locationService.count(new LambdaQueryWrapper<Location>().eq(Location::getLocationStatus, LocationStatus.EMPTY.getCode())); i++) {
|
||||
Map<String, String> resultMap = locationService.getOneLocation(taskInRequest.getOriginPoint(), null);
|
||||
if (resultMap.isEmpty() || !resultMap.containsKey("nextLocationId")) {
|
||||
logger.error("暂无可用库位");
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("暂无可用库位!");
|
||||
return convertJsonString(response);
|
||||
} else {
|
||||
Location nextLocation = locationService.getOne(new LambdaQueryWrapper<Location>().eq(Location::getLocationId, resultMap.get("nextLocationId")));
|
||||
LambdaUpdateWrapper<Location> updateLocationWrapper = new LambdaUpdateWrapper<Location>()
|
||||
.set(Location::getLocationStatus, LocationStatus.OCCUPY.getCode())
|
||||
.set(Location::getVehicleId, taskInRequest.getVehicleId())
|
||||
.eq(Location::getLocationId, nextLocation.getLocationId())
|
||||
.eq(Location::getLocationStatus, LocationStatus.EMPTY.getCode());
|
||||
if (locationService.update(updateLocationWrapper)) {
|
||||
nextLocationMap = resultMap;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (nextLocationMap.isEmpty() || !nextLocationMap.containsKey("nextLocationId")) {
|
||||
logger.error("暂无可用库位");
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("暂无可用库位!");
|
||||
return convertJsonString(response);
|
||||
}
|
||||
// 生成入库任务
|
||||
String saveTaskResult;
|
||||
if (taskInRequest.getGoodsList() == null || taskInRequest.getGoodsList().isEmpty()) {// 空托入库
|
||||
saveTaskResult = genEmptyInTask(taskInRequest, nextLocationMap.get("nextLocationId"), nextLocationMap.get("preTaskId"));
|
||||
} else {// 带料入库
|
||||
saveTaskResult = genGoodsInTask(taskInRequest, nextLocationMap.get("nextLocationId"), nextLocationMap.get("preTaskId"));
|
||||
}
|
||||
if (!saveTaskResult.equals("")) {
|
||||
// 回退库位锁定
|
||||
locationService.update(new LambdaUpdateWrapper<Location>()
|
||||
.set(Location::getLocationStatus, LocationStatus.EMPTY.getCode())
|
||||
.set(Location::getVehicleId, "")
|
||||
.eq(Location::getLocationId, nextLocationMap.get("nextLocationId"))
|
||||
.eq(Location::getLocationStatus, LocationStatus.OCCUPY.getCode()));
|
||||
}
|
||||
|
||||
logger.info("接收入库请求成功!");
|
||||
response.setCode(ResponseCode.OK.getCode());
|
||||
response.setMessage("接收入库请求成功!");
|
||||
return convertJsonString(response);
|
||||
} catch (Exception e) {
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
logger.error("发生异常:{}", e.getMessage());
|
||||
// 返回其他异常
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("发生意料之外的错误");
|
||||
return convertJsonString(response);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加空入库任务
|
||||
*
|
||||
* @param taskInRequest 入库请求
|
||||
* @param locationId 库位id
|
||||
* @param preTaskId 前置任务
|
||||
* @return 添加结果
|
||||
*/
|
||||
private String genEmptyInTask(TaskInRequest taskInRequest, String locationId, String preTaskId) {
|
||||
String result = "";
|
||||
Task tempInTask = new Task();
|
||||
tempInTask.setTaskId(generateId("RK_"));
|
||||
tempInTask.setTaskType(TaskType.IN.getCode());
|
||||
tempInTask.setTaskStatus(WmsTaskStatus.NEW.getCode());
|
||||
tempInTask.setTaskGroup(generateId(""));
|
||||
tempInTask.setTaskPriority(1);
|
||||
tempInTask.setVehicleId(taskInRequest.getVehicleId());
|
||||
tempInTask.setOrigin(taskInRequest.getOriginPoint());
|
||||
tempInTask.setDestination(locationId);
|
||||
tempInTask.setVehicleSize(1);
|
||||
tempInTask.setWeight(taskInRequest.getTotalWeight());
|
||||
tempInTask.setCreateTime(LocalDateTime.now());
|
||||
tempInTask.setUserName(taskInRequest.getUserName());
|
||||
tempInTask.setPreTask(preTaskId);
|
||||
try {
|
||||
if (!taskService.save(tempInTask)) {
|
||||
return "添加空入库任务失败";
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("添加空入库任务异常:{}", convertJsonString(e));
|
||||
return "添加空入库任务失败";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加入库任务
|
||||
*
|
||||
* @param taskInRequest 入库请求
|
||||
* @param locationId 库位号
|
||||
* @param preTaskId 前置任务
|
||||
* @return 添加结果
|
||||
*/
|
||||
private String genGoodsInTask(TaskInRequest taskInRequest, String locationId, String preTaskId) {
|
||||
String result = "";
|
||||
String taskGroupId = generateId("");
|
||||
List<Task> tempTasks = new ArrayList<>();
|
||||
for (GoodsInRequest goodsInRequest : taskInRequest.getGoodsList()) {
|
||||
Task tempInTask = new Task();
|
||||
tempInTask.setTaskId(generateId("RK_"));
|
||||
tempInTask.setTaskType(TaskType.IN.getCode());
|
||||
tempInTask.setTaskStatus(WmsTaskStatus.NEW.getCode());
|
||||
tempInTask.setTaskGroup(taskGroupId);
|
||||
tempInTask.setTaskPriority(1);
|
||||
tempInTask.setVehicleId(taskInRequest.getVehicleId());
|
||||
tempInTask.setOrigin(taskInRequest.getOriginPoint());
|
||||
tempInTask.setDestination(locationId);
|
||||
tempInTask.setVehicleSize(1);
|
||||
tempInTask.setWeight(taskInRequest.getTotalWeight());
|
||||
tempInTask.setCreateTime(LocalDateTime.now());
|
||||
tempInTask.setUserName(taskInRequest.getUserName());
|
||||
tempInTask.setPreTask(preTaskId);
|
||||
// 物料相关信息
|
||||
TaskDetailInfo goodsRelatedInfo = new TaskDetailInfo();
|
||||
// TODO 物料信息需要完善
|
||||
goodsRelatedInfo.setGoodsId(goodsInRequest.getGoodsId());
|
||||
goodsRelatedInfo.setGoodsName("");
|
||||
goodsRelatedInfo.setOpNum(goodsInRequest.getGoodsNum());
|
||||
goodsRelatedInfo.setOriginNum(BigDecimal.ZERO);
|
||||
tempInTask.setGoodsRelated(goodsRelatedInfo);
|
||||
|
||||
tempTasks.add(tempInTask);
|
||||
}
|
||||
|
||||
try {
|
||||
if (!taskService.saveBatch(tempTasks)) {
|
||||
return "添加入库任务失败";
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("添加入库任务异常:{}", convertJsonString(e));
|
||||
return "添加入库任务失败";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证入库请求
|
||||
*
|
||||
* @param taskInRequest 入库请求
|
||||
* @return 验证结果---空为验证通过,否则输出错误信息
|
||||
*/
|
||||
private String validateTaskInRequest(TaskInRequest taskInRequest) {
|
||||
// 验证任务请求
|
||||
if (taskInRequest == null) {
|
||||
return TaskInValidationEnum.NO_REQUEST_BODY.getErrorMessage();
|
||||
}
|
||||
// 验证载具号
|
||||
if (StringUtils.isEmpty(taskInRequest.getVehicleId())) {
|
||||
return TaskInValidationEnum.NO_VEHICLE_ID.getErrorMessage();
|
||||
}
|
||||
// 验证载具号是否重复入库
|
||||
if (vehicleService.exists(new LambdaQueryWrapper<Vehicle>().eq(Vehicle::getVehicleId, taskInRequest.getVehicleId())
|
||||
.and(wrapper -> wrapper.eq(Vehicle::getVehicleStatus, VehicleStatus.ON.getCode())
|
||||
.or().eq(Vehicle::getVehicleStatus, VehicleStatus.MOVE.getCode())))) {
|
||||
return TaskInValidationEnum.DUPLICATE_VEHICLE_ID.getErrorMessage();
|
||||
}
|
||||
// 验证当前载具是否已经有入库任务
|
||||
if (taskService.exists(new LambdaQueryWrapper<Task>().eq(Task::getVehicleId, taskInRequest.getVehicleId())
|
||||
.and(wrapper -> wrapper.eq(Task::getTaskType, TaskType.IN.getCode())))) {
|
||||
return TaskInValidationEnum.DUPLICATE_VEHICLE_ID.getErrorMessage();
|
||||
}
|
||||
// 验证重量
|
||||
if (taskInRequest.getTotalWeight() == null) {
|
||||
return TaskInValidationEnum.NO_WEIGHT.getErrorMessage();
|
||||
}
|
||||
BigDecimal max_weight = BigDecimal.valueOf(10000000);
|
||||
try {
|
||||
max_weight = new BigDecimal(configMap.get(ConfigMapKeyEnum.MAX_WEIGHT.getConfigKey()));
|
||||
} catch (Exception e) {
|
||||
logger.error("转换配置项---最大承重,发生错误");
|
||||
}
|
||||
if (taskInRequest.getTotalWeight().compareTo(max_weight) > 0) {
|
||||
// 超重
|
||||
return TaskInValidationEnum.OVER_WEIGHT.getErrorMessage();
|
||||
}
|
||||
// 验证起点
|
||||
if (StringUtils.isEmpty(taskInRequest.getOriginPoint())) {
|
||||
return TaskInValidationEnum.NO_IN_POINT.getErrorMessage();
|
||||
} else {
|
||||
if (!standService.validateStand(taskInRequest.getOriginPoint(), TaskType.IN.getCode())) {
|
||||
return TaskInValidationEnum.ERROR_IN_POINT.getErrorMessage();
|
||||
}
|
||||
}
|
||||
// 验证物料信息
|
||||
if (taskInRequest.getGoodsList() != null && !taskInRequest.getGoodsList().isEmpty()) {
|
||||
for (GoodsInRequest goodsInRequest : taskInRequest.getGoodsList()) {
|
||||
// 验证物料编号
|
||||
if (StringUtils.isEmpty(goodsInRequest.getGoodsId())) {
|
||||
return TaskInValidationEnum.NO_GOODS_ID.getErrorMessage();
|
||||
} else {
|
||||
if (!goodsService.validateGoodsId(goodsInRequest.getGoodsId())) {
|
||||
return TaskInValidationEnum.ERROR_GOODS_ID.getErrorMessage();
|
||||
}
|
||||
}
|
||||
// 验证数量
|
||||
if (goodsInRequest.getGoodsNum() == null || goodsInRequest.getGoodsNum().compareTo(BigDecimal.ZERO) <= 0) {
|
||||
return TaskInValidationEnum.ERROR_GOODS_NUM.getErrorMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
return TaskInValidationEnum.OK.getErrorMessage();
|
||||
}
|
||||
|
||||
/**
|
||||
* 接收出库任务请求
|
||||
*
|
||||
* @param taskOutRequest 出库任务
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/requestOut")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
@MyLog(logTitle = "出库请求", logMethod = "requestOut")
|
||||
@ApiOperation(value = "请求入库")
|
||||
public String receiveTaskOutRequest(@RequestBody TaskOutRequest taskOutRequest) {
|
||||
logger.info("接收到出库请求:{},ip地址:{}", JSON.toJSONString(taskOutRequest), HttpUtils.getIpAddr(servletRequest));
|
||||
// 创建响应信息
|
||||
ResponseEntity response = new ResponseEntity();
|
||||
try {
|
||||
// 验证出库请求
|
||||
String validationInfo = validateTaskOutRequest(taskOutRequest);
|
||||
if (!Objects.equals(validationInfo, TaskInValidationEnum.OK.getErrorMessage())) {
|
||||
logger.error("出库请求验证错误!{}", validationInfo);
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("出库请求验证错误:" + validationInfo);
|
||||
return convertJsonString(response);
|
||||
}
|
||||
// 没有物料,单纯载具或者库位出库
|
||||
String genResult;
|
||||
if (StringUtils.isEmpty(taskOutRequest.getGoodsId())) {
|
||||
genResult = genVehicleLocationOutTask(taskOutRequest);
|
||||
} else {
|
||||
genResult = genGoodsOutTask(taskOutRequest);
|
||||
}
|
||||
if (!genResult.equals("")) {
|
||||
logger.error("出库错误!{}", genResult);
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("出库错误:" + genResult);
|
||||
return convertJsonString(response);
|
||||
}
|
||||
|
||||
logger.info("处理出库请求成功!");
|
||||
response.setCode(ResponseCode.OK.getCode());
|
||||
response.setMessage("处理出库请求成功!");
|
||||
return convertJsonString(response);
|
||||
} catch (Exception e) {
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
logger.error("发生异常:{}", convertJsonString(e));
|
||||
// 返回其他异常
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("发生意料之外的错误");
|
||||
return convertJsonString(response);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 生成载具或库位出库任务
|
||||
*
|
||||
* @param taskOutRequest 出库请求
|
||||
* @return 结果
|
||||
*/
|
||||
private String genVehicleLocationOutTask(TaskOutRequest taskOutRequest) {
|
||||
// 查询对应载具
|
||||
if (StringUtils.isNotEmpty(taskOutRequest.getVehicleId())) {
|
||||
Vehicle currentVehicle = vehicleService.getOne(new LambdaQueryWrapper<Vehicle>().eq(Vehicle::getVehicleId, taskOutRequest.getVehicleId()));
|
||||
// 创建空出库任务
|
||||
Task vehicleOutTask = new Task();
|
||||
vehicleOutTask.setTaskId(generateId("CK_"));
|
||||
vehicleOutTask.setTaskType(TaskType.OUT.getCode());
|
||||
vehicleOutTask.setTaskGroup(generateId(""));
|
||||
vehicleOutTask.setTaskStatus(WmsTaskStatus.NEW.getCode());
|
||||
vehicleOutTask.setTaskPriority(1);
|
||||
TaskDto moveTask = taskService.genMoveTask(currentVehicle.getCurrentLocation());
|
||||
if (moveTask != null) {
|
||||
if (moveTask.getTaskId().equals("LOCKED")) {
|
||||
return "外层库位上锁,无法出库";
|
||||
}
|
||||
vehicleOutTask.setPreTask(moveTask.getTaskId());
|
||||
}
|
||||
vehicleOutTask.setVehicleId(taskOutRequest.getVehicleId());
|
||||
vehicleOutTask.setUserName(taskOutRequest.getUserName());
|
||||
vehicleOutTask.setOrigin(currentVehicle.getCurrentLocation());
|
||||
vehicleOutTask.setDestination(taskOutRequest.getDestinationPoint());
|
||||
vehicleOutTask.setIsPicking(taskOutRequest.getIsPicking());
|
||||
vehicleOutTask.setPickStand(taskOutRequest.getPickStand());
|
||||
vehicleOutTask.setCreateTime(LocalDateTime.now());
|
||||
taskService.save(vehicleOutTask);
|
||||
// 对应载具所有库存上锁
|
||||
stockService.update(new LambdaUpdateWrapper<Stock>()
|
||||
.set(Stock::getStockStatus, StockStatus.OUT.getCode())
|
||||
.eq(Stock::getVehicleId, taskOutRequest.getVehicleId()));
|
||||
// 对应载具状态设置
|
||||
vehicleService.update(new LambdaUpdateWrapper<Vehicle>()
|
||||
.set(Vehicle::getVehicleStatus, VehicleStatus.OUT.getCode())
|
||||
.eq(Vehicle::getVehicleId, taskOutRequest.getVehicleId()));
|
||||
} else {
|
||||
// 查找对应库位
|
||||
Location currentLocation = locationService.getOne(new LambdaQueryWrapper<Location>().eq(Location::getLocationId, taskOutRequest.getOriginPoint()));
|
||||
// 创建空出库任务
|
||||
Task vehicleOutTask = new Task();
|
||||
vehicleOutTask.setTaskId(generateId("CK_"));
|
||||
vehicleOutTask.setTaskType(TaskType.OUT.getCode());
|
||||
vehicleOutTask.setTaskGroup(generateId(""));
|
||||
vehicleOutTask.setTaskStatus(WmsTaskStatus.NEW.getCode());
|
||||
vehicleOutTask.setTaskPriority(1);
|
||||
TaskDto moveTask = taskService.genMoveTask(currentLocation.getLocationId());
|
||||
if (moveTask != null) {
|
||||
if (moveTask.getTaskId().equals("LOCKED")) {
|
||||
return "外层库位上锁,无法出库";
|
||||
}
|
||||
vehicleOutTask.setPreTask(moveTask.getTaskId());
|
||||
}
|
||||
vehicleOutTask.setVehicleId(currentLocation.getVehicleId());
|
||||
vehicleOutTask.setUserName(taskOutRequest.getUserName());
|
||||
vehicleOutTask.setOrigin(currentLocation.getLocationId());
|
||||
vehicleOutTask.setDestination(taskOutRequest.getDestinationPoint());
|
||||
vehicleOutTask.setIsPicking(taskOutRequest.getIsPicking());
|
||||
vehicleOutTask.setPickStand(taskOutRequest.getPickStand());
|
||||
vehicleOutTask.setCreateTime(LocalDateTime.now());
|
||||
taskService.save(vehicleOutTask);
|
||||
// 对应库位所有库存上锁
|
||||
stockService.update(new LambdaUpdateWrapper<Stock>()
|
||||
.set(Stock::getStockStatus, StockStatus.OUT.getCode())
|
||||
.eq(Stock::getLocationId, taskOutRequest.getOriginPoint()));
|
||||
// 对应库位状态设置
|
||||
vehicleService.update(new LambdaUpdateWrapper<Vehicle>()
|
||||
.set(Vehicle::getVehicleStatus, VehicleStatus.OUT.getCode())
|
||||
.eq(Vehicle::getCurrentLocation, taskOutRequest.getOriginPoint()));
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成物料出库任务
|
||||
*
|
||||
* @param taskOutRequest 出库请求
|
||||
* @return 结果
|
||||
*/
|
||||
private String genGoodsOutTask(TaskOutRequest taskOutRequest) {
|
||||
// 查询库存
|
||||
LambdaQueryWrapper<Stock> stockQueryWrapper = new LambdaQueryWrapper<Stock>()
|
||||
.apply("goods_related -> '$.goodsId' = {0}", taskOutRequest.getGoodsId())
|
||||
.apply("goods_related -> '$.remainNum' > 0")
|
||||
.eq(StringUtils.isNotEmpty(taskOutRequest.getVehicleId()), Stock::getVehicleId, taskOutRequest.getVehicleId())
|
||||
.eq(StringUtils.isNotEmpty(taskOutRequest.getOriginPoint()), Stock::getLocationId, taskOutRequest.getOriginPoint());
|
||||
List<Stock> stocks = stockService.list(stockQueryWrapper);
|
||||
List<Task> goodsOutTasks = new ArrayList<>();
|
||||
BigDecimal needNum = taskOutRequest.getGoodsNum();
|
||||
for (Stock stock : stocks) {
|
||||
if (Objects.equals(stock.getStockStatus(), StockStatus.OK.getCode())) {// 库存状态正常的情况
|
||||
// 悲观锁,锁定库存状态---同一载具下的库存
|
||||
boolean lockStocksFlag = stockService.update(new LambdaUpdateWrapper<Stock>()
|
||||
.set(Stock::getStockStatus, StockStatus.OUT.getCode())
|
||||
.eq(Stock::getVehicleId, stock.getVehicleId())
|
||||
.eq(Stock::getStockStatus, StockStatus.OK.getCode()));
|
||||
|
||||
// 锁定载具状态
|
||||
boolean lockVehicleFlag = vehicleService.update(new LambdaUpdateWrapper<Vehicle>()
|
||||
.set(Vehicle::getVehicleStatus, VehicleStatus.OUT.getCode())
|
||||
.eq(Vehicle::getVehicleId, stock.getVehicleId())
|
||||
.eq(Vehicle::getVehicleStatus, VehicleStatus.ON));
|
||||
if (!lockStocksFlag || !lockVehicleFlag) {
|
||||
// 释放锁
|
||||
stockService.update(new LambdaUpdateWrapper<Stock>()
|
||||
.set(Stock::getStockStatus, StockStatus.OK.getCode())
|
||||
.eq(Stock::getVehicleId, stock.getVehicleId())
|
||||
.eq(Stock::getStockStatus, StockStatus.OK.getCode()));
|
||||
vehicleService.update(new LambdaUpdateWrapper<Vehicle>()
|
||||
.set(Vehicle::getVehicleStatus, VehicleStatus.ON.getCode())
|
||||
.eq(Vehicle::getVehicleId, stock.getVehicleId()));
|
||||
continue;
|
||||
}
|
||||
// 创建出库任务
|
||||
Task vehicleOutTask = new Task();
|
||||
vehicleOutTask.setTaskId(generateId("CK_"));
|
||||
vehicleOutTask.setTaskType(TaskType.OUT.getCode());
|
||||
vehicleOutTask.setTaskGroup(generateId(""));
|
||||
vehicleOutTask.setTaskStatus(WmsTaskStatus.NEW.getCode());
|
||||
vehicleOutTask.setTaskPriority(1);
|
||||
TaskDto moveTask = taskService.genMoveTask(stock.getLocationId());
|
||||
if (moveTask != null) {
|
||||
if (moveTask.getTaskId().equals("LOCKED")) {
|
||||
continue;
|
||||
}
|
||||
vehicleOutTask.setPreTask(moveTask.getTaskId());
|
||||
}
|
||||
vehicleOutTask.setVehicleId(stock.getVehicleId());
|
||||
vehicleOutTask.setUserName(taskOutRequest.getUserName());
|
||||
vehicleOutTask.setOrigin(stock.getLocationId());
|
||||
vehicleOutTask.setDestination(taskOutRequest.getDestinationPoint());
|
||||
vehicleOutTask.setIsPicking(taskOutRequest.getIsPicking());
|
||||
vehicleOutTask.setPickStand(taskOutRequest.getPickStand());
|
||||
vehicleOutTask.setCreateTime(LocalDateTime.now());
|
||||
// TODO 设定物料相关信息 需要完善
|
||||
TaskDetailInfo taskDetailInfo = new TaskDetailInfo();
|
||||
taskDetailInfo.setGoodsId(stock.getGoodsRelated().getGoodsId());
|
||||
taskDetailInfo.setGoodsName(stock.getGoodsRelated().getGoodsName());
|
||||
taskDetailInfo.setOpNum(needNum.compareTo(stock.getGoodsRelated().getRemainNum()) > 0 ? stock.getGoodsRelated().getRemainNum() : needNum);
|
||||
taskDetailInfo.setOriginNum(stock.getGoodsRelated().getRemainNum());
|
||||
vehicleOutTask.setGoodsRelated(taskDetailInfo);
|
||||
goodsOutTasks.add(vehicleOutTask);
|
||||
needNum = needNum.subtract(stock.getGoodsRelated().getRemainNum());
|
||||
} else if (Objects.equals(stock.getStockStatus(), StockStatus.OUT.getCode())) {
|
||||
// 查询到当前当前载具对应的任务,并同步
|
||||
Task sameVehicleTask = taskService.getOne(new LambdaQueryWrapper<Task>()
|
||||
.eq(Task::getVehicleId, stock.getVehicleId()));
|
||||
// 创建出库任务
|
||||
Task vehicleOutTask = new Task();
|
||||
vehicleOutTask.setTaskId(generateId("CK_"));
|
||||
vehicleOutTask.setTaskType(TaskType.OUT.getCode());
|
||||
if (sameVehicleTask != null) {
|
||||
vehicleOutTask.setTaskGroup(sameVehicleTask.getTaskGroup());
|
||||
vehicleOutTask.setTaskStatus(sameVehicleTask.getTaskStatus());
|
||||
vehicleOutTask.setTaskPriority(sameVehicleTask.getTaskPriority());
|
||||
vehicleOutTask.setPreTask(sameVehicleTask.getPreTask());
|
||||
} else {
|
||||
vehicleOutTask.setTaskGroup(generateId(""));
|
||||
vehicleOutTask.setTaskStatus(WmsTaskStatus.NEW.getCode());
|
||||
vehicleOutTask.setTaskPriority(1);
|
||||
TaskDto moveTask = taskService.genMoveTask(stock.getLocationId());
|
||||
if (moveTask != null) {
|
||||
if (moveTask.getTaskId().equals("LOCKED")) {
|
||||
continue;
|
||||
}
|
||||
vehicleOutTask.setPreTask(moveTask.getTaskId());
|
||||
}
|
||||
}
|
||||
vehicleOutTask.setVehicleId(stock.getVehicleId());
|
||||
vehicleOutTask.setUserName(taskOutRequest.getUserName());
|
||||
vehicleOutTask.setOrigin(stock.getLocationId());
|
||||
vehicleOutTask.setDestination(taskOutRequest.getDestinationPoint());
|
||||
vehicleOutTask.setIsPicking(taskOutRequest.getIsPicking());
|
||||
vehicleOutTask.setPickStand(taskOutRequest.getPickStand());
|
||||
vehicleOutTask.setCreateTime(LocalDateTime.now());
|
||||
// TODO 设定物料相关信息 需要完善
|
||||
TaskDetailInfo taskDetailInfo = new TaskDetailInfo();
|
||||
taskDetailInfo.setGoodsId(stock.getGoodsRelated().getGoodsId());
|
||||
taskDetailInfo.setGoodsName(stock.getGoodsRelated().getGoodsName());
|
||||
taskDetailInfo.setOpNum(needNum.compareTo(stock.getGoodsRelated().getRemainNum()) > 0 ? stock.getGoodsRelated().getRemainNum() : needNum);
|
||||
taskDetailInfo.setOriginNum(stock.getGoodsRelated().getRemainNum());
|
||||
vehicleOutTask.setGoodsRelated(taskDetailInfo);
|
||||
goodsOutTasks.add(vehicleOutTask);
|
||||
needNum = needNum.subtract(stock.getGoodsRelated().getRemainNum());
|
||||
}
|
||||
// 盘点,移库,锁定状态不可使用
|
||||
if (needNum.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
// 库存足够,跳出循环
|
||||
break;
|
||||
}
|
||||
}
|
||||
// 添加任务记录表
|
||||
taskService.saveBatch(goodsOutTasks);
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证出库请求
|
||||
*
|
||||
* @param taskOutRequest 出库请求
|
||||
* @return 验证结果---空为验证通过,否则输出错误信息
|
||||
*/
|
||||
private String validateTaskOutRequest(TaskOutRequest taskOutRequest) {
|
||||
// 验证任务
|
||||
if (taskOutRequest == null) {
|
||||
return TaskOutValidationEnum.NO_REQUEST_BODY.getErrorMessage();
|
||||
}
|
||||
// 验证是否包含请求信息
|
||||
if (StringUtils.isEmpty(taskOutRequest.getGoodsId())
|
||||
&& StringUtils.isEmpty(taskOutRequest.getVehicleId())
|
||||
&& StringUtils.isEmpty(taskOutRequest.getOriginPoint())) {
|
||||
return TaskOutValidationEnum.LACK_REQUIRED_PARAM.getErrorMessage();
|
||||
}
|
||||
// 验证载具号
|
||||
if (StringUtils.isNotEmpty(taskOutRequest.getVehicleId())
|
||||
&& vehicleService.exists(new LambdaQueryWrapper<Vehicle>().eq(Vehicle::getVehicleId, taskOutRequest.getVehicleId()))) {
|
||||
return TaskOutValidationEnum.ERROR_VEHICLE_ID.getErrorMessage();
|
||||
}
|
||||
// 验证库位
|
||||
if (StringUtils.isNotEmpty(taskOutRequest.getOriginPoint())
|
||||
&& locationService.exists(new LambdaQueryWrapper<Location>().eq(Location::getLocationId, taskOutRequest.getOriginPoint()))) {
|
||||
return TaskOutValidationEnum.ERROR_ORIGIN_POINT.getErrorMessage();
|
||||
}
|
||||
// 验证终点站台
|
||||
if (taskOutRequest.getIsPicking() == 0) {// 出库
|
||||
if (!standService.validateStand(taskOutRequest.getDestinationPoint(), 2)) {
|
||||
return TaskOutValidationEnum.ERROR_DESTINATION_POINT.getErrorMessage();
|
||||
}
|
||||
} else {// 拣选出库
|
||||
if (!standService.validateStand(taskOutRequest.getDestinationPoint(), 3)) {
|
||||
return TaskOutValidationEnum.ERROR_PICK_STAND.getErrorMessage();
|
||||
}
|
||||
}
|
||||
// 验证物料信息
|
||||
if (StringUtils.isNotEmpty(taskOutRequest.getGoodsId())) {
|
||||
if (taskOutRequest.getGoodsNum() == null || taskOutRequest.getGoodsNum().compareTo(BigDecimal.ZERO) <= 0) {
|
||||
return TaskOutValidationEnum.ERROR_GOODS_NUM.getErrorMessage();
|
||||
}
|
||||
// 查询库存信息
|
||||
LambdaQueryWrapper<Stock> stockQueryWrapper = new LambdaQueryWrapper<Stock>()
|
||||
.apply("goods_related -> '$.goodsId' = {0}", taskOutRequest.getGoodsId())
|
||||
.apply("goods_related -> '$.remainNum' > 0")
|
||||
.eq(StringUtils.isNotEmpty(taskOutRequest.getVehicleId()), Stock::getVehicleId, taskOutRequest.getVehicleId())
|
||||
.eq(StringUtils.isNotEmpty(taskOutRequest.getOriginPoint()), Stock::getLocationId, taskOutRequest.getOriginPoint());
|
||||
if (!stockService.exists(stockQueryWrapper)) {
|
||||
return TaskOutValidationEnum.NO_STOCK.getErrorMessage();
|
||||
}
|
||||
} else {
|
||||
if (StringUtils.isNotEmpty(taskOutRequest.getVehicleId())) {
|
||||
Vehicle currentVehicle = vehicleService.getOne(new LambdaQueryWrapper<Vehicle>().eq(Vehicle::getVehicleId, taskOutRequest.getVehicleId()));
|
||||
Location currentLocation = locationService.getOne(new LambdaQueryWrapper<Location>().eq(Location::getLocationId, currentVehicle.getCurrentLocation()));
|
||||
if (!Objects.equals(currentVehicle.getVehicleStatus(), VehicleStatus.ON.getCode())) {
|
||||
return TaskOutValidationEnum.ERROR_VEHICLE_STATUS.getErrorMessage();
|
||||
}
|
||||
if (!Objects.equals(currentLocation.getIsLock(), 1)) {
|
||||
return TaskOutValidationEnum.LOCKED_LOCATION.getErrorMessage();
|
||||
}
|
||||
} else {
|
||||
Location currentLocation = locationService.getOne(new LambdaQueryWrapper<Location>().eq(Location::getLocationId, taskOutRequest.getOriginPoint()));
|
||||
if (!Objects.equals(currentLocation.getIsLock(), 1)) {
|
||||
return TaskOutValidationEnum.LOCKED_LOCATION.getErrorMessage();
|
||||
}
|
||||
if (!Objects.equals(currentLocation.getLocationStatus(), LocationStatus.OCCUPY.getCode())) {
|
||||
return TaskOutValidationEnum.ERROR_ORIGIN_POINT_STATUS.getErrorMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
return TaskOutValidationEnum.OK.getErrorMessage();
|
||||
}
|
||||
|
||||
/**
|
||||
* 接收任务反馈
|
||||
*
|
||||
* @param wcsTaskResultRequest wcs任务反馈请求
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/sendTaskResult")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
@MyLog(logTitle = "Wcs任务反馈", logMethod = "sendTaskResult")
|
||||
public String receiveTaskResult(@RequestBody WcsTaskResultRequest wcsTaskResultRequest) {
|
||||
logger.info("接收到任务反馈:{},ip地址:{}", JSON.toJSONString(wcsTaskResultRequest), HttpUtils.getIpAddr(servletRequest));
|
||||
// 创建响应信息
|
||||
ResponseEntity response = new ResponseEntity();
|
||||
try {
|
||||
String validateInfo = validateTaskResult(wcsTaskResultRequest);
|
||||
if (!Objects.equals(validateInfo, TaskResultValidationEnum.OK.getErrorMessage())) {
|
||||
logger.error("任务反馈请求验证失败:{}", validateInfo);
|
||||
// 返回其他异常
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("任务反馈请求验证失败:" + validateInfo);
|
||||
return convertJsonString(response);
|
||||
}
|
||||
// 解析任务号
|
||||
List<Task> feedBackTasks = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getTaskGroup, wcsTaskResultRequest.getTaskId()));
|
||||
// 任务状态
|
||||
int taskType = feedBackTasks.get(0).getTaskType();
|
||||
// 任务状态
|
||||
int taskStatus = wcsTaskResultRequest.getTaskStatus();
|
||||
// 判断任务状态
|
||||
if (taskStatus == WcsTaskStatus.FINISH.getCode()) {// 任务完成
|
||||
// 入库任务完成
|
||||
if (taskType == TaskType.IN.getCode()) {
|
||||
// 对所有任务组里面的入库任务进行处理
|
||||
for (Task inTask : feedBackTasks) {
|
||||
if (!Objects.equals(inTask.getTaskType(), TaskType.IN.getCode())) {
|
||||
// 非入库任务跳过
|
||||
continue;
|
||||
}
|
||||
// 当前载具是否有移库任务
|
||||
boolean haveMoveTask = taskService.exists(new LambdaQueryWrapper<Task>()
|
||||
.eq(Task::getVehicleId, inTask.getVehicleId())
|
||||
.eq(Task::getTaskType, TaskType.MOVE.getCode()));
|
||||
// 如果是入库
|
||||
if (inTask.getTaskId().startsWith("RK")) {
|
||||
// 添加库存
|
||||
if (inTask.getGoodsRelated() != null && !inTask.getGoodsRelated().getGoodsId().isEmpty()) {
|
||||
// 查询这个物料有没有库存
|
||||
// TODO 查询条件根据项目要求调整
|
||||
Stock existStock = stockService.getOne(new LambdaQueryWrapper<Stock>()
|
||||
.apply("goods_related -> '$.goodsId' = {0}", inTask.getGoodsRelated().getGoodsId())
|
||||
.eq(Stock::getVehicleId, inTask.getVehicleId()));
|
||||
if (existStock != null) {
|
||||
// 已有库存,直接更新数量
|
||||
existStock.getGoodsRelated().setRemainNum(existStock.getGoodsRelated().getRemainNum().add(inTask.getGoodsRelated().getOpNum()));
|
||||
existStock.getGoodsRelated().setTotalNum(existStock.getGoodsRelated().getTotalNum().add(inTask.getGoodsRelated().getOpNum()));
|
||||
existStock.setLastUpdateTime(LocalDateTime.now());
|
||||
existStock.setLastUpdateUser(inTask.getUserName());
|
||||
existStock.setLocationId(inTask.getDestination());
|
||||
stockService.update(existStock, new LambdaUpdateWrapper<Stock>().eq(Stock::getStockId, existStock.getStockId()));
|
||||
} else {
|
||||
Stock newStock = new Stock();
|
||||
newStock.setStockId(generateId("ST_"));
|
||||
newStock.setVehicleId(inTask.getVehicleId());
|
||||
newStock.setLocationId(inTask.getDestination());
|
||||
newStock.setNoUseDays(0);
|
||||
newStock.setIsInventory(0);
|
||||
newStock.setCreateTime(LocalDateTime.now());
|
||||
newStock.setWeight(inTask.getWeight());
|
||||
newStock.setLastUpdateUser(inTask.getUserName());
|
||||
StockDetailInfo detailInfo = new StockDetailInfo();
|
||||
detailInfo.setGoodsId(inTask.getGoodsRelated().getGoodsId());
|
||||
detailInfo.setGoodsName(inTask.getGoodsRelated().getGoodsName());
|
||||
detailInfo.setGoodsStatus(GoodsStatus.OK.getCode());
|
||||
detailInfo.setRemainNum(inTask.getGoodsRelated().getOpNum());
|
||||
detailInfo.setTotalNum(inTask.getGoodsRelated().getOpNum());
|
||||
newStock.setGoodsRelated(detailInfo);
|
||||
stockService.save(newStock);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 更新库存状态
|
||||
List<Stock> backStocks = stockService.list(new LambdaQueryWrapper<Stock>()
|
||||
.eq(Stock::getVehicleId, inTask.getVehicleId()));
|
||||
backStocks.forEach(stock -> {
|
||||
if (haveMoveTask) {
|
||||
// 后续有移库
|
||||
stock.setStockStatus(StockStatus.MOVE.getCode());
|
||||
} else {
|
||||
// 后续没有移库
|
||||
stock.setStockStatus(StockStatus.OK.getCode());
|
||||
}
|
||||
stock.setLastUpdateTime(LocalDateTime.now());
|
||||
stock.setLastUpdateUser(inTask.getUserName());
|
||||
stockService.update(stock, new LambdaUpdateWrapper<Stock>().eq(Stock::getStockId, stock.getStockId()));
|
||||
});
|
||||
// 当前载具
|
||||
Vehicle currentVehicle = vehicleService.getOne(new LambdaQueryWrapper<Vehicle>().eq(Vehicle::getVehicleId, inTask.getVehicleId()));
|
||||
if (currentVehicle == null) {
|
||||
// 添加载具
|
||||
Vehicle newVehicle = new Vehicle();
|
||||
newVehicle.setVehicleId(inTask.getVehicleId());
|
||||
newVehicle.setVehicleType(1);
|
||||
newVehicle.setVehicleStatus(VehicleStatus.ON.getCode());
|
||||
newVehicle.setCurrentLocation(inTask.getDestination());
|
||||
if (haveMoveTask) {
|
||||
newVehicle.setVehicleStatus(VehicleStatus.MOVE.getCode());
|
||||
} else {
|
||||
newVehicle.setVehicleStatus(VehicleStatus.ON.getCode());
|
||||
}
|
||||
boolean haveStocks = stockService.exists(new LambdaQueryWrapper<Stock>().eq(Stock::getVehicleId, inTask.getVehicleId()));
|
||||
if (haveStocks) {
|
||||
newVehicle.setIsEmpty(0);
|
||||
} else {
|
||||
newVehicle.setIsEmpty(1);
|
||||
}
|
||||
vehicleService.save(newVehicle);
|
||||
} else {
|
||||
// 更新载具
|
||||
currentVehicle.setCurrentLocation(inTask.getDestination());
|
||||
if (haveMoveTask) {
|
||||
currentVehicle.setVehicleStatus(VehicleStatus.MOVE.getCode());
|
||||
} else {
|
||||
currentVehicle.setVehicleStatus(VehicleStatus.ON.getCode());
|
||||
}
|
||||
boolean haveStocks = stockService.exists(new LambdaQueryWrapper<Stock>().eq(Stock::getVehicleId, inTask.getVehicleId()));
|
||||
if (haveStocks) {
|
||||
currentVehicle.setIsEmpty(0);
|
||||
} else {
|
||||
currentVehicle.setIsEmpty(1);
|
||||
}
|
||||
vehicleService.update(currentVehicle, new LambdaUpdateWrapper<Vehicle>().eq(Vehicle::getVehicleId, currentVehicle.getVehicleId()));
|
||||
}
|
||||
// 添加任务记录
|
||||
inTask.setTaskStatus(WmsTaskStatus.FINISH.getCode());
|
||||
inTask.setFinishTime(LocalDateTime.now());
|
||||
taskRecordService.save(BeanUtil.copyProperties(inTask, TaskRecord.class));
|
||||
// 删除移库任务
|
||||
taskService.remove(new LambdaQueryWrapper<Task>().eq(Task::getTaskId, inTask.getTaskId()));
|
||||
}
|
||||
}
|
||||
// 出库任务
|
||||
if (taskType == TaskType.OUT.getCode()) {
|
||||
// 对所有任务组里面的出库任务进行处理
|
||||
for (Task outTask : feedBackTasks) {
|
||||
if (!Objects.equals(outTask.getTaskType(), TaskType.OUT.getCode())) {
|
||||
// 非移库任务跳过
|
||||
continue;
|
||||
}
|
||||
if (outTask.getIsPicking() == 1) {
|
||||
// 拣选任务,更新任务状态
|
||||
taskService.update(new LambdaUpdateWrapper<Task>()
|
||||
.set(Task::getTaskStatus, WmsTaskStatus.PICKING.getCode())
|
||||
.eq(Task::getTaskId, outTask.getTaskId()));
|
||||
// 当前载具上所有库存状态设置为拣选
|
||||
stockService.update(new LambdaUpdateWrapper<Stock>()
|
||||
.set(Stock::getStockStatus, StockStatus.PICKING.getCode())
|
||||
.eq(Stock::getVehicleId, outTask.getVehicleId())
|
||||
.ne(Stock::getStockStatus, StockStatus.PICKING.getCode()));
|
||||
// 当前载具设置为出库中状态
|
||||
vehicleService.update(new LambdaUpdateWrapper<Vehicle>()
|
||||
.set(Vehicle::getVehicleStatus, VehicleStatus.OUT.getCode())
|
||||
.eq(Vehicle::getVehicleId, outTask.getVehicleId())
|
||||
.ne(Vehicle::getVehicleStatus, VehicleStatus.OUT.getCode()));
|
||||
} else {
|
||||
// 添加任务记录
|
||||
outTask.setTaskStatus(WmsTaskStatus.FINISH.getCode());
|
||||
outTask.setFinishTime(LocalDateTime.now());
|
||||
taskRecordService.save(BeanUtil.copyProperties(outTask, TaskRecord.class));
|
||||
// 删除移库任务
|
||||
taskService.remove(new LambdaQueryWrapper<Task>().eq(Task::getTaskId, outTask.getTaskId()));
|
||||
// 删除当前载具上所有库存
|
||||
stockService.remove(new LambdaQueryWrapper<Stock>().eq(Stock::getVehicleId, outTask.getVehicleId()));
|
||||
// 删除载具
|
||||
vehicleService.remove(new LambdaQueryWrapper<Vehicle>().eq(Vehicle::getVehicleId, outTask.getVehicleId()));
|
||||
}
|
||||
// 释放原来的库位
|
||||
locationService.update(new LambdaUpdateWrapper<Location>()
|
||||
.set(Location::getLocationStatus, LocationStatus.EMPTY.getCode())
|
||||
.eq(Location::getLocationId, outTask.getOrigin()));
|
||||
}
|
||||
}
|
||||
// 移库任务完成
|
||||
if (taskType == TaskType.MOVE.getCode()) {
|
||||
// 对所有任务组里面的移库任务进行处理
|
||||
for (Task moveTask : feedBackTasks) {
|
||||
if (!Objects.equals(moveTask.getTaskType(), TaskType.MOVE.getCode())) {
|
||||
// 非移库任务跳过
|
||||
continue;
|
||||
}
|
||||
// 更新库存
|
||||
LambdaUpdateWrapper<Stock> lambdaUpdateWrapperOfStock = new LambdaUpdateWrapper<Stock>()
|
||||
.set(Stock::getLocationId, moveTask.getDestination())
|
||||
.set(Stock::getStockStatus, StockStatus.OK.getCode())
|
||||
.set(Stock::getLastUpdateTime, LocalDateTime.now())
|
||||
.set(Stock::getLastUpdateUser, moveTask.getUserName())
|
||||
.eq(Stock::getVehicleId, moveTask.getVehicleId())
|
||||
.eq(Stock::getStockStatus, StockStatus.MOVE.getCode());
|
||||
stockService.update(lambdaUpdateWrapperOfStock);
|
||||
// 更新载具
|
||||
LambdaUpdateWrapper<Vehicle> lambdaUpdateWrapperOfVehicle = new LambdaUpdateWrapper<Vehicle>()
|
||||
.set(Vehicle::getVehicleStatus, VehicleStatus.ON.getCode())
|
||||
.set(Vehicle::getCurrentLocation, moveTask.getDestination())
|
||||
.eq(Vehicle::getVehicleId, moveTask.getVehicleId())
|
||||
.eq(Vehicle::getVehicleStatus, VehicleStatus.MOVE.getCode());
|
||||
vehicleService.update(lambdaUpdateWrapperOfVehicle);
|
||||
// 释放原来的库位
|
||||
LambdaUpdateWrapper<Location> lambdaUpdateWrapperOfLocation = new LambdaUpdateWrapper<Location>()
|
||||
.set(Location::getLocationStatus, LocationStatus.EMPTY.getCode())
|
||||
.set(Location::getVehicleId, "")
|
||||
.eq(Location::getLocationId, moveTask.getOrigin())
|
||||
.eq(Location::getLocationStatus, LocationStatus.OCCUPY.getCode());
|
||||
locationService.update(lambdaUpdateWrapperOfLocation);
|
||||
// 添加任务记录
|
||||
moveTask.setTaskStatus(WmsTaskStatus.FINISH.getCode());
|
||||
moveTask.setFinishTime(LocalDateTime.now());
|
||||
taskRecordService.save(BeanUtil.copyProperties(moveTask, TaskRecord.class));
|
||||
// 删除移库任务
|
||||
taskService.remove(new LambdaQueryWrapper<Task>().eq(Task::getTaskId, moveTask.getTaskId()));
|
||||
}
|
||||
}
|
||||
} else if (taskStatus == WcsTaskStatus.RUN.getCode()) {// 任务开始运行
|
||||
// 更新任务状态为正在运行
|
||||
for (Task task : feedBackTasks) {
|
||||
task.setTaskStatus(WmsTaskStatus.RUN.getCode());
|
||||
}
|
||||
taskService.updateBatchById(feedBackTasks);
|
||||
}
|
||||
|
||||
// 返回成功
|
||||
logger.info("处理任务反馈成功");
|
||||
response.setCode(ResponseCode.OK.getCode());
|
||||
response.setMessage("处理任务反馈成功");
|
||||
return convertJsonString(response);
|
||||
} catch (Exception e) {
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
logger.error("发生异常:{}", convertJsonString(e));
|
||||
// 返回其他异常
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("任务反馈发生异常");
|
||||
return convertJsonString(response);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证任务反馈的请求信息
|
||||
*
|
||||
* @param wcsTaskResultRequest 任务反馈的请求
|
||||
* @return 验证结果
|
||||
*/
|
||||
private String validateTaskResult(WcsTaskResultRequest wcsTaskResultRequest) {
|
||||
// 验证请求体是否为空
|
||||
if (wcsTaskResultRequest == null) {
|
||||
return TaskResultValidationEnum.NO_REQUEST_BODY.getErrorMessage();
|
||||
}
|
||||
// 验证是否缺少必须信息
|
||||
if (StringUtils.isEmpty(wcsTaskResultRequest.getTaskId()) || StringUtils.isEmpty(wcsTaskResultRequest.getVehicleId())
|
||||
|| wcsTaskResultRequest.getTaskStatus() == null) {
|
||||
return TaskResultValidationEnum.LACK_REQUIRED_PARAM.getErrorMessage();
|
||||
}
|
||||
// 验证反馈的任务号是否正确
|
||||
if (!taskService.exists(new LambdaQueryWrapper<Task>().eq(Task::getTaskGroup, wcsTaskResultRequest.getTaskId()))) {
|
||||
return TaskResultValidationEnum.ERROR_TASK_GROUP.getErrorMessage();
|
||||
}
|
||||
// 验证反馈的任务状态枚举是否正确
|
||||
boolean isValidWcsTaskStatus = false;
|
||||
for (WcsTaskStatus wcsTaskStatus : WcsTaskStatus.values()) {
|
||||
if (Objects.equals(wcsTaskStatus.getCode(), wcsTaskResultRequest.getTaskStatus())) {
|
||||
isValidWcsTaskStatus = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isValidWcsTaskStatus) {
|
||||
return TaskResultValidationEnum.ERROR_TASK_STATUS.getErrorMessage();
|
||||
}
|
||||
return TaskResultValidationEnum.OK.getErrorMessage();
|
||||
}
|
||||
}
|
||||
214
src/main/java/com/wms/controller/UserController.java
Normal file
214
src/main/java/com/wms/controller/UserController.java
Normal file
|
|
@ -0,0 +1,214 @@
|
|||
package com.wms.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.wms.constants.enums.ResponseCode;
|
||||
import com.wms.entity.app.dto.MenuDto;
|
||||
import com.wms.entity.app.dto.UserDto;
|
||||
import com.wms.entity.app.request.UserQuery;
|
||||
import com.wms.entity.app.vo.MenuEntity;
|
||||
import com.wms.entity.app.ResponseEntity;
|
||||
import com.wms.entity.app.vo.UserConfigEntity;
|
||||
import com.wms.service.MenuService;
|
||||
import com.wms.service.UserService;
|
||||
import com.wms.constants.WmsConstants;
|
||||
import com.wms.utils.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.transaction.annotation.Isolation;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.wms.utils.StringUtils.convertJsonString;
|
||||
|
||||
/**
|
||||
* WMS用户控制类
|
||||
* @author 梁州
|
||||
* @date 2023/2/14
|
||||
*/
|
||||
@Controller
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = "/wms/user")
|
||||
public class UserController {
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
/**
|
||||
* 用户服务
|
||||
*/
|
||||
final UserService userService;
|
||||
/**
|
||||
* 菜单服务
|
||||
*/
|
||||
final MenuService menuService;
|
||||
|
||||
@Autowired
|
||||
public UserController(UserService userService, MenuService menuService) {
|
||||
this.userService = userService;
|
||||
this.menuService = menuService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 带密码登录
|
||||
* @param userQuery 用户
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/loginWithAuth")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
public String loginWithAuth(@RequestBody UserQuery userQuery) {
|
||||
logger.info("请求登录,登录账户名:{}", userQuery.getLoginAccount());
|
||||
// 创建响应信息
|
||||
ResponseEntity rsp = new ResponseEntity();
|
||||
try {
|
||||
if (StringUtils.isEmpty(userQuery.getLoginAccount())) {
|
||||
logger.error("请输入用户名");
|
||||
// 返回错误
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("请输入用户名");
|
||||
return convertJsonString(rsp);
|
||||
}
|
||||
// 验证用户信息
|
||||
UserDto validatedUser = userService.validateUser(userQuery.toUserPO(), true);
|
||||
if (validatedUser == null || StringUtils.isEmpty(validatedUser.getLoginAccount())) {
|
||||
logger.error("登录错误,用户不存在或密码错误");
|
||||
// 返回错误
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("登录错误,用户不存在或密码错误");
|
||||
return convertJsonString(rsp);
|
||||
}
|
||||
|
||||
// 返回成功
|
||||
logger.info("登录成功,登录账户名:{}", validatedUser.getLoginAccount());
|
||||
rsp.setCode(ResponseCode.OK.getCode());
|
||||
rsp.setMessage("登录成功");
|
||||
// 返回用户数据
|
||||
rsp.setReturnData(generateUserInfo(validatedUser));
|
||||
return JSON.toJSONString(rsp);
|
||||
} catch (Exception e) {
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
logger.info("数据库错误:{}", convertJsonString(e));
|
||||
// 返回其他异常
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("登录异常");
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 无密码登录
|
||||
* @param userQuery 用户
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/loginWithoutAuth")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
public String loginWithoutAuth(@RequestBody UserQuery userQuery) {
|
||||
logger.info("请求无密码登录,登录账户名:{}", userQuery.getLoginAccount());
|
||||
// 创建响应信息
|
||||
ResponseEntity rsp = new ResponseEntity();
|
||||
try {
|
||||
if (StringUtils.isEmpty(userQuery.getLoginAccount())) {
|
||||
logger.error("请输入用户名");
|
||||
// 返回错误
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("请输入用户名");
|
||||
return convertJsonString(rsp);
|
||||
}
|
||||
// 验证用户信息
|
||||
UserDto validatedUser = userService.validateUser(userQuery.toUserPO(), false);
|
||||
if (validatedUser == null || StringUtils.isEmpty(validatedUser.getLoginAccount())) {
|
||||
logger.error("登录错误,用户不存在或密码错误");
|
||||
// 返回错误
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("登录错误,用户不存在或密码错误");
|
||||
return convertJsonString(rsp);
|
||||
}
|
||||
|
||||
// 返回成功
|
||||
logger.info("登录成功,登录账户名:{}", validatedUser.getLoginAccount());
|
||||
rsp.setCode(ResponseCode.OK.getCode());
|
||||
rsp.setMessage("登录成功");
|
||||
// 返回用户数据
|
||||
rsp.setReturnData(generateUserInfo(validatedUser));
|
||||
return JSON.toJSONString(rsp);
|
||||
} catch (Exception e) {
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
logger.info("数据库错误:{}", convertJsonString(e));
|
||||
// 返回其他异常
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("登录异常");
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造用户信息(菜单、按钮等权限)
|
||||
* @param currentUser 当前用户
|
||||
* @return 用户信息
|
||||
*/
|
||||
private UserConfigEntity generateUserInfo (UserDto currentUser) {
|
||||
UserConfigEntity userConfigEntity = new UserConfigEntity();
|
||||
try {
|
||||
if (currentUser.getRoleId() == null) {
|
||||
return null;
|
||||
}
|
||||
List<MenuDto> menus = menuService.selMenuByRoleId(currentUser.getRoleId());
|
||||
List<MenuEntity> menuList = new LinkedList<>();
|
||||
// 查找一级菜单
|
||||
for (MenuDto firstMenu : menus) {
|
||||
if (WmsConstants.ROOT_MENU_ID.equals(firstMenu.getParentId())) {// 查找到所有的一级子菜单
|
||||
MenuEntity tempFirstMenu = new MenuEntity();
|
||||
tempFirstMenu.setId(firstMenu.getMenuId());// ID
|
||||
tempFirstMenu.setLabelName(firstMenu.getLabelName());// 菜单显示名称
|
||||
tempFirstMenu.setIconValue(firstMenu.getIconValue());// 图标
|
||||
tempFirstMenu.setPath(firstMenu.getPath());// 路径
|
||||
// 设置子菜单
|
||||
List<MenuEntity> tempFirstMenuChildren = new LinkedList<>();
|
||||
for (MenuDto secondMenu : menus) {
|
||||
if (firstMenu.getMenuId().equals(secondMenu.getParentId())) {
|
||||
MenuEntity tempSecondMenu = new MenuEntity();
|
||||
tempSecondMenu.setId(secondMenu.getMenuId());// ID
|
||||
tempSecondMenu.setLabelName(secondMenu.getLabelName());// 菜单显示名称
|
||||
tempSecondMenu.setIconValue(secondMenu.getIconValue());// 图标
|
||||
tempSecondMenu.setPath(secondMenu.getPath());// 路径
|
||||
// 设置子菜单
|
||||
List<MenuEntity> tempSecondMenuChildren = new LinkedList<>();
|
||||
for (MenuDto thirdMenu : menus) {
|
||||
if (secondMenu.getMenuId().equals(thirdMenu.getParentId())) {
|
||||
MenuEntity tempThirdMenu = new MenuEntity();
|
||||
tempSecondMenu.setId(thirdMenu.getMenuId());// ID
|
||||
tempSecondMenu.setLabelName(thirdMenu.getLabelName());// 菜单显示名称
|
||||
tempSecondMenu.setIconValue(thirdMenu.getIconValue());// 图标
|
||||
tempSecondMenu.setPath(thirdMenu.getPath());// 路径
|
||||
// 添加按钮
|
||||
tempSecondMenuChildren.add(tempThirdMenu);
|
||||
}
|
||||
}
|
||||
tempSecondMenu.setChildren(tempSecondMenuChildren);
|
||||
// 添加二级菜单
|
||||
tempFirstMenuChildren.add(tempSecondMenu);
|
||||
}
|
||||
}
|
||||
tempFirstMenu.setChildren(tempFirstMenuChildren);
|
||||
// 添加一级菜单
|
||||
menuList.add(tempFirstMenu);
|
||||
}
|
||||
}
|
||||
logger.info("构造用户信息成功,当前用户:{}", currentUser.getUserName());
|
||||
// 设置返回信息
|
||||
userConfigEntity.setUser(BeanUtil.copyProperties(currentUser, UserDto.class));
|
||||
userConfigEntity.setMenuList(menuList);
|
||||
} catch (Exception e) {
|
||||
logger.error("构造用户信息失败,当前用户:{}", currentUser.getUserName());
|
||||
}
|
||||
return userConfigEntity;
|
||||
}
|
||||
}
|
||||
80
src/main/java/com/wms/controller/WmsLogController.java
Normal file
80
src/main/java/com/wms/controller/WmsLogController.java
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
package com.wms.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.wms.constants.enums.ResponseCode;
|
||||
import com.wms.entity.app.ResponseEntity;
|
||||
import com.wms.entity.app.dto.PageDto;
|
||||
import com.wms.entity.app.request.WmsLogQuery;
|
||||
import com.wms.entity.app.vo.WmsLogVo;
|
||||
import com.wms.entity.table.WmsLog;
|
||||
import com.wms.service.LogService;
|
||||
import com.wms.utils.HttpUtils;
|
||||
import com.wms.utils.StringUtils;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.transaction.annotation.Isolation;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import static com.wms.utils.StringUtils.convertJsonString;
|
||||
|
||||
@Controller
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = "/wms/log")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class WmsLogController {
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
/**
|
||||
* 请求头部信息
|
||||
*/
|
||||
private final HttpServletRequest servletRequest;
|
||||
/**
|
||||
* 日志服务
|
||||
*/
|
||||
private final LogService logService;
|
||||
|
||||
/**
|
||||
* 查询日志
|
||||
*
|
||||
* @param logQuery 请求参数
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/queryWmsLog")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
public String getGoodsInfoByPage(@RequestBody WmsLogQuery logQuery){
|
||||
logger.info("接收到查询日志请求:{},请求ip:{}", convertJsonString(logQuery), HttpUtils.getIpAddr(servletRequest));
|
||||
ResponseEntity response = new ResponseEntity();
|
||||
try {
|
||||
Page<WmsLog> page = logQuery.toMpPage();
|
||||
Page<WmsLog> logPage = logService.page(page, new LambdaQueryWrapper<WmsLog>()
|
||||
.like(StringUtils.isNotEmpty(logQuery.getQueryParam()), WmsLog::getLogTitle, logQuery.getQueryParam())
|
||||
.or().like(StringUtils.isNotEmpty(logQuery.getQueryParam()), WmsLog::getLogMethod, logQuery.getQueryParam())
|
||||
.or().like(StringUtils.isNotEmpty(logQuery.getQueryParam()), WmsLog::getLogRequest, logQuery.getQueryParam())
|
||||
.or().like(StringUtils.isNotEmpty(logQuery.getQueryParam()), WmsLog::getLogResponse, logQuery.getQueryParam())
|
||||
.or().like(StringUtils.isNotEmpty(logQuery.getQueryParam()), WmsLog::getLogIp, logQuery.getQueryParam())
|
||||
.or().like(StringUtils.isNotEmpty(logQuery.getQueryParam()), WmsLog::getLogUser, logQuery.getQueryParam()));
|
||||
|
||||
PageDto<WmsLogVo> pageDto = PageDto.of(logPage, log -> BeanUtil.copyProperties(log, WmsLogVo.class));
|
||||
response.setCode(ResponseCode.OK.getCode());
|
||||
response.setMessage("查询成功");
|
||||
response.setReturnData(pageDto);
|
||||
return convertJsonString(response);
|
||||
} catch (Exception e) {
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
logger.error("查询日志信息发生异常:{}", convertJsonString(e));
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("查询日志信息发生异常");
|
||||
return convertJsonString(response);
|
||||
}
|
||||
}
|
||||
}
|
||||
46
src/main/java/com/wms/entity/app/ResponseEntity.java
Normal file
46
src/main/java/com/wms/entity/app/ResponseEntity.java
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
package com.wms.entity.app;
|
||||
|
||||
/**
|
||||
* 接口响应实体类
|
||||
*/
|
||||
public class ResponseEntity {
|
||||
|
||||
/**
|
||||
* 响应代码
|
||||
*/
|
||||
private Integer code;
|
||||
|
||||
/**
|
||||
* 错误信息
|
||||
*/
|
||||
private String message;
|
||||
|
||||
/**
|
||||
* 返回数据(非必须)
|
||||
*/
|
||||
private Object returnData;
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public Object getReturnData() {
|
||||
return returnData;
|
||||
}
|
||||
|
||||
public void setReturnData(Object returnData) {
|
||||
this.returnData = returnData;
|
||||
}
|
||||
}
|
||||
55
src/main/java/com/wms/entity/app/display/LocationData.java
Normal file
55
src/main/java/com/wms/entity/app/display/LocationData.java
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
package com.wms.entity.app.display;
|
||||
|
||||
/**
|
||||
* 大屏用数据详细类
|
||||
*/
|
||||
public class LocationData {
|
||||
/**
|
||||
* 零件号
|
||||
*/
|
||||
private String goodsId;
|
||||
/**
|
||||
* 零件名称
|
||||
*/
|
||||
private String goodsName;
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private Integer goodsNum;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
public String getGoodsId() {
|
||||
return goodsId;
|
||||
}
|
||||
|
||||
public void setGoodsId(String goodsId) {
|
||||
this.goodsId = goodsId;
|
||||
}
|
||||
|
||||
public String getGoodsName() {
|
||||
return goodsName;
|
||||
}
|
||||
|
||||
public void setGoodsName(String goodsName) {
|
||||
this.goodsName = goodsName;
|
||||
}
|
||||
|
||||
public Integer getGoodsNum() {
|
||||
return goodsNum;
|
||||
}
|
||||
|
||||
public void setGoodsNum(Integer goodsNum) {
|
||||
this.goodsNum = goodsNum;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
}
|
||||
45
src/main/java/com/wms/entity/app/display/LocationInfo.java
Normal file
45
src/main/java/com/wms/entity/app/display/LocationInfo.java
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
package com.wms.entity.app.display;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 大屏用库位信息
|
||||
*/
|
||||
public class LocationInfo {
|
||||
/**
|
||||
* 库位编号
|
||||
*/
|
||||
private String locationId;
|
||||
/**
|
||||
* 料箱号
|
||||
*/
|
||||
private String vehicleNo;
|
||||
/**
|
||||
* 详细数据
|
||||
*/
|
||||
private List<LocationData> locationData;
|
||||
|
||||
public String getLocationId() {
|
||||
return locationId;
|
||||
}
|
||||
|
||||
public void setLocationId(String locationId) {
|
||||
this.locationId = locationId;
|
||||
}
|
||||
|
||||
public String getVehicleNo() {
|
||||
return vehicleNo;
|
||||
}
|
||||
|
||||
public void setVehicleNo(String vehicleNo) {
|
||||
this.vehicleNo = vehicleNo;
|
||||
}
|
||||
|
||||
public List<LocationData> getLocationData() {
|
||||
return locationData;
|
||||
}
|
||||
|
||||
public void setLocationData(List<LocationData> locationData) {
|
||||
this.locationData = locationData;
|
||||
}
|
||||
}
|
||||
34
src/main/java/com/wms/entity/app/dto/ConfigDto.java
Normal file
34
src/main/java/com/wms/entity/app/dto/ConfigDto.java
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
package com.wms.entity.app.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 配置
|
||||
*/
|
||||
@Data
|
||||
public class ConfigDto {
|
||||
/**
|
||||
* 配置ID
|
||||
*/
|
||||
private Integer configId;
|
||||
|
||||
/**
|
||||
* 配置键
|
||||
*/
|
||||
private String configKey;
|
||||
|
||||
/**
|
||||
* 配置值
|
||||
*/
|
||||
private String configValue;
|
||||
|
||||
/**
|
||||
* 配置类型
|
||||
*/
|
||||
private String configType;
|
||||
|
||||
/**
|
||||
* 配置名称
|
||||
*/
|
||||
private String configName;
|
||||
}
|
||||
50
src/main/java/com/wms/entity/app/dto/GoodsDto.java
Normal file
50
src/main/java/com/wms/entity/app/dto/GoodsDto.java
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
package com.wms.entity.app.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 物料
|
||||
*/
|
||||
@Data
|
||||
public class GoodsDto {
|
||||
/**
|
||||
* 物料编号
|
||||
*/
|
||||
private String goodsId;
|
||||
/**
|
||||
* 物料名称
|
||||
*/
|
||||
private String goodsName;
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
private String goodsUnit;
|
||||
/**
|
||||
* 物料ID
|
||||
*/
|
||||
private String itemId;
|
||||
/**
|
||||
* 物料分类
|
||||
*/
|
||||
private String goodsType;
|
||||
/**
|
||||
* 有效天数
|
||||
*/
|
||||
private Integer lifeDays;
|
||||
/**
|
||||
* 仓储分类
|
||||
*/
|
||||
private String invCategory;
|
||||
/**
|
||||
* 最后更新日期
|
||||
*/
|
||||
private Date lastUpdateTime;
|
||||
/**
|
||||
* 最后更新用户
|
||||
*/
|
||||
private String lastUpdateUser;
|
||||
}
|
||||
54
src/main/java/com/wms/entity/app/dto/LocationDto.java
Normal file
54
src/main/java/com/wms/entity/app/dto/LocationDto.java
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
package com.wms.entity.app.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 库位
|
||||
*/
|
||||
@Data
|
||||
public class LocationDto {
|
||||
/**
|
||||
* 库位编号
|
||||
*/
|
||||
private String locationId;
|
||||
/**
|
||||
* 库区编号
|
||||
*/
|
||||
private Integer areaId;
|
||||
/**
|
||||
* 设备编号
|
||||
*/
|
||||
private Integer equipmentId;
|
||||
/**
|
||||
* 库位类型
|
||||
*/
|
||||
private Integer locationType;
|
||||
/**
|
||||
* 排
|
||||
*/
|
||||
private Integer wRow;
|
||||
/**
|
||||
* 列
|
||||
*/
|
||||
private Integer wCol;
|
||||
/**
|
||||
* 层
|
||||
*/
|
||||
private Integer wLayer;
|
||||
/**
|
||||
* 深度
|
||||
*/
|
||||
private Integer wDepth;
|
||||
/**
|
||||
* 是否锁定
|
||||
*/
|
||||
private Integer isLock;
|
||||
/**
|
||||
* 库位状态
|
||||
*/
|
||||
private Integer locationStatus;
|
||||
/**
|
||||
* 载具号
|
||||
*/
|
||||
private String vehicleId;
|
||||
}
|
||||
30
src/main/java/com/wms/entity/app/dto/MenuDto.java
Normal file
30
src/main/java/com/wms/entity/app/dto/MenuDto.java
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
package com.wms.entity.app.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 菜单
|
||||
*/
|
||||
@Data
|
||||
public class MenuDto {
|
||||
/**
|
||||
* 菜单Id
|
||||
*/
|
||||
private String menuId;
|
||||
/**
|
||||
* 菜单名称
|
||||
*/
|
||||
private String labelName;
|
||||
/**
|
||||
* 图标值
|
||||
*/
|
||||
private String iconValue;
|
||||
/**
|
||||
* 地址
|
||||
*/
|
||||
private String path;
|
||||
/**
|
||||
* 父菜单Id
|
||||
*/
|
||||
private String parentId;
|
||||
}
|
||||
43
src/main/java/com/wms/entity/app/dto/PageDto.java
Normal file
43
src/main/java/com/wms/entity/app/dto/PageDto.java
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
package com.wms.entity.app.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "分页数据实体")
|
||||
public class PageDto<T> {
|
||||
@ApiModelProperty(value ="总行数")
|
||||
private Long total;
|
||||
@ApiModelProperty(value ="总页数")
|
||||
private Long pages;
|
||||
@ApiModelProperty(value ="数据集合")
|
||||
private List<T> lists;
|
||||
|
||||
/**
|
||||
* 将数据库集合转换为分页结果
|
||||
* @param page 数据库查询结果
|
||||
* @param converter 转换方法
|
||||
* @return 转换后的分页结果
|
||||
* @param <PO> 数据库结果集
|
||||
* @param <VO> 前端显示结果集
|
||||
*/
|
||||
public static <PO, VO> PageDto<VO> of(Page<PO> page, Function<PO, VO> converter) {
|
||||
PageDto<VO> pageDto = new PageDto<>();
|
||||
// 设置总数
|
||||
pageDto.setTotal(page.getTotal());
|
||||
// 设置总页数
|
||||
pageDto.setPages(page.getPages());
|
||||
if (page.getRecords().isEmpty()) {
|
||||
pageDto.setLists(Collections.emptyList());
|
||||
return pageDto;
|
||||
}
|
||||
pageDto.setLists(page.getRecords().stream().map(converter).toList());
|
||||
return pageDto;
|
||||
}
|
||||
}
|
||||
57
src/main/java/com/wms/entity/app/dto/StandDto.java
Normal file
57
src/main/java/com/wms/entity/app/dto/StandDto.java
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
package com.wms.entity.app.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 站台表
|
||||
*/
|
||||
@Data
|
||||
public class StandDto {
|
||||
/**
|
||||
* 站台id
|
||||
*/
|
||||
private String standId;
|
||||
/**
|
||||
* 是否允许入库
|
||||
*/
|
||||
private Integer allowIn;
|
||||
/**
|
||||
* 是否允许出库
|
||||
*/
|
||||
private Integer allowOut;
|
||||
/**
|
||||
* 站台是否锁定
|
||||
*/
|
||||
private Integer isLock;
|
||||
/**
|
||||
* 站台状态
|
||||
*/
|
||||
private Integer standStatus;
|
||||
/**
|
||||
* 设备编号
|
||||
*/
|
||||
private Integer equipmentId;
|
||||
/**
|
||||
* 库区编号
|
||||
*/
|
||||
private Integer areaId;
|
||||
/**
|
||||
* 站台类型
|
||||
*/
|
||||
private Integer standType;
|
||||
/**
|
||||
* 站台ip
|
||||
*/
|
||||
private String standIp;
|
||||
/**
|
||||
* 外部id
|
||||
* 如果对接,其它系统的站台id
|
||||
*/
|
||||
private String outerId;
|
||||
/**
|
||||
* 最近一次的使用时间
|
||||
*/
|
||||
private LocalDateTime lastUseTime;
|
||||
}
|
||||
66
src/main/java/com/wms/entity/app/dto/StockDto.java
Normal file
66
src/main/java/com/wms/entity/app/dto/StockDto.java
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
package com.wms.entity.app.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.wms.entity.app.dto.extend.StockDetailInfo;
|
||||
import com.wms.utils.excel.ExcelExport;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 库存
|
||||
*/
|
||||
@Data
|
||||
public class StockDto {
|
||||
/**
|
||||
* 库存编号
|
||||
*/
|
||||
private String stockId;
|
||||
/**
|
||||
* 库位ID
|
||||
*/
|
||||
private String locationId;
|
||||
/**
|
||||
* 托盘号
|
||||
*/
|
||||
private String vehicleId;
|
||||
/**
|
||||
* 重量
|
||||
*/
|
||||
private BigDecimal weight;
|
||||
/**
|
||||
* 库存状态
|
||||
* 正常、出库中、锁定 等
|
||||
*/
|
||||
private Integer stockStatus;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
/**
|
||||
* 最后更新时间
|
||||
*/
|
||||
private LocalDateTime lastUpdateTime;
|
||||
/**
|
||||
* 最后更新用户
|
||||
*/
|
||||
private String lastUpdateUser;
|
||||
/**
|
||||
* 是否盘点
|
||||
*/
|
||||
private Integer isInventory;
|
||||
/**
|
||||
* 盘点任务号 盘点出库和盘点入库同样
|
||||
*/
|
||||
private String inventoryTaskId;
|
||||
/**
|
||||
* 呆滞天数
|
||||
*/
|
||||
private Integer noUseDays;
|
||||
/**
|
||||
* 物料相关信息
|
||||
*/
|
||||
private StockDetailInfo goodsRelated;
|
||||
}
|
||||
82
src/main/java/com/wms/entity/app/dto/TaskDto.java
Normal file
82
src/main/java/com/wms/entity/app/dto/TaskDto.java
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
package com.wms.entity.app.dto;
|
||||
|
||||
import com.wms.entity.app.dto.extend.TaskDetailInfo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 任务
|
||||
*/
|
||||
@Data
|
||||
public class TaskDto {
|
||||
/**
|
||||
* 任务号
|
||||
*/
|
||||
private String taskId;
|
||||
/**
|
||||
* 任务类型
|
||||
*/
|
||||
private Integer taskType;
|
||||
/**
|
||||
* 任务状态
|
||||
*/
|
||||
private Integer taskStatus;
|
||||
/**
|
||||
* 起点
|
||||
*/
|
||||
private String origin;
|
||||
/**
|
||||
* 终点
|
||||
*/
|
||||
private String destination;
|
||||
/**
|
||||
* 任务优先级
|
||||
*/
|
||||
private Integer taskPriority;
|
||||
/**
|
||||
* 任务组
|
||||
*/
|
||||
private String taskGroup;
|
||||
/**
|
||||
* 载具号
|
||||
*/
|
||||
private String vehicleId;
|
||||
/**
|
||||
* 重量
|
||||
*/
|
||||
private BigDecimal weight;
|
||||
/**
|
||||
* 载具尺寸
|
||||
*/
|
||||
private Integer vehicleSize;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
/**
|
||||
* 完成时间
|
||||
*/
|
||||
private LocalDateTime finishTime;
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String userName;
|
||||
/**
|
||||
* 物料相关信息
|
||||
*/
|
||||
private TaskDetailInfo goodsRelated;
|
||||
/**
|
||||
* 前置任务号
|
||||
*/
|
||||
private String preTask;
|
||||
/**
|
||||
* 是否拣选
|
||||
*/
|
||||
private Integer isPicking;
|
||||
/**
|
||||
* 拣选站台
|
||||
*/
|
||||
private String pickStand;
|
||||
}
|
||||
79
src/main/java/com/wms/entity/app/dto/TaskRecordDto.java
Normal file
79
src/main/java/com/wms/entity/app/dto/TaskRecordDto.java
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
package com.wms.entity.app.dto;
|
||||
|
||||
import com.wms.entity.app.dto.extend.TaskDetailInfo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class TaskRecordDto {
|
||||
/**
|
||||
* 任务号
|
||||
*/
|
||||
private String taskId;
|
||||
/**
|
||||
* 任务类型
|
||||
*/
|
||||
private Integer taskType;
|
||||
/**
|
||||
* 任务状态
|
||||
*/
|
||||
private Integer taskStatus;
|
||||
/**
|
||||
* 起点
|
||||
*/
|
||||
private String origin;
|
||||
/**
|
||||
* 终点
|
||||
*/
|
||||
private String destination;
|
||||
/**
|
||||
* 任务优先级
|
||||
*/
|
||||
private Integer taskPriority;
|
||||
/**
|
||||
* 任务组
|
||||
*/
|
||||
private String taskGroup;
|
||||
/**
|
||||
* 载具号
|
||||
*/
|
||||
private String vehicleId;
|
||||
/**
|
||||
* 重量
|
||||
*/
|
||||
private BigDecimal weight;
|
||||
/**
|
||||
* 载具尺寸
|
||||
*/
|
||||
private Integer vehicleSize;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
/**
|
||||
* 完成时间
|
||||
*/
|
||||
private LocalDateTime finishTime;
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String userName;
|
||||
/**
|
||||
* 物料相关
|
||||
*/
|
||||
private TaskDetailInfo goodsRelated;
|
||||
/**
|
||||
* 前置任务号
|
||||
*/
|
||||
private String preTask;
|
||||
/**
|
||||
* 是否拣选
|
||||
*/
|
||||
private Integer isPicking;
|
||||
/**
|
||||
* 拣选站台
|
||||
*/
|
||||
private String pickStand;
|
||||
}
|
||||
28
src/main/java/com/wms/entity/app/dto/UserDto.java
Normal file
28
src/main/java/com/wms/entity/app/dto/UserDto.java
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
package com.wms.entity.app.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 用户
|
||||
*/
|
||||
@Data
|
||||
public class UserDto {
|
||||
/** 用户ID */
|
||||
private Integer userId;
|
||||
/** 用户名 */
|
||||
private String userName;
|
||||
/** 角色Id */
|
||||
private Integer roleId = null;
|
||||
/** 登录账户 */
|
||||
private String loginAccount;
|
||||
/** 登录密码 */
|
||||
private String loginPassword;
|
||||
/** 添加时间 */
|
||||
private LocalDateTime addTime;
|
||||
/** 更新时间 */
|
||||
private LocalDateTime updateTime;
|
||||
/** 添加用户名 */
|
||||
private String addUser;
|
||||
}
|
||||
35
src/main/java/com/wms/entity/app/dto/VehicleDto.java
Normal file
35
src/main/java/com/wms/entity/app/dto/VehicleDto.java
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
package com.wms.entity.app.dto;
|
||||
|
||||
import com.wms.entity.app.dto.extend.VehicleDetailInfo;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 载具
|
||||
*/
|
||||
@Data
|
||||
public class VehicleDto {
|
||||
/**
|
||||
* 载具编号
|
||||
*/
|
||||
private String vehicleId;
|
||||
/**
|
||||
* 当前所在位置
|
||||
*/
|
||||
private String currentLocation;
|
||||
/**
|
||||
* 载具状态
|
||||
*/
|
||||
private Integer vehicleStatus;
|
||||
/**
|
||||
* 是否是空箱
|
||||
*/
|
||||
private Integer isEmpty;
|
||||
/**
|
||||
* 载具类型
|
||||
*/
|
||||
private Integer vehicleType;
|
||||
/**
|
||||
* 额外信息
|
||||
*/
|
||||
private VehicleDetailInfo details;
|
||||
}
|
||||
46
src/main/java/com/wms/entity/app/dto/WmsLogDto.java
Normal file
46
src/main/java/com/wms/entity/app/dto/WmsLogDto.java
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
package com.wms.entity.app.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 操作日志类
|
||||
*/
|
||||
@Data
|
||||
public class WmsLogDto {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private String logId;
|
||||
/**
|
||||
* 描述/标题
|
||||
*/
|
||||
private String logTitle;
|
||||
/**
|
||||
* 方法
|
||||
*/
|
||||
private String logMethod;
|
||||
/**
|
||||
* 请求参数
|
||||
*/
|
||||
private Object logRequest;
|
||||
/**
|
||||
* 响应参数
|
||||
*/
|
||||
private Object logResponse;
|
||||
/**
|
||||
* 请求的ip
|
||||
*/
|
||||
private String logIp;
|
||||
/**
|
||||
* 请求时间
|
||||
*/
|
||||
private LocalDateTime logTime;
|
||||
/**
|
||||
* 请求用户
|
||||
*/
|
||||
private String logUser;
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package com.wms.entity.app.dto.extend;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class StockDetailInfo {
|
||||
/**
|
||||
* 物料编号
|
||||
*/
|
||||
private String goodsId;
|
||||
/**
|
||||
* 物料名称
|
||||
*/
|
||||
private String goodsName;
|
||||
/**
|
||||
* 物料状态
|
||||
*/
|
||||
private Integer goodsStatus;
|
||||
/**
|
||||
* 剩余数量
|
||||
*/
|
||||
private BigDecimal remainNum;
|
||||
/**
|
||||
* 入库库存总数
|
||||
*/
|
||||
private BigDecimal totalNum;
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.wms.entity.app.dto.extend;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class TaskDetailInfo {
|
||||
/**
|
||||
* 物料编号
|
||||
*/
|
||||
private String goodsId;
|
||||
/**
|
||||
* 物料名称
|
||||
*/
|
||||
private String goodsName;
|
||||
/**
|
||||
* 操作数量
|
||||
*/
|
||||
private BigDecimal opNum;
|
||||
/**
|
||||
* 原库存剩余数量
|
||||
*/
|
||||
private BigDecimal originNum;
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.wms.entity.app.dto.extend;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 料箱详细信息
|
||||
*/
|
||||
@Data
|
||||
public class VehicleDetailInfo {
|
||||
/// 上
|
||||
private String up;
|
||||
/// 下
|
||||
private String down;
|
||||
/// 左右
|
||||
private String left;
|
||||
/// 右
|
||||
private String right;
|
||||
}
|
||||
28
src/main/java/com/wms/entity/app/request/GoodsInRequest.java
Normal file
28
src/main/java/com/wms/entity/app/request/GoodsInRequest.java
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
package com.wms.entity.app.request;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "入库请求---物料数据")
|
||||
public class GoodsInRequest {
|
||||
@ApiModelProperty(value ="物料编号")
|
||||
private String goodsId;
|
||||
@ApiModelProperty(value ="物料名称")
|
||||
private String goodsName;
|
||||
@ApiModelProperty(value ="物料类型")
|
||||
private String goodsType;
|
||||
@ApiModelProperty(value ="物料单位")
|
||||
private String goodsUnit;
|
||||
@ApiModelProperty(value ="物料数量")
|
||||
private BigDecimal goodsNum;
|
||||
@ApiModelProperty(value ="物料描述")
|
||||
private String goodsDesc;
|
||||
@ApiModelProperty(value ="单个零件重量")
|
||||
private BigDecimal singleWeight;
|
||||
@ApiModelProperty(value ="零件总重量")
|
||||
private BigDecimal weight;
|
||||
}
|
||||
30
src/main/java/com/wms/entity/app/request/GoodsQuery.java
Normal file
30
src/main/java/com/wms/entity/app/request/GoodsQuery.java
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
package com.wms.entity.app.request;
|
||||
|
||||
import com.wms.entity.table.Goods;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@ApiModel(value = "物料查询")
|
||||
public class GoodsQuery extends PageQuery{
|
||||
@ApiModelProperty(value ="物料编号")
|
||||
private String goodsId;
|
||||
@ApiModelProperty(value ="物料名称")
|
||||
private String goodsName;
|
||||
|
||||
|
||||
/**
|
||||
* 将goodsQuery转化为GoodsPO
|
||||
* @return goodsPO
|
||||
*/
|
||||
public Goods toGoodsPO() {
|
||||
Goods goodsPO = new Goods();
|
||||
goodsPO.setGoodsId(goodsId);// 物料编号
|
||||
goodsPO.setGoodsName(goodsName);// 物料描述
|
||||
|
||||
return goodsPO;
|
||||
}
|
||||
}
|
||||
44
src/main/java/com/wms/entity/app/request/LocationQuery.java
Normal file
44
src/main/java/com/wms/entity/app/request/LocationQuery.java
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
package com.wms.entity.app.request;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.wms.entity.table.Location;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@ApiModel(value = "库位查询")
|
||||
public class LocationQuery extends PageQuery {
|
||||
@ApiModelProperty(value = "库位号")
|
||||
private String locationId;
|
||||
@ApiModelProperty(value = "库区编号")
|
||||
private Integer areaId;
|
||||
@ApiModelProperty(value = "设备编号")
|
||||
private Integer equipmentId;
|
||||
@ApiModelProperty(value = "库位类型")
|
||||
private Integer locationType;
|
||||
@ApiModelProperty(value = "排")
|
||||
private Integer wRow;
|
||||
@ApiModelProperty(value = "列")
|
||||
private Integer wCol;
|
||||
@ApiModelProperty(value = "层")
|
||||
private Integer wLayer;
|
||||
@ApiModelProperty(value = "深度")
|
||||
private Integer wDepth;
|
||||
@ApiModelProperty(value = "是否锁定")
|
||||
private Integer isLock;
|
||||
@ApiModelProperty(value = "库位状态")
|
||||
private Integer locationStatus;
|
||||
@ApiModelProperty(value = "载具号")
|
||||
private String vehicleId;
|
||||
|
||||
/**
|
||||
* 将locationQuery转化为LocationPO
|
||||
* @return locationPO
|
||||
*/
|
||||
public Location toLocationPO() {
|
||||
return BeanUtil.copyProperties(this, Location.class);
|
||||
}
|
||||
}
|
||||
48
src/main/java/com/wms/entity/app/request/PageQuery.java
Normal file
48
src/main/java/com/wms/entity/app/request/PageQuery.java
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
package com.wms.entity.app.request;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.wms.utils.StringUtils;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "分页查询")
|
||||
public class PageQuery {
|
||||
@ApiModelProperty(value ="页码")
|
||||
private Long pageNo = 1L;
|
||||
@ApiModelProperty(value ="每页行数")
|
||||
private Long pageSize = 10L;
|
||||
@ApiModelProperty(value ="排序字段")
|
||||
private String sortBy;
|
||||
@ApiModelProperty(value ="是否升序")
|
||||
private Boolean isAsc = true;
|
||||
|
||||
/**
|
||||
* 将前端查询转换为数据库查询可用的分页查询
|
||||
* @param orderItems 排序字段
|
||||
* @return 分页查询
|
||||
* @param <PO> 实体类PO
|
||||
*/
|
||||
public <PO> Page<PO> toMpPage(OrderItem ... orderItems){
|
||||
Page<PO> page = Page.of(pageNo, pageSize);
|
||||
if (StringUtils.isNotEmpty(sortBy)) {
|
||||
page.addOrder(new OrderItem().setColumn(sortBy).setAsc(isAsc));
|
||||
} else {
|
||||
page.addOrder(orderItems);
|
||||
}
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 传入 默认排序字段的转换
|
||||
* @param defaultSortValue 默认查询
|
||||
* @param isAsc 排序方式
|
||||
* @return 分页查询
|
||||
* @param <PO> 实体类
|
||||
*/
|
||||
public <PO> Page<PO> toMpPage(String defaultSortValue, Boolean isAsc){
|
||||
return toMpPage(new OrderItem().setColumn(defaultSortValue).setAsc(isAsc));
|
||||
}
|
||||
}
|
||||
39
src/main/java/com/wms/entity/app/request/StandQuery.java
Normal file
39
src/main/java/com/wms/entity/app/request/StandQuery.java
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
package com.wms.entity.app.request;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@ApiModel(value = "站台查询")
|
||||
public class StandQuery extends PageQuery {
|
||||
/**
|
||||
* 站台id
|
||||
*/
|
||||
@ApiModelProperty(value = "站台号")
|
||||
private String standId;
|
||||
/**
|
||||
* 站台是否锁定
|
||||
*/
|
||||
@ApiModelProperty(value = "是否锁定")
|
||||
private Integer isLock;
|
||||
/**
|
||||
* 站台状态
|
||||
*/
|
||||
@ApiModelProperty(value = "站台状态")
|
||||
private Integer standStatus;
|
||||
/**
|
||||
* 站台类型
|
||||
*/
|
||||
@ApiModelProperty(value = "站台类型")
|
||||
private Integer standType;
|
||||
/**
|
||||
* 设备类型
|
||||
*/
|
||||
@ApiModelProperty(value = "设备类型")
|
||||
private Integer equipmentType;
|
||||
}
|
||||
47
src/main/java/com/wms/entity/app/request/StockQuery.java
Normal file
47
src/main/java/com/wms/entity/app/request/StockQuery.java
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
package com.wms.entity.app.request;
|
||||
|
||||
import com.wms.entity.app.dto.extend.StockDetailInfo;
|
||||
import com.wms.entity.table.Stock;
|
||||
import com.wms.utils.StringUtils;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "库存记录查询---客户端")
|
||||
public class StockQuery extends PageQuery {
|
||||
@ApiModelProperty(value = "库存状态")
|
||||
private Integer stockStatus;
|
||||
@ApiModelProperty(value = "物料状态")
|
||||
private Integer goodsStatus;
|
||||
@ApiModelProperty(value = "库位编号")
|
||||
private String locationId;
|
||||
@ApiModelProperty(value = "载具号/料箱号")
|
||||
private String vehicleId;
|
||||
@ApiModelProperty(value = "物料编号")
|
||||
private String goodsId;
|
||||
@ApiModelProperty(value = "物料名称/描述")
|
||||
private String goodsName;
|
||||
|
||||
/**
|
||||
* 根据客户端查询生成数据库查询条件
|
||||
* @return 数据库PO
|
||||
*/
|
||||
public Stock toStockPO() {
|
||||
Stock stockPO = new Stock();
|
||||
stockPO.setLocationId(locationId);// 库位号
|
||||
stockPO.setStockStatus(stockStatus);// 库存状态
|
||||
stockPO.setVehicleId(vehicleId);// 载具号
|
||||
if (StringUtils.isNotEmpty(goodsId) || StringUtils.isNotEmpty(goodsName) || goodsStatus != null) {// 包含物料详细信息
|
||||
StockDetailInfo goodsRelatedPO = new StockDetailInfo();
|
||||
goodsRelatedPO.setGoodsId(goodsId);
|
||||
goodsRelatedPO.setGoodsName(goodsName);
|
||||
goodsRelatedPO.setGoodsStatus(goodsStatus);
|
||||
stockPO.setGoodsRelated(goodsRelatedPO);
|
||||
}
|
||||
|
||||
return stockPO;
|
||||
}
|
||||
}
|
||||
23
src/main/java/com/wms/entity/app/request/TaskInRequest.java
Normal file
23
src/main/java/com/wms/entity/app/request/TaskInRequest.java
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
package com.wms.entity.app.request;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "入库请求")
|
||||
public class TaskInRequest {
|
||||
@ApiModelProperty(value ="载具号")
|
||||
private String vehicleId;
|
||||
@ApiModelProperty(value ="起点站台")
|
||||
private String originPoint;
|
||||
@ApiModelProperty(value ="称重")
|
||||
private BigDecimal totalWeight;
|
||||
@ApiModelProperty(value ="用户名")
|
||||
private String userName;
|
||||
@ApiModelProperty(value ="入库物料清单")
|
||||
private List<GoodsInRequest> goodsList;
|
||||
}
|
||||
28
src/main/java/com/wms/entity/app/request/TaskOutRequest.java
Normal file
28
src/main/java/com/wms/entity/app/request/TaskOutRequest.java
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
package com.wms.entity.app.request;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "出库请求")
|
||||
public class TaskOutRequest {
|
||||
@ApiModelProperty(value ="物料编号")
|
||||
private String goodsId;
|
||||
@ApiModelProperty(value ="数量")
|
||||
private BigDecimal goodsNum;
|
||||
@ApiModelProperty(value ="载具号")
|
||||
private String vehicleId;
|
||||
@ApiModelProperty(value ="起始库位")
|
||||
private String originPoint;
|
||||
@ApiModelProperty(value ="终点站台")
|
||||
private String destinationPoint;
|
||||
@ApiModelProperty(value ="用户名")
|
||||
private String userName;
|
||||
@ApiModelProperty(value ="是否拣选")
|
||||
private Integer isPicking;
|
||||
@ApiModelProperty(value ="拣选站台")
|
||||
private String pickStand;
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package com.wms.entity.app.request;
|
||||
|
||||
import com.wms.entity.app.dto.extend.TaskDetailInfo;
|
||||
import com.wms.entity.table.TaskRecord;
|
||||
import com.wms.utils.StringUtils;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "任务记录查询---客户端")
|
||||
public class TaskRecordQuery extends PageQuery {
|
||||
@ApiModelProperty(value = "任务类型")
|
||||
private Integer taskType;
|
||||
@ApiModelProperty(value = "载具号/料箱号")
|
||||
private String vehicleId;
|
||||
@ApiModelProperty(value = "物料编号")
|
||||
private String goodsId;
|
||||
@ApiModelProperty(value = "物料名称/描述")
|
||||
private String goodsName;
|
||||
|
||||
/**
|
||||
* 根据客户端查询生成数据库查询条件
|
||||
* @return 数据库PO
|
||||
*/
|
||||
public TaskRecord toTaskRecordPO() {
|
||||
TaskRecord recordPO = new TaskRecord();
|
||||
recordPO.setTaskType(taskType);// 任务类型
|
||||
recordPO.setVehicleId(vehicleId);// 载具号
|
||||
if (StringUtils.isNotEmpty(goodsId) || StringUtils.isNotEmpty(goodsName)) {// 包含物料详细信息
|
||||
TaskDetailInfo goodsRelatedPO = new TaskDetailInfo();
|
||||
goodsRelatedPO.setGoodsId(goodsId);
|
||||
goodsRelatedPO.setGoodsName(goodsName);
|
||||
recordPO.setGoodsRelated(goodsRelatedPO);
|
||||
}
|
||||
|
||||
return recordPO;
|
||||
}
|
||||
}
|
||||
55
src/main/java/com/wms/entity/app/request/UserQuery.java
Normal file
55
src/main/java/com/wms/entity/app/request/UserQuery.java
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
package com.wms.entity.app.request;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.wms.entity.table.User;
|
||||
import com.wms.utils.MyPassword;
|
||||
import com.wms.utils.StringUtils;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@ApiModel(value = "载具查询")
|
||||
public class UserQuery extends PageQuery{
|
||||
/** 用户ID */
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private Integer userId;
|
||||
/** 用户名 */
|
||||
@ApiModelProperty(value = "用户名")
|
||||
private String userName;
|
||||
/** 角色Id */
|
||||
@ApiModelProperty(value = "角色id")
|
||||
private Integer roleId;
|
||||
/** 登录账户 */
|
||||
@ApiModelProperty(value = "登录账号")
|
||||
private String loginAccount;
|
||||
/** 登录密码 */
|
||||
@ApiModelProperty(value = "登录密码")
|
||||
private String loginPassword;
|
||||
/** 添加时间 */
|
||||
@ApiModelProperty(value = "添加时间")
|
||||
private LocalDateTime addTime;
|
||||
/** 更新时间 */
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
/** 添加用户名 */
|
||||
@ApiModelProperty(value = "添加用户")
|
||||
private String addUser;
|
||||
|
||||
/**
|
||||
* 将UserQuery转化为UserPO
|
||||
* @return UserVO结果
|
||||
*/
|
||||
public User toUserPO() {
|
||||
User user = BeanUtil.copyProperties(this, User.class);
|
||||
if (StringUtils.isNotEmpty(user.getLoginPassword())) {
|
||||
user.setLoginPassword(MyPassword.encrypt(user.getLoginPassword()));
|
||||
}
|
||||
|
||||
return user;
|
||||
}
|
||||
}
|
||||
36
src/main/java/com/wms/entity/app/request/VehicleQuery.java
Normal file
36
src/main/java/com/wms/entity/app/request/VehicleQuery.java
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
package com.wms.entity.app.request;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.wms.entity.table.Location;
|
||||
import com.wms.entity.table.Vehicle;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@ApiModel(value = "载具查询")
|
||||
public class VehicleQuery extends PageQuery {
|
||||
@ApiModelProperty(value = "载具编号")
|
||||
private String vehicleId;
|
||||
@ApiModelProperty(value = "载具状态")
|
||||
private Integer vehicleStatus;
|
||||
@ApiModelProperty(value = "是否为空")
|
||||
private Integer isEmpty;
|
||||
@ApiModelProperty(value = "当前位置")
|
||||
private String currentLocation;
|
||||
|
||||
/**
|
||||
* 将VehicleQuery转化为VehiclePO
|
||||
* @return VehiclePO
|
||||
*/
|
||||
public Vehicle toVehiclePO() {
|
||||
Vehicle vehiclePO = new Vehicle();
|
||||
vehiclePO.setVehicleId(vehicleId);
|
||||
vehiclePO.setVehicleStatus(vehicleStatus);
|
||||
vehiclePO.setIsEmpty(isEmpty);
|
||||
vehiclePO.setCurrentLocation(currentLocation);
|
||||
return vehiclePO;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.wms.entity.app.request;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "WCS任务结果反馈请求")
|
||||
public class WcsTaskResultRequest {
|
||||
/**
|
||||
* 任务id----对应wms的taskGroup
|
||||
*/
|
||||
@ApiModelProperty(value = "任务id---对应wms的taskGroup")
|
||||
private String taskId;
|
||||
/**
|
||||
* 载具号
|
||||
*/
|
||||
@ApiModelProperty(value = "载具号")
|
||||
private String vehicleId;
|
||||
/**
|
||||
* 任务状态
|
||||
*/
|
||||
@ApiModelProperty(value = "任务状态")
|
||||
private Integer taskStatus;
|
||||
/**
|
||||
* 任务终点
|
||||
*/
|
||||
@ApiModelProperty(value = "任务终点")
|
||||
private String destination;
|
||||
/**
|
||||
* 任务信息
|
||||
*/
|
||||
@ApiModelProperty(value = "任务信息")
|
||||
private String message;
|
||||
}
|
||||
30
src/main/java/com/wms/entity/app/request/WmsLogQuery.java
Normal file
30
src/main/java/com/wms/entity/app/request/WmsLogQuery.java
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
package com.wms.entity.app.request;
|
||||
|
||||
import com.wms.entity.table.WmsLog;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@ApiModel(value = "日志查询")
|
||||
public class WmsLogQuery extends PageQuery {
|
||||
@ApiModelProperty(value = "日志查询参数")
|
||||
private String queryParam;
|
||||
|
||||
/**
|
||||
* 将日志查询条件转化为LogPO
|
||||
* @return logPO
|
||||
*/
|
||||
public WmsLog toLogPO() {
|
||||
WmsLog logPO = new WmsLog();
|
||||
logPO.setLogTitle(this.queryParam);
|
||||
logPO.setLogMethod(this.queryParam);
|
||||
logPO.setLogRequest(this.queryParam);
|
||||
logPO.setLogResponse(this.queryParam);
|
||||
logPO.setLogIp(this.queryParam);
|
||||
logPO.setLogUser(this.queryParam);
|
||||
return logPO;
|
||||
}
|
||||
}
|
||||
45
src/main/java/com/wms/entity/app/vo/GoodsVo.java
Normal file
45
src/main/java/com/wms/entity/app/vo/GoodsVo.java
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
package com.wms.entity.app.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class GoodsVo {
|
||||
/**
|
||||
* 物料编号
|
||||
*/
|
||||
private String goodsId;
|
||||
/**
|
||||
* 物料名称
|
||||
*/
|
||||
private String goodsName;
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
private String goodsUnit;
|
||||
/**
|
||||
* 物料ID
|
||||
*/
|
||||
private String itemId;
|
||||
/**
|
||||
* 物料分类
|
||||
*/
|
||||
private String goodsType;
|
||||
/**
|
||||
* 有效天数
|
||||
*/
|
||||
private Integer lifeDays;
|
||||
/**
|
||||
* 仓储分类
|
||||
*/
|
||||
private String invCategory;
|
||||
/**
|
||||
* 最后更新日期
|
||||
*/
|
||||
private Date lastUpdateTime;
|
||||
/**
|
||||
* 最后更新用户
|
||||
*/
|
||||
private String lastUpdateUser;
|
||||
}
|
||||
37
src/main/java/com/wms/entity/app/vo/LayerLocation.java
Normal file
37
src/main/java/com/wms/entity/app/vo/LayerLocation.java
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
package com.wms.entity.app.vo;
|
||||
|
||||
|
||||
import com.wms.entity.app.dto.LocationDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 按层划分的库位实体类
|
||||
*/
|
||||
public class LayerLocation {
|
||||
/**
|
||||
* 当前层
|
||||
*/
|
||||
private Integer layer;
|
||||
|
||||
/**
|
||||
* 当前层的所有库位
|
||||
*/
|
||||
private List<LocationDto> currentColLocations;
|
||||
|
||||
public Integer getLayer() {
|
||||
return layer;
|
||||
}
|
||||
|
||||
public void setLayer(Integer layer) {
|
||||
this.layer = layer;
|
||||
}
|
||||
|
||||
public List<LocationDto> getCurrentColLocations() {
|
||||
return currentColLocations;
|
||||
}
|
||||
|
||||
public void setCurrentColLocations(List<LocationDto> currentColLocations) {
|
||||
this.currentColLocations = currentColLocations;
|
||||
}
|
||||
}
|
||||
51
src/main/java/com/wms/entity/app/vo/LocationVo.java
Normal file
51
src/main/java/com/wms/entity/app/vo/LocationVo.java
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
package com.wms.entity.app.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class LocationVo {
|
||||
/**
|
||||
* 库位编号
|
||||
*/
|
||||
private String locationId;
|
||||
/**
|
||||
* 库区编号
|
||||
*/
|
||||
private Integer areaId;
|
||||
/**
|
||||
* 设备编号
|
||||
*/
|
||||
private Integer equipmentId;
|
||||
/**
|
||||
* 库位类型
|
||||
*/
|
||||
private Integer locationType;
|
||||
/**
|
||||
* 排
|
||||
*/
|
||||
private Integer wRow;
|
||||
/**
|
||||
* 列
|
||||
*/
|
||||
private Integer wCol;
|
||||
/**
|
||||
* 层
|
||||
*/
|
||||
private Integer wLayer;
|
||||
/**
|
||||
* 深度
|
||||
*/
|
||||
private Integer wDepth;
|
||||
/**
|
||||
* 是否锁定
|
||||
*/
|
||||
private Integer isLock;
|
||||
/**
|
||||
* 库位状态
|
||||
*/
|
||||
private Integer locationStatus;
|
||||
/**
|
||||
* 载具号
|
||||
*/
|
||||
private String vehicleId;
|
||||
}
|
||||
70
src/main/java/com/wms/entity/app/vo/MenuEntity.java
Normal file
70
src/main/java/com/wms/entity/app/vo/MenuEntity.java
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
package com.wms.entity.app.vo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MenuEntity {
|
||||
/**
|
||||
* 菜单Id
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 菜单名称
|
||||
*/
|
||||
private String labelName;
|
||||
|
||||
/**
|
||||
* 图标值
|
||||
*/
|
||||
private String iconValue;
|
||||
|
||||
/**
|
||||
* 地址
|
||||
*/
|
||||
private String path;
|
||||
|
||||
/**
|
||||
* 子菜单
|
||||
*/
|
||||
private List<MenuEntity> children;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLabelName() {
|
||||
return labelName;
|
||||
}
|
||||
|
||||
public void setLabelName(String labelName) {
|
||||
this.labelName = labelName;
|
||||
}
|
||||
|
||||
public String getIconValue() {
|
||||
return iconValue;
|
||||
}
|
||||
|
||||
public void setIconValue(String iconValue) {
|
||||
this.iconValue = iconValue;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
public List<MenuEntity> getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<MenuEntity> children) {
|
||||
this.children = children;
|
||||
}
|
||||
}
|
||||
34
src/main/java/com/wms/entity/app/vo/RowLocation.java
Normal file
34
src/main/java/com/wms/entity/app/vo/RowLocation.java
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
package com.wms.entity.app.vo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 排
|
||||
*/
|
||||
public class RowLocation {
|
||||
/**
|
||||
* 当前排
|
||||
*/
|
||||
private Integer row;
|
||||
|
||||
/**
|
||||
* 当前排的所有库位
|
||||
*/
|
||||
private List<LayerLocation> currentLayerLocations;
|
||||
|
||||
public Integer getRow() {
|
||||
return row;
|
||||
}
|
||||
|
||||
public void setRow(Integer row) {
|
||||
this.row = row;
|
||||
}
|
||||
|
||||
public List<LayerLocation> getCurrentLayerLocations() {
|
||||
return currentLayerLocations;
|
||||
}
|
||||
|
||||
public void setCurrentLayerLocations(List<LayerLocation> currentLayerLocations) {
|
||||
this.currentLayerLocations = currentLayerLocations;
|
||||
}
|
||||
}
|
||||
54
src/main/java/com/wms/entity/app/vo/StandVo.java
Normal file
54
src/main/java/com/wms/entity/app/vo/StandVo.java
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
package com.wms.entity.app.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class StandVo {
|
||||
/**
|
||||
* 站台id
|
||||
*/
|
||||
private String standId;
|
||||
/**
|
||||
* 是否允许入库
|
||||
*/
|
||||
private Integer allowIn;
|
||||
/**
|
||||
* 是否允许出库
|
||||
*/
|
||||
private Integer allowOut;
|
||||
/**
|
||||
* 站台是否锁定
|
||||
*/
|
||||
private Integer isLock;
|
||||
/**
|
||||
* 站台状态
|
||||
*/
|
||||
private Integer standStatus;
|
||||
/**
|
||||
* 设备编号
|
||||
*/
|
||||
private Integer equipmentId;
|
||||
/**
|
||||
* 库区编号
|
||||
*/
|
||||
private Integer areaId;
|
||||
/**
|
||||
* 站台类型
|
||||
*/
|
||||
private Integer standType;
|
||||
/**
|
||||
* 站台ip
|
||||
*/
|
||||
private String standIp;
|
||||
/**
|
||||
* 外部id
|
||||
* 如果对接,其它系统的站台id
|
||||
*/
|
||||
private String outerId;
|
||||
/**
|
||||
* 最近一次的使用时间
|
||||
*/
|
||||
private LocalDateTime lastUseTime;
|
||||
}
|
||||
14
src/main/java/com/wms/entity/app/vo/StockVo.java
Normal file
14
src/main/java/com/wms/entity/app/vo/StockVo.java
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
package com.wms.entity.app.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class StockVo {
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
}
|
||||
82
src/main/java/com/wms/entity/app/vo/TaskRecordVO.java
Normal file
82
src/main/java/com/wms/entity/app/vo/TaskRecordVO.java
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
package com.wms.entity.app.vo;
|
||||
|
||||
import com.wms.entity.app.dto.extend.TaskDetailInfo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 任务记录VO
|
||||
*/
|
||||
@Data
|
||||
public class TaskRecordVO {
|
||||
/**
|
||||
* 任务号
|
||||
*/
|
||||
private String taskId;
|
||||
/**
|
||||
* 任务类型
|
||||
*/
|
||||
private Integer taskType;
|
||||
/**
|
||||
* 任务状态
|
||||
*/
|
||||
private Integer taskStatus;
|
||||
/**
|
||||
* 起点
|
||||
*/
|
||||
private String origin;
|
||||
/**
|
||||
* 终点
|
||||
*/
|
||||
private String destination;
|
||||
/**
|
||||
* 任务优先级
|
||||
*/
|
||||
private Integer taskPriority;
|
||||
/**
|
||||
* 任务组
|
||||
*/
|
||||
private String taskGroup;
|
||||
/**
|
||||
* 载具号
|
||||
*/
|
||||
private String vehicleId;
|
||||
/**
|
||||
* 重量
|
||||
*/
|
||||
private BigDecimal weight;
|
||||
/**
|
||||
* 载具尺寸
|
||||
*/
|
||||
private Integer vehicleSize;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
/**
|
||||
* 完成时间
|
||||
*/
|
||||
private LocalDateTime finishTime;
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String userName;
|
||||
/**
|
||||
* 物料相关
|
||||
*/
|
||||
private TaskDetailInfo goodsRelated;
|
||||
/**
|
||||
* 前置任务号
|
||||
*/
|
||||
private String preTask;
|
||||
/**
|
||||
* 是否拣选
|
||||
*/
|
||||
private Integer isPicking;
|
||||
/**
|
||||
* 拣选站台
|
||||
*/
|
||||
private String pickStand;
|
||||
}
|
||||
35
src/main/java/com/wms/entity/app/vo/UserConfigEntity.java
Normal file
35
src/main/java/com/wms/entity/app/vo/UserConfigEntity.java
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
package com.wms.entity.app.vo;
|
||||
|
||||
import com.wms.entity.app.dto.UserDto;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel(value = "用户信息")
|
||||
public class UserConfigEntity {
|
||||
/**
|
||||
* 用户认证信息
|
||||
*/
|
||||
private UserDto user;
|
||||
|
||||
/**
|
||||
* 菜单及各种按钮信息
|
||||
*/
|
||||
private List<MenuEntity> menuList;
|
||||
|
||||
public UserDto getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(UserDto user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public List<MenuEntity> getMenuList() {
|
||||
return menuList;
|
||||
}
|
||||
|
||||
public void setMenuList(List<MenuEntity> menuList) {
|
||||
this.menuList = menuList;
|
||||
}
|
||||
}
|
||||
35
src/main/java/com/wms/entity/app/vo/VehicleVO.java
Normal file
35
src/main/java/com/wms/entity/app/vo/VehicleVO.java
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
package com.wms.entity.app.vo;
|
||||
|
||||
import com.wms.entity.app.dto.extend.VehicleDetailInfo;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 载具VO
|
||||
*/
|
||||
@Data
|
||||
public class VehicleVO {
|
||||
/**
|
||||
* 载具编号
|
||||
*/
|
||||
private String vehicleId;
|
||||
/**
|
||||
* 当前所在位置
|
||||
*/
|
||||
private String currentLocation;
|
||||
/**
|
||||
* 载具状态
|
||||
*/
|
||||
private Integer vehicleStatus;
|
||||
/**
|
||||
* 是否是空箱
|
||||
*/
|
||||
private Integer isEmpty;
|
||||
/**
|
||||
* 载具类型
|
||||
*/
|
||||
private Integer vehicleType;
|
||||
/**
|
||||
* 额外信息
|
||||
*/
|
||||
private VehicleDetailInfo details;
|
||||
}
|
||||
41
src/main/java/com/wms/entity/app/vo/WmsLogVo.java
Normal file
41
src/main/java/com/wms/entity/app/vo/WmsLogVo.java
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
package com.wms.entity.app.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class WmsLogVo {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private String logId;
|
||||
/**
|
||||
* 描述/标题
|
||||
*/
|
||||
private String logTitle;
|
||||
/**
|
||||
* 方法
|
||||
*/
|
||||
private String logMethod;
|
||||
/**
|
||||
* 请求参数
|
||||
*/
|
||||
private Object logRequest;
|
||||
/**
|
||||
* 响应参数
|
||||
*/
|
||||
private Object logResponse;
|
||||
/**
|
||||
* 请求的ip
|
||||
*/
|
||||
private String logIp;
|
||||
/**
|
||||
* 请求时间
|
||||
*/
|
||||
private LocalDateTime logTime;
|
||||
/**
|
||||
* 请求用户
|
||||
*/
|
||||
private String logUser;
|
||||
}
|
||||
58
src/main/java/com/wms/entity/app/wcs/ETaskData.java
Normal file
58
src/main/java/com/wms/entity/app/wcs/ETaskData.java
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
package com.wms.entity.app.wcs;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@ApiModel(value = "电子标签详细任务数据")
|
||||
public class ETaskData {
|
||||
@ApiModelProperty(value = "任务号")
|
||||
private String taskId;
|
||||
@ApiModelProperty(value = "点位")
|
||||
private String location;
|
||||
@ApiModelProperty(value = "物料编号")
|
||||
private String goodsId;
|
||||
@ApiModelProperty(value = "物料名称")
|
||||
private String goodsName;
|
||||
@ApiModelProperty(value = "需求数量")
|
||||
private Integer needNum;
|
||||
|
||||
public String getTaskId() {
|
||||
return taskId;
|
||||
}
|
||||
|
||||
public void setTaskId(String taskId) {
|
||||
this.taskId = taskId;
|
||||
}
|
||||
|
||||
public String getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setLocation(String location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public String getGoodsId() {
|
||||
return goodsId;
|
||||
}
|
||||
|
||||
public void setGoodsId(String goodsId) {
|
||||
this.goodsId = goodsId;
|
||||
}
|
||||
|
||||
public String getGoodsName() {
|
||||
return goodsName;
|
||||
}
|
||||
|
||||
public void setGoodsName(String goodsName) {
|
||||
this.goodsName = goodsName;
|
||||
}
|
||||
|
||||
public Integer getNeedNum() {
|
||||
return needNum;
|
||||
}
|
||||
|
||||
public void setNeedNum(Integer needNum) {
|
||||
this.needNum = needNum;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
package com.wms.entity.app.wcs;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@ApiModel(value = "WCS料箱到达请求")
|
||||
public class WcsBoxArriveRequest {
|
||||
@ApiModelProperty(value = "任务组编号")
|
||||
private String taskGroup;
|
||||
@ApiModelProperty(value = "料箱号")
|
||||
private String vehicleNo;
|
||||
@ApiModelProperty(value = "点位---站台")
|
||||
private String location;
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
public String getTaskGroup() {
|
||||
return taskGroup;
|
||||
}
|
||||
|
||||
public void setTaskGroup(String taskGroup) {
|
||||
this.taskGroup = taskGroup;
|
||||
}
|
||||
|
||||
public String getVehicleNo() {
|
||||
return vehicleNo;
|
||||
}
|
||||
|
||||
public void setVehicleNo(String vehicleNo) {
|
||||
this.vehicleNo = vehicleNo;
|
||||
}
|
||||
|
||||
public String getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setLocation(String location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.wms.entity.app.wcs;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@ApiModel(description = "向WCS发送任务请求")
|
||||
public class WcsChangeTaskRequest {
|
||||
@ApiModelProperty(value = "任务ID", required = true)
|
||||
private String taskId;
|
||||
@ApiModelProperty(value = "任务状态---修改后", required = true)
|
||||
private Integer taskStatus;
|
||||
|
||||
public String getTaskId() {
|
||||
return taskId;
|
||||
}
|
||||
|
||||
public void setTaskId(String taskId) {
|
||||
this.taskId = taskId;
|
||||
}
|
||||
|
||||
public Integer getTaskStatus() {
|
||||
return taskStatus;
|
||||
}
|
||||
|
||||
public void setTaskStatus(Integer taskStatus) {
|
||||
this.taskStatus = taskStatus;
|
||||
}
|
||||
}
|
||||
38
src/main/java/com/wms/entity/app/wcs/WcsCommonResponse.java
Normal file
38
src/main/java/com/wms/entity/app/wcs/WcsCommonResponse.java
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
package com.wms.entity.app.wcs;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@ApiModel(description = "WCS通用返回信息")
|
||||
public class WcsCommonResponse<T> {
|
||||
@ApiModelProperty(value = "返回码", required = true)
|
||||
private Integer code;
|
||||
@ApiModelProperty(value = "返回信息", required = true)
|
||||
private String message;
|
||||
@ApiModelProperty(value = "返回数据")
|
||||
private T returnData;
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public T getReturnData() {
|
||||
return returnData;
|
||||
}
|
||||
|
||||
public void setReturnData(T returnData) {
|
||||
this.returnData = returnData;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,108 @@
|
|||
package com.wms.entity.app.wcs;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@ApiModel(value = "WCS电子标签任务反馈请求")
|
||||
public class WcsETaskFeedbackRequest {
|
||||
@ApiModelProperty(value = "任务组")
|
||||
private String taskGroup;
|
||||
@ApiModelProperty(value = "任务类型")
|
||||
private Integer taskType;
|
||||
@ApiModelProperty(value = "料箱号")
|
||||
private String vehicleNo;
|
||||
@ApiModelProperty(value = "订单号")
|
||||
private String orderId;
|
||||
@ApiModelProperty(value = "任务号")
|
||||
private String taskId;
|
||||
@ApiModelProperty(value = "点位")
|
||||
private String location;
|
||||
@ApiModelProperty(value = "物料编号")
|
||||
private String goodsId;
|
||||
@ApiModelProperty(value = "物料名称")
|
||||
private String goodsName;
|
||||
@ApiModelProperty(value = "需求数量")
|
||||
private Integer needNum;
|
||||
@ApiModelProperty(value = "确认数量")
|
||||
private Integer confirmNum;
|
||||
|
||||
public String getTaskGroup() {
|
||||
return taskGroup;
|
||||
}
|
||||
|
||||
public void setTaskGroup(String taskGroup) {
|
||||
this.taskGroup = taskGroup;
|
||||
}
|
||||
|
||||
public Integer getTaskType() {
|
||||
return taskType;
|
||||
}
|
||||
|
||||
public void setTaskType(Integer taskType) {
|
||||
this.taskType = taskType;
|
||||
}
|
||||
|
||||
public String getVehicleNo() {
|
||||
return vehicleNo;
|
||||
}
|
||||
|
||||
public void setVehicleNo(String vehicleNo) {
|
||||
this.vehicleNo = vehicleNo;
|
||||
}
|
||||
|
||||
public String getOrderId() {
|
||||
return orderId;
|
||||
}
|
||||
|
||||
public void setOrderId(String orderId) {
|
||||
this.orderId = orderId;
|
||||
}
|
||||
|
||||
public String getTaskId() {
|
||||
return taskId;
|
||||
}
|
||||
|
||||
public void setTaskId(String taskId) {
|
||||
this.taskId = taskId;
|
||||
}
|
||||
|
||||
public String getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setLocation(String location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public String getGoodsId() {
|
||||
return goodsId;
|
||||
}
|
||||
|
||||
public void setGoodsId(String goodsId) {
|
||||
this.goodsId = goodsId;
|
||||
}
|
||||
|
||||
public String getGoodsName() {
|
||||
return goodsName;
|
||||
}
|
||||
|
||||
public void setGoodsName(String goodsName) {
|
||||
this.goodsName = goodsName;
|
||||
}
|
||||
|
||||
public Integer getNeedNum() {
|
||||
return needNum;
|
||||
}
|
||||
|
||||
public void setNeedNum(Integer needNum) {
|
||||
this.needNum = needNum;
|
||||
}
|
||||
|
||||
public Integer getConfirmNum() {
|
||||
return confirmNum;
|
||||
}
|
||||
|
||||
public void setConfirmNum(Integer confirmNum) {
|
||||
this.confirmNum = confirmNum;
|
||||
}
|
||||
}
|
||||
60
src/main/java/com/wms/entity/app/wcs/WcsETaskRequest.java
Normal file
60
src/main/java/com/wms/entity/app/wcs/WcsETaskRequest.java
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
package com.wms.entity.app.wcs;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel(value = "WCS电子标签任务发送请求")
|
||||
public class WcsETaskRequest {
|
||||
@ApiModelProperty(value = "任务组")
|
||||
private String taskGroup;
|
||||
@ApiModelProperty(value = "任务类型")
|
||||
private Integer taskType;
|
||||
@ApiModelProperty(value = "料箱号")
|
||||
private String vehicleNo;
|
||||
@ApiModelProperty(value = "订单号")
|
||||
private String orderId;
|
||||
@ApiModelProperty(value = "任务数据")
|
||||
private List<ETaskData> taskData;
|
||||
|
||||
public String getTaskGroup() {
|
||||
return taskGroup;
|
||||
}
|
||||
|
||||
public void setTaskGroup(String taskGroup) {
|
||||
this.taskGroup = taskGroup;
|
||||
}
|
||||
|
||||
public Integer getTaskType() {
|
||||
return taskType;
|
||||
}
|
||||
|
||||
public void setTaskType(Integer taskType) {
|
||||
this.taskType = taskType;
|
||||
}
|
||||
|
||||
public String getVehicleNo() {
|
||||
return vehicleNo;
|
||||
}
|
||||
|
||||
public void setVehicleNo(String vehicleNo) {
|
||||
this.vehicleNo = vehicleNo;
|
||||
}
|
||||
|
||||
public String getOrderId() {
|
||||
return orderId;
|
||||
}
|
||||
|
||||
public void setOrderId(String orderId) {
|
||||
this.orderId = orderId;
|
||||
}
|
||||
|
||||
public List<ETaskData> getTaskData() {
|
||||
return taskData;
|
||||
}
|
||||
|
||||
public void setTaskData(List<ETaskData> taskData) {
|
||||
this.taskData = taskData;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
package com.wms.entity.app.wcs;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@ApiModel(description = "WCS发送任务反馈")
|
||||
public class WcsFeedbackTaskRequest {
|
||||
@ApiModelProperty(value = "任务Id")
|
||||
private String taskId;
|
||||
@ApiModelProperty(value = "任务状态")
|
||||
private Integer taskStatus;
|
||||
@ApiModelProperty(value = "任务终点")
|
||||
private String destination;
|
||||
@ApiModelProperty(value = "异常信息")
|
||||
private String message;
|
||||
|
||||
public String getTaskId() {
|
||||
return taskId;
|
||||
}
|
||||
|
||||
public void setTaskId(String taskId) {
|
||||
this.taskId = taskId;
|
||||
}
|
||||
|
||||
public Integer getTaskStatus() {
|
||||
return taskStatus;
|
||||
}
|
||||
|
||||
public void setTaskStatus(Integer taskStatus) {
|
||||
this.taskStatus = taskStatus;
|
||||
}
|
||||
|
||||
public String getDestination() {
|
||||
return destination;
|
||||
}
|
||||
|
||||
public void setDestination(String destination) {
|
||||
this.destination = destination;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
package com.wms.entity.app.wcs;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel(value = "WCS站台拣选任务请求")
|
||||
public class WcsStandTaskRequest {
|
||||
@ApiModelProperty("任务组编号")
|
||||
private String taskGroup;
|
||||
@ApiModelProperty("料箱号")
|
||||
private String vehicleNo;
|
||||
@ApiModelProperty("任务类型---1:拣选任务")
|
||||
private Integer taskType;
|
||||
@ApiModelProperty("点位---站台号")
|
||||
private List<String> location;
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
public String getTaskGroup() {
|
||||
return taskGroup;
|
||||
}
|
||||
|
||||
public void setTaskGroup(String taskGroup) {
|
||||
this.taskGroup = taskGroup;
|
||||
}
|
||||
|
||||
public String getVehicleNo() {
|
||||
return vehicleNo;
|
||||
}
|
||||
|
||||
public void setVehicleNo(String vehicleNo) {
|
||||
this.vehicleNo = vehicleNo;
|
||||
}
|
||||
|
||||
public Integer getTaskType() {
|
||||
return taskType;
|
||||
}
|
||||
|
||||
public void setTaskType(Integer taskType) {
|
||||
this.taskType = taskType;
|
||||
}
|
||||
|
||||
public List<String> getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setLocation(List<String> location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
}
|
||||
93
src/main/java/com/wms/entity/app/wcs/WcsTaskRequest.java
Normal file
93
src/main/java/com/wms/entity/app/wcs/WcsTaskRequest.java
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
package com.wms.entity.app.wcs;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 向Wcs发送任务的请求
|
||||
*/
|
||||
@ApiModel(description = "向WCS发送任务请求")
|
||||
public class WcsTaskRequest {
|
||||
@ApiModelProperty(value = "任务ID", required = true)
|
||||
private String taskId;
|
||||
@ApiModelProperty(value = "任务类型", required = true)
|
||||
private Integer taskType;
|
||||
@ApiModelProperty(value = "任务优先级---同一任务类型中优先级")
|
||||
private Integer priority;
|
||||
@ApiModelProperty(value = "任务起点")
|
||||
private String origin;
|
||||
@ApiModelProperty(value = "任务终点")
|
||||
private String destination;
|
||||
@ApiModelProperty(value = "料箱号", required = true)
|
||||
private String vehicleNo;
|
||||
@ApiModelProperty(value = "料箱尺寸")
|
||||
private Integer vehicleSize = 0;
|
||||
@ApiModelProperty(value = "重量")
|
||||
private BigDecimal weight = BigDecimal.ZERO;
|
||||
|
||||
public String getTaskId() {
|
||||
return taskId;
|
||||
}
|
||||
|
||||
public void setTaskId(String taskId) {
|
||||
this.taskId = taskId;
|
||||
}
|
||||
|
||||
public Integer getTaskType() {
|
||||
return taskType;
|
||||
}
|
||||
|
||||
public void setTaskType(Integer taskType) {
|
||||
this.taskType = taskType;
|
||||
}
|
||||
|
||||
public Integer getPriority() {
|
||||
return priority;
|
||||
}
|
||||
|
||||
public void setPriority(Integer priority) {
|
||||
this.priority = priority;
|
||||
}
|
||||
|
||||
public String getOrigin() {
|
||||
return origin;
|
||||
}
|
||||
|
||||
public void setOrigin(String origin) {
|
||||
this.origin = origin;
|
||||
}
|
||||
|
||||
public String getDestination() {
|
||||
return destination;
|
||||
}
|
||||
|
||||
public void setDestination(String destination) {
|
||||
this.destination = destination;
|
||||
}
|
||||
|
||||
public String getVehicleNo() {
|
||||
return vehicleNo;
|
||||
}
|
||||
|
||||
public void setVehicleNo(String vehicleNo) {
|
||||
this.vehicleNo = vehicleNo;
|
||||
}
|
||||
|
||||
public Integer getVehicleSize() {
|
||||
return vehicleSize;
|
||||
}
|
||||
|
||||
public void setVehicleSize(Integer vehicleSize) {
|
||||
this.vehicleSize = vehicleSize;
|
||||
}
|
||||
|
||||
public BigDecimal getWeight() {
|
||||
return weight;
|
||||
}
|
||||
|
||||
public void setWeight(BigDecimal weight) {
|
||||
this.weight = weight;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
package com.wms.entity.app.wcs;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@ApiModel(value = "WCS请求料箱入库")
|
||||
public class WcsVehicleInRequest {
|
||||
@ApiModelProperty(value = "点位")
|
||||
private String point;
|
||||
@ApiModelProperty(value = "料箱号")
|
||||
private String vehicleNo;
|
||||
@ApiModelProperty(value = "条码信息")
|
||||
private String codeMessage;
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
public String getPoint() {
|
||||
return point;
|
||||
}
|
||||
|
||||
public void setPoint(String point) {
|
||||
this.point = point;
|
||||
}
|
||||
|
||||
public String getVehicleNo() {
|
||||
return vehicleNo;
|
||||
}
|
||||
|
||||
public void setVehicleNo(String vehicleNo) {
|
||||
this.vehicleNo = vehicleNo;
|
||||
}
|
||||
|
||||
public String getCodeMessage() {
|
||||
return codeMessage;
|
||||
}
|
||||
|
||||
public void setCodeMessage(String codeMessage) {
|
||||
this.codeMessage = codeMessage;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
}
|
||||
67
src/main/java/com/wms/entity/page/PageDomain.java
Normal file
67
src/main/java/com/wms/entity/page/PageDomain.java
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
package com.wms.entity.page;
|
||||
|
||||
import com.wms.utils.StringUtils;
|
||||
|
||||
/**
|
||||
* 分页请求
|
||||
* 前端表格用
|
||||
*/
|
||||
public class PageDomain {
|
||||
/**
|
||||
* 当前记录起始索引
|
||||
*/
|
||||
private Integer pageNum;
|
||||
/**
|
||||
* 每页显示记录数
|
||||
*/
|
||||
private Integer pageSize;
|
||||
/**
|
||||
*排序列
|
||||
*/
|
||||
private String orderByColumn;
|
||||
/**
|
||||
* 排序方向
|
||||
*/
|
||||
private String isAsc = "asc";
|
||||
|
||||
public String getOrderBy()
|
||||
{
|
||||
if (StringUtils.isEmpty(orderByColumn))
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return StringUtils.toUnderScoreCase(orderByColumn) + " " + isAsc;
|
||||
}
|
||||
|
||||
public Integer getPageNum() {
|
||||
return pageNum;
|
||||
}
|
||||
|
||||
public void setPageNum(Integer pageNum) {
|
||||
this.pageNum = pageNum;
|
||||
}
|
||||
|
||||
public Integer getPageSize() {
|
||||
return pageSize;
|
||||
}
|
||||
|
||||
public void setPageSize(Integer pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
|
||||
public String getOrderByColumn() {
|
||||
return orderByColumn;
|
||||
}
|
||||
|
||||
public void setOrderByColumn(String orderByColumn) {
|
||||
this.orderByColumn = orderByColumn;
|
||||
}
|
||||
|
||||
public String getIsAsc() {
|
||||
return isAsc;
|
||||
}
|
||||
|
||||
public void setIsAsc(String isAsc) {
|
||||
this.isAsc = isAsc;
|
||||
}
|
||||
}
|
||||
43
src/main/java/com/wms/entity/page/TableRequest.java
Normal file
43
src/main/java/com/wms/entity/page/TableRequest.java
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
package com.wms.entity.page;
|
||||
|
||||
/**
|
||||
* 前端请求表格数据
|
||||
*/
|
||||
public class TableRequest<T, T2> {
|
||||
/**
|
||||
* 分页请求数据
|
||||
*/
|
||||
private PageDomain page;
|
||||
/**
|
||||
* 参数
|
||||
*/
|
||||
private T param;
|
||||
/**
|
||||
* 参数2
|
||||
*/
|
||||
private T2 param2;
|
||||
|
||||
public PageDomain getPage() {
|
||||
return page;
|
||||
}
|
||||
|
||||
public void setPage(PageDomain page) {
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
public T getParam() {
|
||||
return param;
|
||||
}
|
||||
|
||||
public void setParam(T param) {
|
||||
this.param = param;
|
||||
}
|
||||
|
||||
public T2 getParam2() {
|
||||
return param2;
|
||||
}
|
||||
|
||||
public void setParam2(T2 param2) {
|
||||
this.param2 = param2;
|
||||
}
|
||||
}
|
||||
57
src/main/java/com/wms/entity/page/TableResponse.java
Normal file
57
src/main/java/com/wms/entity/page/TableResponse.java
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
package com.wms.entity.page;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 前端表格请求的返回值
|
||||
*/
|
||||
public class TableResponse {
|
||||
/**
|
||||
* 总记录数
|
||||
*/
|
||||
private long total;
|
||||
/**
|
||||
* 列表数据
|
||||
*/
|
||||
private List<?> rows;
|
||||
/**
|
||||
* 状态码
|
||||
*/
|
||||
private int code;
|
||||
/**
|
||||
* 消息
|
||||
*/
|
||||
private String message;
|
||||
|
||||
public long getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public void setTotal(long total) {
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public List<?> getRows() {
|
||||
return rows;
|
||||
}
|
||||
|
||||
public void setRows(List<?> rows) {
|
||||
this.rows = rows;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user