Compare commits

..

80 Commits

Author SHA1 Message Date
ebbf10d608 refactor: 设置lombok 2025-01-07 14:19:01 +08:00
1de159ff6c refactor: 测试环境配置文件修改 2025-01-05 20:33:56 +08:00
53180f3b48 refactor(库位): mapper, 排序字段修改 2025-01-05 20:32:53 +08:00
ea54889b99 refactor(台账): mapper,查询过滤隐藏的台账 2025-01-05 20:32:22 +08:00
d375f6b9bb refactor: 配置文件,修改开发环境 2025-01-05 20:31:51 +08:00
75a60fc4e1 refactor(出库计划): 类型修改 2025-01-05 20:31:30 +08:00
e4766cef52 feat(出库计划): 根据订单生成出库计划 2025-01-05 20:31:04 +08:00
3f5d4992b2 feat(出入库计划类型): 增加根据类型编码查询, 2025-01-05 20:30:37 +08:00
a2f5177f2c feat(入库计划): 增加执行入库计划;增加根据订单生成入库计划 2025-01-05 16:28:22 +08:00
ea7d61a6f4 refactor(入库任务): 将库位信息填充至料箱,代码块优化 2025-01-05 16:27:24 +08:00
cf738261c4 refactor(出入库类型): 设置lombok,修改id字段类型 2025-01-05 16:26:11 +08:00
353443bdc7 feat(台账): 根据rfid查询台账 2025-01-05 16:25:34 +08:00
9c3143e0bf refactor: 出库任务,优化 2024-12-20 14:13:38 +08:00
f11994376f fix: 自动分配,修复 2024-12-20 14:11:17 +08:00
7c420ab7a5 注释解开 2024-12-20 10:54:17 +08:00
19b97b234b 工具库生产准备 2024-12-20 10:52:52 +08:00
1d9e31b5fa fix: 执行入库任务修复 2024-12-20 10:05:40 +08:00
cf04961ff0 refactor: 组装任务修改 2024-12-20 09:19:09 +08:00
289df67850 refactor: 料箱mapper增加rfid字段 2024-12-20 08:57:30 +08:00
b7f1ad32e7 refactor: 根据料箱查询入库任务,修改 2024-12-20 08:57:10 +08:00
76e571359f refactor: 料箱字段类型修改 2024-12-19 17:02:30 +08:00
8987386691 refactor: 料箱字段类型修改 2024-12-19 16:43:34 +08:00
93be09a4de feat: 同步主数据管理平台数据 2024-12-19 16:42:57 +08:00
4f77b1921d refactor: 入库之后台账更新库位 2024-12-19 10:58:27 +08:00
d8357ea130 refactor: 出库计划编码自动生成 2024-12-19 10:48:43 +08:00
82929979fb 修改自动分配库位机制 2024-12-19 10:05:19 +08:00
b515389f38 Merge remote-tracking branch 'origin/master' 2024-12-19 10:00:42 +08:00
b26e4a31a1 出库时置空料箱库位字段 2024-12-19 10:00:33 +08:00
a8bf938f30 refactor: 执行入库后将库位信息填充,料箱 2024-12-19 09:49:05 +08:00
f253d12153 refactor: 说明文档更新 2024-12-19 09:48:16 +08:00
fe34ec181e Merge remote-tracking branch 'origin/master' 2024-12-19 09:17:07 +08:00
64477b68c7 attr1字段可置空更新 2024-12-19 09:16:11 +08:00
105ac642b5 Merge remote-tracking branch 'origin/master' 2024-12-19 09:15:05 +08:00
18a0416a28 refactor: 自动分配优化 2024-12-19 09:14:18 +08:00
47b4f94cd4 更新注释 2024-12-19 09:13:47 +08:00
2ce5028d07 增加料箱的库位支持 2024-12-19 09:12:03 +08:00
4711eac382 fix: 出库任务修复 2024-12-18 17:37:41 +08:00
25f3092b65 增加自动分配库位机制 2024-12-18 16:02:34 +08:00
f769bc17be 排除临时库位机制 2024-12-18 15:51:50 +08:00
7d69b2eafc 删除多余代码 2024-12-18 15:42:18 +08:00
f1129e8464 增加自动全部到临时库位机制 2024-12-18 15:35:40 +08:00
726d14eeb4 refactor: 根据料箱查询任务时,将料箱rfid绑定至相关任务 2024-12-18 14:25:27 +08:00
79d23c9e99 修复BUG 2024-12-18 11:25:10 +08:00
faa93f5d7b 增加根据库区编码与大小标记获取一个库位 2024-12-18 10:42:15 +08:00
c7edc4ea37 修正SQL语法错误 2024-12-18 10:29:01 +08:00
f14fd39c5c 增加对大小料箱的支持 2024-12-18 10:26:59 +08:00
d5b4647a12 接收扫描器传递来的数据 2024-12-18 10:02:25 +08:00
f2478d9e89 完善大号物料字段 2024-12-16 16:16:09 +08:00
968fdcee45 完善注释 2024-12-16 15:36:49 +08:00
9918b476dd 格式化代码 2024-12-16 15:19:38 +08:00
8b967dda27 增加注释 2024-12-16 14:41:43 +08:00
e6b8cbc848 完成出库任务公开列表增加台账实体数据 2024-12-16 11:12:18 +08:00
dab8541b37 完成出库计划新增接口,并自动执行出库计划,在数量等条件满足的情况下生成相应的出库任务 2024-12-16 11:09:33 +08:00
26561fd2a7 绑定料箱包含隐藏物料 2024-12-12 16:13:09 +08:00
48cc27d3c6 完成出库计划执行时自动匹配库位 2024-12-10 16:32:01 +08:00
f6a2554263 完善物料绑定前校验 2024-12-09 11:23:50 +08:00
866cac140d feat: 根据料箱编码查询入库任务信息 2024-12-06 15:30:51 +08:00
c985a22b5a refactor: 入库计划执行逻辑修改,执行入库计划时生成隐藏状态台账 2024-12-06 15:30:18 +08:00
c294457ccb refactor: 变量类型修改 2024-12-06 15:29:08 +08:00
3765bfcc8b feat(料箱管理): 根据rfid查询料箱管理 2024-12-06 15:27:14 +08:00
6df503cf41 Merge remote-tracking branch 'origin/master' 2024-12-06 10:28:17 +08:00
7bec3c51fe refactor: 增加注解 2024-12-06 09:54:59 +08:00
28e9a0c4a2 出库计划增加联查台账信息 2024-12-06 09:19:45 +08:00
a9a361efa1 Merge remote-tracking branch 'origin/master' 2024-12-05 17:51:21 +08:00
ad4935021e refactor: 注入修改 2024-12-05 17:50:59 +08:00
3f9cac0982 refactor: 入库任务实体修改 2024-12-05 17:49:39 +08:00
c454bbf94c refactor: 入库计划实体修改 2024-12-05 17:47:03 +08:00
1269b800f3 Merge remote-tracking branch 'origin/master' 2024-12-05 17:39:00 +08:00
a5767e0144 物料数量统计优化 2024-12-05 17:37:01 +08:00
889f17d307 Merge remote-tracking branch 'origin/master' 2024-12-05 17:36:20 +08:00
bb456267d5 Merge remote-tracking branch 'origin/master' 2024-12-05 17:32:01 +08:00
99abda65bd 增加统计限制 2024-12-05 17:31:52 +08:00
3345ea6bc0 refactor: 配置文件 2024-12-05 16:11:05 +08:00
efc78860bf Merge remote-tracking branch 'origin/master' 2024-12-05 15:42:07 +08:00
fbc5b94956 feat: 自动装配 2024-12-05 15:37:52 +08:00
ea2c07cbc2 优化代码 2024-12-05 10:10:22 +08:00
de7aa40751 Merge remote-tracking branch 'origin/master' 2024-11-29 09:31:45 +08:00
a627762b39 tjk 2024-11-29 09:15:42 +08:00
a517e61398 开放执行任务接口 2024-11-28 10:17:20 +08:00
8c5baf4b5f 增加手持设备新增料箱功能 2024-11-27 15:20:32 +08:00
82 changed files with 4102 additions and 1885 deletions

View File

@ -1,2 +1,10 @@
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">工刀具库WMS</h1>
<p align="center">
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">工具库WMS</h1>
<p align="center">
# 项目启动
## 1. 拉取Maven依赖
## 2. 手动添加DM依赖
### Hibernate5.4
`mvn install:install-file -Dfile=[jar包路径] -DgroupId=com.dm.dialect -DartifactId=hibernate5 -Dversion=5.4 -Dpackaging=jar`
### DmJdbc
`mvn install:install-file -Dfile=[jar包路径] -DgroupId=com.dm -DartifactId=DmJdbcDriver -Dversion=1.8 -Dpackaging=jar`

View File

@ -0,0 +1,97 @@
# 数据源配置
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: dm.jdbc.driver.DmDriver
druid:
# 主库数据源
master:
url: jdbc:dm://192.168.8.60:5236/WMS_GJ?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: SYSDBA
password: SYSDBA
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled: false
url:
username:
password:
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username: ruoyi
login-password: 123456
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true
# redis 配置
redis:
# 地址
host: 192.168.8.60
# 端口默认为6379
port: 6379
# 数据库索引
database: 2
# 密码
password: 123456
# 连接超时时间
timeout: 10s
lettuce:
pool:
# 连接池中的最小空闲连接
min-idle: 0
# 连接池中的最大空闲连接
max-idle: 8
# 连接池的最大数据库连接数
max-active: 8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
#Mino配置
minio:
url: http://192.168.8.60:9000
accessKey: seBsDKT7Ss8B4aGiNiNn
secretKey: IYvTR63NZE3EemLfIHGTXu72O7svMEiNHG2OoOWI
bucketName: wms-gj
# 远程读取文件
globalConfig:
toolSettingXml:
localPath: E:\xml_wjj\
remoteUrl: smb://DBJGJG24/ddy/
remoteUser: share
remotePass: share
productionControl:
path: http://172.16.99.10:5005/api

View File

@ -0,0 +1,99 @@
# 数据源配置
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: dm.jdbc.driver.DmDriver
druid:
# 主库数据源
master:
# url: jdbc:dm://30.30.2.24:5237/WMS_DJ?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# url: jdbc:dm://localhost:5236/WMS_DJ?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:dm://abca.xin:7069/WMS_GJ?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: SYSDBA
password: SYSDBA001
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled: false
url:
username:
password:
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username: ruoyi
login-password: 123456
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true
# redis 配置
redis:
# 地址
host: abca.xin
# 端口默认为6379
port: 7067
# 数据库索引
database: 2
# 密码
password: redis_HtWAZW
# 连接超时时间
timeout: 10s
lettuce:
pool:
# 连接池中的最小空闲连接
min-idle: 0
# 连接池中的最大空闲连接
max-idle: 8
# 连接池的最大数据库连接数
max-active: 8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
#Mino配置
minio:
url: http://abca.xin:7068
accessKey: seBsDKT7Ss8B4aGiNiNn
secretKey: IYvTR63NZE3EemLfIHGTXu72O7svMEiNHG2OoOWI
bucketName: wms-gj
# 远程读取文件
globalConfig:
toolSettingXml:
localPath: E:\xml_wjj\
remoteUrl: smb://DBJGJG24/ddy/
remoteUser: share
remotePass: share
productionControl:
path: http://172.16.99.10:5005/api

View File

@ -1,59 +0,0 @@
# 数据源配置
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: dm.jdbc.driver.DmDriver
druid:
# 主库数据源
master:
# url: jdbc:dm://30.30.2.24:5237/WMS_DJ?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# url: jdbc:dm://localhost:5236/WMS_DJ?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:dm://192.168.8.60:5236/WMS_GJ?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: SYSDBA
password: SYSDBA
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled: false
url:
username:
password:
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username: ruoyi
login-password: 123456
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true

View File

@ -0,0 +1,116 @@
# 数据源配置
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
druid:
# 主库数据源
dm:
driverClassName: dm.jdbc.driver.DmDriver
url: jdbc:dm://8.218.31.53:7069/WMS_GJ?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: SYSDBA
password: SYSDBA001
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
# 从库数据源
sqlserver:
# 从数据源开关/默认关闭
enabled: true
driverClassName: net.sourceforge.jtds.jdbc.Driver
url: jdbc:jtds:sqlserver://192.168.8.68:1433/DPG_RH_YQ_20240711
username: sa
password: rh123456
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username: ruoyi
login-password: 123456
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true
# redis 配置
redis:
# 地址
host: 8.218.31.53
# 端口默认为6379
port: 7067
# 数据库索引
database: 2
# 密码
password: redis_HtWAZW
# 连接超时时间
timeout: 10s
lettuce:
pool:
# 连接池中的最小空闲连接
min-idle: 0
# 连接池中的最大空闲连接
max-idle: 8
# 连接池的最大数据库连接数
max-active: 8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
#Mino配置
minio:
url: http://8.218.31.53:7068
accessKey: seBsDKT7Ss8B4aGiNiNn
secretKey: IYvTR63NZE3EemLfIHGTXu72O7svMEiNHG2OoOWI
bucketName: wms-dj
# 远程读取文件
globalConfig:
toolSettingXml:
localPath: E:\xml_wjj\
remoteUrl: smb://DBJGJG24/ddy/
remoteUser: share
remotePass: share
productionControl:
path: http://172.16.99.10:5005/api

View File

@ -0,0 +1,116 @@
# 数据源配置
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
druid:
# 主库数据源
dm:
driverClassName: dm.jdbc.driver.DmDriver
url: jdbc:dm://8.218.31.53:7069/WMS_GJ?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: SYSDBA
password: SYSDBA001
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
# 从库数据源
sqlserver:
# 从数据源开关/默认关闭
enabled: true
driverClassName: net.sourceforge.jtds.jdbc.Driver
url: jdbc:jtds:sqlserver://192.168.8.68:1433/DPG_RH_YQ_20240711
username: sa
password: rh123456
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username: ruoyi
login-password: 123456
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true
# redis 配置
redis:
# 地址
host: 8.218.31.53
# 端口默认为6379
port: 7067
# 数据库索引
database: 2
# 密码
password: redis_HtWAZW
# 连接超时时间
timeout: 10s
lettuce:
pool:
# 连接池中的最小空闲连接
min-idle: 0
# 连接池中的最大空闲连接
max-idle: 8
# 连接池的最大数据库连接数
max-active: 8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
#Mino配置
minio:
url: http://8.218.31.53:7068
accessKey: seBsDKT7Ss8B4aGiNiNn
secretKey: IYvTR63NZE3EemLfIHGTXu72O7svMEiNHG2OoOWI
bucketName: wms-dj
# 远程读取文件
globalConfig:
toolSettingXml:
localPath: E:\xml_wjj\
remoteUrl: smb://DBJGJG24/ddy/
remoteUser: share
remotePass: share
productionControl:
path: http://172.16.99.10:5005/api

View File

@ -47,7 +47,7 @@ spring:
# 国际化资源文件路径
basename: i18n/messages
profiles:
active: druid
active: dev
# 文件上传
servlet:
multipart:
@ -60,28 +60,6 @@ spring:
restart:
# 热部署开关
enabled: true
# redis 配置
redis:
# 地址
host: 192.168.8.60
# 端口默认为6379
port: 6379
# 数据库索引
database: 4
# 密码
password: 123456
# 连接超时时间
timeout: 10s
lettuce:
pool:
# 连接池中的最小空闲连接
min-idle: 0
# 连接池中的最大空闲连接
max-idle: 8
# 连接池的最大数据库连接数
max-active: 8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
# token配置
token:
@ -123,10 +101,3 @@ xss:
excludes: /system/notice
# 匹配链接
urlPatterns: /system/*,/monitor/*,/tool/*
#Mino配置
minio:
url: http://192.168.8.60:9000
accessKey: seBsDKT7Ss8B4aGiNiNn
secretKey: IYvTR63NZE3EemLfIHGTXu72O7svMEiNHG2OoOWI
bucketName: wms-dj

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- 日志存放路径 -->
<property name="log.path" value="/home/ktg/logs" />
<property name="log.path" value="./logs" />
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />

View File

@ -157,6 +157,12 @@
<version>2.2.9</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>annotationProcessor</scope>
</dependency>
</dependencies>
</project>

View File

@ -53,10 +53,25 @@
<artifactId>swagger-models</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>jcifs</groupId>
<artifactId>jcifs</artifactId>
<version>1.3.17</version>
</dependency>
<dependency>
<groupId>com.ktg</groupId>
<artifactId>ktg-generator</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<!--CXF webservices-->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxws</artifactId>
<version>3.4.4</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,36 @@
package com.ktg.mes.md.config;
import com.ktg.mes.md.service.IMasterDataSyncService;
import lombok.RequiredArgsConstructor;
import org.apache.cxf.Bus;
import org.apache.cxf.bus.spring.SpringBus;
import org.apache.cxf.jaxws.EndpointImpl;
import org.apache.cxf.transport.servlet.CXFServlet;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.xml.ws.Endpoint;
@Configuration
@RequiredArgsConstructor
public class WebServiceConfig {
private final IMasterDataSyncService masterDataSyncService;
@Bean(name = Bus.DEFAULT_BUS_ID)
public SpringBus springBus() {
return new SpringBus();
}
@Bean
public ServletRegistrationBean<CXFServlet> cxfServlet() {
return new ServletRegistrationBean<>(new CXFServlet(), "/WebServices/open/*");
}
@Bean
public Endpoint endpoint() {
EndpointImpl endpoint = new EndpointImpl(springBus(), masterDataSyncService);
endpoint.publish("/MasterDataSyncService");
return endpoint;
}
}

View File

@ -1,5 +1,6 @@
package com.ktg.mes.md.controller;
import java.io.IOException;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import javax.servlet.http.HttpServletResponse;
@ -7,7 +8,9 @@ import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSON;
import com.ktg.common.utils.DateUtils;
import com.ktg.generator.util.MultiModuleCodeGenerator;
import com.ktg.mes.cal.utils.CalendarUtil;
import com.ktg.mes.md.domain.*;
import com.ktg.mes.md.mapper.BaseKnifeLockedMapper;
import com.ktg.mes.md.mapper.WmsOutPlanDetailEntityMapper;
import com.ktg.mes.md.mapper.WmsOutPlanMapper;
import com.ktg.mes.md.mapper.WmsOutTaskMapper;
@ -20,6 +23,10 @@ import com.ktg.mes.wm.service.IWmsInTaskService;
import com.ktg.mes.wm.service.IWmsZdTaskService;
import com.ktg.system.domain.SysOperLog;
import com.ktg.system.service.ISysOperLogService;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
@ -82,6 +89,12 @@ public class BaseKnifeController extends BaseController {
@Autowired
private ProductionArrangementsMapper productionArrangementsMapper;
@Autowired
private BaseKnifeLockedMapper baseKnifeLockedMapper;
@Autowired
private MyConfig myConfig;
/**
* 列表查询
@ -133,13 +146,41 @@ public class BaseKnifeController extends BaseController {
return getDataTable(list);
}
@PostMapping("/open/checkForAlignment")
/**
* 列表查询
*
* @return
*/
@PostMapping("/open/life")
public AjaxResult life(@RequestBody BaseKnife baseKnife) {
// 检查台账是否存在
BaseKnife baseKnifeOrigin = baseKnifeService.selectBaseKnifeByBaseKnifeId(baseKnife.getBaseKnifeId());
if (baseKnifeOrigin == null) return AjaxResult.error();
// 计算消耗寿命
int currentLife = baseKnifeOrigin.getKnifeLife() + baseKnifeOrigin.getResetCount() * 100 - baseKnife.getKnifeLife();
if (currentLife > 0){
baseKnifeOrigin.setKnifeLife(currentLife % 100);
baseKnifeOrigin.setResetCount(currentLife / 100);
} else {
baseKnifeOrigin.setKnifeLife(0);
baseKnifeOrigin.setResetCount(0);
}
baseKnifeService.updateBaseKnife(baseKnifeOrigin);
return AjaxResult.success();
}
@PostMapping("/open/checkForAlignment/{technologyCode}")
@ResponseBody
public AjaxResult checkForAlignment(@RequestBody List<String> processCodeList) {
// 获取工艺bom
List<BaseTechnologyBom> technologyBomList = baseTechnologyBomService.selectBaseTechnologyBomListByProcessCodeList(processCodeList);
public AjaxResult checkForAlignment(@PathVariable String technologyCode) {
// 验证bom工艺
BaseTechnologyBom baseTechnologyBomWrapper = new BaseTechnologyBom();
baseTechnologyBomWrapper.setTechnologyCode(technologyCode);
// List<BaseTechnologyBom> technologyBomList = baseTechnologyBomService.selectBaseTechnologyBomListByProcessCodeList(productionArrangements.getProcessCodes());
List<BaseTechnologyBom> technologyBomList = baseTechnologyBomService.selectBaseTechnologyBomList(baseTechnologyBomWrapper);
if (technologyBomList.isEmpty() || technologyBomList.size() == 1 && technologyBomList.get(0).getKnifeCode() == null)
return AjaxResult.error("未检测到工艺bom项");
throw new RuntimeException("未检测到工艺bom项");
// 构建日志
SysOperLog operLog = new SysOperLog();
@ -151,7 +192,7 @@ public class BaseKnifeController extends BaseController {
operLog.setOperLocation("上游系统");
operLog.setOperUrl("/mes/md/baseKnife/open/checkForAlignment");
operLog.setMethod("com.ktg.mes.md.controller.BaseKnifeController.checkForAlignment()");
operLog.setOperParam(JSON.toJSONString(processCodeList));
operLog.setOperParam(JSON.toJSONString(technologyCode));
operLog.setStatus(1);
operLog.setOperTime(new Date());
@ -171,7 +212,7 @@ public class BaseKnifeController extends BaseController {
if (mdItemTemp == null) {
operLog.setJsonResult("物料台账查询错误:" + techBom.getKnifeCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("物料台账查询错误", techBom.getKnifeCode());
throw new RuntimeException("物料台账查询错误" + techBom.getKnifeCode());
}
baseKnifeWrapper.setMbbBdMrlId(mdItemTemp.getItemId());
@ -189,7 +230,7 @@ public class BaseKnifeController extends BaseController {
if (bomRouteList.isEmpty()) {
operLog.setJsonResult("Bom头查询错误" + techBom.getKnifeCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("Bom头查询错误", techBom.getKnifeCode());
throw new RuntimeException("Bom头查询错误" + techBom.getKnifeCode());
}
BomRoute bomRoute = bomRouteService.selectBomRouteByBomRouteId(bomRouteList.get(0).getBomRouteId());
@ -205,14 +246,14 @@ public class BaseKnifeController extends BaseController {
if (sitmTempList.isEmpty()) {
operLog.setJsonResult("基础物料不足进行组装工具:" + bom.getMdItemCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("基础物料不足进行组装工具", bom.getMdItemCode());
throw new RuntimeException("基础物料不足进行组装工具" + bom.getMdItemCode());
} else if (countMap.get(sitmTempList.get(0).getKnifeCode()) == null) {
if (sitmTempList.size() >= bom.getStandardDosage() * knifeCount.get()) {
countMap.put(sitmTempList.get(0).getKnifeCode(), bom.getStandardDosage() * knifeCount.get());
} else {
operLog.setJsonResult("基础物料不足进行组装工具:" + bom.getMdItemCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("基础物料不足进行组装工具", bom.getMdItemCode());
throw new RuntimeException("基础物料不足进行组装工具" + bom.getMdItemCode());
}
} else {
countMap.put(sitmTempList.get(0).getKnifeCode(), countMap.get(sitmTempList.get(0).getKnifeCode()) + bom.getStandardDosage() * knifeCount.get());
@ -222,18 +263,18 @@ public class BaseKnifeController extends BaseController {
if (sitmTempList.size() < countMap.get(sitmTempList.get(0).getKnifeCode()) && countMap.get(sitmTempList.get(0).getKnifeCode()) > bom.getStandardDosage() * knifeCount.get()) {
operLog.setJsonResult("基础物料不足进行组装工具:" + techBom.getKnifeCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("基础物料不足进行组装工具", bom.getMdItemCode());
throw new RuntimeException("基础物料不足进行组装工具" + bom.getMdItemCode());
}
}
} else {
operLog.setJsonResult("暂无记录整刀bom项" + techBom.getKnifeCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("暂无记录整刀bom项", techBom.getKnifeCode());
throw new RuntimeException("暂无记录整刀bom项" + techBom.getKnifeCode());
}
} else {
operLog.setJsonResult("基础物料不足:" + techBom.getKnifeCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("基础物料不足", techBom.getKnifeCode());
throw new RuntimeException("基础物料不足" + techBom.getKnifeCode());
}
} else {
// 将物料填入集合
@ -253,7 +294,7 @@ public class BaseKnifeController extends BaseController {
if (bomRouteList.isEmpty()) {
operLog.setJsonResult("Bom头查询错误" + techBom.getKnifeCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("Bom头查询错误", techBom.getKnifeCode());
throw new RuntimeException("Bom头查询错误" + techBom.getKnifeCode());
}
BomRoute bomRoute = bomRouteService.selectBomRouteByBomRouteId(bomRouteList.get(0).getBomRouteId());
@ -269,14 +310,14 @@ public class BaseKnifeController extends BaseController {
if (sitmTempList.isEmpty()) {
operLog.setJsonResult("基础物料不足进行组装工具:" + bom.getMdItemCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("基础物料不足进行组装工具", bom.getMdItemCode());
throw new RuntimeException("基础物料不足进行组装工具" + bom.getMdItemCode());
} else if (countMap.get(sitmTempList.get(0).getKnifeCode()) == null) {
if (sitmTempList.size() >= bom.getStandardDosage() * knifeCount.get()) {
countMap.put(sitmTempList.get(0).getKnifeCode(), bom.getStandardDosage() * knifeCount.get());
} else {
operLog.setJsonResult("基础物料不足进行组装工具:" + bom.getMdItemCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("基础物料不足进行组装工具", bom.getMdItemCode());
throw new RuntimeException("基础物料不足进行组装工具" + bom.getMdItemCode());
}
} else {
countMap.put(sitmTempList.get(0).getKnifeCode(), countMap.get(sitmTempList.get(0).getKnifeCode()) + bom.getStandardDosage() * knifeCount.get());
@ -286,18 +327,18 @@ public class BaseKnifeController extends BaseController {
if (sitmTempList.size() < countMap.get(sitmTempList.get(0).getKnifeCode()) && countMap.get(sitmTempList.get(0).getKnifeCode()) > bom.getStandardDosage() * knifeCount.get()) {
operLog.setJsonResult("基础物料不足进行组装工具:" + techBom.getKnifeCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("基础物料不足进行组装工具", bom.getMdItemCode());
throw new RuntimeException("基础物料不足进行组装工具" + bom.getMdItemCode());
}
}
} else {
operLog.setJsonResult("暂无记录整刀bom项" + techBom.getKnifeCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("暂无记录整刀bom项", techBom.getKnifeCode());
throw new RuntimeException("暂无记录整刀bom项" + techBom.getKnifeCode());
}
} else {
operLog.setJsonResult("基础物料不足:" + techBom.getKnifeCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("基础物料不足", techBom.getKnifeCode());
throw new RuntimeException("基础物料不足" + techBom.getKnifeCode());
}
}
}
@ -313,31 +354,37 @@ public class BaseKnifeController extends BaseController {
@PostMapping("/open/productionArrangements")
@ResponseBody
@Transactional
public AjaxResult productionArrangements(@RequestBody ProductionArrangements productionArrangements) {
// 检查计划单是否已存在
public AjaxResult productionArrangements(@RequestBody ProductionArrangements productionArrangements) throws IOException {
// 检查计划单是否已存在 从台账表中寻找
BaseKnife baseKnifePlan = new BaseKnife();
baseKnifePlan.setPlanSheet(productionArrangements.getPlanSheet());
if (!baseKnifeService.selectBaseKnifeList(baseKnifePlan).isEmpty())
return AjaxResult.error("该计划单已存在,请更换重试");
// 检查计划单是否已存在 从组装任务表中寻找
WmsZdTask wmsZdTaskValid = new WmsZdTask();
wmsZdTaskValid.setPlanSheet(productionArrangements.getPlanSheet());
if (!zdTaskService.selectWmsZdTaskList(wmsZdTaskValid).isEmpty())
return AjaxResult.error("该计划单已存在,请更换重试");
// 检查计划单是否已存在 从物料预订表中寻找
BaseKnifeLocked baseKnifeLockedValid = new BaseKnifeLocked();
baseKnifeLockedValid.setPlanSheet(productionArrangements.getPlanSheet());
if (!baseKnifeLockedMapper.selectBaseKnifeLockedList(baseKnifeLockedValid).isEmpty())
return AjaxResult.error("该计划单已存在,请更换重试");
// 齐套性检查
AjaxResult ajaxResult = this.checkForAlignment(productionArrangements.getProcessCodes());
if (Integer.parseInt(String.valueOf(ajaxResult.get("code"))) != 200) {
return AjaxResult.error(ajaxResult.get("msg").toString(), ajaxResult.get("data"));
}
// 验证bom工艺
List<BaseTechnologyBom> technologyBomList = baseTechnologyBomService.selectBaseTechnologyBomListByProcessCodeList(productionArrangements.getProcessCodes());
// 验证工艺BOM是否存在
BaseTechnologyBom baseTechnologyBomWrapper = new BaseTechnologyBom();
baseTechnologyBomWrapper.setTechnologyCode(productionArrangements.getTechnologyCode());
List<BaseTechnologyBom> technologyBomList = baseTechnologyBomService.selectBaseTechnologyBomList(baseTechnologyBomWrapper);
if (technologyBomList.isEmpty() || technologyBomList.size() == 1 && technologyBomList.get(0).getKnifeCode() == null)
return AjaxResult.error("未检测到工艺bom项");
// 记录数据修改
// 记录已经列入订单需求的物料数据
List<BaseKnife> baseKnifeOriginList = new ArrayList<>();
// 参数列表
Map<String, Object> params = new HashMap<>();
params.put("planCode", productionArrangements.getPlanSheet());
params.put("processCodeList", productionArrangements.getProcessCodes());
params.put("processCode", productionArrangements.getTechnologyCode());
params.put("processUnit", productionArrangements.getProcessUnit());
// 构建日志
@ -356,8 +403,9 @@ public class BaseKnifeController extends BaseController {
// 接口返回信息
String msg = "生产准备验证成功!";
// 记录所需物料数量的map
// 记录所符合需求的物料数量 map 需要组装的物料数量
Map<String, Integer> countMap = new HashMap<>();
Map<String, Integer> zdTaskMap = new HashMap<>();
BaseKnife baseKnifeWrapper = new BaseKnife();
BomRoute bomRouteTemp = new BomRoute();
MdItem mdItemTemp = new MdItem();
@ -366,21 +414,21 @@ public class BaseKnifeController extends BaseController {
for (BaseTechnologyBom techBom : technologyBomList) {
// 空则0
countMap.putIfAbsent(techBom.getKnifeCode(), 0);
zdTaskMap.putIfAbsent(techBom.getKnifeCode(), 0);
// 台账表中查询工具 并记录数量
// 查询物料编码是否存在
mdItemTemp = mdItemService.selectMdItemByCode(techBom.getKnifeCode());
if (mdItemTemp == null) {
baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife));
operLog.setJsonResult("物料台账查询错误:" + techBom.getKnifeCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("物料台账查询错误", techBom.getKnifeCode());
throw new RuntimeException("物料台账查询错误" + techBom.getKnifeCode());
}
// 查询复合条件的台账
// 查询符合条件的台账 锁定状态为 0 空闲中
baseKnifeWrapper.setMbbBdMrlId(mdItemTemp.getItemId());
baseKnifeWrapper.setIsLocked(0);
List<BaseKnife> tempList = this.baseKnifeService.selectBaseKnifeList(baseKnifeWrapper);
tempList.removeIf(baseKnife -> baseKnife.getKnifeLife() + baseKnife.getResetCount() * 100 < techBom.getExpendLife());
// 记录此项工艺需要的物料数量
AtomicInteger knifeCount = new AtomicInteger(techBom.getKnifeCount());
// 如果台账表中不存在尝试组刀任务查询
@ -390,59 +438,63 @@ public class BaseKnifeController extends BaseController {
bomRouteTemp.setMdItemId(mdItemTemp.getItemId());
List<BomRoute> bomRouteList = bomRouteService.selectBomRouteList(bomRouteTemp);
if (bomRouteList.isEmpty()) {
baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife));
operLog.setJsonResult("Bom头查询错误" + techBom.getKnifeCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("Bom头查询错误", techBom.getKnifeCode());
throw new RuntimeException("Bom头查询错误" + techBom.getKnifeCode());
}
// 获取整刀BOM 进行子项遍历
BomRoute bomRoute = bomRouteService.selectBomRouteByBomRouteId(bomRouteList.get(0).getBomRouteId());
if (!bomRoute.getMbbProduBomList().isEmpty()) {
// 遍历bom项 从台账表中筛选对应基础物料
for (MbbProduBom bom : bomRoute.getMbbProduBomList()) {
// 查询基础物料不包含已锁定的
baseKnifeWrapper.setMbbBdMrlId(bom.getMdItemId());
baseKnifeWrapper.setIsLocked(0);
List<BaseKnife> sitmTempList = baseKnifeService.selectBaseKnifeList(baseKnifeWrapper);
if (sitmTempList.isEmpty()) {
baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife));
operLog.setJsonResult("基础物料不足进行组装工具:" + bom.getMdItemCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("基础物料不足进行组装工具", bom.getMdItemCode());
} else if (countMap.get(sitmTempList.get(0).getKnifeCode()) == null) {
if (sitmTempList.size() >= bom.getStandardDosage() * knifeCount.get()) {
countMap.put(sitmTempList.get(0).getKnifeCode(), bom.getStandardDosage() * knifeCount.get());
} else {
baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife));
operLog.setJsonResult("基础物料不足进行组装工具:" + bom.getMdItemCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("基础物料不足进行组装工具", bom.getMdItemCode());
}
// 记录需要组装的数量 能够组装的数量
int knifeNeedQuantity = zdTaskMap.get(techBom.getKnifeCode()) + techBom.getKnifeCount();
int knifeHaveQuantity = this.getBomZdTaskQuantity(bomRoute, knifeNeedQuantity);
// 如果组装出来的数量不够 去预订其他订单中的
if (knifeHaveQuantity < knifeNeedQuantity) {
// 当前库内无符合需求的物料 尝试查询已经在订单中的刀但作业时间不同
List<Long> lockedBaseKnifeIds = this.getLockedBaseKnifeId(mdItemTemp.getItemCode(), productionArrangements, knifeNeedQuantity - knifeHaveQuantity);
if (!lockedBaseKnifeIds.isEmpty()) {
lockedBaseKnifeIds.forEach(lockedBaseKnifeId -> {
BaseKnife lockedBaseKnife = baseKnifeService.selectBaseKnifeByBaseKnifeId(lockedBaseKnifeId);
// 新增一条台账锁定记录 预订台账
BaseKnifeLocked baseKnifeLocked = new BaseKnifeLocked();
baseKnifeLocked.setPlanSheet(productionArrangements.getPlanSheet());
baseKnifeLocked.setStatus(0); // 状态未完成
baseKnifeLocked.setLockedStartTime(productionArrangements.getStartTime());
baseKnifeLocked.setLockedEndTime(productionArrangements.getEndTime());
baseKnifeLocked.setItemCode(lockedBaseKnife.getKnifeCode());
baseKnifeLocked.setBaseKnifeId(lockedBaseKnife.getBaseKnifeId());
baseKnifeLockedMapper.insertBaseKnifeLocked(baseKnifeLocked);
});
// 更新需要组装的数量 生产准备中已准备好的数量
zdTaskMap.put(techBom.getKnifeCode(), knifeHaveQuantity);
countMap.put(techBom.getKnifeCode(), countMap.get(techBom.getKnifeCode()) + lockedBaseKnifeIds.size());
msg = msg + "【已预订" + lockedBaseKnifeIds.size() + "把整刀】";
} else {
countMap.put(sitmTempList.get(0).getKnifeCode(), countMap.get(sitmTempList.get(0).getKnifeCode()) + bom.getStandardDosage() * knifeCount.get());
}
// 判断基础物料是否充足
if (sitmTempList.size() < countMap.get(sitmTempList.get(0).getKnifeCode()) && countMap.get(sitmTempList.get(0).getKnifeCode()) > bom.getStandardDosage() * knifeCount.get()) {
baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife));
operLog.setJsonResult("基础物料不足进行组装工具:" + techBom.getKnifeCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("基础物料不足进行组装工具", bom.getMdItemCode());
throw new RuntimeException("基础物料不足进行组装工具" + techBom.getKnifeCode());
}
} else {
// 更新需要组装的数量 生产准备中已准备好的数量
zdTaskMap.put(techBom.getKnifeCode(), knifeHaveQuantity);
countMap.put(techBom.getKnifeCode(), countMap.get(techBom.getKnifeCode()) + knifeNeedQuantity);
}
} else {
baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife));
operLog.setJsonResult("暂无记录整刀bom项" + techBom.getKnifeCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("暂无记录整刀bom项", techBom.getKnifeCode());
throw new RuntimeException("暂无记录整刀bom项" + techBom.getKnifeCode());
}
} else {
baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife));
operLog.setJsonResult("基础物料不足:" + techBom.getKnifeCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("基础物料不足", techBom.getKnifeCode());
throw new RuntimeException("基础物料不足" + techBom.getKnifeCode());
}
} else {
// 将物料填入集合
@ -451,13 +503,15 @@ public class BaseKnifeController extends BaseController {
// 更新数量
knifeCount.getAndDecrement();
countMap.put(item.getKnifeCode(), countMap.get(item.getKnifeCode()) + 1);
// 记录源数据然后锁定
baseKnifeOriginList.add(item);
// 锁定
item.setPlanSheet(productionArrangements.getPlanSheet());
item.setIsLocked(1);
item.setLockedStartTime(techBom.getLockedStartTime());
item.setLockedEndTime(techBom.getLockedEndTime());
item.setIsLocked(1); // 锁定整刀台账
item.setLockedStartTime(productionArrangements.getStartTime());
item.setLockedEndTime(productionArrangements.getEndTime());
baseKnifeService.updateBaseKnife(item);
// 记录锁定记录
baseKnifeOriginList.add(item);
}
});
if (knifeCount.get() > 0) {
@ -467,125 +521,100 @@ public class BaseKnifeController extends BaseController {
List<BomRoute> bomRouteList = bomRouteService.selectBomRouteList(bomRouteTemp);
if (bomRouteList.isEmpty()) {
baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife));
operLog.setJsonResult("Bom头查询错误" + techBom.getKnifeCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("Bom头查询错误", techBom.getKnifeCode());
throw new RuntimeException("Bom头查询错误" + techBom.getKnifeCode());
}
// 获取整刀BOM 进行子项遍历
BomRoute bomRoute = bomRouteService.selectBomRouteByBomRouteId(bomRouteList.get(0).getBomRouteId());
if (!bomRoute.getMbbProduBomList().isEmpty()) {
// 遍历bom项 从台账表中筛选对应基础物料
for (MbbProduBom bom : bomRoute.getMbbProduBomList()) {
// 查询基础物料不包含已锁定的
baseKnifeWrapper.setMbbBdMrlId(bom.getMdItemId());
baseKnifeWrapper.setIsLocked(0);
List<BaseKnife> sitmTempList = baseKnifeService.selectBaseKnifeList(baseKnifeWrapper);
if (sitmTempList.isEmpty()) {
baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife));
operLog.setJsonResult("基础物料不足进行组装工具:" + bom.getMdItemCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("基础物料不足进行组装工具", bom.getMdItemCode());
} else if (countMap.get(sitmTempList.get(0).getKnifeCode()) == null) {
if (sitmTempList.size() >= bom.getStandardDosage() * knifeCount.get()) {
countMap.put(sitmTempList.get(0).getKnifeCode(), bom.getStandardDosage() * knifeCount.get());
} else {
baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife));
operLog.setJsonResult("基础物料不足进行组装工具:" + bom.getMdItemCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("基础物料不足进行组装工具", bom.getMdItemCode());
}
// 记录需要组装的数量 能够组装的数量
int knifeNeedQuantity = zdTaskMap.get(techBom.getKnifeCode()) + knifeCount.get();
int knifeHaveQuantity = this.getBomZdTaskQuantity(bomRoute, knifeNeedQuantity);
// 如果组装出来的数量不够 去预订其他订单中的
if (knifeHaveQuantity < knifeNeedQuantity) {
// 当前库内无符合需求的物料 尝试查询已经在订单中的刀但作业时间不同
List<Long> lockedBaseKnifeIds = this.getLockedBaseKnifeId(mdItemTemp.getItemCode(), productionArrangements, knifeNeedQuantity - knifeHaveQuantity);
if (!lockedBaseKnifeIds.isEmpty()) {
lockedBaseKnifeIds.forEach(lockedBaseKnifeId -> {
BaseKnife lockedBaseKnife = baseKnifeService.selectBaseKnifeByBaseKnifeId(lockedBaseKnifeId);
// 新增一条台账锁定记录 预订台账
BaseKnifeLocked baseKnifeLocked = new BaseKnifeLocked();
baseKnifeLocked.setPlanSheet(productionArrangements.getPlanSheet());
baseKnifeLocked.setStatus(0);
baseKnifeLocked.setLockedStartTime(productionArrangements.getStartTime());
baseKnifeLocked.setLockedEndTime(productionArrangements.getEndTime());
baseKnifeLocked.setItemCode(lockedBaseKnife.getKnifeCode());
baseKnifeLocked.setBaseKnifeId(lockedBaseKnife.getBaseKnifeId());
baseKnifeLockedMapper.insertBaseKnifeLocked(baseKnifeLocked);
});
// 更新需要组装的数量 生产准备中已准备好的数量
zdTaskMap.put(techBom.getKnifeCode(), knifeHaveQuantity);
countMap.put(techBom.getKnifeCode(), countMap.get(techBom.getKnifeCode()) + lockedBaseKnifeIds.size());
msg = msg + "【已预订" + lockedBaseKnifeIds.size() + "把整刀】";
} else {
countMap.put(sitmTempList.get(0).getKnifeCode(), countMap.get(sitmTempList.get(0).getKnifeCode()) + bom.getStandardDosage() * knifeCount.get());
}
// 判断基础物料是否充足
if (sitmTempList.size() < countMap.get(sitmTempList.get(0).getKnifeCode()) && countMap.get(sitmTempList.get(0).getKnifeCode()) > bom.getStandardDosage() * knifeCount.get()) {
baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife));
operLog.setJsonResult("基础物料不足进行组装工具:" + techBom.getKnifeCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("基础物料不足进行组装工具", bom.getMdItemCode());
throw new RuntimeException("基础物料不足进行组装工具" + techBom.getKnifeCode());
}
} else {
// 更新需要组装的数量 生产准备中已准备好的数量
zdTaskMap.put(techBom.getKnifeCode(), knifeHaveQuantity);
countMap.put(techBom.getKnifeCode(), countMap.get(techBom.getKnifeCode()) + knifeNeedQuantity);
}
} else {
baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife));
operLog.setJsonResult("暂无记录整刀bom项" + techBom.getKnifeCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("暂无记录整刀bom项", techBom.getKnifeCode());
throw new RuntimeException("暂无记录整刀bom项" + techBom.getKnifeCode());
}
} else {
baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife));
operLog.setJsonResult("基础物料不足:" + techBom.getKnifeCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("基础物料不足", techBom.getKnifeCode());
throw new RuntimeException("基础物料不足" + techBom.getKnifeCode());
}
}
}
}
// 组刀
MdItem mdItem;
List<BaseKnife> baseKnifeList;
int count;
List<MbbProduBom> bomList;
for (BaseTechnologyBom techBom : technologyBomList) {
mdItem = mdItemService.selectMdItemByCode(techBom.getKnifeCode());
count = techBom.getKnifeCount() - countMap.get(techBom.getKnifeCode());
for (Map.Entry<String, Integer> zdTaskItem : zdTaskMap.entrySet()){
if (zdTaskItem.getValue() != 0){
MdItem mdItem = mdItemService.selectMdItemByCode(zdTaskItem.getKey());
BomRoute bomRouteWrapper = new BomRoute();
bomRouteWrapper.setMdItemId(mdItem.getItemId());
List<BomRoute> bomRouteList = bomRouteService.selectBomRouteList(bomRouteWrapper);
// 先从台账表找
baseKnifeWrapper.setMbbBdMrlId(mdItem.getItemId());
baseKnifeWrapper.setIsLocked(0);
baseKnifeList = baseKnifeService.selectBaseKnifeList(baseKnifeWrapper);
baseKnifeList.removeIf(baseKnife -> baseKnife.getKnifeLife() + baseKnife.getResetCount() * 100 < techBom.getExpendLife());
for (BaseKnife wmsBaseKnife : baseKnifeList) {
if (wmsBaseKnife.getKnifeLife() >= techBom.getExpendLife() && count > 0) {
count--;
}
}
// 整刀不足进行组装
if (count > 0) {
if ("PRODUCT".equals(mdItem.getItemOrProduct())) {
// 查询整刀bom项 如果不存在说明 为基础物料或者没有记录此整刀的组装
bomRouteTemp.setMdItemId(mdItem.getItemId());
List<BomRoute> bomRouteList = bomRouteService.selectBomRouteList(bomRouteTemp);
if (bomRouteList.isEmpty()) {
baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife));
operLog.setJsonResult("Bom头查询错误" + techBom.getKnifeCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("Bom头查询错误", techBom.getKnifeCode());
}
// 生成组装任务
WmsZdTask wmsZdTask = new WmsZdTask();
wmsZdTask.setmProductId(mdItem.getItemId());
wmsZdTask.setPlanSheet(productionArrangements.getPlanSheet());
wmsZdTask.setCode(generateTaskCode(techBom.getProcessCode()));
wmsZdTask.setName(techBom.getProcessName());
wmsZdTask.setProductIdQty(count);
wmsZdTask.setBomId(bomRouteList.get(0).getBomRouteId());
wmsZdTask.setCreateTime(DateUtils.getNowDate());
zdTaskService.insertWmsZdTask(wmsZdTask);
msg = "生产准备验证成功!缺少物料已生成组装任务!";
} else {
baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife));
operLog.setJsonResult("缺少BOM项" + techBom.getKnifeCode());
operLogService.insertOperlog(operLog);
return AjaxResult.error("缺少BOM项", techBom.getKnifeCode());
}
// 生成组装任务
WmsZdTask wmsZdTask = new WmsZdTask();
wmsZdTask.setmProductId(mdItem.getItemId());
wmsZdTask.setPlanSheet(productionArrangements.getPlanSheet());
wmsZdTask.setCode(generateTaskCode(productionArrangements.getTechnologyCode()));
wmsZdTask.setName(productionArrangements.getPlanSheet());
wmsZdTask.setProductIdQty(zdTaskItem.getValue());
wmsZdTask.setBomId(bomRouteList.get(0).getBomRouteId());
wmsZdTask.setCreateTime(DateUtils.getNowDate());
zdTaskService.insertWmsZdTask(wmsZdTask);
msg = "生产准备验证成功!缺少物料已生成组装任务!";
}
}
// 添加生产准备记录
productionArrangements.setProcessCode(productionArrangements.getProcessCodes().toString());
productionArrangements.setTechnologyCode(productionArrangements.getTechnologyCode());
productionArrangements.setProcessUnit(productionArrangements.getProcessUnit());
productionArrangements.setStatus(0);
productionArrangements.setStartTime(productionArrangements.getStartTime());
productionArrangements.setEndTime(productionArrangements.getEndTime());
productionArrangements.setCreateTime(DateUtils.getNowDate());
productionArrangementsMapper.insertProductionArrangements(productionArrangements);
if (!msg.contains("缺少物料已生成组装任务!")){
if (!msg.contains("缺少物料已生成组装任务!") && !msg.contains("已预订")) {
// 生成出库计划单
WmsOutPlan outPlan = new WmsOutPlan();
outPlan.setPlanCode(productionArrangements.getPlanSheet());
@ -610,9 +639,15 @@ public class BaseKnifeController extends BaseController {
// 对当前台账对象进行收录
baseKnifeHashMapMap.get(item.getMbbBdMrlId()).get(item.getAreaCode()).add(item);
// 出库
item.setKnifeFineState(2);
baseKnifeService.updateBaseKnife(item);
// 新增一条台账锁定记录 预订台账
BaseKnifeLocked baseKnifeLocked = new BaseKnifeLocked();
baseKnifeLocked.setPlanSheet(productionArrangements.getPlanSheet());
baseKnifeLocked.setStatus(0);
baseKnifeLocked.setLockedStartTime(productionArrangements.getStartTime());
baseKnifeLocked.setLockedEndTime(productionArrangements.getEndTime());
baseKnifeLocked.setItemCode(item.getKnifeCode());
baseKnifeLocked.setBaseKnifeId(item.getBaseKnifeId());
baseKnifeLockedMapper.insertBaseKnifeLocked(baseKnifeLocked);
});
// 生成出库计划明细
@ -685,6 +720,7 @@ public class BaseKnifeController extends BaseController {
productionArrangements.setStatus(1);
productionArrangementsMapper.updateProductionArrangements(productionArrangements);
this.productionArrangementsIsOk(productionArrangements);
}
operLog.setJsonResult(msg);
@ -693,6 +729,153 @@ public class BaseKnifeController extends BaseController {
return AjaxResult.success(msg);
}
// 调用生产准备完成接口
public void productionArrangementsIsOk(ProductionArrangements productionArrangements) throws IOException {
// 产线控制系统生产准备完成接口
String url = myConfig.getProductionControlPath() + "/cutterapi/cutComplete";
// 请求客户端
OkHttpClient client = new OkHttpClient();
// 构建请求数据
Map<String, Object> requestMap = new HashMap<>();
requestMap.put("prodordercode", productionArrangements.getPlanSheet());
requestMap.put("result", "0");
requestMap.put("completetime", CalendarUtil.getDateTimeStr());
// 获取工艺信息
BaseTechnologyBom technologyBomWrapper = new BaseTechnologyBom();
technologyBomWrapper.setTechnologyCode(productionArrangements.getTechnologyCode());
List<BaseTechnologyBom> technologyBomList = baseTechnologyBomService.selectBaseTechnologyBomList(technologyBomWrapper);
BaseKnife baseKnifeWrapper = new BaseKnife();
baseKnifeWrapper.setPlanSheet(productionArrangements.getPlanSheet());
// 获取刀具信息
List<Map<String, String>> cutterList = new ArrayList<>();
technologyBomList.forEach(baseTechnologyBom -> {
baseKnifeWrapper.setKnifeCode(baseTechnologyBom.getKnifeCode());
List<BaseKnife> baseKnifeList = baseKnifeService.selectBaseKnifeList(baseKnifeWrapper);
baseKnifeList.forEach(baseKnife -> {
Map<String, String> map = new HashMap<>();
map.put("specno", baseTechnologyBom.getProcessCode());
map.put("code", baseKnife.getKnifeCode());
map.put("name", baseKnife.getKnifeName());
map.put("life", baseKnife.getKnifeLife().toString());
cutterList.add(map);
});
});
requestMap.put("cutterinfo", cutterList);
// 构建请求数据
MediaType mediaType = MediaType.parse("application/json; charset=utf-8");
okhttp3.RequestBody requestBody = okhttp3.RequestBody.create(mediaType, JSON.toJSONString(requestMap));
// 请求体
Request request = new Request.Builder()
.url(url)
.post(requestBody)
.build();
// 发送请求
try(Response response = client.newCall(request).execute()) {
if (!response.isSuccessful())
throw new IOException("Unexpected code " + response);
// 请求响应
String responseBody = response.body().string();
System.out.println(responseBody);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
public int getBomZdTaskQuantity(BomRoute bomRoute, Integer knifeCount){
// 记录基础物料数量的map
Map<String, Integer> baseKnifeItemCount = new HashMap<>();
// 遍历bom项 从台账表中筛选对应基础物料
for (MbbProduBom bom : bomRoute.getMbbProduBomList()) {
// 查询基础物料不包含已锁定的
BaseKnife baseKnifeWrapper = new BaseKnife();
baseKnifeWrapper.setMbbBdMrlId(bom.getMdItemId());
baseKnifeWrapper.setIsLocked(0);
List<BaseKnife> sitmTempList = baseKnifeService.selectBaseKnifeList(baseKnifeWrapper);
// 填充基础物料数量
baseKnifeItemCount.put(bom.getMdItemCode(), sitmTempList.size());
}
// 更具需要的物料数量计算基础物料能组装多少
for (int i = 0; i < knifeCount; i++){
// 遍历bom项 并减去数量
for (MbbProduBom bom : bomRoute.getMbbProduBomList()) {
if (baseKnifeItemCount.get(bom.getMdItemCode()) - bom.getStandardDosage() >= 0){
baseKnifeItemCount.put(bom.getMdItemCode(), baseKnifeItemCount.get(bom.getMdItemCode()) - bom.getStandardDosage());
} else return i;
}
}
return knifeCount;
}
public List<Long> getLockedBaseKnifeId(String mdItemCode, ProductionArrangements productionArrangements, int count){
// 查询该物料编码的锁定记录
BaseKnifeLocked baseKnifeLockedWrapper = new BaseKnifeLocked();
baseKnifeLockedWrapper.setItemCode(mdItemCode);
baseKnifeLockedWrapper.setStatus(0);
List<BaseKnifeLocked> baseKnifeLockedList = baseKnifeLockedMapper.selectBaseKnifeLockedList(baseKnifeLockedWrapper);
// 根据台账ID进行分组
Map<Long, List<BaseKnifeLocked>> groupBaseKnifeLocked = new HashMap<>();
for (BaseKnifeLocked item : baseKnifeLockedList){
Long key = item.getBaseKnifeId();
// 判断是否已经锁定, 未锁定则跳过
BaseKnife baseKnife = baseKnifeService.selectBaseKnifeByBaseKnifeId(key);
if (baseKnife.getIsLocked() == 0 ) continue;
// 进行分组
if (groupBaseKnifeLocked.containsKey(key)){
groupBaseKnifeLocked.get(key).add(item);
} else {
List<BaseKnifeLocked> tempList = new ArrayList<>();
tempList.add(item);
groupBaseKnifeLocked.put(key, tempList);
}
}
// 遍历获取锁定时间不吻合的项
List<Long> lockedBaseKnifeIds = new ArrayList<>();
for (Map.Entry<Long, List<BaseKnifeLocked>> entry : groupBaseKnifeLocked.entrySet()){
if (count > 0){
boolean flag = true;
for (BaseKnifeLocked baseKnifeLocked : entry.getValue()){
// 如果已经锁定的开始时间在生产计划开始时间之后并且结束时间在生产计划开始时间之后则不符合
if (baseKnifeLocked.getLockedStartTime().getTime() < productionArrangements.getStartTime().getTime()){
if (baseKnifeLocked.getLockedEndTime().getTime() > productionArrangements.getStartTime().getTime()) {
flag = false;
break;
}
} else { // 如果已经锁定的开始时间在生产计划开始时间之前并且开始时间在生产计划结束时间之前则不符合
if (baseKnifeLocked.getLockedStartTime().getTime() < productionArrangements.getEndTime().getTime()) {
flag = false;
break;
}
}
}
if (flag) {
lockedBaseKnifeIds.add(entry.getKey());
count--;
}
} else return lockedBaseKnifeIds;
}
// 数量是否足够
if (count > 0) return new ArrayList<>();
else return lockedBaseKnifeIds;
}
/**
* 修改工具台账
@ -717,7 +900,7 @@ public class BaseKnifeController extends BaseController {
// 如果未锁定的物料不足所需数量
if (baseKnifeList.size() < mbbProduBom.getStandardDosage() * zdTask.getProductIdQty())
return AjaxResult.error("bom物料不足进行组装" + mbbProduBom.getMdItemCode());
throw new RuntimeException("bom物料不足进行组装" + mbbProduBom.getMdItemCode());
}
List<WmsOutPlanDetail> wmsOutPlanDetailList = new ArrayList<>();
@ -805,6 +988,7 @@ public class BaseKnifeController extends BaseController {
outPlanDetail.setWmStorageAreaCode(wmStorageArea.getAreaCode());
outPlanDetail.setWmStorageAreaName(wmStorageArea.getAreaName());
outPlanDetail.setDetailState("1");
outPlanDetail.setCreateTime(DateUtils.getNowDate());
wmsOutPlanDetailList.add(outPlanDetail);
}
@ -890,11 +1074,12 @@ public class BaseKnifeController extends BaseController {
if (wmsInPlan == null) {
WmsInPlan wmsInPlanTemp = new WmsInPlan();
wmsInPlanTemp.setState("1");
wmsInPlanTemp.setSourceType("SGLR");
wmsInPlanTemp.setSourceType("SCZB");
wmsInPlanTemp.setCellCode(zdTask.getAttr3());
wmsInPlanTemp.setPlanCode(zdTask.getAttr4() == null ? zdTask.getCode() : zdTask.getAttr4());
wmsInPlanTemp.setRelBillCode("组装单据");
wmsInPlanTemp.setPlanTypeId("13");
wmsInPlanTemp.setPlanTypeId(9L);
wmsInPlanTemp.setPlanTypeCode("ZDHK");
wmsInPlanTemp.setCreateBy(getUsername());
wmsInPlanTemp.setCreateTime(DateUtils.getNowDate());
@ -932,7 +1117,7 @@ public class BaseKnifeController extends BaseController {
// 生成任务号
String taskInCode = MultiModuleCodeGenerator.generateTaskCode("RKT");
wmsInTask.setTaskInCode(taskInCode);
wmsInTask.setPlanInId(wmsInPlan.getPlanId().toString());
wmsInTask.setPlanInId(wmsInPlan.getPlanId());
wmsInTask.setPlanInCode(wmsInPlan.getPlanCode());
wmsInTask.setMaterialCode(mdItem.getItemCode());
wmsInTask.setTaskInQuantity(zdTask.getProductIdQty());
@ -942,6 +1127,7 @@ public class BaseKnifeController extends BaseController {
wmsInTask.setBatch(batchNum);
wmsInTask.setMaterialId(zdTask.getmProductId().toString());
wmsInTask.setPlanTypeId("9");
wmsInTask.setPlanTypeCode("ZDHK");
wmsInTask.setPlanInStatus("1");
wmsInTaskService.insertWmsInTask(wmsInTask);
@ -1008,6 +1194,7 @@ public class BaseKnifeController extends BaseController {
@Log(title = "工具台账", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BaseKnife baseKnife) {
baseKnife.setCreateBy(getUsername());
return toAjax(baseKnifeService.insertBaseKnife(baseKnife));
}
@ -1018,6 +1205,7 @@ public class BaseKnifeController extends BaseController {
@Log(title = "工具台账", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BaseKnife baseKnife) {
baseKnife.setUpdateBy(getUsername());
return toAjax(baseKnifeService.updateBaseKnife(baseKnife));
}

View File

@ -7,14 +7,20 @@ import com.ktg.common.core.domain.AjaxResult;
import com.ktg.common.core.page.TableDataInfo;
import com.ktg.common.enums.BusinessType;
import com.ktg.common.utils.poi.ExcelUtil;
import com.ktg.mes.md.domain.WmsOutPlan;
import com.ktg.mes.md.domain.WmsOutPlanDetailEntity;
import com.ktg.generator.util.MultiModuleCodeGenerator;
import com.ktg.mes.md.domain.*;
import com.ktg.mes.md.domain.dto.WmsOutboundOrderDto;
import com.ktg.mes.md.service.IMdItemService;
import com.ktg.mes.md.service.IWmsBusinessTypeService;
import com.ktg.mes.md.service.IWmsOutPlanService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -26,9 +32,11 @@ import java.util.List;
*/
@RestController
@RequestMapping("/md/PLAN")
@RequiredArgsConstructor
public class WmsOutPlanController extends BaseController {
@Autowired
private IWmsOutPlanService wmsOutPlanService;
private final IWmsOutPlanService wmsOutPlanService;
private final IWmsBusinessTypeService wmsBusinessTypeService;
private final IMdItemService mdItemService;
/**
* 查询出库计划管理列表
@ -40,6 +48,75 @@ public class WmsOutPlanController extends BaseController {
return getDataTable(list);
}
@PostMapping("/open/add")
public AjaxResult openAdd(@RequestBody WmsOutPlan wmsOutPlan) {
// 出库计划编码自动生成
if (wmsOutPlan.getPlanCode() == null || wmsOutPlan.getPlanCode().isEmpty()) {
wmsOutPlan.setPlanCode(MultiModuleCodeGenerator.generateTaskCode("CKP"));
}
return toAjax(wmsOutPlanService.insertWmsOutPlanAndRun(wmsOutPlan));
}
/**
* 订单生成出库计划
* @param wmsOutboundOrderDto
* @return
*/
@PostMapping("/open/order/add")
public AjaxResult openOrderAdd(@RequestBody @Valid WmsOutboundOrderDto wmsOutboundOrderDto) {
// 查询业务类型
WmsBusinessType wmsBusinessType = wmsBusinessTypeService.selectWmsBusinessTypeByCode(wmsOutboundOrderDto.getTypeCode());
if (wmsBusinessType == null) {
return AjaxResult.error("出库类型编码错误:" + wmsOutboundOrderDto.getTypeCode());
}
// 查询物料信息
MdItem mdItem = mdItemService.selectMdItemByCode(wmsOutboundOrderDto.getMaterialCode());
if (mdItem == null) {
return AjaxResult.error("物料编码错误:" + wmsOutboundOrderDto.getMaterialCode());
}
// 创建出库计划
WmsOutPlan wmsOutPlan = new WmsOutPlan();
wmsOutPlan.setPlanCode(MultiModuleCodeGenerator.generateTaskCode("CKP"));
wmsOutPlan.setWmsBusinessTypeId(wmsBusinessType.getTypeId());
wmsOutPlan.setWmsBusinessType(wmsBusinessType);
wmsOutPlan.setPlanType("SGLR");
wmsOutPlan.setPlanState("0");
wmsOutPlan.setRemark("订单号: " + wmsOutboundOrderDto.getOrderId());
// 创建出库计划明细
ArrayList<WmsOutPlanDetail> wmsOutPlanDetails = getWmsOutPlanDetails(wmsOutboundOrderDto, mdItem);
wmsOutPlan.setWmsOutPlanDetailList(wmsOutPlanDetails);
// 插入出库计划并执行
try {
int i = wmsOutPlanService.insertWmsOutPlanAndRun(wmsOutPlan);
if (i > 0) {
return AjaxResult.success("出库任务创建成功");
} else {
return AjaxResult.error("出库任务创建失败,原因:数据库插入失败");
}
} catch (Exception e) {
return AjaxResult.error("出库任务创建失败,原因:" + e.getMessage());
}
}
private static ArrayList<WmsOutPlanDetail> getWmsOutPlanDetails(WmsOutboundOrderDto wmsOutboundOrderDto, MdItem mdItem) {
WmsOutPlanDetail wmsOutPlanDetail = new WmsOutPlanDetail();
wmsOutPlanDetail.setMdItemId(mdItem.getItemId());
wmsOutPlanDetail.setMdItemName(mdItem.getItemName());
wmsOutPlanDetail.setMdItemCode(mdItem.getItemCode());
wmsOutPlanDetail.setMdItemUnit(mdItem.getUnitName());
wmsOutPlanDetail.setPlannedQuantity(wmsOutboundOrderDto.getQuantity());
wmsOutPlanDetail.setRealQuantity(wmsOutboundOrderDto.getQuantity());
wmsOutPlanDetail.setDetailBatchNum(wmsOutboundOrderDto.getOrderId());
wmsOutPlanDetail.setDetailState("0");
ArrayList<WmsOutPlanDetail> wmsOutPlanDetails = new ArrayList<>();
wmsOutPlanDetails.add(wmsOutPlanDetail);
return wmsOutPlanDetails;
}
/**
* 查询出库计划管理列表
*/
@ -79,8 +156,12 @@ public class WmsOutPlanController extends BaseController {
@Log(title = "出库计划管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WmsOutPlan wmsOutPlan) {
if (UserConstants.NOT_UNIQUE.equals(wmsOutPlanService.checkPlanCodeUnique(wmsOutPlan))) {
return AjaxResult.error("新增出库计划失败,出库计划编码“" + wmsOutPlan.getPlanCode() + "”已存在");
// if (UserConstants.NOT_UNIQUE.equals(wmsOutPlanService.checkPlanCodeUnique(wmsOutPlan))) {
// return AjaxResult.error("新增出库计划失败,出库计划编码“" + wmsOutPlan.getPlanCode() + "”已存在");
// }
// 出库计划编码自动生成
if (wmsOutPlan.getPlanCode() == null || wmsOutPlan.getPlanCode().isEmpty()) {
wmsOutPlan.setPlanCode(MultiModuleCodeGenerator.generateTaskCode("CKP"));
}
wmsOutPlan.setCreateBy(getUsername());
return toAjax(wmsOutPlanService.insertWmsOutPlan(wmsOutPlan));

View File

@ -40,6 +40,11 @@ public class WmsOutTaskController extends BaseController {
return getDataTable(list);
}
@PutMapping("/open/run/{wmsOutTaskIds}")
public AjaxResult openRun(@PathVariable Long[] wmsOutTaskIds) {
return toAjax(wmsOutTaskService.runWmsOutTask(wmsOutTaskIds));
}
/**
* 查询出库任务列表
*/

View File

@ -0,0 +1,134 @@
package com.ktg.mes.md.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ktg.common.annotation.Excel;
import com.ktg.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
/**
* 台账锁定对象 BASE_KNIFE_LOCKED
*
* @author yinjinlu
* @date 2024-12-09
*/
public class BaseKnifeLocked extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 刀具台账 */
@Excel(name = "刀具台账")
private Long baseKnifeId;
/** 计划单 */
@Excel(name = "计划单")
private String planSheet;
/** 计划单 */
@Excel(name = "物料编码")
private String itemCode;
/** 锁定开始时间 */
@Excel(name = "锁定开始时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date lockedStartTime;
/** 锁定结束时间 */
@Excel(name = "锁定结束时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date lockedEndTime;
/** 消耗定额 */
@Excel(name = "消耗定额")
private Integer expendLife;
/** 状态 */
@Excel(name = "状态")
private Integer status;
/** 主键ID */
private Long baseKnifeLockedId;
public void setBaseKnifeId(Long baseKnifeId)
{
this.baseKnifeId = baseKnifeId;
}
public Long getBaseKnifeId()
{
return baseKnifeId;
}
public void setPlanSheet(String planSheet)
{
this.planSheet = planSheet;
}
public String getPlanSheet()
{
return planSheet;
}
public void setLockedStartTime(Date lockedStartTime)
{
this.lockedStartTime = lockedStartTime;
}
public Date getLockedStartTime()
{
return lockedStartTime;
}
public void setLockedEndTime(Date lockedEndTime)
{
this.lockedEndTime = lockedEndTime;
}
public Date getLockedEndTime()
{
return lockedEndTime;
}
public void setBaseKnifeLockedId(Long baseKnifeLockedId)
{
this.baseKnifeLockedId = baseKnifeLockedId;
}
public Long getBaseKnifeLockedId()
{
return baseKnifeLockedId;
}
public String getItemCode() {
return itemCode;
}
public void setItemCode(String itemCode) {
this.itemCode = itemCode;
}
public Integer getExpendLife() {
return expendLife;
}
public void setExpendLife(Integer expendLife) {
this.expendLife = expendLife;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("baseKnifeId", getBaseKnifeId())
.append("planSheet", getPlanSheet())
.append("lockedStartTime", getLockedStartTime())
.append("lockedEndTime", getLockedEndTime())
.append("baseKnifeLockedId", getBaseKnifeLockedId())
.toString();
}
}

View File

@ -72,6 +72,14 @@ public class BaseTechnologyBom extends BaseEntity
@Excel(name = "预留字段4")
private String attr4;
/** 预留字段4 */
@Excel(name = "工艺编码")
private String technologyCode;
/** 预留字段4 */
@Excel(name = "工艺名称")
private String technologyName;
public void setTechnologyBomId(String technologyBomId)
{
this.technologyBomId = technologyBomId;
@ -199,6 +207,22 @@ public class BaseTechnologyBom extends BaseEntity
return attr4;
}
public String getTechnologyCode() {
return technologyCode;
}
public void setTechnologyCode(String technologyCode) {
this.technologyCode = technologyCode;
}
public String getTechnologyName() {
return technologyName;
}
public void setTechnologyName(String technologyName) {
this.technologyName = technologyName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -70,6 +70,10 @@ public class InventoryBatch {
@Excel(name = "入库/出库")
private Integer inOrOut;
@Excel(name = "入库/出库明细")
private List<HashMap<String, Object>> infoList;
/**
* 日期
*/
@ -155,4 +159,12 @@ public class InventoryBatch {
public void setMdItemNum(Integer mdItemNum) {
this.mdItemNum = mdItemNum;
}
public List<HashMap<String, Object>> getInfoList() {
return infoList;
}
public void setInfoList(List<HashMap<String, Object>> infoList) {
this.infoList = infoList;
}
}

View File

@ -42,6 +42,10 @@ public class MbbProduBom extends BaseEntity
@Excel(name = "标准用量")
private Integer standardDosage;
/** 标准用量 */
@Excel(name = "当期库存")
private Long currentInventory;
/** 预留字段1 */
private String attr1;
@ -154,6 +158,14 @@ public class MbbProduBom extends BaseEntity
return attr4;
}
public Long getCurrentInventory() {
return currentInventory;
}
public void setCurrentInventory(Long currentInventory) {
this.currentInventory = currentInventory;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -39,8 +39,8 @@ public class MdItem extends BaseEntity {
private String highValue;
private Integer attr1;
private Integer attr2;
private String attr3;
private String attr4;
private Integer attr3;
private Integer attr4;
private Long count;
@ -203,19 +203,19 @@ public class MdItem extends BaseEntity {
this.attr2 = attr2;
}
public String getAttr3() {
public Integer getAttr3() {
return attr3;
}
public void setAttr3(String attr3) {
public void setAttr3(Integer attr3) {
this.attr3 = attr3;
}
public String getAttr4() {
public Integer getAttr4() {
return attr4;
}
public void setAttr4(String attr4) {
public void setAttr4(Integer attr4) {
this.attr4 = attr4;
}
@ -248,9 +248,9 @@ public class MdItem extends BaseEntity {
", maxStock=" + maxStock +
", highValue='" + highValue + '\'' +
", attr1=" + attr1 +
", attr2='" + attr2 + '\'' +
", attr3='" + attr3 + '\'' +
", attr4='" + attr4 + '\'' +
", attr2=" + attr2 +
", attr3=" + attr3 +
", attr4=" + attr4 +
", count=" + count +
'}';
}

View File

@ -0,0 +1,63 @@
package com.ktg.mes.md.domain;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class MyConfig {
@Value("${globalConfig.toolSettingXml.localPath}")
private String toolSettingXmlPath;
@Value("${globalConfig.toolSettingXml.remoteUrl}")
private String remoteUrl;
@Value("${globalConfig.toolSettingXml.remoteUser}")
private String remoteUser;
@Value("${globalConfig.toolSettingXml.remotePass}")
private String remotePass;
@Value("${globalConfig.productionControl.path}")
private String productionControlPath;
public String getToolSettingXmlPath() {
return toolSettingXmlPath;
}
public void setToolSettingXmlPath(String toolSettingXmlPath) {
this.toolSettingXmlPath = toolSettingXmlPath;
}
public String getProductionControlPath() {
return productionControlPath;
}
public void setProductionControlPath(String productionControlPath) {
this.productionControlPath = productionControlPath;
}
public String getRemoteUrl() {
return remoteUrl;
}
public void setRemoteUrl(String remoteUrl) {
this.remoteUrl = remoteUrl;
}
public String getRemoteUser() {
return remoteUser;
}
public void setRemoteUser(String remoteUser) {
this.remoteUser = remoteUser;
}
public String getRemotePass() {
return remotePass;
}
public void setRemotePass(String remotePass) {
this.remotePass = remotePass;
}
}

View File

@ -1,5 +1,7 @@
package com.ktg.mes.md.domain;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ktg.common.annotation.Excel;
@ -11,13 +13,15 @@ import com.ktg.common.core.domain.BaseEntity;
* @author yinjinlu
* @date 2024-10-31
*/
@Setter
@Getter
public class WmsBusinessType extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String typeId;
private Long typeId;
/**
* 修改日期
@ -120,190 +124,6 @@ public class WmsBusinessType extends BaseEntity {
@Excel(name = "是否记录入库时间:0否1是")
private String isRecordInboundTime;
public void setTypeId(String typeId) {
this.typeId = typeId;
}
public String getTypeId() {
return typeId;
}
public void setModifyDate(String modifyDate) {
this.modifyDate = modifyDate;
}
public String getModifyDate() {
return modifyDate;
}
public void setIsActive(String isActive) {
this.isActive = isActive;
}
public String getIsActive() {
return isActive;
}
public void setIsDelete(String isDelete) {
this.isDelete = isDelete;
}
public String getIsDelete() {
return isDelete;
}
public void setCode(String code) {
this.code = code;
}
public String getCode() {
return code;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setFlag(String flag) {
this.flag = flag;
}
public String getFlag() {
return flag;
}
public void setType(String type) {
this.type = type;
}
public String getType() {
return type;
}
public void setIsDefault(String isDefault) {
this.isDefault = isDefault;
}
public String getIsDefault() {
return isDefault;
}
public void setIsGlobal(String isGlobal) {
this.isGlobal = isGlobal;
}
public String getIsGlobal() {
return isGlobal;
}
public void setIsNeedUp(String isNeedUp) {
this.isNeedUp = isNeedUp;
}
public String getIsNeedUp() {
return isNeedUp;
}
public void setQualityType(String qualityType) {
this.qualityType = qualityType;
}
public String getQualityType() {
return qualityType;
}
public void setIsOutboundReview(String isOutboundReview) {
this.isOutboundReview = isOutboundReview;
}
public String getIsOutboundReview() {
return isOutboundReview;
}
public void setWaveStrategy(String waveStrategy) {
this.waveStrategy = waveStrategy;
}
public String getWaveStrategy() {
return waveStrategy;
}
public void setIsMultipleAllowed(String isMultipleAllowed) {
this.isMultipleAllowed = isMultipleAllowed;
}
public String getIsMultipleAllowed() {
return isMultipleAllowed;
}
public void setIsShortageAllowed(String isShortageAllowed) {
this.isShortageAllowed = isShortageAllowed;
}
public String getIsShortageAllowed() {
return isShortageAllowed;
}
public void setIsExcessAllowed(String isExcessAllowed) {
this.isExcessAllowed = isExcessAllowed;
}
public String getIsExcessAllowed() {
return isExcessAllowed;
}
public void setIsWholeOrderPost(String isWholeOrderPost) {
this.isWholeOrderPost = isWholeOrderPost;
}
public String getIsWholeOrderPost() {
return isWholeOrderPost;
}
public void setIsManuallyCreate(String isManuallyCreate) {
this.isManuallyCreate = isManuallyCreate;
}
public String getIsManuallyCreate() {
return isManuallyCreate;
}
public void setIsNoTask(String isNoTask) {
this.isNoTask = isNoTask;
}
public String getIsNoTask() {
return isNoTask;
}
public void setIsNegativeInv(String isNegativeInv) {
this.isNegativeInv = isNegativeInv;
}
public String getIsNegativeInv() {
return isNegativeInv;
}
public void setIsCheckSafetyStock(String isCheckSafetyStock) {
this.isCheckSafetyStock = isCheckSafetyStock;
}
public String getIsCheckSafetyStock() {
return isCheckSafetyStock;
}
public void setIsRecordInboundTime(String isRecordInboundTime) {
this.isRecordInboundTime = isRecordInboundTime;
}
public String getIsRecordInboundTime() {
return isRecordInboundTime;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

View File

@ -44,6 +44,11 @@ public class WmsOutTask extends BaseEntity {
@Excel(name = "出库类型ID")
private Long wmsBusinessTypeId;
/**
* 出库类型编码
*/
private String wmsBusinessTypeCode;
/**
* 任务编码
*/
@ -132,6 +137,38 @@ public class WmsOutTask extends BaseEntity {
private List<HashMap<String, Object>> outInfoList;
private List<BaseKnife> baseKnifes;
public WmsOutTask() {
super();
}
public WmsOutTask(Long wmsOutTaskId, Long wmsOutPlanId, String wmsOutPlanCode, Long wmsOutPlanDetailId, Long wmsBusinessTypeId, String wmsBusinessTypeCode, String taskCode, Integer taskNumber, Integer outNumber, Long wmStorageAreaId, String batchNum, Long mdItemId, String mdItemCode, String mdItemName, String mdItemUnit, String taskState, String recipientUsername, String attr1, String attr2, Integer attr3, Integer attr4, List<HashMap<String, Object>> outInfoList, List<BaseKnife> baseKnifes) {
this.wmsOutTaskId = wmsOutTaskId;
this.wmsOutPlanId = wmsOutPlanId;
this.wmsOutPlanCode = wmsOutPlanCode;
this.wmsOutPlanDetailId = wmsOutPlanDetailId;
this.wmsBusinessTypeId = wmsBusinessTypeId;
this.wmsBusinessTypeCode = wmsBusinessTypeCode;
this.taskCode = taskCode;
this.taskNumber = taskNumber;
this.outNumber = outNumber;
this.wmStorageAreaId = wmStorageAreaId;
this.batchNum = batchNum;
this.mdItemId = mdItemId;
this.mdItemCode = mdItemCode;
this.mdItemName = mdItemName;
this.mdItemUnit = mdItemUnit;
this.taskState = taskState;
this.recipientUsername = recipientUsername;
this.attr1 = attr1;
this.attr2 = attr2;
this.attr3 = attr3;
this.attr4 = attr4;
this.outInfoList = outInfoList;
this.baseKnifes = baseKnifes;
}
public Long getWmsOutTaskId() {
return wmsOutTaskId;
}
@ -172,6 +209,14 @@ public class WmsOutTask extends BaseEntity {
this.wmsBusinessTypeId = wmsBusinessTypeId;
}
public String getWmsBusinessTypeCode() {
return wmsBusinessTypeCode;
}
public void setWmsBusinessTypeCode(String wmsBusinessTypeCode) {
this.wmsBusinessTypeCode = wmsBusinessTypeCode;
}
public String getTaskCode() {
return taskCode;
}
@ -300,6 +345,14 @@ public class WmsOutTask extends BaseEntity {
this.outInfoList = outInfoList;
}
public List<BaseKnife> getBaseKnifes() {
return baseKnifes;
}
public void setBaseKnifes(List<BaseKnife> baseKnifes) {
this.baseKnifes = baseKnifes;
}
@Override
public String toString() {
return "WmsOutTask{" +
@ -308,6 +361,7 @@ public class WmsOutTask extends BaseEntity {
", wmsOutPlanCode='" + wmsOutPlanCode + '\'' +
", wmsOutPlanDetailId=" + wmsOutPlanDetailId +
", wmsBusinessTypeId=" + wmsBusinessTypeId +
", wmsBusinessTypeCode='" + wmsBusinessTypeCode + '\'' +
", taskCode='" + taskCode + '\'' +
", taskNumber=" + taskNumber +
", outNumber=" + outNumber +
@ -324,6 +378,7 @@ public class WmsOutTask extends BaseEntity {
", attr3=" + attr3 +
", attr4=" + attr4 +
", outInfoList=" + outInfoList +
", baseKnifes=" + baseKnifes +
'}';
}
}

View File

@ -0,0 +1,27 @@
package com.ktg.mes.md.domain.dto;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
// 根据订单出库
@Getter
@Setter
public class WmsOutboundOrderDto {
// 订单号
@NotBlank(message = "订单号不能为空")
private String orderId;
// 物料编码
@NotBlank(message = "物料编码不能为空")
private String materialCode;
// 出库类型编码
@NotBlank(message = "出库类型编码不能为空")
private String typeCode;
// 出库数量
@NotNull(message = "出库数量不能为空")
@Min(value = 1, message = "数量必须大于等于 1")
private int quantity;
}

View File

@ -0,0 +1,64 @@
package com.ktg.mes.md.mapper;
import com.ktg.mes.md.domain.BaseKnifeLocked;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 台账锁定Mapper接口
*
* @author yinjinlu
* @date 2024-12-09
*/
@Mapper
public interface BaseKnifeLockedMapper
{
/**
* 查询台账锁定
*
* @param baseKnifeLockedId 台账锁定主键
* @return 台账锁定
*/
public BaseKnifeLocked selectBaseKnifeLockedByBaseKnifeLockedId(String baseKnifeLockedId);
/**
* 查询台账锁定列表
*
* @param baseKnifeLocked 台账锁定
* @return 台账锁定集合
*/
public List<BaseKnifeLocked> selectBaseKnifeLockedList(BaseKnifeLocked baseKnifeLocked);
/**
* 新增台账锁定
*
* @param baseKnifeLocked 台账锁定
* @return 结果
*/
public int insertBaseKnifeLocked(BaseKnifeLocked baseKnifeLocked);
/**
* 修改台账锁定
*
* @param baseKnifeLocked 台账锁定
* @return 结果
*/
public int updateBaseKnifeLocked(BaseKnifeLocked baseKnifeLocked);
/**
* 删除台账锁定
*
* @param baseKnifeLockedId 台账锁定主键
* @return 结果
*/
public int deleteBaseKnifeLockedByBaseKnifeLockedId(String baseKnifeLockedId);
/**
* 批量删除台账锁定
*
* @param baseKnifeLockedIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteBaseKnifeLockedByBaseKnifeLockedIds(String[] baseKnifeLockedIds);
}

View File

@ -2,6 +2,7 @@ package com.ktg.mes.md.mapper;
import com.ktg.mes.md.domain.BaseKnife;
import com.ktg.mes.md.domain.MdItem;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -12,6 +13,7 @@ import java.util.List;
* @author yinjinlu
* @date 2024-10-31
*/
@Mapper
public interface BaseKnifeMapper {
/**
* 查询工具台账
@ -88,6 +90,11 @@ public interface BaseKnifeMapper {
@Param("isLocked") Integer isLocked
);
List<BaseKnife> selectBaseKnifeListByMbbBdMrlIdAndKnifeFineStateAndIsLocked(
@Param("mbbBdMrlId") Long mbbBdMrlId,
@Param("isLocked") Integer isLocked
);
int updateBaseKnifeIsLockedByBaseKnifeId(
@Param("baseKnifeId") Long baseKnifeId,
@Param("isLocked") Integer isLocked
@ -114,4 +121,8 @@ public interface BaseKnifeMapper {
public Boolean isDuplicateRfid(String rfid);
List<BaseKnife> selectBaseKnifeNotValidList(BaseKnife baseKnifeWrapper);
List<String> selectNotEmptyAreaCodeList();
List<BaseKnife> selectBaseKnifeListByMbbBdMrlId(Long itemId);
}

View File

@ -2,6 +2,7 @@ package com.ktg.mes.md.mapper;
import java.util.List;
import com.ktg.mes.md.domain.BaseTechnologyBom;
import org.apache.ibatis.annotations.Mapper;
/**
* 工艺bomMapper接口
@ -9,6 +10,7 @@ import com.ktg.mes.md.domain.BaseTechnologyBom;
* @author yinjinlu
* @date 2024-11-01
*/
@Mapper
public interface BaseTechnologyBomMapper
{
/**

View File

@ -1,9 +1,14 @@
package com.ktg.mes.md.mapper;
import com.ktg.mes.md.domain.MdItem;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author luo26
*/
@Mapper
public interface MdItemMapper {
/**
* 根据条件查询物料编码

View File

@ -1,6 +1,7 @@
package com.ktg.mes.md.mapper;
import com.ktg.mes.wm.domain.UcmCtMaterial;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@ -10,6 +11,7 @@ import java.util.List;
* @author yinjinlu
* @date 2024-11-15
*/
@Mapper
public interface UcmCtMaterialMapper2 {
/**
* 查询料箱物料绑定

View File

@ -1,6 +1,7 @@
package com.ktg.mes.md.mapper;
import com.ktg.mes.md.domain.WmsBusinessType;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -11,7 +12,8 @@ import java.util.List;
* @author yinjinlu
* @date 2024-10-31
*/
public interface WmsBusinessTypeMapper
@Mapper
public interface WmsBusinessTypeMapper
{
/**
* 查询出入库类型

View File

@ -3,6 +3,7 @@ package com.ktg.mes.md.mapper;
import java.util.List;
import com.ktg.mes.md.domain.WmsOutPlanDetailEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 出库计划明细实体Mapper接口
@ -10,6 +11,7 @@ import com.ktg.mes.md.domain.WmsOutPlanDetailEntity;
* @author yinjinlu
* @date 2024-11-11
*/
@Mapper
public interface WmsOutPlanDetailEntityMapper {
/**
* 查询出库计划明细实体

View File

@ -2,6 +2,7 @@ package com.ktg.mes.md.mapper;
import com.ktg.mes.md.domain.WmsOutPlan;
import com.ktg.mes.md.domain.WmsOutPlanDetail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -12,6 +13,7 @@ import java.util.List;
* @author yinjinlu
* @date 2024-11-01
*/
@Mapper
public interface WmsOutPlanMapper {
/**
* 查询出库计划管理

View File

@ -1,6 +1,7 @@
package com.ktg.mes.md.mapper;
import com.ktg.mes.md.domain.WmsOutTask;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@ -10,6 +11,7 @@ import java.util.List;
* @author yinjinlu
* @date 2024-11-02
*/
@Mapper
public interface WmsOutTaskMapper {
/**
* 查询出库任务

View File

@ -19,6 +19,14 @@ public interface IBaseKnifeService
*/
public BaseKnife selectBaseKnifeByBaseKnifeId(Long baseKnifeId);
/**
* 查询工具台账
*
* @param rfid 工具台账主键
* @return 工具台账 包含物料基础信息
*/
public BaseKnife selectBaseKnifeByRfid(String rfid);
/**
* 查询工具台账列表
*

View File

@ -0,0 +1,40 @@
package com.ktg.mes.md.service;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
@WebService(name = IMasterDataSyncService.SERVICE_NAME, targetNamespace = IMasterDataSyncService.TARGET_NAMESPACE)
public interface IMasterDataSyncService {
String SERVICE_NAME = "MasterDataSyncService";
String TARGET_NAMESPACE = "http://server.spring.zhang.pers/";
/**
* 同步物料数据
*
* @param materialListStr 物料列表
*/
@WebMethod(operationName = "syncMaterial")
@WebResult
String syncMaterial(@WebParam(name = "materialListStr") String materialListStr);
/**
* 同步物料分类数据
*
* @param materialCategoryListStr 物料分类列表
*/
@WebMethod(operationName = "syncMaterialCategory")
@WebResult
String syncMaterialCategory(@WebParam(name = "materialCategoryList") String materialCategoryListStr);
/**
* 同步计量单位数据
*
* @param unitListStr 计量单位列表
*/
@WebMethod(operationName = "syncUnit")
@WebResult
String syncUnit(@WebParam(name = "unitList") String unitListStr);
}

View File

@ -19,6 +19,14 @@ public interface IWmsBusinessTypeService
*/
public WmsBusinessType selectWmsBusinessTypeByTypeId(String typeId);
/**
* 查询出入库类型
*
* @param code 出入库类型编码
* @return 出入库类型
*/
public WmsBusinessType selectWmsBusinessTypeByCode(String code);
/**
* 查询出入库类型列表
*

View File

@ -29,6 +29,14 @@ public interface IWmsOutPlanService {
*/
List<WmsOutPlan> selectWmsOutPlanList(WmsOutPlan wmsOutPlan);
/**
* 新增出库计划管理并执行
*
* @param wmsOutPlan 出库计划管理
* @return 结果
*/
int insertWmsOutPlanAndRun(WmsOutPlan wmsOutPlan);
/**
* 新增出库计划管理
*

View File

@ -65,6 +65,11 @@ public class BaseKnifeServiceImpl implements IBaseKnifeService {
return baseKnife;
}
@Override
public BaseKnife selectBaseKnifeByRfid(String rfid) {
return baseKnifeMapper.selectBaseKnifeByRfid(rfid);
}
/**
* 查询工具台账列表
*

View File

@ -2,6 +2,7 @@ package com.ktg.mes.md.service.impl;
import java.util.List;
import com.ktg.common.utils.DateUtils;
import com.ktg.mes.md.mapper.BaseKnifeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
@ -24,6 +25,9 @@ public class BomRouteServiceImpl implements IBomRouteService
@Autowired
private BomRouteMapper bomRouteMapper;
@Autowired
private BaseKnifeMapper baseKnifeMapper;
/**
* 查询BOM头
*
@ -33,7 +37,11 @@ public class BomRouteServiceImpl implements IBomRouteService
@Override
public BomRoute selectBomRouteByBomRouteId(Long bomRouteId)
{
return bomRouteMapper.selectBomRouteByBomRouteId(bomRouteId);
BomRoute bomRoute = bomRouteMapper.selectBomRouteByBomRouteId(bomRouteId);
bomRoute.getMbbProduBomList().forEach(item -> {
item.setCurrentInventory(this.baseKnifeMapper.countBaseKnife(item.getMdItemId()));
});
return bomRoute;
}
/**
@ -125,7 +133,7 @@ public class BomRouteServiceImpl implements IBomRouteService
mbbProduBom.setBomRouteId(bomRouteId);
list.add(mbbProduBom);
}
if (list.size() > 0)
if (!list .isEmpty())
{
bomRouteMapper.batchMbbProduBom(list);
}

View File

@ -4,10 +4,8 @@ import com.ktg.common.utils.DateUtils;
import com.ktg.mes.md.domain.*;
import com.ktg.mes.md.mapper.*;
import com.ktg.mes.md.service.IInventoryBatchService;
import com.ktg.mes.wm.domain.WmsInPlanDetailEntity;
import com.ktg.mes.wm.domain.WmsInTask;
import com.ktg.mes.wm.mapper.WmsInPlanDetailEntityMapper;
import com.ktg.mes.wm.mapper.WmsInTaskMapper;
import com.ktg.mes.wm.domain.*;
import com.ktg.mes.wm.mapper.*;
import com.ktg.mes.wm.service.impl.WmsInPlanDetailEntityServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -29,12 +27,27 @@ import static org.apache.commons.lang3.SystemUtils.getUserName;
*/
@Service
public class InventoryBatchServiceImpl implements IInventoryBatchService {
@Autowired
@Autowired
private BaseKnifeMapper baseKnifeMapper;
@Autowired
private WmsOutPlanMapper wmsOutPlanMapper;
@Autowired
private WmsInPlanMapper wmsInPlanMapper;
@Autowired
private WmStorageLocationMapper wmStorageLocationMapper;
@Autowired
private WmStorageAreaMapper wmStorageAreaMapper;
@Autowired
private WmWarehouseMapper wmWarehouseMapper;
@Autowired
private MdItemMapper mdItemMapper;
@Autowired
private WmsOutPlanDetailEntityMapper wmsOutPlanDetailEntityMapper;
@ -72,6 +85,7 @@ public class InventoryBatchServiceImpl implements IInventoryBatchService {
@Override
public List<InventoryBatch> selectInventoryBatchList(InventoryBatch inventoryBatch) {
// 构建出库信息
List<InventoryBatch> result = new ArrayList<>();
WmsOutTask wmsOutTaskWrapper = new WmsOutTask();
@ -89,6 +103,69 @@ public class InventoryBatchServiceImpl implements IInventoryBatchService {
inventoryBatchOut.setInOrOut(0);
inventoryBatchOut.setDateTime(outTask.getCreateTime());
inventoryBatchOut.setStatus(outTask.getTaskState());
// 获得当前出库计划明细实体列表并遍历
List<HashMap<String, Object>> hashMapList = new ArrayList<>();
WmsOutPlanDetailEntity entityQuery = new WmsOutPlanDetailEntity();
entityQuery.setWmsOutPlanDetailId(outTask.getWmsOutPlanDetailId());
List<WmsOutPlanDetailEntity> wmsOutPlanDetailEntityList = wmsOutPlanDetailEntityMapper.selectWmsOutPlanDetailEntityList(entityQuery);
wmsOutPlanDetailEntityList.forEach(outPlanDetailEntity -> {
// 根据出库实例对象获取出库计划明细
WmsOutPlanDetail wmsOutPlanDetail = this.wmsOutPlanMapper.selectWmsOutPlanDetailById(outPlanDetailEntity.getWmsOutPlanDetailId());
// 根据计划明细获得出库计划
WmsOutPlan wmsOutPlan = this.wmsOutPlanMapper.selectWmsOutPlanByWmsOutPlanId(wmsOutPlanDetail.getWmsOutPlanId());
// 根据出库计划获得出库类型
WmsBusinessType wmsBusinessType = this.wmsBusinessTypeMapper.selectWmsBusinessTypeByTypeId(wmsOutPlan.getWmsBusinessTypeId().toString());
// 获得物料
MdItem mdItem = this.mdItemMapper.selectMdItemById(outTask.getMdItemId());
// 设定出库信息数据
HashMap<String, Object> hashMap = new HashMap<>();
/* 来自物料 */
hashMap.put("mdItemId", mdItem.getItemId()); // 物料ID
hashMap.put("mdItemCode", mdItem.getItemCode()); // 物料编码
hashMap.put("mdItemName", mdItem.getItemName()); // 物料名称
hashMap.put("mdItemUnit", mdItem.getUnitName()); // 物料单位
hashMap.put("mdItemKnifeWarn", mdItem.getAttr2()); // 物料名称
/* 来自出入库计划类型 */
hashMap.put("planTypeId", wmsBusinessType.getTypeId()); // 出库类型ID
hashMap.put("planTypeCode", wmsBusinessType.getCode()); // 出库类型编码
hashMap.put("planTypeName", wmsBusinessType.getName()); // 出库类型名称
/* 来自计划明细 */
hashMap.put("detailBatchNum", wmsOutPlanDetail.getDetailBatchNum()); // 明细批次
hashMap.put("wmStorageAreaId", wmsOutPlanDetail.getWmStorageAreaId()); // 库位ID
hashMap.put("wmStorageAreaCode", wmsOutPlanDetail.getWmStorageAreaCode()); // 库位编码
hashMap.put("wmStorageAreaName", wmsOutPlanDetail.getWmStorageAreaName()); // 库位名称
hashMap.put("detailStatus", wmsOutPlanDetail.getDetailState()); // 明细状态
// 查询库区信息
WmStorageArea wmStorageArea = wmStorageAreaMapper.selectWmStorageAreaByAreaId(wmsOutPlanDetail.getWmStorageAreaId());
WmStorageLocation wmStorageLocation = wmStorageLocationMapper.selectWmStorageLocationByLocationId(wmStorageArea.getLocationId());
// 查询库房信息
WmWarehouse wmWarehouse = wmWarehouseMapper.selectWmWarehouseByWarehouseId(wmStorageLocation.getWarehouseId());
hashMap.put("wmWarehouseName", wmWarehouse.getWarehouseName()); // 库位名称
/* 实体 */
String outTime = null;
if (outPlanDetailEntity.getCreateTime() != null)
outTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(outPlanDetailEntity.getCreateTime());
hashMap.put("dateTime", outTime); // 出库时间
hashMap.put("baseKnifeId", outPlanDetailEntity.getBaseKnifeId());
hashMap.put("planCode", outTask.getWmsOutPlanCode());
// hashMap.put("knifeLife", nowWmsOutPlanDetailEntity.getKnifeLife());
// hashMap.put("resetCount", nowWmsOutPlanDetailEntity.getResetCount());
// 寿命预警
if ("PRODUCT".equals(outPlanDetailEntity.getItemOrProduct()) && outPlanDetailEntity.getKnifeLife() <= mdItem.getAttr2())
hashMap.put("knifeWarning", true);
else
hashMap.put("knifeWarning", false);
hashMapList.add(hashMap);
});
// 注入出库信息对象
inventoryBatchOut.setInfoList(hashMapList);
result.add(inventoryBatchOut);
});
@ -108,6 +185,57 @@ public class InventoryBatchServiceImpl implements IInventoryBatchService {
inventoryBatchIn.setInOrOut(1);
inventoryBatchIn.setDateTime(inTask.getCreateTime());
inventoryBatchIn.setStatus("1");
// 获取当期入库明细数据
List<HashMap<String, Object>> hashMapList = new ArrayList<>();
WmsInPlanDetailEntity entityQuery = new WmsInPlanDetailEntity();
entityQuery.setPlanId(inTask.getPlanInId());
// entityQuery.setKnifeId(Long.parseLong(inTask.getPlanInId()));
List<WmsInPlanDetailEntity> wmsInPlanDetailEntityList = wmsInPlanDetailEntityMapper.selectWmsInPlanDetailEntityList(entityQuery);
wmsInPlanDetailEntityList.forEach(inPlanDetailEntity -> {
// 根据出库计划获得出库类型
WmsBusinessType wmsBusinessType = this.wmsBusinessTypeMapper.selectWmsBusinessTypeByTypeId(inTask.getPlanTypeId());
// 获得物料
MdItem mdItem = this.mdItemMapper.selectMdItemById(Long.parseLong(inTask.getMaterialId()));
// 设定出库信息数据
HashMap<String, Object> hashMap = new HashMap<>();
/* 来自物料 */
hashMap.put("mdItemId", mdItem.getItemId()); // 物料ID
hashMap.put("mdItemCode", mdItem.getItemCode()); // 物料编码
hashMap.put("mdItemName", mdItem.getItemName()); // 物料名称
hashMap.put("mdItemUnit", mdItem.getUnitName()); // 物料单位
hashMap.put("mdItemKnifeWarn", mdItem.getAttr2()); // 物料名称
/* 来自出入库计划类型 */
hashMap.put("planTypeId", wmsBusinessType.getTypeId()); // 入库类型ID
hashMap.put("planTypeCode", wmsBusinessType.getCode()); // 入库类型编码
hashMap.put("planTypeName", wmsBusinessType.getName()); // 入库类型名称
/* 来自计划明细 */
hashMap.put("detailBatchNum", inTask.getBatch()); // 明细批次
hashMap.put("wmStorageAreaId", inTask.getCellTgt()); // 库位ID
hashMap.put("wmStorageAreaName", inTask.getCellName()); // 库位名称
hashMap.put("detailStatus", inTask.getPlanInStatus()); // 明细状态
// 查询库区信息
WmStorageArea wmStorageArea = wmStorageAreaMapper.selectWmStorageAreaByAreaId(inTask.getCellTgt());
WmStorageLocation wmStorageLocation = wmStorageLocationMapper.selectWmStorageLocationByLocationId(wmStorageArea.getLocationId());
// 查询库房信息
WmWarehouse wmWarehouse = wmWarehouseMapper.selectWmWarehouseByWarehouseId(wmStorageLocation.getWarehouseId());
hashMap.put("wmWarehouseName", wmWarehouse.getWarehouseName()); // 库位名称
/* 实体 */
String outTime = null;
if (inPlanDetailEntity.getCreateTime() != null)
outTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(inPlanDetailEntity.getCreateTime());
hashMap.put("dateTime", outTime); // 出库时间
hashMap.put("baseKnifeId", inPlanDetailEntity.getKnifeId());
hashMap.put("planCode", inTask.getPlanInCode());
// hashMap.put("knifeLife", nowWmsOutPlanDetailEntity.getKnifeLife());
// hashMap.put("resetCount", nowWmsOutPlanDetailEntity.getResetCount());
hashMapList.add(hashMap);
});
inventoryBatchIn.setInfoList(hashMapList);
result.add(inventoryBatchIn);
});

View File

@ -0,0 +1,189 @@
package com.ktg.mes.md.service.impl;
import com.ktg.common.core.domain.entity.ItemType;
import com.ktg.mes.md.domain.MdItem;
import com.ktg.mes.md.domain.MdUnitMeasure;
import com.ktg.mes.md.service.IMasterDataSyncService;
import com.ktg.mes.md.service.IMdItemService;
import com.ktg.mes.md.service.IMdUnitMeasureService;
import lombok.RequiredArgsConstructor;
import org.codehaus.jackson.JsonNode;
import org.codehaus.jackson.map.ObjectMapper;
import org.springframework.stereotype.Service;
import javax.jws.WebService;
import java.util.List;
@RequiredArgsConstructor
@Service
@WebService(name = IMasterDataSyncService.SERVICE_NAME, targetNamespace = IMasterDataSyncService.TARGET_NAMESPACE, endpointInterface = "com.ktg.mes.md.service.IMasterDataSyncService")
public class MasterDataSyncServiceImpl implements IMasterDataSyncService {
private final ItemTypeServiceImpl itemTypeService;
private final IMdItemService mdItemService;
private final IMdUnitMeasureService mdUnitMeasureService;
// 无参构造函数 CXF 使用
public MasterDataSyncServiceImpl() {
this.itemTypeService = null;
this.mdItemService = null;
this.mdUnitMeasureService = null;
}
/**
* 同步物料数据
*
* @param materialListStr 物料列表
*/
@Override
public String syncMaterial(String materialListStr) {
// 使用 ObjectMapper 来处理 JSON
ObjectMapper objectMapper = new ObjectMapper();
try {
// 解析传入的 JSON 字符串
String jsonList = objectMapper.readTree(materialListStr).get("LIST").asText();
JsonNode jsonNode = objectMapper.readTree(jsonList);
for (JsonNode node : jsonNode) {
JsonNode jsonNode1 = null;
// 通用工具工装
if (!node.get("T_TYGJGZ").asText().isEmpty()) {
jsonNode1 = objectMapper.readTree(node.get("T_TYGJGZ").asText());
// 专用工具工装
} else if (!node.get("T_ZYGJGZ").asText().isEmpty()) {
jsonNode1 = objectMapper.readTree(node.get("T_ZYGJGZ").asText());
}
if (jsonNode1 != null) {
MdItem mdItem = new MdItem();
mdItem.setItemName(jsonNode1.get("MC").asText());
mdItem.setItemCode(jsonNode1.get("WLBM").asText());
// 查询并设置计量单位数据
MdUnitMeasure unit = mdUnitMeasureService.selectMdUnitByCode(jsonNode1.get("UNIT").asText());
mdItem.setUnitName(unit.getMeasureName());
mdItem.setUnitOfMeasure(unit.getMeasureName());
// 四级分类数据
String categoryName = jsonNode1.get("SIJFL").asText();
if (categoryName.isEmpty()) {
// 为空则使用三级分类数据
categoryName = jsonNode1.get("SJFL").asText();
}
ItemType itemType = itemTypeService.selectItemTypeByName(categoryName);
mdItem.setItemOrProduct(itemType.getItemOrProduct());
mdItem.setItemTypeId(itemType.getItemTypeId());
mdItem.setItemTypeName(itemType.getItemTypeName());
mdItemService.insertMdItem(mdItem);
}
}
} catch (Exception e) {
e.printStackTrace();
return "同步失败,原因:" + e.getMessage();
}
return "1"; // 返回成功标识
}
/**
* 同步物料分类数据
*
* @param materialCategoryListStr 物料分类列表
*/
@Override
public String syncMaterialCategory(String materialCategoryListStr) {
// 使用 ObjectMapper 来处理 JSON
ObjectMapper objectMapper = new ObjectMapper();
try {
// 解析传入的 JSON 字符串
String jsonList = objectMapper.readTree(materialCategoryListStr).get("LIST").asText();
JsonNode jsonNode = objectMapper.readTree(jsonList);
for (JsonNode node : jsonNode) {
ItemType itemType = new ItemType();
itemType.setItemTypeName(node.get("NAME").asText());
itemType.setItemTypeCode(node.get("CODE").asText());
// 判断是否有父级分类
String parentCode = node.get("PCODE").asText();
if (!parentCode.isEmpty()) {
ItemType itemTypeQuery = new ItemType();
itemTypeQuery.setItemTypeCode(parentCode);
// 查询父级数据
List<ItemType> parentItemTypeList = itemTypeService.selectItemTypeList(itemTypeQuery);
if (!parentItemTypeList.isEmpty()) {
ItemType parentItemType = parentItemTypeList.get(0);
itemType.setParentTypeId(parentItemType.getItemTypeId());
// 提取父级分类ID
Long parentId = parentItemType.getParentTypeId();
// 循环直至查出最顶层分类
while (parentId != null && parentId != 0) {
parentItemType = itemTypeService.selectItemTypeById(parentId);
if (parentItemType != null) {
// 更新父级 ID
parentId = parentItemType.getParentTypeId();
// 判断分类名称设置对应的物料类型
if ("专用刀具".equals(parentItemType.getItemTypeName()) || "刀具".equals(parentItemType.getItemTypeName())) {
itemType.setItemOrProduct("BLAND");
break;
} else if (parentId == 0) {
itemType.setItemOrProduct("ITEM");
break;
}
} else {
break;
}
}
}
}
// 插入数据
itemTypeService.insertItemType(itemType);
}
} catch (Exception e) {
e.printStackTrace();
return "同步失败,原因:" + e.getMessage();
}
return "1"; // 返回成功标识
}
/**
* 同步计量单位数据
*
* @param unitListStr 计量单位列表
*/
@Override
public String syncUnit(String unitListStr) {
// 使用 ObjectMapper 来处理 JSON
ObjectMapper objectMapper = new ObjectMapper();
try {
// 解析传入的 JSON 字符串
String jsonList = objectMapper.readTree(unitListStr).get("LIST").asText();
JsonNode jsonNode = objectMapper.readTree(jsonList);
for (JsonNode node : jsonNode) {
JsonNode jsonNode1 = objectMapper.readTree(node.get("DIC_D_UNIT").asText());
if (jsonNode1 != null) {
MdUnitMeasure mdUnitMeasure = new MdUnitMeasure();
mdUnitMeasure.setMeasureCode(jsonNode1.get("CODE").asText());
mdUnitMeasure.setMeasureName(jsonNode1.get("NAME").asText());
mdUnitMeasureService.insertMdUnitMeasure(mdUnitMeasure);
}
}
} catch (Exception e) {
e.printStackTrace();
return "同步失败,原因:" + e.getMessage();
}
return "1"; // 返回成功标识
}
}

View File

@ -32,6 +32,18 @@ public class WmsBusinessTypeServiceImpl implements IWmsBusinessTypeService
return wmsBusinessTypeMapper.selectWmsBusinessTypeByTypeId(typeId);
}
/**
* 查询出入库类型
*
* @param code 出入库类型编码
* @return 出入库类型
*/
@Override
public WmsBusinessType selectWmsBusinessTypeByCode(String code) {
return wmsBusinessTypeMapper.selectWmsBusinessTypeByCode(code);
}
/**
* 查询出入库类型列表
*

View File

@ -73,6 +73,16 @@ public class WmsOutPlanServiceImpl implements IWmsOutPlanService {
return wmsOutPlanList;
}
@Transactional
@Override
public int insertWmsOutPlanAndRun(WmsOutPlan wmsOutPlan) {
wmsOutPlan.setCreateTime(DateUtils.getNowDate());
int rows = wmsOutPlanMapper.insertWmsOutPlan(wmsOutPlan);
insertWmsOutPlanDetail(wmsOutPlan);
this.runWmsOutPlan(new Long[]{wmsOutPlan.getWmsOutPlanId()});
return rows;
}
/**
* 新增出库计划管理
*
@ -141,9 +151,8 @@ public class WmsOutPlanServiceImpl implements IWmsOutPlanService {
List<WmsOutPlanDetail> wmsOutPlanDetailList = wmsOutPlan.getWmsOutPlanDetailList();
wmsOutPlanDetailList.forEach(wmsOutPlanDetail -> {
// 获得该出库计划子项对应的工具台账实体
List<BaseKnife> baseKnifeList = this.baseKnifeMapper.selectBaseKnifeListByMbbBdMrlIdAndAreaCodeAndKnifeFineStateAndIsLocked(
List<BaseKnife> baseKnifeList = this.baseKnifeMapper.selectBaseKnifeListByMbbBdMrlIdAndKnifeFineStateAndIsLocked(
wmsOutPlanDetail.getMdItemId(),
wmsOutPlanDetail.getWmStorageAreaCode(),
0
);
@ -160,6 +169,7 @@ public class WmsOutPlanServiceImpl implements IWmsOutPlanService {
);
// 开始遍历出库计划子项
HashMap<String, List<BaseKnife>> baseKnifeListHashMap = new HashMap<>();
baseKnifeList.subList(0, wmsOutPlanDetail.getPlannedQuantity()).forEach(baseKnife -> {
// 构建出库计划明细实体
WmsOutPlanDetailEntity wmsOutPlanDetailEntity = new WmsOutPlanDetailEntity();
@ -181,29 +191,40 @@ public class WmsOutPlanServiceImpl implements IWmsOutPlanService {
// 锁定工具台账中的物料实体
this.baseKnifeMapper.updateBaseKnifeIsLockedByBaseKnifeId(baseKnife.getBaseKnifeId(), 1);
// 加入进MAP
if (!baseKnifeListHashMap.containsKey(baseKnife.getAreaCode()))
baseKnifeListHashMap.put(baseKnife.getAreaCode(), new ArrayList<>());
baseKnifeListHashMap.get(baseKnife.getAreaCode()).add(baseKnife);
});
// 构建出库任务
WmsOutTask wmsOutTask = new WmsOutTask();
wmsOutTask.setWmsOutPlanId(wmsOutPlanId);
wmsOutTask.setWmsOutPlanCode(wmsOutPlan.getPlanCode());
wmsOutTask.setWmsOutPlanDetailId(wmsOutPlanDetail.getWmsOutPlanDetailId());
wmsOutTask.setWmsBusinessTypeId(wmsOutPlan.getWmsBusinessTypeId());
wmsOutTask.setTaskCode(new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()));
wmsOutTask.setTaskNumber(wmsOutPlanDetail.getPlannedQuantity());
wmsOutTask.setOutNumber(wmsOutPlanDetail.getPlannedQuantity());
wmsOutTask.setWmStorageAreaId(wmsOutPlanDetail.getWmStorageAreaId());
wmsOutTask.setBatchNum(wmsOutPlanDetail.getDetailBatchNum());
wmsOutTask.setMdItemId(wmsOutPlanDetail.getMdItemId());
wmsOutTask.setMdItemCode(wmsOutPlanDetail.getMdItemCode());
wmsOutTask.setMdItemName(wmsOutPlanDetail.getMdItemName());
wmsOutTask.setMdItemUnit(wmsOutPlanDetail.getMdItemUnit());
wmsOutTask.setTaskState("0");
wmsOutTask.setRecipientUsername(wmsOutPlan.getRecipientUsername());
wmsOutTask.setCreateTime(new Date());
// 根据库位遍历台账
baseKnifeListHashMap.keySet().forEach(key -> {
// 获取库位信息
WmStorageArea wmStorageAreaByAreaCode = this.wmStorageAreaMapper.selectWmStorageAreaByAreaCode(key);
// 插入出库任务
this.wmsOutTaskMapper.insertWmsOutTask(wmsOutTask);
// 构建出库任务
WmsOutTask wmsOutTask = new WmsOutTask();
wmsOutTask.setWmsOutPlanId(wmsOutPlanId);
wmsOutTask.setWmsOutPlanCode(wmsOutPlan.getPlanCode());
wmsOutTask.setWmsOutPlanDetailId(wmsOutPlanDetail.getWmsOutPlanDetailId());
wmsOutTask.setWmsBusinessTypeId(wmsOutPlan.getWmsBusinessTypeId());
wmsOutTask.setTaskCode(new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()));
wmsOutTask.setTaskNumber(baseKnifeListHashMap.get(key).size());
wmsOutTask.setOutNumber(baseKnifeListHashMap.get(key).size());
wmsOutTask.setWmStorageAreaId(wmStorageAreaByAreaCode.getAreaId());
wmsOutTask.setBatchNum(wmsOutPlanDetail.getDetailBatchNum());
wmsOutTask.setMdItemId(wmsOutPlanDetail.getMdItemId());
wmsOutTask.setMdItemCode(wmsOutPlanDetail.getMdItemCode());
wmsOutTask.setMdItemName(wmsOutPlanDetail.getMdItemName());
wmsOutTask.setMdItemUnit(wmsOutPlanDetail.getMdItemUnit());
wmsOutTask.setTaskState("0");
wmsOutTask.setRecipientUsername(wmsOutPlan.getRecipientUsername());
wmsOutTask.setCreateTime(new Date());
// 插入出库任务
this.wmsOutTaskMapper.insertWmsOutTask(wmsOutTask);
});
});
// 更新出库计划状态为已执行
@ -248,10 +269,12 @@ public class WmsOutPlanServiceImpl implements IWmsOutPlanService {
hashMap.put("wmStorageAreaCode", wmsOutPlanDetail.getWmStorageAreaCode()); // 库位编码
hashMap.put("wmStorageAreaName", wmsOutPlanDetail.getWmStorageAreaName()); // 库位名称
hashMap.put("detailStatus", wmsOutPlanDetail.getDetailState()); // 明细状态
/* 来自台账明细 */
/* 来自物料 */
hashMap.put("itemId", mdItem.getItemId()); // 物料ID
hashMap.put("itemName", mdItem.getItemName()); // 物料名称
hashMap.put("itemCode", mdItem.getItemCode()); // 物料编码
/* 来自台账 */
hashMap.put("baseKnife", baseKnifeMapper.selectBaseKnifeByBaseKnifeId(nowWmsOutPlanDetailEntity.getBaseKnifeId()));
/* 实体 */
String outTime = null;
if (nowWmsOutPlanDetailEntity.getCreateTime() != null)
@ -291,7 +314,7 @@ public class WmsOutPlanServiceImpl implements IWmsOutPlanService {
// 构建出库计划
WmsOutPlan wmsOutPlan = new WmsOutPlan();
wmsOutPlan.setPlanCode(Long.toString(System.currentTimeMillis(), 32).toUpperCase(Locale.ROOT));
wmsOutPlan.setWmsBusinessTypeId(this.wmsBusinessTypeMapper.selectWmsBusinessTypeByCode("CK04").getTypeId() != null ? Long.parseLong(this.wmsBusinessTypeMapper.selectWmsBusinessTypeByCode("CK04").getTypeId()) : 14L);
wmsOutPlan.setWmsBusinessTypeId(this.wmsBusinessTypeMapper.selectWmsBusinessTypeByCode("CK04").getTypeId() != null ? this.wmsBusinessTypeMapper.selectWmsBusinessTypeByCode("CK04").getTypeId() : 14L);
wmsOutPlan.setPlanState("1");
wmsOutPlan.setPlanType("SGLR");
wmsOutPlan.setRemark("一键清退无寿命物品");

View File

@ -1,21 +1,37 @@
package com.ktg.mes.md.service.impl;
import com.alibaba.fastjson.JSON;
import com.ktg.common.utils.DateUtils;
import com.ktg.mes.cal.utils.CalendarUtil;
import com.ktg.mes.md.domain.*;
import com.ktg.mes.md.mapper.*;
import com.ktg.mes.md.service.IWmsOutTaskService;
import com.ktg.mes.wm.domain.UcmCtBase;
import com.ktg.mes.wm.domain.UcmCtMaterial;
import com.ktg.mes.wm.domain.WmStorageArea;
import com.ktg.mes.wm.domain.WmsZdTask;
import com.ktg.mes.wm.mapper.UcmCtBaseMapper;
import com.ktg.mes.wm.mapper.WmStorageAreaMapper;
import com.ktg.mes.wm.service.IWmStorageAreaService;
import com.ktg.mes.wm.mapper.WmsZdTaskMapper;
import jcifs.smb.NtlmPasswordAuthentication;
import jcifs.smb.SmbFile;
import jcifs.smb.SmbFileInputStream;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.attribute.BasicFileAttributes;
import java.nio.file.attribute.FileTime;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
/**
* 出库任务Service业务层处理
@ -46,6 +62,15 @@ public class WmsOutTaskServiceImpl implements IWmsOutTaskService {
@Autowired
private WmStorageAreaMapper wmStorageAreaMapper;
@Autowired
private UcmCtBaseMapper ucmCtBaseMapper;
@Autowired
private UcmCtMaterialMapper2 ucmCtMaterialMapper2;
@Autowired
private WmsZdTaskMapper wmsZdTaskMapper;
/**
* 查询出库任务
*
@ -67,7 +92,8 @@ public class WmsOutTaskServiceImpl implements IWmsOutTaskService {
entityQuery.setWmsOutPlanDetailId(wmsOutTask.getWmsOutPlanDetailId());
List<WmsOutPlanDetailEntity> wmsOutPlanDetailEntityList = wmsOutPlanDetailEntityMapper.selectWmsOutPlanDetailEntityList(entityQuery);
wmsOutPlanDetailEntityList.forEach(nowWmsOutPlanDetailEntity -> {
wmsOutPlanDetailEntityList.subList(0, wmsOutTask.getOutNumber()).forEach(nowWmsOutPlanDetailEntity -> {
// 根据出库实例对象获取出库计划明细
WmsOutPlanDetail wmsOutPlanDetail = this.wmsOutPlanMapper.selectWmsOutPlanDetailById(nowWmsOutPlanDetailEntity.getWmsOutPlanDetailId());
@ -78,7 +104,7 @@ public class WmsOutTaskServiceImpl implements IWmsOutTaskService {
WmsBusinessType wmsBusinessType = this.wmsBusinessTypeMapper.selectWmsBusinessTypeByTypeId(wmsOutPlan.getWmsBusinessTypeId().toString());
// 获取库位信息
WmStorageArea wmStorageArea = wmStorageAreaMapper.selectWmStorageAreaByAreaId(wmsOutPlanDetail.getWmStorageAreaId());
WmStorageArea wmStorageArea = wmStorageAreaMapper.selectWmStorageAreaByAreaCode(nowWmsOutPlanDetailEntity.getAreaCode());
// 设定出库信息数据
HashMap<String, Object> hashMap = new HashMap<>();
@ -98,9 +124,9 @@ public class WmsOutTaskServiceImpl implements IWmsOutTaskService {
hashMap.put("planTypeName", wmsBusinessType.getName()); // 出库类型名称
/* 来自计划明细 */
hashMap.put("detailBatchNum", wmsOutPlanDetail.getDetailBatchNum()); // 明细批次
hashMap.put("wmStorageAreaId", wmsOutPlanDetail.getWmStorageAreaId()); // 库位ID
hashMap.put("wmStorageAreaCode", wmsOutPlanDetail.getWmStorageAreaCode()); // 库位编码
hashMap.put("wmStorageAreaName", wmsOutPlanDetail.getWmStorageAreaName()); // 库位名称
hashMap.put("wmStorageAreaId", wmStorageArea.getAreaId()); // 库位ID
hashMap.put("wmStorageAreaCode", wmStorageArea.getAreaCode()); // 库位编码
hashMap.put("wmStorageAreaName", wmStorageArea.getAreaName()); // 库位名称
hashMap.put("cellX", wmStorageArea.getPositionX().toString());
hashMap.put("cellY", wmStorageArea.getPositionY().toString());
hashMap.put("cellZ", wmStorageArea.getPositionZ().toString());
@ -136,7 +162,15 @@ public class WmsOutTaskServiceImpl implements IWmsOutTaskService {
*/
@Override
public List<WmsOutTask> selectWmsOutTaskList(WmsOutTask wmsOutTask) {
return wmsOutTaskMapper.selectWmsOutTaskList(wmsOutTask);
List<WmsOutTask> wmsOutTaskList = wmsOutTaskMapper.selectWmsOutTaskList(wmsOutTask);
wmsOutTaskList.forEach(nowWmsOutTask -> {
WmsOutPlanDetailEntity entityQuery = new WmsOutPlanDetailEntity();
entityQuery.setWmsOutPlanDetailId(nowWmsOutTask.getWmsOutPlanDetailId());
nowWmsOutTask.setBaseKnifes(wmsOutPlanDetailEntityMapper.selectWmsOutPlanDetailEntityList(entityQuery).stream()
.map(it -> this.baseKnifeMapper.selectBaseKnifeByBaseKnifeId(it.getBaseKnifeId()))
.filter(Objects::nonNull).collect(Collectors.toList()));
});
return wmsOutTaskList;
}
/**
@ -205,15 +239,69 @@ public class WmsOutTaskServiceImpl implements IWmsOutTaskService {
2,
1
);
// 获取料箱明细
UcmCtMaterial ucmCtMaterialQuery = new UcmCtMaterial();
ucmCtMaterialQuery.setBaseKnifeId(wmsOutPlanDetailEntity.getBaseKnifeId());
List<UcmCtMaterial> ucmCtMaterials = this.ucmCtMaterialMapper2.selectUcmCtMaterialList(ucmCtMaterialQuery);
ucmCtMaterials.forEach(ucmCtMaterial -> {
UcmCtBase ucmCtBase = this.ucmCtBaseMapper.selectUcmCtBaseByCtBaseId(ucmCtMaterial.getCtBaseId().toString());
if (ucmCtBase != null) {
ucmCtBase.setAttr1(null);
this.ucmCtBaseMapper.updateUcmCtBase(ucmCtBase);
}
});
}
// 更新出库任务状态
wmsOutTask.setTaskState("1");
wmsOutTaskMapper.updateWmsOutTask(wmsOutTask);
// 完成标识
boolean flag = true;
// 判断是否来自组装任务
WmsZdTask wmsZdTaskWrapper = new WmsZdTask();
wmsZdTaskWrapper.setCode(wmsOutTask.getWmsOutPlanCode());
List<WmsZdTask> wmsZdTaskList = wmsZdTaskMapper.selectWmsZdTaskList(wmsZdTaskWrapper);
if (!wmsZdTaskList.isEmpty()) {
// 获取组装任务
WmsZdTask wmsZdTask = wmsZdTaskList.get(0);
// 检测是否完成
WmsOutTask wmsOutTaskWrapper = new WmsOutTask();
wmsOutTaskWrapper.setWmsOutPlanCode(wmsZdTask.getCode());
List<WmsOutTask> wmsOutTaskList = wmsOutTaskMapper.selectWmsOutTaskList(wmsOutTaskWrapper);
// 遍历状态
for (WmsOutTask item : wmsOutTaskList) {
if (Objects.equals("0", item.getTaskState())) {
flag = false;
break;
}
}
}
if (flag) {
this.wmsZdTaskFinish(wmsOutTask.getWmsOutPlanCode());
}
}
return true;
}
public void wmsZdTaskFinish(String planCode) {
WmsZdTask wmsZdTaskWrapper = new WmsZdTask();
wmsZdTaskWrapper.setCode(planCode);
List<WmsZdTask> wmsZdTaskList = wmsZdTaskMapper.selectWmsZdTaskList(wmsZdTaskWrapper);
if (!wmsZdTaskList.isEmpty()) {
// 获取组装任务 更新状态
WmsZdTask wmsZdTask = wmsZdTaskList.get(0);
wmsZdTask.setStatus("1");
wmsZdTaskMapper.updateWmsZdTask(wmsZdTask);
}
}
@Transactional
@Override
public boolean autoRunWmsOutTask(Long[] wmsOutTaskIds) {

View File

@ -91,6 +91,11 @@ public class UcmCtBaseController extends BaseController {
}
}
@PostMapping("/open/add")
public String openAdd(@RequestBody UcmCtBase ucmCtBase) {
return ucmCtBaseService.addUcmCtBase(ucmCtBase);
}
/**
* 查询料箱管理列表
*/

View File

@ -2,7 +2,9 @@ package com.ktg.mes.wm.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import com.ktg.mes.wm.domain.dto.WmsInboundOrderDto;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -62,7 +64,7 @@ public class WmsInPlanController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('wm:PLAN:query')")
@GetMapping(value = "/{planId}")
public AjaxResult getInfo(@PathVariable("planId") String planId) {
public AjaxResult getInfo(@PathVariable("planId") Long planId) {
return AjaxResult.success(wmsInPlanService.selectWmsInPlanByPlanId(planId));
}
@ -82,6 +84,13 @@ public class WmsInPlanController extends BaseController {
return toAjax(wmsInPlanService.insertWmsInPlan(wmsInPlan));
}
@Log(title = "入库计划", businessType = BusinessType.INSERT)
@PostMapping("/open/order/add")
public AjaxResult openOrderAdd(@RequestBody @Valid WmsInboundOrderDto wmsInboundOrderDto) {
wmsInPlanService.insertOrderWmsInPlan(wmsInboundOrderDto);
return AjaxResult.success("入库任务创建成功");
}
/**
* 修改入库计划
*/

View File

@ -1,31 +1,37 @@
package com.ktg.mes.wm.controller;
import com.alibaba.fastjson.JSON;
import com.ktg.common.annotation.Log;
import com.ktg.common.core.controller.BaseController;
import com.ktg.common.core.domain.AjaxResult;
import com.ktg.common.core.page.TableDataInfo;
import com.ktg.common.enums.BusinessType;
import com.ktg.common.utils.DateUtils;
import com.ktg.common.utils.StringUtils;
import com.ktg.common.utils.poi.ExcelUtil;
import com.ktg.mes.md.domain.BaseKnife;
import com.ktg.mes.md.domain.MdItem;
import com.ktg.mes.cal.utils.CalendarUtil;
import com.ktg.mes.md.domain.*;
import com.ktg.mes.md.mapper.*;
import com.ktg.mes.md.service.IBaseKnifeService;
import com.ktg.mes.md.service.IMdItemService;
import com.ktg.mes.wm.domain.WmStorageArea;
import com.ktg.mes.wm.domain.WmsInPlanDetailEntity;
import com.ktg.mes.wm.domain.WmsInTask;
import com.ktg.mes.wm.service.IWmStorageAreaService;
import com.ktg.mes.wm.service.IWmsInPlanDetailEntityService;
import com.ktg.mes.wm.service.IWmsInTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import com.ktg.mes.wm.domain.*;
import com.ktg.mes.wm.mapper.ProductionArrangementsMapper;
import com.ktg.mes.wm.mapper.WmStorageAreaMapper;
import com.ktg.mes.wm.service.*;
import lombok.RequiredArgsConstructor;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Stream;
import java.io.IOException;
import java.util.*;
import static com.ktg.generator.util.MultiModuleCodeGenerator.generateTaskCode;
/**
* 入库任务Controller
@ -34,18 +40,28 @@ import java.util.stream.Stream;
* @date 2024-11-01
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/wm/wmsInTask")
public class WmsInTaskController extends BaseController {
@Autowired
private IWmsInTaskService wmsInTaskService;
@Autowired
private IMdItemService mdItemService;
@Autowired
private IBaseKnifeService baseKnifeService;
@Autowired
private IWmStorageAreaService wmStorageAreaService;
@Autowired
private IWmsInPlanDetailEntityService wmsInPlanDetailEntityService;
private final IWmsInTaskService wmsInTaskService;
private final IMdItemService mdItemService;
private final IBaseKnifeService baseKnifeService;
private final IWmStorageAreaService wmStorageAreaService;
private final IWmsInPlanDetailEntityService wmsInPlanDetailEntityService;
private final WmsOutPlanDetailEntityMapper wmsOutPlanDetailEntityMapper;
private final IUcmCtBaseService ucmCtBaseService;
private final IWmStorageLocationService wmStorageLocationService;
private final BaseKnifeLockedMapper baseKnifeLockedMapper;
private final IUcmCtBaseService umcCtBaseService;
private final ProductionArrangementsMapper productionArrangementsMapper;
private final BaseTechnologyBomMapper baseTechnologyBomMapper;
private final BaseKnifeMapper baseKnifeMapper;
private final WmsOutPlanMapper wmsOutPlanMapper;
private final WmsOutTaskMapper wmsOutTaskMapper;
private final MdItemMapper mdItemMapper;
private final WmStorageAreaMapper wmStorageAreaMapper;
private final MyConfig myConfig;
/**
* 查询入库任务列表
@ -89,6 +105,45 @@ public class WmsInTaskController extends BaseController {
return AjaxResult.success(wmsInTaskService.selectWmsInTaskById(id));
}
/**
* 根据料箱rfid查询入库任务信息
*/
@GetMapping(value = "/open/box/{rfid}")
public AjaxResult getInfoByBox(@PathVariable("rfid") String rfid) {
WmsInTask wmsInTask = wmsInTaskService.selectWmsInTaskByBoxRfid(rfid);
if (wmsInTask == null) {
return AjaxResult.error("未查询到相关任务");
}
// 获得料箱
UcmCtBase ucmCtBaseByCode = ucmCtBaseService.selectUcmCtBaseByCode(rfid);
if (ucmCtBaseByCode == null) {
return AjaxResult.error("未查询到相关料箱");
}
// 自动分配非临时库位
if (wmsInTask.getCellCode().equals("TEMP")) {
WmStorageArea wmStorageArea = this.wmStorageLocationService.queryOneAreaByLocationCode("DDJ01", ucmCtBaseByCode.getAttr3() != null && ucmCtBaseByCode.getAttr3() == 1);
wmsInTask.setCellTgt(wmStorageArea.getAreaId());
wmsInTask.setCellName(wmStorageArea.getAreaName());
wmsInTask.setCellCode(wmStorageArea.getAreaCode());
wmsInTask.setCellX(wmStorageArea.getPositionX().toString());
wmsInTask.setCellY(wmStorageArea.getPositionY().toString());
wmsInTask.setCellZ(wmStorageArea.getPositionZ().toString());
}
// 将料箱rfid绑定至任务
wmsInTask.setBoxRfid(rfid);
// 将库位信息填充至料箱
UcmCtBase ucmCtBase = ucmCtBaseService.selectUcmCtBaseByCode(wmsInTask.getBoxRfid());
ucmCtBase.setAttr1(wmsInTask.getCellTgt().toString());
ucmCtBaseService.updateUcmCtBase(ucmCtBase);
wmsInTaskService.updateWmsInTask(wmsInTask);
return AjaxResult.success(wmsInTask);
}
/**
* 新增入库任务
*/
@ -144,23 +199,63 @@ public class WmsInTaskController extends BaseController {
// 入库类型为整刀回库
if (Objects.equals(wmsInTask.getPlanTypeId(), "9")) {
// 插入台账数据
wmsInPlanDetailEntityList.forEach(planDetailEntity -> {
BaseKnife baseKnife = baseKnifeService.selectBaseKnifeByBaseKnifeId(planDetailEntity.getKnifeId());
// 计算消耗寿命
int consumeLife = baseKnife.getKnifeLife() - (planDetailEntity.getConsumeLife() % 100);
baseKnife.setKnifeLife(consumeLife);
// 计算重置次数
int resetCount = baseKnife.getResetCount() - (planDetailEntity.getConsumeLife() / 100);
baseKnife.setResetCount(resetCount);
// 设置状态为 解锁
baseKnife.setIsLocked(0);
// 设置工具状态 已入库
baseKnife.setKnifeFineState(1);
if (StringUtils.isNotEmpty(planDetailEntity.getRfid())) {
baseKnife.setRfid(planDetailEntity.getRfid());
}
// 状态为生效
baseKnife.setIsValid(0);
// 设置库位信息
baseKnife.setAreaCode(wmStorageArea.getAreaCode());
baseKnife.setAreaName(wmStorageArea.getAreaName());
// 更新台账状态
baseKnifeService.updateBaseKnife(baseKnife);
// 判断物料是否有绑定了订单
if (baseKnife.getPlanSheet() != null){
// 获取台账锁定实体并将状态设置为已完成
BaseKnifeLocked baseKnifeLockedWrapper = new BaseKnifeLocked();
baseKnifeLockedWrapper.setStatus(0);
baseKnifeLockedWrapper.setBaseKnifeId(baseKnife.getBaseKnifeId());
baseKnifeLockedWrapper.setPlanSheet(baseKnife.getPlanSheet());
List<BaseKnifeLocked> baseKnifeLockedList = baseKnifeLockedMapper.selectBaseKnifeLockedList(baseKnifeLockedWrapper);
// 获取实体并修改状态
BaseKnifeLocked baseKnifeLocked;
if (!baseKnifeLockedList.isEmpty()){
baseKnifeLocked = baseKnifeLockedList.get(0);
baseKnifeLocked.setStatus(1);
baseKnifeLockedMapper.updateBaseKnifeLocked(baseKnifeLocked);
}
// 再次查询物料是否有预订订单
baseKnifeLockedWrapper.setPlanSheet(null);
baseKnifeLockedList = baseKnifeLockedMapper.selectBaseKnifeLockedList(baseKnifeLockedWrapper);
if (!baseKnifeLockedList.isEmpty()){
baseKnifeLocked = baseKnifeLockedList.get(0);
baseKnife.setPlanSheet(baseKnifeLocked.getPlanSheet());
baseKnife.setIsLocked(1);
baseKnife.setLockedStartTime(baseKnifeLocked.getLockedStartTime());
baseKnife.setLockedEndTime(baseKnifeLocked.getLockedEndTime());
baseKnifeService.updateBaseKnife(baseKnife);
// 检测订单是否完成完成则出库整刀
if (this.checkFinal(baseKnifeLocked.getPlanSheet())) {
try {
this.createOutTask(baseKnifeLocked.getPlanSheet());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
} else {
// 订单解绑
baseKnife.setPlanSheet("");
baseKnifeService.updateBaseKnife(baseKnife);
}
}
});
} else if (Objects.equals(wmsInTask.getPlanTypeId(), "15")) {
// 拆刀回库
@ -206,6 +301,38 @@ public class WmsInTaskController extends BaseController {
baseKnifeService.insertBaseKnife(baseKnife);
});
mdItemService.updateMdItem(mbbBdMrlMitm);
} else if (Objects.equals(wmsInTask.getPlanTypeCode(), "CGRK")) {
// 插入台账数据
wmsInPlanDetailEntityList.forEach(planDetailEntity -> {
BaseKnife baseKnife = baseKnifeService.selectBaseKnifeByBaseKnifeId(planDetailEntity.getKnifeId());
// 设置状态为 解锁
baseKnife.setIsLocked(0);
// 设置工具状态 已入库
baseKnife.setKnifeFineState(1);
// 状态为生效
baseKnife.setIsValid(0);
// 设置库位信息
baseKnife.setAreaCode(wmStorageArea.getAreaCode());
baseKnife.setAreaName(wmStorageArea.getAreaName());
// 更新台账状态
baseKnifeService.updateBaseKnife(baseKnife);
});
} else if (Objects.equals(wmsInTask.getPlanTypeCode(), "GJHK")) {
// 插入台账数据
wmsInPlanDetailEntityList.forEach(planDetailEntity -> {
BaseKnife baseKnife = baseKnifeService.selectBaseKnifeByBaseKnifeId(planDetailEntity.getKnifeId());
// 设置状态为 解锁
baseKnife.setIsLocked(0);
// 设置工具状态 已入库
baseKnife.setKnifeFineState(1);
// 状态为生效
baseKnife.setIsValid(0);
// 设置库位信息
baseKnife.setAreaCode(wmStorageArea.getAreaCode());
baseKnife.setAreaName(wmStorageArea.getAreaName());
// 更新台账状态
baseKnifeService.updateBaseKnife(baseKnife);
});
} else {
for (int i = 0; i < wmsInTask.getActualInQuantity(); i++) {
// 生成台账
@ -232,4 +359,209 @@ public class WmsInTaskController extends BaseController {
}
return toAjax(1);
}
// 检查订单完成状态
public Boolean checkFinal(String planSheet) {
// 获取订单记录
ProductionArrangements productionArrangements = productionArrangementsMapper.selectProductionArrangementsByPlanSheet(planSheet);
BaseTechnologyBom baseTechnologyBomWrapper = new BaseTechnologyBom();
baseTechnologyBomWrapper.setTechnologyCode(productionArrangements.getTechnologyCode());
List<BaseTechnologyBom> baseTechnologyBomList = baseTechnologyBomMapper.selectBaseTechnologyBomList(baseTechnologyBomWrapper);
// 判断订单锁定的物料是否足够
for (BaseTechnologyBom technologyBom : baseTechnologyBomList) {
BaseKnife baseKnifeWrapper = new BaseKnife();
baseKnifeWrapper.setPlanSheet(planSheet);
baseKnifeWrapper.setKnifeCode(technologyBom.getKnifeCode());
List<BaseKnife> baseKnifePlanSheetList = baseKnifeMapper.selectBaseKnifeList(baseKnifeWrapper);
if (baseKnifePlanSheetList.size() < technologyBom.getKnifeCount()) return false;
}
return true;
}
// 检查订单完成状态
@Transactional
public void createOutTask(String planSheet) throws IOException {
// 构建出库计划
WmsOutPlan outPlan = new WmsOutPlan();
outPlan.setPlanCode(planSheet);
outPlan.setWmsBusinessTypeId(16L);
outPlan.setPlanState("1");
outPlan.setPlanType("ZDCK");
// outPlan.setCreateBy(getUsername());
outPlan.setCreateTime(DateUtils.getNowDate());
wmsOutPlanMapper.insertWmsOutPlan(outPlan);
// 所有的物料
List<BaseKnife> baseKnifeResultList = new ArrayList<>();
// 获取订单记录
ProductionArrangements productionArrangements = productionArrangementsMapper.selectProductionArrangementsByPlanSheet(planSheet);
BaseTechnologyBom baseTechnologyBomWrapper = new BaseTechnologyBom();
baseTechnologyBomWrapper.setTechnologyCode(productionArrangements.getTechnologyCode());
List<BaseTechnologyBom> baseTechnologyBomList = baseTechnologyBomMapper.selectBaseTechnologyBomList(baseTechnologyBomWrapper);
// 判断订单锁定的物料是否足够
for (BaseTechnologyBom technologyBom : baseTechnologyBomList) {
BaseKnife baseKnifeWrapper = new BaseKnife();
baseKnifeWrapper.setPlanSheet(planSheet);
baseKnifeWrapper.setKnifeCode(technologyBom.getKnifeCode());
List<BaseKnife> baseKnifeLockedList = baseKnifeMapper.selectBaseKnifeList(baseKnifeWrapper);
if (baseKnifeLockedList.size() == technologyBom.getKnifeCount())
baseKnifeResultList.addAll(baseKnifeLockedList);
}
String batchNum = "SCZBPC01";
// 出库任务进行整刀的出库
HashMap<Long, HashMap<String, List<BaseKnife>>> baseKnifeHashMapMap = new HashMap<>();
// 遍历构建map
baseKnifeResultList.forEach(item -> {
// 判断当前物料主键是否已经被收录
baseKnifeHashMapMap.computeIfAbsent(item.getMbbBdMrlId(), k -> new HashMap<>());
// 判断当前库位编码是否已经被收录
baseKnifeHashMapMap.get(item.getMbbBdMrlId()).computeIfAbsent(item.getAreaCode(), k -> new ArrayList<>());
// 对当前台账对象进行收录
baseKnifeHashMapMap.get(item.getMbbBdMrlId()).get(item.getAreaCode()).add(item);
});
// 生成出库计划明细
WmsOutPlan outPlanTemp = outPlan;
baseKnifeHashMapMap.keySet().forEach(mdItemId -> {
MdItem mdItemOutPlan = mdItemMapper.selectMdItemById(mdItemId);
// 根据库位编码遍历
baseKnifeHashMapMap.get(mdItemId).keySet().forEach(areaCode -> {
// 获得库位对象
WmStorageArea wmStorageAreaOutPlan = wmStorageAreaMapper.selectWmStorageAreaByAreaCode(areaCode);
WmsOutPlanDetail outPlanDetail = new WmsOutPlanDetail();
outPlanDetail.setWmsOutPlanId(outPlanTemp.getWmsOutPlanId());
outPlanDetail.setMdItemId(mdItemId);
outPlanDetail.setMdItemCode(mdItemOutPlan.getItemCode());
outPlanDetail.setMdItemName(mdItemOutPlan.getItemName());
outPlanDetail.setMdItemUnit(mdItemOutPlan.getUnitName());
outPlanDetail.setPlannedQuantity(baseKnifeHashMapMap.get(mdItemId).get(areaCode).size());
outPlanDetail.setRealQuantity(baseKnifeHashMapMap.get(mdItemId).get(areaCode).size());
outPlanDetail.setDetailBatchNum(batchNum);
outPlanDetail.setWmStorageAreaId(wmStorageAreaOutPlan.getAreaId());
outPlanDetail.setWmStorageAreaCode(wmStorageAreaOutPlan.getAreaCode());
outPlanDetail.setWmStorageAreaName(wmStorageAreaOutPlan.getAreaName());
outPlanDetail.setDetailState("1");
outPlanDetail.setCreateTime(DateUtils.getNowDate());
wmsOutPlanMapper.insertWmsOutPlanDetail(outPlanDetail);
// 遍历台账对象
baseKnifeHashMapMap.get(mdItemId).get(areaCode).forEach(item -> {
// 构建出库计划明细实体
WmsOutPlanDetailEntity wmsOutPlanDetailEntity = new WmsOutPlanDetailEntity();
wmsOutPlanDetailEntity.setWmsOutPlanDetailId(outPlanDetail.getWmsOutPlanDetailId());
wmsOutPlanDetailEntity.setBaseKnifeId(item.getBaseKnifeId());
wmsOutPlanDetailEntity.setAreaCode(item.getAreaCode());
wmsOutPlanDetailEntity.setItemOrProduct(item.getItemOrProduct());
wmsOutPlanDetailEntity.setKnifeCode(item.getKnifeCode());
wmsOutPlanDetailEntity.setKnifeName(item.getKnifeName());
wmsOutPlanDetailEntity.setPlanSheet(item.getPlanSheet());
wmsOutPlanDetailEntity.setKnifeLife(item.getKnifeLife());
wmsOutPlanDetailEntity.setResetCount(item.getResetCount());
wmsOutPlanDetailEntity.setKnifeUnit(item.getKnifeUnit());
wmsOutPlanDetailEntity.setSafeStock(item.getKnifeType());
wmsOutPlanDetailEntity.setStandardQuantity(item.getStandardQuantity());
wmsOutPlanDetailEntity.setCreateTime(DateUtils.getNowDate());
wmsOutPlanDetailEntityMapper.insertWmsOutPlanDetailEntity(wmsOutPlanDetailEntity);
});
// 生成出库任务
WmsOutTask wmsOutTask = new WmsOutTask();
wmsOutTask.setWmsOutPlanId(outPlanTemp.getWmsOutPlanId());
wmsOutTask.setWmsOutPlanCode(outPlanTemp.getPlanCode());
wmsOutTask.setWmsOutPlanDetailId(outPlanDetail.getWmsOutPlanDetailId());
// 出库类型 12组刀出库
wmsOutTask.setWmsBusinessTypeId(12L);
wmsOutTask.setTaskCode(generateTaskCode("CKT"));
wmsOutTask.setTaskNumber(outPlanDetail.getPlannedQuantity());
wmsOutTask.setOutNumber(outPlanDetail.getRealQuantity());
wmsOutTask.setWmStorageAreaId(outPlanDetail.getWmStorageAreaId());
wmsOutTask.setBatchNum(batchNum);
wmsOutTask.setMdItemId(outPlanDetail.getMdItemId());
wmsOutTask.setMdItemCode(outPlanDetail.getMdItemCode());
wmsOutTask.setMdItemName(outPlanDetail.getMdItemName());
wmsOutTask.setMdItemUnit(outPlanDetail.getMdItemUnit());
wmsOutTask.setTaskState("0");
wmsOutTask.setRecipientUsername("");
wmsOutTask.setCreateTime(DateUtils.getNowDate());
wmsOutTaskMapper.insertWmsOutTask(wmsOutTask);
});
});
productionArrangements.setStatus(1);
productionArrangementsMapper.updateProductionArrangements(productionArrangements);
// 给产线控制系统发指令
this.productionArrangementsIsOk(productionArrangements);
}
// 调用生产准备完成接口
public void productionArrangementsIsOk(ProductionArrangements productionArrangements) throws IOException {
// 产线控制系统生产准备完成接口
String url = myConfig.getProductionControlPath() + "/cutterapi/cutComplete";
// 请求客户端
OkHttpClient client = new OkHttpClient();
// 构建请求数据
Map<String, Object> requestMap = new HashMap<>();
requestMap.put("prodordercode", productionArrangements.getPlanSheet());
requestMap.put("result", "0");
requestMap.put("completetime", CalendarUtil.getDateTimeStr());
// 获取工艺信息
BaseTechnologyBom technologyBomWrapper = new BaseTechnologyBom();
technologyBomWrapper.setTechnologyCode(productionArrangements.getTechnologyCode());
List<BaseTechnologyBom> technologyBomList = baseTechnologyBomMapper.selectBaseTechnologyBomList(technologyBomWrapper);
BaseKnife baseKnifeWrapper = new BaseKnife();
baseKnifeWrapper.setPlanSheet(productionArrangements.getPlanSheet());
// 获取刀具信息
List<Map<String, String>> cutterList = new ArrayList<>();
technologyBomList.forEach(baseTechnologyBom -> {
baseKnifeWrapper.setKnifeCode(baseTechnologyBom.getKnifeCode());
List<BaseKnife> baseKnifeList = baseKnifeMapper.selectBaseKnifeList(baseKnifeWrapper);
baseKnifeList.forEach(baseKnife -> {
Map<String, String> map = new HashMap<>();
map.put("specno", baseTechnologyBom.getProcessCode());
map.put("code", baseKnife.getKnifeCode());
map.put("name", baseKnife.getKnifeName());
map.put("life", baseKnife.getKnifeLife().toString());
cutterList.add(map);
});
});
requestMap.put("cutterinfo", cutterList);
// 构建请求数据
MediaType mediaType = MediaType.parse("application/json; charset=utf-8");
okhttp3.RequestBody requestBody = okhttp3.RequestBody.create(mediaType, JSON.toJSONString(requestMap));
// 请求体
Request request = new Request.Builder()
.url(url)
.post(requestBody)
.build();
// 发送请求
try(Response response = client.newCall(request).execute()) {
if (!response.isSuccessful())
throw new IOException("Unexpected code " + response);
// 请求响应
String responseBody = response.body().string();
System.out.println(responseBody);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}

View File

@ -1,11 +1,12 @@
package com.ktg.mes.wm.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ktg.common.annotation.Excel;
import com.ktg.common.core.domain.BaseEntity;
import java.util.List;
import java.sql.Date;
/**
* 生产准备记录对象 PRODUCTION_ARRANGEMENTS
@ -25,11 +26,8 @@ public class ProductionArrangements extends BaseEntity
private String planSheet;
/** 工序号 */
@Excel(name = "工序号")
private String processCode;
@Excel(name = "工序号")
private List<String> processCodes;
@Excel(name = "工艺编码")
private String technologyCode;
@Excel(name = "工序号")
private String processUnit;
@ -38,6 +36,12 @@ public class ProductionArrangements extends BaseEntity
@Excel(name = "状态")
private Integer status;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date endTime;
/** 预留字段1 */
@Excel(name = "预留字段1")
private String attr1;
@ -72,17 +76,16 @@ public class ProductionArrangements extends BaseEntity
{
return planSheet;
}
public void setProcessCode(String processCode)
{
this.processCode = processCode;
public String getTechnologyCode() {
return technologyCode;
}
public String getProcessCode()
{
return processCode;
public void setTechnologyCode(String technologyCode) {
this.technologyCode = technologyCode;
}
public void setStatus(Integer status)
{
public void setStatus(Integer status) {
this.status = status;
}
@ -94,13 +97,7 @@ public class ProductionArrangements extends BaseEntity
this.processUnit = processUnit;
}
public List<String> getProcessCodes() {
return processCodes;
}
public void setProcessCodes(List<String> processCodes) {
this.processCodes = processCodes;
}
public Integer getStatus()
{
@ -143,13 +140,28 @@ public class ProductionArrangements extends BaseEntity
return attr4;
}
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
@Override
public String toString() {
return "ProductionArrangements{" +
"productionArrangementsId='" + productionArrangementsId + '\'' +
", planSheet='" + planSheet + '\'' +
", processCode='" + processCode + '\'' +
", processCodes=" + processCodes +
", processUnit='" + processUnit + '\'' +
", status=" + status +
", attr1='" + attr1 + '\'' +

View File

@ -1,112 +1,116 @@
package com.ktg.mes.wm.domain;
import com.ktg.mes.md.domain.BaseKnife;
import com.ktg.mes.md.domain.MbbProduBom;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ktg.common.annotation.Excel;
import com.ktg.common.core.domain.BaseEntity;
import com.ktg.mes.md.domain.BaseKnife;
import java.util.List;
/**
* 料箱管理对象 UCM_CT_BASE
*
*
* @author yinjinlu
* @date 2024-10-31
*/
public class UcmCtBase extends BaseEntity
{
public class UcmCtBase extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 料箱id */
/**
* 料箱id
*/
private String ctBaseId;
/** 料箱编码 */
/**
* 料箱编码
*/
@Excel(name = "料箱编码")
private String code;
/** 料箱状态0-正常1-绑定2-解绑 */
/**
* 料箱状态0-正常1-绑定2-解绑
*/
@Excel(name = "料箱状态0-正常1-绑定2-解绑")
private String type;
/** 预留字段1 */
/**
* 预留字段1表示当前料箱所在库位ID
*/
private String attr1;
/** 预留字段2 */
/**
* 预留字段2
*/
private String attr2;
/** 预留字段3 */
private String attr3;
/**
* 预留字段3为空或者0表示普通料箱为1表示大号料箱
*/
private Integer attr3;
/** 预留字段4 */
private String attr4;
/**
* 预留字段4
*/
private Integer attr4;
/** BOM物料信息 */
/**
* BOM物料信息
*/
private List<BaseKnife> baseKnifeList;
public void setCtBaseId(String ctBaseId)
{
public void setCtBaseId(String ctBaseId) {
this.ctBaseId = ctBaseId;
}
public String getCtBaseId()
{
public String getCtBaseId() {
return ctBaseId;
}
public void setCode(String code)
{
public void setCode(String code) {
this.code = code;
}
public String getCode()
{
public String getCode() {
return code;
}
public void setType(String type)
{
public void setType(String type) {
this.type = type;
}
public String getType()
{
public String getType() {
return type;
}
public void setAttr1(String attr1)
{
public void setAttr1(String attr1) {
this.attr1 = attr1;
}
public String getAttr1()
{
public String getAttr1() {
return attr1;
}
public void setAttr2(String attr2)
{
public void setAttr2(String attr2) {
this.attr2 = attr2;
}
public String getAttr2()
{
public String getAttr2() {
return attr2;
}
public void setAttr3(String attr3)
{
public Integer getAttr3() {
return attr3;
}
public void setAttr3(Integer attr3) {
this.attr3 = attr3;
}
public String getAttr3()
{
return attr3;
}
public void setAttr4(String attr4)
{
this.attr4 = attr4;
public Integer getAttr4() {
return attr4;
}
public String getAttr4()
{
return attr4;
public void setAttr4(Integer attr4) {
this.attr4 = attr4;
}
public List<BaseKnife> getBaseKnifeList() {
@ -119,19 +123,15 @@ public class UcmCtBase extends BaseEntity
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("ctBaseId", getCtBaseId())
.append("code", getCode())
.append("type", getType())
.append("remark", getRemark())
.append("attr1", getAttr1())
.append("attr2", getAttr2())
.append("attr3", getAttr3())
.append("attr4", getAttr4())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
return "UcmCtBase{" +
"ctBaseId='" + ctBaseId + '\'' +
", code='" + code + '\'' +
", type='" + type + '\'' +
", attr1='" + attr1 + '\'' +
", attr2='" + attr2 + '\'' +
", attr3=" + attr3 +
", attr4=" + attr4 +
", baseKnifeList=" + baseKnifeList +
'}';
}
}

View File

@ -1,162 +1,179 @@
package com.ktg.mes.wm.domain;
import java.math.BigDecimal;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ktg.common.annotation.Excel;
import com.ktg.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.math.BigDecimal;
/**
* 库位设置对象 wm_storage_area
*
*
* @author yinjinlu
* @date 2022-05-08
*/
public class WmStorageArea extends BaseEntity
{
public class WmStorageArea extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 库位ID */
/**
* 库位ID
*/
private Long areaId;
/** 库位编码 */
/**
* 库位编码
*/
@Excel(name = "库位编码")
private String areaCode;
/** 库位名称 */
/**
* 库位名称
*/
@Excel(name = "库位名称")
private String areaName;
/** 库区ID */
/**
* 库区ID
*/
@Excel(name = "库区ID")
private Long locationId;
/** 面积 */
/**
* 面积
*/
@Excel(name = "面积")
private BigDecimal area;
/** 最大载重量 */
/**
* 最大载重量
*/
@Excel(name = "最大载重量")
private BigDecimal maxLoa;
/** 库位位置X */
/**
* 库位位置X
*/
@Excel(name = "库位位置X")
private Long positionX;
/** 库位位置y */
/**
* 库位位置y
*/
@Excel(name = "库位位置y")
private Long positionY;
/** 库位位置z */
/**
* 库位位置z
*/
@Excel(name = "库位位置z")
private Long positionZ;
/** 是否启用 */
/**
* 是否启用
*/
@Excel(name = "是否启用")
private String enableFlag;
private String frozenFlag;
/** 预留字段1 */
/**
* 预留字段1
*/
private String attr1;
/** 预留字段2 */
/**
* 预留字段2
*/
private String attr2;
/** 预留字段3 */
/**
* 预留字段3 - 为空或者0表示普通空间-1表示大空间
*/
private Long attr3;
/** 预留字段4 */
/**
* 预留字段4 - 为空或者0表示启用-1表示禁用
*/
private Long attr4;
public void setAreaId(Long areaId)
{
public void setAreaId(Long areaId) {
this.areaId = areaId;
}
public Long getAreaId()
{
public Long getAreaId() {
return areaId;
}
public void setAreaCode(String areaCode)
{
public void setAreaCode(String areaCode) {
this.areaCode = areaCode;
}
public String getAreaCode()
{
public String getAreaCode() {
return areaCode;
}
public void setAreaName(String areaName)
{
public void setAreaName(String areaName) {
this.areaName = areaName;
}
public String getAreaName()
{
public String getAreaName() {
return areaName;
}
public void setLocationId(Long locationId)
{
public void setLocationId(Long locationId) {
this.locationId = locationId;
}
public Long getLocationId()
{
public Long getLocationId() {
return locationId;
}
public void setArea(BigDecimal area)
{
public void setArea(BigDecimal area) {
this.area = area;
}
public BigDecimal getArea()
{
public BigDecimal getArea() {
return area;
}
public void setMaxLoa(BigDecimal maxLoa)
{
public void setMaxLoa(BigDecimal maxLoa) {
this.maxLoa = maxLoa;
}
public BigDecimal getMaxLoa()
{
public BigDecimal getMaxLoa() {
return maxLoa;
}
public void setPositionX(Long positionX)
{
public void setPositionX(Long positionX) {
this.positionX = positionX;
}
public Long getPositionX()
{
public Long getPositionX() {
return positionX;
}
public void setPositionY(Long positionY)
{
public void setPositionY(Long positionY) {
this.positionY = positionY;
}
public Long getPositionY()
{
public Long getPositionY() {
return positionY;
}
public void setPositionZ(Long positionZ)
{
public void setPositionZ(Long positionZ) {
this.positionZ = positionZ;
}
public Long getPositionZ()
{
public Long getPositionZ() {
return positionZ;
}
public void setEnableFlag(String enableFlag)
{
public void setEnableFlag(String enableFlag) {
this.enableFlag = enableFlag;
}
public String getEnableFlag()
{
public String getEnableFlag() {
return enableFlag;
}
@ -168,65 +185,60 @@ public class WmStorageArea extends BaseEntity
this.frozenFlag = frozenFlag;
}
public void setAttr1(String attr1)
{
public void setAttr1(String attr1) {
this.attr1 = attr1;
}
public String getAttr1()
{
public String getAttr1() {
return attr1;
}
public void setAttr2(String attr2)
{
public void setAttr2(String attr2) {
this.attr2 = attr2;
}
public String getAttr2()
{
public String getAttr2() {
return attr2;
}
public void setAttr3(Long attr3)
{
public void setAttr3(Long attr3) {
this.attr3 = attr3;
}
public Long getAttr3()
{
public Long getAttr3() {
return attr3;
}
public void setAttr4(Long attr4)
{
public void setAttr4(Long attr4) {
this.attr4 = attr4;
}
public Long getAttr4()
{
public Long getAttr4() {
return attr4;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("areaId", getAreaId())
.append("areaCode", getAreaCode())
.append("areaName", getAreaName())
.append("locationId", getLocationId())
.append("area", getArea())
.append("maxLoa", getMaxLoa())
.append("positionX", getPositionX())
.append("positionY", getPositionY())
.append("positionZ", getPositionZ())
.append("enableFlag", getEnableFlag())
.append("remark", getRemark())
.append("attr1", getAttr1())
.append("attr2", getAttr2())
.append("attr3", getAttr3())
.append("attr4", getAttr4())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("areaId", getAreaId())
.append("areaCode", getAreaCode())
.append("areaName", getAreaName())
.append("locationId", getLocationId())
.append("area", getArea())
.append("maxLoa", getMaxLoa())
.append("positionX", getPositionX())
.append("positionY", getPositionY())
.append("positionZ", getPositionZ())
.append("enableFlag", getEnableFlag())
.append("remark", getRemark())
.append("attr1", getAttr1())
.append("attr2", getAttr2())
.append("attr3", getAttr3())
.append("attr4", getAttr4())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -1,7 +1,10 @@
package com.ktg.mes.wm.domain;
import java.util.Date;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ktg.common.annotation.Excel;
@ -13,6 +16,8 @@ import com.ktg.common.core.domain.BaseEntity;
* @author yinjinlu
* @date 2024-10-31
*/
@Getter
@Setter
public class WmsInPlan extends BaseEntity {
private static final long serialVersionUID = 1L;
@ -55,7 +60,7 @@ public class WmsInPlan extends BaseEntity {
* 计划日期
*/
@Excel(name = "计划日期")
private String expectDate;
private Date expectDate;
/**
* 发布人
@ -150,206 +155,25 @@ public class WmsInPlan extends BaseEntity {
/**
* 入库类型
*/
@Excel(name = "入库类型")
private String planTypeId;
@Excel(name = "入库类型ID")
private Long planTypeId;
/**
* 入库类型编码
*/
private String planTypeCode;
/**
* 库区编码
*/
private String locationCode;
/**
* 入库计划明细信息
*/
private List<WmsInPlanDetails> wmsInPlanDetailsList;
public void setPlanId(Long planId) {
this.planId = planId;
}
public Long getPlanId() {
return planId;
}
public void setState(String state) {
this.state = state;
}
public String getState() {
return state;
}
public void setSourceType(String sourceType) {
this.sourceType = sourceType;
}
public String getSourceType() {
return sourceType;
}
public void setWareId(String wareId) {
this.wareId = wareId;
}
public String getWareId() {
return wareId;
}
public void setCellCode(String cellCode) {
this.cellCode = cellCode;
}
public String getCellCode() {
return cellCode;
}
public void setWorkOrderCode(String workOrderCode) {
this.workOrderCode = workOrderCode;
}
public String getWorkOrderCode() {
return workOrderCode;
}
public void setExpectDate(String expectDate) {
this.expectDate = expectDate;
}
public String getExpectDate() {
return expectDate;
}
public void setPublishName(String publishName) {
this.publishName = publishName;
}
public String getPublishName() {
return publishName;
}
public void setPublishTime(String publishTime) {
this.publishTime = publishTime;
}
public String getPublishTime() {
return publishTime;
}
public void setCloserId(String closerId) {
this.closerId = closerId;
}
public String getCloserId() {
return closerId;
}
public void setCloseTime(String closeTime) {
this.closeTime = closeTime;
}
public String getCloseTime() {
return closeTime;
}
public void setRelBillCode(String relBillCode) {
this.relBillCode = relBillCode;
}
public String getRelBillCode() {
return relBillCode;
}
public void setCustomerId(String customerId) {
this.customerId = customerId;
}
public String getCustomerId() {
return customerId;
}
public void setPoCode(String poCode) {
this.poCode = poCode;
}
public String getPoCode() {
return poCode;
}
public void setDepartmentId(String departmentId) {
this.departmentId = departmentId;
}
public String getDepartmentId() {
return departmentId;
}
public void setContractNo(String contractNo) {
this.contractNo = contractNo;
}
public String getContractNo() {
return contractNo;
}
public void setSupplierId(String supplierId) {
this.supplierId = supplierId;
}
public String getSupplierId() {
return supplierId;
}
public void setBusinessTypeId(String businessTypeId) {
this.businessTypeId = businessTypeId;
}
public String getBusinessTypeId() {
return businessTypeId;
}
public void setSrcOutTaskId(String srcOutTaskId) {
this.srcOutTaskId = srcOutTaskId;
}
public String getSrcOutTaskId() {
return srcOutTaskId;
}
public void setIsActive(String isActive) {
this.isActive = isActive;
}
public String getIsActive() {
return isActive;
}
public void setIsDelete(String isDelete) {
this.isDelete = isDelete;
}
public String getIsDelete() {
return isDelete;
}
public void setPlanCode(String planCode) {
this.planCode = planCode;
}
public String getPlanCode() {
return planCode;
}
public void setPlanTypeId(String planTypeId) {
this.planTypeId = planTypeId;
}
public String getPlanTypeId() {
return planTypeId;
}
public List<WmsInPlanDetails> getWmsInPlanDetailsList() {
return wmsInPlanDetailsList;
}
public void setWmsInPlanDetailsList(List<WmsInPlanDetails> wmsInPlanDetailsList) {
this.wmsInPlanDetailsList = wmsInPlanDetailsList;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
@ -381,6 +205,7 @@ public class WmsInPlan extends BaseEntity {
.append("isDelete", getIsDelete())
.append("planCode", getPlanCode())
.append("planTypeId", getPlanTypeId())
.append("planTypeCode", getPlanTypeCode())
.append("wmsInPlanDetailsList", getWmsInPlanDetailsList())
.toString();
}

View File

@ -1,5 +1,7 @@
package com.ktg.mes.wm.domain;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ktg.common.annotation.Excel;
@ -13,6 +15,8 @@ import java.util.List;
* @author yinjinlu
* @date 2024-11-01
*/
@Setter
@Getter
public class WmsInTask extends BaseEntity {
private static final long serialVersionUID = 1L;
@ -31,7 +35,7 @@ public class WmsInTask extends BaseEntity {
* 入库计划id
*/
@Excel(name = "入库计划id")
private String planInId;
private Long planInId;
/**
* 任务数量
@ -134,200 +138,15 @@ public class WmsInTask extends BaseEntity {
@Excel(name = "入库明细ID")
private Long detailInId;
/**
* 计划类型编码
*/
private String planTypeCode;
private String boxRfid;
private List<WmsInPlanDetailEntity> wmsInPlanDetailEntityList;
public void setId(Long id) {
this.id = id;
}
public Long getId() {
return id;
}
public void setTaskInCode(String taskInCode) {
this.taskInCode = taskInCode;
}
public String getTaskInCode() {
return taskInCode;
}
public void setPlanInId(String planInId) {
this.planInId = planInId;
}
public String getPlanInId() {
return planInId;
}
public void setTaskInQuantity(Integer taskInQuantity) {
this.taskInQuantity = taskInQuantity;
}
public Integer getTaskInQuantity() {
return taskInQuantity;
}
public void setActualInQuantity(Integer actualInQuantity) {
this.actualInQuantity = actualInQuantity;
}
public Integer getActualInQuantity() {
return actualInQuantity;
}
public void setCellTgt(Long cellTgt) {
this.cellTgt = cellTgt;
}
public Long getCellTgt() {
return cellTgt;
}
public void setCellOrig(String cellOrig) {
this.cellOrig = cellOrig;
}
public String getCellOrig() {
return cellOrig;
}
public String getCellName() {
return cellName;
}
public void setCellName(String cellName) {
this.cellName = cellName;
}
public String getCellCode() {
return cellCode;
}
public void setCellCode(String cellCode) {
this.cellCode = cellCode;
}
public String getCellX() {
return cellX;
}
public void setCellX(String cellX) {
this.cellX = cellX;
}
public String getCellY() {
return cellY;
}
public void setCellY(String cellY) {
this.cellY = cellY;
}
public String getCellZ() {
return cellZ;
}
public void setCellZ(String cellZ) {
this.cellZ = cellZ;
}
public void setIsActive(String isActive) {
this.isActive = isActive;
}
public String getIsActive() {
return isActive;
}
public void setIsDelete(String isDelete) {
this.isDelete = isDelete;
}
public String getIsDelete() {
return isDelete;
}
public void setBatch(String batch) {
this.batch = batch;
}
public String getBatch() {
return batch;
}
public void setMaterialId(String materialId) {
this.materialId = materialId;
}
public String getMaterialId() {
return materialId;
}
public void setPlanTypeId(String planTypeId) {
this.planTypeId = planTypeId;
}
public String getPlanTypeId() {
return planTypeId;
}
public void setPlanInStatus(String planInStatus) {
this.planInStatus = planInStatus;
}
public String getPlanInStatus() {
return planInStatus;
}
public void setPlanInCode(String planInCode) {
this.planInCode = planInCode;
}
public String getPlanInCode() {
return planInCode;
}
public void setMaterialCode(String materialCode) {
this.materialCode = materialCode;
}
public String getMaterialCode() {
return materialCode;
}
public Long getDetailInId() {
return detailInId;
}
public void setDetailInId(Long detailInId) {
this.detailInId = detailInId;
}
public String getMaterialName() {
return materialName;
}
public void setMaterialName(String materialName) {
this.materialName = materialName;
}
public String getMaterialUnit() {
return materialUnit;
}
public void setMaterialUnit(String materialUnit) {
this.materialUnit = materialUnit;
}
public List<WmsInPlanDetailEntity> getWmsInPlanDetailEntityList() {
return wmsInPlanDetailEntityList;
}
public void setWmsInPlanDetailEntityList(List<WmsInPlanDetailEntity> wmsInPlanDetailEntityList) {
this.wmsInPlanDetailEntityList = wmsInPlanDetailEntityList;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
@ -353,6 +172,7 @@ public class WmsInTask extends BaseEntity {
.append("batch", getBatch())
.append("materialId", getMaterialId())
.append("planTypeId", getPlanTypeId())
.append("planTypeCode", getPlanTypeCode())
.append("planInStatus", getPlanInStatus())
.append("planInCode", getPlanInCode())
.append("materialCode", getMaterialCode())

View File

@ -0,0 +1,25 @@
package com.ktg.mes.wm.domain.dto;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
// 根据订单入库
@Getter
@Setter
public class WmsInboundOrderDto {
// 订单号
@NotBlank(message = "订单号不能为空")
private String orderId;
// 物料编码
@NotBlank(message = "物料编码不能为空")
private String materialCode;
@NotBlank(message = "RFID不能为空")
private String rfid;
// 入库类型编码
@NotBlank(message = "入库类型编码不能为空")
private String typeCode;
}

View File

@ -2,6 +2,7 @@ package com.ktg.mes.wm.mapper;
import java.util.List;
import com.ktg.mes.wm.domain.ProductionArrangements;
import org.apache.ibatis.annotations.Mapper;
/**
* 生产准备记录Mapper接口
@ -9,6 +10,7 @@ import com.ktg.mes.wm.domain.ProductionArrangements;
* @author yinjinlu
* @date 2024-11-18
*/
@Mapper
public interface ProductionArrangementsMapper
{
/**

View File

@ -3,6 +3,7 @@ package com.ktg.mes.wm.mapper;
import java.util.List;
import com.ktg.mes.wm.domain.UcmCtBase;
import com.ktg.mes.wm.domain.UcmCtMaterial;
import org.apache.ibatis.annotations.Mapper;
/**
* 料箱管理Mapper接口
@ -10,7 +11,8 @@ import com.ktg.mes.wm.domain.UcmCtMaterial;
* @author yinjinlu
* @date 2024-10-31
*/
public interface UcmCtBaseMapper
@Mapper
public interface UcmCtBaseMapper
{
/**
* 查询料箱管理
@ -20,6 +22,14 @@ public interface UcmCtBaseMapper
*/
public UcmCtBase selectUcmCtBaseByCtBaseId(String ctBaseId);
/**
* 查询料箱管理
*
* @param code 物料code
* @return 料箱管理
*/
public UcmCtBase selectUcmCtBaseByCode(String code);
/**
* 查询料箱管理列表
*
@ -63,4 +73,6 @@ public interface UcmCtBaseMapper
public int deleteUcmCtBaseByCtBaseIds(String[] ctBaseIds);
void deleteUcmCtMaterialByCtBaseId(String ctBaseId);
List<String> selectNotEmptyAreaIdList();
}

View File

@ -3,6 +3,7 @@ package com.ktg.mes.wm.mapper;
import java.util.List;
import com.ktg.mes.wm.domain.WmStorageArea;
import com.ktg.mes.wm.domain.vo.AreaVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
/**
@ -11,6 +12,7 @@ import org.apache.ibatis.annotations.Select;
* @author yinjinlu
* @date 2022-05-08
*/
@Mapper
public interface WmStorageAreaMapper
{
/**

View File

@ -1,20 +1,22 @@
package com.ktg.mes.wm.mapper;
import java.util.List;
import com.ktg.mes.wm.domain.WmStorageLocation;
import com.ktg.mes.wm.domain.vo.WmStorageLocationVo;
import org.apache.ibatis.annotations.Mapper;
/**
* 库区设置Mapper接口
*
*
* @author yinjinlu
* @date 2022-05-07
*/
public interface WmStorageLocationMapper
{
@Mapper
public interface WmStorageLocationMapper {
/**
* 查询库区设置
*
*
* @param locationId 库区设置主键
* @return 库区设置
*/
@ -30,6 +32,7 @@ public interface WmStorageLocationMapper
/**
* 根据库区编码查询库区
*
* @param locationCode
* @return
*/
@ -37,7 +40,7 @@ public interface WmStorageLocationMapper
/**
* 查询库区设置列表
*
*
* @param wmStorageLocation 库区设置
* @return 库区设置集合
*/
@ -53,13 +56,13 @@ public interface WmStorageLocationMapper
public WmStorageLocation checkLocationCodeUnique(WmStorageLocation wmStorageLocation);
public WmStorageLocation checkLocationNameUnique(WmStorageLocation wmStorageLocation);
public WmStorageLocation checkLocationNameUnique(WmStorageLocation wmStorageLocation);
/**
* 新增库区设置
*
*
* @param wmStorageLocation 库区设置
* @return 结果
*/
@ -67,7 +70,7 @@ public interface WmStorageLocationMapper
/**
* 修改库区设置
*
*
* @param wmStorageLocation 库区设置
* @return 结果
*/
@ -75,7 +78,7 @@ public interface WmStorageLocationMapper
/**
* 删除库区设置
*
*
* @param locationId 库区设置主键
* @return 结果
*/
@ -83,7 +86,7 @@ public interface WmStorageLocationMapper
/**
* 批量删除库区设置
*
*
* @param locationIds 需要删除的数据主键集合
* @return 结果
*/
@ -91,6 +94,7 @@ public interface WmStorageLocationMapper
/**
* 根据仓库删除对应的库区
*
* @param warehouseId
* @return
*/

View File

@ -1,19 +1,21 @@
package com.ktg.mes.wm.mapper;
import java.util.List;
import com.ktg.mes.wm.domain.WmWarehouse;
import org.apache.ibatis.annotations.Mapper;
/**
* 仓库设置Mapper接口
*
*
* @author yinjinlu
* @date 2022-05-07
*/
public interface WmWarehouseMapper
{
@Mapper
public interface WmWarehouseMapper {
/**
* 查询仓库设置
*
*
* @param warehouseId 仓库设置主键
* @return 仓库设置
*/
@ -21,6 +23,7 @@ public interface WmWarehouseMapper
/**
* 根据编码查询仓库
*
* @param warehouseCdoe
* @return
*/
@ -29,7 +32,7 @@ public interface WmWarehouseMapper
/**
* 查询仓库设置列表
*
*
* @param wmWarehouse 仓库设置
* @return 仓库设置集合
*/
@ -38,11 +41,12 @@ public interface WmWarehouseMapper
public List<WmWarehouse> getTreeList();
public WmWarehouse checkWarehouseCodeUnique(WmWarehouse wmWarehouse);
public WmWarehouse checkWarehouseNameUnique(WmWarehouse wmWarehouse);
/**
* 新增仓库设置
*
*
* @param wmWarehouse 仓库设置
* @return 结果
*/
@ -50,7 +54,7 @@ public interface WmWarehouseMapper
/**
* 修改仓库设置
*
*
* @param wmWarehouse 仓库设置
* @return 结果
*/
@ -58,7 +62,7 @@ public interface WmWarehouseMapper
/**
* 删除仓库设置
*
*
* @param warehouseId 仓库设置主键
* @return 结果
*/
@ -66,7 +70,7 @@ public interface WmWarehouseMapper
/**
* 批量删除仓库设置
*
*
* @param warehouseIds 需要删除的数据主键集合
* @return 结果
*/

View File

@ -2,6 +2,7 @@ package com.ktg.mes.wm.mapper;
import java.util.List;
import com.ktg.mes.wm.domain.WmsInPlanDetailEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 入库计划明细实体Mapper接口
@ -9,7 +10,8 @@ import com.ktg.mes.wm.domain.WmsInPlanDetailEntity;
* @author yinjinlu
* @date 2024-11-05
*/
public interface WmsInPlanDetailEntityMapper
@Mapper
public interface WmsInPlanDetailEntityMapper
{
/**
* 查询入库计划明细实体

View File

@ -3,6 +3,7 @@ package com.ktg.mes.wm.mapper;
import java.util.List;
import com.ktg.mes.wm.domain.WmsInPlan;
import com.ktg.mes.wm.domain.WmsInPlanDetails;
import org.apache.ibatis.annotations.Mapper;
/**
* 入库计划Mapper接口
@ -10,7 +11,8 @@ import com.ktg.mes.wm.domain.WmsInPlanDetails;
* @author yinjinlu
* @date 2024-10-31
*/
public interface WmsInPlanMapper
@Mapper
public interface WmsInPlanMapper
{
/**
* 查询入库计划
@ -18,7 +20,7 @@ public interface WmsInPlanMapper
* @param planId 入库计划主键
* @return 入库计划
*/
public WmsInPlan selectWmsInPlanByPlanId(String planId);
public WmsInPlan selectWmsInPlanByPlanId(Long planId);
/**
* 查询入库计划列表

View File

@ -3,6 +3,7 @@ package com.ktg.mes.wm.mapper;
import java.util.List;
import com.ktg.mes.wm.domain.WmsInTask;
import com.ktg.mes.wm.domain.WmsZdTask;
import org.apache.ibatis.annotations.Mapper;
/**
* 入库任务Mapper接口
@ -10,7 +11,8 @@ import com.ktg.mes.wm.domain.WmsZdTask;
* @author yinjinlu
* @date 2024-11-01
*/
public interface WmsInTaskMapper
@Mapper
public interface WmsInTaskMapper
{
/**
* 查询入库任务

View File

@ -22,6 +22,14 @@ public interface IUcmCtBaseService
*/
public UcmCtBase selectUcmCtBaseByCtBaseId(String ctBaseId);
/**
* 查询料箱管理
*
* @param code 料箱code rfid
* @return 料箱管理
*/
public UcmCtBase selectUcmCtBaseByCode(String code);
/**
* 查询料箱管理列表
*
@ -71,4 +79,6 @@ public interface IUcmCtBaseService
String uploadTempBoxListInfo(List<RfidCard> rfidCardList);
String uploadTempBoxItemListInfo(List<RfidCard> rfidCardList);
String addUcmCtBase(UcmCtBase ucmCtBase);
}

View File

@ -1,6 +1,8 @@
package com.ktg.mes.wm.service;
import java.util.List;
import com.ktg.mes.wm.domain.WmStorageArea;
import com.ktg.mes.wm.domain.WmStorageLocation;
import com.ktg.mes.wm.domain.vo.WmStorageLocationVo;
@ -105,4 +107,13 @@ public interface IWmStorageLocationService
* @return
*/
public int deleteByWarehouseId(Long warehouseId);
/**
* 查询一个库位
*
* @param code 库区编码
* @param isBig 是否大件
* @return 库位
*/
WmStorageArea queryOneAreaByLocationCode(String code, Boolean isBig);
}

View File

@ -2,6 +2,7 @@ package com.ktg.mes.wm.service;
import java.util.List;
import com.ktg.mes.wm.domain.WmsInPlan;
import com.ktg.mes.wm.domain.dto.WmsInboundOrderDto;
/**
* 入库计划Service接口
@ -17,7 +18,7 @@ public interface IWmsInPlanService
* @param planId 入库计划主键
* @return 入库计划
*/
public WmsInPlan selectWmsInPlanByPlanId(String planId);
public WmsInPlan selectWmsInPlanByPlanId(Long planId);
WmsInPlan selectWmsInPlanByPlanCode(String planCode);
@ -67,4 +68,23 @@ public interface IWmsInPlanService
* @return 是否重复
*/
public Boolean isDuplicatePlanCode(String planCode);
/**
* 执行入库计划
*
* @param planId 入库计划ID
*/
public void issueWmsInPlan(Long planId);
/**
* 创建并执行入库计划
* @param wmsInPlan 入库计划
*/
public void insertAndIssueWmsInPlan(WmsInPlan wmsInPlan);
/**
* 根据订单创建入库计划
* @param wmsInboundOrderDto 入库计划参数
*/
public void insertOrderWmsInPlan(WmsInboundOrderDto wmsInboundOrderDto);
}

View File

@ -19,6 +19,14 @@ public interface IWmsInTaskService
*/
public WmsInTask selectWmsInTaskById(String id);
/**
* 查询入库任务
*
* @param rfid 料箱 RFID
* @return 入库任务
*/
public WmsInTask selectWmsInTaskByBoxRfid(String rfid);
/**
* 查询入库任务列表
*

View File

@ -12,6 +12,7 @@ import com.ktg.mes.wm.domain.box.BoxItem;
import com.ktg.mes.wm.domain.box.RfidCard;
import com.ktg.mes.wm.mapper.UcmCtBaseMapper;
import com.ktg.mes.wm.service.IUcmCtBaseService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -28,15 +29,11 @@ import static org.apache.commons.lang3.SystemUtils.getUserName;
* @date 2024-10-31
*/
@Service
@RequiredArgsConstructor
public class UcmCtBaseServiceImpl implements IUcmCtBaseService {
@Autowired
private UcmCtBaseMapper ucmCtBaseMapper;
@Autowired
private BaseKnifeMapper baseKnifeMapper;
@Autowired
private UcmCtMaterialMapper2 ucmCtMaterialMapper2;
private final UcmCtBaseMapper ucmCtBaseMapper;
private final BaseKnifeMapper baseKnifeMapper;
private final UcmCtMaterialMapper2 ucmCtMaterialMapper2;
/**
* 查询料箱管理
@ -49,6 +46,17 @@ public class UcmCtBaseServiceImpl implements IUcmCtBaseService {
return ucmCtBaseMapper.selectUcmCtBaseByCtBaseId(ctBaseId);
}
/**
* 查询料箱管理
*
* @param code 料箱code rfid
* @return 料箱管理
*/
@Override
public UcmCtBase selectUcmCtBaseByCode(String code) {
return ucmCtBaseMapper.selectUcmCtBaseByCode(code);
}
/**
* 查询料箱管理列表
*
@ -137,7 +145,7 @@ public class UcmCtBaseServiceImpl implements IUcmCtBaseService {
BaseKnife baseKnifeQuery = new BaseKnife();
baseKnifeQuery.setRfid(itemCode);
List<BaseKnife> baseKnifeList = baseKnifeMapper.selectBaseKnifeList(baseKnifeQuery);
List<BaseKnife> baseKnifeList = baseKnifeMapper.selectBaseKnifeNotValidList(baseKnifeQuery);
if (baseKnifeList.isEmpty())
throw new RuntimeException("绑定失败,该物料不存在");
@ -200,16 +208,15 @@ public class UcmCtBaseServiceImpl implements IUcmCtBaseService {
BaseKnife baseKnifeQuery = new BaseKnife();
baseKnifeQuery.setRfid(boxItem.getBoxItemRfid().trim());
List<BaseKnife> baseKnifeList = baseKnifeMapper.selectBaseKnifeList(baseKnifeQuery);
List<BaseKnife> baseKnifeList = baseKnifeMapper.selectBaseKnifeNotValidList(baseKnifeQuery);
if (baseKnifeList.isEmpty())
throw new RuntimeException(String.format("绑定失败,物料“%s”不存在", boxItem.getBoxItemRfid().trim()));
UcmCtMaterial ucmCtMaterialQuery = new UcmCtMaterial();
ucmCtMaterialQuery.setCtBaseId(Long.parseLong(ucmCtBaseList.get(0).getCtBaseId()));
ucmCtMaterialQuery.setBaseKnifeId(baseKnifeList.get(0).getBaseKnifeId());
List<UcmCtMaterial> ucmCtMaterialList = ucmCtMaterialMapper2.selectUcmCtMaterialList(ucmCtMaterialQuery);
if (!ucmCtMaterialList.isEmpty())
throw new RuntimeException(String.format("绑定失败,物料“%s”已经绑定料箱“%s”", boxItem.getBoxItemRfid().trim(), box.getBoxRfid().trim()));
throw new RuntimeException(String.format("绑定失败,物料“%s”已经被其它料箱绑定", boxItem.getBoxItemRfid().trim()));
UcmCtMaterial ucmCtMaterial = new UcmCtMaterial();
ucmCtMaterial.setCtBaseId(Long.parseLong(ucmCtBaseList.get(0).getCtBaseId()));
@ -227,7 +234,7 @@ public class UcmCtBaseServiceImpl implements IUcmCtBaseService {
BaseKnife baseKnifeQuery = new BaseKnife();
baseKnifeQuery.setRfid(boxItem.getBoxItemRfid().trim());
List<BaseKnife> baseKnifeList = baseKnifeMapper.selectBaseKnifeList(baseKnifeQuery);
List<BaseKnife> baseKnifeList = baseKnifeMapper.selectBaseKnifeNotValidList(baseKnifeQuery);
if (baseKnifeList.isEmpty())
throw new RuntimeException(String.format("解绑失败,物料“%s”不存在", boxItem.getBoxItemRfid().trim()));
@ -262,4 +269,16 @@ public class UcmCtBaseServiceImpl implements IUcmCtBaseService {
System.out.println("==============================================");
return "OK";
}
@Override
public String addUcmCtBase(UcmCtBase ucmCtBase) {
UcmCtBase ucmCtBaseQuery = new UcmCtBase();
ucmCtBaseQuery.setCode(ucmCtBase.getCode());
if (!ucmCtBaseMapper.selectUcmCtBaseList(ucmCtBaseQuery).isEmpty())
return "新增失败,该料箱已经存在";
ucmCtBase.setCreateTime(DateUtils.getNowDate());
ucmCtBase.setCreateBy(getUserName());
ucmCtBaseMapper.insertUcmCtBase(ucmCtBase);
return "OK";
}
}

View File

@ -1,39 +1,50 @@
package com.ktg.mes.wm.service.impl;
import java.util.List;
import com.ktg.common.constant.UserConstants;
import com.ktg.common.utils.DateUtils;
import com.ktg.common.utils.StringUtils;
import com.ktg.mes.md.mapper.BaseKnifeMapper;
import com.ktg.mes.wm.domain.WmStorageArea;
import com.ktg.mes.wm.domain.WmStorageLocation;
import com.ktg.mes.wm.domain.vo.WmStorageLocationVo;
import org.apache.catalina.User;
import com.ktg.mes.wm.mapper.UcmCtBaseMapper;
import com.ktg.mes.wm.mapper.WmStorageAreaMapper;
import com.ktg.mes.wm.mapper.WmStorageLocationMapper;
import com.ktg.mes.wm.service.IWmStorageLocationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ktg.mes.wm.mapper.WmStorageLocationMapper;
import com.ktg.mes.wm.domain.WmStorageLocation;
import com.ktg.mes.wm.service.IWmStorageLocationService;
import java.util.List;
import java.util.stream.Collectors;
/**
* 库区设置Service业务层处理
*
*
* @author yinjinlu
* @date 2022-05-07
*/
@Service
public class WmStorageLocationServiceImpl implements IWmStorageLocationService
{
public class WmStorageLocationServiceImpl implements IWmStorageLocationService {
@Autowired
private WmStorageLocationMapper wmStorageLocationMapper;
@Autowired
private BaseKnifeMapper baseKnifeMapper;
@Autowired
private WmStorageAreaMapper wmStorageAreaMapper;
@Autowired
private UcmCtBaseMapper ucmCtBaseMapper;
/**
* 查询库区设置
*
*
* @param locationId 库区设置主键
* @return 库区设置
*/
@Override
public WmStorageLocation selectWmStorageLocationByLocationId(Long locationId)
{
public WmStorageLocation selectWmStorageLocationByLocationId(Long locationId) {
return wmStorageLocationMapper.selectWmStorageLocationByLocationId(locationId);
}
@ -44,10 +55,10 @@ public class WmStorageLocationServiceImpl implements IWmStorageLocationService
* @return 库区设置
*/
@Override
public WmStorageLocationVo selectWmStorageLocationVoByLocationId(Long locationId)
{
public WmStorageLocationVo selectWmStorageLocationVoByLocationId(Long locationId) {
return wmStorageLocationMapper.selectWmStorageLocationByVoLocationId(locationId);
}
@Override
public WmStorageLocation selectWmStorageLocationByLocationCode(String locationCode) {
return wmStorageLocationMapper.selectWmStorageLocationByLocationCode(locationCode);
@ -55,13 +66,12 @@ public class WmStorageLocationServiceImpl implements IWmStorageLocationService
/**
* 查询库区设置列表
*
*
* @param wmStorageLocation 库区设置
* @return 库区设置
*/
@Override
public List<WmStorageLocation> selectWmStorageLocationList(WmStorageLocation wmStorageLocation)
{
public List<WmStorageLocation> selectWmStorageLocationList(WmStorageLocation wmStorageLocation) {
return wmStorageLocationMapper.selectWmStorageLocationList(wmStorageLocation);
}
@ -72,16 +82,15 @@ public class WmStorageLocationServiceImpl implements IWmStorageLocationService
* @return 库区设置
*/
@Override
public List<WmStorageLocationVo> selectWmStorageLocationListVo(WmStorageLocation wmStorageLocation)
{
public List<WmStorageLocationVo> selectWmStorageLocationListVo(WmStorageLocation wmStorageLocation) {
return wmStorageLocationMapper.selectWmStorageLocationListVo(wmStorageLocation);
}
@Override
public String checkLocationCodeUnique(WmStorageLocation wmStorageLocation) {
WmStorageLocation location = wmStorageLocationMapper.checkLocationCodeUnique(wmStorageLocation);
Long locationId = wmStorageLocation.getLocationId()==null?-1L:wmStorageLocation.getLocationId();
if(StringUtils.isNotNull(location) && location.getLocationId().longValue() != locationId.longValue()){
Long locationId = wmStorageLocation.getLocationId() == null ? -1L : wmStorageLocation.getLocationId();
if (StringUtils.isNotNull(location) && location.getLocationId().longValue() != locationId.longValue()) {
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
@ -90,8 +99,8 @@ public class WmStorageLocationServiceImpl implements IWmStorageLocationService
@Override
public String checkLocationNameUnique(WmStorageLocation wmStorageLocation) {
WmStorageLocation location = wmStorageLocationMapper.checkLocationNameUnique(wmStorageLocation);
Long locationId = wmStorageLocation.getLocationId()==null?-1L:wmStorageLocation.getLocationId();
if(StringUtils.isNotNull(location) && location.getLocationId().longValue() != locationId.longValue()){
Long locationId = wmStorageLocation.getLocationId() == null ? -1L : wmStorageLocation.getLocationId();
if (StringUtils.isNotNull(location) && location.getLocationId().longValue() != locationId.longValue()) {
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
@ -99,51 +108,47 @@ public class WmStorageLocationServiceImpl implements IWmStorageLocationService
/**
* 新增库区设置
*
*
* @param wmStorageLocation 库区设置
* @return 结果
*/
@Override
public int insertWmStorageLocation(WmStorageLocation wmStorageLocation)
{
public int insertWmStorageLocation(WmStorageLocation wmStorageLocation) {
wmStorageLocation.setCreateTime(DateUtils.getNowDate());
return wmStorageLocationMapper.insertWmStorageLocation(wmStorageLocation);
}
/**
* 修改库区设置
*
*
* @param wmStorageLocation 库区设置
* @return 结果
*/
@Override
public int updateWmStorageLocation(WmStorageLocation wmStorageLocation)
{
public int updateWmStorageLocation(WmStorageLocation wmStorageLocation) {
wmStorageLocation.setUpdateTime(DateUtils.getNowDate());
return wmStorageLocationMapper.updateWmStorageLocation(wmStorageLocation);
}
/**
* 批量删除库区设置
*
*
* @param locationIds 需要删除的库区设置主键
* @return 结果
*/
@Override
public int deleteWmStorageLocationByLocationIds(Long[] locationIds)
{
public int deleteWmStorageLocationByLocationIds(Long[] locationIds) {
return wmStorageLocationMapper.deleteWmStorageLocationByLocationIds(locationIds);
}
/**
* 删除库区设置信息
*
*
* @param locationId 库区设置主键
* @return 结果
*/
@Override
public int deleteWmStorageLocationByLocationId(Long locationId)
{
public int deleteWmStorageLocationByLocationId(Long locationId) {
return wmStorageLocationMapper.deleteWmStorageLocationByLocationId(locationId);
}
@ -151,4 +156,30 @@ public class WmStorageLocationServiceImpl implements IWmStorageLocationService
public int deleteByWarehouseId(Long warehouseId) {
return wmStorageLocationMapper.deleteByWarehouseId(warehouseId);
}
@Override
public WmStorageArea queryOneAreaByLocationCode(String code, Boolean isBig) {
// 获取库区
WmStorageLocation wmStorageLocationByCode = this.wmStorageLocationMapper.selectWmStorageLocationByLocationCode(code);
if (wmStorageLocationByCode == null) throw new RuntimeException("自动获取库位失败,该库区不存在");
// 获取料箱中已经使用的库位编码
List<String> selectNotEmptyAreaIdList = this.ucmCtBaseMapper.selectNotEmptyAreaIdList();
// 获取库位列表
WmStorageArea wmStorageAreaQuery = new WmStorageArea();
wmStorageAreaQuery.setLocationId(wmStorageLocationByCode.getLocationId());
wmStorageAreaQuery.setAttr3(isBig ? 1L : 0L);
List<WmStorageArea> wmStorageAreaList = this.wmStorageAreaMapper.selectWmStorageAreaList(wmStorageAreaQuery).stream()
// 过滤掉全部已经存在料箱的库位
.filter(it -> !selectNotEmptyAreaIdList.contains(it.getAreaId().toString()))
// 过滤掉临时库位
.filter(it -> !it.getAreaCode().equals("TEMP"))
.collect(Collectors.toList());
if (wmStorageAreaList == null || wmStorageAreaList.isEmpty())
throw new RuntimeException("自动获取库位失败,无可用库位");
// 返回第一个可用的库位
return wmStorageAreaList.get(0);
}
}

View File

@ -7,6 +7,7 @@ import com.ktg.mes.md.domain.WmsBusinessType;
import com.ktg.mes.md.mapper.WmsBusinessTypeMapper;
import com.ktg.mes.wm.domain.*;
import com.ktg.mes.wm.mapper.*;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ktg.mes.wm.service.IWmsInPlanDetailEntityService;
@ -18,19 +19,14 @@ import com.ktg.mes.wm.service.IWmsInPlanDetailEntityService;
* @date 2024-11-05
*/
@Service
@RequiredArgsConstructor
public class WmsInPlanDetailEntityServiceImpl implements IWmsInPlanDetailEntityService {
@Autowired
private WmsInPlanDetailEntityMapper wmsInPlanDetailEntityMapper;
@Autowired
private WmsInPlanMapper wmsInPlanMapper;
@Autowired
private WmsBusinessTypeMapper wmsBusinessTypeMapper;
@Autowired
private WmStorageAreaMapper wmStorageAreaMapper;
@Autowired
private WmStorageLocationMapper wmStorageLocationMapper;
@Autowired
private WmWarehouseMapper wmWarehouseMapper;
private final WmsInPlanDetailEntityMapper wmsInPlanDetailEntityMapper;
private final WmsInPlanMapper wmsInPlanMapper;
private final WmsBusinessTypeMapper wmsBusinessTypeMapper;
private final WmStorageAreaMapper wmStorageAreaMapper;
private final WmStorageLocationMapper wmStorageLocationMapper;
private final WmWarehouseMapper wmWarehouseMapper;
/**
* 查询入库计划明细实体
@ -66,9 +62,9 @@ public class WmsInPlanDetailEntityServiceImpl implements IWmsInPlanDetailEntityS
List<WmsInPlanDetailEntity> handleWmsInPlanDetailEntityList = new ArrayList<>();
wmsInPlanDetailEntityList.forEach(entity -> {
// 获取入库计划信息
WmsInPlan wmsInPlan = wmsInPlanMapper.selectWmsInPlanByPlanId(entity.getPlanId().toString());
WmsInPlan wmsInPlan = wmsInPlanMapper.selectWmsInPlanByPlanId(entity.getPlanId());
// 获取入库计划
WmsBusinessType wmsBusinessType = wmsBusinessTypeMapper.selectWmsBusinessTypeByTypeId(wmsInPlan.getPlanTypeId());
WmsBusinessType wmsBusinessType = wmsBusinessTypeMapper.selectWmsBusinessTypeByTypeId(wmsInPlan.getPlanTypeId().toString());
for (WmsInPlanDetails detail : wmsInPlan.getWmsInPlanDetailsList()) {
// 匹配入库明细

View File

@ -1,21 +1,30 @@
package com.ktg.mes.wm.service.impl;
import java.util.List;
import com.ktg.common.utils.DateUtils;
import com.ktg.mes.wm.domain.WmsInPlanDetailEntity;
import com.ktg.mes.wm.mapper.WmsInPlanDetailEntityMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import com.ktg.common.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import com.ktg.mes.wm.domain.WmsInPlanDetails;
import com.ktg.generator.util.MultiModuleCodeGenerator;
import com.ktg.mes.md.domain.BaseKnife;
import com.ktg.mes.md.domain.MdItem;
import com.ktg.mes.md.domain.WmsBusinessType;
import com.ktg.mes.md.mapper.WmsBusinessTypeMapper;
import com.ktg.mes.md.service.IBaseKnifeService;
import com.ktg.mes.md.service.IMdItemService;
import com.ktg.mes.md.service.impl.BaseKnifeServiceImpl;
import com.ktg.mes.md.service.impl.WmsBusinessTypeServiceImpl;
import com.ktg.mes.wm.domain.*;
import com.ktg.mes.wm.domain.dto.WmsInboundOrderDto;
import com.ktg.mes.wm.mapper.UcmCtBaseMapper;
import com.ktg.mes.wm.mapper.WmStorageAreaMapper;
import com.ktg.mes.wm.mapper.WmsInPlanDetailEntityMapper;
import com.ktg.mes.wm.mapper.WmsInPlanMapper;
import com.ktg.mes.wm.domain.WmsInPlan;
import com.ktg.mes.wm.service.IWmsInPlanService;
import com.ktg.mes.wm.service.IWmsInTaskService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
/**
* 入库计划Service业务层处理
@ -24,12 +33,16 @@ import com.ktg.mes.wm.service.IWmsInPlanService;
* @date 2024-10-31
*/
@Service
@RequiredArgsConstructor
public class WmsInPlanServiceImpl implements IWmsInPlanService {
@Autowired
private WmsInPlanMapper wmsInPlanMapper;
@Autowired
private WmsInPlanDetailEntityMapper wmsInPlanDetailEntityMapper;
private final IWmsInTaskService wmsInTaskService;
private final IMdItemService mdItemService;
private final IBaseKnifeService baseKnifeService;
private final WmsInPlanMapper wmsInPlanMapper;
private final WmsInPlanDetailEntityMapper wmsInPlanDetailEntityMapper;
private final WmStorageAreaServiceImpl wmStorageAreaService;
private final WmStorageAreaMapper wmStorageAreaMapper;
private final WmsBusinessTypeMapper wmsBusinessTypeMapper;
/**
* 查询入库计划
@ -38,7 +51,7 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService {
* @return 入库计划
*/
@Override
public WmsInPlan selectWmsInPlanByPlanId(String planId) {
public WmsInPlan selectWmsInPlanByPlanId(Long planId) {
WmsInPlan wmsInPlan = wmsInPlanMapper.selectWmsInPlanByPlanId(planId);
List<WmsInPlanDetails> wmsInPlanDetailsList = new ArrayList<>();
wmsInPlan.getWmsInPlanDetailsList().forEach(detail -> {
@ -77,7 +90,19 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService {
@Transactional
@Override
public int insertWmsInPlan(WmsInPlan wmsInPlan) {
WmStorageArea wmStorageAreaByAreaCode = wmStorageAreaMapper.selectWmStorageAreaByAreaCode("TEMP");
if (wmStorageAreaByAreaCode == null) throw new RuntimeException("系统内缺少编码为“TEMP”的临时库位");
wmsInPlan.getWmsInPlanDetailsList().forEach(detail -> {
if (detail.getCellId() == null || detail.getCellId() == 0)
detail.setCellId(wmStorageAreaByAreaCode.getAreaId());
});
wmsInPlan.setCreateTime(DateUtils.getNowDate());
// 设置计划编码
if (wmsInPlan.getPlanCode() == null) {
wmsInPlan.setPlanCode(MultiModuleCodeGenerator.generateTaskCode("RKP"));
}
int rows = wmsInPlanMapper.insertWmsInPlan(wmsInPlan);
insertWmsInPlanDetails(wmsInPlan);
return rows;
@ -129,6 +154,7 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService {
*
* @param wmsInPlan 入库计划对象
*/
@Transactional
public void insertWmsInPlanDetails(WmsInPlan wmsInPlan) {
List<WmsInPlanDetails> wmsInPlanDetailsList = wmsInPlan.getWmsInPlanDetailsList();
Long planId = wmsInPlan.getPlanId();
@ -140,7 +166,7 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService {
}
if (!list.isEmpty()) {
wmsInPlanMapper.batchWmsInPlanDetails(list);
WmsInPlan wmsInPlan1 = selectWmsInPlanByPlanId(planId.toString());
WmsInPlan wmsInPlan1 = selectWmsInPlanByPlanId(planId);
List<WmsInPlanDetails> wmsInPlanDetailsList1 = wmsInPlan1.getWmsInPlanDetailsList();
for (int i = 0; i < list.size(); i++) {
List<WmsInPlanDetailEntity> wmsInPlanDetailEntityList = list.get(i).getWmsInPlanDetailEntityList();
@ -157,17 +183,49 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService {
*
* @param wmsInPlanDetails 入库计划明细对象
*/
@Transactional
public void insertWmsInPlanDetailEntity(WmsInPlanDetails wmsInPlanDetails) {
List<WmsInPlanDetailEntity> wmsInPlanDetailEntityList = wmsInPlanDetails.getWmsInPlanDetailEntityList();
Long planId = wmsInPlanDetails.getPlanId();
Long planDetailsId = wmsInPlanDetails.getDetailsId();
if (StringUtils.isNotNull(wmsInPlanDetailEntityList)) {
// 查询物料信息
MdItem mdItem = mdItemService.selectMdItemById(Long.parseLong(wmsInPlanDetails.getMaterialId()));
// 查询库位信息
WmStorageArea wmStorageArea = wmStorageAreaService.selectWmStorageAreaByAreaId(wmsInPlanDetails.getCellId());
if (!Objects.isNull(wmsInPlanDetailEntityList)) {
ArrayList<WmsInPlanDetailEntity> list = new ArrayList<>();
for (WmsInPlanDetailEntity wmsInPlanDetailEntity : wmsInPlanDetailEntityList) {
if (wmsInPlanDetailEntity.getKnifeId() == null) {
// 生成台账
BaseKnife baseKnife = new BaseKnife();
baseKnife.setMbbBdMrlId(mdItem.getItemId());
baseKnife.setKnifeCode(mdItem.getItemCode());
baseKnife.setKnifeName(mdItem.getItemName());
baseKnife.setKnifeUnit(mdItem.getUnitName());
baseKnife.setKnifeType(mdItem.getItemTypeName());
baseKnife.setAreaCode(wmStorageArea.getAreaCode());
baseKnife.setSafeStock(mdItem.getMinStock());
baseKnife.setStandardQuantity("1");
baseKnife.setKnifeLife(100);
baseKnife.setRfid(wmsInPlanDetailEntity.getRfid());
// 设置台账状态 入库
baseKnife.setKnifeFineState(1);
// 设置为失效
baseKnife.setIsValid(1);
baseKnife.setPlanSheet("");
baseKnife.setResetCount(mdItem.getAttr1());
baseKnife.setItemOrProduct(mdItem.getItemOrProduct());
baseKnifeService.insertBaseKnife(baseKnife);
// 插入实例中台账ID
wmsInPlanDetailEntity.setKnifeId(baseKnife.getBaseKnifeId());
}
// 实例
wmsInPlanDetailEntity.setPlanId(planId);
wmsInPlanDetailEntity.setPlanDetailsId(planDetailsId);
wmsInPlanDetailEntity.setCreateTime(DateUtils.getNowDate());
list.add(wmsInPlanDetailEntity);
}
if (!list.isEmpty()) {
@ -178,10 +236,113 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService {
/**
* 入库计划ID是否重复
*
* @param planCode 入库计划ID
* @return 是否重复
*/
@Override
public Boolean isDuplicatePlanCode(String planCode) {
return wmsInPlanMapper.isDuplicatePlanCode(planCode);
}
/**
* 执行入库计划
*
* @param planId 入库计划ID
*/
@Override
@Transactional
public void issueWmsInPlan(Long planId) {
WmsInPlan wmsInPlan = selectWmsInPlanByPlanId(planId);
WmsInTask wmsInTask = new WmsInTask();
AtomicInteger atomicInteger = new AtomicInteger();
wmsInPlan.getWmsInPlanDetailsList().forEach(detail -> {
int index = atomicInteger.getAndIncrement();
wmsInTask.setPlanInId(wmsInPlan.getPlanId());
wmsInTask.setPlanInCode(wmsInPlan.getPlanCode());
wmsInTask.setTaskInQuantity(Integer.parseInt(detail.getQuantity()));
wmsInTask.setActualInQuantity(Integer.parseInt(detail.getQuantityIn()));
wmsInTask.setCellTgt(detail.getCellId());
wmsInTask.setCellOrig(new Date().toString() + index);
wmsInTask.setRemark(detail.getRemark());
wmsInTask.setBatch(detail.getBatch());
wmsInTask.setMaterialId(detail.getMaterialId());
MdItem mdItem = mdItemService.selectMdItemById(Long.parseLong(wmsInTask.getMaterialId()));
wmsInTask.setMaterialCode(mdItem.getItemCode());
wmsInTask.setPlanTypeCode(wmsInPlan.getPlanTypeCode());
wmsInTask.setPlanInStatus("0");
wmsInTask.setDetailInId(detail.getDetailsId());
wmsInTaskService.insertWmsInTask(wmsInTask);
});
wmsInPlan.setState("1");
wmsInPlanMapper.updateWmsInPlan(wmsInPlan);
}
/**
* 创建并执行入库计划
*
* @param wmsInPlan 入库计划
*/
@Transactional
@Override
public void insertAndIssueWmsInPlan(WmsInPlan wmsInPlan) {
this.insertWmsInPlan(wmsInPlan);
this.issueWmsInPlan(wmsInPlan.getPlanId());
}
@Transactional
@Override
public void insertOrderWmsInPlan(WmsInboundOrderDto wmsInboundOrderDto) {
// 查询业务类型
WmsBusinessType wmsBusinessType = wmsBusinessTypeMapper.selectWmsBusinessTypeByCode(wmsInboundOrderDto.getTypeCode());
if (wmsBusinessType == null) {
throw new RuntimeException("出库类型编码错误: " + wmsInboundOrderDto.getTypeCode());
}
// 查询物料信息
MdItem mdItem = mdItemService.selectMdItemByCode(wmsInboundOrderDto.getMaterialCode());
if (mdItem == null) {
throw new RuntimeException("物料编码错误: " + wmsInboundOrderDto.getMaterialCode());
}
// 创建入库计划
WmsInPlan wmsInPlan = new WmsInPlan();
wmsInPlan.setState("0");
// 业务类型
wmsInPlan.setSourceType("SGLR");
wmsInPlan.setPlanTypeCode(wmsBusinessType.getCode());
wmsInPlan.setPlanTypeId(wmsBusinessType.getTypeId());
wmsInPlan.setRemark("订单号: " + wmsInboundOrderDto.getOrderId());
//-- 入库计划详情
WmsInPlanDetails wmsInPlanDetail = new WmsInPlanDetails();
// 状态-待执行
wmsInPlanDetail.setPlanInStatus("0");
// 数量
wmsInPlanDetail.setQuantity("1");
wmsInPlanDetail.setQuantityIn("1");
wmsInPlanDetail.setMaterialId(mdItem.getItemId().toString());
wmsInPlan.setWmsInPlanDetailsList(Collections.singletonList(wmsInPlanDetail));
// 创建入库计划详情实例
WmsInPlanDetailEntity wmsInPlanDetailEntity = new WmsInPlanDetailEntity();
// 工具回库
if (StringUtils.equals(wmsInboundOrderDto.getTypeCode(), "GJHK")) {
BaseKnife baseKnife = baseKnifeService.selectBaseKnifeByRfid(wmsInboundOrderDto.getRfid());
if (baseKnife == null) {
throw new RuntimeException("RFID错误" + wmsInboundOrderDto.getRfid());
}
wmsInPlanDetailEntity.setKnifeId(baseKnife.getBaseKnifeId());
// 采购入库
} else if (StringUtils.equals(wmsInboundOrderDto.getTypeCode(), "DPRK")) {
}
wmsInPlanDetailEntity.setRfid(wmsInboundOrderDto.getRfid());
wmsInPlanDetail.setWmsInPlanDetailEntityList(Collections.singletonList(wmsInPlanDetailEntity));
this.insertAndIssueWmsInPlan(wmsInPlan);
}
}

View File

@ -1,18 +1,20 @@
package com.ktg.mes.wm.service.impl;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.*;
import com.ktg.common.utils.DateUtils;
import com.ktg.generator.util.MultiModuleCodeGenerator;
import com.ktg.mes.md.domain.BaseKnife;
import com.ktg.mes.md.domain.MdItem;
import com.ktg.mes.md.mapper.MdItemMapper;
import com.ktg.mes.md.service.IMdItemService;
import com.ktg.mes.wm.domain.UcmCtBase;
import com.ktg.mes.wm.domain.WmStorageArea;
import com.ktg.mes.wm.domain.WmsInPlanDetailEntity;
import com.ktg.mes.wm.mapper.WmStorageAreaMapper;
import com.ktg.mes.wm.service.IUcmCtBaseService;
import com.ktg.mes.wm.service.IWmsInPlanDetailEntityService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ktg.mes.wm.mapper.WmsInTaskMapper;
@ -26,15 +28,13 @@ import com.ktg.mes.wm.service.IWmsInTaskService;
* @date 2024-11-01
*/
@Service
@RequiredArgsConstructor
public class WmsInTaskServiceImpl implements IWmsInTaskService {
@Autowired
private WmsInTaskMapper wmsInTaskMapper;
@Autowired
private MdItemMapper mdItemMapper;
@Autowired
private IWmsInPlanDetailEntityService wmsInPlanDetailEntityService;
@Autowired
private WmStorageAreaMapper wmStorageAreaMapper;
private final WmsInTaskMapper wmsInTaskMapper;
private final MdItemMapper mdItemMapper;
private final IWmsInPlanDetailEntityService wmsInPlanDetailEntityService;
private final WmStorageAreaMapper wmStorageAreaMapper;
private final IUcmCtBaseService ucmCtBaseService;
/**
* 查询入库任务
@ -47,6 +47,51 @@ public class WmsInTaskServiceImpl implements IWmsInTaskService {
return wmsInTaskMapper.selectWmsInTaskById(id);
}
/**
* 查询入库任务
*
* @param rfid 料箱 RFID
* @return 入库任务
*/
@Override
public WmsInTask selectWmsInTaskByBoxRfid(String rfid) {
List<WmsInTask> wmsInTaskList = new ArrayList<>();
UcmCtBase ucmCtBase = ucmCtBaseService.selectUcmCtBaseByCode(rfid);
if (ucmCtBase == null) {
return null;
}
for (BaseKnife baseKnife : ucmCtBase.getBaseKnifeList()) {
// wmsInTaskList.clear();
WmsInPlanDetailEntity wmsInPlanDetailEntityQuery = new WmsInPlanDetailEntity();
wmsInPlanDetailEntityQuery.setRfid(baseKnife.getRfid());
// 查询所有符合条件的计划明细
List<WmsInPlanDetailEntity> planDetailEntities = wmsInPlanDetailEntityService.selectWmsInPlanDetailEntityList(wmsInPlanDetailEntityQuery);
// 遍历所有明细查询相应的WmsInTask
for (WmsInPlanDetailEntity entity : planDetailEntities) {
WmsInTask wmsInTaskQuery = new WmsInTask();
wmsInTaskQuery.setDetailInId(entity.getPlanDetailsId());
wmsInTaskQuery.setPlanInId(entity.getPlanId());
wmsInTaskQuery.setPlanInStatus("0");
// 查询并加入符合条件的任务
List<WmsInTask> tasks = selectWmsInTaskList(wmsInTaskQuery);
if (tasks != null && !tasks.isEmpty()) {
wmsInTaskList.addAll(tasks);
}
}
}
// 返回第一个符合条件的任务
if (!wmsInTaskList.isEmpty()) {
return wmsInTaskList.get(0);
}
return null;
}
/**
* 查询入库任务列表
*

View File

@ -74,6 +74,9 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
@Autowired
private ProductionArrangementsMapper productionArrangementsMapper;
@Autowired
private BaseKnifeLockedMapper baseKnifeLockedMapper;
/**
* 查询组装任务
*
@ -176,18 +179,25 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
// 查询工艺bom
BaseTechnologyBom technologyBom = new BaseTechnologyBom();
ProductionArrangements productionArrangements = new ProductionArrangements();
Boolean lockedFlag = false;
// attr4 组装任务所属计划单 如果为空则是手动组装任务不需要锁定
// 如果为空则是手动组装任务不需要锁定, 不为空说明是组装任务生成的计划单
if (zdTask.getPlanSheet() != null) {
lockedFlag = true;
// 获取工序工艺bom
BaseTechnologyBom technologyBomWrapper = new BaseTechnologyBom();
technologyBomWrapper.setProcessCode(zdTask.getProcessCode());
MdItem mdItemTemp = mdItemMapper.selectMdItemById(zdTask.getmProductId());
technologyBomWrapper.setKnifeCode(mdItemTemp.getItemCode());
technologyBom = baseTechnologyBomMapper.selectBaseTechnologyBomList(technologyBomWrapper).get(0);
// 获取生产准备记录中的锁定开始结束时间
ProductionArrangements productionArrangementsWrapper = new ProductionArrangements();
productionArrangementsWrapper.setPlanSheet(zdTask.getPlanSheet());
productionArrangements = productionArrangementsMapper.selectProductionArrangementsList(productionArrangementsWrapper).get(0);
}
// 出库基础物料 根据图号查询出库计划如果不存在生成计划存在则往计划中添加任务
// 出库基础物料 根据订单号查询出库计划如果不存在生成计划存在则往计划中添加任务
WmsOutPlan outPlan = wmsOutPlanMapper.selectWmsOutPlanByPlanCode(zdTask.getCode());
if (outPlan == null) {
// 构建新的出库计划
@ -220,15 +230,16 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
baseKnife.setKnifeLife(100);
baseKnife.setKnifeFineState(1);
baseKnife.setIsValid(1);
// 判断是否需要锁定整刀
// 判断是否需要锁定整刀来自订单的组装任务需要锁定
if (lockedFlag) {
baseKnife.setIsLocked(1);
baseKnife.setKnifeFineState(2);
baseKnife.setLockedStartTime(technologyBom.getLockedStartTime());
baseKnife.setLockedEndTime(technologyBom.getLockedEndTime());
baseKnife.setKnifeFineState(1);
baseKnife.setLockedStartTime(productionArrangements.getStartTime());
baseKnife.setLockedEndTime(productionArrangements.getEndTime());
} else {
baseKnife.setIsLocked(0);
}
// attr4 计划编码 整刀
baseKnife.setPlanSheet(zdTask.getPlanSheet());
baseKnife.setZdTaskId(zdTask.getWmsZdTaskId());
@ -237,6 +248,19 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
baseKnife.setCreateTime(DateUtils.getNowDate());
baseKnifeMapper.insertBaseKnife(baseKnife);
if (lockedFlag) {
// 添加物料锁定记录
BaseKnifeLocked baseKnifeLocked = new BaseKnifeLocked();
baseKnifeLocked.setPlanSheet(zdTask.getPlanSheet());
baseKnifeLocked.setBaseKnifeId(baseKnife.getBaseKnifeId());
baseKnifeLocked.setItemCode(mdItem.getItemCode());
baseKnifeLocked.setExpendLife(technologyBom.getExpendLife());
baseKnifeLocked.setStatus(0);
baseKnifeLocked.setLockedStartTime(productionArrangements.getStartTime());
baseKnifeLocked.setLockedEndTime(productionArrangements.getEndTime());
baseKnifeLockedMapper.insertBaseKnifeLocked(baseKnifeLocked);
}
// 锁定物料
int resetCount = 0;
for (MbbProduBom mbbProduBom : bomRoute.getMbbProduBomList()) {
@ -249,11 +273,9 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
int bomCount = mbbProduBom.getStandardDosage();
for (BaseKnife wmsBaseKnife : baseKnifeList) {
if (bomCount > 0) {
// 绑定到组装任务 整刀父id
wmsBaseKnife.setZdTaskId(zdTask.getWmsZdTaskId());
wmsBaseKnife.setIsLocked(1);
wmsBaseKnife.setKnifeFineState(2);
wmsBaseKnife.setLockedStartTime(technologyBom.getLockedStartTime());
wmsBaseKnife.setLockedEndTime(technologyBom.getLockedEndTime());
wmsBaseKnife.setParentId(baseKnife.getBaseKnifeId());
wmsBaseKnife.setPlanSheet(zdTask.getPlanSheet());
baseKnifeListOutPlan.add(wmsBaseKnife);
@ -268,6 +290,9 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
// 更新重置次数
baseKnife.setResetCount(resetCount - 1);
// 设置rfid, 为整刀编码加序号 例如整刀编码为 aaa 则整刀rfid为 aaa0001 aaa0002, 传个i在当前事务中新增的台账还没提交所以把循环系数加上
baseKnife.setRfid(this.getProductRfid(zdTask.getmProductId(), i));
baseKnifeMapper.updateBaseKnife(baseKnife);
}
@ -349,7 +374,7 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
wmsOutTask.setMdItemCode(outPlanDetail.getMdItemCode());
wmsOutTask.setMdItemName(outPlanDetail.getMdItemName());
wmsOutTask.setMdItemUnit(outPlanDetail.getMdItemUnit());
wmsOutTask.setTaskState("1");
wmsOutTask.setTaskState("0");
wmsOutTask.setRecipientUsername("");
wmsOutTask.setCreateBy(getUsername());
wmsOutTask.setCreateTime(DateUtils.getNowDate());
@ -358,11 +383,24 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
});
// 更新组装任务
zdTask.setStatus("1");
zdTask.setStatus("3");
wmsZdTaskMapper.updateWmsZdTask(zdTask);
return AjaxResult.success();
}
public String getProductRfid(Long itemId, int i){
MdItem mdItem = mdItemMapper.selectMdItemById(itemId);
// 获取最大的RFID 然后加1 RFID为物料的编码加序号
List<BaseKnife> baseKnifeList = baseKnifeMapper.selectBaseKnifeListByMbbBdMrlId(itemId);
if (baseKnifeList.isEmpty()) return mdItem.getItemCode() + String.format("%04d", 1);
else {
String index = baseKnifeList.get(0).getRfid().substring(baseKnifeList.get(0).getRfid().length() - 4);
Integer indexInt = Integer.parseInt(index) + 1 + i;
return mdItem.getItemCode() + String.format("%04d", indexInt);
}
}
@Override
@Transactional
@ -377,15 +415,16 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
// 整刀入库计划, 根据图号查询入库计划如果不存在生成计划存在则往计划中添加任务
WmStorageArea wmStorageArea = wmStorageAreaMapper.selectWmStorageAreaByAreaId(zdTask.getAreaId());
WmsInPlan wmsInPlan = wmsInPlanService.selectWmsInPlanByPlanCode(zdTask.getCode());
WmsInPlan wmsInPlan = wmsInPlanService.selectWmsInPlanByPlanCode(zdTask.getPlanSheet());
if (wmsInPlan == null) {
WmsInPlan wmsInPlanTemp = new WmsInPlan();
wmsInPlanTemp.setState("1");
wmsInPlanTemp.setSourceType("SGLR");
wmsInPlanTemp.setSourceType(zdTask.getPlanSheet() != null ? "SCZB" : "ZZRW");
wmsInPlanTemp.setCellCode(wmStorageArea.getAreaCode());
wmsInPlanTemp.setPlanCode(zdTask.getCode());
wmsInPlanTemp.setPlanCode(zdTask.getPlanSheet() != null ? zdTask.getPlanSheet() : zdTask.getCode());
wmsInPlanTemp.setRelBillCode("组装单据");
wmsInPlanTemp.setPlanTypeId("13");
wmsInPlanTemp.setPlanTypeId(9L);
wmsInPlanTemp.setPlanTypeCode("ZDHK");
wmsInPlanTemp.setCreateBy(getUsername());
wmsInPlanTemp.setCreateTime(DateUtils.getNowDate());
@ -403,6 +442,7 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
baseKnifeList.forEach(baseKnife -> {
WmsInPlanDetailEntity wmsInPlanDetailEntity = new WmsInPlanDetailEntity();
wmsInPlanDetailEntity.setKnifeId(baseKnife.getBaseKnifeId());
wmsInPlanDetailEntity.setRfid(baseKnife.getRfid());
wmsInPlanDetailEntityList.add(wmsInPlanDetailEntity);
});
wmsInPlanDetails.setWmsInPlanDetailEntityList(wmsInPlanDetailEntityList);
@ -425,13 +465,16 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
wmsInPlanService.updateWmsInPlan(wmsInPlan);
}
// 复查一遍入库计划
WmsInPlan inPlanTemp = wmsInPlanService.selectWmsInPlanByPlanId(wmsInPlan.getPlanId());
// 入库任务
MdItem mdItem = mdItemMapper.selectMdItemById(zdTask.getmProductId());
WmsInTask wmsInTask = new WmsInTask();
// 生成任务号
String taskInCode = MultiModuleCodeGenerator.generateTaskCode("RKT");
wmsInTask.setTaskInCode(taskInCode);
wmsInTask.setPlanInId(wmsInPlan.getPlanId().toString());
wmsInTask.setPlanInId(wmsInPlan.getPlanId());
wmsInTask.setPlanInCode(wmsInPlan.getPlanCode());
wmsInTask.setMaterialCode(mdItem.getItemCode());
wmsInTask.setTaskInQuantity(zdTask.getProductIdQty());
@ -440,21 +483,13 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
wmsInTask.setBatch(batchNum);
wmsInTask.setMaterialId(zdTask.getmProductId().toString());
wmsInTask.setPlanTypeId("9");
wmsInTask.setPlanInStatus("1");
wmsInTask.setPlanTypeCode("ZDHK");
wmsInTask.setPlanInStatus("0");
wmsInTask.setDetailInId(inPlanTemp.getWmsInPlanDetailsList().get(0).getDetailsId());
wmsInTask.setCreateBy(getUsername());
wmsInTask.setCreateTime(DateUtils.getNowDate());
wmsInTaskMapper.insertWmsInTask(wmsInTask);
// 刀台账设为有效
baseKnifeList.forEach(baseKnife -> {
baseKnife.setIsValid(0);
baseKnife.setCreateTime(DateUtils.getNowDate());
baseKnifeMapper.updateBaseKnife(baseKnife);
});
// 检测订单是否完成完成则出库整刀
if (zdTask.getPlanSheet() != null && this.checkFinal(zdTask.getPlanSheet())) this.createOutTask(zdTask.getPlanSheet());
// 更新组装任务
zdTask.setStatus("2");
zdTask.setQtyOk(zdTask.getProductIdQty());
@ -462,6 +497,7 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
return AjaxResult.success();
}
@Override
public String checkTaskCodeUnique(WmsZdTask wmsZdTask) {
WmsZdTask zdTask = wmsZdTaskMapper.checkTaskCodeUnique(wmsZdTask);
@ -473,152 +509,5 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
}
}
// 检查订单完成状态
public Boolean checkFinal(String planSheet){
// 获取订单记录
ProductionArrangements productionArrangements = productionArrangementsMapper.selectProductionArrangementsByPlanSheet(planSheet);
String[] processCodes = productionArrangements.getProcessCode().substring(1, productionArrangements.getProcessCode().length() - 1).split(",");
for (String processCode : processCodes) {
// 遍历工序
List<BaseTechnologyBom> baseTechnologyBomList = baseTechnologyBomMapper.selectBaseTechnologyBomListByProcessCode(processCode.trim());
if (baseTechnologyBomList != null && baseTechnologyBomList.size() > 0) {
// 判断订单锁定的物料是否足够
for (BaseTechnologyBom technologyBom : baseTechnologyBomList) {
BaseKnife baseKnifeWrapper = new BaseKnife();
baseKnifeWrapper.setPlanSheet(planSheet);
baseKnifeWrapper.setKnifeCode(technologyBom.getKnifeCode());
List<BaseKnife> baseKnifePlanSheetList = baseKnifeMapper.selectBaseKnifeList(baseKnifeWrapper);
if (baseKnifePlanSheetList.size() < technologyBom.getKnifeCount()) return false;
}
}
}
return true;
}
// 检查订单完成状态
@Transactional
public void createOutTask(String planSheet){
// 构建出库计划
WmsOutPlan outPlan = new WmsOutPlan();
outPlan.setPlanCode(planSheet);
outPlan.setWmsBusinessTypeId(16L);
outPlan.setPlanState("1");
outPlan.setPlanType("ZDCK");
outPlan.setCreateBy(getUsername());
outPlan.setCreateTime(DateUtils.getNowDate());
wmsOutPlanMapper.insertWmsOutPlan(outPlan);
// 所有的物料
List<BaseKnife> baseKnifeResultList = new ArrayList<>();
// 获取订单记录
ProductionArrangements productionArrangements = productionArrangementsMapper.selectProductionArrangementsByPlanSheet(planSheet);
String[] processCodes = productionArrangements.getProcessCode().substring(1, productionArrangements.getProcessCode().length() - 1).split(",");
for (String processCode : processCodes) {
// 遍历工序
List<BaseTechnologyBom> baseTechnologyBomList = baseTechnologyBomMapper.selectBaseTechnologyBomListByProcessCode(processCode.trim());
if (baseTechnologyBomList != null && baseTechnologyBomList.size() > 0) {
// 判断订单锁定的物料是否足够
for (BaseTechnologyBom technologyBom : baseTechnologyBomList) {
BaseKnife baseKnifeWrapper = new BaseKnife();
baseKnifeWrapper.setPlanSheet(planSheet);
baseKnifeWrapper.setKnifeCode(technologyBom.getKnifeCode());
List<BaseKnife> baseKnifeLockedList = baseKnifeMapper.selectBaseKnifeList(baseKnifeWrapper);
if (baseKnifeLockedList.size() == technologyBom.getKnifeCount()) baseKnifeResultList.addAll(baseKnifeLockedList);
}
}
}
String batchNum = "SCZBPC01";
// 出库任务进行整刀的出库
HashMap<Long, HashMap<String, List<BaseKnife>>> baseKnifeHashMapMap = new HashMap<>();
// 遍历构建map
baseKnifeResultList.forEach(item -> {
// 判断当前物料主键是否已经被收录
baseKnifeHashMapMap.computeIfAbsent(item.getMbbBdMrlId(), k -> new HashMap<>());
// 判断当前库位编码是否已经被收录
baseKnifeHashMapMap.get(item.getMbbBdMrlId()).computeIfAbsent(item.getAreaCode(), k -> new ArrayList<>());
// 对当前台账对象进行收录
baseKnifeHashMapMap.get(item.getMbbBdMrlId()).get(item.getAreaCode()).add(item);
// 修改出库状态
item.setKnifeFineState(2);
baseKnifeMapper.updateBaseKnife(item);
});
// 生成出库计划明细
WmsOutPlan outPlanTemp = outPlan;
baseKnifeHashMapMap.keySet().forEach(mdItemId -> {
MdItem mdItemOutPlan = mdItemMapper.selectMdItemById(mdItemId);
// 根据库位编码遍历
baseKnifeHashMapMap.get(mdItemId).keySet().forEach(areaCode -> {
// 获得库位对象
WmStorageArea wmStorageAreaOutPlan = wmStorageAreaMapper.selectWmStorageAreaByAreaCode(areaCode);
WmsOutPlanDetail outPlanDetail = new WmsOutPlanDetail();
outPlanDetail.setWmsOutPlanId(outPlanTemp.getWmsOutPlanId());
outPlanDetail.setMdItemId(mdItemId);
outPlanDetail.setMdItemCode(mdItemOutPlan.getItemCode());
outPlanDetail.setMdItemName(mdItemOutPlan.getItemName());
outPlanDetail.setMdItemUnit(mdItemOutPlan.getUnitName());
outPlanDetail.setPlannedQuantity(baseKnifeHashMapMap.get(mdItemId).get(areaCode).size());
outPlanDetail.setRealQuantity(baseKnifeHashMapMap.get(mdItemId).get(areaCode).size());
outPlanDetail.setDetailBatchNum(batchNum);
outPlanDetail.setWmStorageAreaId(wmStorageAreaOutPlan.getAreaId());
outPlanDetail.setWmStorageAreaCode(wmStorageAreaOutPlan.getAreaCode());
outPlanDetail.setWmStorageAreaName(wmStorageAreaOutPlan.getAreaName());
outPlanDetail.setDetailState("1");
outPlanDetail.setCreateTime(DateUtils.getNowDate());
wmsOutPlanMapper.insertWmsOutPlanDetail(outPlanDetail);
// 遍历台账对象
baseKnifeHashMapMap.get(mdItemId).get(areaCode).forEach(item -> {
// 构建出库计划明细实体
WmsOutPlanDetailEntity wmsOutPlanDetailEntity = new WmsOutPlanDetailEntity();
wmsOutPlanDetailEntity.setWmsOutPlanDetailId(outPlanDetail.getWmsOutPlanDetailId());
wmsOutPlanDetailEntity.setBaseKnifeId(item.getBaseKnifeId());
wmsOutPlanDetailEntity.setAreaCode(item.getAreaCode());
wmsOutPlanDetailEntity.setItemOrProduct(item.getItemOrProduct());
wmsOutPlanDetailEntity.setKnifeCode(item.getKnifeCode());
wmsOutPlanDetailEntity.setKnifeName(item.getKnifeName());
wmsOutPlanDetailEntity.setPlanSheet(item.getPlanSheet());
wmsOutPlanDetailEntity.setKnifeLife(item.getKnifeLife());
wmsOutPlanDetailEntity.setResetCount(item.getResetCount());
wmsOutPlanDetailEntity.setKnifeUnit(item.getKnifeUnit());
wmsOutPlanDetailEntity.setSafeStock(item.getKnifeType());
wmsOutPlanDetailEntity.setStandardQuantity(item.getStandardQuantity());
wmsOutPlanDetailEntity.setCreateTime(DateUtils.getNowDate());
wmsOutPlanDetailEntityMapper.insertWmsOutPlanDetailEntity(wmsOutPlanDetailEntity);
});
// 生成出库任务
WmsOutTask wmsOutTask = new WmsOutTask();
wmsOutTask.setWmsOutPlanId(outPlanTemp.getWmsOutPlanId());
wmsOutTask.setWmsOutPlanCode(outPlanTemp.getPlanCode());
wmsOutTask.setWmsOutPlanDetailId(outPlanDetail.getWmsOutPlanDetailId());
// 出库类型 12组刀出库
wmsOutTask.setWmsBusinessTypeId(12L);
wmsOutTask.setTaskCode(generateTaskCode("CKT"));
wmsOutTask.setTaskNumber(outPlanDetail.getPlannedQuantity());
wmsOutTask.setOutNumber(outPlanDetail.getRealQuantity());
wmsOutTask.setWmStorageAreaId(outPlanDetail.getWmStorageAreaId());
wmsOutTask.setBatchNum(batchNum);
wmsOutTask.setMdItemId(outPlanDetail.getMdItemId());
wmsOutTask.setMdItemCode(outPlanDetail.getMdItemCode());
wmsOutTask.setMdItemName(outPlanDetail.getMdItemName());
wmsOutTask.setMdItemUnit(outPlanDetail.getMdItemUnit());
wmsOutTask.setTaskState("0");
wmsOutTask.setRecipientUsername("");
wmsOutTask.setCreateTime(DateUtils.getNowDate());
wmsOutTaskMapper.insertWmsOutTask(wmsOutTask);
});
});
productionArrangements.setStatus(1);
productionArrangementsMapper.updateProductionArrangements(productionArrangements);
}
}

View File

@ -0,0 +1,87 @@
<?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.ktg.mes.md.mapper.BaseKnifeLockedMapper">
<resultMap type="BaseKnifeLocked" id="BaseKnifeLockedResult">
<result property="baseKnifeId" column="BASE_KNIFE_ID" />
<result property="planSheet" column="PLAN_SHEET" />
<result property="itemCode" column="ITEM_CODE" />
<result property="expendLife" column="EXPEND_LIFE" />
<result property="status" column="STATUS" />
<result property="lockedStartTime" column="LOCKED_START_TIME" />
<result property="lockedEndTime" column="LOCKED_END_TIME" />
<result property="baseKnifeLockedId" column="BASE_KNIFE_LOCKED_ID" />
</resultMap>
<sql id="selectBaseKnifeLockedVo">
select BASE_KNIFE_ID, PLAN_SHEET, ITEM_CODE, EXPEND_LIFE, STATUS, LOCKED_START_TIME, LOCKED_END_TIME, BASE_KNIFE_LOCKED_ID from BASE_KNIFE_LOCKED
</sql>
<select id="selectBaseKnifeLockedList" parameterType="BaseKnifeLocked" resultMap="BaseKnifeLockedResult">
<include refid="selectBaseKnifeLockedVo"/>
<where>
<if test="baseKnifeId != null and baseKnifeId != ''"> and BASE_KNIFE_ID = #{baseKnifeId}</if>
<if test="planSheet != null and planSheet != ''"> and PLAN_SHEET = #{planSheet}</if>
<if test="itemCode != null and itemCode != ''"> and ITEM_CODE = #{itemCode}</if>
<if test="expendLife != null and expendLife != ''"> and EXPEND_LIFE = #{expendLife}</if>
<if test="status != null"> and STATUS = #{status}</if>
<if test="lockedStartTime != null and lockedStartTime != ''"> and LOCKED_START_TIME = #{lockedStartTime}</if>
<if test="lockedEndTime != null and lockedEndTime != ''"> and LOCKED_END_TIME = #{lockedEndTime}</if>
</where>
order by LOCKED_START_TIME
</select>
<select id="selectBaseKnifeLockedByBaseKnifeLockedId" parameterType="String" resultMap="BaseKnifeLockedResult">
<include refid="selectBaseKnifeLockedVo"/>
where BASE_KNIFE_LOCKED_ID = #{baseKnifeLockedId}
</select>
<insert id="insertBaseKnifeLocked" parameterType="BaseKnifeLocked" useGeneratedKeys="true" keyProperty="baseKnifeLockedId">
insert into BASE_KNIFE_LOCKED
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="baseKnifeId != null">BASE_KNIFE_ID,</if>
<if test="planSheet != null">PLAN_SHEET,</if>
<if test="itemCode != null">ITEM_CODE,</if>
<if test="expendLife != null">EXPEND_LIFE,</if>
<if test="status != null">STATUS,</if>
<if test="lockedStartTime != null">LOCKED_START_TIME,</if>
<if test="lockedEndTime != null">LOCKED_END_TIME,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="baseKnifeId != null">#{baseKnifeId},</if>
<if test="planSheet != null">#{planSheet},</if>
<if test="itemCode != null">#{itemCode},</if>
<if test="expendLife != null">#{expendLife},</if>
<if test="status != null">#{status},</if>
<if test="lockedStartTime != null">#{lockedStartTime},</if>
<if test="lockedEndTime != null">#{lockedEndTime},</if>
</trim>
</insert>
<update id="updateBaseKnifeLocked" parameterType="BaseKnifeLocked">
update BASE_KNIFE_LOCKED
<trim prefix="SET" suffixOverrides=",">
<if test="baseKnifeId != null">BASE_KNIFE_ID = #{baseKnifeId},</if>
<if test="planSheet != null">PLAN_SHEET = #{planSheet},</if>
<if test="itemCode != null">ITEM_CODE = #{itemCode},</if>
<if test="expendLife != null">EXPEND_LIFE = #{expendLife},</if>
<if test="status != null">STATUS = #{status},</if>
<if test="lockedStartTime != null">LOCKED_START_TIME = #{lockedStartTime},</if>
<if test="lockedEndTime != null">LOCKED_END_TIME = #{lockedEndTime},</if>
</trim>
where BASE_KNIFE_LOCKED_ID = #{baseKnifeLockedId}
</update>
<delete id="deleteBaseKnifeLockedByBaseKnifeLockedId" parameterType="String">
delete from BASE_KNIFE_LOCKED where BASE_KNIFE_LOCKED_ID = #{baseKnifeLockedId}
</delete>
<delete id="deleteBaseKnifeLockedByBaseKnifeLockedIds" parameterType="String">
delete from BASE_KNIFE_LOCKED where BASE_KNIFE_LOCKED_ID in
<foreach item="baseKnifeLockedId" collection="array" open="(" separator="," close=")">
#{baseKnifeLockedId}
</foreach>
</delete>
</mapper>

View File

@ -82,7 +82,7 @@
BK.SAFE_STOCK,
BK.STANDARD_QUANTITY,
BK.AREA_CODE,
WSA.AREA_NAME AREA_NAME,
WSA.AREA_NAME AREA_NAME,
BK.KNIFE_LIFE,
BK.KNIFE_FINE_STATE,
BK.IS_LOCKED,
@ -192,10 +192,13 @@
order by create_time desc
</select>
<!-- IS_VALID = 1 出粗则添加该指令 -->
<select id="selectBaseKnifeNotValidList" parameterType="BaseKnife" resultMap="BaseKnifeResult">
<include refid="selectBaseKnifeVo"/>
<where>
IS_VALID = 1
<if test="rfid != null and rfid != ''">
and RFID = #{rfid}
</if>
<if test="mbbBdMrlId != null and mbbBdMrlId != ''">
and MBB_BD_MRL_ID = #{mbbBdMrlId}
</if>
@ -522,15 +525,15 @@
<insert id="batchMdItem">
insert into MD_ITEM(ITEM_ID, ITEM_CODE, ITEM_NAME, SPECIFICATION, UNIT_OF_MEASURE, ITEM_OR_PRODUCT,
ITEM_TYPE_ID, ITEM_TYPE_CODE, ITEM_TYPE_NAME, ENABLE_FLAG, SAFE_STOCK_FLAG, MIN_STOCK,
MAX_STOCK, REMARK, ATTR1, ATTR2, ATTR3, ATTR4, CREATE_BY, CREATE_TIME, UPDATE_BY,
UPDATE_TIME, HIGH_VALUE, UNIT_NAME, MODEL_NUMBER, STANDARD_NUMBER) values
ITEM_TYPE_ID, ITEM_TYPE_CODE, ITEM_TYPE_NAME, ENABLE_FLAG, SAFE_STOCK_FLAG, MIN_STOCK,
MAX_STOCK, REMARK, ATTR1, ATTR2, ATTR3, ATTR4, CREATE_BY, CREATE_TIME, UPDATE_BY,
UPDATE_TIME, HIGH_VALUE, UNIT_NAME, MODEL_NUMBER, STANDARD_NUMBER) values
<foreach item="item" index="index" collection="list" separator=",">
(#{item.itemId}, #{item.itemCode}, #{item.itemName}, #{item.specification}, #{item.unitOfMeasure},
#{item.itemOrProduct}, #{item.itemTypeId}, #{item.itemTypeCode}, #{item.itemTypeName}, #{item.enableFlag},
#{item.safeStockFlag}, #{item.minStock}, #{item.maxStock}, #{item.remark}, #{item.attr1}, #{item.attr2},
#{item.attr3}, #{item.attr4}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime},
#{item.highValue}, #{item.unitName}, #{item.modelNumber}, #{item.standardNumber})
#{item.itemOrProduct}, #{item.itemTypeId}, #{item.itemTypeCode}, #{item.itemTypeName}, #{item.enableFlag},
#{item.safeStockFlag}, #{item.minStock}, #{item.maxStock}, #{item.remark}, #{item.attr1}, #{item.attr2},
#{item.attr3}, #{item.attr4}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime},
#{item.highValue}, #{item.unitName}, #{item.modelNumber}, #{item.standardNumber})
</foreach>
</insert>
@ -549,6 +552,19 @@
</where>
</select>
<select id="selectBaseKnifeListByMbbBdMrlIdAndKnifeFineStateAndIsLocked" resultMap="BaseKnifeResult">
<include refid="selectBaseKnifeVo"/>
<where>
IS_VALID = 0
<if test="mbbBdMrlId != null and mbbBdMrlId != ''">
and MBB_BD_MRL_ID = #{mbbBdMrlId}
</if>
<if test="isLocked != null">
and IS_LOCKED = #{isLocked}
</if>
</where>
</select>
<update id="updateBaseKnifeIsLockedByBaseKnifeId">
update BASE_KNIFE
<trim prefix="SET" suffixOverrides=",">
@ -577,6 +593,7 @@
FROM BASE_KNIFE BK
WHERE MBB_BD_MRL_ID = #{mbbBdMrlId}
AND (KNIFE_FINE_STATE = 0 OR KNIFE_FINE_STATE = 1)
AND IS_VALID = 0
</select>
<select id="selectScrapList" resultMap="BaseKnifeResult">
@ -596,4 +613,22 @@
FROM BASE_KNIFE
WHERE RFID = #{value}
</select>
</mapper>
<select id="selectNotEmptyAreaCodeList" resultType="java.lang.String">
SELECT AREA_CODE
FROM BASE_KNIFE
WHERE KNIFE_FINE_STATE == 1
GROUP BY AREA_CODE
</select>
<select id="selectBaseKnifeListByMbbBdMrlId" resultType="com.ktg.mes.md.domain.BaseKnife">
<include refid="selectBaseKnifeVo"/>
<where>
IS_VALID = 0
<if test="mbbBdMrlId != null and mbbBdMrlId != ''">
and MBB_BD_MRL_ID = #{mbbBdMrlId}
</if>
</where>
order by rfid desc
</select>
</mapper>

View File

@ -42,6 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="expendLife != null and expendLife != ''"> and EXPEND_LIFE = #{expendLife}</if>
<if test="lockedStartTime != null and lockedStartTime != ''"> and LOCKED_START_TIME = #{lockedStartTime}</if>
<if test="lockedEndTime != null and lockedEndTime != ''"> and LOCKED_END_TIME = #{lockedEndTime}</if>
<if test="technologyCode != null and technologyCode != ''"> and TECHNOLOGY_CODE = #{technologyCode}</if>
<if test="remark != null and remark != ''"> and REMARK = #{remark}</if>
<if test="attr1 != null and attr1 != ''"> and ATTR1 = #{attr1}</if>
<if test="attr2 != null and attr2 != ''"> and ATTR2 = #{attr2}</if>

View File

@ -52,6 +52,8 @@
high_value,
attr1,
attr2,
attr3,
attr4,
create_by,
create_time,
remark
@ -323,10 +325,10 @@
<if test="attr2 != null">
attr2=#{attr2},
</if>
<if test="attr3 != null and attr3 != 0">
<if test="attr3 != null">
attr3=#{attr3},
</if>
<if test="attr4 != null and attr4 != 0">
<if test="attr4 != null">
attr4=#{attr4},
</if>
<if test="updateBy != null and updateBy != ''">

View File

@ -1,128 +0,0 @@
<?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.ktg.mes.wm.mapper.BaseTechnologyBomMapper">
<resultMap type="BaseTechnologyBom" id="BaseTechnologyBomResult">
<result property="technologyBomId" column="technology_bom_id" />
<result property="figureCode" column="figure_code" />
<result property="processCode" column="process_code" />
<result property="processName" column="process_name" />
<result property="knifeCode" column="knife_code" />
<result property="knifeSort" column="knife_sort" />
<result property="knifeCount" column="knife_count" />
<result property="expendLife" column="expend_life" />
<result property="remark" column="remark" />
<result property="attr1" column="attr1" />
<result property="attr2" column="attr2" />
<result property="attr3" column="attr3" />
<result property="attr4" column="attr4" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectBaseTechnologyBomVo">
select technology_bom_id, figure_code, process_code, process_name, knife_code, knife_sort, knife_count, expend_life, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from base_technology_bom
</sql>
<select id="selectBaseTechnologyBomList" parameterType="BaseTechnologyBom" resultMap="BaseTechnologyBomResult">
<include refid="selectBaseTechnologyBomVo"/>
<where>
<if test="figureCode != null and figureCode != ''"> and figure_code = #{figureCode}</if>
<if test="processCode != null and processCode != ''"> and process_code = #{processCode}</if>
<if test="processName != null and processName != ''"> and process_name like concat('%', #{processName}, '%')</if>
<if test="knifeCode != null and knifeCode != ''"> and knife_code = #{knifeCode}</if>
<if test="knifeSort != null and knifeSort != ''"> and knife_sort = #{knifeSort}</if>
<if test="knifeCount != null "> and knife_count = #{knifeCount}</if>
<if test="expendLife != null "> and expend_life = #{expendLife}</if>
<if test="attr1 != null and attr1 != ''"> and attr1 = #{attr1}</if>
<if test="attr2 != null and attr2 != ''"> and attr2 = #{attr2}</if>
<if test="attr3 != null "> and attr3 = #{attr3}</if>
<if test="attr4 != null "> and attr4 = #{attr4}</if>
</where>
</select>
<select id="selectBaseTechnologyBomByTechnologyBomId" parameterType="Long" resultMap="BaseTechnologyBomResult">
<include refid="selectBaseTechnologyBomVo"/>
where technology_bom_id = #{technologyBomId}
</select>
<insert id="insertBaseTechnologyBom" parameterType="BaseTechnologyBom">
insert into base_technology_bom
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="technologyBomId != null">technology_bom_id,</if>
<if test="figureCode != null and figureCode != ''">figure_code,</if>
<if test="processCode != null and processCode != ''">process_code,</if>
<if test="processName != null and processName != ''">process_name,</if>
<if test="knifeCode != null and knifeCode != ''">knife_code,</if>
<if test="knifeSort != null and knifeSort != ''">knife_sort,</if>
<if test="knifeCount != null">knife_count,</if>
<if test="expendLife != null">expend_life,</if>
<if test="remark != null">remark,</if>
<if test="attr1 != null">attr1,</if>
<if test="attr2 != null">attr2,</if>
<if test="attr3 != null">attr3,</if>
<if test="attr4 != null">attr4,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="technologyBomId != null">#{technologyBomId},</if>
<if test="figureCode != null and figureCode != ''">#{figureCode},</if>
<if test="processCode != null and processCode != ''">#{processCode},</if>
<if test="processName != null and processName != ''">#{processName},</if>
<if test="knifeCode != null and knifeCode != ''">#{knifeCode},</if>
<if test="knifeSort != null and knifeSort != ''">#{knifeSort},</if>
<if test="knifeCount != null">#{knifeCount},</if>
<if test="expendLife != null">#{expendLife},</if>
<if test="remark != null">#{remark},</if>
<if test="attr1 != null">#{attr1},</if>
<if test="attr2 != null">#{attr2},</if>
<if test="attr3 != null">#{attr3},</if>
<if test="attr4 != null">#{attr4},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateBaseTechnologyBom" parameterType="BaseTechnologyBom">
update base_technology_bom
<trim prefix="SET" suffixOverrides=",">
<if test="figureCode != null and figureCode != ''">figure_code = #{figureCode},</if>
<if test="processCode != null and processCode != ''">process_code = #{processCode},</if>
<if test="processName != null and processName != ''">process_name = #{processName},</if>
<if test="knifeCode != null and knifeCode != ''">knife_code = #{knifeCode},</if>
<if test="knifeSort != null and knifeSort != ''">knife_sort = #{knifeSort},</if>
<if test="knifeCount != null">knife_count = #{knifeCount},</if>
<if test="expendLife != null">expend_life = #{expendLife},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="attr1 != null">attr1 = #{attr1},</if>
<if test="attr2 != null">attr2 = #{attr2},</if>
<if test="attr3 != null">attr3 = #{attr3},</if>
<if test="attr4 != null">attr4 = #{attr4},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where technology_bom_id = #{technologyBomId}
</update>
<delete id="deleteBaseTechnologyBomByTechnologyBomId" parameterType="Long">
delete from base_technology_bom where technology_bom_id = #{technologyBomId}
</delete>
<delete id="deleteBaseTechnologyBomByTechnologyBomIds" parameterType="String">
delete from base_technology_bom where technology_bom_id in
<foreach item="technologyBomId" collection="array" open="(" separator="," close=")">
#{technologyBomId}
</foreach>
</delete>
</mapper>

View File

@ -1,13 +1,13 @@
<?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">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ktg.mes.wm.mapper.ProductionArrangementsMapper">
<resultMap type="ProductionArrangements" id="ProductionArrangementsResult">
<result property="productionArrangementsId" column="PRODUCTION_ARRANGEMENTS_ID" />
<result property="planSheet" column="PLAN_SHEET" />
<result property="processCode" column="PROCESS_CODE" />
<result property="technologyCode" column="TECHNOLOGY_CODE" />
<result property="status" column="STATUS" />
<result property="attr1" column="ATTR1" />
<result property="attr2" column="ATTR2" />
@ -17,17 +17,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createTime" column="CREATE_TIME" />
<result property="updateBy" column="UPDATE_BY" />
<result property="updateTime" column="UPDATE_TIME" />
<result property="startTime" column="START_TIME" />
<result property="endTime" column="END_TIME" />
</resultMap>
<sql id="selectProductionArrangementsVo">
select PRODUCTION_ARRANGEMENTS_ID, PLAN_SHEET, PROCESS_CODE, STATUS, ATTR1, ATTR2, ATTR3, ATTR4, CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME from PRODUCTION_ARRANGEMENTS
select PRODUCTION_ARRANGEMENTS_ID, PLAN_SHEET, TECHNOLOGY_CODE, STATUS, ATTR1, ATTR2, ATTR3, ATTR4, CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME, START_TIME, END_TIME from PRODUCTION_ARRANGEMENTS
</sql>
<select id="selectProductionArrangementsList" parameterType="ProductionArrangements" resultMap="ProductionArrangementsResult">
<include refid="selectProductionArrangementsVo"/>
<where>
<where>
<if test="planSheet != null and planSheet != ''"> and PLAN_SHEET = #{planSheet}</if>
<if test="processCode != null and processCode != ''"> and PROCESS_CODE = #{processCode}</if>
<if test="technologyCode != null and technologyCode != ''"> and TECHNOLOGY_CODE = #{technologyCode}</if>
<if test="status != null and status != ''"> and STATUS = #{status}</if>
<if test="attr1 != null and attr1 != ''"> and ATTR1 = #{attr1}</if>
<if test="attr2 != null and attr2 != ''"> and ATTR2 = #{attr2}</if>
@ -37,9 +39,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null and createTime != ''"> and CREATE_TIME = #{createTime}</if>
<if test="updateBy != null and updateBy != ''"> and UPDATE_BY = #{updateBy}</if>
<if test="updateTime != null and updateTime != ''"> and UPDATE_TIME = #{updateTime}</if>
<if test="startTime != null and startTime != ''"> and START_TIME = #{startTime}</if>
<if test="endTime != null and endTime != ''"> and END_TIME = #{endTime}</if>
</where>
</select>
<select id="selectProductionArrangementsByProductionArrangementsId" parameterType="String" resultMap="ProductionArrangementsResult">
<include refid="selectProductionArrangementsVo"/>
where PRODUCTION_ARRANGEMENTS_ID = #{productionArrangementsId}
@ -49,12 +53,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectProductionArrangementsVo"/>
where PLAN_SHEET = #{planSheet}
</select>
<insert id="insertProductionArrangements" parameterType="ProductionArrangements" useGeneratedKeys="true" keyProperty="productionArrangementsId">
insert into PRODUCTION_ARRANGEMENTS
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="planSheet != null">PLAN_SHEET,</if>
<if test="processCode != null">PROCESS_CODE,</if>
<if test="technologyCode != null">TECHNOLOGY_CODE,</if>
<if test="status != null">STATUS,</if>
<if test="processUnit != null">PROCESS_UNIT,</if>
<if test="attr1 != null">ATTR1,</if>
@ -65,10 +69,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">CREATE_TIME,</if>
<if test="updateBy != null">UPDATE_BY,</if>
<if test="updateTime != null">UPDATE_TIME,</if>
</trim>
<if test="startTime != null">START_TIME,</if>
<if test="endTime != null">END_TIME,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="planSheet != null">#{planSheet},</if>
<if test="processCode != null">#{processCode},</if>
<if test="technologyCode != null">#{technologyCode},</if>
<if test="status != null">#{status},</if>
<if test="processUnit != null">#{processUnit},</if>
<if test="attr1 != null">#{attr1},</if>
@ -79,14 +85,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
<if test="startTime != null">#{startTime},</if>
<if test="endTime != null">#{endTime},</if>
</trim>
</insert>
<update id="updateProductionArrangements" parameterType="ProductionArrangements">
update PRODUCTION_ARRANGEMENTS
<trim prefix="SET" suffixOverrides=",">
<if test="planSheet != null">PLAN_SHEET = #{planSheet},</if>
<if test="processCode != null">PROCESS_CODE = #{processCode},</if>
<if test="technologyCode != null">TECHNOLOGY_CODE = #{technologyCode},</if>
<if test="status != null">STATUS = #{status},</if>
<if test="attr1 != null">ATTR1 = #{attr1},</if>
<if test="attr2 != null">ATTR2 = #{attr2},</if>
@ -96,6 +104,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">CREATE_TIME = #{createTime},</if>
<if test="updateBy != null">UPDATE_BY = #{updateBy},</if>
<if test="updateTime != null">UPDATE_TIME = #{updateTime},</if>
<if test="startTime != null">START_TIME = #{startTime},</if>
<if test="endTime != null">END_TIME = #{endTime},</if>
</trim>
where PRODUCTION_ARRANGEMENTS_ID = #{productionArrangementsId}
</update>
@ -105,7 +115,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteProductionArrangementsByProductionArrangementsIds" parameterType="String">
delete from PRODUCTION_ARRANGEMENTS where PRODUCTION_ARRANGEMENTS_ID in
delete from PRODUCTION_ARRANGEMENTS where PRODUCTION_ARRANGEMENTS_ID in
<foreach item="productionArrangementsId" collection="array" open="(" separator="," close=")">
#{productionArrangementsId}
</foreach>

View File

@ -1,129 +1,273 @@
<?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">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ktg.mes.wm.mapper.UcmCtBaseMapper">
<resultMap type="UcmCtBase" id="UcmCtBaseResult">
<result property="ctBaseId" column="CT_BASE_ID" />
<result property="code" column="CODE" />
<result property="type" column="TYPE" />
<result property="remark" column="REMARK" />
<result property="attr1" column="ATTR1" />
<result property="attr2" column="ATTR2" />
<result property="attr3" column="ATTR3" />
<result property="attr4" column="ATTR4" />
<result property="createBy" column="CREATE_BY" />
<result property="createTime" column="CREATE_TIME" />
<result property="updateBy" column="UPDATE_BY" />
<result property="updateTime" column="UPDATE_TIME" />
<result property="ctBaseId" column="CT_BASE_ID"/>
<result property="code" column="CODE"/>
<result property="type" column="TYPE"/>
<result property="remark" column="REMARK"/>
<result property="attr1" column="ATTR1"/>
<result property="attr2" column="ATTR2"/>
<result property="attr3" column="ATTR3"/>
<result property="attr4" column="ATTR4"/>
<result property="createBy" column="CREATE_BY"/>
<result property="createTime" column="CREATE_TIME"/>
<result property="updateBy" column="UPDATE_BY"/>
<result property="updateTime" column="UPDATE_TIME"/>
</resultMap>
<resultMap id="UcmCtBaseBaseKnifeResult" type="UcmCtBase" extends="UcmCtBaseResult">
<collection property="baseKnifeList" notNullColumn="base_knife_id" javaType="java.util.List" resultMap="BaseKnifeList" />
<collection property="baseKnifeList" notNullColumn="base_knife_id" javaType="java.util.List"
resultMap="BaseKnifeList"/>
</resultMap>
<resultMap type="BaseKnife" id="BaseKnifeList">
<result property="baseKnifeId" column="base_knife_id" />
<result property="knifeCode" column="knife_code" />
<result property="knifeName" column="knife_name" />
<result property="knifeUnit" column="knife_unit" />
<result property="baseKnifeId" column="base_knife_id"/>
<result property="rfid" column="rfid"/>
<result property="knifeCode" column="knife_code"/>
<result property="knifeName" column="knife_name"/>
<result property="knifeUnit" column="knife_unit"/>
</resultMap>
<sql id="selectUcmCtBaseVo">
select CT_BASE_ID, CODE, TYPE, REMARK, ATTR1, ATTR2, ATTR3, ATTR4, CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME from UCM_CT_BASE
select CT_BASE_ID,
CODE,
TYPE,
REMARK,
ATTR1,
ATTR2,
ATTR3,
ATTR4,
CREATE_BY,
CREATE_TIME,
UPDATE_BY,
UPDATE_TIME
from UCM_CT_BASE
</sql>
<select id="selectUcmCtBaseList" parameterType="UcmCtBase" resultMap="UcmCtBaseResult">
<include refid="selectUcmCtBaseVo"/>
<where>
<if test="code != null and code != ''"> and CODE = #{code}</if>
<if test="type != null and type != ''"> and TYPE = #{type}</if>
<if test="createBy != null and createBy != ''"> and CREATE_BY = #{createBy}</if>
<if test="createTime != null and createTime != ''"> and CREATE_TIME = #{createTime}</if>
<if test="updateBy != null and updateBy != ''"> and UPDATE_BY = #{updateBy}</if>
<if test="updateTime != null and updateTime != ''"> and UPDATE_TIME = #{updateTime}</if>
<where>
<if test="code != null and code != ''">
and CODE = #{code}
</if>
<if test="type != null and type != ''">
and TYPE = #{type}
</if>
<if test="attr1 != null">
and ATTR1 = #{attr1}
</if>
<if test="attr3 != null">
and ATTR3 = #{attr3}
</if>
<if test="createBy != null and createBy != ''">
and CREATE_BY = #{createBy}
</if>
<if test="createTime != null and createTime != ''">
and CREATE_TIME = #{createTime}
</if>
<if test="updateBy != null and updateBy != ''">
and UPDATE_BY = #{updateBy}
</if>
<if test="updateTime != null and updateTime != ''">
and UPDATE_TIME = #{updateTime}
</if>
</where>
</select>
<select id="selectUcmCtBaseByCtBaseId" parameterType="String" resultMap="UcmCtBaseBaseKnifeResult">
select ucb.CT_BASE_ID, ucb.CODE, ucb.TYPE, ucb.REMARK, ucb.CREATE_BY, ucb.CREATE_TIME, ucb.UPDATE_BY, ucb.UPDATE_TIME,
bk.base_knife_id, mi.item_name as knife_name, mi.item_code as knife_code, mi.unit_name as knife_unit
<select id="selectUcmCtBaseByCode" parameterType="String" resultMap="UcmCtBaseBaseKnifeResult">
select ucb.CT_BASE_ID,
ucb.CODE,
ucb.TYPE,
ucb.REMARK,
ucb.ATTR1,
ucb.ATTR3,
ucb.CREATE_BY,
ucb.CREATE_TIME,
ucb.UPDATE_BY,
ucb.UPDATE_TIME,
bk.base_knife_id,
bk.rfid,
mi.item_name as knife_name,
mi.item_code as knife_code,
mi.unit_name as knife_unit
from UCM_CT_BASE ucb
left join ucm_ct_material ucm
on ucb.ct_base_id = ucm.ct_base_id
left join base_knife bk
on ucm.base_knife_id = bk.base_knife_id
left join md_item mi
on bk.mbb_bd_mrl_id = mi.item_id
left join ucm_ct_material ucm
on ucb.ct_base_id = ucm.ct_base_id
left join base_knife bk
on ucm.base_knife_id = bk.base_knife_id
left join md_item mi
on bk.mbb_bd_mrl_id = mi.item_id
where ucb.CODE = #{code}
</select>
<select id="selectUcmCtBaseByCtBaseId" parameterType="String" resultMap="UcmCtBaseBaseKnifeResult">
select ucb.CT_BASE_ID,
ucb.CODE,
ucb.TYPE,
ucb.REMARK,
ucb.ATTR1,
ucb.ATTR3,
ucb.CREATE_BY,
ucb.CREATE_TIME,
ucb.UPDATE_BY,
ucb.UPDATE_TIME,
bk.base_knife_id,
mi.item_name as knife_name,
mi.item_code as knife_code,
mi.unit_name as knife_unit
from UCM_CT_BASE ucb
left join ucm_ct_material ucm
on ucb.ct_base_id = ucm.ct_base_id
left join base_knife bk
on ucm.base_knife_id = bk.base_knife_id
left join md_item mi
on bk.mbb_bd_mrl_id = mi.item_id
where ucb.CT_BASE_ID = #{ctBaseId}
</select>
<insert id="insertUcmCtBase" parameterType="UcmCtBase" useGeneratedKeys="true" keyProperty="ctBaseId">
insert into UCM_CT_BASE
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="code != null">CODE,</if>
<if test="type != null">TYPE,</if>
<if test="remark != null">REMARK,</if>
<if test="attr1 != null">ATTR1,</if>
<if test="attr2 != null">ATTR2,</if>
<if test="attr3 != null">ATTR3,</if>
<if test="attr4 != null">ATTR4,</if>
<if test="createBy != null">CREATE_BY,</if>
<if test="createTime != null">CREATE_TIME,</if>
<if test="updateBy != null">UPDATE_BY,</if>
<if test="updateTime != null">UPDATE_TIME,</if>
</trim>
<if test="code != null">
CODE,
</if>
<if test="type != null">
TYPE,
</if>
<if test="remark != null">
REMARK,
</if>
<if test="attr1 != null">
ATTR1,
</if>
<if test="attr2 != null">
ATTR2,
</if>
<if test="attr3 != null">
ATTR3,
</if>
<if test="attr4 != null">
ATTR4,
</if>
<if test="createBy != null">
CREATE_BY,
</if>
<if test="createTime != null">
CREATE_TIME,
</if>
<if test="updateBy != null">
UPDATE_BY,
</if>
<if test="updateTime != null">
UPDATE_TIME,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="code != null">#{code},</if>
<if test="type != null">#{type},</if>
<if test="remark != null">#{remark},</if>
<if test="attr1 != null">#{attr1},</if>
<if test="attr2 != null">#{attr2},</if>
<if test="attr3 != null">#{attr3},</if>
<if test="attr4 != null">#{attr4},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
<if test="code != null">
#{code},
</if>
<if test="type != null">
#{type},
</if>
<if test="remark != null">
#{remark},
</if>
<if test="attr1 != null">
#{attr1},
</if>
<if test="attr2 != null">
#{attr2},
</if>
<if test="attr3 != null">
#{attr3},
</if>
<if test="attr4 != null">
#{attr4},
</if>
<if test="createBy != null">
#{createBy},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateBy != null">
#{updateBy},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
</trim>
</insert>
<update id="updateUcmCtBase" parameterType="UcmCtBase">
update UCM_CT_BASE
<trim prefix="SET" suffixOverrides=",">
<if test="code != null">CODE = #{code},</if>
<if test="type != null">TYPE = #{type},</if>
<if test="remark != null">REMARK = #{remark},</if>
<if test="attr1 != null">ATTR1 = #{attr1},</if>
<if test="attr2 != null">ATTR2 = #{attr2},</if>
<if test="attr3 != null">ATTR3 = #{attr3},</if>
<if test="attr4 != null">ATTR4 = #{attr4},</if>
<if test="createBy != null">CREATE_BY = #{createBy},</if>
<if test="createTime != null">CREATE_TIME = #{createTime},</if>
<if test="updateBy != null">UPDATE_BY = #{updateBy},</if>
<if test="updateTime != null">UPDATE_TIME = #{updateTime},</if>
<if test="code != null">
CODE = #{code},
</if>
<if test="type != null">
TYPE = #{type},
</if>
<if test="remark != null">
REMARK = #{remark},
</if>
ATTR1 = #{attr1},
<if test="attr2 != null">
ATTR2 = #{attr2},
</if>
<if test="attr3 != null">
ATTR3 = #{attr3},
</if>
<if test="attr4 != null">
ATTR4 = #{attr4},
</if>
<if test="createBy != null">
CREATE_BY = #{createBy},
</if>
<if test="createTime != null">
CREATE_TIME = #{createTime},
</if>
<if test="updateBy != null">
UPDATE_BY = #{updateBy},
</if>
<if test="updateTime != null">
UPDATE_TIME = #{updateTime},
</if>
</trim>
where CT_BASE_ID = #{ctBaseId}
</update>
<delete id="deleteUcmCtBaseByCtBaseId" parameterType="String">
delete from UCM_CT_BASE where CT_BASE_ID = #{ctBaseId}
delete
from UCM_CT_BASE
where CT_BASE_ID = #{ctBaseId}
</delete>
<delete id="deleteUcmCtBaseByCtBaseIds" parameterType="String">
delete from UCM_CT_BASE where CT_BASE_ID in
delete
from UCM_CT_BASE where CT_BASE_ID in
<foreach item="ctBaseId" collection="array" open="(" separator="," close=")">
#{ctBaseId}
</foreach>
</delete>
<delete id="deleteUcmCtMaterialByCtBaseId">
delete from UCM_CT_MATERIAL where ct_base_id = #{ctBaseId}
delete
from UCM_CT_MATERIAL
where ct_base_id = #{ctBaseId}
</delete>
<insert id="insertUcmCtMaterial">
insert into ucm_ct_material( ct_base_id, base_knife_id, CREATE_BY, CREATE_TIME) values
( #{ctBaseId}, #{baseKnifeId}, #{createBy}, #{createTime})
insert into ucm_ct_material(ct_base_id, base_knife_id, CREATE_BY, CREATE_TIME)
values (#{ctBaseId}, #{baseKnifeId}, #{createBy}, #{createTime})
</insert>
</mapper>
<select id="selectNotEmptyAreaIdList" resultType="java.lang.String">
SELECT ATTR1
FROM UCM_CT_BASE
GROUP BY ATTR1
</select>
</mapper>

View File

@ -1,189 +1,373 @@
<?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">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ktg.mes.wm.mapper.WmStorageAreaMapper">
<resultMap type="WmStorageArea" id="WmStorageAreaResult">
<result property="areaId" column="area_id" />
<result property="areaCode" column="area_code" />
<result property="areaName" column="area_name" />
<result property="locationId" column="location_id" />
<result property="area" column="area" />
<result property="maxLoa" column="max_loa" />
<result property="positionX" column="position_x" />
<result property="positionY" column="position_y" />
<result property="positionZ" column="position_z" />
<result property="enableFlag" column="enable_flag" />
<result property="frozenFlag" column="frozen_flag" />
<result property="remark" column="remark" />
<result property="attr1" column="attr1" />
<result property="attr2" column="attr2" />
<result property="attr3" column="attr3" />
<result property="attr4" column="attr4" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="areaId" column="area_id"/>
<result property="areaCode" column="area_code"/>
<result property="areaName" column="area_name"/>
<result property="locationId" column="location_id"/>
<result property="area" column="area"/>
<result property="maxLoa" column="max_loa"/>
<result property="positionX" column="position_x"/>
<result property="positionY" column="position_y"/>
<result property="positionZ" column="position_z"/>
<result property="enableFlag" column="enable_flag"/>
<result property="frozenFlag" column="frozen_flag"/>
<result property="remark" column="remark"/>
<result property="attr1" column="attr1"/>
<result property="attr2" column="attr2"/>
<result property="attr3" column="attr3"/>
<result property="attr4" column="attr4"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<resultMap type="AreaVo" id="WmStorageAreaVoResult">
<result property="areaId" column="area_id" />
<result property="areaCode" column="area_code" />
<result property="locationName" column="location_name" />
<result property="areaName" column="area_name" />
<result property="locationId" column="location_id" />
<result property="area" column="area" />
<result property="maxLoa" column="max_loa" />
<result property="positionX" column="position_x" />
<result property="positionY" column="position_y" />
<result property="positionZ" column="position_z" />
<result property="enableFlag" column="enable_flag" />
<result property="frozenFlag" column="frozen_flag" />
<result property="remark" column="remark" />
<result property="attr1" column="attr1" />
<result property="attr2" column="attr2" />
<result property="attr3" column="attr3" />
<result property="attr4" column="attr4" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="areaId" column="area_id"/>
<result property="areaCode" column="area_code"/>
<result property="locationName" column="location_name"/>
<result property="areaName" column="area_name"/>
<result property="locationId" column="location_id"/>
<result property="area" column="area"/>
<result property="maxLoa" column="max_loa"/>
<result property="positionX" column="position_x"/>
<result property="positionY" column="position_y"/>
<result property="positionZ" column="position_z"/>
<result property="enableFlag" column="enable_flag"/>
<result property="frozenFlag" column="frozen_flag"/>
<result property="remark" column="remark"/>
<result property="attr1" column="attr1"/>
<result property="attr2" column="attr2"/>
<result property="attr3" column="attr3"/>
<result property="attr4" column="attr4"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<sql id="selectWmStorageAreaVo">
select area_id, area_code, area_name, location_id, area, max_loa, position_x, position_y, position_z, enable_flag, frozen_flag, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_storage_area
select area_id,
area_code,
area_name,
location_id,
area,
max_loa,
position_x,
position_y,
position_z,
enable_flag,
frozen_flag,
remark,
attr1,
attr2,
attr3,
attr4,
create_by,
create_time,
update_by,
update_time
from wm_storage_area
</sql>
<select id="selectWmStorageAreaList" parameterType="WmStorageArea" resultMap="WmStorageAreaResult">
<include refid="selectWmStorageAreaVo"/>
<where>
<if test="areaCode != null and areaCode != ''"> and area_code like concat('%', #{areaCode}, '%') </if>
<if test="areaName != null and areaName != ''"> and area_name like concat('%', #{areaName}, '%')</if>
<if test="locationId != null "> and location_id like concat('%', #{locationId}, '%') </if>
<if test="area != null "> and like concat('%',#{area}, '%') </if>
<if test="maxLoa != null "> and max_loa = #{maxLoa}</if>
<if test="positionX != null and positionX !=0 "> and position_x = #{positionX}</if>
<if test="positionY != null and positionY !=0"> and position_y = #{positionY}</if>
<if test="positionZ != null and positionZ !=0"> and position_z = #{positionZ}</if>
<if test="enableFlag != null and enableFlag != ''"> and enable_flag = #{enableFlag}</if>
and IS_DELETE = 0
</where>
</select>
<select id="selectWmStorageAreaList" parameterType="WmStorageArea" resultMap="WmStorageAreaResult">
<include refid="selectWmStorageAreaVo"/>
<where>
<if test="areaCode != null and areaCode != ''">
and area_code like concat('%', #{areaCode}, '%')
</if>
<if test="areaName != null and areaName != ''">
and area_name like concat('%', #{areaName}, '%')
</if>
<if test="locationId != null">
and location_id like concat('%', #{locationId}, '%')
</if>
<if test="area != null">
and like concat('%', #{area}, '%')
</if>
<if test="maxLoa != null">
and max_loa = #{maxLoa}
</if>
<if test="attr3 != null">
and attr3 = #{attr3}
</if>
<if test="positionX != null and positionX != 0">
and position_x = #{positionX}
</if>
<if test="positionY != null and positionY != 0">
and position_y = #{positionY}
</if>
<if test="positionZ != null and positionZ != 0">
and position_z = #{positionZ}
</if>
<if test="enableFlag != null and enableFlag != ''">
and enable_flag = #{enableFlag}
</if>
and IS_DELETE = 0
</where>
ORDER BY attr2 ASC
</select>
<select id="selectWmStorageAreaListVo" parameterType="AreaVo" resultMap="WmStorageAreaVoResult">
select w.*,l.location_name from wm_storage_area w join wm_storage_location l on w.location_id = l.location_id
select w.*, l.location_name
from wm_storage_area w
join wm_storage_location l on w.location_id = l.location_id
<where>
<if test="areaCode != null and areaCode != ''"> and w.area_code like concat('%', #{areaCode}, '%') </if>
<if test="areaName != null and areaName != ''"> and w.area_name like concat('%', #{areaName}, '%')</if>
<if test="locationId != null "> and w.location_id like concat('%', #{locationId}, '%') </if>
<if test="area != null "> and like concat('%',#{area}, '%') </if>
<if test="maxLoa != null "> and max_loa = #{maxLoa}</if>
<if test="positionX != null and positionX !=0 "> and w.position_x = #{positionX}</if>
<if test="positionY != null and positionY !=0"> and w.position_y = #{positionY}</if>
<if test="positionZ != null and positionZ !=0"> and w.position_z = #{positionZ}</if>
<if test="enableFlag != null and enableFlag != ''"> and w.enable_flag = #{enableFlag}</if>
<if test="areaCode != null and areaCode != ''">
and w.area_code like concat('%', #{areaCode}, '%')
</if>
<if test="areaName != null and areaName != ''">
and w.area_name like concat('%', #{areaName}, '%')
</if>
<if test="locationId != null">
and w.location_id like concat('%', #{locationId}, '%')
</if>
<if test="area != null">
and like concat('%', #{area}, '%')
</if>
<if test="maxLoa != null">
and max_loa = #{maxLoa}
</if>
<if test="positionX != null and positionX != 0">
and w.position_x = #{positionX}
</if>
<if test="positionY != null and positionY != 0">
and w.position_y = #{positionY}
</if>
<if test="positionZ != null and positionZ != 0">
and w.position_z = #{positionZ}
</if>
<if test="enableFlag != null and enableFlag != ''">
and w.enable_flag = #{enableFlag}
</if>
and w.IS_DELETE = 0
</where>
</select>
<select id="selectWmStorageAreaByAreaId" parameterType="Long" resultMap="WmStorageAreaResult">
<include refid="selectWmStorageAreaVo"/>
where area_id = #{areaId} and IS_DELETE = 0
where area_id = #{areaId}
and IS_DELETE = 0
</select>
<select id="selectWmStorageAreaByAreaIdVo" parameterType="Long" resultMap="WmStorageAreaVoResult">
select w.*,l.location_name from wm_storage_area w join wm_storage_location l on w.location_id = l.location_id
where area_id = #{areaId} and w.IS_DELETE = 0
select w.*, l.location_name
from wm_storage_area w
join wm_storage_location l on w.location_id = l.location_id
where area_id = #{areaId}
and w.IS_DELETE = 0
</select>
<select id="selectWmStorageAreaByAreaCode" parameterType="String" resultMap="WmStorageAreaResult">
<include refid="selectWmStorageAreaVo"/>
where area_code = #{areaCode} and IS_DELETE = 0
where area_code = #{areaCode}
and IS_DELETE = 0
</select>
<select id="getAll" resultType="com.ktg.mes.wm.domain.WmStorageArea" resultMap="WmStorageAreaResult">
SELECT * FROM wm_storage_area where IS_DELETE = 0
SELECT *
FROM wm_storage_area
where IS_DELETE = 0
</select>
<insert id="insertWmStorageArea" parameterType="WmStorageArea" useGeneratedKeys="true" keyProperty="areaId">
insert into wm_storage_area
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="areaCode != null and areaCode != ''">area_code,</if>
<if test="areaName != null and areaName != ''">area_name,</if>
<if test="locationId != null">location_id,</if>
<if test="area != null">area,</if>
<if test="maxLoa != null">max_loa,</if>
<if test="positionX != null">position_x,</if>
<if test="positionY != null">position_y,</if>
<if test="positionZ != null">position_z,</if>
<if test="enableFlag != null">enable_flag,</if>
<if test="frozenFlag != null">frozen_flag,</if>
<if test="remark != null">remark,</if>
<if test="attr1 != null">attr1,</if>
<if test="attr2 != null">attr2,</if>
<if test="attr3 != null">attr3,</if>
<if test="attr4 != null">attr4,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<if test="areaCode != null and areaCode != ''">
area_code,
</if>
<if test="areaName != null and areaName != ''">
area_name,
</if>
<if test="locationId != null">
location_id,
</if>
<if test="area != null">
area,
</if>
<if test="maxLoa != null">
max_loa,
</if>
<if test="positionX != null">
position_x,
</if>
<if test="positionY != null">
position_y,
</if>
<if test="positionZ != null">
position_z,
</if>
<if test="enableFlag != null">
enable_flag,
</if>
<if test="frozenFlag != null">
frozen_flag,
</if>
<if test="remark != null">
remark,
</if>
<if test="attr1 != null">
attr1,
</if>
<if test="attr2 != null">
attr2,
</if>
<if test="attr3 != null">
attr3,
</if>
<if test="attr4 != null">
attr4,
</if>
<if test="createBy != null">
create_by,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateBy != null">
update_by,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="areaCode != null and areaCode != ''">#{areaCode},</if>
<if test="areaName != null and areaName != ''">#{areaName},</if>
<if test="locationId != null">#{locationId},</if>
<if test="area != null">#{area},</if>
<if test="maxLoa != null">#{maxLoa},</if>
<if test="positionX != null">#{positionX},</if>
<if test="positionY != null">#{positionY},</if>
<if test="positionZ != null">#{positionZ},</if>
<if test="enableFlag != null">#{enableFlag},</if>
<if test="frozenFlag != null">#{frozenFlag},</if>
<if test="remark != null">#{remark},</if>
<if test="attr1 != null">#{attr1},</if>
<if test="attr2 != null">#{attr2},</if>
<if test="attr3 != null">#{attr3},</if>
<if test="attr4 != null">#{attr4},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
<if test="areaCode != null and areaCode != ''">
#{areaCode},
</if>
<if test="areaName != null and areaName != ''">
#{areaName},
</if>
<if test="locationId != null">
#{locationId},
</if>
<if test="area != null">
#{area},
</if>
<if test="maxLoa != null">
#{maxLoa},
</if>
<if test="positionX != null">
#{positionX},
</if>
<if test="positionY != null">
#{positionY},
</if>
<if test="positionZ != null">
#{positionZ},
</if>
<if test="enableFlag != null">
#{enableFlag},
</if>
<if test="frozenFlag != null">
#{frozenFlag},
</if>
<if test="remark != null">
#{remark},
</if>
<if test="attr1 != null">
#{attr1},
</if>
<if test="attr2 != null">
#{attr2},
</if>
<if test="attr3 != null">
#{attr3},
</if>
<if test="attr4 != null">
#{attr4},
</if>
<if test="createBy != null">
#{createBy},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateBy != null">
#{updateBy},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
</trim>
</insert>
<update id="updateWmStorageArea" parameterType="WmStorageArea">
update wm_storage_area
<trim prefix="SET" suffixOverrides=",">
<if test="areaCode != null and areaCode != ''">area_code = #{areaCode},</if>
<if test="areaName != null and areaName != ''">area_name = #{areaName},</if>
<if test="locationId != null">location_id = #{locationId},</if>
<if test="area != null">area = #{area},</if>
<if test="maxLoa != null">max_loa = #{maxLoa},</if>
<if test="positionX != null">position_x = #{positionX},</if>
<if test="positionY != null">position_y = #{positionY},</if>
<if test="positionZ != null">position_z = #{positionZ},</if>
<if test="enableFlag != null">enable_flag = #{enableFlag},</if>
<if test="frozenFlag != null">frozen_flag = #{frozenFlag},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="attr1 != null">attr1 = #{attr1},</if>
<if test="attr2 != null">attr2 = #{attr2},</if>
<if test="attr3 != null">attr3 = #{attr3},</if>
<if test="attr4 != null">attr4 = #{attr4},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="areaCode != null and areaCode != ''">
area_code = #{areaCode},
</if>
<if test="areaName != null and areaName != ''">
area_name = #{areaName},
</if>
<if test="locationId != null">
location_id = #{locationId},
</if>
<if test="area != null">
area = #{area},
</if>
<if test="maxLoa != null">
max_loa = #{maxLoa},
</if>
<if test="positionX != null">
position_x = #{positionX},
</if>
<if test="positionY != null">
position_y = #{positionY},
</if>
<if test="positionZ != null">
position_z = #{positionZ},
</if>
<if test="enableFlag != null">
enable_flag = #{enableFlag},
</if>
<if test="frozenFlag != null">
frozen_flag = #{frozenFlag},
</if>
<if test="remark != null">
remark = #{remark},
</if>
<if test="attr1 != null">
attr1 = #{attr1},
</if>
<if test="attr2 != null">
attr2 = #{attr2},
</if>
<if test="attr3 != null">
attr3 = #{attr3},
</if>
<if test="attr4 != null">
attr4 = #{attr4},
</if>
<if test="createBy != null">
create_by = #{createBy},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
<if test="updateBy != null">
update_by = #{updateBy},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
</trim>
where area_id = #{areaId}
</update>
<update id="deleteWmStorageAreaByAreaId" parameterType="Long">
update wm_storage_area set IS_DELETE =1
update wm_storage_area
set IS_DELETE =1
where area_id = #{areaId}
</update>
<update id="deleteWmStorageAreaByAreaIds" parameterType="String">
update wm_storage_area set IS_DELETE = 1
update wm_storage_area
set IS_DELETE = 1
where area_id in
<foreach item="areaId" collection="array" open="(" separator="," close=")">
#{areaId}
@ -191,13 +375,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<update id="deleteByWarehouseId" parameterType="Long">
update wm_storage_area set IS_DELETE =1
where location_id in ( select location_id from wm_storage_location where warehouse_id = #{warehouseId})
update wm_storage_area
set IS_DELETE =1
where location_id in (select location_id from wm_storage_location where warehouse_id = #{warehouseId})
</update>
<update id="deleteByLocationId" parameterType="Long">
update wm_storage_area set IS_DELETE = 1
update wm_storage_area
set IS_DELETE = 1
where location_id = #{locationId}
</update>
</mapper>

View File

@ -1,60 +1,85 @@
<?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">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ktg.mes.wm.mapper.WmStorageLocationMapper">
<resultMap type="WmStorageLocation" id="WmStorageLocationResult">
<result property="locationId" column="location_id" />
<result property="locationCode" column="location_code" />
<result property="locationName" column="location_name" />
<result property="warehouseId" column="warehouse_id" />
<result property="area" column="area" />
<result property="areaFlag" column="area_flag" />
<result property="frozenFlag" column="frozen_flag" />
<result property="remark" column="remark" />
<result property="attr1" column="attr1" />
<result property="attr2" column="attr2" />
<result property="attr3" column="attr3" />
<result property="attr4" column="attr4" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="locationId" column="location_id"/>
<result property="locationCode" column="location_code"/>
<result property="locationName" column="location_name"/>
<result property="warehouseId" column="warehouse_id"/>
<result property="area" column="area"/>
<result property="areaFlag" column="area_flag"/>
<result property="frozenFlag" column="frozen_flag"/>
<result property="remark" column="remark"/>
<result property="attr1" column="attr1"/>
<result property="attr2" column="attr2"/>
<result property="attr3" column="attr3"/>
<result property="attr4" column="attr4"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<resultMap type="WmStorageLocationVo" id="WmStorageLocationVoResult">
<result property="locationId" column="location_id" />
<result property="locationCode" column="location_code" />
<result property="locationName" column="location_name" />
<result property="warehouseId" column="warehouse_id" />
<result property="area" column="area" />
<result property="areaFlag" column="area_flag" />
<result property="frozenFlag" column="frozen_flag" />
<result property="remark" column="remark" />
<result property="attr1" column="attr1" />
<result property="attr2" column="attr2" />
<result property="attr3" column="attr3" />
<result property="attr4" column="attr4" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="warehouseName" column="warehouse_name" />
<result property="locationId" column="location_id"/>
<result property="locationCode" column="location_code"/>
<result property="locationName" column="location_name"/>
<result property="warehouseId" column="warehouse_id"/>
<result property="area" column="area"/>
<result property="areaFlag" column="area_flag"/>
<result property="frozenFlag" column="frozen_flag"/>
<result property="remark" column="remark"/>
<result property="attr1" column="attr1"/>
<result property="attr2" column="attr2"/>
<result property="attr3" column="attr3"/>
<result property="attr4" column="attr4"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="warehouseName" column="warehouse_name"/>
</resultMap>
<sql id="selectWmStorageLocationVo">
select location_id, location_code, location_name, warehouse_id, area, area_flag, frozen_flag, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_storage_location
select location_id,
location_code,
location_name,
warehouse_id,
area,
area_flag,
frozen_flag,
remark,
attr1,
attr2,
attr3,
attr4,
create_by,
create_time,
update_by,
update_time
from wm_storage_location
</sql>
<select id="selectWmStorageLocationList" parameterType="WmStorageLocation" resultMap="WmStorageLocationResult">
<include refid="selectWmStorageLocationVo"/>
<where>
<if test="locationCode != null and locationCode != ''"> and location_code like concat('%',#{locationCode}, '%') </if>
<if test="locationName != null and locationName != ''"> and location_name like concat('%', #{locationName}, '%')</if>
<if test="warehouseId != null "> and warehouse_id = #{warehouseId}</if>
<if test="area != null "> and area = #{area}</if>
<if test="areaFlag != null and areaFlag != ''"> and area_flag = #{areaFlag}</if>
<where>
<if test="locationCode != null and locationCode != ''">
and location_code like concat('%', #{locationCode}, '%')
</if>
<if test="locationName != null and locationName != ''">
and location_name like concat('%', #{locationName}, '%')
</if>
<if test="warehouseId != null">
and warehouse_id = #{warehouseId}
</if>
<if test="area != null">
and area = #{area}
</if>
<if test="areaFlag != null and areaFlag != ''">
and area_flag = #{areaFlag}
</if>
and IS_DELETE = 0
</where>
</select>
@ -62,114 +87,228 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectWmStorageLocationListVo" parameterType="WmStorageLocation" resultMap="WmStorageLocationVoResult">
SELECT l.*, w.warehouse_name
FROM wm_storage_location l
JOIN wm_warehouse w ON w.warehouse_id = l.warehouse_id
JOIN wm_warehouse w ON w.warehouse_id = l.warehouse_id
<where>
<if test="locationCode != null and locationCode != ''"> and l.location_code like concat('%',#{locationCode}, '%') </if>
<if test="locationName != null and locationName != ''"> and l.location_name like concat('%', #{locationName}, '%')</if>
<if test="warehouseId != null "> and w.warehouse_id = #{warehouseId}</if>
<if test="area != null "> and l.area = #{area}</if>
<if test="areaFlag != null and areaFlag != ''"> and l.area_flag = #{areaFlag}</if>
<if test="locationCode != null and locationCode != ''">
and l.location_code like concat('%', #{locationCode}, '%')
</if>
<if test="locationName != null and locationName != ''">
and l.location_name like concat('%', #{locationName}, '%')
</if>
<if test="warehouseId != null">
and w.warehouse_id = #{warehouseId}
</if>
<if test="area != null">
and l.area = #{area}
</if>
<if test="areaFlag != null and areaFlag != ''">
and l.area_flag = #{areaFlag}
</if>
and l.IS_DELETE = 0
</where>
</select>
<select id="selectWmStorageLocationByLocationId" parameterType="Long" resultMap="WmStorageLocationResult">
<include refid="selectWmStorageLocationVo"/>
where location_id = #{locationId} and IS_DELETE = 0
where location_id = #{locationId}
and IS_DELETE = 0
</select>
<select id="selectWmStorageLocationByVoLocationId" parameterType="Long" resultMap="WmStorageLocationVoResult">
select l.* ,w.warehouse_name from wm_storage_location l
join wm_warehouse w on w.warehouse_id = l.warehouse_id
where location_id = #{locationId} and l.IS_DELETE = 0
select l.*, w.warehouse_name
from wm_storage_location l
join wm_warehouse w on w.warehouse_id = l.warehouse_id
where location_id = #{locationId}
and l.IS_DELETE = 0
</select>
<select id="selectWmStorageLocationByLocationCode" parameterType="String" resultMap="WmStorageLocationResult">
<include refid="selectWmStorageLocationVo"/>
where location_code = #{locationCode} limit 1 and IS_DELETE = 0
where location_code = #{locationCode}
and IS_DELETE = 0 limit 1
</select>
<select id="checkLocationCodeUnique" parameterType="WmStorageLocation" resultMap="WmStorageLocationResult">
<include refid="selectWmStorageLocationVo"/>
where location_code = #{locationCode} and IS_DELETE = 0 and warehouse_id = #{warehouseId} limit 1
where location_code = #{locationCode}
and IS_DELETE = 0
and warehouse_id = #{warehouseId} limit 1
</select>
<select id="checkLocationNameUnique" parameterType="WmStorageLocation" resultMap="WmStorageLocationResult">
<include refid="selectWmStorageLocationVo"/>
where location_name = #{locationName} and IS_DELETE = 0 and warehouse_id = #{warehouseId} limit 1
where location_name = #{locationName}
and IS_DELETE = 0
and warehouse_id = #{warehouseId} limit 1
</select>
<insert id="insertWmStorageLocation" parameterType="WmStorageLocation" useGeneratedKeys="true" keyProperty="locationId">
<insert id="insertWmStorageLocation" parameterType="WmStorageLocation" useGeneratedKeys="true"
keyProperty="locationId">
insert into wm_storage_location
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="locationCode != null and locationCode != ''">location_code,</if>
<if test="locationName != null and locationName != ''">location_name,</if>
<if test="warehouseId != null">warehouse_id,</if>
<if test="area != null">area,</if>
<if test="areaFlag != null">area_flag,</if>
<if test="frozenFlag != null">frozen_flag,</if>
<if test="remark != null">remark,</if>
<if test="attr1 != null">attr1,</if>
<if test="attr2 != null">attr2,</if>
<if test="attr3 != null">attr3,</if>
<if test="attr4 != null">attr4,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<if test="locationCode != null and locationCode != ''">
location_code,
</if>
<if test="locationName != null and locationName != ''">
location_name,
</if>
<if test="warehouseId != null">
warehouse_id,
</if>
<if test="area != null">
area,
</if>
<if test="areaFlag != null">
area_flag,
</if>
<if test="frozenFlag != null">
frozen_flag,
</if>
<if test="remark != null">
remark,
</if>
<if test="attr1 != null">
attr1,
</if>
<if test="attr2 != null">
attr2,
</if>
<if test="attr3 != null">
attr3,
</if>
<if test="attr4 != null">
attr4,
</if>
<if test="createBy != null">
create_by,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateBy != null">
update_by,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="locationCode != null and locationCode != ''">#{locationCode},</if>
<if test="locationName != null and locationName != ''">#{locationName},</if>
<if test="warehouseId != null">#{warehouseId},</if>
<if test="area != null">#{area},</if>
<if test="areaFlag != null">#{areaFlag},</if>
<if test="frozenFlag != null">#{frozenFlag},</if>
<if test="remark != null">#{remark},</if>
<if test="attr1 != null">#{attr1},</if>
<if test="attr2 != null">#{attr2},</if>
<if test="attr3 != null">#{attr3},</if>
<if test="attr4 != null">#{attr4},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
<if test="locationCode != null and locationCode != ''">
#{locationCode},
</if>
<if test="locationName != null and locationName != ''">
#{locationName},
</if>
<if test="warehouseId != null">
#{warehouseId},
</if>
<if test="area != null">
#{area},
</if>
<if test="areaFlag != null">
#{areaFlag},
</if>
<if test="frozenFlag != null">
#{frozenFlag},
</if>
<if test="remark != null">
#{remark},
</if>
<if test="attr1 != null">
#{attr1},
</if>
<if test="attr2 != null">
#{attr2},
</if>
<if test="attr3 != null">
#{attr3},
</if>
<if test="attr4 != null">
#{attr4},
</if>
<if test="createBy != null">
#{createBy},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateBy != null">
#{updateBy},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
</trim>
</insert>
<update id="updateWmStorageLocation" parameterType="WmStorageLocation">
update wm_storage_location
<trim prefix="SET" suffixOverrides=",">
<if test="locationCode != null and locationCode != ''">location_code = #{locationCode},</if>
<if test="locationName != null and locationName != ''">location_name = #{locationName},</if>
<if test="warehouseId != null">warehouse_id = #{warehouseId},</if>
<if test="area != null">area = #{area},</if>
<if test="areaFlag != null">area_flag = #{areaFlag},</if>
<if test="frozenFlag != null">frozen_flag = #{frozenFlag},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="attr1 != null">attr1 = #{attr1},</if>
<if test="attr2 != null">attr2 = #{attr2},</if>
<if test="attr3 != null">attr3 = #{attr3},</if>
<if test="attr4 != null">attr4 = #{attr4},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="locationCode != null and locationCode != ''">
location_code = #{locationCode},
</if>
<if test="locationName != null and locationName != ''">
location_name = #{locationName},
</if>
<if test="warehouseId != null">
warehouse_id = #{warehouseId},
</if>
<if test="area != null">
area = #{area},
</if>
<if test="areaFlag != null">
area_flag = #{areaFlag},
</if>
<if test="frozenFlag != null">
frozen_flag = #{frozenFlag},
</if>
<if test="remark != null">
remark = #{remark},
</if>
<if test="attr1 != null">
attr1 = #{attr1},
</if>
<if test="attr2 != null">
attr2 = #{attr2},
</if>
<if test="attr3 != null">
attr3 = #{attr3},
</if>
<if test="attr4 != null">
attr4 = #{attr4},
</if>
<if test="createBy != null">
create_by = #{createBy},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
<if test="updateBy != null">
update_by = #{updateBy},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
</trim>
where location_id = #{locationId}
</update>
<update id="deleteWmStorageLocationByLocationId" parameterType="Long">
update wm_storage_location set IS_DELETE = 1 where location_id = #{locationId}
update wm_storage_location
set IS_DELETE = 1
where location_id = #{locationId}
</update>
<update id="deleteWmStorageLocationByLocationIds" parameterType="String">
update wm_storage_location set IS_DELETE = 1 where location_id in
update wm_storage_location
set IS_DELETE = 1 where location_id in
<foreach item="locationId" collection="array" open="(" separator="," close=")">
#{locationId}
</foreach>
</update>
<update id="deleteByWarehouseId" parameterType="Long">
update wm_storage_location set IS_DELETE = 1 where warehouse_id = #{warehouseId}
update wm_storage_location
set IS_DELETE = 1
where warehouse_id = #{warehouseId}
</update>
</mapper>

View File

@ -33,6 +33,7 @@
<result property="isDelete" column="IS_DELETE"/>
<result property="planCode" column="PLAN_CODE"/>
<result property="planTypeId" column="PLAN_TYPE_ID"/>
<result property="planTypeCode" column="PLAN_TYPE_CODE"/>
</resultMap>
<resultMap id="WmsInPlanWmsInPlanDetailsResult" type="WmsInPlan" extends="WmsInPlanResult">
@ -54,7 +55,25 @@
<result property="createTime" column="sub_CREATE_TIME"/>
<result property="updateBy" column="sub_UPDATE_BY"/>
<result property="updateTime" column="sub_UPDATE_TIME"/>
<result property="isActivy" column="sub_IS_ACTIVY"/>
<result property="isActive" column="sub_IS_ACTIVE"/>
<result property="isDelete" column="sub_IS_DELETE"/>
</resultMap>
<resultMap type="WmsInPlanDetails" id="BizWmsInPlanDetailsResult">
<result property="detailsId" column="sub_DETAILS_ID"/>
<result property="planId" column="sub_PLAN_ID"/>
<result property="materialId" column="sub_MATERIAL_ID"/>
<result property="batch" column="sub_BATCH"/>
<result property="cellId" column="sub_CELL_ID"/>
<result property="quantity" column="sub_QUANTITY"/>
<result property="quantityIn" column="sub_QUANTITY_IN"/>
<result property="planInStatus" column="sub_PLAN_IN_STATUS"/>
<result property="remark" column="sub_REMARK"/>
<result property="createBy" column="sub_CREATE_BY"/>
<result property="createTime" column="sub_CREATE_TIME"/>
<result property="updateBy" column="sub_UPDATE_BY"/>
<result property="updateTime" column="sub_UPDATE_TIME"/>
<result property="isActive" column="sub_IS_ACTIVE"/>
<result property="isDelete" column="sub_IS_DELETE"/>
</resultMap>
@ -86,7 +105,8 @@
IS_ACTIVE,
IS_DELETE,
PLAN_CODE,
PLAN_TYPE_ID
PLAN_TYPE_ID,
PLAN_TYPE_CODE
from WMS_IN_PLAN
</sql>
@ -122,11 +142,12 @@
<if test="isDelete != null and isDelete != ''">and IS_DELETE = #{isDelete}</if>
<if test="planCode != null and planCode != ''">and PLAN_CODE = #{planCode}</if>
<if test="planTypeId != null and planTypeId != ''">and PLAN_TYPE_ID = #{planTypeId}</if>
<if test="planTypeCode != null and planTypeCode != ''">and PLAN_TYPE_CODE = #{planTypeCode}</if>
</where>
order by CREATE_TIME desc
</select>
<select id="selectWmsInPlanByPlanId" parameterType="String" resultMap="WmsInPlanWmsInPlanDetailsResult">
<select id="selectWmsInPlanByPlanId" parameterType="LONG" resultMap="WmsInPlanWmsInPlanDetailsResult">
select a.PLAN_ID,
a.STATE,
a.SOURCE_TYPE,
@ -155,6 +176,7 @@
a.IS_DELETE,
a.PLAN_CODE,
a.PLAN_TYPE_ID,
a.PLAN_TYPE_CODE,
b.DETAILS_ID as sub_DETAILS_ID,
b.PLAN_ID as sub_PLAN_ID,
b.MATERIAL_ID as sub_MATERIAL_ID,
@ -204,6 +226,7 @@
a.IS_DELETE,
a.PLAN_CODE,
a.PLAN_TYPE_ID,
a.PLAN_TYPE_CODE,
b.DETAILS_ID as sub_DETAILS_ID,
b.PLAN_ID as sub_PLAN_ID,
b.MATERIAL_ID as sub_MATERIAL_ID,
@ -254,6 +277,7 @@
<if test="isDelete != null">IS_DELETE,</if>
<if test="planCode != null">PLAN_CODE,</if>
<if test="planTypeId != null">PLAN_TYPE_ID,</if>
<if test="planTypeCode != null">PLAN_TYPE_CODE,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="state != null">#{state},</if>
@ -283,6 +307,7 @@
<if test="isDelete != null">#{isDelete},</if>
<if test="planCode != null">#{planCode},</if>
<if test="planTypeId != null">#{planTypeId},</if>
<if test="planTypeCode != null">#{planTypeCode},</if>
</trim>
</insert>
@ -316,6 +341,7 @@
<if test="isDelete != null">IS_DELETE = #{isDelete},</if>
<if test="planCode != null">PLAN_CODE = #{planCode},</if>
<if test="planTypeId != null">PLAN_TYPE_ID = #{planTypeId},</if>
<if test="planTypeCode != null">PLAN_TYPE_CODE = #{planTypeCode},</if>
</trim>
where PLAN_ID = #{planId}
</update>
@ -361,4 +387,10 @@
FROM WMS_IN_PLAN
WHERE PLAN_CODE = #{value}
</select>
<select id="selectWmsInPlanDetailById" resultMap="BizWmsInPlanDetailsResult">
SELECT *
FROM WMS_IN_PLAN_DETAILS
WHERE DETAILS_ID = #{planDetailsId}
</select>
</mapper>

View File

@ -24,12 +24,14 @@
<result property="batch" column="BATCH"/>
<result property="materialId" column="MATERIAL_ID"/>
<result property="planTypeId" column="PLAN_TYPE_ID"/>
<result property="planTypeCode" column="PLAN_TYPE_CODE"/>
<result property="planInStatus" column="PLAN_IN_STATUS"/>
<result property="planInCode" column="PLAN_IN_CODE"/>
<result property="materialCode" column="MATERIAL_CODE"/>
<result property="materialUnit" column="MATERIAL_UNIT"/>
<result property="materialName" column="MATERIAL_NAME"/>
<result property="detailInId" column="DETAIL_IN_ID"/>
<result property="boxRfid" column="BOX_RFID"/>
</resultMap>
<sql id="selectWmsInTaskVo">
@ -50,10 +52,12 @@
a.BATCH,
a.MATERIAL_ID,
a.PLAN_TYPE_ID,
a.PLAN_TYPE_CODE,
a.PLAN_IN_STATUS,
a.PLAN_IN_CODE,
a.MATERIAL_CODE,
a.DETAIL_IN_ID,
a.BOX_RFID,
b.AREA_CODE as CELL_CODE,
b.AREA_NAME as CELL_NAME,
c.UNIT_NAME AS MATERIAL_UNIT,
@ -84,10 +88,14 @@
<if test="batch != null and batch != ''">and BATCH like concat('%', #{batch}, '%')</if>
<if test="materialId != null and materialId != ''">and MATERIAL_ID = #{materialId}</if>
<if test="planTypeId != null and planTypeId != ''">and PLAN_TYPE_ID = #{planTypeId}</if>
<if test="planTypeCode != null and planTypeCode != ''">and PLAN_TYPE_CODE = #{planTypeCode}</if>
<if test="planInStatus != null and planInStatus != ''">and PLAN_IN_STATUS = #{planInStatus}</if>
<if test="planInCode != null and planInCode != ''">and PLAN_IN_CODE = #{planInCode}</if>
<if test="materialCode != null and materialCode != ''">and MATERIAL_CODE like concat('%', #{materialCode}, '%')</if>
<if test="materialCode != null and materialCode != ''">and MATERIAL_CODE like concat('%', #{materialCode},
'%')
</if>
<if test="detailInId != null and detailInId != ''">and DETAIL_IN_ID = #{detailInId}</if>
<if test="boxRfid != null and boxRfid != ''">and BOX_RFID = #{boxRfid}</if>
</where>
order by a.CREATE_TIME desc
</select>
@ -116,10 +124,12 @@
<if test="batch != null">BATCH,</if>
<if test="materialId != null">MATERIAL_ID,</if>
<if test="planTypeId != null">PLAN_TYPE_ID,</if>
<if test="planTypeCode != null">PLAN_TYPE_CODE,</if>
<if test="planInStatus != null">PLAN_IN_STATUS,</if>
<if test="planInCode != null">PLAN_IN_CODE,</if>
<if test="materialCode != null">MATERIAL_CODE,</if>
<if test="detailInId != null">DETAIL_IN_ID,</if>
<if test="boxRfid != null">BOX_RFID,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="taskInCode != null">#{taskInCode},</if>
@ -138,10 +148,12 @@
<if test="batch != null">#{batch},</if>
<if test="materialId != null">#{materialId},</if>
<if test="planTypeId != null">#{planTypeId},</if>
<if test="planTypeCode != null">#{planTypeCode},</if>
<if test="planInStatus != null">#{planInStatus},</if>
<if test="planInCode != null">#{planInCode},</if>
<if test="materialCode != null">#{materialCode},</if>
<if test="detailInId != null">#{detailInId},</if>
<if test="boxRfid != null">#{boxRfid},</if>
</trim>
</insert>
@ -164,10 +176,12 @@
<if test="batch != null">BATCH = #{batch},</if>
<if test="materialId != null">MATERIAL_ID = #{materialId},</if>
<if test="planTypeId != null">PLAN_TYPE_ID = #{planTypeId},</if>
<if test="planTypeCode != null">PLAN_TYPE_CODE = #{planTypeCode},</if>
<if test="planInStatus != null">PLAN_IN_STATUS = #{planInStatus},</if>
<if test="planInCode != null">PLAN_IN_CODE = #{planInCode},</if>
<if test="materialCode != null">MATERIAL_CODE = #{materialCode},</if>
<if test="detailInId != null">DETAIL_IN_ID = #{detailInId},</if>
<if test="boxRfid != null">BOX_RFID = #{boxRfid},</if>
</trim>
where ID = #{id}
</update>

View File

@ -46,7 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectWmsZdTaskList" parameterType="WmsZdTask" resultMap="WmsZdTaskResult">
<include refid="selectWmsZdTaskVo"/>
<where>
<where>
<if test="code != null and code != ''"> and CODE like concat('%', #{code}, '%')</if>
<if test="name != null and name != ''"> and "name" like concat('%', #{name}, '%')</if>
<if test="mProductId != null and mProductId != ''"> and M_PRODUCT_ID = #{mProductId}</if>
@ -54,6 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="planOutId != null and planOutId != ''"> and PLAN_OUT_ID = #{planOutId}</if>
<if test="planOutType != null and planOutType != ''"> and PLAN_OUT_TYPE = #{planOutType}</if>
<if test="technologyBomId != null and technologyBomId != ''"> and technology_bom_id = #{technologyBomId}</if>
<if test="planSheet != null and planSheet != ''"> and plan_sheet = #{planSheet}</if>
<if test="qtyOk != null and qtyOk != ''"> and QTY_OK = #{qtyOk}</if>
<if test="remark != null and remark != ''"> and REMARK = #{remark}</if>
<if test="attr1 != null and attr1 != ''"> and ATTR1 = #{attr1}</if>