feat: 添加库区规则支持,更新相关接口和组件以处理先进先出和后进先出逻辑
This commit is contained in:
parent
5d57a8924f
commit
cfb04396e2
@ -44,6 +44,7 @@ export interface MapAreaInfo {
|
||||
points?: Array<string>; // 绑定点位id集合
|
||||
routes?: Array<string>; // 绑定线路id集合
|
||||
maxAmr?: number; // 最大可容纳AMR数
|
||||
inoutflag?: 1 | 2; // 库区规则
|
||||
}
|
||||
//#endregion
|
||||
|
||||
|
@ -67,6 +67,7 @@ export interface StandardSceneArea {
|
||||
points?: Array<string>; // 绑定点位id集合
|
||||
routes?: Array<string>; // 绑定线路id集合
|
||||
maxAmr?: number; // 最大可容纳AMR数
|
||||
inoutflag?: 1 | 2; // 库区规则
|
||||
config?: object; // 其它属性配置(可按需增加)
|
||||
properties?: unknown; // 附加数据(前端不做任何处理)
|
||||
}
|
||||
|
@ -43,6 +43,12 @@ const bindRoute = computed<string>(
|
||||
.filter((v) => !!v)
|
||||
.join('、') ?? '',
|
||||
);
|
||||
|
||||
const ruleText = computed(() => {
|
||||
if (area.value?.inoutflag === 1) return '先进先出';
|
||||
if (area.value?.inoutflag === 2) return '后进先出';
|
||||
return '';
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@ -69,6 +75,12 @@ const bindRoute = computed<string>(
|
||||
<a-typography-text>{{ pen.area?.maxAmr ?? $t('暂无') }}</a-typography-text>
|
||||
</a-flex>
|
||||
</a-list-item>
|
||||
<a-list-item v-if="MapAreaType.库区 === area.type">
|
||||
<a-flex :gap="8" vertical>
|
||||
<a-typography-text type="secondary">{{ $t('库区规则') }}</a-typography-text>
|
||||
<a-typography-text>{{ ruleText || $t('暂无') }}</a-typography-text>
|
||||
</a-flex>
|
||||
</a-list-item>
|
||||
<a-list-item v-if="MapAreaType.库区 === area.type">
|
||||
<a-flex :gap="8" vertical>
|
||||
<a-typography-text type="secondary">{{ $t('绑定动作点') }}</a-typography-text>
|
||||
|
@ -80,6 +80,21 @@ const routes = computed<string[]>(
|
||||
/>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row v-if="area.type === MapAreaType.库区" :gutter="[8, 8]">
|
||||
<a-col :span="24">
|
||||
<a-typography-text>{{ $t('库区规则') }}:</a-typography-text>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-select
|
||||
class="full"
|
||||
:value="pen.area?.inoutflag"
|
||||
@change="editor.updateArea(id, { inoutflag: $event as 1 | 2 })"
|
||||
>
|
||||
<a-select-option :value="1">{{ $t('先进先出') }}</a-select-option>
|
||||
<a-select-option :value="2">{{ $t('后进先出') }}</a-select-option>
|
||||
</a-select>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<a-row :gutter="[8, 8]">
|
||||
<a-col :span="24">
|
||||
|
@ -153,10 +153,10 @@ export class EditorService extends Meta2d {
|
||||
if (!areas?.length) return;
|
||||
await Promise.all(
|
||||
areas.map(async (v) => {
|
||||
const { id, name, desc, x, y, w, h, type, points, routes, maxAmr, properties } = v;
|
||||
const { id, name, desc, x, y, w, h, type, points, routes, maxAmr, inoutflag, properties } = v;
|
||||
await this.addArea({ x, y }, { x: x + w, y: y + h }, type, id);
|
||||
this.setValue(
|
||||
{ id, label: name, desc, properties, area: { type, points, routes, maxAmr } },
|
||||
{ id, label: name, desc, properties, area: { type, points, routes, maxAmr, inoutflag } },
|
||||
{ render: false, history: false, doEvent: false },
|
||||
);
|
||||
}),
|
||||
@ -232,7 +232,7 @@ export class EditorService extends Meta2d {
|
||||
#mapSceneArea(pen: MapPen): StandardSceneArea | null {
|
||||
if (!pen.id || isEmpty(pen.area)) return null;
|
||||
const { id, label, desc, properties } = pen;
|
||||
const { type, points, routes, maxAmr } = pen.area;
|
||||
const { type, points, routes, maxAmr, inoutflag } = pen.area;
|
||||
const { x, y, width, height } = this.getPenRect(pen);
|
||||
// 进行坐标转换:左上角原点 -> 中心点原点,同时应用ratio缩放
|
||||
const transformedCoords = this.#transformCoordinate(x, y);
|
||||
@ -253,6 +253,7 @@ export class EditorService extends Meta2d {
|
||||
}
|
||||
if (MapAreaType.库区 === type) {
|
||||
area.points = points?.filter((v) => this.getPenById(v)?.point?.type === MapPointType.动作点);
|
||||
area.inoutflag = inoutflag;
|
||||
}
|
||||
if ([MapAreaType.互斥区, MapAreaType.非互斥区, MapAreaType.约束区].includes(type)) {
|
||||
area.points = points?.filter((v) => {
|
||||
@ -809,6 +810,10 @@ export class EditorService extends Meta2d {
|
||||
break;
|
||||
}
|
||||
}
|
||||
const areaInfo: MapAreaInfo = { type, points, routes };
|
||||
if (type === MapAreaType.库区) {
|
||||
areaInfo.inoutflag = 1;
|
||||
}
|
||||
const pen: MapPen = {
|
||||
id,
|
||||
name: 'area',
|
||||
@ -819,7 +824,7 @@ export class EditorService extends Meta2d {
|
||||
width: w,
|
||||
height: h,
|
||||
lineWidth: 1,
|
||||
area: { type, points, routes },
|
||||
area: areaInfo,
|
||||
locked: LockState.None,
|
||||
};
|
||||
const area = await this.addPen(pen, true, true, true);
|
||||
|
Loading…
x
Reference in New Issue
Block a user