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
a0aa0811
Commit
a0aa0811
authored
Sep 21, 2026
by
DESKTOP-VKRD9QF\Administration
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
场景
parent
9f10bbc6
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
84 additions
and
15 deletions
+84
-15
MacroPlannerResultController.java
...java/com/aps/controller/MacroPlannerResultController.java
+4
-1
PlanPeriodController.java
src/main/java/com/aps/controller/PlanPeriodController.java
+54
-10
PlanPeriod.java
src/main/java/com/aps/entity/PlanPeriod.java
+7
-1
MacroSceneDataPermissionHandler.java
...s/macroplanner/scene/MacroSceneDataPermissionHandler.java
+2
-1
MacroSceneMode.java
src/main/java/com/aps/macroplanner/scene/MacroSceneMode.java
+1
-1
MacroSceneService.java
...in/java/com/aps/macroplanner/scene/MacroSceneService.java
+6
-1
MacroSceneDataPermissionHandlerTest.java
...croplanner/scene/MacroSceneDataPermissionHandlerTest.java
+10
-0
No files found.
src/main/java/com/aps/controller/MacroPlannerResultController.java
View file @
a0aa0811
...
@@ -64,6 +64,9 @@ import java.util.stream.Stream;
...
@@ -64,6 +64,9 @@ import java.util.stream.Stream;
@Slf4j
@Slf4j
public
class
MacroPlannerResultController
{
public
class
MacroPlannerResultController
{
@Autowired
private
com
.
aps
.
macroplanner
.
scene
.
MacroSceneMode
sceneMode
;
@Autowired
@Autowired
private
MpPispipResultPersistenceService
mpPispipResultPersistenceService
;
private
MpPispipResultPersistenceService
mpPispipResultPersistenceService
;
...
@@ -543,7 +546,7 @@ public class MacroPlannerResultController {
...
@@ -543,7 +546,7 @@ public class MacroPlannerResultController {
try
{
try
{
// 1. 数据转换: 数据库工艺物料类 → macroplanner 实体
// 1. 数据转换: 数据库工艺物料类 → macroplanner 实体
TestDataBuilder
data
=
macroPlannerDataConverter
.
convert
(
s
id
);
TestDataBuilder
data
=
macroPlannerDataConverter
.
convert
(
s
ceneMode
.
resolve
(
sid
)
);
result
.
put
(
"dataSummary"
,
buildDataSummary
(
data
));
result
.
put
(
"dataSummary"
,
buildDataSummary
(
data
));
// 2. 数据验证
// 2. 数据验证
...
...
src/main/java/com/aps/controller/PlanPeriodController.java
View file @
a0aa0811
package
com
.
aps
.
controller
;
package
com
.
aps
.
controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
com.aps.common.util.R
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.aps.entity.MacroSceneConfig
;
import
com.aps.entity.PlanPeriod
;
import
com.aps.macroplanner.scene.MacroSceneContext
;
import
com.aps.macroplanner.scene.MacroSceneService
;
import
com.aps.service.PlanPeriodService
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
io.swagger.v3.oas.annotations.Operation
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.web.bind.annotation.*
;
import
java.time.LocalDateTime
;
import
java.util.List
;
import
java.util.UUID
;
/**
* <p>
* 前端控制器
* </p>
*
* @author MyBatis-Plus
* @since 2026-09-20
*/
@RestController
@RestController
@RequestMapping
(
"/planPeriod"
)
@RequestMapping
(
"/planPeriod"
)
@RequiredArgsConstructor
public
class
PlanPeriodController
{
public
class
PlanPeriodController
{
private
final
PlanPeriodService
planPeriodService
;
private
final
MacroSceneService
macroSceneService
;
@PostMapping
(
"/create"
)
@Operation
(
summary
=
"新增场景计划周期"
)
public
R
<
PlanPeriod
>
create
(
@RequestParam
(
required
=
false
)
String
sceneId
,
@RequestBody
PlanPeriod
period
)
{
String
targetScene
=
resolveScene
(
sceneId
);
return
MacroSceneContext
.
execute
(
targetScene
,
()
->
{
period
.
setId
(
UUID
.
randomUUID
().
toString
());
period
.
setMpSceneId
(
targetScene
);
period
.
setIsdeleted
(
0L
);
period
.
setDeletiontime
(
null
);
period
.
setDeleteruserid
(
null
);
period
.
setCreationtime
(
LocalDateTime
.
now
());
if
(!
planPeriodService
.
save
(
period
))
{
return
R
.
failed
(
"新增计划周期失败"
);
}
return
R
.
ok
(
period
);
});
}
@GetMapping
(
"/list"
)
@Operation
(
summary
=
"查询场景计划周期"
)
public
R
<
List
<
PlanPeriod
>>
list
(
@RequestParam
(
required
=
false
)
String
sceneId
)
{
String
targetScene
=
resolveScene
(
sceneId
);
return
MacroSceneContext
.
execute
(
targetScene
,
()
->
R
.
ok
(
planPeriodService
.
list
(
new
LambdaQueryWrapper
<
PlanPeriod
>()
.
eq
(
PlanPeriod:
:
getIsdeleted
,
0
))));
}
private
String
resolveScene
(
String
sceneId
)
{
String
targetScene
=
sceneId
==
null
?
MacroSceneContext
.
getSceneId
()
:
sceneId
.
trim
();
if
(
targetScene
==
null
||
targetScene
.
isEmpty
())
return
null
;
MacroSceneConfig
scene
=
macroSceneService
.
getScene
(
targetScene
);
if
(
scene
==
null
||
!
targetScene
.
equals
(
scene
.
getSceneId
())
||
!
"READY"
.
equals
(
scene
.
getSceneStatus
()))
{
throw
new
IllegalArgumentException
(
"场景不存在或尚未就绪: "
+
targetScene
);
}
return
targetScene
;
}
}
}
src/main/java/com/aps/entity/PlanPeriod.java
View file @
a0aa0811
package
com
.
aps
.
entity
;
package
com
.
aps
.
entity
;
import
lombok.Data
;
import
lombok.Data
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.FieldFill
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
...
@@ -8,6 +12,7 @@ import lombok.Data;
...
@@ -8,6 +12,7 @@ import lombok.Data;
@Data
@Data
public
class
PlanPeriod
{
public
class
PlanPeriod
{
@TableId
(
type
=
IdType
.
INPUT
)
private
String
id
;
private
String
id
;
private
LocalDateTime
creationtime
;
private
LocalDateTime
creationtime
;
private
Long
creatoruserid
;
private
Long
creatoruserid
;
...
@@ -34,5 +39,6 @@ private Long isvisable;
...
@@ -34,5 +39,6 @@ private Long isvisable;
private
Long
top
;
private
Long
top
;
private
LocalDateTime
basetime
;
private
LocalDateTime
basetime
;
private
Short
enabled
;
private
Short
enabled
;
@TableField
(
value
=
"MP_SCENE_ID"
,
fill
=
FieldFill
.
INSERT
)
private
String
mpSceneId
;
private
String
mpSceneId
;
}
}
src/main/java/com/aps/macroplanner/scene/MacroSceneDataPermissionHandler.java
View file @
a0aa0811
...
@@ -31,7 +31,8 @@ public class MacroSceneDataPermissionHandler implements MultiDataPermissionHandl
...
@@ -31,7 +31,8 @@ public class MacroSceneDataPermissionHandler implements MultiDataPermissionHandl
"PLAN_RESOURCE"
,
"PLAN_RESOURCE"
,
"EQUIPINFO"
,
"EQUIPINFO"
,
"EQUIP_SHIFT_CAPACITY"
,
"EQUIP_SHIFT_CAPACITY"
,
"APS_TIME_CONFIG"
"APS_TIME_CONFIG"
,
"PLAN_PERIOD"
));
));
@Override
@Override
...
...
src/main/java/com/aps/macroplanner/scene/MacroSceneMode.java
View file @
a0aa0811
...
@@ -6,7 +6,7 @@ import org.springframework.stereotype.Component;
...
@@ -6,7 +6,7 @@ import org.springframework.stereotype.Component;
@Component
@Component
public
class
MacroSceneMode
{
public
class
MacroSceneMode
{
// Temporary test mode. Set to false and rebuild to restore scene management.
// Temporary test mode. Set to false and rebuild to restore scene management.
private
static
final
boolean
DEFAULT_ONLY
=
tru
e
;
private
static
final
boolean
DEFAULT_ONLY
=
fals
e
;
private
final
boolean
defaultOnly
;
private
final
boolean
defaultOnly
;
public
MacroSceneMode
()
{
public
MacroSceneMode
()
{
...
...
src/main/java/com/aps/macroplanner/scene/MacroSceneService.java
View file @
a0aa0811
...
@@ -71,6 +71,7 @@ public class MacroSceneService {
...
@@ -71,6 +71,7 @@ public class MacroSceneService {
private
final
EquipinfoMapper
equipinfoMapper
;
private
final
EquipinfoMapper
equipinfoMapper
;
private
final
EquipShiftCapacityMapper
equipShiftCapacityMapper
;
private
final
EquipShiftCapacityMapper
equipShiftCapacityMapper
;
private
final
ApsTimeConfigMapper
apsTimeConfigMapper
;
private
final
ApsTimeConfigMapper
apsTimeConfigMapper
;
private
final
PlanPeriodMapper
planPeriodMapper
;
public
List
<
MacroSceneConfig
>
listScenes
()
{
public
List
<
MacroSceneConfig
>
listScenes
()
{
if
(
sceneMode
.
isDefaultOnly
())
return
java
.
util
.
Collections
.
singletonList
(
sceneMode
.
defaultScene
());
if
(
sceneMode
.
isDefaultOnly
())
return
java
.
util
.
Collections
.
singletonList
(
sceneMode
.
defaultScene
());
...
@@ -183,6 +184,7 @@ public class MacroSceneService {
...
@@ -183,6 +184,7 @@ public class MacroSceneService {
sjzPfWhStockMapper
.
delete
(
null
);
sjzPfWhStockMapper
.
delete
(
null
);
materialInfoMapper
.
delete
(
null
);
materialInfoMapper
.
delete
(
null
);
apsTimeConfigMapper
.
delete
(
null
);
apsTimeConfigMapper
.
delete
(
null
);
planPeriodMapper
.
delete
(
null
);
});
});
}
}
...
@@ -214,6 +216,8 @@ public class MacroSceneService {
...
@@ -214,6 +216,8 @@ public class MacroSceneService {
copyStocksAndSupplies
(
sourceSceneId
,
targetSceneId
,
materialIds
,
routingIds
);
copyStocksAndSupplies
(
sourceSceneId
,
targetSceneId
,
materialIds
,
routingIds
);
copyEquipCapacity
(
sourceSceneId
,
targetSceneId
,
equipIds
,
resourceIds
);
copyEquipCapacity
(
sourceSceneId
,
targetSceneId
,
equipIds
,
resourceIds
);
copySimpleRows
(
sourceSceneId
,
targetSceneId
,
apsTimeConfigMapper
,
ApsTimeConfig
.
class
,
null
);
copySimpleRows
(
sourceSceneId
,
targetSceneId
,
apsTimeConfigMapper
,
ApsTimeConfig
.
class
,
null
);
copySimpleRows
(
sourceSceneId
,
targetSceneId
,
planPeriodMapper
,
PlanPeriod
.
class
,
row
->
row
.
setId
(
UUID
.
randomUUID
().
toString
()));
}
}
private
Map
<
Integer
,
Integer
>
copyEquipinfo
(
String
source
,
String
target
)
{
private
Map
<
Integer
,
Integer
>
copyEquipinfo
(
String
source
,
String
target
)
{
...
@@ -1027,7 +1031,8 @@ public class MacroSceneService {
...
@@ -1027,7 +1031,8 @@ public class MacroSceneService {
||
mapper
==
routingDetailEquipMapper
||
mapper
==
stockMapper
||
mapper
==
routingDetailEquipMapper
||
mapper
==
stockMapper
||
mapper
==
materialPurchaseMapper
||
mapper
==
erpPurchaseOrderMapper
||
mapper
==
materialPurchaseMapper
||
mapper
==
erpPurchaseOrderMapper
||
mapper
==
purchaseReceiptMapper
||
mapper
==
sjzPfWhStockMapper
||
mapper
==
purchaseReceiptMapper
||
mapper
==
sjzPfWhStockMapper
||
mapper
==
planResourceMapper
||
mapper
==
equipinfoMapper
)
{
||
mapper
==
planResourceMapper
||
mapper
==
equipinfoMapper
||
mapper
==
planPeriodMapper
)
{
return
"ISDELETED"
;
return
"ISDELETED"
;
}
}
if
(
mapper
==
routingDetailMapper
||
mapper
==
equipShiftCapacityMapper
)
{
if
(
mapper
==
routingDetailMapper
||
mapper
==
equipShiftCapacityMapper
)
{
...
...
src/test/java/com/aps/macroplanner/scene/MacroSceneDataPermissionHandlerTest.java
View file @
a0aa0811
...
@@ -45,4 +45,14 @@ class MacroSceneDataPermissionHandlerTest {
...
@@ -45,4 +45,14 @@ class MacroSceneDataPermissionHandlerTest {
assertNull
(
expression
);
assertNull
(
expression
);
}
}
@Test
void
planPeriodsAreScopedToBaselineOrSelectedScene
()
{
Table
table
=
new
Table
(
"PLAN_PERIOD"
);
assertEquals
(
"PLAN_PERIOD.MP_SCENE_ID IS NULL"
,
handler
.
getSqlSegment
(
table
,
null
,
"test.select"
).
toString
());
MacroSceneContext
.
setSceneId
(
"scene-001"
);
assertEquals
(
"PLAN_PERIOD.MP_SCENE_ID = 'scene-001'"
,
handler
.
getSqlSegment
(
table
,
null
,
"test.select"
).
toString
());
}
}
}
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