整合版本

This commit is contained in:
葛林强 2024-09-12 09:32:41 +08:00
commit 86a76c1c06
205 changed files with 31397 additions and 0 deletions

View File

@ -0,0 +1,242 @@
# 电子标签标准化接口文档
> 版本号R1.0
>
> 更新时间2024年9月3日
## 版本控制
| 版本号 | 更新时间 | 更新人 | 更新内容 | 备注 |
| ------ | ------------ | ------ | -------- | ---- |
| R1.0 | 2024年9月3日 | 葛林强 | 初版 | |
## 接口详情
### 统一返回
| 参数键 | 参数名称 | 数据类型 | 长度 | 是否允许空值 | 备注 |
| ---------- | -------- | -------- | ---- | ------------ | ------------------------------ |
| code | 响应代码 | int32 | 4 | 否 | 0 - 成功<br />非0 - 失败 |
| msg | 响应信息 | string | 128 | 否 | |
| returnData | 返回信息 | object | | 是 | 下述若存在返回信息均套用此键值 |
### 1、上位系统 向 DPS 发送亮灯任务
> 客户端:上位系统
>
> 服务端DPS
>
> 请求方式POST
>
> 数据类型application/json
>
> 接口地址http://{ip}:{port}/api/wms/dpsTask
**请求参数**
| 参数键 | 参数名称 | 数据类型 | 长度 | 是否允许空值 | 备注 |
| --------- | -------- | -------- | ---- | ------------ | ---------------------------------- |
| taskGroup | 任务组 | string | 64 | 否 | 每次发送的任务组不允许重复 |
| taskType | 任务类型 | int32 | 4 | 否 | 1 - 拣选任务<br />2 - 存取任务 |
| vehicleNo | 载具号 | string | 32 | 否 | |
| areaId | 区域标识 | string | 40 | 否 | 同一个区域号只能存在一个波次的任务 |
| taskData | 任务详情 | list | | 否 | 任务列表单次请求最大支持50条 |
| | | | | | |
| taskId | 任务标识 | string | 64 | 否 | 表示唯一任务,不允许重复,主键 |
| location | 点位 | string | 32 | 否 | 需要点亮的点位 |
| goodsId | 物料编号 | string | 64 | 是 | |
| goodsName | 物料名称 | string | 64 | 是 | |
| showNum | 数量 | int16 | 2 | 否 | 需要点亮的数量 |
```json
{
"taskGroup":"123123123123",
"taskType":1,
"vehicleNo":"BOX123",
"areaId":"abc",
"taskData":[
{
"taskId":"sdfsdfs123",
"location":"1-1-1",
"goodsId":"1001",
"goodsName":"手榴弹",
"showNum":100
},
{
"taskId":"sdfsdfs123",
"location":"1-1-1",
"goodsId":"1002",
"goodsName":"迫击炮弹",
"showNum":500
}
]
}
```
**响应参数**
```json
{
"code":0,
"msg":"操作成功"
}
```
### 2、DPS 向上位系统反馈任务状态
> 客户端DPS
>
> 服务端:上位系统
>
> 请求方式POST
>
> 数据类型application/json
>
> 接口地址http://{ip}:{port}/api/dps/uploadTaskStatus
<u>注意在请求失败情况下http响应码不为 2xxDPS会重复发送 5 次若请求成功http请求码为 2xxDPS 将不再发送,若 5 次均失败则DPS也不再发送</u>
**请求参数**
| 参数键 | 参数名称 | 数据类型 | 长度 | 是否允许空值 | 备注 |
| ---------- | -------- | -------- | ---- | ------------ | ------------------------- |
| taskId | 任务标识 | string | 64 | 否 | 上位系统发送到DPS的任务号 |
| taskStatus | 任务状态 | int | 4 | 否 | 100 - 任务完成 |
| confirmNum | 确认数量 | int | 4 | 否 | 按下确认按钮时的数量 |
```json
{
"taskId":"12312312312",
"taskStatus":100,
"confirmNum":60
}
```
**响应参数**
```json
{
"code":0,
"msg":"操作成功"
}
```
### 3、上位系统向DPS查询任务状态
> 客户端:上位系统
>
> 服务端DPS
>
> 请求方式GET
>
> 数据类型application/json
>
> 接口地址http://{ip}:{port}/api/wms/dpsTask/{taskId}
<u>注意DPS 只保存最近 10 天的数据,超出时间范围内的任务标识将不会返回数据</u>
**请求参数**
| 参数键 | 参数名称 | 数据类型 | 长度 | 是否允许空值 | 备注 |
| ------ | -------- | -------- | ---- | ------------ | ------------------------- |
| taskId | 任务标识 | string | 64 | 否 | 上位系统发送到DPS的任务号 |
**响应参数**
| 参数键 | 参数名称 | 数据类型 | 长度 | 是否允许空值 | 备注 |
| ----------- | -------- | -------- | ---- | ------------ | ------------------------------------------------------------ |
| taskId | 任务标识 | string | 64 | 否 | 上位系统发送到DPS的任务号 |
| taskStatus | 任务状态 | int | 4 | 否 | 0 - 待点亮<br />1 - 正在点亮<br />2 - 已经确认<br />3 - 已经熄灭<br />9 - 点亮异常 |
| lightTime | 点亮时间 | string | 32 | 是 | yyyy-MM-dd HH:mm:ss |
| confirmTime | 确认时间 | string | 32 | 是 | yyyy-MM-dd HH:mm:ss |
| offTime | 熄灭时间 | string | 32 | 是 | yyyy-MM-dd HH:mm:ss |
| remark | 备注 | string | 128 | 是 | |
```json
{
"code":0,
"msg":"查询成功",
"returnData":{
"taskId":"12334534534",
"taskStatus":3,
"lightTime":"2024-06-02 13:45:10",
"confirmTime":"2024-06-02 13:45:20",
"offTime":"2024-06-02 13:45:21",
"remark":"设备上报完成"
}
}
```
### 4、上位系统要求 DPS 取消任务
>客户端:上位系统
>
>服务端DPS
>
>请求方式DELETE
>
>数据类型application/json
>
>接口地址http://{ip}:{port}/api/wms/dpsTask/{taskId}
**请求参数**
| 参数键 | 参数名称 | 数据类型 | 长度 | 是否允许空值 | 备注 |
| ------ | -------- | -------- | ---- | ------------ | ------------------------- |
| taskId | 任务标识 | string | 64 | 否 | 上位系统发送到DPS的任务号 |
**响应参数**
```json
{
"code":0,
"msg":"操作成功"
}
```

34
wcs_etag/.gitignore vendored Normal file
View 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/
### VS Code ###
.vscode/
log

View File

@ -0,0 +1,19 @@
# 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.
wrapperVersion=3.3.2
distributionType=only-script
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.7/apache-maven-3.9.7-bin.zip

File diff suppressed because one or more lines are too long

259
wcs_etag/mvnw vendored Normal file
View File

@ -0,0 +1,259 @@
#!/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.
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# Apache Maven Wrapper startup batch script, version 3.3.2
#
# Optional ENV vars
# -----------------
# JAVA_HOME - location of a JDK home dir, required when download maven via java source
# MVNW_REPOURL - repo url base for downloading maven distribution
# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven
# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output
# ----------------------------------------------------------------------------
set -euf
[ "${MVNW_VERBOSE-}" != debug ] || set -x
# OS specific support.
native_path() { printf %s\\n "$1"; }
case "$(uname)" in
CYGWIN* | MINGW*)
[ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")"
native_path() { cygpath --path --windows "$1"; }
;;
esac
# set JAVACMD and JAVACCMD
set_java_home() {
# For Cygwin and MinGW, ensure paths are in Unix format before anything is touched
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"
JAVACCMD="$JAVA_HOME/jre/sh/javac"
else
JAVACMD="$JAVA_HOME/bin/java"
JAVACCMD="$JAVA_HOME/bin/javac"
if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then
echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2
echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2
return 1
fi
fi
else
JAVACMD="$(
'set' +e
'unset' -f command 2>/dev/null
'command' -v java
)" || :
JAVACCMD="$(
'set' +e
'unset' -f command 2>/dev/null
'command' -v javac
)" || :
if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then
echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2
return 1
fi
fi
}
# hash string like Java String::hashCode
hash_string() {
str="${1:-}" h=0
while [ -n "$str" ]; do
char="${str%"${str#?}"}"
h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296))
str="${str#?}"
done
printf %x\\n $h
}
verbose() { :; }
[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; }
die() {
printf %s\\n "$1" >&2
exit 1
}
trim() {
# MWRAPPER-139:
# Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds.
# Needed for removing poorly interpreted newline sequences when running in more
# exotic environments such as mingw bash on Windows.
printf "%s" "${1}" | tr -d '[:space:]'
}
# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties
while IFS="=" read -r key value; do
case "${key-}" in
distributionUrl) distributionUrl=$(trim "${value-}") ;;
distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;;
esac
done <"${0%/*}/.mvn/wrapper/maven-wrapper.properties"
[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in ${0%/*}/.mvn/wrapper/maven-wrapper.properties"
case "${distributionUrl##*/}" in
maven-mvnd-*bin.*)
MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/
case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in
*AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;;
:Darwin*x86_64) distributionPlatform=darwin-amd64 ;;
:Darwin*arm64) distributionPlatform=darwin-aarch64 ;;
:Linux*x86_64*) distributionPlatform=linux-amd64 ;;
*)
echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2
distributionPlatform=linux-amd64
;;
esac
distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip"
;;
maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;;
*) MVN_CMD="mvn${0##*/mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;;
esac
# apply MVNW_REPOURL and calculate MAVEN_HOME
# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash>
[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}"
distributionUrlName="${distributionUrl##*/}"
distributionUrlNameMain="${distributionUrlName%.*}"
distributionUrlNameMain="${distributionUrlNameMain%-bin}"
MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}"
MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")"
exec_maven() {
unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || :
exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD"
}
if [ -d "$MAVEN_HOME" ]; then
verbose "found existing MAVEN_HOME at $MAVEN_HOME"
exec_maven "$@"
fi
case "${distributionUrl-}" in
*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;;
*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;;
esac
# prepare tmp dir
if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then
clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; }
trap clean HUP INT TERM EXIT
else
die "cannot create temp dir"
fi
mkdir -p -- "${MAVEN_HOME%/*}"
# Download and Install Apache Maven
verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
verbose "Downloading from: $distributionUrl"
verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
# select .zip or .tar.gz
if ! command -v unzip >/dev/null; then
distributionUrl="${distributionUrl%.zip}.tar.gz"
distributionUrlName="${distributionUrl##*/}"
fi
# verbose opt
__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR=''
[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v
# normalize http auth
case "${MVNW_PASSWORD:+has-password}" in
'') MVNW_USERNAME='' MVNW_PASSWORD='' ;;
has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;;
esac
if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then
verbose "Found wget ... using wget"
wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl"
elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then
verbose "Found curl ... using curl"
curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl"
elif set_java_home; then
verbose "Falling back to use Java to download"
javaSource="$TMP_DOWNLOAD_DIR/Downloader.java"
targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName"
cat >"$javaSource" <<-END
public class Downloader extends java.net.Authenticator
{
protected java.net.PasswordAuthentication getPasswordAuthentication()
{
return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() );
}
public static void main( String[] args ) throws Exception
{
setDefault( new Downloader() );
java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() );
}
}
END
# For Cygwin/MinGW, switch paths to Windows format before running javac and java
verbose " - Compiling Downloader.java ..."
"$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java"
verbose " - Running Downloader.java ..."
"$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")"
fi
# If specified, validate the SHA-256 sum of the Maven distribution zip file
if [ -n "${distributionSha256Sum-}" ]; then
distributionSha256Result=false
if [ "$MVN_CMD" = mvnd.sh ]; then
echo "Checksum validation is not supported for maven-mvnd." >&2
echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
exit 1
elif command -v sha256sum >/dev/null; then
if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c >/dev/null 2>&1; then
distributionSha256Result=true
fi
elif command -v shasum >/dev/null; then
if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then
distributionSha256Result=true
fi
else
echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2
echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
exit 1
fi
if [ $distributionSha256Result = false ]; then
echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2
echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2
exit 1
fi
fi
# unzip and move
if command -v unzip >/dev/null; then
unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip"
else
tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar"
fi
printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/mvnw.url"
mv -- "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME"
clean || :
exec_maven "$@"

149
wcs_etag/mvnw.cmd vendored Normal file
View File

@ -0,0 +1,149 @@
<# : batch portion
@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 Apache Maven Wrapper startup batch script, version 3.3.2
@REM
@REM Optional ENV vars
@REM MVNW_REPOURL - repo url base for downloading maven distribution
@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven
@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output
@REM ----------------------------------------------------------------------------
@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0)
@SET __MVNW_CMD__=
@SET __MVNW_ERROR__=
@SET __MVNW_PSMODULEP_SAVE=%PSModulePath%
@SET PSModulePath=
@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @(
IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B)
)
@SET PSModulePath=%__MVNW_PSMODULEP_SAVE%
@SET __MVNW_PSMODULEP_SAVE=
@SET __MVNW_ARG0_NAME__=
@SET MVNW_USERNAME=
@SET MVNW_PASSWORD=
@IF NOT "%__MVNW_CMD__%"=="" (%__MVNW_CMD__% %*)
@echo Cannot start maven from wrapper >&2 && exit /b 1
@GOTO :EOF
: end batch / begin powershell #>
$ErrorActionPreference = "Stop"
if ($env:MVNW_VERBOSE -eq "true") {
$VerbosePreference = "Continue"
}
# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties
$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl
if (!$distributionUrl) {
Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties"
}
switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) {
"maven-mvnd-*" {
$USE_MVND = $true
$distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip"
$MVN_CMD = "mvnd.cmd"
break
}
default {
$USE_MVND = $false
$MVN_CMD = $script -replace '^mvnw','mvn'
break
}
}
# apply MVNW_REPOURL and calculate MAVEN_HOME
# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash>
if ($env:MVNW_REPOURL) {
$MVNW_REPO_PATTERN = if ($USE_MVND) { "/org/apache/maven/" } else { "/maven/mvnd/" }
$distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace '^.*'+$MVNW_REPO_PATTERN,'')"
}
$distributionUrlName = $distributionUrl -replace '^.*/',''
$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$',''
$MAVEN_HOME_PARENT = "$HOME/.m2/wrapper/dists/$distributionUrlNameMain"
if ($env:MAVEN_USER_HOME) {
$MAVEN_HOME_PARENT = "$env:MAVEN_USER_HOME/wrapper/dists/$distributionUrlNameMain"
}
$MAVEN_HOME_NAME = ([System.Security.Cryptography.MD5]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join ''
$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME"
if (Test-Path -Path "$MAVEN_HOME" -PathType Container) {
Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME"
Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD"
exit $?
}
if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) {
Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl"
}
# prepare tmp dir
$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile
$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir"
$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null
trap {
if ($TMP_DOWNLOAD_DIR.Exists) {
try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null }
catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" }
}
}
New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null
# Download and Install Apache Maven
Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
Write-Verbose "Downloading from: $distributionUrl"
Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
$webclient = New-Object System.Net.WebClient
if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) {
$webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD)
}
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null
# If specified, validate the SHA-256 sum of the Maven distribution zip file
$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum
if ($distributionSha256Sum) {
if ($USE_MVND) {
Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties."
}
Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash
if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) {
Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property."
}
}
# unzip and move
Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null
Rename-Item -Path "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" -NewName $MAVEN_HOME_NAME | Out-Null
try {
Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null
} catch {
if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) {
Write-Error "fail to move MAVEN_HOME"
}
} finally {
try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null }
catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" }
}
Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD"

105
wcs_etag/pom.xml Normal file
View File

@ -0,0 +1,105 @@
<?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.3.2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.wcs_etag</groupId>
<artifactId>wcs_etag</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>wcs_etag</name>
<description>wcs_etag</description>
<url/>
<licenses>
<license/>
</licenses>
<developers>
<developer/>
</developers>
<scm>
<connection/>
<developerConnection/>
<tag/>
<url/>
</scm>
<properties>
<java.version>17</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
<version>3.3.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
<version>3.3.2</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
<version>3.5.7</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.16.1</version>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,208 @@
package com.tcp_client;
import com.tcp_client.constant.SocketStatusEnum;
import com.tcp_client.model.po.SocketServerData;
import lombok.Setter;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import java.io.IOException;
import java.io.InputStream;
import java.net.InetAddress;
import java.net.Socket;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.*;
public class SocketClient {
// 基础的服务端的信息
private List<SocketServerData> socketServerDataList;
// 事件回调
@Setter
private TcpEvent tcpEvent;
/**
* 设置基础的服务端信息
* @param id 服务端ID
* @param ip 服务端ip
* @param port 服务端端口
* @param name 服务端名称
* @return 是否添加成功错误会返回错误信息成功会返回 Null
*/
public String setBaseServerInfo(Integer id, String ip, Integer port, String name) {
if(socketServerDataList == null) {
socketServerDataList = new ArrayList<>();
}
SocketServerData socketServerData = new SocketServerData();
socketServerData.setId(id);
socketServerData.setIp(ip);
socketServerData.setPort(port);
socketServerData.setName(name);
socketServerData.setConnectStatus(SocketStatusEnum.WAIT_CONNECT);
socketServerDataList.add(socketServerData);
return null;
}
/**
* 连接服务端
*/
public void connect() {
if(socketServerDataList == null || socketServerDataList.isEmpty()) {
return;
}
for (SocketServerData socketServerData : socketServerDataList) {
Thread thread = new Thread(()->{
if(socketServerData.getConnectStatus() == SocketStatusEnum.CONNECTING
|| socketServerData.getConnectStatus() == SocketStatusEnum.CONNECTED) {
return;
}
try {
socketServerData.setConnectStatus(SocketStatusEnum.CONNECTING);
socketServerData.setSocket(new Socket(socketServerData.getIp(), socketServerData.getPort()));
socketServerData.setConnectStatus(SocketStatusEnum.CONNECTED);
while (true) {
InputStream inputStream = socketServerData.getSocket().getInputStream();// 接收消息
byte[] receiveBytes = new byte[128];
int readCount = inputStream.read(receiveBytes);
if (tcpEvent != null) {
tcpEvent.receiveData(socketServerData, receiveBytes);
}
if(readCount == 0 || Arrays.equals(receiveBytes, new byte[128])) {
// 断开连接
try {
socketServerData.getSocket().close();
} catch (IOException ignored) {
}
socketServerData.setSocket(null);
if (tcpEvent != null) {
tcpEvent.DisConnected(socketServerData);
}
break;
}
}
socketServerData.setSocket(null);
socketServerData.setConnectStatus(SocketStatusEnum.DISCONNECTED);
if (tcpEvent != null) {
tcpEvent.DisConnected(socketServerData);
}
} catch (IOException e) {
if (socketServerData.getSocket() != null) {
try {
socketServerData.getSocket().close(); // 连接失败时候释放Socket资源
} catch (IOException ignored) {
}
socketServerData.setSocket(null);
}
socketServerData.setConnectStatus(SocketStatusEnum.DISCONNECTED);
if (tcpEvent != null) {
tcpEvent.ConnectFailed(socketServerData); // 连接失败
}
}
});
thread.start();
}
}
/**
* 定时器监控 Socket 是否断开
*/
public void keepAlive() {
ScheduledExecutorService keepAliveThreadPool = Executors.newScheduledThreadPool(5);
keepAliveThreadPool.scheduleAtFixedRate(() -> {
if(socketServerDataList == null || socketServerDataList.isEmpty()) {
keepAliveThreadPool.shutdown();
return;
}
for (SocketServerData socketServerData : socketServerDataList) {
if (socketServerData.getConnectStatus() == SocketStatusEnum.CONNECTED && socketServerData.getSocket() != null) {
/* 检测连接中的Socket是否断开若断开则设置状态为连接断开并且释放Socket资源 */
// ping 地址
boolean canPing = ping(socketServerData.getIp());
if (!canPing) {
socketServerData.setConnectStatus(SocketStatusEnum.DISCONNECTED);
try {
socketServerData.getSocket().close();
} catch (IOException ignored) {
}
socketServerData.setSocket(null);
if (tcpEvent != null) {
tcpEvent.DisConnected(socketServerData);
}
break;
}
// 尝试发送数据
try {
socketServerData.getSocket().getOutputStream().write("".getBytes(StandardCharsets.US_ASCII));
} catch (IOException e) {
// 发送失败断开连接
socketServerData.setConnectStatus(SocketStatusEnum.DISCONNECTED);
try {
socketServerData.getSocket().close();
} catch (IOException ignored) {
}
socketServerData.setSocket(null);
if (tcpEvent != null) {
tcpEvent.DisConnected(socketServerData);
}
break;
}
}
}
connect(); // 重新调用连接方法
}, 10, 5, TimeUnit.SECONDS);
}
/**
* ping 一个ip 地址
* @param ip ip
* @return ping 是否成功的结果
*/
private boolean ping(String ip) {
try {
return InetAddress.getByName(ip).isReachable(500);
} catch (IOException e) {
return false;
}
}
/**
* 向一个 Socket id 发送信息
* @param id id
* @param data 信息
* @return 错误信息 null 则表示发送成功
*/
public String sendData(Integer id, byte[] data) {
if(id == null) {
return "传入的 id 为 null";
}
if(data == null || data.length == 0) {
return "要发送的数据为空";
}
if(socketServerDataList == null || socketServerDataList.isEmpty()) {
return "没有Socket资源";
}
for (SocketServerData socketServerData : socketServerDataList) {
if(socketServerData.getId().equals(id)) {
try {
if(socketServerData.getConnectStatus() != SocketStatusEnum.CONNECTED) {
return "Socket 未连接或者已经断开";
}
if(socketServerData.getSocket() == null) {
return "Socket 连接为空";
}
socketServerData.getSocket().getOutputStream().write(data);
return null;
} catch (IOException e) {
return "发送数据失败";
}
}
}
return "未找到对应 id 的 Socket";
}
}

View File

@ -0,0 +1,44 @@
package com.tcp_client;
import com.tcp_client.model.po.SocketServerData;
/**
* 观察着模式触发事件
*/
public interface TcpEvent {
/**
* 连接中
* @param socketServerData 服务端
*/
void Connecting(SocketServerData socketServerData);
/**
* 连接成功
* @param socketServerData 服务端
*/
void Connected(SocketServerData socketServerData);
/**
* 连接失败
* @param socketServerData 服务端
*/
void ConnectFailed(SocketServerData socketServerData);
/**
* 断开连接
* @param socketServerData 服务端
*/
void DisConnected(SocketServerData socketServerData);
/**
* 收到信息
* @param socketServerData 客户端
* @param data 信息
*/
void receiveData(SocketServerData socketServerData, byte[] data);
}

View File

@ -0,0 +1,20 @@
package com.tcp_client.constant;
/**
* socket 连接状态枚举
*/
public enum SocketStatusEnum {
// 等待连接
WAIT_CONNECT,
// 连接中
CONNECTING,
// 已连接
CONNECTED,
// 已断开连接
DISCONNECTED;
}

View File

@ -0,0 +1,47 @@
package com.tcp_client.model.po;
import com.tcp_client.constant.SocketStatusEnum;
import lombok.Data;
import java.net.Socket;
/**
* 基础的 Socket 连接信息
*/
@Data
public class SocketServerData {
/**
* socket客户端的id号
*/
private Integer id;
/**
* socket客户端的ip
*/
private String ip;
/**
* socket客户端的端口号
*/
private Integer port;
/**
* socket客户端的名称
*/
private String name;
/**
* socket客户端的连接实例
*/
private Socket socket;
/**
* 连接状态
*/
private SocketStatusEnum connectStatus;
}

View File

@ -0,0 +1,6 @@
package com.tcp_client.utils;
public class StringUtils {
}

View File

@ -0,0 +1,13 @@
package com.wcs_etag;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class WcsEtagApplication {
public static void main(String[] args) {
SpringApplication.run(WcsEtagApplication.class, args);
}
}

View File

@ -0,0 +1,12 @@
package com.wcs_etag.business;
/**
* 电子标签主任务类
*/
public class ETagStartMain {
}

View File

@ -0,0 +1,31 @@
package com.wcs_etag.business.base;
import com.wcs_etag.mapper.intf.AppConfigService;
import com.wcs_etag.model.po.AppConfig;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
/**
* 配置表的操作类
*/
@Component
@RequiredArgsConstructor
public class ConfigOperation {
private final AppConfigService appConfigService;
/**
* 根据键值获取配置值
* @param key 键值
* @return 配置值
*/
public String getConfigValue(String key)
{
AppConfig configByKey = appConfigService.getConfigByKey(key);
if(configByKey == null) {
return null;
}
return configByKey.getConfigValue();
}
}

View File

@ -0,0 +1,24 @@
package com.wcs_etag.config;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@Configuration
@EnableTransactionManagement
public class MybatisPlusConfig {
/**
* 添加分页插件
*/
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL)); // 如果配置多个插件, 切记分页最后添加
// 如果有多数据源可以不配具体类型, 否则都建议配上具体的 DbType
return interceptor;
}
}

View File

@ -0,0 +1,6 @@
package com.wcs_etag.constant;
public final class AppConfig {
public static final String MACHINE_ID = "0001"; // 系统机器号
}

View File

@ -0,0 +1,7 @@
package com.wcs_etag.constant;
public class staticString {
public static final String WMS_API = "WMS_API";
}

View File

@ -0,0 +1,23 @@
package com.wcs_etag.constant.wcsEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
/**
* Wcs Api 响应码枚举
*/
@Getter
@AllArgsConstructor
public enum WcsApiResponseCodeEnum {
SUCCESS(0, "成功"),
FAIL(999, "失败"),
REPEAT(200, "数据重复"),
;
private final Integer code;
private final String message;
}

View File

@ -0,0 +1,16 @@
package com.wcs_etag.constant.wcsEnum.commonEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 开启关闭枚举
*/
@Getter
@AllArgsConstructor
public enum OnOffEnum {
ON(1, "开启"),
OFF(0, "关闭");
private final Integer code;
private final String desc;
}

View File

@ -0,0 +1,18 @@
package com.wcs_etag.constant.wcsEnum.commonEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 是否枚举
*/
@Getter
@AllArgsConstructor
public enum TrueFalseEnum {
TRUE(1, ""),
FALSE(0, "");
private final Integer code;
private final String desc;
}

View File

@ -0,0 +1,36 @@
package com.wcs_etag.constant.wcsEnum.tableEnum;
import lombok.Getter;
/**
* 电子标签任务状态枚举
*/
@Getter
public enum ETagTaskStatusEnum {
NEED_LIGHT(0, "待点亮"),
LIGHTING(1, "点亮中"),
CONFIRM(2, "已确认"),
OFF(3, "已熄灭"),
ERROR(9, "异常");
private final Integer code;
private final String desc;
ETagTaskStatusEnum(Integer code, String desc) {
this.code = code;
this.desc = desc;
}
public static String getDescByCode(Integer code) {
for (ETagTaskStatusEnum statusEnum : ETagTaskStatusEnum.values()) {
if (statusEnum.getCode().equals(code)) {
return statusEnum.getDesc();
}
}
return null;
}
}

View File

@ -0,0 +1,30 @@
package com.wcs_etag.constant.wcsEnum.tableEnum;
import lombok.Getter;
/**
* 电子标签的任务类型枚举
*/
@Getter
public enum ETagTaskTypeEnum {
PICK(1, "拣选任务"),
STOCK(2, "存储任务"),
TEST(9, "测试任务");
private final Integer code;
private final String desc;
ETagTaskTypeEnum(Integer code, String desc) {
this.code = code;
this.desc = desc;
}
public static String getDescByCode(Integer code) {
for (ETagTaskTypeEnum e : ETagTaskTypeEnum.values()) {
if (e.getCode().equals(code)) {
return e.getDesc();
}
}
return null;
}
}

View File

@ -0,0 +1,21 @@
package com.wcs_etag.constant.wmsEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* Wms Api 响应码枚举
*/
@Getter
@AllArgsConstructor
public enum WmsApiResponseCodeEnum {
SUCCESS(0, "成功"),
FAIL(999, "失败"),
REPEAT(200, "数据重复"),
;
private final Integer code;
private final String message;
}

View File

@ -0,0 +1,30 @@
package com.wcs_etag.controller.wcs;
import com.wcs_etag.model.dto.wcs.etagLocation.GetETagLocationListPageRequest;
import com.wcs_etag.model.po.AppETagLocation;
import com.wcs_etag.model.vo.wcs.common.WcsApiTagDataResponse;
import com.wcs_etag.service.wcs.intf.IETagLocationControllerService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/wcs/etag")
@ResponseBody
@RequiredArgsConstructor
@CrossOrigin
public class ETagLocationController {
private final IETagLocationControllerService iETagLocationControllerService;
/**
* 查询电子标签货位表
* @param request 查询条件
* @return 返回结果
*/
@PostMapping("/getETagLocationListPage")
public WcsApiTagDataResponse<Integer, List<AppETagLocation>> getETagLocationListPage(@RequestBody GetETagLocationListPageRequest request) {
return iETagLocationControllerService.getETagLocationListPage(request);
}
}

View File

@ -0,0 +1,53 @@
package com.wcs_etag.controller.wcs;
import com.wcs_etag.model.dto.wcs.etagTask.GetETagTaskListPageRequest;
import com.wcs_etag.model.dto.wcs.etagTask.InsertEtagTaskRequest;
import com.wcs_etag.model.dto.wcs.etagTask.UpdateETagTaskStatusRequest;
import com.wcs_etag.model.po.AppETagTask;
import com.wcs_etag.model.vo.wcs.common.WcsApiBaseResponse;
import com.wcs_etag.model.vo.wcs.common.WcsApiTagDataResponse;
import com.wcs_etag.service.wcs.intf.IETagTaskControllerService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/wcs/etag")
@ResponseBody
@RequiredArgsConstructor
@CrossOrigin
public class ETagTaskController {
private final IETagTaskControllerService iETagTaskControllerService;
/**
* 分页查询电子标签任务信息
* @param request 查询条件
* @return 查询结果
*/
@PostMapping("/getETagTaskListPage")
public WcsApiTagDataResponse<Integer, List<AppETagTask>> getETagTaskListPage(@RequestBody GetETagTaskListPageRequest request) {
return iETagTaskControllerService.getETagTaskListPage(request);
}
/**
* 更新电子标签任务状态
* @param request 更新信息
* @return 更新结果
*/
@PostMapping("/updateETagTaskStatus")
public WcsApiBaseResponse updateETagTaskStatus(@RequestBody UpdateETagTaskStatusRequest request) {
return iETagTaskControllerService.updateETagTaskStatus(request);
}
/**
* 添加一条电子标签任务
* @param request 添加信息
* @return 结果
*/
@PostMapping("/insertEtagTask")
public WcsApiBaseResponse insertEtagTask(@RequestBody InsertEtagTaskRequest request) {
return iETagTaskControllerService.insertEtagTask(request);
}
}

View File

@ -0,0 +1,29 @@
package com.wcs_etag.controller.wcs;
import com.wcs_etag.model.po.AppTcp;
import com.wcs_etag.model.vo.wcs.common.WcsApiDataResponse;
import com.wcs_etag.service.wcs.intf.ITcpControllerService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/wcs/tcp")
@ResponseBody
@RequiredArgsConstructor
@CrossOrigin
public class TcpController {
private final ITcpControllerService tcpControllerService;
/**
* 获取 TCP 列表
* @return TCP 列表
*/
@GetMapping("/getTcpList")
public WcsApiDataResponse<List<AppTcp> > getTcpList() {
return tcpControllerService.getTcpList();
}
}

View File

@ -0,0 +1,31 @@
package com.wcs_etag.controller.wcs;
import com.wcs_etag.model.dto.wcs.user.LoginRequest;
import com.wcs_etag.model.vo.wcs.common.WcsApiDataResponse;
import com.wcs_etag.model.vo.wcs.user.LoginResponse;
import com.wcs_etag.service.wcs.intf.IUserControllerService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/wcs/user")
@ResponseBody
@RequiredArgsConstructor
@CrossOrigin
public class UserController {
private final IUserControllerService userControllerService;
/**
* 登录
* @return 登录结果
*/
@PostMapping("/login")
public WcsApiDataResponse<LoginResponse> login(@Validated @RequestBody LoginRequest loginRequest){
return userControllerService.login(loginRequest);
}
}

View File

@ -0,0 +1,56 @@
package com.wcs_etag.controller.wms;
import com.wcs_etag.model.dto.wms.GetDpsTaskRequest;
import com.wcs_etag.model.vo.wms.GetDpsTaskResponse;
import com.wcs_etag.model.vo.wms.common.WmsApiDataResponse;
import com.wcs_etag.model.vo.wms.common.WmsApiBaseResponse;
import com.wcs_etag.service.wms.intf.WmsTaskControllerService;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* 给外部WMS调用的接口
*/
@RestController
@RequestMapping("/wms")
@CrossOrigin
@Log4j2
@RequiredArgsConstructor
public class WmsTaskController {
private final WmsTaskControllerService wmsTaskControllerService;
/**
* 获取DPS任务
* @param request 请求参数
* @return 返回结果
*/
@PostMapping("/dpsTask")
public WmsApiBaseResponse dpsTask(@RequestBody @Validated GetDpsTaskRequest request) {
return wmsTaskControllerService.dpsTask(request);
}
/**
* 查询任务庄涛
* @param dpsTaskId 任务ID
* @return 查询结果
*/
@GetMapping("/dpsTask/{taskId}")
public WmsApiDataResponse<GetDpsTaskResponse> getDpsTask(@PathVariable("taskId") String dpsTaskId) {
return wmsTaskControllerService.getDpsTask(dpsTaskId);
}
/**
* 取消任务
* @param dpsTaskId 任务ID
* @return 结果
*/
@DeleteMapping("/dpsTask/{taskId}")
public WmsApiBaseResponse cancelTask(@PathVariable("taskId") String dpsTaskId) {
return wmsTaskControllerService.cancelTask(dpsTaskId);
}
}

View File

@ -0,0 +1,60 @@
package com.wcs_etag.controllerAdvice;
import com.wcs_etag.model.vo.wcs.common.WcsApiBaseResponse;
import com.wcs_etag.constant.wcsEnum.WcsApiResponseCodeEnum;
import lombok.extern.log4j.Log4j2;
import org.springframework.http.converter.HttpMessageConversionException;
import org.springframework.validation.FieldError;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
@ControllerAdvice(value = "com.wcs_etag.controller.wcs")
@Log4j2
@ResponseBody
public class WcsControllerExceptionHandler {
/**
* 参数校验失败
* @param ex 异常
* @return 返回值
*/
@ExceptionHandler(value = MethodArgumentNotValidException.class)
public WcsApiBaseResponse methodArgumentNotValidException(MethodArgumentNotValidException ex) {
log.error("请求参数错误:{}", ex.getMessage());
String errMessage = "请求参数错误";
FieldError fieldError = ex.getBindingResult().getFieldError();
if(fieldError != null) {
errMessage = fieldError.getDefaultMessage();
}
return new WcsApiBaseResponse(WcsApiResponseCodeEnum.FAIL.getCode(), errMessage);
}
/**
* 参数类型转换失败
* @param ex 异常
* @return 返回值
*/
@ExceptionHandler(HttpMessageConversionException.class)
public WcsApiBaseResponse parameterTypeException(HttpMessageConversionException ex) {
log.error("请求参数格式错误:{}", ex.getMessage());
String errorMessage = "请求参数格式错误,请参照接口文档";
return new WcsApiBaseResponse(WcsApiResponseCodeEnum.FAIL.getCode(), errorMessage);
}
/**
* 捕获所有异常
* @param e 异常
* @return 返回值
*/
@ExceptionHandler(value = Exception.class)
public WcsApiBaseResponse handleException(Exception e) {
log.error("接口异常:{}", e.getMessage());
return new WcsApiBaseResponse(WcsApiResponseCodeEnum.FAIL.getCode(), String.format("发生异常:%s", e.getMessage()));
}
//
}

View File

@ -0,0 +1,61 @@
package com.wcs_etag.controllerAdvice;
import com.wcs_etag.constant.wmsEnum.WmsApiResponseCodeEnum;
import com.wcs_etag.model.vo.wms.common.WmsApiBaseResponse;
import com.wcs_etag.utils.WmsResponseFactory;
import lombok.extern.log4j.Log4j2;
import org.springframework.http.converter.HttpMessageConversionException;
import org.springframework.validation.FieldError;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* Wms 接口的异常处理类
*/
@ControllerAdvice(value = "com.wcs_etag.controller.wms")
@Log4j2
@ResponseBody
public class WmsControllerExceptionHandler {
/**
* 参数校验失败
* @param ex 异常
* @return 返回值
*/
@ExceptionHandler(value = MethodArgumentNotValidException.class)
public WmsApiBaseResponse methodArgumentNotValidException(MethodArgumentNotValidException ex) {
log.error("请求参数错误:{}", ex.getMessage());
String errMessage = "请求参数错误";
FieldError fieldError = ex.getBindingResult().getFieldError();
if(fieldError != null) {
errMessage = fieldError.getDefaultMessage();
}
return WmsResponseFactory.create(WmsApiResponseCodeEnum.FAIL.getCode(), errMessage);
}
/**
* 参数类型转换失败
* @param ex 异常
* @return 返回值
*/
@ExceptionHandler(HttpMessageConversionException.class)
public WmsApiBaseResponse parameterTypeException(HttpMessageConversionException ex) {
log.error("请求参数格式错误:{}", ex.getMessage());
String errorMessage = "请求参数格式错误,请参照接口文档";
return WmsResponseFactory.create(WmsApiResponseCodeEnum.FAIL.getCode(), errorMessage);
}
/**
* 捕获所有异常
* @param e 异常
* @return 返回值
*/
@ExceptionHandler(value = Exception.class)
public WmsApiBaseResponse handleException(Exception e) {
log.error("接口异常:{}", e.getMessage());
return WmsResponseFactory.create(WmsApiResponseCodeEnum.FAIL.getCode(), String.format("发生异常:%s", e.getMessage()));
}
}

View File

@ -0,0 +1,11 @@
package com.wcs_etag.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wcs_etag.model.po.AppConfig;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface AppConfigMapper extends BaseMapper<AppConfig> {
}

View File

@ -0,0 +1,9 @@
package com.wcs_etag.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wcs_etag.model.po.AppETagLocation;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface AppETagLocationMapper extends BaseMapper<AppETagLocation> {
}

View File

@ -0,0 +1,13 @@
package com.wcs_etag.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wcs_etag.model.po.AppETagTask;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface AppETagTaskMapper extends BaseMapper<AppETagTask> {
}

View File

@ -0,0 +1,20 @@
package com.wcs_etag.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wcs_etag.model.po.AppMenu;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface AppMenuMapper extends BaseMapper<AppMenu> {
/**
* 根据用户组和状态查询菜单
* @param groupId 用户组
* @param status 菜单状态
* @return 菜单列表
*/
List<AppMenu> selectMenuWithUserGroupAndStatus(@Param("groupId") String groupId, @Param("status") Integer status);
}

View File

@ -0,0 +1,11 @@
package com.wcs_etag.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wcs_etag.model.po.AppTcp;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface AppTcpMapper extends BaseMapper<AppTcp> {
}

View File

@ -0,0 +1,13 @@
package com.wcs_etag.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wcs_etag.model.po.AppUser;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface AppUserMapper extends BaseMapper<AppUser> {
}

View File

@ -0,0 +1,29 @@
package com.wcs_etag.mapper.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wcs_etag.mapper.AppConfigMapper;
import com.wcs_etag.mapper.intf.AppConfigService;
import com.wcs_etag.model.po.AppConfig;
import com.wcs_etag.utils.StringUtils;
import org.springframework.stereotype.Service;
@Service
public class AppConfigDaoImpl extends ServiceImpl<AppConfigMapper, AppConfig> implements AppConfigService {
/**
* 根据键值获取配置信息
* @param key
* @return 查到的值
*/
@Override
public AppConfig getConfigByKey(String key) {
if(StringUtils.isNullOrEmpty(key)){
return null;
}
try {
return baseMapper.selectById(key);
} catch (Exception e) {
return null;
}
}
}

View File

@ -0,0 +1,43 @@
package com.wcs_etag.mapper.impl;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wcs_etag.mapper.AppETagLocationMapper;
import com.wcs_etag.mapper.intf.AppETagLocationService;
import com.wcs_etag.model.po.AppETagLocation;
import com.wcs_etag.utils.Tuple2;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 电子标签货位表的操作
*/
@Service
public class AppETagLocationDaoImpl extends ServiceImpl<AppETagLocationMapper, AppETagLocation> implements AppETagLocationService {
/**
* 分页查询电子标签货位
* @param searchStr 模糊查询
* @param page 页码
* @param pageSize 每页尺寸
* @return 查询结果
*/
@Override
public Tuple2<List<AppETagLocation>, Integer> getETagLocationList(String searchStr, Integer page, Integer pageSize) {
try {
LambdaUpdateWrapper<AppETagLocation> wrapper = new LambdaUpdateWrapper<>();
wrapper.nested(!searchStr.isBlank(), n -> n.like(AppETagLocation::getLocation, searchStr)
.or().like(AppETagLocation::getTagName, searchStr)
.or().like(AppETagLocation::getArea, searchStr)
.or().like(AppETagLocation::getRemark, searchStr)
.or().like(AppETagLocation::getTaskId, searchStr));
wrapper.orderBy(true, false, AppETagLocation::getTagName);
Page<AppETagLocation> appETagTaskPage = baseMapper.selectPage(new Page<>(page, pageSize), wrapper);
return new Tuple2<>(appETagTaskPage.getRecords(), (int) appETagTaskPage.getTotal());
}catch (Exception e){
return new Tuple2<>(null, 0);
}
}
}

View File

@ -0,0 +1,171 @@
package com.wcs_etag.mapper.impl;
import com.baomidou.mybatisplus.core.batch.MybatisBatch;
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wcs_etag.mapper.AppETagTaskMapper;
import com.wcs_etag.mapper.intf.AppETagTaskService;
import com.wcs_etag.model.po.AppETagTask;
import com.wcs_etag.utils.Tuple2;
import lombok.RequiredArgsConstructor;
import org.apache.ibatis.executor.BatchResult;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.wcs_etag.utils.StringUtils;
import java.time.LocalDateTime;
import java.util.List;
@Service
@RequiredArgsConstructor
public class AppETagTaskDaoImpl extends ServiceImpl<AppETagTaskMapper, AppETagTask> implements AppETagTaskService {
private final SqlSessionFactory sqlSessionFactory;
/**
* 根据条件分页查询
* @param searchStr 筛选条件
* @param statusList 需要查询的状态列表
* @param typeList 需要查询的任务类型列表
* @param timeRange 时间范围创建时间
* @param page 当前页码
* @param pageSize 页码大小
* @return 查询结果
*/
@Override
public Tuple2<List<AppETagTask>, Integer> selectByParamsPage(String searchStr, List<Integer> statusList, List<Integer> typeList, List<LocalDateTime> timeRange, Integer page, Integer pageSize) {
try {
LambdaQueryWrapper<AppETagTask> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.nested(!StringUtils.isNullOrEmpty(searchStr), a -> a.like(AppETagTask::getTaskId, searchStr)
.or().like(AppETagTask::getGoodsName, searchStr)
.or().like(AppETagTask::getLocation, searchStr)
.or().like(AppETagTask::getVehicleNo, searchStr)
.or().like(AppETagTask::getTaskGroup, searchStr)
.or().like(AppETagTask::getRemark, searchStr)
.or().like(AppETagTask::getGoodsId, searchStr));
lambdaQueryWrapper.nested(statusList != null && !statusList.isEmpty(), a -> a.and(ad -> ad.in(AppETagTask::getTaskStatus, statusList)));
lambdaQueryWrapper.nested(typeList != null && !typeList.isEmpty(), a -> a.and(ad -> ad.in(AppETagTask::getTaskType, typeList)));
if(timeRange != null && timeRange.size() >= 2) {
lambdaQueryWrapper.and(a -> a.between(AppETagTask::getCreateTime, timeRange.get(0), timeRange.get(1)));
}
lambdaQueryWrapper.orderBy(true, false, AppETagTask::getCreateTime);
Page<AppETagTask> appETagTaskPage = baseMapper.selectPage(new Page<>(page, pageSize), lambdaQueryWrapper);
return new Tuple2<>(appETagTaskPage.getRecords(), (int) appETagTaskPage.getTotal());
} catch (Exception e) {
return new Tuple2<>(null, 0);
}
}
/**
* 更新任务状态
* @param taskId 任务ID
* @param taskStatus 任务状态
* @param remark 备注
* @return 更新结果
*/
@Override
public int updateTaskStatus(String taskId, Integer taskStatus, String remark) {
try{
return baseMapper.update(new LambdaUpdateWrapper<AppETagTask>()
.eq(AppETagTask::getTaskId, taskId)
.set(AppETagTask::getTaskStatus, taskStatus)
.set(AppETagTask::getRemark, remark));
}catch (Exception e) {
return 0;
}
}
/**
* 插入一条数据
* @param appETagTask 插入数据
* @return 插入结果
*/
@Override
public int insert(AppETagTask appETagTask) {
if(appETagTask != null) {
try {
return baseMapper.insert(appETagTask);
}catch (Exception e) {
return 0;
}
}
return 0;
}
/**
* 条件查询
* @param appETagTask 查询条件
* @return 查询结果
*/
@Override
public List<AppETagTask> select(AppETagTask appETagTask) {
try {
LambdaQueryWrapper<AppETagTask> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(!StringUtils.isNullOrEmpty(appETagTask.getTaskId()), AppETagTask::getTaskId, appETagTask.getTaskId())
.eq(!StringUtils.isNullOrEmpty(appETagTask.getTaskGroup()), AppETagTask::getTaskGroup, appETagTask.getTaskGroup())
.eq(appETagTask.getTaskType() != null, AppETagTask::getTaskType, appETagTask.getTaskType())
.eq(!StringUtils.isNullOrEmpty(appETagTask.getLocation()), AppETagTask::getLocation, appETagTask.getLocation())
.eq(!StringUtils.isNullOrEmpty(appETagTask.getAreaId()), AppETagTask::getAreaId, appETagTask.getAreaId())
.eq(!StringUtils.isNullOrEmpty(appETagTask.getVehicleNo()), AppETagTask::getVehicleNo, appETagTask.getVehicleNo())
.eq(!StringUtils.isNullOrEmpty(appETagTask.getGoodsId()), AppETagTask::getGoodsId, appETagTask.getGoodsId())
.eq(!StringUtils.isNullOrEmpty(appETagTask.getGoodsName()), AppETagTask::getGoodsName, appETagTask.getGoodsName())
.eq(appETagTask.getTaskStatus() != null, AppETagTask::getTaskStatus, appETagTask.getTaskStatus())
.eq(appETagTask.getShowNum() != null, AppETagTask::getShowNum, appETagTask.getShowNum())
.eq(appETagTask.getConfirmNum() != null, AppETagTask::getConfirmNum, appETagTask.getConfirmNum())
.eq(!StringUtils.isNullOrEmpty(appETagTask.getCreatePerson()), AppETagTask::getCreatePerson, appETagTask.getCreatePerson())
.eq(!StringUtils.isNullOrEmpty(appETagTask.getRemark()), AppETagTask::getRemark, appETagTask.getRemark());
return baseMapper.selectList(lambdaQueryWrapper);
} catch (Exception e) {
return null;
}
}
/**
* 批量插入注意事务需要外部捕获异常
* @param tasks 需要插入的数据
* @return 插入结果
*/
@Override
@Transactional
public int insert(List<AppETagTask> tasks) {
if(tasks != null && !tasks.isEmpty()) {
List<BatchResult> insertResult = baseMapper.insert(tasks);
return insertResult.size();
}
return 0;
}
/**
* 根据主键更新数据
* @param appETagTask 更新的数据
* @return 更新条目数
*/
@Override
public int update(AppETagTask appETagTask) {
try {
return baseMapper.update(new LambdaUpdateWrapper<AppETagTask>()
.eq(AppETagTask::getTaskId, appETagTask.getTaskId())
.set(!StringUtils.isNullOrEmpty(appETagTask.getTaskGroup()), AppETagTask::getTaskGroup, appETagTask.getTaskGroup())
.set(appETagTask.getTaskType() != null, AppETagTask::getTaskType, appETagTask.getTaskType())
.set(!StringUtils.isNullOrEmpty(appETagTask.getLocation()), AppETagTask::getLocation, appETagTask.getLocation())
.set(!StringUtils.isNullOrEmpty(appETagTask.getAreaId()), AppETagTask::getAreaId, appETagTask.getAreaId())
.set(!StringUtils.isNullOrEmpty(appETagTask.getVehicleNo()), AppETagTask::getVehicleNo, appETagTask.getVehicleNo())
.set(!StringUtils.isNullOrEmpty(appETagTask.getGoodsId()), AppETagTask::getGoodsId, appETagTask.getGoodsId())
.set(!StringUtils.isNullOrEmpty(appETagTask.getGoodsName()), AppETagTask::getGoodsName, appETagTask.getGoodsName())
.set(appETagTask.getTaskStatus() != null, AppETagTask::getTaskStatus, appETagTask.getTaskStatus())
.set(appETagTask.getShowNum() != null, AppETagTask::getShowNum, appETagTask.getShowNum())
.set(appETagTask.getConfirmNum() != null, AppETagTask::getConfirmNum, appETagTask.getConfirmNum())
.set(!StringUtils.isNullOrEmpty(appETagTask.getCreatePerson()), AppETagTask::getCreatePerson, appETagTask.getCreatePerson())
.set(appETagTask.getLightTime() != null, AppETagTask::getLightTime, appETagTask.getLightTime())
.set(appETagTask.getConfirmTime() != null, AppETagTask::getConfirmTime, appETagTask.getConfirmTime())
.set(appETagTask.getOffTime() != null, AppETagTask::getOffTime, appETagTask.getOffTime())
.set(!StringUtils.isNullOrEmpty(appETagTask.getRemark()), AppETagTask::getRemark, appETagTask.getRemark()));
} catch (Exception e) {
return 0;
}
}
}

View File

@ -0,0 +1,34 @@
package com.wcs_etag.mapper.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wcs_etag.mapper.AppMenuMapper;
import com.wcs_etag.mapper.intf.AppMenuService;
import com.wcs_etag.model.po.AppMenu;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* tbl_app_menu 表的操作
*/
@Service
public class AppMenuDaoImpl extends ServiceImpl<AppMenuMapper, AppMenu> implements AppMenuService {
/**
* 更具用户组和状态查询菜单
* @param groupId 用户组
* @param status 菜单状态
* @return 菜单列表
*/
public List<AppMenu> selectMenuWithUserGroupAndStatus(String groupId, Integer status) {
try {
return this.baseMapper.selectMenuWithUserGroupAndStatus(groupId, status);
}catch (Exception e){
return null;
}
}
}

View File

@ -0,0 +1,27 @@
package com.wcs_etag.mapper.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wcs_etag.mapper.AppTcpMapper;
import com.wcs_etag.mapper.intf.AppTcpService;
import com.wcs_etag.model.po.AppTcp;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class AppTcpDaoImpl extends ServiceImpl<AppTcpMapper, AppTcp> implements AppTcpService {
/**
* 查询所有
* @return 结果
*/
public List<AppTcp> select(){
try {
return baseMapper.selectList(null);
}catch (Exception e) {
return null;
}
}
}

View File

@ -0,0 +1,36 @@
package com.wcs_etag.mapper.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wcs_etag.mapper.AppUserMapper;
import com.wcs_etag.mapper.intf.AppUserService;
import com.wcs_etag.model.po.AppUser;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* tbl_app_user 表的操作
*/
@Service
public class AppUserDaoImpl extends ServiceImpl<AppUserMapper, AppUser> implements AppUserService {
/**
* 登陆验证用户账号密码
* @param userId 用户名
* @param password 密码
* @return 用户信息
*/
public AppUser selectUserByUserIdAndPassword(String userId, String password) {
try {
List<AppUser> appUsers = this.baseMapper.selectList(new LambdaQueryWrapper<AppUser>().eq(AppUser::getUserId, userId).eq(AppUser::getUserPassword, password));
return (appUsers != null && !appUsers.isEmpty()) ? appUsers.get(0) : null;
}catch (Exception e) {
return null;
}
}
}

View File

@ -0,0 +1,10 @@
package com.wcs_etag.mapper.intf;
import com.baomidou.mybatisplus.extension.service.IService;
import com.wcs_etag.model.po.AppConfig;
public interface AppConfigService extends IService<AppConfig> {
AppConfig getConfigByKey(String key);
}

View File

@ -0,0 +1,16 @@
package com.wcs_etag.mapper.intf;
import com.baomidou.mybatisplus.extension.service.IService;
import com.wcs_etag.model.po.AppETagLocation;
import com.wcs_etag.utils.Tuple2;
import java.time.LocalDateTime;
import java.util.List;
public interface AppETagLocationService extends IService<AppETagLocation> {
Tuple2<List<AppETagLocation>, Integer> getETagLocationList(String searchStr, Integer page, Integer pageSize);
}

View File

@ -0,0 +1,18 @@
package com.wcs_etag.mapper.intf;
import com.baomidou.mybatisplus.extension.service.IService;
import com.wcs_etag.model.po.AppETagTask;
import com.wcs_etag.utils.Tuple2;
import java.time.LocalDateTime;
import java.util.List;
public interface AppETagTaskService extends IService<AppETagTask> {
Tuple2<List<AppETagTask>, Integer> selectByParamsPage(String searchStr, List<Integer> statusList, List<Integer> typeList, List<LocalDateTime> timeRange, Integer page, Integer pageSize);
int updateTaskStatus(String taskId, Integer taskStatus, String msg);
int insert(AppETagTask appETagTask);
List<AppETagTask> select(AppETagTask appETagTask);
int insert(List<AppETagTask> appETagTask);
int update(AppETagTask appETagTask);
}

View File

@ -0,0 +1,7 @@
package com.wcs_etag.mapper.intf;
import com.baomidou.mybatisplus.extension.service.IService;
import com.wcs_etag.model.po.AppMenu;
public interface AppMenuService extends IService<AppMenu> {
}

View File

@ -0,0 +1,15 @@
package com.wcs_etag.mapper.intf;
import com.baomidou.mybatisplus.extension.service.IService;
import com.wcs_etag.model.po.AppTcp;
import java.util.List;
public interface AppTcpService extends IService<AppTcp> {
/**
* 查询所有数据
* @return 结果
*/
List<AppTcp> select();
}

View File

@ -0,0 +1,7 @@
package com.wcs_etag.mapper.intf;
import com.baomidou.mybatisplus.extension.service.IService;
import com.wcs_etag.model.po.AppUser;
public interface AppUserService extends IService<AppUser> {
}

View File

@ -0,0 +1,16 @@
package com.wcs_etag.model.dto.wcs.common;
import lombok.Data;
/**
* 用于各种请求的分页参数
*/
@Data
public class PageDto {
private Integer pageIndex;
private Integer pageSize;
private Integer totalRow;
}

View File

@ -0,0 +1,20 @@
package com.wcs_etag.model.dto.wcs.etagLocation;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.wcs_etag.model.dto.wcs.common.PageDto;
import lombok.Data;
@Data
public class GetETagLocationListPageRequest {
/**
* 模糊查询参数
*/
@JsonProperty(value = "searchStr")
private String searchStr;
/**
* 分页数据
*/
@JsonProperty(value = "page")
private PageDto page;
}

View File

@ -0,0 +1,43 @@
package com.wcs_etag.model.dto.wcs.etagTask;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.wcs_etag.model.dto.wcs.common.PageDto;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
@Data
public class GetETagTaskListPageRequest {
/**
* 模糊查询参数
*/
@JsonProperty(value = "searchStr")
private String searchStr;
/**
* 任务类型
*/
@JsonProperty(value = "eTagTaskType")
private List<Integer> eTagTaskType;
/**
* 任务状态
*/
@JsonProperty(value = "eTagTaskStatus")
private List<Integer> eTagTaskStatus;
/**
* 创建的时间
*/
@JsonProperty(value = "timeRange")
private List<LocalDateTime> timeRange;
/**
* 分页数据
*/
@JsonProperty(value = "page")
private PageDto page;
}

View File

@ -0,0 +1,71 @@
package com.wcs_etag.model.dto.wcs.etagTask;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
/**
* 添加电子标签任务的请求类
*/
@Data
public class InsertEtagTaskRequest {
/**
* 任务组
*/
@JsonProperty(value = "taskGroup")
private String taskGroup;
/**
* 任务号
*/
@JsonProperty(value = "taskId")
private String taskId;
/**
* 任务类型
*/
@JsonProperty(value = "taskType")
private Integer taskType;
/**
* 点位
*/
@JsonProperty(value = "location")
private String location;
/**
* 区域号
*/
@JsonProperty(value = "areaId")
private String areaId;
/**
* 载具号
*/
@JsonProperty(value = "vehicleNo")
private String vehicleNo;
/**
* 物料编号
*/
@JsonProperty(value = "goodsId")
private String goodsId;
/**
* 物料名称
*/
@JsonProperty(value = "goodsName")
private String goodsName;
/**
* 显示数量
*/
@JsonProperty(value = "showNum")
private Integer showNum;
/**
* 备注
*/
@JsonProperty(value = "remark")
private String remark;
}

View File

@ -0,0 +1,23 @@
package com.wcs_etag.model.dto.wcs.etagTask;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
/**
* Wcs 前端请求更新电子标签任务状态
*/
@Data
public class UpdateETagTaskStatusRequest {
/**
* 任务ID
*/
@JsonProperty(value = "taskId")
private String taskId;
/**
* 任务状态
*/
@JsonProperty(value = "taskStatus")
private Integer taskStatus;
}

View File

@ -0,0 +1,27 @@
package com.wcs_etag.model.dto.wcs.user;
import com.fasterxml.jackson.annotation.JsonProperty;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
/**
* 登陆接口请求数据
*/
@Data
public class LoginRequest {
/**
* 用户id
*/
@JsonProperty(value = "userId")
@NotBlank(message = "用户id不能为空")
private String userId;
/**
* 用户密码
*/
@JsonProperty(value = "userPassword")
@NotBlank(message = "用户密码不能为空")
private String userPassword;
}

View File

@ -0,0 +1,53 @@
package com.wcs_etag.model.dto.wms;
import com.fasterxml.jackson.annotation.JsonProperty;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;
import java.util.List;
/**
* 创建DPS任务的请求类
*/
@Data
public class GetDpsTaskRequest {
/**
* 任务组
*/
@NotBlank(message = "任务组不能为空")
@Size(max = 64, message = "任务组不能超过32个字符")
@JsonProperty("taskGroup")
private String taskGroup;
/**
* 任务类型
*/
@NotNull(message = "任务类型不能为空")
@JsonProperty("taskType")
private Integer taskType;
/**
* 载具号
*/
@NotBlank(message = "载具号不能为空")
@JsonProperty("vehicleNo")
private String vehicleNo;
/**
* 区域ID
*/
@NotBlank(message = "区域ID不能为空")
@JsonProperty("areaId")
private String areaId;
/**
* 任务详情
*/
@Valid
@JsonProperty("taskData")
private List<GetDpsTaskRequestData> taskData;
}

View File

@ -0,0 +1,36 @@
package com.wcs_etag.model.dto.wms;
import com.fasterxml.jackson.annotation.JsonProperty;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
/**
* 创建DPS任务的请求类的任务数据
*/
@Data
public class GetDpsTaskRequestData {
@NotBlank(message = "任务ID不能为空")
@JsonProperty("taskId")
private String taskId;
@NotBlank(message = "货位不能为空")
@JsonProperty("location")
private String location;
@JsonProperty("goodsId")
private String goodsId;
@JsonProperty("goodsName")
private String goodsName;
@NotNull(message = "显示数量不能为空")
@Min(value = 0, message = "显示数量不能小于0")
@JsonProperty("showNum")
private Integer showNum;
}

View File

@ -0,0 +1,54 @@
package com.wcs_etag.model.po;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
/**
* 系统配置表
*/
@Data
@TableName("tbl_app_config")
public class AppConfig {
/**
* 配置键
*/
@JsonProperty(value = "configKey")
@TableId(value = "config_key")
private String configKey;
/**
* 配置名称
*/
@JsonProperty(value = "configName")
@TableField(value = "config_name")
private String configName;
/**
* 配置值
*/
@JsonProperty(value = "configValue")
@TableField(value = "config_value")
private String configValue;
/**
* 配置类型
*/
@JsonProperty(value = "configType")
@TableField(value = "config_type")
private Integer configType;
/**
* 备注
*/
@JsonProperty(value = "remark")
@TableField(value = "remark")
private String remark;
}

View File

@ -0,0 +1,88 @@
package com.wcs_etag.model.po;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 电子标签货位表
*/
@Data
@TableName("tbl_app_etag_location")
public class AppETagLocation {
/**
* 标签名称
*/
@TableId(value = "tag_name")
@JsonProperty(value = "tagName")
private String tagName;
/**
* 标签绑定的货位必须按照格式输入否则有可能不识别
*/
@TableField(value = "location")
@JsonProperty(value = "location")
private String location;
/**
* 标签ID ID 在控制器下唯一不可重复
*/
@TableField(value = "tag_id")
@JsonProperty(value = "tagId")
private Integer tagId;
/**
* 标签类型
*/
@TableField(value = "tag_type")
@JsonProperty(value = "tagType")
private Integer tagType;
/**
* TcpId tcp 表对应表示标签挂载在哪一个控制器下
*/
@TableField(value = "tcp_id")
@JsonProperty(value = "tcpId")
private Integer tcpId;
/**
* 区域
*/
@TableField(value = "area")
@JsonProperty(value = "area")
private String area;
/**
* 状态指示是否点亮
*/
@TableField(value = "led_status")
@JsonProperty(value = "ledStatus")
private Integer ledStatus;
/**
* 最后点亮时间
*/
@TableField(value = "last_light_time")
@JsonProperty(value = "lastLightTime")
private LocalDateTime lastLightTime;
/**
* 任务ID绑定的任务
*/
@TableField(value = "task_id")
@JsonProperty(value = "taskId")
private String taskId;
/**
* 备注
*/
@TableField(value = "remark")
@JsonProperty(value = "remark")
private String remark;
}

View File

@ -0,0 +1,135 @@
package com.wcs_etag.model.po;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.time.LocalDateTime;
@Data
@TableName("tbl_app_etag_task")
public class AppETagTask {
/**
* 任务编号
*/
@JsonProperty(value = "taskId")
@TableId(value = "task_id")
private String taskId;
/**
* 任务组
*/
@JsonProperty(value = "taskGroup")
@TableField(value = "task_group")
private String taskGroup;
/**
* 任务类型
*/
@JsonProperty(value = "taskType")
@TableField(value = "task_type")
private Integer TaskType;
/**
* 标签位置
*/
@JsonProperty(value = "location")
@TableField(value = "location")
private String location;
/**
* 任务区域
*/
@JsonProperty(value = "areaId")
@TableField(value = "area_id")
private String areaId;
/**
* 载具编号
*/
@JsonProperty(value = "vehicleNo")
@TableField(value = "vehicle_no")
private String vehicleNo;
/**
* 货物编号
*/
@JsonProperty(value = "goodsId")
@TableField(value = "goods_id")
private String goodsId;
/**
* 货物名称
*/
@JsonProperty(value = "goodsName")
@TableField(value = "goods_name")
private String goodsName;
/**
* 任务状态
*/
@JsonProperty(value = "taskStatus")
@TableField(value = "task_status")
private Integer taskStatus;
/**
* 显示数字
*/
@JsonProperty(value = "showNum")
@TableField(value = "show_num")
private Integer showNum;
/**
* 确认数字
*/
@JsonProperty(value = "confirmNum")
@TableField(value = "confirm_num")
private Integer confirmNum;
/**
* 创建人
*/
@JsonProperty(value = "createPerson")
@TableField(value = "create_person")
private String createPerson;
/**
* 创建时间
*/
@JsonProperty(value = "createTime")
@TableField(value = "create_time")
private LocalDateTime createTime;
/**
* 灯亮时间
*/
@JsonProperty(value = "lightTime")
@TableField(value = "light_time")
private LocalDateTime lightTime;
/**
* 确认时间
*/
@JsonProperty(value = "confirmTime")
@TableField(value = "confirm_time")
private LocalDateTime confirmTime;
/**
* 灯灭时间
*/
@JsonProperty(value = "offTime")
@TableField(value = "off_time")
private LocalDateTime offTime;
/**
* 备注
*/
@JsonProperty(value = "remark")
@TableField(value = "remark")
private String remark;
}

View File

@ -0,0 +1,70 @@
package com.wcs_etag.model.po;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
/**
* 菜单表
*/
@Data
@TableName("tbl_app_menu")
public class AppMenu {
/**
* 主菜单索引
*/
@TableField(value = "main_menu_index")
private String mainMenuIndex;
/**
* 主菜单名称
*/
@TableField(value = "main_menu_name")
private String mainMenuName;
/**
* 主菜单图标
*/
@TableField(value = "main_menu_ico")
private String mainMenuIco;
/**
* 次级菜单索引
*/
@TableId(value = "minor_menu_index")
public String minorMenuIndex;
/**
* 次级菜单名称
*/
@TableField(value = "minor_menu_name")
public String minorMenuName;
/**
* 次级菜单图标
*/
@TableField(value = "minor_menu_ico")
public String minorMenuIco;
/**
* 次级菜单路由
*/
@TableField(value = "minor_menu_router")
public String minorMenuRouter;
/**
* 菜单状态
*/
@TableField(value = "menu_status")
public Integer menuStatus;
/**
* 备注
*/
@TableField(value = "remark")
public String remark;
}

View File

@ -0,0 +1,64 @@
package com.wcs_etag.model.po;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
@Data
@TableName("tbl_app_tcp")
public class AppTcp {
/**
* tcp 编号
*/
@TableId(value = "tcp_id")
@JsonProperty(value = "tcpId")
private Integer tcpId;
/**
* tcp ip地址
*/
@TableField(value = "tcp_ip")
@JsonProperty(value = "tcpIp")
private String tcpIp;
/**
* tcp 端口
*/
@TableField(value = "tcp_port")
@JsonProperty(value = "tcpPort")
private Integer tcpPort;
/**
* tcp 类型
*/
@TableField(value = "tcp_type")
@JsonProperty(value = "tcpType")
private Integer tcpType;
/**
* tcp 状态
*/
@TableField(value = "tcp_status")
@JsonProperty(value = "tcpStatus")
private Integer tcpStatus;
/**
* tcp 名称
*/
@TableField(value = "tcp_name")
@JsonProperty(value = "tcpName")
private String tcpName;
/**
* 备注
*/
@TableField(value = "remark")
@JsonProperty(value = "remark")
private String remark;
}

View File

@ -0,0 +1,65 @@
package com.wcs_etag.model.po;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 用户表
*/
@Data
@TableName("tbl_app_user")
public class AppUser {
public AppUser(String userId, String userPassword) {
this.userId = userId;
this.userPassword = userPassword;
}
/**
* 用户id
*/
@TableId(value = "user_id")
private String userId;
/**
* 用户名
*/
@TableField(value = "user_name")
private String userName;
/**
* 用户密码
*/
@TableField(value = "user_password")
private String userPassword;
/**
* 用户状态
*/
@TableField(value = "user_status")
private Integer userStatus;
/**
* 创建时间
*/
@TableField(value = "create_time")
private LocalDateTime createTime;
/**
* 修改时间
*/
@TableField(value = "modify_time")
private LocalDateTime modifyTime;
/**
* 用户组
*/
@TableField(value = "user_group")
private String userGroup;
}

View File

@ -0,0 +1,34 @@
package com.wcs_etag.model.vo.wcs.common;
import com.wcs_etag.constant.wcsEnum.WcsApiResponseCodeEnum;
import lombok.Getter;
import lombok.Setter;
/**
* 基本 Wcs 接口返回类
*/
@Getter
@Setter
public class WcsApiBaseResponse {
/**
* 状态码 ----详情参见枚举 WcsApiResponseCodeEnum
*/
private Integer code;
/**
* 信息
*/
private String message;
public WcsApiBaseResponse(Integer code, String message) {
this.code = code;
this.message = message;
}
public WcsApiBaseResponse(WcsApiResponseCodeEnum wcsApiResponseCodeEnum) {
this.code = wcsApiResponseCodeEnum.getCode();
this.message = wcsApiResponseCodeEnum.getMessage();
}
}

View File

@ -0,0 +1,34 @@
package com.wcs_etag.model.vo.wcs.common;
import com.wcs_etag.constant.wcsEnum.WcsApiResponseCodeEnum;
import lombok.Getter;
import lombok.Setter;
/**
* 带有返回值的 WcsApi 响应
* @param <T>
*/
@Getter
@Setter
public class WcsApiDataResponse<T> extends WcsApiBaseResponse{
/**
* 返回数据
*/
private T returnData;
public WcsApiDataResponse(Integer code, String message) {
super(code, message);
}
public WcsApiDataResponse(Integer code, String message, T returnData) {
super(code, message);
this.returnData = returnData;
}
public WcsApiDataResponse(WcsApiResponseCodeEnum wcsApiResponseCodeEnum, T returnData) {
super(wcsApiResponseCodeEnum);
this.returnData = returnData;
}
}

View File

@ -0,0 +1,27 @@
package com.wcs_etag.model.vo.wcs.common;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.wcs_etag.constant.wcsEnum.WcsApiResponseCodeEnum;
public class WcsApiTagDataResponse<Tag, T> extends WcsApiDataResponse<T>{
@JsonProperty(value = "tag")
private Tag tag;
public WcsApiTagDataResponse(Integer code, String message) {
super(code, message);
}
public WcsApiTagDataResponse(Integer code, String message, T returnData) {
super(code, message, returnData);
}
public WcsApiTagDataResponse(Integer code, String message, Tag tag, T returnData) {
super(code, message, returnData);
this.tag = tag;
}
public WcsApiTagDataResponse(WcsApiResponseCodeEnum wcsApiResponseCodeEnum, T returnData) {
super(wcsApiResponseCodeEnum, returnData);
}
}

View File

@ -0,0 +1,32 @@
package com.wcs_etag.model.vo.wcs.user;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.util.List;
/**
* 登陆的响应信息
*/
@Data
public class LoginResponse {
/**
* 用户名
*/
@JsonProperty(value = "userName")
private String userName;
/**
* token
*/
@JsonProperty(value = "token")
private String token;
/**
* 菜单
*/
@JsonProperty(value = "menu")
private List<MainMenuData> menu;
}

View File

@ -0,0 +1,38 @@
package com.wcs_etag.model.vo.wcs.user;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.util.List;
/**
* 主菜单
*/
@Data
public class MainMenuData {
/**
* 主菜单索引
*/
@JsonProperty(value = "index")
private String index;
/**
* 主菜单
*/
@JsonProperty(value = "mainMenu")
private String mainMenu;
/**
* 主菜单图标
*/
@JsonProperty(value = "ico")
private String ico;
/**
* 次级菜单
*/
@JsonProperty(value = "minor")
private List<MinorMenuData> minor;
}

View File

@ -0,0 +1,36 @@
package com.wcs_etag.model.vo.wcs.user;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
/**
* 次级菜单
*/
@Data
public class MinorMenuData {
/**
* 次级菜单索引
*/
@JsonProperty(value = "index")
private String index;
/**
* 次级菜单
*/
@JsonProperty(value = "minorMenu")
private String minorMenu;
/**
* 次级菜单图标
*/
@JsonProperty(value = "ico")
private String ico;
/**
* 次级菜单路由
*/
@JsonProperty(value = "router")
private String router;
}

View File

@ -0,0 +1,51 @@
package com.wcs_etag.model.vo.wms;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
/**
* 获取电子标签任务的响应类
*/
@Data
public class GetDpsTaskResponse {
/**
* 任务ID
*/
@JsonProperty("taskId")
private String taskId;
/**
* 任务状态
*/
@JsonProperty("taskStatus")
private Integer taskStatus;
/**
* 点亮时间
*/
@JsonProperty("lightTime")
private String lightTime;
/**
* 确认时间
*/
@JsonProperty("confirmTime")
private String confirmTime;
/**
* 熄灭时间
*/
@JsonProperty("offTime")
private String offTime;
/**
* 备注
*/
@JsonProperty("remark")
private String remark;
}

View File

@ -0,0 +1,21 @@
package com.wcs_etag.model.vo.wms.common;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class WmsApiBaseResponse {
/**
* 响应码
*/
@JsonProperty("code")
private Integer code;
/**
* 响应信息
*/
@JsonProperty("msg")
private String msg;
}

View File

@ -0,0 +1,20 @@
package com.wcs_etag.model.vo.wms.common;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.Setter;
/**
* wms 请求的基础返回类
* @param <T>
*/
@Getter
@Setter
public class WmsApiDataResponse<T> extends WmsApiBaseResponse {
/**
* 返回信息
*/
@JsonProperty("returnData")
private T returnData;
}

View File

@ -0,0 +1,35 @@
package com.wcs_etag.service.wcs.impl;
import com.wcs_etag.constant.wcsEnum.WcsApiResponseCodeEnum;
import com.wcs_etag.mapper.impl.AppETagLocationDaoImpl;
import com.wcs_etag.model.dto.wcs.etagLocation.GetETagLocationListPageRequest;
import com.wcs_etag.model.po.AppETagLocation;
import com.wcs_etag.model.vo.wcs.common.WcsApiTagDataResponse;
import com.wcs_etag.service.wcs.intf.IETagLocationControllerService;
import com.wcs_etag.utils.Tuple2;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
@RequiredArgsConstructor
public class ETagLocationControllerService implements IETagLocationControllerService {
private final AppETagLocationDaoImpl appETagLocationDao;
/**
* 查询电子标签货位列表
* @param request 请求参数
* @return 响应
*/
@Override
public WcsApiTagDataResponse<Integer, List<AppETagLocation>> getETagLocationListPage(GetETagLocationListPageRequest request) {
Tuple2<List<AppETagLocation>, Integer> eTagLocationList = appETagLocationDao.getETagLocationList(request.getSearchStr(), request.getPage().getPageIndex(), request.getPage().getPageSize());
if (eTagLocationList != null) {
return new WcsApiTagDataResponse<>(WcsApiResponseCodeEnum.SUCCESS.getCode(), "查询成功", eTagLocationList.getItem2(), eTagLocationList.getItem1());
}
return new WcsApiTagDataResponse<>(WcsApiResponseCodeEnum.FAIL.getCode(), "查询失败,请稍后再试");
}
}

View File

@ -0,0 +1,91 @@
package com.wcs_etag.service.wcs.impl;
import com.wcs_etag.constant.wcsEnum.WcsApiResponseCodeEnum;
import com.wcs_etag.constant.wcsEnum.tableEnum.ETagTaskStatusEnum;
import com.wcs_etag.mapper.intf.AppETagTaskService;
import com.wcs_etag.model.dto.wcs.etagTask.GetETagTaskListPageRequest;
import com.wcs_etag.model.dto.wcs.etagTask.InsertEtagTaskRequest;
import com.wcs_etag.model.dto.wcs.etagTask.UpdateETagTaskStatusRequest;
import com.wcs_etag.model.po.AppETagTask;
import com.wcs_etag.model.vo.wcs.common.WcsApiBaseResponse;
import com.wcs_etag.model.vo.wcs.common.WcsApiTagDataResponse;
import com.wcs_etag.service.wcs.intf.IETagTaskControllerService;
import com.wcs_etag.utils.Tuple2;
import com.wcs_etag.utils.UUID;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.List;
@Service
@RequiredArgsConstructor
public class ETagTaskControllerService implements IETagTaskControllerService {
private final AppETagTaskService appETagTaskService;
/**
* 分页查询电子标签任务信息
* @param request 查询条件
* @return 查询结果
*/
@Override
public WcsApiTagDataResponse<Integer, List<AppETagTask>> getETagTaskListPage(GetETagTaskListPageRequest request) {
Tuple2<List<AppETagTask>, Integer> queryResult = appETagTaskService.selectByParamsPage(request.getSearchStr(), request.getETagTaskStatus(), request.getETagTaskType(), request.getTimeRange(),
request.getPage().getPageIndex(), request.getPage().getPageSize());
if(queryResult.getItem1() != null) {
return new WcsApiTagDataResponse<>(WcsApiResponseCodeEnum.SUCCESS.getCode(), "查询成功", queryResult.getItem2(), queryResult.getItem1());
}
return new WcsApiTagDataResponse<>(WcsApiResponseCodeEnum.FAIL.getCode(), "查询失败", 0, null);
}
/**
* 更新电子标签任务状态
* @param request 更新条件
* @return 更新结果
*/
@Override
public WcsApiBaseResponse updateETagTaskStatus(UpdateETagTaskStatusRequest request) {
int updateResult = appETagTaskService.updateTaskStatus(request.getTaskId(), request.getTaskStatus(), "WCS 变更状态:" + ETagTaskStatusEnum.getDescByCode(request.getTaskStatus()));
if(updateResult > 0) {
return new WcsApiBaseResponse(WcsApiResponseCodeEnum.SUCCESS.getCode(), "更新成功");
}
return new WcsApiBaseResponse(WcsApiResponseCodeEnum.FAIL.getCode(), "更新失败,请稍后再试");
}
/**
* 添加一条电子标签任务
* @param request 添加信息
* @return 结果
*/
@Override
public WcsApiBaseResponse insertEtagTask(InsertEtagTaskRequest request) {
if(request.getVehicleNo().isBlank() || request.getLocation().isBlank()) {
return new WcsApiBaseResponse(WcsApiResponseCodeEnum.FAIL.getCode(), "载具号和货位号不能为空");
}
if(request.getTaskId().isBlank()){
request.setTaskId(UUID.getTimeUUid());
}
if(request.getTaskGroup().isBlank()){
request.setTaskGroup(UUID.getUUIDUpper());
}
AppETagTask newTask = new AppETagTask();
newTask.setTaskId(request.getTaskId());
newTask.setTaskGroup(request.getTaskGroup());
newTask.setTaskType(request.getTaskType());
newTask.setLocation(request.getLocation());
newTask.setAreaId(request.getAreaId());
newTask.setVehicleNo(request.getVehicleNo());
newTask.setGoodsId(request.getGoodsId());
newTask.setGoodsName(request.getGoodsName());
newTask.setTaskStatus(ETagTaskStatusEnum.NEED_LIGHT.getCode());
newTask.setShowNum(request.getShowNum());
newTask.setCreatePerson("WCS");
newTask.setCreateTime(LocalDateTime.now());
int insertResult = appETagTaskService.insert(newTask);
if(insertResult > 0) {
return new WcsApiBaseResponse(WcsApiResponseCodeEnum.SUCCESS.getCode(), "添加成功");
}
return new WcsApiBaseResponse(WcsApiResponseCodeEnum.FAIL.getCode(), "添加失败,请稍后再试");
}
}

View File

@ -0,0 +1,31 @@
package com.wcs_etag.service.wcs.impl;
import com.wcs_etag.mapper.intf.AppTcpService;
import com.wcs_etag.model.po.AppTcp;
import com.wcs_etag.model.vo.wcs.common.WcsApiDataResponse;
import com.wcs_etag.service.wcs.intf.ITcpControllerService;
import com.wcs_etag.constant.wcsEnum.WcsApiResponseCodeEnum;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
@RequiredArgsConstructor
public class TcpControllerService implements ITcpControllerService {
private final AppTcpService appTcpService;
/**
* 查询TCP列表
* @return TCP列表
*/
@Override
public WcsApiDataResponse<List<AppTcp>> getTcpList() {
List<AppTcp> tcpList = appTcpService.select();
if (tcpList == null) {
return new WcsApiDataResponse<>(WcsApiResponseCodeEnum.FAIL.getCode(), "查询失败,请重试");
}
return new WcsApiDataResponse<>(WcsApiResponseCodeEnum.SUCCESS.getCode(), "查询成功", tcpList);
}
}

View File

@ -0,0 +1,80 @@
package com.wcs_etag.service.wcs.impl;
import com.wcs_etag.mapper.impl.AppMenuDaoImpl;
import com.wcs_etag.mapper.impl.AppUserDaoImpl;
import com.wcs_etag.model.dto.wcs.user.LoginRequest;
import com.wcs_etag.model.po.AppMenu;
import com.wcs_etag.model.po.AppUser;
import com.wcs_etag.model.vo.wcs.common.WcsApiDataResponse;
import com.wcs_etag.model.vo.wcs.user.LoginResponse;
import com.wcs_etag.model.vo.wcs.user.MainMenuData;
import com.wcs_etag.model.vo.wcs.user.MinorMenuData;
import com.wcs_etag.service.wcs.intf.IUserControllerService;
import com.wcs_etag.utils.EncryptUtils;
import com.wcs_etag.constant.wcsEnum.WcsApiResponseCodeEnum;
import com.wcs_etag.constant.wcsEnum.commonEnum.OnOffEnum;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.*;
/**
* User 控制器的 Service 实现
*/
@Service
@RequiredArgsConstructor
public class UserControllerService implements IUserControllerService {
private final AppUserDaoImpl appUserDao;
private final AppMenuDaoImpl appMenuDao;
/**
* 登录
* @param loginRequest 登录请求
* @return 登录响应
*/
@Override
public WcsApiDataResponse<LoginResponse> login(LoginRequest loginRequest) {
String encryptPassword = EncryptUtils.encryptPassword(loginRequest.getUserPassword());
AppUser user = appUserDao.selectUserByUserIdAndPassword(loginRequest.getUserId(), encryptPassword);
if(user == null) {
return new WcsApiDataResponse<>(WcsApiResponseCodeEnum.FAIL.getCode(), "登录失败,账户不存在或者密码不正确");
}
/* 拉取用户菜单 */
List<AppMenu> appMenus = appMenuDao.selectMenuWithUserGroupAndStatus(user.getUserGroup(), OnOffEnum.ON.getCode());
if(appMenus == null) {
return new WcsApiDataResponse<>(WcsApiResponseCodeEnum.FAIL.getCode(), "登录失败,用户菜单查找失败,请重试");
}
/* 构建返回值 */
LoginResponse loginResponse = new LoginResponse();
loginResponse.setUserName(user.getUserName());
loginResponse.setToken(UUID.randomUUID().toString());
List<String> mainMenuIndexList = appMenus.stream().map(AppMenu::getMainMenuIndex).distinct().toList();
List<MainMenuData> mainMenuDataList = new ArrayList<>(); // 主菜单
for (String mainMenuIndex : mainMenuIndexList) {
List<AppMenu> minorMenuDataInfo = appMenus.stream().filter(appMenu -> appMenu.getMainMenuIndex().equals(mainMenuIndex)).toList();
if (minorMenuDataInfo.isEmpty()) {
continue;
}
AppMenu appMainMenu = minorMenuDataInfo.get(0);
MainMenuData mainMenuData = new MainMenuData();
mainMenuData.setIco(appMainMenu.getMainMenuIco());
mainMenuData.setIndex(appMainMenu.getMainMenuIndex());
mainMenuData.setMainMenu(appMainMenu.getMainMenuName());
List<MinorMenuData> minorMenuDataList = new ArrayList<>(); // 次级菜单
for (AppMenu minorMenuDataInfoItem : minorMenuDataInfo) {
MinorMenuData minorMenuData = new MinorMenuData();
minorMenuData.setIco(minorMenuDataInfoItem.getMinorMenuIco());
minorMenuData.setIndex(minorMenuDataInfoItem.getMinorMenuIndex());
minorMenuData.setMinorMenu(minorMenuDataInfoItem.getMinorMenuName());
minorMenuData.setRouter(minorMenuDataInfoItem.getMinorMenuRouter());
minorMenuDataList.add(minorMenuData);
}
mainMenuData.setMinor(minorMenuDataList);
mainMenuDataList.add(mainMenuData);
}
loginResponse.setMenu(mainMenuDataList);
return new WcsApiDataResponse<>(WcsApiResponseCodeEnum.SUCCESS.getCode(), "登录成功", loginResponse);
}
}

View File

@ -0,0 +1,12 @@
package com.wcs_etag.service.wcs.intf;
import com.wcs_etag.model.dto.wcs.etagLocation.GetETagLocationListPageRequest;
import com.wcs_etag.model.po.AppETagLocation;
import com.wcs_etag.model.vo.wcs.common.WcsApiTagDataResponse;
import java.util.List;
public interface IETagLocationControllerService {
WcsApiTagDataResponse<Integer, List<AppETagLocation>> getETagLocationListPage(GetETagLocationListPageRequest request);
}

View File

@ -0,0 +1,17 @@
package com.wcs_etag.service.wcs.intf;
import com.wcs_etag.model.dto.wcs.etagTask.GetETagTaskListPageRequest;
import com.wcs_etag.model.dto.wcs.etagTask.InsertEtagTaskRequest;
import com.wcs_etag.model.dto.wcs.etagTask.UpdateETagTaskStatusRequest;
import com.wcs_etag.model.po.AppETagTask;
import com.wcs_etag.model.vo.wcs.common.WcsApiBaseResponse;
import com.wcs_etag.model.vo.wcs.common.WcsApiTagDataResponse;
import java.util.List;
public interface IETagTaskControllerService {
WcsApiTagDataResponse<Integer, List<AppETagTask>> getETagTaskListPage(GetETagTaskListPageRequest request);
WcsApiBaseResponse updateETagTaskStatus(UpdateETagTaskStatusRequest request);
WcsApiBaseResponse insertEtagTask(InsertEtagTaskRequest request);
}

View File

@ -0,0 +1,11 @@
package com.wcs_etag.service.wcs.intf;
import com.wcs_etag.model.po.AppTcp;
import com.wcs_etag.model.vo.wcs.common.WcsApiDataResponse;
import java.util.List;
public interface ITcpControllerService {
WcsApiDataResponse<List<AppTcp>> getTcpList();
}

View File

@ -0,0 +1,18 @@
package com.wcs_etag.service.wcs.intf;
import com.wcs_etag.model.dto.wcs.user.LoginRequest;
import com.wcs_etag.model.vo.wcs.common.WcsApiDataResponse;
import com.wcs_etag.model.vo.wcs.user.LoginResponse;
/**
* UserController Service
*/
public interface IUserControllerService {
/**
* 登录
* @param loginRequest 登录请求
* @return 登陆结果
*/
WcsApiDataResponse<LoginResponse> login (LoginRequest loginRequest);
}

View File

@ -0,0 +1,157 @@
package com.wcs_etag.service.wms.impl;
import com.wcs_etag.constant.wmsEnum.WmsApiResponseCodeEnum;
import com.wcs_etag.mapper.intf.AppETagTaskService;
import com.wcs_etag.model.dto.wms.GetDpsTaskRequest;
import com.wcs_etag.model.dto.wms.GetDpsTaskRequestData;
import com.wcs_etag.model.po.AppETagTask;
import com.wcs_etag.model.vo.wms.GetDpsTaskResponse;
import com.wcs_etag.model.vo.wms.common.WmsApiBaseResponse;
import com.wcs_etag.model.vo.wms.common.WmsApiDataResponse;
import com.wcs_etag.service.wms.intf.WmsTaskControllerService;
import com.wcs_etag.utils.StringUtils;
import com.wcs_etag.utils.WmsResponseFactory;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import com.wcs_etag.constant.wcsEnum.tableEnum.ETagTaskStatusEnum;
import com.wcs_etag.constant.staticString;
import com.wcs_etag.utils.DateTimeUtils;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
/**
* Wms 控制类的 Service 实现
*/
@Service
@RequiredArgsConstructor
public class WmsTaskControllerImpl implements WmsTaskControllerService {
private final AppETagTaskService appETagTaskService;
/**
* 接收 上位系统发来的电子标签任务
* @param request 接收到的信息
* @return 结果
*/
@Override
public WmsApiBaseResponse dpsTask(GetDpsTaskRequest request) {
/* 检测是否有任务 */
if(request.getTaskData() == null || request.getTaskData().isEmpty()) {
return WmsResponseFactory.create(WmsApiResponseCodeEnum.FAIL.getCode(), "任务数据为空");
}
/* 校验任务组是否重复 */
AppETagTask checkTaskGroup = new AppETagTask();
checkTaskGroup.setTaskGroup(request.getTaskGroup());
List<AppETagTask> checkTaskGroupResult = appETagTaskService.select(checkTaskGroup);
if(checkTaskGroupResult == null) {
return WmsResponseFactory.create(WmsApiResponseCodeEnum.FAIL.getCode(), "任务组校验失败");
}
if(!checkTaskGroupResult.isEmpty()) {
return WmsResponseFactory.create(WmsApiResponseCodeEnum.FAIL.getCode(), "该任务组已经存在");
}
/* 校验任务号 */
for (GetDpsTaskRequestData taskDatum : request.getTaskData()) {
AppETagTask checkTaskId = new AppETagTask();
checkTaskId.setTaskId(taskDatum.getTaskId());
List<AppETagTask> checkTaskIdResult = appETagTaskService.select(checkTaskId);
if(checkTaskIdResult == null) {
return WmsResponseFactory.create(WmsApiResponseCodeEnum.FAIL.getCode(), "任务号校验失败");
}
if(!checkTaskIdResult.isEmpty()) {
return WmsResponseFactory.create(WmsApiResponseCodeEnum.FAIL.getCode(), String.format("任务号:%s 已经存在", taskDatum.getTaskId()));
}
}
/* 插入任务数据 */
List<AppETagTask> tasks = new ArrayList<>();
for (GetDpsTaskRequestData taskDatum : request.getTaskData()) {
AppETagTask appETagTask = new AppETagTask();
appETagTask.setTaskId(taskDatum.getTaskId());
appETagTask.setTaskGroup(request.getTaskGroup());
appETagTask.setTaskType(request.getTaskType());
appETagTask.setLocation(taskDatum.getLocation());
appETagTask.setAreaId(request.getAreaId());
appETagTask.setVehicleNo(request.getVehicleNo());
appETagTask.setGoodsId(taskDatum.getGoodsId());
appETagTask.setGoodsName(taskDatum.getGoodsName());
appETagTask.setTaskStatus(ETagTaskStatusEnum.NEED_LIGHT.getCode());
appETagTask.setShowNum(taskDatum.getShowNum());
appETagTask.setCreateTime(LocalDateTime.now());
appETagTask.setCreatePerson(staticString.WMS_API);
tasks.add(appETagTask);
}
try {
int insertResult = appETagTaskService.insert(tasks);
if(insertResult > 0) {
return WmsResponseFactory.create(WmsApiResponseCodeEnum.SUCCESS.getCode(), String.format("任务添加成功,共添加了 %d 条任务", insertResult));
}
return WmsResponseFactory.create(WmsApiResponseCodeEnum.FAIL.getCode(), "任务添加失败,请稍后再试");
}catch (Exception e) {
return WmsResponseFactory.create(WmsApiResponseCodeEnum.FAIL.getCode(), "任务添加失败,请检查服务器网络后再试或者联系我们");
}
}
/**
* 获取电子标签任务详情
* @param dpsTaskId 任务ID
* @return 查询结果
*/
@Override
public WmsApiDataResponse<GetDpsTaskResponse> getDpsTask(String dpsTaskId) {
if(StringUtils.isNullOrEmpty(dpsTaskId)) {
return WmsResponseFactory.create(WmsApiResponseCodeEnum.FAIL.getCode(), "任务ID为空", null);
}
AppETagTask queryTaskId = new AppETagTask();
queryTaskId.setTaskId(dpsTaskId);
List<AppETagTask> tasks = appETagTaskService.select(queryTaskId);
if(tasks == null) {
return WmsResponseFactory.create(WmsApiResponseCodeEnum.FAIL.getCode(), "数据拉取失败,请检查服务器网络后再试", null);
}
if(tasks.isEmpty()) {
return WmsResponseFactory.create(WmsApiResponseCodeEnum.FAIL.getCode(), String.format("任务号:%s 不存在任务信息", dpsTaskId), null);
}
AppETagTask eTagTask = tasks.get(0);
GetDpsTaskResponse response = new GetDpsTaskResponse();
response.setTaskId(eTagTask.getTaskId());
response.setTaskStatus(eTagTask.getTaskStatus());
response.setLightTime(DateTimeUtils.formatterDatetime(eTagTask.getLightTime()));
response.setConfirmTime(DateTimeUtils.formatterDatetime(eTagTask.getConfirmTime()));
response.setOffTime(DateTimeUtils.formatterDatetime(eTagTask.getOffTime()));
response.setRemark(eTagTask.getRemark());
return WmsResponseFactory.create(WmsApiResponseCodeEnum.SUCCESS.getCode(), "成功", response);
}
/**
* 取消电子标签任务
* @param dpsTaskId 任务ID
* @return 取消结果
*/
@Override
public WmsApiBaseResponse cancelTask(String dpsTaskId) {
if(StringUtils.isNullOrEmpty(dpsTaskId)) {
return WmsResponseFactory.create(WmsApiResponseCodeEnum.FAIL.getCode(), "任务ID为空");
}
AppETagTask queryTaskId = new AppETagTask();
queryTaskId.setTaskId(dpsTaskId);
List<AppETagTask> tasks = appETagTaskService.select(queryTaskId);
if(tasks == null) {
return WmsResponseFactory.create(WmsApiResponseCodeEnum.FAIL.getCode(), "数据拉取失败,请检查服务器网络后再试");
}
if(tasks.isEmpty()) {
return WmsResponseFactory.create(WmsApiResponseCodeEnum.FAIL.getCode(), String.format("任务号:%s 不存在任务信息", dpsTaskId));
}
/* 更新任务状态为取消 */
AppETagTask updateAppETagTask = new AppETagTask();
updateAppETagTask.setTaskId(dpsTaskId);
updateAppETagTask.setTaskStatus(ETagTaskStatusEnum.ERROR.getCode());
updateAppETagTask.setOffTime(LocalDateTime.now());
updateAppETagTask.setRemark(String.format("%s 取消任务", staticString.WMS_API));
int update = appETagTaskService.update(updateAppETagTask);
if(update > 0) {
return WmsResponseFactory.create(WmsApiResponseCodeEnum.SUCCESS.getCode(), "成功");
}
return WmsResponseFactory.create(WmsApiResponseCodeEnum.FAIL.getCode(), "取消任务失败,请检查服务器网络后再试");
}
}

View File

@ -0,0 +1,13 @@
package com.wcs_etag.service.wms.intf;
import com.wcs_etag.model.dto.wms.GetDpsTaskRequest;
import com.wcs_etag.model.vo.wms.GetDpsTaskResponse;
import com.wcs_etag.model.vo.wms.common.WmsApiBaseResponse;
import com.wcs_etag.model.vo.wms.common.WmsApiDataResponse;
public interface WmsTaskControllerService {
WmsApiBaseResponse dpsTask(GetDpsTaskRequest request);
WmsApiDataResponse<GetDpsTaskResponse> getDpsTask(String dpsTaskId);
WmsApiBaseResponse cancelTask(String dpsTaskId);
}

View File

@ -0,0 +1,24 @@
package com.wcs_etag.utils;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
public class DateTimeUtils {
public static LocalDateTime getCurrentDateTime() {
return LocalDateTime.now();
}
/**
* 格式化日期时间
* @param dateTime 时间
* @return 格式化后的时间
*/
public static String formatterDatetime(LocalDateTime dateTime) {
if(dateTime == null) {
return "";
}
return dateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
}
}

View File

@ -0,0 +1,36 @@
package com.wcs_etag.utils;
import org.apache.commons.codec.digest.DigestUtils;
/**
* 加密工具类
*/
public class EncryptUtils {
/**
* 加密密码
* @param password 密码
* @return 加密后结果
*/
public static String encryptPassword(String password) {
StringBuilder encryptResult = new StringBuilder(); // 加密结果
if(password == null || password.isEmpty()) {
return encryptResult.toString();
}
int i = 0;
while (encryptResult.toString().length() < 255) {
String md5Result = DigestUtils.md5Hex(password);
md5Result = md5Result.replaceAll("\\W", "").toUpperCase();
if(i % 2 == 0) {
encryptResult.append(md5Result.replaceAll("[0-9]]", ""));
} else {
encryptResult.append(md5Result.replaceAll("[a-zA-Z]]", ""));
}
password = md5Result;
i++;
}
return encryptResult.substring(0, 255);
}
}

View File

@ -0,0 +1,13 @@
package com.wcs_etag.utils;
public class StringUtils {
/**
* 判断一个字符串是不是 null 或者空字符串
* @param value 需要判断的字符串
* @return 返回结果
*/
public static boolean isNullOrEmpty(String value) {
return value == null || value.isEmpty();
}
}

View File

@ -0,0 +1,21 @@
package com.wcs_etag.utils;
import lombok.Data;
/**
* 两个的元组
* @param <T1>
* @param <T2>
*/
@Data
public class Tuple2<T1, T2> {
private T1 item1;
private T2 item2;
public Tuple2(T1 item1, T2 item2) {
this.item1 = item1;
this.item2 = item2;
}
}

View File

@ -0,0 +1,62 @@
package com.wcs_etag.utils;
import com.wcs_etag.constant.AppConfig;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
public class UUID {
/**
* 获取UUID普通格式 无连字符
* @return UUID
*/
public static String getUUID(){
return java.util.UUID.randomUUID().toString().replace("-", "");
}
/**
* 获取UUID普通格式 无连字符 纯大写
* @return UUID
*/
public static String getUUIDUpper(){
return java.util.UUID.randomUUID().toString().replace("-", "").toUpperCase();
}
/********************** 自定义生成唯一 ID **************************/
private static final Object idLock = new Object(); //
private static int id = 0; // id
private static String lastTimeUUid = ""; // 上一个时间ID
private static String lastTime = "";
/**
* 获取时间戳UUID
* @return UUID
*/
public static String getTimeUUid() {
synchronized (idLock) {
while(true) {
String time = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS"));
if(!time.equals(lastTime)){
lastTime = time;
id = 0;
}
String newTimeUUid = "WCS" + time + AppConfig.MACHINE_ID + String.format("%04d", id);
if(!newTimeUUid.equals(lastTimeUUid)) {
lastTimeUUid = newTimeUUid;
return newTimeUUid;
}
if(id < 9999) {
id++;
} else {
id = 0;
}
}
}
}
/****************************** END ***********************************/
}

View File

@ -0,0 +1,39 @@
package com.wcs_etag.utils;
import com.wcs_etag.model.vo.wms.common.WmsApiDataResponse;
import com.wcs_etag.model.vo.wms.common.WmsApiBaseResponse;
/**
* wms 响应信息工厂列
*/
public class WmsResponseFactory {
/**
* 新建一个基础返回信息类
* @param code 响应码
* @param msg 响应细腻些
* @return 返回信息
*/
public static WmsApiBaseResponse create(Integer code, String msg) {
WmsApiBaseResponse response = new WmsApiBaseResponse();
response.setCode(code);
response.setMsg(msg);
return response;
}
/**
* 新建一个带返回数据的返回信息类
* @param code 响应码
* @param msg 响应细腻些
* @param data 返回数据
* @return 返回信息
*/
public static <T> WmsApiDataResponse<T> create(Integer code, String msg, T data) {
WmsApiDataResponse<T> response = new WmsApiDataResponse<T>();
response.setCode(code);
response.setMsg(msg);
response.setReturnData(data);
return response;
}
}

View File

@ -0,0 +1,18 @@
spring:
application:
name: wcs_etag
# 数据库配置
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://192.168.234.128:3306/wcs_etag?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
username: developer
password: developer
# 启动的端口号
server:
port: 18980
servlet:
context-path: /api

View File

@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Configuration后面的status这个用于设置log4j2自身内部的信息输出可以不设置
当设置成trace时可以看到log4j2内部各种详细输出
-->
<!-- monitorIntervalLog4j能够自动检测修改配置 文件和重新配置本身,设置间隔秒数 -->
<configuration monitorInterval="5">
<!-- 日志级别以及优先级排序: OFF > FATAL > ERROR > WARN > INFO > DEBUG > TRACE > ALL -->
<!-- 变量配置 -->
<Properties>
<!--
格式化输出:
%d表示日期
%thread表示线程名
%-5level级别从左显示5个字符宽度
%msg日志消息%n是换行符
%logger{36} 表示 Logger 名字最长36个字符
-->
<property name="LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} %highlight{%-5level}[%thread] %style{%logger{36}}{cyan} : %msg%n" />
<!-- 定义日志存储的路径,不要配置相对路径 -->
<property name="FILE_PATH" value="log/${date:yyyy-MM-dd}" />
<property name="FILE_NAME" value="wcs_etag" />
</Properties>
<appenders>
<console name="Console" target="SYSTEM_OUT">
<!--输出日志的格式-->
<PatternLayout pattern="${LOG_PATTERN}" disableAnsi="false" noConsoleNoAnsi="false"/>
<!--控制台只输出level及其以上级别的信息onMatch其他的直接拒绝onMismatch-->
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
</console>
<!--
  这个会打印出所有的info及以下级别的信息每次大小超过size
  则这size大小的日志会自动存入按年份-月份建立的文件夹下面并进行压缩,作为存档
-->
<RollingFile name="RollingFileInfo" fileName="${FILE_PATH}/info.log" filePattern="${FILE_PATH}/${FILE_NAME}-INFO-%d{yyyy-MM-dd}_%i.log.gz">
<!--控制台只输出level及以上级别的信息onMatch其他的直接拒绝onMismatch-->
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
<PatternLayout pattern="${LOG_PATTERN}"/>
<Policies>
<!--interval属性用来指定多久滚动一次默认是1 hour-->
<TimeBasedTriggeringPolicy interval="1"/>
<SizeBasedTriggeringPolicy size="100MB"/>
</Policies>
<!-- DefaultRolloverStrategy属性如不设置则默认为最多同一文件夹下7个文件开始覆盖 -->
<DefaultRolloverStrategy max="15"/>
</RollingFile>
<RollingFile name="RollingFileError" fileName="${FILE_PATH}/error.log" filePattern="${FILE_PATH}/${FILE_NAME}-ERROR-%d{yyyy-MM-dd}_%i.log.gz">
<ThresholdFilter level="error" onMatch="ACCEPT" onMismatch="DENY"/>
<PatternLayout pattern="${LOG_PATTERN}"/>
<Policies>
<!--interval属性用来指定多久滚动一次默认是1 hour-->
<TimeBasedTriggeringPolicy interval="1"/>
<SizeBasedTriggeringPolicy size="100MB"/>
</Policies>
<!-- DefaultRolloverStrategy属性如不设置则默认为最多同一文件夹下7个文件开始覆盖 -->
<DefaultRolloverStrategy max="15"/>
</RollingFile>
作者:小阿杰
链接https://juejin.cn/post/6972538940855173151
来源:稀土掘金
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
</appenders>
<!--Logger节点用来单独指定日志的形式比如要为指定包下的class指定不同的日志级别等。-->
<!--然后定义loggers只有定义了logger并引入的appenderappender才会生效-->
<loggers>
<!--过滤掉spring和mybatis的一些无用的DEBUG信息-->
<logger name="org.mybatis" level="info" additivity="false">
<AppenderRef ref="Console"/>
</logger>
<!--监控系统信息-->
<!--若是additivity设为false则 子Logger 只会在自己的appender里输出而不会在 父Logger 的appender里输出。-->
<Logger name="org.springframework" level="info" additivity="false">
<AppenderRef ref="Console"/>
</Logger>
<root level="info">
<appender-ref ref="Console"/>
<appender-ref ref="RollingFileInfo"/>
<appender-ref ref="RollingFileWarn"/>
<appender-ref ref="RollingFileError"/>
</root>
</loggers>
</configuration>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.wcs_etag.mapper.AppConfigMapper">
</mapper>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.wcs_etag.mapper.AppETagLocationMapper">
</mapper>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.wcs_etag.mapper.AppETagTaskMapper">
</mapper>

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.wcs_etag.mapper.AppMenuMapper">
<resultMap id="AppMenuMap" type="com.wcs_etag.model.po.AppMenu">
<result column="main_menu_ico" property="mainMenuIco"/>
<result column="main_menu_index" property="mainMenuIndex"/>
<result column="main_menu_name" property="mainMenuName"/>
<result column="menu_status" property="menuStatus"/>
<result column="minor_menu_ico" property="minorMenuIco"/>
<result column="minor_menu_index" property="minorMenuIndex"/>
<result column="minor_menu_name" property="minorMenuName"/>
<result column="minor_menu_router" property="minorMenuRouter"/>
<result column="remark" property="remark"/>
</resultMap>
<sql id="Base_Column_List">
main_menu_ico, main_menu_index, main_menu_name, menu_status, minor_menu_ico, minor_menu_index, minor_menu_name, minor_menu_router, remark
</sql>
<select id="selectMenuWithUserGroupAndStatus" resultType="com.wcs_etag.model.po.AppMenu">
select
<include refid="Base_Column_List"/>
from tbl_app_menu where menu_status = #{status}
and minor_menu_index in (select minor_menu_index from tbl_app_user_rule where group_id = #{groupId})
order by minor_menu_index asc
</select>
</mapper>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.wcs_etag.mapper.AppTcpMapper">
</mapper>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.wcs_etag.mapper.AppUserMapper">
</mapper>

View File

@ -0,0 +1,13 @@
package com.wcs_etag;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class WcsEtagApplicationTests {
@Test
void contextLoads() {
}
}

23
wcs_web/.gitignore vendored Normal file
View File

@ -0,0 +1,23 @@
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

19
wcs_web/README.md Normal file
View File

@ -0,0 +1,19 @@
# wcs_web
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).

5
wcs_web/babel.config.js Normal file
View File

@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}

Some files were not shown because too many files have changed in this diff Show More