Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
adf034f2
提交
adf034f2
authored
12月 15, 2021
作者:
zhoushaopan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(列装模块,装备模块,入库模块): 装备库房3D,修改入库接口。修改列装编辑
装备库房3D,修改入库接口。修改列装编辑
上级
7475f0ff
显示空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
513 行增加
和
58 行删除
+513
-58
DeviceLibraryPositionController.java
...e/library/controller/DeviceLibraryPositionController.java
+62
-0
DeviceLibraryPositionDao.java
...v/device/library/repository/DeviceLibraryPositionDao.java
+25
-0
DeviceLibraryPositionService.java
.../device/library/service/DeviceLibraryPositionService.java
+20
-0
DeviceLibraryPosition.java
...v/device/library/subject/domin/DeviceLibraryPosition.java
+161
-0
DeviceLibraryPositionMessageVo.java
...ce/library/subject/vo/DeviceLibraryPositionMessageVo.java
+27
-0
RotationVo.java
...va/com/tykj/dev/device/library/subject/vo/RotationVo.java
+27
-0
PackingController.java
...tykj/dev/device/packing/controller/PackingController.java
+2
-2
StorageBillController.java
.../dev/device/storage/controller/StorageBillController.java
+189
-56
没有找到文件。
dev-library/src/main/java/com/tykj/dev/device/library/controller/DeviceLibraryPositionController.java
0 → 100644
浏览文件 @
adf034f2
package
com
.
tykj
.
dev
.
device
.
library
.
controller
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.tykj.dev.config.swagger.AutoDocument
;
import
com.tykj.dev.device.library.service.DeviceLibraryCacheService
;
import
com.tykj.dev.device.library.service.DeviceLibraryPositionService
;
import
com.tykj.dev.device.library.subject.domin.DeviceLibrary
;
import
com.tykj.dev.device.library.subject.domin.DeviceLibraryPosition
;
import
com.tykj.dev.device.library.subject.vo.DeviceLibraryPositionMessageVo
;
import
com.tykj.dev.device.library.subject.vo.RotationVo
;
import
com.tykj.dev.device.library.subject.vo.ScriptSaveVo
;
import
com.tykj.dev.misc.utils.JacksonUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* DATE:2021-8-11
* Author:zsp
*/
@RestController
@RequestMapping
(
value
=
"/deviceLibraryPosition"
)
@AutoDocument
@Api
(
tags
=
"装备3D模块"
,
description
=
"装备3D模块"
)
@Slf4j
public
class
DeviceLibraryPositionController
{
@Resource
private
DeviceLibraryPositionService
deviceLibraryPositionService
;
@GetMapping
(
"/findByStorageLocationId"
)
@ApiOperation
(
value
=
"根据库房位置查询装备"
)
public
ResponseEntity
<
List
<
DeviceLibraryPosition
>>
findByStorageLocationId
(
Integer
StorageLocationId
){
List
<
DeviceLibraryPosition
>
deviceLibraryPositions
=
new
ArrayList
<>();
for
(
DeviceLibraryPosition
deviceLibraryPosition
:
deviceLibraryPositionService
.
findByStorageLocationId
(
StorageLocationId
))
{
deviceLibraryPosition
.
setDeviceLibraryPositionMessageVo
(
JacksonUtil
.
readValue
(
deviceLibraryPosition
.
getDeviceLibraryPositionMessage
(),
new
TypeReference
<
DeviceLibraryPositionMessageVo
>()
{}));
deviceLibraryPosition
.
setRotationVo
(
JacksonUtil
.
readValue
(
deviceLibraryPosition
.
getRotation
(),
new
TypeReference
<
RotationVo
>()
{}));
deviceLibraryPositions
.
add
(
deviceLibraryPosition
);
}
return
ResponseEntity
.
ok
(
deviceLibraryPositions
);
}
@PostMapping
(
"/updateDeviceLibraryPosition"
)
@ApiOperation
(
value
=
"修改3D"
)
public
ResponseEntity
<
String
>
updateDeviceLibraryPosition
(
@RequestBody
DeviceLibraryPosition
deviceLibraryPosition
){
String
messageVo
=
deviceLibraryPosition
.
getDeviceLibraryPositionMessageVo
().
toJson
();
String
rotationVo
=
deviceLibraryPosition
.
getRotationVo
().
toJson
();
deviceLibraryPosition
.
setDeviceLibraryPositionMessage
(
messageVo
);
deviceLibraryPosition
.
setRotation
(
rotationVo
);
deviceLibraryPositionService
.
updateDeviceLibraryPosition
(
deviceLibraryPosition
);
return
ResponseEntity
.
ok
(
"修改成功"
);
}
}
dev-library/src/main/java/com/tykj/dev/device/library/repository/DeviceLibraryPositionDao.java
0 → 100644
浏览文件 @
adf034f2
package
com
.
tykj
.
dev
.
device
.
library
.
repository
;
import
com.tykj.dev.device.library.subject.domin.DeviceLibrary
;
import
com.tykj.dev.device.library.subject.domin.DeviceLibraryPosition
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.data.jpa.repository.Modifying
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.data.repository.query.Param
;
import
javax.transaction.Transactional
;
import
java.util.Date
;
import
java.util.List
;
/**
* @author zsp
*/
@SuppressWarnings
(
"SqlResolve"
)
public
interface
DeviceLibraryPositionDao
extends
JpaRepository
<
DeviceLibraryPosition
,
Integer
>,
JpaSpecificationExecutor
<
DeviceLibraryPosition
>
{
List
<
DeviceLibraryPosition
>
findAllByStorageLocationId
(
Integer
StorageLocationId
);
}
dev-library/src/main/java/com/tykj/dev/device/library/service/DeviceLibraryPositionService.java
0 → 100644
浏览文件 @
adf034f2
package
com
.
tykj
.
dev
.
device
.
library
.
service
;
import
com.tykj.dev.device.library.subject.domin.DeviceLibraryPosition
;
import
java.util.List
;
/**
* @author zsp
* @create 2021/12/13 16:23
*/
public
interface
DeviceLibraryPositionService
{
void
addDeviceLibraryPosition
(
DeviceLibraryPosition
deviceLibraryPosition
);
void
updateDeviceLibraryPosition
(
DeviceLibraryPosition
deviceLibraryPosition
);
void
batchDeviceLibraryPositions
(
List
<
DeviceLibraryPosition
>
deviceLibraryPositions
);
List
<
DeviceLibraryPosition
>
findByStorageLocationId
(
Integer
StorageLocationId
);
}
dev-library/src/main/java/com/tykj/dev/device/library/subject/domin/DeviceLibraryPosition.java
0 → 100644
浏览文件 @
adf034f2
package
com
.
tykj
.
dev
.
device
.
library
.
subject
.
domin
;
import
com.tykj.dev.device.library.subject.vo.*
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
org.hibernate.annotations.SQLDelete
;
import
org.hibernate.annotations.Where
;
import
org.springframework.data.annotation.CreatedBy
;
import
org.springframework.data.annotation.CreatedDate
;
import
org.springframework.data.annotation.LastModifiedBy
;
import
org.springframework.data.annotation.LastModifiedDate
;
import
org.springframework.data.jpa.domain.support.AuditingEntityListener
;
import
javax.persistence.*
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* @author zsp
*/
@Data
@Entity
@EntityListeners
(
AuditingEntityListener
.
class
)
@SQLDelete
(
sql
=
"update device_library_position set delete_tag = 1 where id = ?"
)
@Where
(
clause
=
"delete_tag = 0"
)
@ApiModel
(
"装备3D位置存储库"
)
public
class
DeviceLibraryPosition
implements
Serializable
{
/**
* 主键id
*/
@Id
@GeneratedValue
@ApiModelProperty
(
name
=
"主键id"
)
@Column
(
columnDefinition
=
"integer NOT NULL AUTO_INCREMENT"
)
private
Integer
id
;
/**
* 型号
*/
@ApiModelProperty
(
value
=
"型号"
)
private
String
model
;
/**
* 型号
*/
@ApiModelProperty
(
value
=
"装备的id"
)
private
Integer
deviceId
;
/**
* 密级
*/
@ApiModelProperty
(
value
=
"密级"
)
private
Integer
secretLevel
;
/**
* 装备名称
*/
@ApiModelProperty
(
value
=
"装备名称"
)
private
String
name
;
/**
* 装备序列号
*/
@ApiModelProperty
(
value
=
"装备序列号"
)
private
String
seqNumber
;
/**
* 生产序列号
*/
@ApiModelProperty
(
value
=
"生产序列号"
)
private
String
prodNumber
;
/**
* rfid表面号
*/
@ApiModelProperty
(
value
=
"rfid表面号"
)
private
String
rfidSurfaceId
;
/**
* rfid卡号
*/
@ApiModelProperty
(
value
=
"rfid卡号"
)
private
String
rfidCardId
;
/**
* 所在单位
*/
@ApiModelProperty
(
value
=
"所在单位"
)
private
String
locationUnit
;
/**
* 所属单位
*/
@ApiModelProperty
(
value
=
"所属单位"
)
private
String
ownUnit
;
/**
* 创建用户id
*/
@CreatedBy
@ApiModelProperty
(
value
=
"创建用户id"
)
private
Integer
createUserId
;
/**
* 创建时间
*/
@CreatedDate
@ApiModelProperty
(
value
=
"创建时间"
)
private
Date
createTime
;
/**
* 更新用户id
*/
@LastModifiedBy
@ApiModelProperty
(
value
=
"更新用户id"
)
private
Integer
updateUserId
;
/**
* 更新时间
*/
@LastModifiedDate
@ApiModelProperty
(
value
=
"更新时间"
)
private
Date
updateTime
;
/**
* 删除标记(0:未删除,1:已删除)
*/
@ApiModelProperty
(
value
=
"删除标记(0:未删除,1:已删除)"
)
private
Integer
deleteTag
=
0
;
@ApiModelProperty
(
value
=
"库房位置"
,
notes
=
"默认是库房"
)
private
String
storageLocation
;
@ApiModelProperty
(
value
=
"装备存放位置Id"
,
notes
=
"默认是库房"
)
private
Integer
storageLocationId
;
@ApiModelProperty
(
value
=
"DeviceLibraryPosition名称"
,
notes
=
""
)
private
String
deviceLibraryPositionName
;
@ApiModelProperty
(
value
=
"位置信息"
,
notes
=
"{x, y, z}"
)
@Column
(
name
=
"Device_Library_Position_Message"
,
columnDefinition
=
"TEXT"
)
private
String
deviceLibraryPositionMessage
;
@ApiModelProperty
(
value
=
"旋转信息"
,
notes
=
"{x, y, z}"
)
@Column
(
name
=
"Rotation"
,
columnDefinition
=
"TEXT"
)
private
String
rotation
;
@ApiModelProperty
(
value
=
"是否在机柜中 "
,
notes
=
"0 是 1 否"
)
private
Integer
ifCabinet
=
1
;
@ApiModelProperty
(
value
=
"在几号机柜里"
,
notes
=
"1"
)
private
Integer
cabinetPosition
;
@ApiModelProperty
(
value
=
"u位"
,
notes
=
"1"
)
private
Integer
uNum
;
@ApiModelProperty
(
"旋转信息vo"
)
@Transient
private
DeviceLibraryPositionMessageVo
deviceLibraryPositionMessageVo
;
@ApiModelProperty
(
"位置信息vo"
)
@Transient
private
RotationVo
rotationVo
;
}
dev-library/src/main/java/com/tykj/dev/device/library/subject/vo/DeviceLibraryPositionMessageVo.java
0 → 100644
浏览文件 @
adf034f2
package
com
.
tykj
.
dev
.
device
.
library
.
subject
.
vo
;
import
com.tykj.dev.misc.utils.JacksonUtil
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
org.springframework.stereotype.Repository
;
/**
* @author zsp
* @create 2021/12/13 16:46
*/
@Data
@ApiModel
(
"位置信息"
)
@Repository
public
class
DeviceLibraryPositionMessageVo
{
@ApiModelProperty
(
"位置信息"
)
private
String
x
;
private
String
y
;
private
String
z
;
public
String
toJson
(){
return
JacksonUtil
.
toJSon
(
this
);
}
}
dev-library/src/main/java/com/tykj/dev/device/library/subject/vo/RotationVo.java
0 → 100644
浏览文件 @
adf034f2
package
com
.
tykj
.
dev
.
device
.
library
.
subject
.
vo
;
import
com.tykj.dev.misc.utils.JacksonUtil
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
org.springframework.stereotype.Repository
;
/**
* @author zsp
*/
@Data
@ApiModel
(
"旋转信息"
)
@Repository
public
class
RotationVo
{
@ApiModelProperty
(
"位置信息"
)
private
String
x
;
private
String
y
;
private
String
z
;
public
String
toJson
(){
return
JacksonUtil
.
toJSon
(
this
);
}
}
dev-packing/src/main/java/com/tykj/dev/device/packing/controller/PackingController.java
浏览文件 @
adf034f2
...
...
@@ -1008,7 +1008,7 @@ public class PackingController {
packingLogService
.
add
(
packingLog
);
packingLibrary
.
setFileDb
(
FilesUtil
.
stringFileToList
(
packingLibraryUpdateVo
.
getFileList
()));
}
packingLibraryService
.
update
(
packingLibrary
);
PackingLibrary
library
=
packingLibraryService
.
update
(
packingLibrary
);
//发送阅知信息
List
<
Integer
>
userIds
=
userPublicService
.
findOtherUser
(
userUtils
.
getCurrentUserId
());
// originalMap.entrySet().forEach(
...
...
@@ -1022,7 +1022,7 @@ public class PackingController {
MessageBto
messageBto
=
new
MessageBto
(
0
,
1
,
"修改"
+
packingLibraryUpdateVo
.
getModel
()
+
"列装信息:原"
+
mapToString
(
originalMap
)
+
"-->现"
+
mapToString
(
nowMap
),
userIds
,
0
);
messageService
.
add
(
messageBto
);
}
return
ResponseEntity
.
ok
(
"编辑成功"
);
return
ResponseEntity
.
ok
(
library
);
}
...
...
dev-storage/src/main/java/com/tykj/dev/device/storage/controller/StorageBillController.java
浏览文件 @
adf034f2
...
...
@@ -10,12 +10,16 @@ import com.tykj.dev.device.file.entity.FileRet;
import
com.tykj.dev.device.file.service.FilesUtil
;
import
com.tykj.dev.device.library.repository.DeviceLibraryDao
;
import
com.tykj.dev.device.library.service.DeviceLibraryCacheService
;
import
com.tykj.dev.device.library.service.DeviceLibraryPositionService
;
import
com.tykj.dev.device.library.service.DeviceLibraryService
;
import
com.tykj.dev.device.library.service.DeviceLogService
;
import
com.tykj.dev.device.library.subject.Dto.DeviceLogDto
;
import
com.tykj.dev.device.library.subject.domin.DeviceLibrary
;
import
com.tykj.dev.device.library.subject.domin.DeviceLibraryPosition
;
import
com.tykj.dev.device.library.subject.vo.DeviceLibraryPositionMessageVo
;
import
com.tykj.dev.device.library.subject.vo.DeviceLibrarySaveVo
;
import
com.tykj.dev.device.library.subject.vo.FileVo
;
import
com.tykj.dev.device.library.subject.vo.RotationVo
;
import
com.tykj.dev.device.library.utils.DeviceNumberUtils
;
import
com.tykj.dev.device.packing.service.PackingLibraryService
;
import
com.tykj.dev.device.packing.subject.domin.PackingLibrary
;
...
...
@@ -44,6 +48,7 @@ import com.tykj.dev.rfid.service.impl.RfidServiceImpl;
import
com.tykj.dev.socket.MyWebSocket
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
...
...
@@ -51,9 +56,11 @@ import org.springframework.cache.annotation.CacheEvict;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.StopWatch
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
java.util.*
;
import
java.util.concurrent.Executor
;
import
java.util.function.Function
;
...
...
@@ -69,6 +76,7 @@ import static java.util.stream.Collectors.toMap;
@RequestMapping
(
value
=
"/storage"
)
@AutoDocument
@Api
(
tags
=
"装备入库模块"
,
description
=
"装备入库接口"
)
@Slf4j
public
class
StorageBillController
{
@Autowired
TaskService
taskService
;
...
...
@@ -126,6 +134,9 @@ public class StorageBillController {
@Autowired
private
DeviceLibraryCacheService
cacheLibraryService
;
@Resource
private
DeviceLibraryPositionService
positionService
;
@ApiOperation
(
value
=
"判断序列号是否存在申请任务中"
,
notes
=
"判断序列号是否存在申请任务中"
)
@PostMapping
(
value
=
"/existApplyTask"
)
public
ResponseEntity
existApplyTask
(
@RequestBody
List
<
String
>
seqs
){
...
...
@@ -252,7 +263,7 @@ public class StorageBillController {
PackingLibrary
packingLibraryEntity
=
new
PackingLibrary
();
BeanUtils
.
copyProperties
(
packingLibraryService
.
getOne
(
s
.
getPackingId
()),
packingLibraryEntity
);
packingLibraryEntity
.
setCorresponding
(
count
);
packingLibraryEntity
.
setIsSinglePart
(
1
);
//
packingLibraryEntity.setIsSinglePart(1);
if
(!
strings3
.
isEmpty
())
{
packingLibraryEntity
.
setProdNumber
(
strings3
.
get
(
0
));
strings3
.
remove
(
0
);
...
...
@@ -304,7 +315,7 @@ public class StorageBillController {
for
(
int
i
=
0
;
i
<
s2
.
getStorageCount
()
-
deviceNum
;
i
++)
{
packingLibraryEntity
=
packingLibraryService
.
getOne
(
s2
.
getPackingId
());
packingLibraryEntity
.
setCorresponding
(
0
);
packingLibraryEntity
.
setIsSinglePart
(
1
);
//
packingLibraryEntity.setIsSinglePart(1);
if
(!
strings2
.
isEmpty
())
{
if
(
deviceLibraryDao
.
getAllBySeqNumber
(
strings2
.
get
(
0
)).
size
()
>
0
)
{
...
...
@@ -336,7 +347,7 @@ public class StorageBillController {
List
<
String
>
strings4
=
sons3
.
get
(
k
);
List
<
String
>
strings5
=
sons4
.
get
(
k
);
if
(
s3
.
getStorageCount
()
>=
count
)
{
packingLibraryEntity
.
setIsSinglePart
(
0
);
//
packingLibraryEntity.setIsSinglePart(0);
packingLibraryEntity
.
setCorresponding
(
count
);
if
(!
strings4
.
isEmpty
())
{
...
...
@@ -361,7 +372,7 @@ public class StorageBillController {
for
(
int
i
=
0
;
i
<
s3
.
getStorageCount
()
-
deviceNum
;
i
++)
{
packingLibraryEntity
=
packingLibraryService
.
getOne
(
s3
.
getPackingId
());
packingLibraryEntity
.
setCorresponding
(
0
);
packingLibraryEntity
.
setIsSinglePart
(
1
);
//
packingLibraryEntity.setIsSinglePart(1);
if
(!
strings4
.
isEmpty
())
{
...
...
@@ -481,43 +492,33 @@ public class StorageBillController {
}
//存放所有save的装备
List
<
DeviceLibrary
>
saveDevices
=
new
ArrayList
<>();
for
(
DeviceLibrarySaveVo
d
:
storageBillSaveVo
.
getDeviceLibrarySaveVoList
())
{
if
(
d
.
getRfidCardId
()==
null
||
""
.
equals
(
d
.
getRfidCardId
())
||
deviceLibraryDao
.
getAllByRfidCardId
(
d
.
getRfidCardId
()).
size
()==
0
)
{
DeviceLibrary
saveEntity
=
new
DeviceLibrary
();
DeviceLibrary
deviceLibraryEntity
=
new
DeviceLibrary
();
PackingLibrary
packingLibraryEntity
=
packingLibraryService
.
getOne
(
d
.
getPackingId
());
BeanUtils
.
copyProperties
(
packingLibraryEntity
,
deviceLibraryEntity
);
deviceLibraryEntity
.
setId
(
null
);
deviceLibraryEntity
.
setLifeStatus
(
2
);
//设置为在库状态
BeanUtils
.
copyProperties
(
d
,
deviceLibraryEntity
);
deviceLibraryEntity
.
setStorageBillId
(
storageBillId
);
deviceLibraryEntity
.
setLocationUnit
(
userUtils
.
getCurrentUserUnitName
());
deviceLibraryEntity
.
setOwnUnit
(
userUtils
.
getCurrentUserUnitName
());
deviceLibraryEntity
.
setPartParentId
(
null
);
//如果不是单独的配件,设置父装备id为上一个装备的id 0-不是,1-是
if
(
d
.
getIsBinding
()
==
0
){
if
(
d
.
getIsSinglePart
()
==
0
)
{
//0 不是,1:是
if
(
deviceLibraryEntity
.
getIsPart
()
==
0
)
{
saveEntity
=
deviceLibraryService
.
addEntity
(
deviceLibraryEntity
);
}
if
(
deviceLibraryEntity
.
getIsPart
()
==
1
)
{
if
(
parentPackingId
!=
null
)
{
for
(
int
i
=
saveDevices
.
size
()-
1
;
i
>=
0
;
i
--){
if
(
packingLibraryEntity
.
getPartParentId
().
equals
(
saveDevices
.
get
(
i
).
getPackingId
())){
deviceLibraryEntity
.
setPartParentId
(
saveDevices
.
get
(
i
).
getId
());
break
;
}
}
}
saveEntity
=
deviceLibraryService
.
addEntity
(
deviceLibraryEntity
);
}
}
else
{
saveEntity
=
deviceLibraryService
.
addEntity
(
deviceLibraryEntity
);
}
}
String
currentUserUnitName
=
userUtils
.
getCurrentUserUnitName
();
StopWatch
stopWatch
=
new
StopWatch
();
stopWatch
.
start
();
//保存不需要绑定的装备集合
List
<
DeviceLibrary
>
batchEntitiesIsBinding1
=
new
ArrayList
<>();
//保存需要绑定总的集合
List
<
DeviceLibrary
>
batchEntitiesIsBinding0
=
new
ArrayList
<>();
//保存单独的配件的集合
List
<
DeviceLibrary
>
batchEntitiesSinglePart
=
new
ArrayList
<>();
//保存父子集合
List
<
DeviceLibrary
>
batchEntities
=
new
ArrayList
<>();
// for (DeviceLibrarySaveVo d : storageBillSaveVo.getDeviceLibrarySaveVoList()) {
// if (d.getRfidCardId()==null|| "".equals(d.getRfidCardId()) ||deviceLibraryDao.getAllByRfidCardId(d.getRfidCardId()).size()==0) {
// DeviceLibrary saveEntity = new DeviceLibrary();
// DeviceLibrary deviceLibraryEntity = new DeviceLibrary();
// PackingLibrary packingLibraryEntity = packingLibraryService.getOne(d.getPackingId());
// BeanUtils.copyProperties(packingLibraryEntity, deviceLibraryEntity);
// deviceLibraryEntity.setId(null);
// deviceLibraryEntity.setLifeStatus(2);//设置为在库状态
// BeanUtils.copyProperties(d, deviceLibraryEntity);
// deviceLibraryEntity.setStorageBillId(storageBillId);
// deviceLibraryEntity.setLocationUnit(currentUserUnitName);
// deviceLibraryEntity.setOwnUnit(currentUserUnitName);
// deviceLibraryEntity.setPartParentId(null);
//
// //如果不是单独的配件,设置父装备id为上一个装备的id 0-不是,1-是 0 装备 1 配件
// if (d.getIsBinding() == 0){
// if (d.getIsSinglePart() == 0) {
// //0 不是,1:是
// if (deviceLibraryEntity.getIsPart() == 0) {
...
...
@@ -528,26 +529,81 @@ public class StorageBillController {
// for (int i = saveDevices.size()-1;i>=0;i--){
// if (packingLibraryEntity.getPartParentId().equals(saveDevices.get(i).getPackingId())){
// deviceLibraryEntity.setPartParentId(saveDevices.get(i).getId());
// break;
// }
// }
// }
// saveEntity = deviceLibraryService.addEntity(deviceLibraryEntity);
// }
// }
// else {
// saveEntity = deviceLibraryService.addEntity(deviceLibraryEntity);
// }
// }
//如果是单独的配件,不用设置父装备id
//// if (d.getIsSinglePart() == 0) {
//// //0 不是,1:是
//// if (deviceLibraryEntity.getIsPart() == 0) {
//// saveEntity = deviceLibraryService.addEntity(deviceLibraryEntity);
//// }
//// if (deviceLibraryEntity.getIsPart() == 1) {
//// if (parentPackingId!=null) {
//// for (int i = saveDevices.size()-1;i>=0;i--){
//// if (packingLibraryEntity.getPartParentId().equals(saveDevices.get(i).getPackingId())){
//// deviceLibraryEntity.setPartParentId(saveDevices.get(i).getId());
//// }
//// }
//// }
//// saveEntity = deviceLibraryService.addEntity(deviceLibraryEntity);
//// }
//// }
// //如果是单独的配件,不用设置父装备id
// else {
// saveEntity = deviceLibraryService.addEntity(deviceLibraryEntity);
// }
// saveDevices.add(saveEntity);
//// parentId = saveEntity.getId();
// parentPackingId = packingLibraryEntity.getId();
// saveEntities.add(saveEntity);
// stringBuffer.append(saveEntity.getId());
// //存装备日志
// DeviceLogDto deviceLogDto = new DeviceLogDto(saveEntity.getId(), logMessage, fileVoList,null,taskEntity1.getId());
// deviceLogDtos.add(deviceLogDto);
// stringBuffer.append("x");
// //申请业务列装入库数量+1
// if (map.get(d.getPackingId())!=null){
// ApplyBillDetailVo applyBillDetailVo = map.get(d.getPackingId());
// applyBillDetailVo.setCompleteCount(applyBillDetailVo.getCompleteCount()+1);
// map.put(d.getPackingId(),applyBillDetailVo);
// }
// }
// else {
// throw new ApiException("系统中已存在rfid卡号为"+d.getRfidCardId()+"的装备!");
// }
// }
for
(
DeviceLibrarySaveVo
d
:
storageBillSaveVo
.
getDeviceLibrarySaveVoList
())
{
if
(
d
.
getRfidCardId
()==
null
||
""
.
equals
(
d
.
getRfidCardId
())
||
deviceLibraryDao
.
getAllByRfidCardId
(
d
.
getRfidCardId
()).
size
()==
0
)
{
DeviceLibrary
deviceLibraryEntity
=
new
DeviceLibrary
();
PackingLibrary
packingLibraryEntity
=
packingLibraryService
.
getOne
(
d
.
getPackingId
());
BeanUtils
.
copyProperties
(
packingLibraryEntity
,
deviceLibraryEntity
);
deviceLibraryEntity
.
setId
(
null
);
deviceLibraryEntity
.
setLifeStatus
(
2
);
//设置为在库状态
BeanUtils
.
copyProperties
(
d
,
deviceLibraryEntity
);
deviceLibraryEntity
.
setStorageBillId
(
storageBillId
);
deviceLibraryEntity
.
setLocationUnit
(
currentUserUnitName
);
deviceLibraryEntity
.
setOwnUnit
(
currentUserUnitName
);
deviceLibraryEntity
.
setPartParentId
(
null
);
//自己的逻辑
//1.将装备全部保存
//1.1不需要绑定
//1.2需要绑定保存以后,将附件的父id进行赋值
//如果不是单独的配件,设置父装备id为上一个装备的id 0-不是,1-是 0 装备 1 配件
if
(
d
.
getIsBinding
()
==
0
){
//存放父子集合
batchEntities
.
add
(
deviceLibraryEntity
);
}
else
{
saveEntity
=
deviceLibraryService
.
addEntity
(
deviceLibraryEntity
);
batchEntitiesIsBinding1
.
add
(
deviceLibraryEntity
);
}
saveDevices
.
add
(
saveEntity
);
// parentId = saveEntity.getId();
parentPackingId
=
packingLibraryEntity
.
getId
();
saveEntities
.
add
(
saveEntity
);
stringBuffer
.
append
(
saveEntity
.
getId
());
//存装备日志
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
saveEntity
.
getId
(),
logMessage
,
fileVoList
,
null
,
taskEntity1
.
getId
());
// DeviceLogDto deviceLogDto = new DeviceLogDto(saveEntity.getId(), logMessage, fileVoList,null,null);
deviceLogDtos
.
add
(
deviceLogDto
);
stringBuffer
.
append
(
"x"
);
//申请业务列装入库数量+1
if
(
map
.
get
(
d
.
getPackingId
())!=
null
){
ApplyBillDetailVo
applyBillDetailVo
=
map
.
get
(
d
.
getPackingId
());
...
...
@@ -559,6 +615,65 @@ public class StorageBillController {
throw
new
ApiException
(
"系统中已存在rfid卡号为"
+
d
.
getRfidCardId
()+
"的装备!"
);
}
}
// 批量保存
batchEntities
=
deviceLibraryService
.
batchDevices
(
batchEntities
);
//将父子集合的进行赋值 然后更新
//思路: 1.拿到所有的附件 2.拿到所有的装备 3.判断附件中的列装的id的父id是不是等于装备的列装id
List
<
DeviceLibrary
>
parts
=
batchEntities
.
stream
().
filter
(
deviceLibrary
->
deviceLibrary
.
getIsPart
()
==
1
)
.
collect
(
Collectors
.
toList
());
List
<
DeviceLibrary
>
saveParts
=
new
ArrayList
<>();
List
<
DeviceLibrary
>
devs
=
batchEntities
.
stream
().
filter
(
deviceLibrary
->
deviceLibrary
.
getIsPart
()
==
0
)
.
collect
(
Collectors
.
toList
());
if
(!
devs
.
isEmpty
()){
if
(!
parts
.
isEmpty
()){
if
(
devs
.
size
()>
parts
.
size
()){
devs
=
devs
.
subList
(
0
,
parts
.
size
());
}
if
(
devs
.
size
()<
parts
.
size
()){
//将长度设为一致
List
<
DeviceLibrary
>
deviceLibraries
=
parts
.
subList
(
0
,
devs
.
size
());
parts
.
removeAll
(
deviceLibraries
);
saveParts
.
addAll
(
parts
);
}
if
(
devs
.
size
()
==
parts
.
size
()){
for
(
int
i
=
0
;
i
<
devs
.
size
();
i
++)
{
for
(
int
j
=
0
;
j
<
parts
.
size
();
j
++)
{
if
(
devs
.
get
(
i
).
getPackingId
().
equals
(
packingLibraryService
.
getOne
(
parts
.
get
(
j
).
getPackingId
()).
getPartParentId
())){
parts
.
get
(
j
).
setPartParentId
(
devs
.
get
(
i
).
getId
());
saveParts
.
add
(
parts
.
get
(
j
));
i
++;
}
}
}
}
}
}
//批量更新
List
<
DeviceLibrary
>
updateParts
=
deviceLibraryService
.
batchDevices
(
saveParts
);
batchEntitiesIsBinding0
.
addAll
(
updateParts
);
batchEntitiesIsBinding0
.
addAll
(
devs
);
batchEntitiesIsBinding0
.
addAll
(
batchEntitiesSinglePart
);
if
(!
batchEntitiesIsBinding1
.
isEmpty
()){
saveDevices
.
addAll
(
batchEntitiesIsBinding1
);
saveEntities
.
addAll
(
batchEntitiesIsBinding1
);
}
else
{
saveDevices
.
addAll
(
batchEntitiesIsBinding0
);
saveEntities
.
addAll
(
batchEntitiesIsBinding0
);
}
if
(!
batchEntitiesIsBinding1
.
isEmpty
()){
batchEntitiesIsBinding1
.
forEach
(
deviceLibrary
->
{
stringBuffer
.
append
(
deviceLibrary
.
getId
());
//存装备日志
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
deviceLibrary
.
getId
(),
logMessage
,
fileVoList
,
null
,
taskEntity1
.
getId
());
deviceLogDtos
.
add
(
deviceLogDto
);
stringBuffer
.
append
(
"x"
);
});
}
stopWatch
.
stop
();
log
.
info
(
"存放所有save的装备时间:{}"
,
stopWatch
.
getTotalTimeMillis
()+
"ms"
);
//若要打印标签
if
(
storageBillSaveVo
.
getIsPrint
()==
1
){
List
<
PrintVo
>
printVos
=
new
ArrayList
<>();
...
...
@@ -569,7 +684,6 @@ public class StorageBillController {
}
rfidService
.
printString
(
printVos
);
}
//更新申请业务入库数量
if
(
deviceApplyBills
.
size
()>
0
){
deviceApplyBills
.
forEach
(
deviceApplyBill
->
{
...
...
@@ -618,7 +732,6 @@ public class StorageBillController {
deviceApplyBillService
.
update
(
deviceApplyBill
);
});
}
deviceLogService
.
addAllLog
(
deviceLogDtos
);
//4.更新入库单入库详情
storageBillEntity
.
setStorageDetail
(
stringBuffer
.
toString
());
...
...
@@ -670,7 +783,27 @@ public class StorageBillController {
}
}
}
log
.
info
(
"saveDevices:{}"
,
saveDevices
.
size
());
List
<
DeviceLibraryPosition
>
deviceLibraryPositions
=
new
ArrayList
<>();
//开始存储装备的3D
saveDevices
=
saveDevices
.
stream
().
filter
(
deviceLibrary
->
deviceLibrary
.
getIsPart
()
==
0
).
collect
(
Collectors
.
toList
());
saveDevices
.
forEach
(
deviceLibrary
->
{
DeviceLibraryPosition
deviceLibraryPosition
=
new
DeviceLibraryPosition
();
deviceLibraryPosition
.
setDeviceId
(
deviceLibrary
.
getId
());
BeanUtils
.
copyProperties
(
deviceLibrary
,
deviceLibraryPosition
);
RotationVo
rotationVo
=
new
RotationVo
();
String
s
=
rotationVo
.
toJson
();
deviceLibraryPosition
.
setRotation
(
s
);
DeviceLibraryPositionMessageVo
deviceLibraryPositionMessageVo
=
new
DeviceLibraryPositionMessageVo
();
String
s1
=
deviceLibraryPositionMessageVo
.
toJson
();
deviceLibraryPosition
.
setDeviceLibraryPositionMessage
(
s1
);
deviceLibraryPosition
.
setStorageLocation
(
storageBillSaveVo
.
getStorageLocation
());
deviceLibraryPosition
.
setStorageLocationId
(
storageBillSaveVo
.
getStorageLocationId
());
deviceLibraryPositions
.
add
(
deviceLibraryPosition
);
});
log
.
info
(
"存储3D完成"
);
//异步存储
executor
.
execute
(()->
positionService
.
batchDeviceLibraryPositions
(
deviceLibraryPositions
));
//完成更新试用修改为正式
if
(
storageBillSaveVo
.
getTryOutDevice
()
==
0
){
if
(
storageBillSaveVo
.
getDeviceIds
().
size
()>
0
){
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论