@fmsim/machine 0.0.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (274) hide show
  1. package/dist/agv-line.js +48 -0
  2. package/dist/agv-line.js.map +1 -0
  3. package/dist/agv.js +43 -0
  4. package/dist/agv.js.map +1 -0
  5. package/dist/buffer.js +40 -0
  6. package/dist/buffer.js.map +1 -0
  7. package/dist/conveyor-join.js +169 -0
  8. package/dist/conveyor-join.js.map +1 -0
  9. package/dist/conveyor.js +84 -0
  10. package/dist/conveyor.js.map +1 -0
  11. package/dist/crane.js +55 -0
  12. package/dist/crane.js.map +1 -0
  13. package/dist/data-subscription.js +126 -0
  14. package/dist/data-subscription.js.map +1 -0
  15. package/dist/editors/index.js +2 -0
  16. package/dist/editors/index.js.map +1 -0
  17. package/dist/equipment.js +18 -0
  18. package/dist/equipment.js.map +1 -0
  19. package/dist/features/client-api.js +45 -0
  20. package/dist/features/client-api.js.map +1 -0
  21. package/dist/features/conveyor-mixin.js +54 -0
  22. package/dist/features/conveyor-mixin.js.map +1 -0
  23. package/dist/features/mcs-event-handler-mixin.js +65 -0
  24. package/dist/features/mcs-event-handler-mixin.js.map +1 -0
  25. package/dist/features/mcs-status-default.js +67 -0
  26. package/dist/features/mcs-status-default.js.map +1 -0
  27. package/dist/features/mcs-status-mixin.js +39 -0
  28. package/dist/features/mcs-status-mixin.js.map +1 -0
  29. package/dist/features/mcs-transport-mixin.js +39 -0
  30. package/dist/features/mcs-transport-mixin.js.map +1 -0
  31. package/dist/features/mcs-zone-mixin.js +18 -0
  32. package/dist/features/mcs-zone-mixin.js.map +1 -0
  33. package/dist/groups/index.js +10 -0
  34. package/dist/groups/index.js.map +1 -0
  35. package/dist/groups/mcs-acs.js +24 -0
  36. package/dist/groups/mcs-acs.js.map +1 -0
  37. package/dist/groups/mcs-bcs.js +27 -0
  38. package/dist/groups/mcs-bcs.js.map +1 -0
  39. package/dist/groups/mcs-ccs.js +25 -0
  40. package/dist/groups/mcs-ccs.js.map +1 -0
  41. package/dist/groups/mcs-ecs.js +23 -0
  42. package/dist/groups/mcs-ecs.js.map +1 -0
  43. package/dist/groups/mcs-ocs.js +25 -0
  44. package/dist/groups/mcs-ocs.js.map +1 -0
  45. package/dist/groups/mcs-path.js +28 -0
  46. package/dist/groups/mcs-path.js.map +1 -0
  47. package/dist/groups/mcs-scs.js +26 -0
  48. package/dist/groups/mcs-scs.js.map +1 -0
  49. package/dist/groups/mcs-shape.js +26 -0
  50. package/dist/groups/mcs-shape.js.map +1 -0
  51. package/dist/index.js +25 -0
  52. package/dist/index.js.map +1 -0
  53. package/dist/mcs-carrier-holder.js +107 -0
  54. package/dist/mcs-carrier-holder.js.map +1 -0
  55. package/dist/mcs-gauge-capacity-bar.js +170 -0
  56. package/dist/mcs-gauge-capacity-bar.js.map +1 -0
  57. package/dist/mcs-gauge-capacity-circle.js +91 -0
  58. package/dist/mcs-gauge-capacity-circle.js.map +1 -0
  59. package/dist/mcs-machine.js +84 -0
  60. package/dist/mcs-machine.js.map +1 -0
  61. package/dist/mcs-popup.js +82 -0
  62. package/dist/mcs-popup.js.map +1 -0
  63. package/dist/mcs-transport.js +18 -0
  64. package/dist/mcs-transport.js.map +1 -0
  65. package/dist/mcs-unit.js +78 -0
  66. package/dist/mcs-unit.js.map +1 -0
  67. package/dist/mcs-vehicle.js +69 -0
  68. package/dist/mcs-vehicle.js.map +1 -0
  69. package/dist/mcs-zone-unit.js +11 -0
  70. package/dist/mcs-zone-unit.js.map +1 -0
  71. package/dist/oht-line.js +32 -0
  72. package/dist/oht-line.js.map +1 -0
  73. package/dist/oht.js +42 -0
  74. package/dist/oht.js.map +1 -0
  75. package/dist/port.js +32 -0
  76. package/dist/port.js.map +1 -0
  77. package/dist/rtv-rail.js +36 -0
  78. package/dist/rtv-rail.js.map +1 -0
  79. package/dist/shelf.js +41 -0
  80. package/dist/shelf.js.map +1 -0
  81. package/dist/shuttle.js +49 -0
  82. package/dist/shuttle.js.map +1 -0
  83. package/dist/stocker-capacity-bar.js +171 -0
  84. package/dist/stocker-capacity-bar.js.map +1 -0
  85. package/dist/stocker.js +36 -0
  86. package/dist/stocker.js.map +1 -0
  87. package/dist/templates/agv-line-corner.js +34 -0
  88. package/dist/templates/agv-line-corner.js.map +1 -0
  89. package/dist/templates/agv-line-cross.js +34 -0
  90. package/dist/templates/agv-line-cross.js.map +1 -0
  91. package/dist/templates/agv-line-horizontal.js +34 -0
  92. package/dist/templates/agv-line-horizontal.js.map +1 -0
  93. package/dist/templates/agv-line-vertical.js +34 -0
  94. package/dist/templates/agv-line-vertical.js.map +1 -0
  95. package/dist/templates/agv-line.js +15 -0
  96. package/dist/templates/agv-line.js.map +1 -0
  97. package/dist/templates/agv.js +15 -0
  98. package/dist/templates/agv.js.map +1 -0
  99. package/dist/templates/buffer.js +15 -0
  100. package/dist/templates/buffer.js.map +1 -0
  101. package/dist/templates/conveyor-corner.js +33 -0
  102. package/dist/templates/conveyor-corner.js.map +1 -0
  103. package/dist/templates/conveyor-join.js +21 -0
  104. package/dist/templates/conveyor-join.js.map +1 -0
  105. package/dist/templates/conveyor-left.js +33 -0
  106. package/dist/templates/conveyor-left.js.map +1 -0
  107. package/dist/templates/conveyor-middle.js +33 -0
  108. package/dist/templates/conveyor-middle.js.map +1 -0
  109. package/dist/templates/conveyor-right.js +33 -0
  110. package/dist/templates/conveyor-right.js.map +1 -0
  111. package/dist/templates/conveyor.js +18 -0
  112. package/dist/templates/conveyor.js.map +1 -0
  113. package/dist/templates/crane.js +15 -0
  114. package/dist/templates/crane.js.map +1 -0
  115. package/dist/templates/data-subscription.js +16 -0
  116. package/dist/templates/data-subscription.js.map +1 -0
  117. package/dist/templates/equipment.js +15 -0
  118. package/dist/templates/equipment.js.map +1 -0
  119. package/dist/templates/index.js +35 -0
  120. package/dist/templates/index.js.map +1 -0
  121. package/dist/templates/mcs-gauge-capacity-bar.js +18 -0
  122. package/dist/templates/mcs-gauge-capacity-bar.js.map +1 -0
  123. package/dist/templates/mcs-gauge-capacity-circle.js +18 -0
  124. package/dist/templates/mcs-gauge-capacity-circle.js.map +1 -0
  125. package/dist/templates/oht-line-corner.js +34 -0
  126. package/dist/templates/oht-line-corner.js.map +1 -0
  127. package/dist/templates/oht-line-cross.js +34 -0
  128. package/dist/templates/oht-line-cross.js.map +1 -0
  129. package/dist/templates/oht-line-horizontal.js +34 -0
  130. package/dist/templates/oht-line-horizontal.js.map +1 -0
  131. package/dist/templates/oht-line-vertical.js +34 -0
  132. package/dist/templates/oht-line-vertical.js.map +1 -0
  133. package/dist/templates/oht-line.js +15 -0
  134. package/dist/templates/oht-line.js.map +1 -0
  135. package/dist/templates/oht.js +15 -0
  136. package/dist/templates/oht.js.map +1 -0
  137. package/dist/templates/port.js +15 -0
  138. package/dist/templates/port.js.map +1 -0
  139. package/dist/templates/rtv-corner.js +33 -0
  140. package/dist/templates/rtv-corner.js.map +1 -0
  141. package/dist/templates/rtv-left.js +33 -0
  142. package/dist/templates/rtv-left.js.map +1 -0
  143. package/dist/templates/rtv-middle.js +33 -0
  144. package/dist/templates/rtv-middle.js.map +1 -0
  145. package/dist/templates/rtv-rail.js +15 -0
  146. package/dist/templates/rtv-rail.js.map +1 -0
  147. package/dist/templates/rtv-right.js +33 -0
  148. package/dist/templates/rtv-right.js.map +1 -0
  149. package/dist/templates/rtv.js +15 -0
  150. package/dist/templates/rtv.js.map +1 -0
  151. package/dist/templates/shelf.js +15 -0
  152. package/dist/templates/shelf.js.map +1 -0
  153. package/dist/templates/shuttle.js +15 -0
  154. package/dist/templates/shuttle.js.map +1 -0
  155. package/dist/templates/stocker-capacity-bar.js +18 -0
  156. package/dist/templates/stocker-capacity-bar.js.map +1 -0
  157. package/dist/templates/stocker-capacity-circle.js +18 -0
  158. package/dist/templates/stocker-capacity-circle.js.map +1 -0
  159. package/dist/templates/stocker.js +16 -0
  160. package/dist/templates/stocker.js.map +1 -0
  161. package/dist/templates/zone-capacity-bar.js +19 -0
  162. package/dist/templates/zone-capacity-bar.js.map +1 -0
  163. package/dist/tsconfig.tsbuildinfo +1 -0
  164. package/dist/utils/get-locale.js +19 -0
  165. package/dist/utils/get-locale.js.map +1 -0
  166. package/dist/utils/get-value-on-ranges.js +23 -0
  167. package/dist/utils/get-value-on-ranges.js.map +1 -0
  168. package/dist/utils/normalize-angle.js +11 -0
  169. package/dist/utils/normalize-angle.js.map +1 -0
  170. package/dist/utils/safe-round.js +9 -0
  171. package/dist/utils/safe-round.js.map +1 -0
  172. package/dist/zone-capacity-bar.js +162 -0
  173. package/dist/zone-capacity-bar.js.map +1 -0
  174. package/icons/agv-line.png +0 -0
  175. package/icons/agv.png +0 -0
  176. package/icons/buffer.png +0 -0
  177. package/icons/conveyor-corner.png +0 -0
  178. package/icons/conveyor-corner.svg +10 -0
  179. package/icons/conveyor-join.png +0 -0
  180. package/icons/conveyor-left.png +0 -0
  181. package/icons/conveyor-left.svg +6 -0
  182. package/icons/conveyor-middle.png +0 -0
  183. package/icons/conveyor-middle.svg +5 -0
  184. package/icons/conveyor-right.png +0 -0
  185. package/icons/conveyor-right.svg +6 -0
  186. package/icons/conveyor.png +0 -0
  187. package/icons/crane.png +0 -0
  188. package/icons/equipment.png +0 -0
  189. package/icons/icon-data-subscription.png +0 -0
  190. package/icons/oht-line.png +0 -0
  191. package/icons/oht.png +0 -0
  192. package/icons/pallet-empty.svg +3 -0
  193. package/icons/pallet.svg +11 -0
  194. package/icons/path-position.svg +5 -0
  195. package/icons/port.png +0 -0
  196. package/icons/process.png +0 -0
  197. package/icons/rtv-rail.png +0 -0
  198. package/icons/rtv.png +0 -0
  199. package/icons/shelf.png +0 -0
  200. package/icons/shuttle.png +0 -0
  201. package/icons/stocker-capacity-bar.png +0 -0
  202. package/icons/stocker-capacity-circle.png +0 -0
  203. package/icons/stocker.png +0 -0
  204. package/icons/symbol-data-subscription.png +0 -0
  205. package/icons/vehicle.png +0 -0
  206. package/icons/zone-capacity-bar.png +0 -0
  207. package/migration-samples/model.json +7964 -0
  208. package/package.json +59 -0
  209. package/src/agv-line.ts +59 -0
  210. package/src/agv.ts +56 -0
  211. package/src/buffer.ts +50 -0
  212. package/src/conveyor-join.ts +208 -0
  213. package/src/conveyor.ts +101 -0
  214. package/src/crane.ts +72 -0
  215. package/src/data-subscription.ts +150 -0
  216. package/src/editors/index.ts +0 -0
  217. package/src/equipment.ts +21 -0
  218. package/src/features/client-api.ts +52 -0
  219. package/src/features/conveyor-mixin.ts +75 -0
  220. package/src/features/mcs-status-default.ts +76 -0
  221. package/src/features/mcs-status-mixin.ts +53 -0
  222. package/src/features/mcs-zone-mixin.ts +23 -0
  223. package/src/groups/index.ts +10 -0
  224. package/src/groups/mcs-acs.ts +24 -0
  225. package/src/groups/mcs-bcs.ts +27 -0
  226. package/src/groups/mcs-ccs.ts +25 -0
  227. package/src/groups/mcs-ecs.ts +23 -0
  228. package/src/groups/mcs-ocs.ts +25 -0
  229. package/src/groups/mcs-path.ts +28 -0
  230. package/src/groups/mcs-scs.ts +26 -0
  231. package/src/groups/mcs-shape.ts +26 -0
  232. package/src/index.ts +29 -0
  233. package/src/mcs-carrier-holder.ts +141 -0
  234. package/src/mcs-gauge-capacity-circle.ts +113 -0
  235. package/src/mcs-machine.ts +101 -0
  236. package/src/mcs-popup.ts +99 -0
  237. package/src/mcs-transport.ts +20 -0
  238. package/src/mcs-unit.ts +91 -0
  239. package/src/mcs-vehicle.ts +79 -0
  240. package/src/oht-line.ts +43 -0
  241. package/src/oht.ts +55 -0
  242. package/src/port.ts +41 -0
  243. package/src/shelf.ts +53 -0
  244. package/src/shuttle.ts +65 -0
  245. package/src/stocker-capacity-bar.ts +220 -0
  246. package/src/stocker.ts +45 -0
  247. package/src/templates/agv-line.ts +15 -0
  248. package/src/templates/agv.ts +15 -0
  249. package/src/templates/buffer.ts +15 -0
  250. package/src/templates/conveyor.ts +18 -0
  251. package/src/templates/crane.ts +15 -0
  252. package/src/templates/data-subscription.js +16 -0
  253. package/src/templates/equipment.ts +15 -0
  254. package/src/templates/index.ts +43 -0
  255. package/src/templates/oht-line.ts +15 -0
  256. package/src/templates/oht.ts +15 -0
  257. package/src/templates/port.ts +15 -0
  258. package/src/templates/shelf.ts +15 -0
  259. package/src/templates/shuttle.ts +15 -0
  260. package/src/templates/stocker-capacity-bar.ts +18 -0
  261. package/src/templates/stocker-capacity-circle.ts +18 -0
  262. package/src/templates/stocker.ts +16 -0
  263. package/src/templates/zone-capacity-bar.ts +19 -0
  264. package/src/utils/get-locale.ts +22 -0
  265. package/src/utils/get-value-on-ranges.ts +25 -0
  266. package/src/utils/normalize-angle.ts +9 -0
  267. package/src/utils/safe-round.ts +8 -0
  268. package/src/zone-capacity-bar.ts +209 -0
  269. package/things-scene.config.js +7 -0
  270. package/translations/en.json +7 -0
  271. package/translations/ja.json +7 -0
  272. package/translations/ko.json +7 -0
  273. package/translations/ms.json +7 -0
  274. package/translations/zh.json +7 -0
@@ -0,0 +1,43 @@
1
+ import { Component, ComponentNature } from '@hatiolab/things-scene'
2
+ import MCSTransport from './mcs-transport'
3
+
4
+ const NATURE: ComponentNature = {
5
+ mutable: false,
6
+ resizable: true,
7
+ rotatable: true,
8
+ properties: [...MCSTransport.properties]
9
+ }
10
+
11
+ export default class OHTLine extends MCSTransport {
12
+ static get nature() {
13
+ return NATURE
14
+ }
15
+
16
+ get auxColor() {
17
+ return '#333'
18
+ }
19
+
20
+ containable(component: Component) {
21
+ return ['OHT'].includes(component.state.type)
22
+ }
23
+
24
+ render(context: CanvasRenderingContext2D) {
25
+ const { left, top, width, height } = this.bounds
26
+
27
+ context.beginPath()
28
+
29
+ context.translate(left, top)
30
+
31
+ context.fillStyle = this.statusColor!
32
+ context.strokeStyle = this.auxColor!
33
+
34
+ context.fillRect(0, 0, width, height)
35
+
36
+ context.fill()
37
+ context.stroke()
38
+
39
+ context.translate(-left, -top)
40
+ }
41
+ }
42
+
43
+ Component.register('OHTLine', OHTLine)
package/src/oht.ts ADDED
@@ -0,0 +1,55 @@
1
+ import { Component, ComponentNature, Properties } from '@hatiolab/things-scene'
2
+ import MCSVehicle from './mcs-vehicle'
3
+
4
+ const NATURE: ComponentNature = {
5
+ mutable: false,
6
+ resizable: true,
7
+ rotatable: true,
8
+ properties: [...MCSVehicle.properties]
9
+ }
10
+
11
+ const GAP = 2
12
+
13
+ export default class OHT extends MCSVehicle {
14
+ static get nature() {
15
+ return NATURE
16
+ }
17
+
18
+ get auxColor() {
19
+ return 'black'
20
+ }
21
+
22
+ render(ctx: CanvasRenderingContext2D) {
23
+ var { left, top, width, height } = this.bounds
24
+
25
+ ctx.translate(left, top)
26
+ ctx.beginPath()
27
+
28
+ ctx.strokeStyle = this.auxColor
29
+ ctx.fillStyle = this.statusColor!
30
+ ctx.lineWidth = 1
31
+ ctx.lineCap = 'round'
32
+ ctx.setLineDash([])
33
+
34
+ const radius = Math.round(Math.min(width, height) * 0.1)
35
+ ctx.roundRect(0, 0, width, height, radius)
36
+ ctx.roundRect(GAP, GAP, width - GAP * 2, height - GAP * 2, radius - 1)
37
+
38
+ ctx.fill()
39
+ ctx.stroke()
40
+
41
+ ctx.beginPath()
42
+
43
+ ctx.lineCap = 'butt'
44
+ ctx.strokeStyle = 'black'
45
+ ctx.lineWidth = 3
46
+ ctx.moveTo(width / 2, GAP * 2)
47
+ ctx.lineTo(width / 2, height - GAP * 2)
48
+
49
+ ctx.stroke()
50
+
51
+ ctx.translate(-left, -top)
52
+ }
53
+ }
54
+
55
+ Component.register('OHT', OHT)
package/src/port.ts ADDED
@@ -0,0 +1,41 @@
1
+ import { Component, ComponentNature } from '@hatiolab/things-scene'
2
+ import { MCSZoneMixin, MCSZoneMixinProperties } from './features/mcs-zone-mixin'
3
+ import MCSCarrierHolder from './mcs-carrier-holder'
4
+
5
+ const NATURE: ComponentNature = {
6
+ mutable: false,
7
+ resizable: true,
8
+ rotatable: true,
9
+ properties: [...MCSZoneMixinProperties, ...MCSCarrierHolder.properties]
10
+ }
11
+
12
+ export default class Port extends MCSZoneMixin(MCSCarrierHolder) {
13
+ static get nature() {
14
+ return NATURE
15
+ }
16
+
17
+ get auxColor() {
18
+ return 'black'
19
+ }
20
+
21
+ render(ctx: CanvasRenderingContext2D) {
22
+ var { left, top, width, height } = this.bounds
23
+
24
+ ctx.strokeStyle = this.auxColor
25
+ ctx.fillStyle = this.statusColor!
26
+ ctx.lineWidth = 1
27
+ ctx.lineCap = 'round'
28
+ ctx.setLineDash([])
29
+
30
+ ctx.beginPath()
31
+
32
+ const radius = Math.round(Math.min(width, height) * 0.1)
33
+
34
+ ctx.roundRect(left, top, width, height, radius)
35
+
36
+ ctx.fill()
37
+ ctx.stroke()
38
+ }
39
+ }
40
+
41
+ Component.register('Port', Port)
package/src/shelf.ts ADDED
@@ -0,0 +1,53 @@
1
+ import { Component, ComponentNature } from '@hatiolab/things-scene'
2
+ import MCSCarrierHolder from './mcs-carrier-holder'
3
+ import { MCSZoneMixin, MCSZoneMixinProperties } from './features/mcs-zone-mixin'
4
+
5
+ const NATURE: ComponentNature = {
6
+ mutable: false,
7
+ resizable: true,
8
+ rotatable: true,
9
+ properties: [...MCSZoneMixinProperties, ...MCSCarrierHolder.properties]
10
+ }
11
+
12
+ export default class Shelf extends MCSZoneMixin(MCSCarrierHolder) {
13
+ static get nature() {
14
+ return NATURE
15
+ }
16
+
17
+ get auxColor() {
18
+ return 'black'
19
+ }
20
+
21
+ render(ctx: CanvasRenderingContext2D) {
22
+ var { left, top, width, height } = this.bounds
23
+
24
+ ctx.save()
25
+
26
+ ctx.translate(left, top)
27
+ ctx.beginPath()
28
+
29
+ ctx.strokeStyle = this.auxColor
30
+ ctx.fillStyle = this.statusColor!
31
+ ctx.lineWidth = 1
32
+ ctx.lineCap = 'round'
33
+ ctx.setLineDash([])
34
+
35
+ const radius = Math.round(Math.min(width, height) * 0.1)
36
+ ctx.roundRect(0, 0, width, height, radius)
37
+
38
+ ctx.clip()
39
+
40
+ ctx.moveTo(0, 0)
41
+ ctx.lineTo(width, height)
42
+ ctx.moveTo(0, height)
43
+ ctx.lineTo(width, 0)
44
+
45
+ ctx.fill()
46
+ ctx.stroke()
47
+
48
+ ctx.translate(-left, -top)
49
+ ctx.restore()
50
+ }
51
+ }
52
+
53
+ Component.register('Shelf', Shelf)
package/src/shuttle.ts ADDED
@@ -0,0 +1,65 @@
1
+ import { Component, ComponentNature } from '@hatiolab/things-scene'
2
+ import MCSVehicle from './mcs-vehicle'
3
+
4
+ const NATURE: ComponentNature = {
5
+ mutable: false,
6
+ resizable: true,
7
+ rotatable: true,
8
+ properties: [...MCSVehicle.properties]
9
+ }
10
+
11
+ const RAILWIDTH = 2
12
+ export default class Shuttle extends MCSVehicle {
13
+ static get nature() {
14
+ return NATURE
15
+ }
16
+
17
+ get auxColor() {
18
+ return 'black'
19
+ }
20
+
21
+ render(ctx: CanvasRenderingContext2D) {
22
+ var { left, top, width, height } = this.bounds
23
+
24
+ ctx.translate(left, top)
25
+
26
+ // draw rail metapore
27
+ ctx.beginPath()
28
+
29
+ ctx.strokeStyle = 'black'
30
+ ctx.lineWidth = RAILWIDTH * 2
31
+
32
+ ctx.moveTo(0, 0)
33
+ ctx.lineTo(0, height)
34
+ ctx.moveTo(width, 0)
35
+ ctx.lineTo(width, height)
36
+ ctx.stroke()
37
+
38
+ // draw body
39
+ ctx.beginPath()
40
+
41
+ ctx.strokeStyle = this.auxColor!
42
+ ctx.fillStyle = this.statusColor!
43
+ ctx.lineWidth = 1
44
+ ctx.lineCap = 'round'
45
+ ctx.setLineDash([])
46
+
47
+ const radius = Math.round(Math.min(width, height) * 0.1)
48
+
49
+ ctx.roundRect(RAILWIDTH / 2, RAILWIDTH / 2, width - RAILWIDTH, height - RAILWIDTH, radius)
50
+ ctx.fill()
51
+
52
+ ctx.beginPath()
53
+ ctx.roundRect(0, RAILWIDTH, width, RAILWIDTH, radius)
54
+ ctx.roundRect(0, height - RAILWIDTH * 2, width, RAILWIDTH, radius)
55
+
56
+ ctx.fill()
57
+ ctx.stroke()
58
+
59
+ ctx.translate(-left, -top)
60
+
61
+ this.renderDirection(ctx)
62
+ }
63
+ }
64
+
65
+ Component.register('Shuttle', Shuttle)
@@ -0,0 +1,220 @@
1
+ import { Component, ComponentNature, POSITION, Properties, RectPath, Shape } from '@hatiolab/things-scene'
2
+ import { MCSStatusMixin } from './features/mcs-status-mixin'
3
+ import { LEGEND_CAPACITY, Legend } from './features/mcs-status-default'
4
+ import { safeRound } from './utils/safe-round'
5
+ import { getVaueOnRanges } from './utils/get-value-on-ranges'
6
+
7
+ const NATURE: ComponentNature = {
8
+ mutable: false,
9
+ resizable: true,
10
+ rotatable: true,
11
+ properties: [
12
+ {
13
+ type: 'number',
14
+ name: 'currentUsage',
15
+ label: 'current-usage'
16
+ },
17
+ {
18
+ type: 'number',
19
+ name: 'highWatermark',
20
+ label: 'high-watermark'
21
+ },
22
+ {
23
+ type: 'number',
24
+ name: 'maxCapacity',
25
+ label: 'max-capacity'
26
+ },
27
+ {
28
+ type: 'number',
29
+ label: 'round',
30
+ name: 'round',
31
+ property: {
32
+ min: 0
33
+ }
34
+ },
35
+ {
36
+ type: 'hidden',
37
+ name: 'usage',
38
+ label: 'usage'
39
+ }
40
+ ],
41
+ 'value-property': 'usage'
42
+ }
43
+
44
+ var controlHandler = {
45
+ ondragmove: function (point: POSITION, index: number, component: Component) {
46
+ var { left, top, width, height } = component.model
47
+
48
+ var transcoorded = component.transcoordP2S(point.x, point.y)
49
+ var round = ((transcoorded.x - left) / (width / 2)) * 100
50
+
51
+ round = safeRound(round, width, height)
52
+
53
+ component.set({
54
+ round
55
+ })
56
+ }
57
+ }
58
+
59
+ export default class StockerCapacityBar extends MCSStatusMixin(RectPath(Shape)) {
60
+ static get nature() {
61
+ return NATURE
62
+ }
63
+
64
+ get controls() {
65
+ var { left, top, width, round, height } = this.state
66
+ round = round == undefined ? 0 : safeRound(round, width, height)
67
+
68
+ return [
69
+ {
70
+ x: left + (width / 2) * (round / 100),
71
+ y: top,
72
+ handler: controlHandler
73
+ }
74
+ ]
75
+ }
76
+
77
+ getTheme() {
78
+ const { legendName } = this.state
79
+
80
+ if (legendName) {
81
+ return (this.root as any)?.style?.[legendName]
82
+ }
83
+ }
84
+
85
+ get legend(): Legend {
86
+ return this.getTheme() || this.getLegendFallback()
87
+ }
88
+
89
+ getLegendFallback() {
90
+ return LEGEND_CAPACITY
91
+ }
92
+
93
+ get statusColor() {
94
+ return getVaueOnRanges(this.usage, this.legend)
95
+ }
96
+
97
+ get text() {
98
+ return this.usage + '%'
99
+ }
100
+
101
+ render(context: CanvasRenderingContext2D) {
102
+ const { left, top, width, height } = this.bounds
103
+
104
+ if (width >= height) {
105
+ this.renderLandscape(context)
106
+ } else {
107
+ this.renderPortrait(context)
108
+ }
109
+ }
110
+
111
+ renderLandscape(context: CanvasRenderingContext2D) {
112
+ const { left, top, width, height } = this.bounds
113
+ const { lineWidth, strokeStyle, round, fillStyle = '#aaa' } = this.state
114
+
115
+ context.strokeStyle = strokeStyle
116
+ context.lineWidth = lineWidth
117
+
118
+ context.save()
119
+ context.translate(left, top)
120
+
121
+ // gauge background
122
+ context.beginPath()
123
+
124
+ context.fillStyle = fillStyle
125
+ context.roundRect(0, 0, width, height, round)
126
+
127
+ context.fill()
128
+ context.stroke()
129
+
130
+ context.clip()
131
+
132
+ // gauge foreground
133
+ context.beginPath()
134
+
135
+ context.fillStyle = this.statusColor!
136
+
137
+ context.rect(0, 0, (width / 100) * this.usage, height)
138
+ context.fill()
139
+
140
+ context.beginPath()
141
+ context.strokeStyle = strokeStyle
142
+ context.roundRect(0, 0, width, height, round)
143
+ context.stroke()
144
+
145
+ context.beginPath()
146
+
147
+ context.translate(-left, -top)
148
+ context.restore()
149
+ }
150
+
151
+ renderPortrait(context: CanvasRenderingContext2D) {
152
+ const { left, top, width, height } = this.bounds
153
+ const { lineWidth, strokeStyle, round, fillStyle } = this.state
154
+
155
+ context.strokeStyle = strokeStyle
156
+ context.lineWidth = lineWidth
157
+
158
+ context.save()
159
+ context.translate(left, top)
160
+
161
+ // gauge background
162
+ context.beginPath()
163
+
164
+ context.fillStyle = fillStyle
165
+ context.roundRect(0, 0, width, height, round)
166
+
167
+ context.fill()
168
+ context.stroke()
169
+
170
+ context.clip()
171
+
172
+ // gauge foreground
173
+ context.beginPath()
174
+
175
+ context.fillStyle = this.statusColor!
176
+
177
+ context.rect(0, height - (height / 100) * this.usage, width, (height / 100) * this.usage)
178
+ context.fill()
179
+
180
+ context.beginPath()
181
+ context.roundRect(0, 0, width, height, round)
182
+ context.stroke()
183
+
184
+ context.beginPath()
185
+
186
+ context.translate(-left, -top)
187
+ context.restore()
188
+ }
189
+
190
+ get usage() {
191
+ const { currentUsage = 0, maxCapacity = 100 } = this.state
192
+ return Math.round((currentUsage / maxCapacity) * 100)
193
+ }
194
+
195
+ set usage(usage: number) {
196
+ // intentionally have done nothing
197
+ }
198
+
199
+ onchangeData(after: Properties, before: Properties): void {
200
+ const {
201
+ CURRENTCAPACITY = 0,
202
+ MAXCAPACITY = 100,
203
+ HIGHWATERMARK = 100
204
+ } = typeof this.data == 'object' ? this.data : {}
205
+
206
+ const currentUsage = Number(CURRENTCAPACITY) || 0
207
+ const maxCapacity = Number(MAXCAPACITY) || 100
208
+ const highWatermark = Number(HIGHWATERMARK) || 100
209
+
210
+ this.setState({
211
+ currentUsage,
212
+ maxCapacity,
213
+ highWatermark,
214
+ usage: Math.round((currentUsage / maxCapacity) * 100)
215
+ })
216
+ }
217
+ }
218
+
219
+ Component.register('StockerCapacityBar', StockerCapacityBar)
220
+ Component.register('MCSGaugeCapacityBar', StockerCapacityBar)
package/src/stocker.ts ADDED
@@ -0,0 +1,45 @@
1
+ import { Component, ComponentNature } from '@hatiolab/things-scene'
2
+ import MCSTransport from './mcs-transport'
3
+
4
+ const NATURE: ComponentNature = {
5
+ mutable: false,
6
+ resizable: true,
7
+ rotatable: true,
8
+ properties: [...MCSTransport.properties]
9
+ }
10
+
11
+ // const capacity = { ko: 'Capacity', en: 'Capacity', zh_CN: '容量' }
12
+
13
+ // export function getLocaleLanguage() {
14
+ // let localeValue
15
+ // let nameOfCookie = 'miipLang' + '='
16
+ // let x = 0
17
+ // while (x <= document.cookie.length) {
18
+ // let y = x + nameOfCookie.length
19
+ // if (document.cookie.substring(x, y) == nameOfCookie) {
20
+ // let endOfCookie
21
+ // if ((endOfCookie = document.cookie.indexOf(';', y)) == -1) endOfCookie = document.cookie.length
22
+ // localeValue = unescape(document.cookie.substring(y, endOfCookie))
23
+ // }
24
+ // x = document.cookie.indexOf(' ', x) + 1
25
+ // if (x == 0) break
26
+ // }
27
+ // return localeValue
28
+ // }
29
+
30
+ export default class Stocker extends MCSTransport {
31
+ static get nature() {
32
+ return NATURE
33
+ }
34
+
35
+ containable(component: Component) {
36
+ return (
37
+ super.containable(component) ||
38
+ ['Crane', 'Shelf', 'Port', 'MCSGaugeCapacityBar', 'StockerCapacityBar', 'ZoneCapacityBar'].includes(
39
+ component.state.type
40
+ )
41
+ )
42
+ }
43
+ }
44
+
45
+ Component.register('STOCKER', Stocker)
@@ -0,0 +1,15 @@
1
+ const agvLine = new URL('../../icons/agv-line.png', import.meta.url).href
2
+
3
+ export default {
4
+ type: 'AGV Line',
5
+ description: 'AGV Line',
6
+ icon: agvLine,
7
+ group: 'ACS',
8
+ model: {
9
+ type: 'AGVLine',
10
+ left: 200,
11
+ top: 100,
12
+ width: 100,
13
+ height: 20
14
+ }
15
+ }
@@ -0,0 +1,15 @@
1
+ const agv = new URL('../../icons/agv.png', import.meta.url).href
2
+
3
+ export default {
4
+ type: 'AGV',
5
+ description: 'Auto Guided Vehicle',
6
+ icon: agv,
7
+ group: 'ACS',
8
+ model: {
9
+ type: 'AGV',
10
+ left: 100,
11
+ top: 100,
12
+ width: 20,
13
+ height: 20
14
+ }
15
+ }
@@ -0,0 +1,15 @@
1
+ const buffer = new URL('../../icons/buffer.png', import.meta.url).href
2
+
3
+ export default {
4
+ type: 'Buffer',
5
+ description: 'Buffer',
6
+ icon: buffer,
7
+ group: 'BCS',
8
+ model: {
9
+ type: 'Buffer',
10
+ left: 100,
11
+ top: 100,
12
+ width: 30,
13
+ height: 30
14
+ }
15
+ }
@@ -0,0 +1,18 @@
1
+ const conveyor = new URL('../../icons/conveyor.png', import.meta.url).href
2
+
3
+ export default {
4
+ type: 'Conveyor',
5
+ description: 'Conveyor',
6
+ icon: conveyor,
7
+ group: 'CCS',
8
+ model: {
9
+ type: 'Conveyor',
10
+ left: 100,
11
+ top: 100,
12
+ width: 100,
13
+ height: 20,
14
+ lineWidth: 1,
15
+ strokeStyle: 'black',
16
+ rollWidth: 12
17
+ }
18
+ }
@@ -0,0 +1,15 @@
1
+ const crane = new URL('../../icons/crane.png', import.meta.url).href
2
+
3
+ export default {
4
+ type: 'Crane',
5
+ description: 'Crane',
6
+ icon: crane,
7
+ group: 'SCS',
8
+ model: {
9
+ type: 'Crane',
10
+ left: 100,
11
+ top: 100,
12
+ width: 20,
13
+ height: 20
14
+ }
15
+ }
@@ -0,0 +1,16 @@
1
+ const icon = new URL('../../icons/icon-data-subscription.png', import.meta.url).href
2
+
3
+ export default {
4
+ type: 'data-subscription',
5
+ description: 'data-subscription',
6
+ group: 'etc',
7
+ icon,
8
+ model: {
9
+ type: 'data-subscription',
10
+ left: 10,
11
+ top: 10,
12
+ width: 100,
13
+ height: 100,
14
+ hidden: true
15
+ }
16
+ }
@@ -0,0 +1,15 @@
1
+ const equipment = new URL('../../icons/equipment.png', import.meta.url).href
2
+
3
+ export default {
4
+ type: 'Equipment',
5
+ description: 'Equipment',
6
+ icon: equipment,
7
+ group: 'ECS',
8
+ model: {
9
+ type: 'Equipment',
10
+ left: 100,
11
+ top: 100,
12
+ width: 40,
13
+ height: 30
14
+ }
15
+ }
@@ -0,0 +1,43 @@
1
+ // import StockerCapacityCircle from './stocker-capacity-circle'
2
+ import StockerCapacityBar from './stocker-capacity-bar'
3
+ import ZoneCapacityBar from './zone-capacity-bar'
4
+
5
+ import AGV from './agv'
6
+ import Buffer from './buffer'
7
+ import Equipment from './equipment'
8
+ import OHT from './oht'
9
+ import Stocker from './stocker'
10
+
11
+ import Shuttle from './shuttle'
12
+ import Port from './port'
13
+ import Crane from './crane'
14
+ import Shelf from './shelf'
15
+
16
+ import agvLine from './agv-line'
17
+ import ohtLine from './oht-line'
18
+ import conveyor from './conveyor'
19
+
20
+ import DataSubscription from './data-subscription'
21
+
22
+ export default [
23
+ DataSubscription,
24
+
25
+ // StockerCapacityCircle,
26
+ StockerCapacityBar,
27
+ ZoneCapacityBar,
28
+
29
+ Buffer,
30
+ Stocker,
31
+ Equipment,
32
+
33
+ agvLine,
34
+ ohtLine,
35
+ conveyor,
36
+
37
+ AGV,
38
+ OHT,
39
+ Shuttle,
40
+ Crane,
41
+ Shelf,
42
+ Port
43
+ ]
@@ -0,0 +1,15 @@
1
+ const ohtLine = new URL('../../icons/oht-line.png', import.meta.url).href
2
+
3
+ export default {
4
+ type: 'OHT Line',
5
+ description: 'OHT Line',
6
+ icon: ohtLine,
7
+ group: 'OCS',
8
+ model: {
9
+ type: 'OHTLine',
10
+ left: 200,
11
+ top: 100,
12
+ width: 100,
13
+ height: 20
14
+ }
15
+ }