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
3d4f520d
Commit
3d4f520d
authored
Sep 24, 2026
by
DESKTOP-VKRD9QF\Administration
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: complete macro scene data copying
parent
18808dc2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
895 additions
and
211 deletions
+895
-211
MacroSceneController.java
src/main/java/com/aps/controller/MacroSceneController.java
+7
-0
Equipinfo.java
src/main/java/com/aps/entity/Equipinfo.java
+2
-0
MaterialInfo.java
src/main/java/com/aps/entity/MaterialInfo.java
+34
-0
RoutingDetail.java
src/main/java/com/aps/entity/RoutingDetail.java
+27
-0
RoutingDetailEquip.java
src/main/java/com/aps/entity/RoutingDetailEquip.java
+8
-0
RoutingHeader.java
src/main/java/com/aps/entity/RoutingHeader.java
+16
-0
Routingsupporting.java
src/main/java/com/aps/entity/Routingsupporting.java
+3
-0
Stock.java
src/main/java/com/aps/entity/Stock.java
+1
-0
MacroSceneDataPermissionHandler.java
...s/macroplanner/scene/MacroSceneDataPermissionHandler.java
+24
-1
MacroSceneService.java
...in/java/com/aps/macroplanner/scene/MacroSceneService.java
+402
-203
series_config_scene_unique.sql
src/main/resources/db/manual/series_config_scene_unique.sql
+21
-0
supply_scene_column.sql
src/main/resources/db/manual/supply_scene_column.sql
+27
-0
EquipinfoMapper.xml
src/main/resources/mapper/EquipinfoMapper.xml
+2
-1
KpiCategoryItemMapper.xml
src/main/resources/mapper/KpiCategoryItemMapper.xml
+27
-0
MaterialInfoMapper.xml
src/main/resources/mapper/MaterialInfoMapper.xml
+16
-1
PlanPeriodMapper.xml
src/main/resources/mapper/PlanPeriodMapper.xml
+41
-0
RoutingDetailEquipMapper.xml
src/main/resources/mapper/RoutingDetailEquipMapper.xml
+7
-1
RoutingDetailMapper.xml
src/main/resources/mapper/RoutingDetailMapper.xml
+28
-1
RoutingHeaderMapper.xml
src/main/resources/mapper/RoutingHeaderMapper.xml
+9
-1
RoutingsupportingMapper.xml
src/main/resources/mapper/RoutingsupportingMapper.xml
+4
-1
StockMapper.xml
src/main/resources/mapper/StockMapper.xml
+2
-1
ImportProductRestTest.java
src/test/java/com/aps/demo/ImportProductRestTest.java
+81
-0
MacroSceneMultiModeTest.java
...a/com/aps/macroplanner/scene/MacroSceneMultiModeTest.java
+35
-0
PlanPeriodSceneTest.java
.../java/com/aps/macroplanner/scene/PlanPeriodSceneTest.java
+71
-0
No files found.
src/main/java/com/aps/controller/MacroSceneController.java
View file @
3d4f520d
...
...
@@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.PathVariable;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
...
...
@@ -47,6 +48,12 @@ public class MacroSceneController {
return
R
.
ok
(
macroSceneService
.
listScenes
());
}
@GetMapping
(
"/current"
)
@Operation
(
summary
=
"根据用户查询当前主计划场景"
)
public
R
<
MacroSceneConfig
>
current
(
@RequestParam
String
userId
)
{
return
R
.
ok
(
macroSceneService
.
getSceneByUserId
(
userId
));
}
@PostMapping
(
"/select"
)
@Operation
(
summary
=
"选择当前主计划场景"
)
public
R
<
Boolean
>
select
(
@RequestBody
java
.
util
.
Map
<
String
,
String
>
request
)
{
...
...
src/main/java/com/aps/entity/Equipinfo.java
View file @
3d4f520d
...
...
@@ -91,6 +91,8 @@ public class Equipinfo implements Serializable {
private
String
property
;
private
Integer
equipProperty
;
private
LocalDate
creationtime
;
private
Long
creatoruserid
;
...
...
src/main/java/com/aps/entity/MaterialInfo.java
View file @
3d4f520d
...
...
@@ -93,6 +93,14 @@ public class MaterialInfo implements Serializable {
private
Integer
purchaseDuration
;
private
Integer
shelfLifeDays
;
private
Integer
maturityPeriodDays
;
private
Short
isTransferable
;
private
Short
isExcluded
;
private
String
firstLot
;
private
BigDecimal
tailLot
;
...
...
@@ -215,6 +223,32 @@ public class MaterialInfo implements Serializable {
private
String
ser
;
private
String
fixedMaterialId
;
private
String
fixedMaterialName
;
private
String
fixedMaterialCode
;
private
Short
isByProduct
;
@TableField
(
"GROUPID"
)
private
String
groupId
;
@TableField
(
"GROUPNAME"
)
private
String
groupName
;
@TableField
(
"PARAMETERID"
)
private
String
parameterId
;
@TableField
(
"PARAMETERNAME"
)
private
String
parameterName
;
private
Long
seriesId
;
private
String
seriesName
;
private
Integer
supplyType
;
/**
* 是否共用?
*/
...
...
src/main/java/com/aps/entity/RoutingDetail.java
View file @
3d4f520d
...
...
@@ -23,17 +23,28 @@ public class RoutingDetail {
private
BigDecimal
deleterUserId
;
private
LocalDateTime
deletionTime
;
private
Long
routingHeaderId
;
private
Long
classId
;
private
String
name
;
private
String
code
;
private
String
description
;
private
String
taskContent
;
private
Long
taskSeq
;
private
BigDecimal
runtime
;
private
BigDecimal
setupTime
;
private
String
strSetupTime
;
private
Short
efficiencyValue
;
private
BigDecimal
singleOut
;
private
Short
isOutside
;
private
Short
status
;
private
Long
resourceId
;
private
Short
resourceType
;
private
String
resourceCode
;
private
String
remark
;
private
String
extend
;
private
Short
outsideTime
;
private
BigDecimal
transportTime
;
private
BigDecimal
checkTime
;
private
Short
checkFlag
;
private
Short
performanceHours
;
private
Short
schedulingWorkingHours
;
private
Short
realWorkingHours
;
...
...
@@ -44,6 +55,22 @@ public class RoutingDetail {
private
Long
canInterrupt
;
private
Short
previousStartTimeBegin
;
private
int
changeLineTime
;
private
Long
departmentId
;
private
Short
isImportant
;
private
Long
milestoneId
;
private
Long
phaseId
;
private
Short
isImportantResources
;
private
Short
isParticipateIntime
;
private
String
note
;
private
String
fileId
;
private
Long
measureUnit
;
private
String
measureUnitName
;
private
BigDecimal
afterProcessTime
;
private
Long
isGeneral
;
private
Long
canStartEarly
;
private
String
tool
;
private
String
usable
;
private
BigDecimal
leadTime
;
private
Long
preDetailId
;
private
Long
connectType
;
private
Integer
connectProperty
;
...
...
src/main/java/com/aps/entity/RoutingDetailEquip.java
View file @
3d4f520d
...
...
@@ -141,6 +141,14 @@ public class RoutingDetailEquip implements Serializable {
*/
private
int
setupTime
;
private
Short
equipmentBearingType
;
private
BigDecimal
equipmentBearingQty
;
private
Long
outputUnitId
;
private
String
outputUnitName
;
@TableField
(
value
=
"MP_SCENE_ID"
,
fill
=
FieldFill
.
INSERT
)
private
String
mpSceneId
;
}
src/main/java/com/aps/entity/RoutingHeader.java
View file @
3d4f520d
...
...
@@ -145,6 +145,22 @@ public class RoutingHeader implements Serializable {
private
BigDecimal
pcost
;
private
String
specialFixedMaterialId
;
private
String
specialFixedMaterialCode
;
private
String
specialFixedMaterialName
;
private
String
generalFixedMaterialId
;
private
String
generalFixedMaterialCode
;
private
String
generalFixedMaterialName
;
private
Long
pcostUnitId
;
private
String
pcostUnitName
;
private
Integer
invisable
;
@TableField
(
value
=
"MP_SCENE_ID"
,
fill
=
FieldFill
.
INSERT
)
...
...
src/main/java/com/aps/entity/Routingsupporting.java
View file @
3d4f520d
...
...
@@ -39,6 +39,9 @@ private Long mainMeasureUnit;
private
String
mainMeasureUnitName
;
private
Long
spentMeasureUnit
;
private
String
spentMeasureUnitName
;
private
Long
supplyId
;
private
String
supplyCode
;
private
String
supplyName
;
private
String
strId
;
private
String
drawNum
;
@TableField
(
value
=
"MP_SCENE_ID"
,
fill
=
FieldFill
.
INSERT
)
...
...
src/main/java/com/aps/entity/Stock.java
View file @
3d4f520d
...
...
@@ -30,6 +30,7 @@ private String storeCode;
private
String
storeName
;
private
double
total
;
private
Integer
measureUnit
;
private
String
measureUnitName
;
private
double
totalLock
;
private
BigDecimal
cost
;
private
LocalDateTime
productionDate
;
...
...
src/main/java/com/aps/macroplanner/scene/MacroSceneDataPermissionHandler.java
View file @
3d4f520d
...
...
@@ -32,7 +32,30 @@ public class MacroSceneDataPermissionHandler implements MultiDataPermissionHandl
"EQUIPINFO"
,
"EQUIP_SHIFT_CAPACITY"
,
"APS_TIME_CONFIG"
,
"PLAN_PERIOD"
"PLAN_PERIOD"
,
"CATEGORY"
,
"STORE_ROOM_LOCATION"
,
"ROUTING_SUPPORTING_REPLACE"
,
"MES_DAILY_WORK_SCHED"
,
"MES_HOLIDAY"
,
"SPECIAL_CALENDAR"
,
"CLASS_CAPACITY"
,
"EQUIP_MAINTAIN_TASK"
,
"TOOL_RESOURCE"
,
"PRODUCT_INFO"
,
"DISCRETE_PARAMETER_GROUP"
,
"EQUIP_CONNECT"
,
"MFG_RESOURCE_STOCK"
,
"SERIES_CONFIG"
,
"STRATEGY_RULE"
,
"UNIT_MANAGEMENT"
,
"APS_FORCAST"
,
"APS_ORDER"
,
"IN_PROCESS_ORDER"
,
"ZJH_SCHEDULE_PLAN_ORDER_RESULT"
,
"CUSTOMER"
,
"SALES_AREA"
,
"SUPPLY"
));
@Override
...
...
src/main/java/com/aps/macroplanner/scene/MacroSceneService.java
View file @
3d4f520d
This diff is collapsed.
Click to expand it.
src/main/resources/db/manual/series_config_scene_unique.sql
0 → 100644
View file @
3d4f520d
-- Run manually on databases where SERIES_CONFIG still has the old unique constraint.
-- DDL commits implicitly; back up and check conflicting rows before execution.
DECLARE
v_columns
VARCHAR2
(
4000
);
BEGIN
SELECT
LISTAGG
(
cc
.
COLUMN_NAME
,
','
)
WITHIN
GROUP
(
ORDER
BY
cc
.
POSITION
)
INTO
v_columns
FROM
USER_CONSTRAINTS
c
JOIN
USER_CONS_COLUMNS
cc
ON
cc
.
CONSTRAINT_NAME
=
c
.
CONSTRAINT_NAME
WHERE
c
.
TABLE_NAME
=
'SERIES_CONFIG'
AND
c
.
CONSTRAINT_NAME
=
'UK_SERIES_NAME'
;
IF
v_columns
IS
NULL
OR
v_columns
<>
'SERIES_NAME,ISDELETED,DELETIONTIME,MP_SCENE_ID'
THEN
IF
v_columns
IS
NOT
NULL
THEN
EXECUTE
IMMEDIATE
'ALTER TABLE SERIES_CONFIG DROP CONSTRAINT UK_SERIES_NAME'
;
END
IF
;
EXECUTE
IMMEDIATE
'ALTER TABLE SERIES_CONFIG ADD CONSTRAINT UK_SERIES_NAME '
||
'UNIQUE (SERIES_NAME, ISDELETED, DELETIONTIME, MP_SCENE_ID)'
;
END
IF
;
END
;
/
src/main/resources/db/manual/supply_scene_column.sql
0 → 100644
View file @
3d4f520d
-- Add scene isolation to SUPPLY before enabling SUPPLY scene copying.
DECLARE
v_count
NUMBER
;
BEGIN
SELECT
COUNT
(
*
)
INTO
v_count
FROM
USER_TAB_COLUMNS
WHERE
TABLE_NAME
=
'SUPPLY'
AND
COLUMN_NAME
=
'MP_SCENE_ID'
;
IF
v_count
=
0
THEN
EXECUTE
IMMEDIATE
'ALTER TABLE SUPPLY ADD (MP_SCENE_ID NVARCHAR2(64))'
;
END
IF
;
END
;
/
DECLARE
v_count
NUMBER
;
BEGIN
SELECT
COUNT
(
*
)
INTO
v_count
FROM
USER_INDEXES
WHERE
INDEX_NAME
=
'IDX_SUPPLY_MP_SCENE'
;
IF
v_count
=
0
THEN
EXECUTE
IMMEDIATE
'CREATE INDEX IDX_SUPPLY_MP_SCENE ON SUPPLY (MP_SCENE_ID)'
;
END
IF
;
END
;
/
src/main/resources/mapper/EquipinfoMapper.xml
View file @
3d4f520d
...
...
@@ -37,6 +37,7 @@
<result
column=
"equip_port"
property=
"equipPort"
/>
<result
column=
"status"
property=
"status"
/>
<result
column=
"property"
property=
"property"
/>
<result
column=
"equip_property"
property=
"equipProperty"
/>
<result
column=
"creationtime"
property=
"creationtime"
/>
<result
column=
"creatoruserid"
property=
"creatoruserid"
/>
<result
column=
"lastmodificationtime"
property=
"lastmodificationtime"
/>
...
...
@@ -67,7 +68,7 @@
<!-- 通用查询结果列 -->
<sql
id=
"Base_Column_List"
>
MP_SCENE_ID,
id, shop_id, equip_id, equip_type, equip_name, equip_status, location, shaft_qty, capability_value, securityclassid, equip_ip, equipment_sc, operator_id, equip_version, equip_system, equip_pic, locationx, isimportant, filepath, equip_status_updatetime, hot, capacity, standard, usedepartment, installplace, mainnumber, manufacturer, enabledate, equip_winpwd, equip_winname, equip_port, status, property, creationtime, creatoruserid, lastmodificationtime, lastmodifieruserid, isdeleted, deleteruserid, deletiontime, head, runningstatus, system_info, ismdc, work_pattern, work_pattern_name, measure_unit_name, currency_type_name, capacity_type_name, measure_unit, currency_type, capacity_type, fequipid, min_time, min_duration_time, max_duration_time, jp_expecation_time
id, shop_id, equip_id, equip_type, equip_name, equip_status, location, shaft_qty, capability_value, securityclassid, equip_ip, equipment_sc, operator_id, equip_version, equip_system, equip_pic, locationx, isimportant, filepath, equip_status_updatetime, hot, capacity, standard, usedepartment, installplace, mainnumber, manufacturer, enabledate, equip_winpwd, equip_winname, equip_port, status, property,
equip_property,
creationtime, creatoruserid, lastmodificationtime, lastmodifieruserid, isdeleted, deleteruserid, deletiontime, head, runningstatus, system_info, ismdc, work_pattern, work_pattern_name, measure_unit_name, currency_type_name, capacity_type_name, measure_unit, currency_type, capacity_type, fequipid, min_time, min_duration_time, max_duration_time, jp_expecation_time
</sql>
</mapper>
src/main/resources/mapper/KpiCategoryItemMapper.xml
0 → 100644
View file @
3d4f520d
<?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.aps.mapper.KpiCategoryItemMapper"
>
<!-- 通用查询映射结果 -->
<resultMap
id=
"BaseResultMap"
type=
"com.aps.entity.KpiCategoryItem"
>
<id
column=
"ID"
property=
"id"
/>
<result
column=
"CATEGORY_ID"
property=
"categoryId"
/>
<result
column=
"KPI_CODE"
property=
"kpiCode"
/>
<result
column=
"KPI_NAME"
property=
"kpiName"
/>
<result
column=
"WEIGHT"
property=
"weight"
/>
<result
column=
"SORT"
property=
"sort"
/>
<result
column=
"IS_DELETED"
property=
"isDeleted"
/>
<result
column=
"CREATION_TIME"
property=
"creationTime"
/>
<result
column=
"CREATOR_USER_ID"
property=
"creatorUserId"
/>
<result
column=
"LAST_MODIFICATION_TIME"
property=
"lastModificationTime"
/>
<result
column=
"LAST_MODIFIER_USER_ID"
property=
"lastModifierUserId"
/>
<result
column=
"DELETION_TIME"
property=
"deletionTime"
/>
<result
column=
"DELETER_USER_ID"
property=
"deleterUserId"
/>
</resultMap>
<!-- 通用查询结果列 -->
<sql
id=
"Base_Column_List"
>
ID, CATEGORY_ID, KPI_CODE, KPI_NAME, WEIGHT, SORT, IS_DELETED, CREATION_TIME, CREATOR_USER_ID, LAST_MODIFICATION_TIME, LAST_MODIFIER_USER_ID, DELETION_TIME, DELETER_USER_ID
</sql>
</mapper>
src/main/resources/mapper/MaterialInfoMapper.xml
View file @
3d4f520d
...
...
@@ -23,6 +23,10 @@
<result
column=
"material_type_name"
property=
"materialTypeName"
/>
<result
column=
"inspect_duration"
property=
"inspectDuration"
/>
<result
column=
"purchase_duration"
property=
"purchaseDuration"
/>
<result
column=
"shelf_life_days"
property=
"shelfLifeDays"
/>
<result
column=
"maturity_period_days"
property=
"maturityPeriodDays"
/>
<result
column=
"is_transferable"
property=
"isTransferable"
/>
<result
column=
"is_excluded"
property=
"isExcluded"
/>
<result
column=
"first_lot"
property=
"firstLot"
/>
<result
column=
"tail_lot"
property=
"tailLot"
/>
<result
column=
"standard_log"
property=
"standardLog"
/>
...
...
@@ -60,6 +64,17 @@
<result
column=
"supply_code"
property=
"supplyCode"
/>
<result
column=
"istrade"
property=
"istrade"
/>
<result
column=
"ser"
property=
"ser"
/>
<result
column=
"fixed_material_id"
property=
"fixedMaterialId"
/>
<result
column=
"fixed_material_name"
property=
"fixedMaterialName"
/>
<result
column=
"fixed_material_code"
property=
"fixedMaterialCode"
/>
<result
column=
"is_by_product"
property=
"isByProduct"
/>
<result
column=
"GROUPID"
property=
"groupId"
/>
<result
column=
"GROUPNAME"
property=
"groupName"
/>
<result
column=
"PARAMETERID"
property=
"parameterId"
/>
<result
column=
"PARAMETERNAME"
property=
"parameterName"
/>
<result
column=
"series_id"
property=
"seriesId"
/>
<result
column=
"series_name"
property=
"seriesName"
/>
<result
column=
"supply_type"
property=
"supplyType"
/>
<result
column=
"iscommon"
property=
"iscommon"
/>
<result
column=
"iscreatepoolrouting"
property=
"iscreatepoolrouting"
/>
<result
column=
"variety"
property=
"variety"
/>
...
...
@@ -107,7 +122,7 @@
<!-- 通用查询结果列 -->
<sql
id=
"Base_Column_List"
>
MP_SCENE_ID,
id, creationtime, creatoruserid, lastmodificationtime, lastmodifieruserid, isdeleted, deletiontime, deleteruserid, name, brand, specifications, batch, unit_price, min_num, tempcode, code, material_type_name, inspect_duration, purchase_duration,
first_lot, tail_lot, standard_log, safe_stock_day, safe_stock_quantity, category_name, category_code, category_id, material_property, root_category_id, code_rule_id, code_rule_type, drawing, material_type, measure_unit, measure_unit_name, version, product_type, status, latest, iscreatesupplyrouting, iscreatecheckrouting, description, quintiq_ortems, isync, issend, measure_unit2, measure_unit_name2, linkmaterialid, measure_unit3, measure_unit_name3, zjltofjl1, supply_id, supply_name, supply_code, istrade, ser
, iscommon, iscreatepoolrouting, variety, spec, category_id2, utility_material, special_product, bottle_type, bottle_type_str, max_inventory_day, max_inventory_quantity, min_inventory_day, min_inventory_quantity, minimum_supply, start_time, end_time, equip_id, bigpro, smallpro, isthree, is_minus, remark, match_bigpro_id, match_bigpro_code, match_smallpro_id, match_smallpro_code, full_name, is_include_store, is_average_four_week, stocksynctime, inventory_host_cost, beforeplanid, plannum, plancount, new_long_id, new_oldnumber, min_quantity, material_plan_type, min_production, max_production, invisable
id, creationtime, creatoruserid, lastmodificationtime, lastmodifieruserid, isdeleted, deletiontime, deleteruserid, name, brand, specifications, batch, unit_price, min_num, tempcode, code, material_type_name, inspect_duration, purchase_duration,
shelf_life_days, maturity_period_days, is_transferable, is_excluded, first_lot, tail_lot, standard_log, safe_stock_day, safe_stock_quantity, category_name, category_code, category_id, material_property, root_category_id, code_rule_id, code_rule_type, drawing, material_type, measure_unit, measure_unit_name, version, product_type, status, latest, iscreatesupplyrouting, iscreatecheckrouting, description, quintiq_ortems, isync, issend, measure_unit2, measure_unit_name2, linkmaterialid, measure_unit3, measure_unit_name3, zjltofjl1, supply_id, supply_name, supply_code, istrade, ser, fixed_material_id, fixed_material_name, fixed_material_code, is_by_product, GROUPID, GROUPNAME, PARAMETERID, PARAMETERNAME, series_id, series_name, supply_type
, iscommon, iscreatepoolrouting, variety, spec, category_id2, utility_material, special_product, bottle_type, bottle_type_str, max_inventory_day, max_inventory_quantity, min_inventory_day, min_inventory_quantity, minimum_supply, start_time, end_time, equip_id, bigpro, smallpro, isthree, is_minus, remark, match_bigpro_id, match_bigpro_code, match_smallpro_id, match_smallpro_code, full_name, is_include_store, is_average_four_week, stocksynctime, inventory_host_cost, beforeplanid, plannum, plancount, new_long_id, new_oldnumber, min_quantity, material_plan_type, min_production, max_production, invisable
</sql>
</mapper>
src/main/resources/mapper/PlanPeriodMapper.xml
0 → 100644
View file @
3d4f520d
<?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.aps.mapper.PlanPeriodMapper"
>
<!-- 通用查询映射结果 -->
<resultMap
id=
"BaseResultMap"
type=
"com.aps.entity.PlanPeriod"
>
<id
column=
"ID"
property=
"id"
/>
<result
column=
"CREATIONTIME"
property=
"creationtime"
/>
<result
column=
"CREATORUSERID"
property=
"creatoruserid"
/>
<result
column=
"LASTMODIFICATIONTIME"
property=
"lastmodificationtime"
/>
<result
column=
"LASTMODIFIERUSERID"
property=
"lastmodifieruserid"
/>
<result
column=
"ISDELETED"
property=
"isdeleted"
/>
<result
column=
"DELETIONTIME"
property=
"deletiontime"
/>
<result
column=
"DELETERUSERID"
property=
"deleteruserid"
/>
<result
column=
"EXP1"
property=
"exp1"
/>
<result
column=
"EXP2"
property=
"exp2"
/>
<result
column=
"EXP3"
property=
"exp3"
/>
<result
column=
"EXP4"
property=
"exp4"
/>
<result
column=
"EXP5"
property=
"exp5"
/>
<result
column=
"EXP6"
property=
"exp6"
/>
<result
column=
"NAME"
property=
"name"
/>
<result
column=
"TIMEUNITID"
property=
"timeunitid"
/>
<result
column=
"TIMEUNIT"
property=
"timeunit"
/>
<result
column=
"HISTORY"
property=
"history"
/>
<result
column=
"FUTURE"
property=
"future"
/>
<result
column=
"BEGIN"
property=
"begin"
/>
<result
column=
"END"
property=
"end"
/>
<result
column=
"ISPLAN"
property=
"isplan"
/>
<result
column=
"ISVISABLE"
property=
"isvisable"
/>
<result
column=
"TOP"
property=
"top"
/>
<result
column=
"BASETIME"
property=
"basetime"
/>
<result
column=
"ENABLED"
property=
"enabled"
/>
<result
column=
"MP_SCENE_ID"
property=
"mpSceneId"
/>
</resultMap>
<!-- 通用查询结果列 -->
<sql
id=
"Base_Column_List"
>
ID, CREATIONTIME, CREATORUSERID, LASTMODIFICATIONTIME, LASTMODIFIERUSERID, ISDELETED, DELETIONTIME, DELETERUSERID, EXP1, EXP2, EXP3, EXP4, EXP5, EXP6, NAME, TIMEUNITID, TIMEUNIT, HISTORY, FUTURE, BEGIN, END, ISPLAN, ISVISABLE, TOP, BASETIME, ENABLED, MP_SCENE_ID
</sql>
</mapper>
src/main/resources/mapper/RoutingDetailEquipMapper.xml
View file @
3d4f520d
...
...
@@ -28,13 +28,19 @@
<result
column=
"routing_header_id"
property=
"routingHeaderId"
/>
<result
column=
"one_batch_quantity"
property=
"oneBatchQuantity"
/>
<result
column=
"str_id"
property=
"strId"
/>
<result
column=
"efficiency_value"
property=
"efficiencyValue"
/>
<result
column=
"setup_time"
property=
"setupTime"
/>
<result
column=
"equipment_bearing_type"
property=
"equipmentBearingType"
/>
<result
column=
"equipment_bearing_qty"
property=
"equipmentBearingQty"
/>
<result
column=
"output_unit_id"
property=
"outputUnitId"
/>
<result
column=
"output_unit_name"
property=
"outputUnitName"
/>
<result
column=
"MP_SCENE_ID"
property=
"mpSceneId"
/>
</resultMap>
<!-- 通用查询结果列 -->
<sql
id=
"Base_Column_List"
>
MP_SCENE_ID,
id, creationtime, creatoruserid, lastmodificationtime, lastmodifieruserid, isdeleted, deletiontime, deleteruserid, type1, type_name, name, output_quantity, measure_unit, measure_unit_name, duration, exp1, exp2, exp3, exp4, routing_detail_id, equip_id, routing_header_id, one_batch_quantity, str_id
id, creationtime, creatoruserid, lastmodificationtime, lastmodifieruserid, isdeleted, deletiontime, deleteruserid, type1, type_name, name, output_quantity, measure_unit, measure_unit_name, duration, exp1, exp2, exp3, exp4, routing_detail_id, equip_id, routing_header_id, one_batch_quantity, str_id
, efficiency_value, setup_time, equipment_bearing_type, equipment_bearing_qty, output_unit_id, output_unit_name
</sql>
</mapper>
src/main/resources/mapper/RoutingDetailMapper.xml
View file @
3d4f520d
...
...
@@ -13,17 +13,28 @@
<result
column=
"DELETER_USER_ID"
property=
"deleterUserId"
/>
<result
column=
"DELETION_TIME"
property=
"deletionTime"
/>
<result
column=
"ROUTING_HEADER_ID"
property=
"routingHeaderId"
/>
<result
column=
"CLASS_ID"
property=
"classId"
/>
<result
column=
"NAME"
property=
"name"
/>
<result
column=
"CODE"
property=
"code"
/>
<result
column=
"DESCRIPTION"
property=
"description"
/>
<result
column=
"TASK_CONTENT"
property=
"taskContent"
/>
<result
column=
"TASK_SEQ"
property=
"taskSeq"
/>
<result
column=
"RUNTIME"
property=
"runtime"
/>
<result
column=
"SETUP_TIME"
property=
"setupTime"
/>
<result
column=
"STR_SETUP_TIME"
property=
"strSetupTime"
/>
<result
column=
"EFFICIENCY_VALUE"
property=
"efficiencyValue"
/>
<result
column=
"SINGLE_OUT"
property=
"singleOut"
/>
<result
column=
"IS_OUTSIDE"
property=
"isOutside"
/>
<result
column=
"STATUS"
property=
"status"
/>
<result
column=
"RESOURCE_ID"
property=
"resourceId"
/>
<result
column=
"RESOURCE_TYPE"
property=
"resourceType"
/>
<result
column=
"RESOURCE_CODE"
property=
"resourceCode"
/>
<result
column=
"REMARK"
property=
"remark"
/>
<result
column=
"EXTEND"
property=
"extend"
/>
<result
column=
"OUTSIDE_TIME"
property=
"outsideTime"
/>
<result
column=
"TRANSPORT_TIME"
property=
"transportTime"
/>
<result
column=
"CHECK_TIME"
property=
"checkTime"
/>
<result
column=
"CHECK_FLAG"
property=
"checkFlag"
/>
<result
column=
"PERFORMANCE_HOURS"
property=
"performanceHours"
/>
<result
column=
"SCHEDULING_WORKING_HOURS"
property=
"schedulingWorkingHours"
/>
<result
column=
"REAL_WORKING_HOURS"
property=
"realWorkingHours"
/>
...
...
@@ -34,6 +45,22 @@
<result
column=
"CAN_INTERRUPT"
property=
"canInterrupt"
/>
<result
column=
"PREVIOUS_START_TIME_BEGIN"
property=
"previousStartTimeBegin"
/>
<result
column=
"CHANGE_LINE_TIME"
property=
"changeLineTime"
/>
<result
column=
"DEPARTMENT_ID"
property=
"departmentId"
/>
<result
column=
"IS_IMPORTANT"
property=
"isImportant"
/>
<result
column=
"MILESTONE_ID"
property=
"milestoneId"
/>
<result
column=
"PHASE_ID"
property=
"phaseId"
/>
<result
column=
"IS_IMPORTANT_RESOURCES"
property=
"isImportantResources"
/>
<result
column=
"IS_PARTICIPATE_INTIME"
property=
"isParticipateIntime"
/>
<result
column=
"NOTE"
property=
"note"
/>
<result
column=
"FILE_ID"
property=
"fileId"
/>
<result
column=
"MEASURE_UNIT"
property=
"measureUnit"
/>
<result
column=
"MEASURE_UNIT_NAME"
property=
"measureUnitName"
/>
<result
column=
"AFTER_PROCESS_TIME"
property=
"afterProcessTime"
/>
<result
column=
"IS_GENERAL"
property=
"isGeneral"
/>
<result
column=
"CAN_START_EARLY"
property=
"canStartEarly"
/>
<result
column=
"TOOL"
property=
"tool"
/>
<result
column=
"USABLE"
property=
"usable"
/>
<result
column=
"LEAD_TIME"
property=
"leadTime"
/>
<result
column=
"PRE_DETAIL_ID"
property=
"preDetailId"
/>
<result
column=
"CONNECT_TYPE"
property=
"connectType"
/>
<result
column=
"CONNECT_PROPERTY"
property=
"connectProperty"
/>
...
...
@@ -61,7 +88,7 @@
<!-- 通用查询结果列 -->
<sql
id=
"Base_Column_List"
>
MP_SCENE_ID,
ID, CREATION_TIME, CREATOR_USER_ID, LAST_MODIFICATION_TIME, LAST_MODIFIER_USER_ID, IS_DELETED, DELETER_USER_ID, DELETION_TIME, ROUTING_HEADER_ID,
NAME, TASK_SEQ, RUNTIME, SETUP_TIME, EFFICIENCY_VALUE, SINGLE_OUT, IS_OUTSIDE, STATUS, REMARK, EXTEND, OUTSIDE_TIME, PERFORMANCE_HOURS, SCHEDULING_WORKING_HOURS, REAL_WORKING_HOURS, REAL_RUNTIME, PERFORMANCE_WORKING_HOURS, EQUIP_TYPE, EQUIP_TYPE_ID, CAN_INTERRUPT, PREVIOUS_START_TIME_BEGIN, CHANGE_LINE_TIME, PRE_DETAIL_ID, CONNECT_TYPE, CONNECT_PROPERTY, CONNECT_TYPE_NAME, CONNECT_PROPERTY_NAME, CONST_TIME,
INCREMENT_QTY, BATCH_QTY, MIN_PRODUCTION_QTY, MAX_PRODUCTION_QTY, PRODUCTION_TAKT, PREPROCESSING_TIME, POSTPROCESSING_TIME, SPLIT_MIN_QTY, SPLIT_MAX_QTY, EQUIPMENT_CONNECTIVITY, SINGLE_OUT_UNIT_ID, SINGLE_OUT_UNIT_NAME, CONNECT_UNIT_ID, CONNECT_UNIT_NAME
ID, CREATION_TIME, CREATOR_USER_ID, LAST_MODIFICATION_TIME, LAST_MODIFIER_USER_ID, IS_DELETED, DELETER_USER_ID, DELETION_TIME, ROUTING_HEADER_ID,
CLASS_ID, NAME, CODE, DESCRIPTION, TASK_CONTENT, TASK_SEQ, RUNTIME, SETUP_TIME, STR_SETUP_TIME, EFFICIENCY_VALUE, SINGLE_OUT, IS_OUTSIDE, STATUS, RESOURCE_ID, RESOURCE_TYPE, RESOURCE_CODE, REMARK, EXTEND, OUTSIDE_TIME, TRANSPORT_TIME, CHECK_TIME, CHECK_FLAG, PERFORMANCE_HOURS, SCHEDULING_WORKING_HOURS, REAL_WORKING_HOURS, REAL_RUNTIME, PERFORMANCE_WORKING_HOURS, EQUIP_TYPE, EQUIP_TYPE_ID, CAN_INTERRUPT, PREVIOUS_START_TIME_BEGIN, CHANGE_LINE_TIME, DEPARTMENT_ID, IS_IMPORTANT, MILESTONE_ID, PHASE_ID, IS_IMPORTANT_RESOURCES, IS_PARTICIPATE_INTIME, NOTE, FILE_ID, MEASURE_UNIT, MEASURE_UNIT_NAME, AFTER_PROCESS_TIME, IS_GENERAL, CAN_START_EARLY, TOOL, USABLE, LEAD_TIME, PRE_DETAIL_ID, CONNECT_TYPE, CONNECT_PROPERTY, CONNECT_TYPE_NAME, CONNECT_PROPERTY_NAME, CONST_TIME,
INCREMENT_QTY, BATCH_QTY, MIN_PRODUCTION_QTY, MAX_PRODUCTION_QTY, PRODUCTION_TAKT, PREPROCESSING_TIME, POSTPROCESSING_TIME, SPLIT_MIN_QTY, SPLIT_MAX_QTY, EQUIPMENT_CONNECTIVITY, SINGLE_OUT_UNIT_ID, SINGLE_OUT_UNIT_NAME, CONNECT_UNIT_ID, CONNECT_UNIT_NAME
</sql>
</mapper>
src/main/resources/mapper/RoutingHeaderMapper.xml
View file @
3d4f520d
...
...
@@ -63,6 +63,14 @@
<result
column=
"createoutbomtime"
property=
"createoutbomtime"
/>
<result
column=
"material_plan_type"
property=
"materialPlanType"
/>
<result
column=
"pcost"
property=
"pcost"
/>
<result
column=
"special_fixed_material_id"
property=
"specialFixedMaterialId"
/>
<result
column=
"special_fixed_material_code"
property=
"specialFixedMaterialCode"
/>
<result
column=
"special_fixed_material_name"
property=
"specialFixedMaterialName"
/>
<result
column=
"general_fixed_material_id"
property=
"generalFixedMaterialId"
/>
<result
column=
"general_fixed_material_code"
property=
"generalFixedMaterialCode"
/>
<result
column=
"general_fixed_material_name"
property=
"generalFixedMaterialName"
/>
<result
column=
"pcost_unit_id"
property=
"pcostUnitId"
/>
<result
column=
"pcost_unit_name"
property=
"pcostUnitName"
/>
<result
column=
"invisable"
property=
"invisable"
/>
<result
column=
"MP_SCENE_ID"
property=
"mpSceneId"
/>
</resultMap>
...
...
@@ -70,7 +78,7 @@
<!-- 通用查询结果列 -->
<sql
id=
"Base_Column_List"
>
MP_SCENE_ID,
id, creation_time, creator_user_id, last_modification_time, last_modifier_user_id, deleter_user_id, deletion_time, class_id, unicode, name, code, product_id, version, author, department_id, is_main, up_id, up_detail_id, routing_type, status, approval_status, remark, approval_status_remark, audit_user_id1, audit_user_id2, is_deleted, platesnum, is_effect, versionnotes, phase, versionid, is_send_ppm, file_id, product_name, department_name, drawing_no, product_bom_id, routing_changeorder_code, routing_changeheader_id, audit_user_id3, material_id, output_quantity, routing_type_name, lead_time, quintiq_ortems, iscreatecheckrouting, iscreateoutbom, issupportingstore, isync, routing_usetype, linkroutingid, effect_end, year, effect_begin, cost, erptag, createoutbomtime, material_plan_type, pcost, invisable
id, creation_time, creator_user_id, last_modification_time, last_modifier_user_id, deleter_user_id, deletion_time, class_id, unicode, name, code, product_id, version, author, department_id, is_main, up_id, up_detail_id, routing_type, status, approval_status, remark, approval_status_remark, audit_user_id1, audit_user_id2, is_deleted, platesnum, is_effect, versionnotes, phase, versionid, is_send_ppm, file_id, product_name, department_name, drawing_no, product_bom_id, routing_changeorder_code, routing_changeheader_id, audit_user_id3, material_id, output_quantity, routing_type_name, lead_time, quintiq_ortems, iscreatecheckrouting, iscreateoutbom, issupportingstore, isync, routing_usetype, linkroutingid, effect_end, year, effect_begin, cost, erptag, createoutbomtime, material_plan_type, pcost,
special_fixed_material_id, special_fixed_material_code, special_fixed_material_name, general_fixed_material_id, general_fixed_material_code, general_fixed_material_name, pcost_unit_id, pcost_unit_name,
invisable
</sql>
</mapper>
src/main/resources/mapper/RoutingsupportingMapper.xml
View file @
3d4f520d
...
...
@@ -30,6 +30,9 @@
<result
column=
"MAIN_MEASURE_UNIT_NAME"
property=
"mainMeasureUnitName"
/>
<result
column=
"SPENT_MEASURE_UNIT"
property=
"spentMeasureUnit"
/>
<result
column=
"SPENT_MEASURE_UNIT_NAME"
property=
"spentMeasureUnitName"
/>
<result
column=
"SUPPLY_ID"
property=
"supplyId"
/>
<result
column=
"SUPPLY_CODE"
property=
"supplyCode"
/>
<result
column=
"SUPPLY_NAME"
property=
"supplyName"
/>
<result
column=
"STR_ID"
property=
"strId"
/>
<result
column=
"DRAW_NUM"
property=
"drawNum"
/>
<result
column=
"MP_SCENE_ID"
property=
"mpSceneId"
/>
...
...
@@ -38,7 +41,7 @@
<!-- 通用查询结果列 -->
<sql
id=
"Base_Column_List"
>
MP_SCENE_ID,
ID, CREATIONTIME, CREATORUSERID, LASTMODIFICATIONTIME, LASTMODIFIERUSERID, ISDELETED, DELETIONTIME, DELETERUSERID, ROUTING_HEADER_ID, ROUTING_DETAIL_ID, MATERIAL_ID, MATERIAL_TYPE, MATERIAL_NUMBER, MATERIAL_NAME, MATERIAL_VERSION, REMARK, STORE_ID, STORE_NAME, MAIN_QTY, SPENT_QTY, STR_MAIN_QTY, STR_SPENT_QTY, MAIN_MEASURE_UNIT, MAIN_MEASURE_UNIT_NAME, SPENT_MEASURE_UNIT, SPENT_MEASURE_UNIT_NAME, STR_ID, DRAW_NUM
ID, CREATIONTIME, CREATORUSERID, LASTMODIFICATIONTIME, LASTMODIFIERUSERID, ISDELETED, DELETIONTIME, DELETERUSERID, ROUTING_HEADER_ID, ROUTING_DETAIL_ID, MATERIAL_ID, MATERIAL_TYPE, MATERIAL_NUMBER, MATERIAL_NAME, MATERIAL_VERSION, REMARK, STORE_ID, STORE_NAME, MAIN_QTY, SPENT_QTY, STR_MAIN_QTY, STR_SPENT_QTY, MAIN_MEASURE_UNIT, MAIN_MEASURE_UNIT_NAME, SPENT_MEASURE_UNIT, SPENT_MEASURE_UNIT_NAME, S
UPPLY_ID, SUPPLY_CODE, SUPPLY_NAME, S
TR_ID, DRAW_NUM
</sql>
</mapper>
src/main/resources/mapper/StockMapper.xml
View file @
3d4f520d
...
...
@@ -21,6 +21,7 @@
<result
column=
"STORE_NAME"
property=
"storeName"
/>
<result
column=
"TOTAL"
property=
"total"
/>
<result
column=
"MEASURE_UNIT"
property=
"measureUnit"
/>
<result
column=
"MEASURE_UNIT_NAME"
property=
"measureUnitName"
/>
<result
column=
"TOTAL_LOCK"
property=
"totalLock"
/>
<result
column=
"COST"
property=
"cost"
/>
<result
column=
"PRODUCTION_DATE"
property=
"productionDate"
/>
...
...
@@ -40,7 +41,7 @@
<!-- 通用查询结果列 -->
<sql
id=
"Base_Column_List"
>
MP_SCENE_ID,
ID, CREATIONTIME, CREATORUSERID, LASTMODIFICATIONTIME, LASTMODIFIERUSERID, ISDELETED, DELETIONTIME, DELETERUSERID, MATERIAL_ID, MATERIAL_CODE, MATERIAL_NAME, MATERIAL_VERSION, STORE_ID, STORE_CODE, STORE_NAME, TOTAL, MEASURE_UNIT, TOTAL_LOCK, COST, PRODUCTION_DATE, EXPIRY_DATE, WAREHOUSING_DATE, BATCH, CURRENCY_ID, CURRENCY_NAME, SUPPLIER_ID, SUPPLIER_CODE, SUPPLIER_NAME, WAREHOUSING_UNIT_ID, WAREHOUSING_UNIT_NAME
ID, CREATIONTIME, CREATORUSERID, LASTMODIFICATIONTIME, LASTMODIFIERUSERID, ISDELETED, DELETIONTIME, DELETERUSERID, MATERIAL_ID, MATERIAL_CODE, MATERIAL_NAME, MATERIAL_VERSION, STORE_ID, STORE_CODE, STORE_NAME, TOTAL, MEASURE_UNIT,
MEASURE_UNIT_NAME,
TOTAL_LOCK, COST, PRODUCTION_DATE, EXPIRY_DATE, WAREHOUSING_DATE, BATCH, CURRENCY_ID, CURRENCY_NAME, SUPPLIER_ID, SUPPLIER_CODE, SUPPLIER_NAME, WAREHOUSING_UNIT_ID, WAREHOUSING_UNIT_NAME
</sql>
</mapper>
src/test/java/com/aps/demo/ImportProductRestTest.java
0 → 100644
View file @
3d4f520d
package
com
.
aps
.
demo
;
import
org.junit.jupiter.api.Test
;
import
java.io.ByteArrayOutputStream
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
import
java.nio.charset.StandardCharsets
;
public
class
ImportProductRestTest
{
@Test
public
void
importProduct
()
throws
Exception
{
String
host
=
System
.
getProperty
(
"quintiq.import.host"
,
"localhost"
);
String
port
=
System
.
getProperty
(
"quintiq.import.port"
,
"1234"
);
String
url
=
"http://"
+
host
+
":"
+
port
+
"/ImportProduct"
;
String
requestBody
=
"{"
+
"\"Product\":["
+
"{"
+
"\"ProductId\":\"TEST_PRODUCT_001\","
+
"\"IsDelete\":false,"
+
"\"IsDiscrete\":true,"
+
"\"Name\":\"TEST_PRODUCT_001\","
+
"\"PieceWeight\":1.0,"
+
"\"Type\":\"TEST\","
+
"\"UoM\":\"pc\","
+
"\"ProductInStockingPoint\":["
+
"{"
+
"\"StockingPointId\":\"SLAB\","
+
"\"IsDelete\":false"
+
"}"
+
"]"
+
"}"
+
"]"
+
"}"
;
HttpURLConnection
connection
=
(
HttpURLConnection
)
new
URL
(
url
).
openConnection
();
connection
.
setRequestMethod
(
"POST"
);
connection
.
setConnectTimeout
(
5000
);
connection
.
setReadTimeout
(
15000
);
connection
.
setDoOutput
(
true
);
connection
.
setRequestProperty
(
"Content-Type"
,
"application/json; charset=UTF-8"
);
connection
.
setRequestProperty
(
"Accept"
,
"application/json"
);
byte
[]
bytes
=
requestBody
.
getBytes
(
StandardCharsets
.
UTF_8
);
connection
.
setFixedLengthStreamingMode
(
bytes
.
length
);
try
(
OutputStream
outputStream
=
connection
.
getOutputStream
())
{
outputStream
.
write
(
bytes
);
}
int
statusCode
=
connection
.
getResponseCode
();
String
responseBody
=
readBody
(
connection
,
statusCode
);
System
.
out
.
println
(
"POST "
+
url
);
System
.
out
.
println
(
"HTTP "
+
statusCode
);
System
.
out
.
println
(
responseBody
);
if
(
statusCode
<
200
||
statusCode
>=
300
)
{
throw
new
IllegalStateException
(
"ImportProduct failed, HTTP "
+
statusCode
+
": "
+
responseBody
);
}
}
private
String
readBody
(
HttpURLConnection
connection
,
int
statusCode
)
throws
Exception
{
InputStream
inputStream
=
statusCode
>=
400
?
connection
.
getErrorStream
()
:
connection
.
getInputStream
();
if
(
inputStream
==
null
)
{
return
""
;
}
try
(
InputStream
in
=
inputStream
;
ByteArrayOutputStream
out
=
new
ByteArrayOutputStream
())
{
byte
[]
buffer
=
new
byte
[
1024
];
int
length
;
while
((
length
=
in
.
read
(
buffer
))
!=
-
1
)
{
out
.
write
(
buffer
,
0
,
length
);
}
return
new
String
(
out
.
toByteArray
(),
StandardCharsets
.
UTF_8
);
}
}
}
src/test/java/com/aps/macroplanner/scene/MacroSceneMultiModeTest.java
0 → 100644
View file @
3d4f520d
package
com
.
aps
.
macroplanner
.
scene
;
import
com.aps.entity.MacroSceneConfig
;
import
com.aps.mapper.MacroSceneConfigMapper
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.test.util.ReflectionTestUtils
;
import
java.util.Collections
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.*;
import
static
org
.
mockito
.
Mockito
.*;
class
MacroSceneMultiModeTest
{
@Test
void
productionModeAllowsManagementAndPreservesSceneId
()
{
MacroSceneMode
mode
=
new
MacroSceneMode
();
assertFalse
(
mode
.
isDefaultOnly
());
assertDoesNotThrow
(
mode:
:
requireSceneManagement
);
assertEquals
(
"scene-001"
,
mode
.
resolve
(
" scene-001 "
));
assertThrows
(
IllegalArgumentException
.
class
,
()
->
mode
.
resolve
(
null
));
assertNull
(
new
MacroSceneMode
(
true
).
resolve
(
"default"
));
}
@Test
void
listsRealScenesWithoutVirtualDefault
()
{
MacroSceneService
service
=
mock
(
MacroSceneService
.
class
,
CALLS_REAL_METHODS
);
MacroSceneConfigMapper
mapper
=
mock
(
MacroSceneConfigMapper
.
class
);
ReflectionTestUtils
.
setField
(
service
,
"sceneMode"
,
new
MacroSceneMode
());
ReflectionTestUtils
.
setField
(
service
,
"sceneConfigMapper"
,
mapper
);
MacroSceneConfig
scene
=
new
MacroSceneConfig
();
scene
.
setSceneId
(
"scene-001"
);
when
(
mapper
.
selectList
(
null
)).
thenReturn
(
Collections
.
singletonList
(
scene
));
assertSame
(
scene
,
service
.
listScenes
().
get
(
0
));
when
(
mapper
.
selectList
(
null
)).
thenReturn
(
Collections
.
emptyList
());
assertTrue
(
service
.
listScenes
().
isEmpty
());
}
}
src/test/java/com/aps/macroplanner/scene/PlanPeriodSceneTest.java
0 → 100644
View file @
3d4f520d
package
com
.
aps
.
macroplanner
.
scene
;
import
com.aps.controller.PlanPeriodController
;
import
com.aps.entity.MacroSceneConfig
;
import
com.aps.entity.PlanPeriod
;
import
com.aps.mapper.PlanPeriodMapper
;
import
com.aps.service.PlanPeriodService
;
import
com.baomidou.mybatisplus.core.MybatisConfiguration
;
import
com.baomidou.mybatisplus.core.conditions.Wrapper
;
import
com.baomidou.mybatisplus.core.metadata.TableInfoHelper
;
import
org.apache.ibatis.builder.MapperBuilderAssistant
;
import
org.apache.ibatis.reflection.SystemMetaObject
;
import
org.junit.jupiter.api.AfterEach
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.test.util.ReflectionTestUtils
;
import
java.util.Collections
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.*;
import
static
org
.
mockito
.
Mockito
.*;
class
PlanPeriodSceneTest
{
@AfterEach
void
clearContext
()
{
MacroSceneContext
.
clear
();
}
@Test
void
createUsesSelectedSceneAndIgnoresPayloadOwnership
()
{
PlanPeriodService
service
=
mock
(
PlanPeriodService
.
class
);
MacroSceneService
scenes
=
mock
(
MacroSceneService
.
class
);
MacroSceneConfig
config
=
new
MacroSceneConfig
();
config
.
setSceneId
(
"scene-a"
);
config
.
setSceneStatus
(
"READY"
);
when
(
scenes
.
getScene
(
"scene-a"
)).
thenReturn
(
config
);
when
(
service
.
save
(
any
())).
thenAnswer
(
invocation
->
{
assertEquals
(
"scene-a"
,
MacroSceneContext
.
getSceneId
());
return
true
;
});
PlanPeriod
period
=
new
PlanPeriod
();
period
.
setId
(
"old-id"
);
period
.
setMpSceneId
(
"wrong-scene"
);
new
PlanPeriodController
(
service
,
scenes
).
create
(
"scene-a"
,
period
);
assertEquals
(
"scene-a"
,
period
.
getMpSceneId
());
assertNotEquals
(
"old-id"
,
period
.
getId
());
assertEquals
(
Long
.
valueOf
(
0
),
period
.
getIsdeleted
());
assertNull
(
MacroSceneContext
.
getSceneId
());
}
@Test
void
originalReadUsesNullScopeAndActiveFilter
()
{
TableInfoHelper
.
initTableInfo
(
new
MapperBuilderAssistant
(
new
MybatisConfiguration
(),
"test"
),
PlanPeriod
.
class
);
PlanPeriodService
service
=
mock
(
PlanPeriodService
.
class
);
when
(
service
.
list
(
any
(
Wrapper
.
class
))).
thenAnswer
(
invocation
->
{
assertNull
(
MacroSceneContext
.
getSceneId
());
Wrapper
<?>
query
=
invocation
.
getArgument
(
0
);
assertTrue
(
query
.
getSqlSegment
().
toUpperCase
().
contains
(
"ISDELETED"
));
return
Collections
.
emptyList
();
});
assertTrue
(
new
PlanPeriodController
(
service
,
mock
(
MacroSceneService
.
class
)).
list
(
null
).
getData
().
isEmpty
());
verify
(
service
).
list
(
any
(
Wrapper
.
class
));
}
@Test
void
insertionFillAndCopyFilterIncludePlanPeriod
()
{
PlanPeriod
period
=
new
PlanPeriod
();
MacroSceneContext
.
setSceneId
(
"scene-b"
);
new
MacroSceneMetaObjectHandler
().
insertFill
(
SystemMetaObject
.
forObject
(
period
));
assertEquals
(
"scene-b"
,
period
.
getMpSceneId
());
MacroSceneService
scenes
=
mock
(
MacroSceneService
.
class
,
CALLS_REAL_METHODS
);
PlanPeriodMapper
mapper
=
mock
(
PlanPeriodMapper
.
class
);
ReflectionTestUtils
.
setField
(
scenes
,
"planPeriodMapper"
,
mapper
);
assertEquals
(
"ISDELETED"
,
ReflectionTestUtils
.
invokeMethod
(
scenes
,
"deletedColumn"
,
mapper
));
}
}
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