Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
HYH.APSJ
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
佟礼
HYH.APSJ
Commits
5c054afd
Commit
5c054afd
authored
Nov 28, 2025
by
DESKTOP-VKRD9QF\Administration
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整字段类型
parent
0ec0d884
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
110 additions
and
46 deletions
+110
-46
pom.xml
pom.xml
+2
-1
EquipCapacityDef.java
src/main/java/com/aps/entity/EquipCapacityDef.java
+1
-1
ProdEquipSpecialCal.java
src/main/java/com/aps/entity/ProdEquipSpecialCal.java
+2
-0
ProdEquipment.java
src/main/java/com/aps/entity/ProdEquipment.java
+9
-0
ProdOrderProcess.java
src/main/java/com/aps/entity/ProdOrderProcess.java
+1
-0
ProdProcessExec.java
src/main/java/com/aps/entity/ProdProcessExec.java
+6
-4
RoutingDetail.java
src/main/java/com/aps/entity/RoutingDetail.java
+4
-4
RoutingDetailEquip.java
src/main/java/com/aps/entity/RoutingDetailEquip.java
+9
-0
LanuchServiceImpl.java
src/main/java/com/aps/service/impl/LanuchServiceImpl.java
+30
-6
ProdEquipSpecialCalServiceImpl.java
.../com/aps/service/impl/ProdEquipSpecialCalServiceImpl.java
+46
-30
No files found.
pom.xml
View file @
5c054afd
...
@@ -62,10 +62,11 @@
...
@@ -62,10 +62,11 @@
<artifactId>
mysql-connector-java
</artifactId>
<artifactId>
mysql-connector-java
</artifactId>
<version>
8.0.33
</version>
<version>
8.0.33
</version>
</dependency>
</dependency>
<!-- 使用更新的版本 -->
<dependency>
<dependency>
<groupId>
com.oracle.database.jdbc
</groupId>
<groupId>
com.oracle.database.jdbc
</groupId>
<artifactId>
ojdbc8
</artifactId>
<artifactId>
ojdbc8
</artifactId>
<version>
2
1.5.0.0
</version>
<version>
2
3.3.0.23.09
</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.microsoft.sqlserver
</groupId>
<groupId>
com.microsoft.sqlserver
</groupId>
...
...
src/main/java/com/aps/entity/EquipCapacityDef.java
View file @
5c054afd
...
@@ -22,7 +22,7 @@ private String equipName;
...
@@ -22,7 +22,7 @@ private String equipName;
private
LocalDateTime
effectiveStartTime
;
private
LocalDateTime
effectiveStartTime
;
private
LocalDateTime
effectiveEndTime
;
private
LocalDateTime
effectiveEndTime
;
private
Long
referenceId
;
private
Long
referenceId
;
private
Short
referenceType
;
private
Integer
referenceType
;
private
BigDecimal
efficiencyCoeff
;
private
BigDecimal
efficiencyCoeff
;
private
Integer
minUtilization
;
private
Integer
minUtilization
;
private
Integer
maxUtilization
;
private
Integer
maxUtilization
;
...
...
src/main/java/com/aps/entity/ProdEquipSpecialCal.java
View file @
5c054afd
...
@@ -20,4 +20,6 @@ private Long referenceId;
...
@@ -20,4 +20,6 @@ private Long referenceId;
private
String
referenceName
;
private
String
referenceName
;
private
Long
creatorUserId
;
private
Long
creatorUserId
;
private
LocalDateTime
creationTime
;
private
LocalDateTime
creationTime
;
private
Integer
referenceType
;
//2 是节假日 1 是产能
private
String
id
;
}
}
\ No newline at end of file
src/main/java/com/aps/entity/ProdEquipment.java
View file @
5c054afd
...
@@ -16,4 +16,13 @@ public class ProdEquipment implements Serializable {
...
@@ -16,4 +16,13 @@ public class ProdEquipment implements Serializable {
private
Long
resourceId
;
private
Long
resourceId
;
private
String
execId
;
private
String
execId
;
private
Double
speed
;
private
Double
speed
;
private
String
id
;
/**
* 效率系数
*/
private
double
efficiencyValue
;
/**
* 准备时间
*/
private
int
setupTime
;
}
}
\ No newline at end of file
src/main/java/com/aps/entity/ProdOrderProcess.java
View file @
5c054afd
...
@@ -11,4 +11,5 @@ private String targetOrderId;
...
@@ -11,4 +11,5 @@ private String targetOrderId;
private
String
targetTaskSeq
;
private
String
targetTaskSeq
;
private
String
execId
;
private
String
execId
;
private
String
targetExecId
;
private
String
targetExecId
;
private
String
id
;
}
}
\ No newline at end of file
src/main/java/com/aps/entity/ProdProcessExec.java
View file @
5c054afd
...
@@ -46,29 +46,31 @@ public class ProdProcessExec {
...
@@ -46,29 +46,31 @@ public class ProdProcessExec {
* 注释: 换线时间
* 注释: 换线时间
*/
*/
private
BigDecimal
changeLineTime
;
private
int
changeLineTime
;
/**
/**
* 常数时间
* 常数时间
* 注释: 常数时间
* 注释: 常数时间
*/
*/
private
BigDecimal
constTime
;
private
int
constTime
;
/**
/**
* 前处理时间(秒)
* 前处理时间(秒)
* 注释: 前处理时间(秒)
* 注释: 前处理时间(秒)
*/
*/
private
Long
preprocessingTime
;
private
int
preprocessingTime
;
/**
/**
* 后处理时间(秒)
* 后处理时间(秒)
* 注释: 后处理时间(秒)
* 注释: 后处理时间(秒)
*/
*/
private
Long
postprocessingTime
;
private
int
postprocessingTime
;
//速度
//速度
private
Double
speed
;
private
Double
speed
;
private
String
id
;
}
}
\ No newline at end of file
src/main/java/com/aps/entity/RoutingDetail.java
View file @
5c054afd
...
@@ -61,7 +61,7 @@ private Long canStartEarly;
...
@@ -61,7 +61,7 @@ private Long canStartEarly;
private
Short
previousStartTimeBegin
;
private
Short
previousStartTimeBegin
;
private
String
code
;
private
String
code
;
private
String
tool
;
private
String
tool
;
private
BigDecimal
changeLineTime
;
private
int
changeLineTime
;
private
Long
preDetailId
;
private
Long
preDetailId
;
private
Long
connectType
;
private
Long
connectType
;
private
Long
connectProperty
;
private
Long
connectProperty
;
...
@@ -69,15 +69,15 @@ private String connectTypeName;
...
@@ -69,15 +69,15 @@ private String connectTypeName;
private
String
connectPropertyName
;
private
String
connectPropertyName
;
private
String
strSetupTime
;
private
String
strSetupTime
;
private
Long
isync
;
private
Long
isync
;
private
BigDecimal
constTime
;
private
int
constTime
;
private
String
usable
;
private
String
usable
;
private
BigDecimal
leadTime
;
private
BigDecimal
leadTime
;
private
BigDecimal
batchQty
;
private
BigDecimal
batchQty
;
private
BigDecimal
minProductionQty
;
private
BigDecimal
minProductionQty
;
private
BigDecimal
maxProductionQty
;
private
BigDecimal
maxProductionQty
;
private
BigDecimal
productionTakt
;
private
BigDecimal
productionTakt
;
private
Long
preprocessingTime
;
private
int
preprocessingTime
;
private
Long
postprocessingTime
;
private
int
postprocessingTime
;
private
BigDecimal
splitMinQty
;
private
BigDecimal
splitMinQty
;
private
BigDecimal
splitMaxQty
;
private
BigDecimal
splitMaxQty
;
private
Short
equipmentConnectivity
;
private
Short
equipmentConnectivity
;
...
...
src/main/java/com/aps/entity/RoutingDetailEquip.java
View file @
5c054afd
...
@@ -129,4 +129,13 @@ public class RoutingDetailEquip implements Serializable {
...
@@ -129,4 +129,13 @@ public class RoutingDetailEquip implements Serializable {
private
BigDecimal
oneBatchQuantity
;
private
BigDecimal
oneBatchQuantity
;
private
String
strId
;
private
String
strId
;
/**
* 效率系数
*/
private
double
efficiencyValue
;
/**
* 准备时间
*/
private
int
setupTime
;
}
}
\ No newline at end of file
src/main/java/com/aps/service/impl/LanuchServiceImpl.java
View file @
5c054afd
package
com
.
aps
.
service
.
impl
;
package
com
.
aps
.
service
.
impl
;
import
com.aps.common.util.R
;
import
com.aps.common.util.R
;
import
com.aps.common.util.SnowFlackIdWorker
;
import
com.aps.entity.*
;
import
com.aps.entity.*
;
import
com.aps.mapper.RoutingDetailMapper
;
import
com.aps.mapper.RoutingDetailMapper
;
import
com.aps.mapper.RoutingHeaderMapper
;
import
com.aps.mapper.RoutingHeaderMapper
;
...
@@ -374,7 +375,7 @@ public class LanuchServiceImpl implements LanuchService {
...
@@ -374,7 +375,7 @@ public class LanuchServiceImpl implements LanuchService {
equipSpecialCal
.
setEndDate
(
endTime
);
equipSpecialCal
.
setEndDate
(
endTime
);
equipSpecialCal
.
setShiftWorkSchedCode
(
shiftWorkSched
.
getShiftWorkSchedCode
());
equipSpecialCal
.
setShiftWorkSchedCode
(
shiftWorkSched
.
getShiftWorkSchedCode
());
equipSpecialCal
.
setPeriodDesc
(
shiftWorkSched
.
getShiftName
());
equipSpecialCal
.
setPeriodDesc
(
shiftWorkSched
.
getShiftName
());
equipSpecialCal
.
setId
(
String
.
valueOf
(
SnowFlackIdWorker
.
getId
()));
return
equipSpecialCal
;
return
equipSpecialCal
;
}
}
...
@@ -554,7 +555,7 @@ public class LanuchServiceImpl implements LanuchService {
...
@@ -554,7 +555,7 @@ public class LanuchServiceImpl implements LanuchService {
prodProcessExec
.
setConstTime
(
detail
.
getConstTime
());
prodProcessExec
.
setConstTime
(
detail
.
getConstTime
());
prodProcessExec
.
setPreprocessingTime
(
detail
.
getPreprocessingTime
());
prodProcessExec
.
setPreprocessingTime
(
detail
.
getPreprocessingTime
());
prodProcessExec
.
setPostprocessingTime
(
detail
.
getPostprocessingTime
());
prodProcessExec
.
setPostprocessingTime
(
detail
.
getPostprocessingTime
());
prodProcessExec
.
setId
(
String
.
valueOf
(
SnowFlackIdWorker
.
getId
()));
prodProcessExec
.
setSpeed
(
prodProcessExec
.
setSpeed
(
Optional
.
ofNullable
(
detail
.
getRuntime
())
Optional
.
ofNullable
(
detail
.
getRuntime
())
...
@@ -642,9 +643,24 @@ public class LanuchServiceImpl implements LanuchService {
...
@@ -642,9 +643,24 @@ public class LanuchServiceImpl implements LanuchService {
}
}
}
}
// 批量保存
// 批量保存
(增加严格校验)
if
(!
CollectionUtils
.
isEmpty
(
processRelations
))
{
if
(!
CollectionUtils
.
isEmpty
(
processRelations
))
{
prodOrderProcessService
.
saveBatch
(
processRelations
);
// 过滤掉null元素,并确保关键属性不为空
List
<
ProdOrderProcess
>
validRelations
=
processRelations
.
stream
()
.
filter
(
Objects:
:
nonNull
)
// 过滤null元素
.
filter
(
relation
->
{
// 根据实际业务规则检查必要属性
return
relation
.
getSceneId
()
!=
null
&&
relation
.
getOrderId
()
!=
null
;
})
.
collect
(
Collectors
.
toList
());
if
(!
CollectionUtils
.
isEmpty
(
validRelations
))
{
prodOrderProcessService
.
saveBatch
(
validRelations
,
500
);
}
else
{
log
.
warn
(
"所有工序关系数据无效或为空,跳过批量保存"
);
}
}
}
}
}
...
@@ -694,16 +710,23 @@ public class LanuchServiceImpl implements LanuchService {
...
@@ -694,16 +710,23 @@ public class LanuchServiceImpl implements LanuchService {
prodOrderProcess
.
setTaskSeq
(
connection
.
getSourceoperation
());
prodOrderProcess
.
setTaskSeq
(
connection
.
getSourceoperation
());
prodOrderProcess
.
setTargetOrderId
(
prodOrderMain
.
getOrderId
());
prodOrderProcess
.
setTargetOrderId
(
prodOrderMain
.
getOrderId
());
prodOrderProcess
.
setTargetTaskSeq
(
connection
.
getDestoperation
());
prodOrderProcess
.
setTargetTaskSeq
(
connection
.
getDestoperation
());
prodOrderProcess
.
setId
(
String
.
valueOf
(
SnowFlackIdWorker
.
getId
()));
String
execId
=
routingDetailIdToExecIdMap
.
get
(
connection
.
getSourceoperationid
());
String
execId
=
routingDetailIdToExecIdMap
.
get
(
connection
.
getSourceoperationid
());
String
targetExecId
=
routingDetailIdToExecIdMap
.
get
(
connection
.
getDestoperationid
());
String
targetExecId
=
routingDetailIdToExecIdMap
.
get
(
connection
.
getDestoperationid
());
if
(
execId
!=
null
)
{
if
(
execId
!=
null
)
{
prodOrderProcess
.
setExecId
(
execId
);
prodOrderProcess
.
setExecId
(
execId
);
}
else
{
prodOrderProcess
.
setExecId
(
"ttt"
);
}
}
if
(
targetExecId
!=
null
)
{
if
(
targetExecId
!=
null
)
{
prodOrderProcess
.
setTargetExecId
(
targetExecId
);
prodOrderProcess
.
setTargetExecId
(
targetExecId
);
}
else
{
prodOrderProcess
.
setTargetExecId
(
"ttt"
);
}
}
return
prodOrderProcess
;
return
prodOrderProcess
;
...
@@ -761,8 +784,9 @@ public class LanuchServiceImpl implements LanuchService {
...
@@ -761,8 +784,9 @@ public class LanuchServiceImpl implements LanuchService {
// prodEquipment.setEquipCode(routingDetailEquip.getName());
// prodEquipment.setEquipCode(routingDetailEquip.getName());
prodEquipment
.
setEquipName
(
routingDetailEquip
.
getName
());
prodEquipment
.
setEquipName
(
routingDetailEquip
.
getName
());
prodEquipment
.
setResourceId
(
routingDetailEquip
.
getType1
());
prodEquipment
.
setResourceId
(
routingDetailEquip
.
getType1
());
prodEquipment
.
setEfficiencyValue
(
routingDetailEquip
.
getEfficiencyValue
());
prodEquipment
.
setSetupTime
(
routingDetailEquip
.
getSetupTime
());
prodEquipment
.
setId
(
String
.
valueOf
(
SnowFlackIdWorker
.
getId
()));
prodEquipment
.
setSpeed
(
prodEquipment
.
setSpeed
(
Optional
.
ofNullable
(
routingDetailEquip
.
getDuration
())
Optional
.
ofNullable
(
routingDetailEquip
.
getDuration
())
...
...
src/main/java/com/aps/service/impl/ProdEquipSpecialCalServiceImpl.java
View file @
5c054afd
package
com
.
aps
.
service
.
impl
;
package
com
.
aps
.
service
.
impl
;
import
com.aps.common.util.SnowFlackIdWorker
;
import
com.aps.entity.ProdEquipSpecialCal
;
import
com.aps.entity.ProdEquipSpecialCal
;
import
com.aps.entity.EquipCapacityDef
;
import
com.aps.entity.EquipCapacityDef
;
import
com.aps.mapper.ProdEquipSpecialCalMapper
;
import
com.aps.mapper.ProdEquipSpecialCalMapper
;
...
@@ -10,10 +11,9 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -10,10 +11,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
/**
/**
* <p>
* <p>
* 设备特殊日历配置表:记录特定工位/设备在指定时间段的特殊日历规则(如节假日、维护期等) 服务实现类
* 设备特殊日历配置表:记录特定工位/设备在指定时间段的特殊日历规则(如节假日、维护期等) 服务实现类
...
@@ -33,47 +33,63 @@ public class ProdEquipSpecialCalServiceImpl extends ServiceImpl<ProdEquipSpecial
...
@@ -33,47 +33,63 @@ public class ProdEquipSpecialCalServiceImpl extends ServiceImpl<ProdEquipSpecial
*/
*/
@Override
@Override
public
void
copyFromEquipCapacityDef
(
String
sceneId
)
{
public
void
copyFromEquipCapacityDef
(
String
sceneId
)
{
// 查询EquipCapacityDef表中is_deleted为0的所有记录
// 直接通过条件查询,而不是全表查询后过滤
List
<
EquipCapacityDef
>
capacityDefs
=
equipCapacityDefService
.
list
();
List
<
EquipCapacityDef
>
activeCapacityDefs
=
equipCapacityDefService
.
lambdaQuery
()
.
eq
(
EquipCapacityDef:
:
getIsDeleted
,
0
)
// 过滤出is_deleted为0的记录
.
isNotNull
(
EquipCapacityDef:
:
getReferenceId
)
List
<
EquipCapacityDef
>
activeCapacityDefs
=
capacityDefs
.
stream
()
.
list
();
.
filter
(
e
->
e
.
getIsDeleted
()
!=
null
&&
e
.
getIsDeleted
()
==
0
&&
e
.
getReferenceId
()
!=
null
)
.
collect
(
Collectors
.
toList
());
// 转换对象并设置必要字段
// 转换对象并设置必要字段
List
<
ProdEquipSpecialCal
>
specialCals
=
activeCapacityDefs
.
stream
()
List
<
ProdEquipSpecialCal
>
specialCals
=
activeCapacityDefs
.
stream
()
.
map
(
capacityDef
->
convertToProdEquipSpecialCal
(
capacityDef
,
sceneId
))
.
map
(
capacityDef
->
convertToProdEquipSpecialCal
(
capacityDef
,
sceneId
))
.
filter
(
Objects:
:
nonNull
)
// 过滤掉转换失败的对象
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
// 批量保存到ProdEquipSpecialCal表
// 批量保存到ProdEquipSpecialCal表
if
(!
specialCals
.
isEmpty
())
{
if
(!
specialCals
.
isEmpty
())
{
this
.
saveBatch
(
specialCals
);
// 使用分批插入,避免单次插入过多数据
int
batchSize
=
100
;
for
(
int
i
=
0
;
i
<
specialCals
.
size
();
i
+=
batchSize
)
{
int
end
=
Math
.
min
(
i
+
batchSize
,
specialCals
.
size
());
this
.
saveBatch
(
specialCals
.
subList
(
i
,
end
),
batchSize
);
}
}
}
}
}
/**
/**
* 将EquipCapacityDef转换为ProdEquipSpecialCal
* 将EquipCapacityDef转换为ProdEquipSpecialCal
* @param capacityDef 源对象
* @param capacityDef 源对象
* @return 转换后的对象
* @return 转换后的对象
*/
*/
private
ProdEquipSpecialCal
convertToProdEquipSpecialCal
(
EquipCapacityDef
capacityDef
,
String
sceneId
)
{
private
ProdEquipSpecialCal
convertToProdEquipSpecialCal
(
EquipCapacityDef
capacityDef
,
String
sceneId
)
{
ProdEquipSpecialCal
specialCal
=
new
ProdEquipSpecialCal
();
try
{
ProdEquipSpecialCal
specialCal
=
new
ProdEquipSpecialCal
();
// 设置特定字段
specialCal
.
setEquipId
(
capacityDef
.
getEquipId
()
!=
null
?
(
int
)
capacityDef
.
getEquipId
()
:
null
);
// 设置必填字段,确保不会为空
specialCal
.
setEquipCode
(
capacityDef
.
getEquipCode
());
specialCal
.
setId
(
String
.
valueOf
(
SnowFlackIdWorker
.
getId
()));
specialCal
.
setStartDate
(
capacityDef
.
getEffectiveStartTime
());
specialCal
.
setSceneId
(
sceneId
);
// sceneId不能为空
specialCal
.
setEndDate
(
capacityDef
.
getEffectiveEndTime
());
specialCal
.
setEfficiencyCoeff
(
capacityDef
.
getEfficiencyCoeff
()
!=
null
?
// 可选字段的安全转换
capacityDef
.
getEfficiencyCoeff
().
longValue
()
:
null
);
specialCal
.
setEquipId
(
capacityDef
.
getEquipId
()
!=
null
?
capacityDef
.
getEquipId
().
intValue
()
:
null
);
specialCal
.
setReferenceId
(
capacityDef
.
getReferenceId
());
specialCal
.
setEquipCode
(
capacityDef
.
getEquipCode
());
specialCal
.
setReferenceName
(
capacityDef
.
getReferenceName
());
specialCal
.
setStartDate
(
capacityDef
.
getEffectiveStartTime
());
specialCal
.
setCreatorUserId
(
capacityDef
.
getCreatorUserId
());
specialCal
.
setEndDate
(
capacityDef
.
getEffectiveEndTime
());
specialCal
.
setCreationTime
(
LocalDateTime
.
now
());
specialCal
.
setSceneId
(
sceneId
);
// 处理数值类型转换的空值
return
specialCal
;
if
(
capacityDef
.
getEfficiencyCoeff
()
!=
null
)
{
specialCal
.
setEfficiencyCoeff
(
capacityDef
.
getEfficiencyCoeff
().
longValue
());
}
specialCal
.
setReferenceId
(
capacityDef
.
getReferenceId
());
specialCal
.
setReferenceName
(
capacityDef
.
getReferenceName
());
specialCal
.
setCreatorUserId
(
capacityDef
.
getCreatorUserId
());
specialCal
.
setCreationTime
(
LocalDateTime
.
now
());
specialCal
.
setReferenceType
(
capacityDef
.
getReferenceType
());
return
specialCal
;
}
catch
(
Exception
e
)
{
log
.
error
(
"转换EquipCapacityDef到ProdEquipSpecialCal失败"
,
e
);
return
null
;
}
}
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment