Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
E
erp-service
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ximai
erp-service
Commits
fa4ec878
Commit
fa4ec878
authored
Oct 12, 2025
by
chicheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
成品入库功能添加
parent
48e86735
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
880 additions
and
633 deletions
+880
-633
.gitignore
.gitignore
+28
-25
CorsConfig.java
...topsunit/scanservice/ximai/barcode/common/CorsConfig.java
+46
-0
application-dev.yml
barcode-system/target/classes/application-dev.yml
+82
-82
application.yml
barcode-system/target/classes/application.yml
+4
-4
pom.xml
common/pom.xml
+115
-108
MoctfController.java
...opsunit/scanservice/ximai/controller/MoctfController.java
+32
-33
ExAccountInfoDto.java
.../com/topsunit/scanservice/ximai/dto/ExAccountInfoDto.java
+38
-35
MoctfCreateParams.java
...com/topsunit/scanservice/ximai/dto/MoctfCreateParams.java
+76
-73
MoctfCreateParams2.java
...om/topsunit/scanservice/ximai/dto/MoctfCreateParams2.java
+36
-33
MoctgCreateParams.java
...com/topsunit/scanservice/ximai/dto/MoctgCreateParams.java
+73
-73
StorageDetailParams.java
...m/topsunit/scanservice/ximai/dto/StorageDetailParams.java
+29
-0
ExAccountInfo.java
.../com/topsunit/scanservice/ximai/entity/ExAccountInfo.java
+53
-49
MoctfService.java
.../com/topsunit/scanservice/ximai/service/MoctfService.java
+180
-118
MesStorageDetailRecordService.java
...anservice/ximai/webapi/MesStorageDetailRecordService.java
+30
-0
StorageDetailRecordCreate.java
...anservice/ximai/webapi/dto/StorageDetailRecordCreate.java
+33
-0
StorageDetailRecordResult.java
...anservice/ximai/webapi/dto/StorageDetailRecordResult.java
+25
-0
No files found.
.gitignore
View file @
fa4ec878
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
/target/
/.idea/
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
/target/
/.idea/
/barcode-system/target/
/barcode-system/target/
/erp-system/target/
barcode-system/src/main/java/com/topsunit/scanservice/ximai/barcode/common/CorsConfig.java
0 → 100644
View file @
fa4ec878
package
com
.
topsunit
.
scanservice
.
ximai
.
barcode
.
common
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.cors.CorsConfiguration
;
import
org.springframework.web.cors.UrlBasedCorsConfigurationSource
;
import
org.springframework.web.filter.CorsFilter
;
/**
* <p>Title: CorsConfig</p>
* <p>Description: 跨域配置</p>
*
* @author system
* @version V1.0
* @date 2025/10/12
*/
@Configuration
public
class
CorsConfig
{
@Bean
public
CorsFilter
corsFilter
()
{
CorsConfiguration
config
=
new
CorsConfiguration
();
// 允许所有域名进行跨域调用
config
.
addAllowedOriginPattern
(
"*"
);
// 允许所有请求头
config
.
addAllowedHeader
(
"*"
);
// 允许所有请求方法
config
.
addAllowedMethod
(
"*"
);
// 允许发送Cookie
config
.
setAllowCredentials
(
true
);
// 预检请求的有效期,单位为秒
config
.
setMaxAge
(
3600L
);
UrlBasedCorsConfigurationSource
source
=
new
UrlBasedCorsConfigurationSource
();
// 对所有接口都应用跨域配置
source
.
registerCorsConfiguration
(
"/**"
,
config
);
return
new
CorsFilter
(
source
);
}
}
barcode-system/target/classes/application-dev.yml
View file @
fa4ec878
topsunit
:
token-expires-hour
:
8760
token-secret
:
q8w3Cx9Lr4fT2y6uV5sZ8aE1mN0kP7gH
authentication-enabled
:
false
print-api-url
:
http://127.0.0.1:8085/ximaiprintservice/print/PrintLabelByBarTender
share-url
:
smb://127.0.0.1/share
mes-url
:
http://localhost:8088
default-password
:
123456
db-name
:
BARCODE_SYSTEM_B
server
:
port
:
20092
servlet
:
context-path
:
/
logging
:
level
:
root
:
warn
com
:
topsunit
:
scanservice
:
ximai
:
barcodeb
:
controller
:
debug
com.topsunit
:
info
druid
:
sql
:
Statement
:
debug
spring
:
messages
:
# 国际化资源文件路径
basename
:
i18n/messages
devtools
:
restart
:
enabled
:
false
datasource
:
name
:
BARCODE_SYSTEM
username
:
sa
password
:
123qweQWE
url
:
jdbc:sqlserver://localhost:1433;DatabaseName=OVF
type
:
com.alibaba.druid.pool.DruidDataSource
druid
:
filters
:
stat
max-active
:
20
initial-size
:
1
max-wait
:
60000
min-idle
:
1
time-between-eviction-runs-millis
:
60000
min-evictable-idle-time-millis
:
30000
validation-query
:
select 'x'
test-while-idle
:
true
test-on-borrow
:
false
test-on-return
:
false
pool-prepared-statements
:
true
max-open-prepared-statements
:
20
filter
:
slf4j
:
enabled
:
true
statement-log-enabled
:
true
statement-create-after-log-enabled
:
false
statement-close-after-log-enabled
:
false
statement-executable-sql-log-enable
:
true
statement-prepare-after-log-enabled
:
false
statement-parameter-set-log-enabled
:
false
statement-execute-after-log-enabled
:
false
statement-execute-query-after-log-enabled
:
false
statement-execute-update-after-log-enabled
:
false
statement-execute-batch-after-log-enabled
:
false
statement-sql-pretty-format
:
false
driver-class-name
:
com.microsoft.sqlserver.jdbc.SQLServerDriver
jackson
:
serialization
:
indent-output
:
true
jpa
:
hibernate
:
ddl-auto
:
none
naming
:
physical-strategy
:
com.topsunit.scanservice.ximai.common.PhysicalNamingStrategyUpperCaseImpl
show-sql
:
true
application
:
name
:
barcode-system
topsunit
:
token-expires-hour
:
8760
token-secret
:
q8w3Cx9Lr4fT2y6uV5sZ8aE1mN0kP7gH
authentication-enabled
:
false
print-api-url
:
http://127.0.0.1:8085/ximaiprintservice/print/PrintLabelByBarTender
share-url
:
smb://127.0.0.1/share
mes-url
:
http://localhost:8088
default-password
:
123456
db-name
:
BARCODE_SYSTEM_B
server
:
port
:
20092
servlet
:
context-path
:
/
logging
:
level
:
root
:
warn
com
:
topsunit
:
scanservice
:
ximai
:
barcodeb
:
controller
:
debug
com.topsunit
:
info
druid
:
sql
:
Statement
:
debug
spring
:
messages
:
# 国际化资源文件路径
basename
:
i18n/messages
devtools
:
restart
:
enabled
:
false
datasource
:
name
:
BARCODE_SYSTEM
username
:
sa
password
:
123qweQWE
url
:
jdbc:sqlserver://localhost:1433;DatabaseName=OVF
type
:
com.alibaba.druid.pool.DruidDataSource
druid
:
filters
:
stat
max-active
:
20
initial-size
:
1
max-wait
:
60000
min-idle
:
1
time-between-eviction-runs-millis
:
60000
min-evictable-idle-time-millis
:
30000
validation-query
:
select 'x'
test-while-idle
:
true
test-on-borrow
:
false
test-on-return
:
false
pool-prepared-statements
:
true
max-open-prepared-statements
:
20
filter
:
slf4j
:
enabled
:
true
statement-log-enabled
:
true
statement-create-after-log-enabled
:
false
statement-close-after-log-enabled
:
false
statement-executable-sql-log-enable
:
true
statement-prepare-after-log-enabled
:
false
statement-parameter-set-log-enabled
:
false
statement-execute-after-log-enabled
:
false
statement-execute-query-after-log-enabled
:
false
statement-execute-update-after-log-enabled
:
false
statement-execute-batch-after-log-enabled
:
false
statement-sql-pretty-format
:
false
driver-class-name
:
com.microsoft.sqlserver.jdbc.SQLServerDriver
jackson
:
serialization
:
indent-output
:
true
jpa
:
hibernate
:
ddl-auto
:
none
naming
:
physical-strategy
:
com.topsunit.scanservice.ximai.common.PhysicalNamingStrategyUpperCaseImpl
show-sql
:
true
application
:
name
:
barcode-system
barcode-system/target/classes/application.yml
View file @
fa4ec878
spring
:
profiles
:
active
:
-
dev
spring
:
profiles
:
active
:
-
dev
common/pom.xml
View file @
fa4ec878
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
com.topsunit.scanservice.ximai
</groupId>
<artifactId>
ximaiscanservice-parent
</artifactId>
<version>
4.0.0.1
</version>
</parent>
<artifactId>
ximaiscanservice-common
</artifactId>
<description>
希迈条码系统服务公共依赖模块
</description>
<packaging>
jar
</packaging>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-data-jpa
</artifactId>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
druid-spring-boot-starter
</artifactId>
</dependency>
<dependency>
<groupId>
com.microsoft.sqlserver
</groupId>
<artifactId>
mssql-jdbc
</artifactId>
</dependency>
<dependency>
<groupId>
org.mapstruct
</groupId>
<artifactId>
mapstruct
</artifactId>
</dependency>
<dependency>
<groupId>
org.mapstruct
</groupId>
<artifactId>
mapstruct-processor
</artifactId>
</dependency>
<dependency>
<groupId>
com.auth0
</groupId>
<artifactId>
java-jwt
</artifactId>
</dependency>
<dependency>
<groupId>
commons-collections
</groupId>
<artifactId>
commons-collections
</artifactId>
</dependency>
<dependency>
<groupId>
commons-lang
</groupId>
<artifactId>
commons-lang
</artifactId>
</dependency>
<dependency>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
</dependency>
<dependency>
<groupId>
cn.hutool
</groupId>
<artifactId>
hutool-all
</artifactId>
</dependency>
<dependency>
<groupId>
org.samba.jcifs
</groupId>
<artifactId>
jcifs
</artifactId>
<version>
1.3.3
</version>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-openfeign
</artifactId>
<version>
${openfeign.version}
</version>
</dependency>
<dependency>
<groupId>
io.jsonwebtoken
</groupId>
<artifactId>
jjwt
</artifactId>
<version>
${jwt.version}
</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-compiler-plugin
</artifactId>
<version>
3.8.1
</version>
<configuration>
<source>
8
</source>
<target>
8
</target>
<annotationProcessorPaths>
<path>
<groupId>
org.mapstruct
</groupId>
<artifactId>
mapstruct-processor
</artifactId>
<version>
${org.mapstruct.version}
</version>
</path>
<path>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
<version>
${lombok}
</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>
</project>
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
com.topsunit.scanservice.ximai
</groupId>
<artifactId>
ximaiscanservice-parent
</artifactId>
<version>
4.0.0.1
</version>
</parent>
<artifactId>
ximaiscanservice-common
</artifactId>
<description>
希迈条码系统服务公共依赖模块
</description>
<packaging>
jar
</packaging>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-data-jpa
</artifactId>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
druid-spring-boot-starter
</artifactId>
</dependency>
<dependency>
<groupId>
com.microsoft.sqlserver
</groupId>
<artifactId>
mssql-jdbc
</artifactId>
</dependency>
<dependency>
<groupId>
org.mapstruct
</groupId>
<artifactId>
mapstruct
</artifactId>
</dependency>
<dependency>
<groupId>
org.mapstruct
</groupId>
<artifactId>
mapstruct-processor
</artifactId>
</dependency>
<dependency>
<groupId>
com.auth0
</groupId>
<artifactId>
java-jwt
</artifactId>
</dependency>
<dependency>
<groupId>
commons-collections
</groupId>
<artifactId>
commons-collections
</artifactId>
</dependency>
<dependency>
<groupId>
commons-lang
</groupId>
<artifactId>
commons-lang
</artifactId>
</dependency>
<dependency>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
</dependency>
<dependency>
<groupId>
cn.hutool
</groupId>
<artifactId>
hutool-all
</artifactId>
</dependency>
<dependency>
<groupId>
org.samba.jcifs
</groupId>
<artifactId>
jcifs
</artifactId>
<version>
1.3.3
</version>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-openfeign
</artifactId>
<version>
${openfeign.version}
</version>
</dependency>
<dependency>
<groupId>
io.jsonwebtoken
</groupId>
<artifactId>
jjwt
</artifactId>
<version>
${jwt.version}
</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-compiler-plugin
</artifactId>
<version>
3.8.1
</version>
<configuration>
<source>
8
</source>
<target>
8
</target>
<annotationProcessorPaths>
<path>
<groupId>
org.mapstruct
</groupId>
<artifactId>
mapstruct-processor
</artifactId>
<version>
${org.mapstruct.version}
</version>
</path>
<path>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
<version>
${lombok}
</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
<configuration>
<skip>
true
</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>
erp-system/src/main/java/com/topsunit/scanservice/ximai/controller/MoctfController.java
View file @
fa4ec878
package
com
.
topsunit
.
scanservice
.
ximai
.
controller
;
import
com.topsunit.scanservice.ximai.dto.*
;
import
com.topsunit.scanservice.ximai.service.MoctcService
;
import
com.topsunit.scanservice.ximai.service.MoctfService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Optional
;
/**
* 完工入库申请
*/
@RestController
public
class
MoctfController
{
@Autowired
private
MoctfService
moctfService
;
@PostMapping
(
"/moctf/create"
)
public
void
create
(
@RequestBody
MoctfCreateParams
createParams
)
{
moctfService
.
create
(
createParams
);
}
@PostMapping
(
"/moctf/createByErp"
)
public
void
createByErp
(
@RequestBody
MoctfCreateParams2
createParams
)
{
moctfService
.
create2
(
createParams
);
}
}
package
com
.
topsunit
.
scanservice
.
ximai
.
controller
;
import
com.topsunit.scanservice.ximai.dto.*
;
import
com.topsunit.scanservice.ximai.service.MoctcService
;
import
com.topsunit.scanservice.ximai.service.MoctfService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Optional
;
/**
* 完工入库申请
*/
@RestController
public
class
MoctfController
{
@Autowired
private
MoctfService
moctfService
;
@PostMapping
(
"/moctf/create"
)
public
void
create
(
@RequestBody
MoctfCreateParams
createParams
)
{
moctfService
.
create
(
createParams
);
}
@PostMapping
(
"/moctf/createByErp"
)
public
void
createByErp
(
@RequestBody
MoctfCreateParams2
createParams
)
{
moctfService
.
create2
(
createParams
);
}
}
erp-system/src/main/java/com/topsunit/scanservice/ximai/dto/ExAccountInfoDto.java
View file @
fa4ec878
package
com
.
topsunit
.
scanservice
.
ximai
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
/**
* <p>Title: EX_ACCOUNT_INFO</p>
* <p>Description: 套账表</p>
*
* @author chicheng.li
* @version V1.0
* @date 2025/1/9
*/
@Data
public
class
ExAccountInfoDto
{
@Id
String
id
;
@ApiModelProperty
(
"套账名称"
)
String
accountName
;
@ApiModelProperty
(
"接口地睛"
)
String
apiUrl
;
@ApiModelProperty
(
"MES接口地址"
)
String
mesUrl
;
@ApiModelProperty
(
"开启"
)
String
enable
;
}
package
com
.
topsunit
.
scanservice
.
ximai
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
/**
* <p>Title: EX_ACCOUNT_INFO</p>
* <p>Description: 套账表</p>
*
* @author chicheng.li
* @version V1.0
* @date 2025/1/9
*/
@Data
public
class
ExAccountInfoDto
{
@Id
String
id
;
@ApiModelProperty
(
"套账名称"
)
String
accountName
;
@ApiModelProperty
(
"接口地睛"
)
String
apiUrl
;
@ApiModelProperty
(
"MES接口地址"
)
String
mesUrl
;
@ApiModelProperty
(
"条码系统地址"
)
String
barcodeUrl
;
@ApiModelProperty
(
"开启"
)
String
enable
;
}
erp-system/src/main/java/com/topsunit/scanservice/ximai/dto/MoctfCreateParams.java
View file @
fa4ec878
package
com
.
topsunit
.
scanservice
.
ximai
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.persistence.Id
;
import
java.math.BigDecimal
;
import
java.util.List
;
/**
* <p>Title: MoctfCreateParams</p>
* <p>Description: 完工入库申请表头</p>
*
* @author chicheng.li
* @version V1.0
* @date 2024/10/22
*/
@Data
public
class
MoctfCreateParams
{
@ApiModelProperty
(
"入库单别"
)
private
String
tf001
=
"5801"
;
/**
* S+yyMMddxxxx
*/
@ApiModelProperty
(
"入库单号"
)
private
String
tf002
;
/**
* 入库日期
*/
@ApiModelProperty
(
"入库日期"
)
private
String
tf003
;
@ApiModelProperty
(
"工厂编号"
)
private
String
tf004
=
"01"
;
@ApiModelProperty
(
"备注"
)
private
String
tf005
;
@ApiModelProperty
(
"审核码"
)
private
String
tf006
=
"N"
;
@ApiModelProperty
(
"生产记录更新码"
)
private
String
tf007
=
"N"
;
@ApiModelProperty
(
"生成分录-成本"
)
private
String
tf010
=
"N"
;
@ApiModelProperty
(
"签核状态码"
)
private
String
tf014
=
"N"
;
@ApiModelProperty
(
"自动扣料更新码"
)
private
String
tf009
=
"N"
;
@ApiModelProperty
(
"工作中心"
)
private
String
tf011
=
"0001"
;
/**
* 单据日期
*/
@ApiModelProperty
(
"单据日期"
)
private
String
tf012
;
@ApiModelProperty
(
"部门"
)
private
String
tf016
=
"04"
;
@ApiModelProperty
(
"项目编号"
)
private
String
tf033
;
@ApiModelProperty
(
"明细"
)
private
List
<
MoctgCreateParams
>
details
;
}
package
com
.
topsunit
.
scanservice
.
ximai
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.persistence.Id
;
import
java.math.BigDecimal
;
import
java.util.List
;
/**
* <p>Title: MoctfCreateParams</p>
* <p>Description: 完工入库申请表头</p>
*
* @author chicheng.li
* @version V1.0
* @date 2024/10/22
*/
@Data
public
class
MoctfCreateParams
{
@ApiModelProperty
(
"入库单别"
)
private
String
tf001
=
"5801"
;
/**
* S+yyMMddxxxx
*/
@ApiModelProperty
(
"入库单号"
)
private
String
tf002
;
/**
* 入库日期
*/
@ApiModelProperty
(
"入库日期"
)
private
String
tf003
;
@ApiModelProperty
(
"工厂编号"
)
private
String
tf004
=
"01"
;
@ApiModelProperty
(
"备注"
)
private
String
tf005
;
@ApiModelProperty
(
"审核码"
)
private
String
tf006
=
"N"
;
@ApiModelProperty
(
"生产记录更新码"
)
private
String
tf007
=
"N"
;
@ApiModelProperty
(
"生成分录-成本"
)
private
String
tf010
=
"N"
;
@ApiModelProperty
(
"签核状态码"
)
private
String
tf014
=
"N"
;
@ApiModelProperty
(
"自动扣料更新码"
)
private
String
tf009
=
"N"
;
@ApiModelProperty
(
"工作中心"
)
private
String
tf011
=
"0001"
;
/**
* 单据日期
*/
@ApiModelProperty
(
"单据日期"
)
private
String
tf012
;
@ApiModelProperty
(
"部门"
)
private
String
tf016
=
"04"
;
@ApiModelProperty
(
"项目编号"
)
private
String
tf033
;
@ApiModelProperty
(
"明细"
)
private
List
<
MoctgCreateParams
>
details
;
@ApiModelProperty
(
"标签明细"
)
private
List
<
StorageDetailParams
>
storageDetails
;
}
erp-system/src/main/java/com/topsunit/scanservice/ximai/dto/MoctfCreateParams2.java
View file @
fa4ec878
package
com
.
topsunit
.
scanservice
.
ximai
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.math.BigDecimal
;
import
java.util.List
;
/**
* <p>Title: MoctfCreateParams</p>
* <p>Description: 完工入库申请表头</p>
*
* @author chicheng.li
* @version V1.0
* @date 2024/10/22
*/
@Data
public
class
MoctfCreateParams2
{
@ApiModelProperty
(
"入库单别"
)
private
String
tg001
=
"5801"
;
@ApiModelProperty
(
"仓库"
)
private
String
tg010
;
@ApiModelProperty
(
"库位"
)
private
String
tg036
;
@ApiModelProperty
(
"入库数量"
)
private
BigDecimal
tg011
;
@ApiModelProperty
(
"工单单别"
)
private
String
tg014
;
@ApiModelProperty
(
"工单单号"
)
private
String
tg015
;
}
package
com
.
topsunit
.
scanservice
.
ximai
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.math.BigDecimal
;
import
java.util.List
;
/**
* <p>Title: MoctfCreateParams</p>
* <p>Description: 完工入库申请表头</p>
*
* @author chicheng.li
* @version V1.0
* @date 2024/10/22
*/
@Data
public
class
MoctfCreateParams2
{
@ApiModelProperty
(
"入库单别"
)
private
String
tg001
=
"5801"
;
@ApiModelProperty
(
"仓库"
)
private
String
tg010
;
@ApiModelProperty
(
"库位"
)
private
String
tg036
;
@ApiModelProperty
(
"入库数量"
)
private
BigDecimal
tg011
;
@ApiModelProperty
(
"工单单别"
)
private
String
tg014
;
@ApiModelProperty
(
"工单单号"
)
private
String
tg015
;
@ApiModelProperty
(
"标签明细"
)
private
List
<
StorageDetailParams
>
storageDetails
;
}
erp-system/src/main/java/com/topsunit/scanservice/ximai/dto/MoctgCreateParams.java
View file @
fa4ec878
package
com
.
topsunit
.
scanservice
.
ximai
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.persistence.Id
;
import
java.math.BigDecimal
;
import
java.util.List
;
/**
* <p>Title: MoctgCreateParams</p>
* <p>Description: 完工入库申请表身</p>
*
* @author chicheng.li
* @version V1.0
* @date 2024/10/22
*/
@Data
public
class
MoctgCreateParams
{
@ApiModelProperty
(
"入库单别"
)
private
String
tg001
=
"5801"
;
@ApiModelProperty
(
"入库单号"
)
private
String
tg002
;
@ApiModelProperty
(
"序号"
)
private
String
tg003
=
"0001"
;
/**
* 产品品号
*/
@ApiModelProperty
(
"产品品号"
)
private
String
tg004
;
@ApiModelProperty
(
"品名"
)
private
String
tg005
;
@ApiModelProperty
(
"规格"
)
private
String
tg006
;
@ApiModelProperty
(
"单位"
)
private
String
tg007
;
@ApiModelProperty
(
"入/出别"
)
private
Integer
tg009
=
1
;
@ApiModelProperty
(
"仓库"
)
private
String
tg010
;
@ApiModelProperty
(
"审核码"
)
private
String
tg022
=
"N"
;
@ApiModelProperty
(
"库位"
)
private
String
tg036
;
@ApiModelProperty
(
"库存单位"
)
private
String
tg037
;
@ApiModelProperty
(
"入库数量"
)
private
BigDecimal
tg011
;
@ApiModelProperty
(
"工单单别"
)
private
String
tg014
;
@ApiModelProperty
(
"工单单号"
)
private
String
tg015
;
@ApiModelProperty
(
"检验状态"
)
private
String
tg016
=
"0"
;
@ApiModelProperty
(
"批号"
)
private
String
tg017
=
"********************"
;
@ApiModelProperty
(
"急料"
)
private
String
tg024
;
@ApiModelProperty
(
"生产日期"
)
private
String
tg030
;
@ApiModelProperty
(
"批号说明"
)
private
String
tg031
=
""
;
@ApiModelProperty
(
"报废数量"
)
private
BigDecimal
tg012
=
BigDecimal
.
ZERO
;
@ApiModelProperty
(
"验退数量"
)
private
BigDecimal
tg023
=
BigDecimal
.
ZERO
;
@ApiModelProperty
(
"破坏数量"
)
private
BigDecimal
tg032
=
BigDecimal
.
ZERO
;
@ApiModelProperty
(
"验收数量"
)
private
BigDecimal
tg013
;
}
package
com
.
topsunit
.
scanservice
.
ximai
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.persistence.Id
;
import
java.math.BigDecimal
;
import
java.util.List
;
/**
* <p>Title: MoctgCreateParams</p>
* <p>Description: 完工入库申请表身</p>
*
* @author chicheng.li
* @version V1.0
* @date 2024/10/22
*/
@Data
public
class
MoctgCreateParams
{
@ApiModelProperty
(
"入库单别"
)
private
String
tg001
=
"5801"
;
@ApiModelProperty
(
"入库单号"
)
private
String
tg002
;
@ApiModelProperty
(
"序号"
)
private
String
tg003
=
"0001"
;
/**
* 产品品号
*/
@ApiModelProperty
(
"产品品号"
)
private
String
tg004
;
@ApiModelProperty
(
"品名"
)
private
String
tg005
;
@ApiModelProperty
(
"规格"
)
private
String
tg006
;
@ApiModelProperty
(
"单位"
)
private
String
tg007
;
@ApiModelProperty
(
"入/出别"
)
private
Integer
tg009
=
1
;
@ApiModelProperty
(
"仓库"
)
private
String
tg010
;
@ApiModelProperty
(
"审核码"
)
private
String
tg022
=
"N"
;
@ApiModelProperty
(
"库位"
)
private
String
tg036
;
@ApiModelProperty
(
"库存单位"
)
private
String
tg037
;
@ApiModelProperty
(
"入库数量"
)
private
BigDecimal
tg011
;
@ApiModelProperty
(
"工单单别"
)
private
String
tg014
;
@ApiModelProperty
(
"工单单号"
)
private
String
tg015
;
@ApiModelProperty
(
"检验状态"
)
private
String
tg016
=
"0"
;
@ApiModelProperty
(
"批号"
)
private
String
tg017
=
"********************"
;
@ApiModelProperty
(
"急料"
)
private
String
tg024
;
@ApiModelProperty
(
"生产日期"
)
private
String
tg030
;
@ApiModelProperty
(
"批号说明"
)
private
String
tg031
=
""
;
@ApiModelProperty
(
"报废数量"
)
private
BigDecimal
tg012
=
BigDecimal
.
ZERO
;
@ApiModelProperty
(
"验退数量"
)
private
BigDecimal
tg023
=
BigDecimal
.
ZERO
;
@ApiModelProperty
(
"破坏数量"
)
private
BigDecimal
tg032
=
BigDecimal
.
ZERO
;
@ApiModelProperty
(
"验收数量"
)
private
BigDecimal
tg013
;
}
erp-system/src/main/java/com/topsunit/scanservice/ximai/dto/StorageDetailParams.java
0 → 100644
View file @
fa4ec878
package
com
.
topsunit
.
scanservice
.
ximai
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* <p>Title: StorageDetailParams</p>
* <p>Description: 入库标签明细参数</p>
*
* @author generator
* @version V1.0
* @date 2025-10-12
*/
@Data
public
class
StorageDetailParams
{
@ApiModelProperty
(
"工单单别"
)
private
String
workOrderType
;
@ApiModelProperty
(
"工单单号"
)
private
String
workOrderNo
;
@ApiModelProperty
(
"箱码"
)
private
String
boxCode
;
@ApiModelProperty
(
"小标签号"
)
private
String
labelNo
;
}
erp-system/src/main/java/com/topsunit/scanservice/ximai/entity/ExAccountInfo.java
View file @
fa4ec878
package
com
.
topsunit
.
scanservice
.
ximai
.
entity
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
/**
* <p>Title: EX_ACCOUNT_INFO</p>
* <p>Description: 套账表</p>
*
* @author chicheng.li
* @version V1.0
* @date 2025/1/9
*/
@Data
@Entity
@Table
(
name
=
"EX_ACCOUNT_INFO"
)
public
class
ExAccountInfo
{
@Id
Integer
id
;
@ApiModelProperty
(
"套账名称"
)
@Column
(
name
=
"ACCOUNT_NAME"
)
String
accountName
;
@ApiModelProperty
(
"套账编码"
)
@Column
(
name
=
"ACCOUNT_CODE"
)
String
accountCode
;
@ApiModelProperty
(
"接口地睛"
)
@Column
(
name
=
"API_URL"
)
String
apiUrl
;
@ApiModelProperty
(
"MES接口地址"
)
@Column
(
name
=
"MES_URL"
)
String
mesUrl
;
@ApiModelProperty
(
"开启"
)
@Column
(
name
=
"ENABLE"
)
String
enable
;
@ApiModelProperty
(
"序号"
)
@Column
(
name
=
"SERIAL"
)
String
serial
;
}
package
com
.
topsunit
.
scanservice
.
ximai
.
entity
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
/**
* <p>Title: EX_ACCOUNT_INFO</p>
* <p>Description: 套账表</p>
*
* @author chicheng.li
* @version V1.0
* @date 2025/1/9
*/
@Data
@Entity
@Table
(
name
=
"EX_ACCOUNT_INFO"
)
public
class
ExAccountInfo
{
@Id
Integer
id
;
@ApiModelProperty
(
"套账名称"
)
@Column
(
name
=
"ACCOUNT_NAME"
)
String
accountName
;
@ApiModelProperty
(
"套账编码"
)
@Column
(
name
=
"ACCOUNT_CODE"
)
String
accountCode
;
@ApiModelProperty
(
"接口地睛"
)
@Column
(
name
=
"API_URL"
)
String
apiUrl
;
@ApiModelProperty
(
"条码系统地址"
)
@Column
(
name
=
"BARCODE_URL"
)
String
barcodeUrl
;
@ApiModelProperty
(
"MES接口地址"
)
@Column
(
name
=
"MES_URL"
)
String
mesUrl
;
@ApiModelProperty
(
"开启"
)
@Column
(
name
=
"ENABLE"
)
String
enable
;
@ApiModelProperty
(
"序号"
)
@Column
(
name
=
"SERIAL"
)
String
serial
;
}
erp-system/src/main/java/com/topsunit/scanservice/ximai/service/MoctfService.java
View file @
fa4ec878
package
com
.
topsunit
.
scanservice
.
ximai
.
service
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.date.DateUtil
;
import
com.topsunit.scanservice.ximai.common.TopsunitException
;
import
com.topsunit.scanservice.ximai.dao.*
;
import
com.topsunit.scanservice.ximai.dto.*
;
import
com.topsunit.scanservice.ximai.entity.*
;
import
com.topsunit.scanservice.ximai.utils.MessageUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.Calendar
;
import
java.util.concurrent.atomic.AtomicReference
;
/**
* 完工入库申请服务
*/
@Service
public
class
MoctfService
{
@Autowired
private
MoctfDao
moctfDao
;
@Autowired
private
MoctgDao
moctgDao
;
@Autowired
private
InvmbDao
invmbDao
;
@Autowired
private
InvmcDao
invmcDao
;
@Autowired
private
MoctaDao
moctaDao
;
@Transactional
public
void
create
(
MoctfCreateParams
create
){
Moctf
moctf
=
BeanUtil
.
toBeanIgnoreError
(
create
,
Moctf
.
class
);
Calendar
curr
=
Calendar
.
getInstance
();
String
currStr
=
DateUtil
.
format
(
curr
.
getTime
(),
"yyyyMMdd"
);
moctf
.
setTf003
(
currStr
);
moctf
.
setTf012
(
currStr
);
AtomicReference
<
String
>
ta083
=
new
AtomicReference
<
String
>();
create
.
getDetails
().
forEach
(
s
->{
Moctg
moctg
=
BeanUtil
.
toBeanIgnoreError
(
s
,
Moctg
.
class
);
//查询工单
Mocta
mocta
=
moctaDao
.
findById
(
new
MoctaId
(
s
.
getTg014
(),
s
.
getTg015
())).
orElseThrow
(()->
new
TopsunitException
(
MessageUtils
.
getMessage
(
"未找到对应工单:{0},{1}"
,
s
.
getTg014
(),
s
.
getTg015
())));
//查询物料
Invmb
invmb
=
invmbDao
.
findById
(
mocta
.
getTa006
()).
orElseThrow
(()->
new
TopsunitException
(
MessageUtils
.
getMessage
(
"未找到对应物料:{0}"
,
s
.
getTg004
())));
moctg
.
setTg004
(
invmb
.
getMb001
());
moctg
.
setTg005
(
invmb
.
getMb002
());
moctg
.
setTg006
(
invmb
.
getMb003
());
moctg
.
setTg007
(
invmb
.
getMb004
());
moctg
.
setTg037
(
invmb
.
getMb004
());
moctg
.
setTg010
(
invmb
.
getMb017
());
ta083
.
set
(
mocta
.
getTa083
());
//查询物料默认仓库
Invmc
invmc
=
invmcDao
.
findById
(
new
InvmcId
(
invmb
.
getMb001
(),
invmb
.
getMb017
())).
orElseThrow
(()->
new
TopsunitException
(
MessageUtils
.
getMessage
(
"未找到对应物料默认库:{0},{1}"
,
invmb
.
getMb001
(),
invmb
.
getMb017
())));
moctg
.
setTg036
(
invmc
.
getMc015
());
moctg
.
setTg030
(
currStr
);
moctg
.
setTg038
(
moctg
.
getTg011
());
moctgDao
.
save
(
moctg
);
});
moctf
.
setTf033
(
ta083
.
get
());
moctf
.
setTf023
(
create
.
getDetails
().
get
(
0
).
getTg011
());
moctf
.
setTf024
(
create
.
getDetails
().
get
(
0
).
getTg011
());
moctfDao
.
save
(
moctf
);
}
@Transactional
public
void
create2
(
MoctfCreateParams2
create
){
Moctf
moctf
=
BeanUtil
.
toBeanIgnoreError
(
new
MoctfCreateParams
(),
Moctf
.
class
);
Calendar
curr
=
Calendar
.
getInstance
();
String
currStr
=
DateUtil
.
format
(
curr
.
getTime
(),
"yyyyMMdd"
);
moctf
.
setTf001
(
create
.
getTg001
());
moctf
.
setTf002
(
this
.
getNewTf002
(
create
.
getTg001
()));
moctf
.
setTf003
(
currStr
);
moctf
.
setTf012
(
currStr
);
AtomicReference
<
String
>
ta083
=
new
AtomicReference
<
String
>();
Moctg
moctg
=
BeanUtil
.
toBeanIgnoreError
(
new
MoctgCreateParams
(),
Moctg
.
class
);
BeanUtil
.
copyProperties
(
create
,
moctg
);
//查询工单
Mocta
mocta
=
moctaDao
.
findById
(
new
MoctaId
(
create
.
getTg014
(),
create
.
getTg015
())).
orElseThrow
(()->
new
TopsunitException
(
MessageUtils
.
getMessage
(
"未找到对应工单:{0},{1}"
,
create
.
getTg014
(),
create
.
getTg015
())));
//查询物料
Invmb
invmb
=
invmbDao
.
findById
(
mocta
.
getTa006
()).
orElseThrow
(()->
new
TopsunitException
(
MessageUtils
.
getMessage
(
"未找到对应物料:{0}"
,
mocta
.
getTa006
())));
moctg
.
setTg001
(
moctf
.
getTf001
());
moctg
.
setTg002
(
moctf
.
getTf002
());
moctg
.
setTg004
(
invmb
.
getMb001
());
moctg
.
setTg005
(
invmb
.
getMb002
());
moctg
.
setTg006
(
invmb
.
getMb003
());
moctg
.
setTg007
(
invmb
.
getMb004
());
moctg
.
setTg013
(
create
.
getTg011
());
moctg
.
setTg037
(
invmb
.
getMb004
());
moctg
.
setTg010
(
invmb
.
getMb017
());
ta083
.
set
(
mocta
.
getTa083
());
//查询物料默认仓库
Invmc
invmc
=
invmcDao
.
findById
(
new
InvmcId
(
invmb
.
getMb001
(),
invmb
.
getMb017
())).
orElseThrow
(()->
new
TopsunitException
(
MessageUtils
.
getMessage
(
"未找到对应物料默认库:{0},{1}"
,
invmb
.
getMb001
(),
invmb
.
getMb017
())));
moctg
.
setTg036
(
invmc
.
getMc015
());
moctg
.
setTg030
(
currStr
);
moctg
.
setTg038
(
moctg
.
getTg011
());
moctgDao
.
save
(
moctg
);
moctf
.
setTf033
(
ta083
.
get
());
moctf
.
setTf023
(
create
.
getTg011
());
moctf
.
setTf024
(
create
.
getTg011
());
moctfDao
.
save
(
moctf
);
}
private
String
getNewTf002
(
String
tf001
)
{
String
prefix
=
com
.
topsunit
.
scanservice
.
ximai
.
common
.
DateUtil
.
currentDateString
();
return
moctfDao
.
findFirstByTf001AndTf002StartingWithOrderByTf002Desc
(
tf001
,
prefix
)
.
map
(
i
->
{
int
currentOrdianl
=
Integer
.
parseInt
(
i
.
getTf002
().
replace
(
prefix
,
""
));
return
prefix
+
String
.
format
(
"%03d"
,
currentOrdianl
+
1
);
})
.
orElse
(
prefix
+
"001"
);
}
}
package
com
.
topsunit
.
scanservice
.
ximai
.
service
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.date.DateUtil
;
import
com.topsunit.scanservice.ximai.common.TopsunitException
;
import
com.topsunit.scanservice.ximai.dao.*
;
import
com.topsunit.scanservice.ximai.dto.*
;
import
com.topsunit.scanservice.ximai.entity.*
;
import
com.topsunit.scanservice.ximai.utils.MessageUtils
;
import
com.topsunit.scanservice.ximai.webapi.MesStorageDetailRecordService
;
import
com.topsunit.scanservice.ximai.webapi.dto.StorageDetailRecordCreate
;
import
com.topsunit.scanservice.ximai.webapi.dto.StorageDetailRecordResult
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.Calendar
;
import
java.util.concurrent.atomic.AtomicReference
;
/**
* 完工入库申请服务
*/
@Service
public
class
MoctfService
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
MoctfService
.
class
);
@Autowired
private
MoctfDao
moctfDao
;
@Autowired
private
MoctgDao
moctgDao
;
@Autowired
private
InvmbDao
invmbDao
;
@Autowired
private
InvmcDao
invmcDao
;
@Autowired
private
MoctaDao
moctaDao
;
@Autowired
private
MesStorageDetailRecordService
mesStorageDetailRecordService
;
@Transactional
public
void
create
(
MoctfCreateParams
create
){
Moctf
moctf
=
BeanUtil
.
toBeanIgnoreError
(
create
,
Moctf
.
class
);
Calendar
curr
=
Calendar
.
getInstance
();
String
currStr
=
DateUtil
.
format
(
curr
.
getTime
(),
"yyyyMMdd"
);
if
(
StringUtils
.
isEmpty
(
create
.
getTf002
())){
moctf
.
setTf002
(
this
.
getNewTf002
(
create
.
getTf001
()));
}
moctf
.
setTf003
(
currStr
);
moctf
.
setTf012
(
currStr
);
AtomicReference
<
String
>
ta083
=
new
AtomicReference
<
String
>();
create
.
getDetails
().
forEach
(
s
->{
Moctg
moctg
=
BeanUtil
.
toBeanIgnoreError
(
s
,
Moctg
.
class
);
//查询工单
Mocta
mocta
=
moctaDao
.
findById
(
new
MoctaId
(
s
.
getTg014
(),
s
.
getTg015
())).
orElseThrow
(()->
new
TopsunitException
(
MessageUtils
.
getMessage
(
"未找到对应工单:{0},{1}"
,
s
.
getTg014
(),
s
.
getTg015
())));
//查询物料
Invmb
invmb
=
invmbDao
.
findById
(
mocta
.
getTa006
()).
orElseThrow
(()->
new
TopsunitException
(
MessageUtils
.
getMessage
(
"未找到对应物料:{0}"
,
s
.
getTg004
())));
if
(
StringUtils
.
isEmpty
(
moctg
.
getTg002
())){
moctg
.
setTg002
(
moctf
.
getTf002
());
}
moctg
.
setTg004
(
invmb
.
getMb001
());
moctg
.
setTg005
(
invmb
.
getMb002
());
moctg
.
setTg006
(
invmb
.
getMb003
());
moctg
.
setTg007
(
invmb
.
getMb004
());
moctg
.
setTg037
(
invmb
.
getMb004
());
moctg
.
setTg010
(
invmb
.
getMb017
());
ta083
.
set
(
mocta
.
getTa083
());
//查询物料默认仓库
Invmc
invmc
=
invmcDao
.
findById
(
new
InvmcId
(
invmb
.
getMb001
(),
invmb
.
getMb017
())).
orElseThrow
(()->
new
TopsunitException
(
MessageUtils
.
getMessage
(
"未找到对应物料默认库:{0},{1}"
,
invmb
.
getMb001
(),
invmb
.
getMb017
())));
moctg
.
setTg036
(
invmc
.
getMc015
());
moctg
.
setTg030
(
currStr
);
moctg
.
setTg038
(
moctg
.
getTg011
());
moctgDao
.
save
(
moctg
);
});
moctf
.
setTf033
(
ta083
.
get
());
moctf
.
setTf023
(
create
.
getDetails
().
get
(
0
).
getTg011
());
moctf
.
setTf024
(
create
.
getDetails
().
get
(
0
).
getTg011
());
moctfDao
.
save
(
moctf
);
// 保存入库标签明细记录到 MES 系统
if
(
create
.
getStorageDetails
()
!=
null
&&
!
create
.
getStorageDetails
().
isEmpty
())
{
create
.
getStorageDetails
().
forEach
(
detail
->
{
try
{
StorageDetailRecordCreate
storageDetailRecord
=
new
StorageDetailRecordCreate
();
storageDetailRecord
.
setWorkOrderType
(
detail
.
getWorkOrderType
());
storageDetailRecord
.
setWorkOrderNo
(
detail
.
getWorkOrderNo
());
storageDetailRecord
.
setBoxCode
(
detail
.
getBoxCode
());
storageDetailRecord
.
setLabelNo
(
detail
.
getLabelNo
());
StorageDetailRecordResult
result
=
mesStorageDetailRecordService
.
create
(
storageDetailRecord
);
if
(
result
.
getCode
()==
200
)
{
log
.
info
(
"保存入库明细记录成功:工单单别={}, 工单单号={}, 箱码={}, 小标签号={}"
,
detail
.
getWorkOrderType
(),
detail
.
getWorkOrderNo
(),
detail
.
getBoxCode
(),
detail
.
getLabelNo
());
}
else
{
throw
new
TopsunitException
(
result
.
getMsg
());
}
}
catch
(
Exception
e
)
{
log
.
error
(
"保存入库明细记录失败:工单单别={}, 工单单号={}, 箱码={}, 小标签号={}, 错误信息={}"
,
detail
.
getWorkOrderType
(),
detail
.
getWorkOrderNo
(),
detail
.
getBoxCode
(),
detail
.
getLabelNo
(),
e
.
getMessage
(),
e
);
// 不抛出异常,仅记录日志,避免影响主流程
}
});
}
}
@Transactional
public
void
create2
(
MoctfCreateParams2
create
){
Moctf
moctf
=
BeanUtil
.
toBeanIgnoreError
(
new
MoctfCreateParams
(),
Moctf
.
class
);
Calendar
curr
=
Calendar
.
getInstance
();
String
currStr
=
DateUtil
.
format
(
curr
.
getTime
(),
"yyyyMMdd"
);
moctf
.
setTf001
(
create
.
getTg001
());
moctf
.
setTf002
(
this
.
getNewTf002
(
create
.
getTg001
()));
moctf
.
setTf003
(
currStr
);
moctf
.
setTf012
(
currStr
);
AtomicReference
<
String
>
ta083
=
new
AtomicReference
<
String
>();
Moctg
moctg
=
BeanUtil
.
toBeanIgnoreError
(
new
MoctgCreateParams
(),
Moctg
.
class
);
BeanUtil
.
copyProperties
(
create
,
moctg
);
//查询工单
Mocta
mocta
=
moctaDao
.
findById
(
new
MoctaId
(
create
.
getTg014
(),
create
.
getTg015
())).
orElseThrow
(()->
new
TopsunitException
(
MessageUtils
.
getMessage
(
"未找到对应工单:{0},{1}"
,
create
.
getTg014
(),
create
.
getTg015
())));
//查询物料
Invmb
invmb
=
invmbDao
.
findById
(
mocta
.
getTa006
()).
orElseThrow
(()->
new
TopsunitException
(
MessageUtils
.
getMessage
(
"未找到对应物料:{0}"
,
mocta
.
getTa006
())));
moctg
.
setTg001
(
moctf
.
getTf001
());
moctg
.
setTg002
(
moctf
.
getTf002
());
moctg
.
setTg004
(
invmb
.
getMb001
());
moctg
.
setTg005
(
invmb
.
getMb002
());
moctg
.
setTg006
(
invmb
.
getMb003
());
moctg
.
setTg007
(
invmb
.
getMb004
());
moctg
.
setTg013
(
create
.
getTg011
());
moctg
.
setTg037
(
invmb
.
getMb004
());
moctg
.
setTg010
(
invmb
.
getMb017
());
ta083
.
set
(
mocta
.
getTa083
());
//查询物料默认仓库
Invmc
invmc
=
invmcDao
.
findById
(
new
InvmcId
(
invmb
.
getMb001
(),
invmb
.
getMb017
())).
orElseThrow
(()->
new
TopsunitException
(
MessageUtils
.
getMessage
(
"未找到对应物料默认库:{0},{1}"
,
invmb
.
getMb001
(),
invmb
.
getMb017
())));
moctg
.
setTg036
(
invmc
.
getMc015
());
moctg
.
setTg030
(
currStr
);
moctg
.
setTg038
(
moctg
.
getTg011
());
moctgDao
.
save
(
moctg
);
moctf
.
setTf033
(
ta083
.
get
());
moctf
.
setTf023
(
create
.
getTg011
());
moctf
.
setTf024
(
create
.
getTg011
());
moctfDao
.
save
(
moctf
);
// 保存入库标签明细记录到 MES 系统
if
(
create
.
getStorageDetails
()
!=
null
&&
!
create
.
getStorageDetails
().
isEmpty
())
{
create
.
getStorageDetails
().
forEach
(
detail
->
{
try
{
StorageDetailRecordCreate
storageDetailRecord
=
new
StorageDetailRecordCreate
();
storageDetailRecord
.
setWorkOrderType
(
detail
.
getWorkOrderType
());
storageDetailRecord
.
setWorkOrderNo
(
detail
.
getWorkOrderNo
());
storageDetailRecord
.
setBoxCode
(
detail
.
getBoxCode
());
storageDetailRecord
.
setLabelNo
(
detail
.
getLabelNo
());
StorageDetailRecordResult
result
=
mesStorageDetailRecordService
.
create
(
storageDetailRecord
);
log
.
info
(
"保存入库明细记录成功:工单单别={}, 工单单号={}, 箱码={}, 小标签号={}"
,
detail
.
getWorkOrderType
(),
detail
.
getWorkOrderNo
(),
detail
.
getBoxCode
(),
detail
.
getLabelNo
());
}
catch
(
Exception
e
)
{
log
.
error
(
"保存入库明细记录失败:工单单别={}, 工单单号={}, 箱码={}, 小标签号={}, 错误信息={}"
,
detail
.
getWorkOrderType
(),
detail
.
getWorkOrderNo
(),
detail
.
getBoxCode
(),
detail
.
getLabelNo
(),
e
.
getMessage
(),
e
);
// 不抛出异常,仅记录日志,避免影响主流程
}
});
}
}
private
String
getNewTf002
(
String
tf001
)
{
String
prefix
=
com
.
topsunit
.
scanservice
.
ximai
.
common
.
DateUtil
.
currentDateString
();
return
moctfDao
.
findFirstByTf001AndTf002StartingWithOrderByTf002Desc
(
tf001
,
prefix
)
.
map
(
i
->
{
int
currentOrdianl
=
Integer
.
parseInt
(
i
.
getTf002
().
replace
(
prefix
,
""
));
return
prefix
+
String
.
format
(
"%03d"
,
currentOrdianl
+
1
);
})
.
orElse
(
prefix
+
"001"
);
}
}
erp-system/src/main/java/com/topsunit/scanservice/ximai/webapi/MesStorageDetailRecordService.java
0 → 100644
View file @
fa4ec878
package
com
.
topsunit
.
scanservice
.
ximai
.
webapi
;
import
com.topsunit.scanservice.ximai.webapi.dto.StorageDetailRecordCreate
;
import
com.topsunit.scanservice.ximai.webapi.dto.StorageDetailRecordResult
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
/**
* <p>Title: MesStorageDetailRecordService</p>
* <p>Description: MES 入库明细记录服务</p>
*
* @author generator
* @version V1.0
* @date 2025-10-12
*/
@FeignClient
(
name
=
"MES-StorageDetailRecord"
,
url
=
"${topsunit.mes-url}"
)
public
interface
MesStorageDetailRecordService
{
/**
* 新增入库明细记录(内部接口,无权限验证)
*
* @param storageDetailRecordCreate 入库明细记录创建对象
* @return 操作结果
*/
@RequestMapping
(
value
=
"/pro/storageDetailRecord/internal"
,
method
=
RequestMethod
.
POST
)
StorageDetailRecordResult
create
(
@RequestBody
StorageDetailRecordCreate
storageDetailRecordCreate
);
}
erp-system/src/main/java/com/topsunit/scanservice/ximai/webapi/dto/StorageDetailRecordCreate.java
0 → 100644
View file @
fa4ec878
package
com
.
topsunit
.
scanservice
.
ximai
.
webapi
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* <p>Title: StorageDetailRecordCreate</p>
* <p>Description: 入库明细记录创建对象</p>
*
* @author generator
* @version V1.0
* @date 2025-10-12
*/
@Data
public
class
StorageDetailRecordCreate
{
/** 工单单别 */
@ApiModelProperty
(
"工单单别"
)
private
String
workOrderType
;
/** 工单单号 */
@ApiModelProperty
(
"工单单号"
)
private
String
workOrderNo
;
/** 箱码 */
@ApiModelProperty
(
"箱码"
)
private
String
boxCode
;
/** 小标签号 */
@ApiModelProperty
(
"小标签号"
)
private
String
labelNo
;
}
erp-system/src/main/java/com/topsunit/scanservice/ximai/webapi/dto/StorageDetailRecordResult.java
0 → 100644
View file @
fa4ec878
package
com
.
topsunit
.
scanservice
.
ximai
.
webapi
.
dto
;
import
lombok.Data
;
/**
* <p>Title: StorageDetailRecordResult</p>
* <p>Description: 入库明细记录返回结果</p>
*
* @author generator
* @version V1.0
* @date 2025-10-12
*/
@Data
public
class
StorageDetailRecordResult
{
/** 状态码 */
private
Integer
code
;
/** 消息 */
private
String
msg
;
/** 数据 */
private
Object
data
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment