Browse Source

tw_zh

jx-test
修宁 5 months ago
parent
commit
a5e30eb824
  1. 61
      src/editor/propEditors/JsonPreview.vue
  2. 2
      src/editor/widgets/property/PropertyPanelConstant.ts
  3. 73
      src/modules/way/WayPropertySetter.ts
  4. 50
      src/utils/AmrMapConvert.ts

61
src/editor/propEditors/JsonPreview.vue

@ -0,0 +1,61 @@
<script setup lang="ts">
import { reactive, useAttrs } from 'vue'
import { useFormItem } from 'element-plus'
defineOptions({
name: 'JsonPreview'
})
// Props
interface JsonPreviewProps {
modelValue: any;
}
// props
const props = withDefaults(defineProps<JsonPreviewProps>(), {})
// State
interface JsonPreviewState {
}
// state
const state = reactive<JsonPreviewState>({})
// Data
interface JsonPreviewData {
}
//
const data: JsonPreviewData = {}
const { formItem } = useFormItem()
interface JsonPreviewExpose {
state: JsonPreviewState;
data: JsonPreviewData;
}
const expose: JsonPreviewExpose = {
state,
data
}
//
defineExpose(expose)
export type {
JsonPreviewProps,
JsonPreviewState
}
</script>
<template>
<div class="yvan-json-preview">
<pre>{{ JSON.stringify(props.modelValue, null, 2) }}</pre>
</div>
</template>
<style scoped>
.yvan-json-preview {
flex: 1;
}
</style>

2
src/editor/widgets/property/PropertyPanelConstant.ts

@ -6,6 +6,7 @@ import TransformEditor from "@/editor/propEditors/TransformEditor.vue";
import InOutCenterEditor from "@/editor/propEditors/InOutCenterEditor.vue"; import InOutCenterEditor from "@/editor/propEditors/InOutCenterEditor.vue";
import BayEditor from "@/editor/propEditors/BayEditor.vue"; import BayEditor from "@/editor/propEditors/BayEditor.vue";
import PtrController from "@/editor/propEditors/PtrController.vue"; import PtrController from "@/editor/propEditors/PtrController.vue";
import JsonPreview from "@/editor/propEditors/JsonPreview.vue";
const defDataFormProps: DataFormProps = { const defDataFormProps: DataFormProps = {
columnCount: 1, columnCount: 1,
@ -18,6 +19,7 @@ dataFormInputComponents.TransformEditor = markRaw<any>(TransformEditor);
dataFormInputComponents.InOutCenterEditor = markRaw<any>(InOutCenterEditor); dataFormInputComponents.InOutCenterEditor = markRaw<any>(InOutCenterEditor);
dataFormInputComponents.BayEditor = markRaw<any>(BayEditor); dataFormInputComponents.BayEditor = markRaw<any>(BayEditor);
dataFormInputComponents.PtrController = markRaw<any>(PtrController); dataFormInputComponents.PtrController = markRaw<any>(PtrController);
dataFormInputComponents.JsonPreview = markRaw<any>(JsonPreview);
const basicFieldsSetter: Array<PropertyFieldSetter> = [ const basicFieldsSetter: Array<PropertyFieldSetter> = [
{ {

73
src/modules/way/WayPropertySetter.ts

@ -14,9 +14,78 @@ const propertySetter: PropertySetter = {
inputProps: {} inputProps: {}
}, },
{ {
dataPath: 'originId', label: 'originId', input: 'InputNumber', dataPath: 'dt.agvRotation', label: '旋转', input: 'SelectV2',
inputProps: {} inputProps: {
placeholder: '请选择',
multiple: true,
clearable: true,
options: [
{
label: 'FitBot300',
value: 'SlamFitBot300'
},
{
label: 'FitBot500',//肥波500
value: 'FitBot500'
},
{
label: 'FitBot1000',//肥波1000
value: 'FitBot1000'
},
{
label: 'CL', //侧叉车型
value: 'CY'
},
{
label: 'CLX', //侧叉车型
value: 'CLX'
},
{
label: 'CC5', //侧叉车型
value: 'CC'
},
{
label: 'CC8', //侧叉车型
value: 'CCX'
}, {
label: 'FreeShuttle',//飞梭车型
value: 'FreeShuttle'
},
{
label: 'NZ',//
value: 'NZ'
},
{
label: 'FreeRoller',//滚筒车
value: 'FreeRoller'
},
{
label: 'SlamFitRoller',//
value: 'SlamFitRoller'
},
{
label: 'ForkSeer',
value: 'ForkSeer'
},
{
label: 'SurayRGV',
value: 'SurayRGV'
},
{
label: 'BroachAGV',
value: 'BroachAGV'
}, },
{
label: 'NYRGV',
value: 'NYRGV'
}
]
}
},
{
dataPath: 'dt.linkStore', input: 'JsonPreview',
inputProps: {}
}
] ]
} }
} }

50
src/utils/AmrMapConvert.ts

@ -277,10 +277,10 @@ export function AmrMapConvert(from: any): Array<ItemJson> {
} }
// 货架高度是从 attribute[0].goodsAllocation[].layerHeight 读取的 // 货架高度是从 attribute[0].goodsAllocation[].layerHeight 读取的
if(insertNode.t === 'rack') { if (insertNode.t === 'rack') {
const levelsInfo = amrNode.attribute[0].attrDetail const levelsInfo = amrNode.attribute[0].attrDetail
const levelCount = levelsInfo.length const levelCount = levelsInfo.length
const levelHeight = _.map(levelsInfo, l=> new Decimal(l.val).div(d1000).toNumber() ) const levelHeight = _.map(levelsInfo, l => new Decimal(l.val).div(d1000).toNumber())
insertNode.dt.levelCount = levelCount insertNode.dt.levelCount = levelCount
insertNode.dt.bays[0].levelHeight = levelHeight insertNode.dt.bays[0].levelHeight = levelHeight
@ -318,34 +318,34 @@ export function AmrMapConvert(from: any): Array<ItemJson> {
} }
// 这是潜伏AGV货位 // 这是潜伏AGV货位
if(amrNode.type === 'CODE' && amrNode.attribute[0]?.rackTypeId === 3) { if (amrNode.type === 'CODE' && amrNode.attribute[0]?.rackTypeId === 3 && amrNode.attribute[0]?.attrValue === 'CellTypeRackLocation') {
lccMap.set(lccId+'C', { lccMap.set(lccId + 'C', {
"id": lccId+'C', 'id': lccId + 'C',
"t": "gstore", 't': 'gstore',
"v": true, 'v': true,
"tf": [ 'tf': [
[ [
new Decimal(amrNode.x).div(d100).toNumber(), new Decimal(amrNode.x).div(d100).toNumber(),
0, 0,
new Decimal(amrNode.y).div(d100).toNumber() new Decimal(amrNode.y).div(d100).toNumber()
], ],
[0,0,0], [0, 0, 0],
[0.5,0.01,0.5] [0.5, 0.01, 0.5]
], ],
"dt": { 'dt': {
"in": [], 'in': [],
"out": [], 'out': [],
"center": [], 'center': [],
"strokeWidth": 0.05 'strokeWidth': 0.05
}, },
"logicX": amrNode.logicX, 'logicX': amrNode.logicX,
"logicY": amrNode.logicY 'logicY': amrNode.logicY
}) })
insertNode.dt.linkStore = [] insertNode.dt.linkStore = []
for(let c of amrNode.direction) { for (let c of amrNode.direction) {
insertNode.dt.linkStore.push({ insertNode.dt.linkStore.push({
'item': lccId+'C', 'item': lccId + 'C',
'bay': 0, 'level': 0, 'cell': 0, 'direction': convertDirection(c) 'bay': 0, 'level': 0, 'cell': 0, 'direction': convertDirection(c)
}) })
} }
@ -498,6 +498,8 @@ function convertAmrDirectToLinkStoreDirection(direct: number): string {
return 'right' return 'right'
} else if (direct === 4) { } else if (direct === 4) {
return 'left' return 'left'
} else if (direct === 5) {
return 'right'
} else { } else {
throw new Error('未知的方向: ' + direct) throw new Error('未知的方向: ' + direct)
} }
@ -529,17 +531,17 @@ function convertLinkStoreDistance(direction: string, storeNode: any) {
// 根据方向,调整存储位的距离 // 根据方向,调整存储位的距离
function convertDirection(directions: string) { function convertDirection(directions: string) {
// N=up / S=down / E=right / W=left // N=up / S=down / E=right / W=left
if(directions === 'N') { if (directions === 'N') {
return 'up' return 'up'
} }
if(directions === 'S'){ if (directions === 'S') {
return 'down' return 'down'
} }
if(directions === 'E'){ if (directions === 'E') {
return 'right' return 'right'
} }
if(directions === 'W'){ if (directions === 'W') {
return 'left' return 'left'
} }
throw new Error('convertDirection error:'+ directions) throw new Error('convertDirection error:' + directions)
} }

Loading…
Cancel
Save