{
  "custom": {},
  "params": {
    "configuring": false,
    "equipmentPath": "New Enterprise\\Site 1\\Simulation Area\\Simulation Line",
    "multi": false,
    "title": "Run Control"
  },
  "propConfig": {
    "params.configuring": {
      "onChange": {
        "enabled": null,
        "script": "\tviewParams\u003dself.params\n\tconfigParams\u003dself.getChild(\"root/configuration\").props.params\n\tif currentValue.value:\n\t\tconfigParams.equipmentPathIn \u003d viewParams.equipmentPath\t\n\t\tconfigParams.titleIn \u003d viewParams.title\n\telif previousValue is not None and previousValue.value:\n\t\tviewParams.equipmentPath \u003d configParams.equipmentPathOut\n\t\tviewParams.title \u003d configParams.titleOut\n\t\tself.getChild(\"root\").getChild(\"runtime\").getChild(\"drp_Materials\").getAvailableMaterials(viewParams.equipmentPath)"
      },
      "paramDirection": "input",
      "persistent": true
    },
    "params.equipmentPath": {
      "onChange": {
        "enabled": null,
        "script": "\tif len(currentValue.value) !\u003d 0:\n\t\tself.params.multi\u003d system.mes.loadMESObjectByEquipmentPath(currentValue.value).isMultiOperationCapable()\n\t\tself.getChild(\"root\").getChild(\"runtime\").getChild(\"drp_Materials\").custom.updateRate \u003d system.date.now()\n\telse:\n\t\tself.params.multi\u003d False"
      },
      "paramDirection": "inout",
      "persistent": true
    },
    "params.multi": {
      "paramDirection": "input",
      "persistent": true
    },
    "params.title": {
      "paramDirection": "inout",
      "persistent": true
    }
  },
  "props": {
    "defaultSize": {
      "height": 272,
      "width": 451
    }
  },
  "root": {
    "children": [
      {
        "meta": {
          "name": "Widget Title"
        },
        "position": {
          "height": 0.1034,
          "width": 1
        },
        "propConfig": {
          "meta.visible": {
            "binding": {
              "config": {
                "expression": "!{view.params.configuring}"
              },
              "type": "expr"
            }
          },
          "props.params.text": {
            "binding": {
              "config": {
                "path": "view.params.title"
              },
              "type": "property"
            }
          }
        },
        "props": {
          "path": "Page/Embedded/Widget Title"
        },
        "type": "ia.display.view"
      },
      {
        "children": [
          {
            "meta": {
              "name": "Label"
            },
            "position": {
              "height": 0.2,
              "width": 0.9535,
              "x": 0.0256,
              "y": -0.0057
            },
            "propConfig": {
              "props.style.fontSize": {
                "binding": {
                  "config": {
                    "path": "page.props.dimensions.screen.width"
                  },
                  "transforms": [
                    {
                      "code": "\tif(value \u003e\u003d600 and value\u003c1300):\n\t\treturn 12\n\telif (value \u003e\u003d1300 and value\u003c\u003d1580):\n\t\treturn 14\n\telif(value \u003e 1580):\n\t\treturn 18\n\telse:\n\t\treturn 6",
                      "type": "script"
                    }
                  ],
                  "type": "property"
                }
              },
              "props.text": {
                "binding": {
                  "config": {
                    "path": "view.params.equipmentPath"
                  },
                  "transforms": [
                    {
                      "code": "\tif value \u003d\u003d \"\" or value is None:\n\t\treturn \"\"\n\t\n\treturn value.split(\u0027\\\\\u0027)[3]",
                      "type": "script"
                    }
                  ],
                  "type": "property"
                }
              }
            },
            "props": {
              "alignVertical": "bottom",
              "style": {
                "fontFamily": "Roboto",
                "fontWeight": "bold",
                "marginBottom": 5,
                "marginTop": 10,
                "overflow": "auto",
                "overflowX": "auto",
                "overflowY": "auto",
                "textAlign": "center"
              }
            },
            "type": "ia.display.label"
          },
          {
            "meta": {
              "name": "drp_Materials"
            },
            "position": {
              "height": 0.177,
              "width": 0.9535,
              "x": 0.0257,
              "y": 0.2164
            },
            "propConfig": {
              "custom.updateRate": {
                "binding": {
                  "config": {
                    "expression": "now(10000)"
                  },
                  "type": "expr"
                },
                "onChange": {
                  "enabled": null,
                  "script": "\tif self.view.params.equipmentPath:\n\t\tself.getAvailableMaterials(self.view.params.equipmentPath)"
                }
              },
              "props.options": {
                "persistent": false
              },
              "props.style.fontSize": {
                "binding": {
                  "config": {
                    "path": "page.props.dimensions.screen.width"
                  },
                  "transforms": [
                    {
                      "code": "\tif(value \u003e\u003d600 and value\u003c1300):\n\t\treturn 8\n\telif (value \u003e\u003d1300 and value\u003c\u003d1580):\n\t\treturn 12\n\telif(value \u003e 1580):\n\t\treturn 15\n\telse:\n\t\treturn 6",
                      "type": "script"
                    }
                  ],
                  "type": "property"
                }
              }
            },
            "props": {
              "placeholder": {
                "icon": {
                  "style": {
                    "textAlign": "center"
                  }
                },
                "text": "Select Material"
              },
              "style": {
                "fontFamily": "Roboto",
                "marginBottom": 10,
                "marginTop": 10,
                "paddingBottom": 5,
                "paddingLeft": 15,
                "paddingRight": 15,
                "paddingTop": 5,
                "textAlign": "center"
              }
            },
            "scripts": {
              "customMethods": [
                {
                  "name": "getAvailableMaterials",
                  "params": [
                    "eqPath"
                  ],
                  "script": "\toptions \u003d []\n\tlist \u003d system.mes.oee.getEquipmentAvailableMaterial(eqPath, \u0027*\u0027)\n\tfor matLink in list:\n\t\toptions.append({\u0027value\u0027:matLink.getName(),\u0027label\u0027:matLink.getName()})\n\tself.props.options \u003d options"
                }
              ],
              "extensionFunctions": null,
              "messageHandlers": []
            },
            "type": "ia.input.dropdown"
          },
          {
            "events": {
              "component": {
                "onActionPerformed": {
                  "config": {
                    "script": "\tlinePath \u003d self.view.params.equipmentPath\n\tmaterial \u003d self.getSibling(\"drp_Materials\").props.value\n\tshared.simulation.Production.startProduction(linePath, material)"
                  },
                  "scope": "G",
                  "type": "script"
                }
              }
            },
            "meta": {
              "name": "btn_begin"
            },
            "position": {
              "height": 0.177,
              "width": 0.9535,
              "x": 0.0257,
              "y": 0.4958
            },
            "propConfig": {
              "props.enabled": {
                "binding": {
                  "config": {
                    "fallbackDelay": 2.5,
                    "mode": "expression",
                    "tagPath": "concat(\"[MES]/\",replace({view.params.equipmentPath},\"\\\\\",\"/\"),\"/Live Analysis/Current Shift/Equipment Mode Type\")"
                  },
                  "transforms": [
                    {
                      "code": "\t\n\tif(not(self.view.params.multi)):\n\t\tif(value \u003d\u003d \"Production\" or value \u003d\u003d \"Changeover\"):\n\t\t\treturn False\n\t\telse:\n\t\t\treturn True\n\telse:\n\t\treturn True",
                      "type": "script"
                    }
                  ],
                  "type": "tag"
                }
              },
              "props.textStyle.fontSize": {
                "binding": {
                  "config": {
                    "path": "page.props.dimensions.screen.width"
                  },
                  "transforms": [
                    {
                      "code": "\tif(value \u003e\u003d600 and value\u003c1300):\n\t\treturn 14\n\telif (value \u003e\u003d1300 and value\u003c\u003d1580):\n\t\treturn 16\n\telif(value \u003e 1580):\n\t\treturn 18\n\telif(value \u003d\u003d 0):\n\t\treturn 18\n\telse:\n\t\treturn 10",
                      "type": "script"
                    }
                  ],
                  "type": "property"
                }
              }
            },
            "props": {
              "style": {
                "classes": "Buttons/Large_Button",
                "height": "64px",
                "width": "100px"
              },
              "text": "Begin OEE Run"
            },
            "type": "ia.input.button"
          },
          {
            "events": {
              "component": {
                "onActionPerformed": {
                  "config": {
                    "script": "\tlinePath \u003d self.view.params.equipmentPath\n\tshared.simulation.Production.endProduction(linePath)"
                  },
                  "scope": "G",
                  "type": "script"
                }
              }
            },
            "meta": {
              "name": "btn_endProd"
            },
            "position": {
              "height": 0.177,
              "width": 0.9564,
              "x": 0.0234,
              "y": 0.7384
            },
            "propConfig": {
              "props.enabled": {
                "binding": {
                  "config": {
                    "fallbackDelay": 2.5,
                    "mode": "expression",
                    "tagPath": "concat(\u0027[MES]\u0027,replace({view.params.equipmentPath},\u0027\\\\\u0027,\u0027/\u0027),\u0027/Live Analysis/Current Shift/Equipment Mode Type\u0027)"
                  },
                  "transforms": [
                    {
                      "code": "\tif value \u003d\u003d \u0027Production\u0027:\n\t\treturn True\n\telse:\n\t\treturn False",
                      "type": "script"
                    }
                  ],
                  "type": "tag"
                }
              },
              "props.textStyle.fontSize": {
                "binding": {
                  "config": {
                    "path": "page.props.dimensions.screen.width"
                  },
                  "transforms": [
                    {
                      "code": "\tif(value \u003e\u003d600 and value\u003c1300):\n\t\treturn 14\n\telif (value \u003e\u003d1300 and value\u003c\u003d1580):\n\t\treturn 16\n\telif(value \u003e 1580):\n\t\treturn 18\n\telif(value \u003d\u003d 0):\n\t\treturn 18\n\telse:\n\t\treturn 10",
                      "type": "script"
                    }
                  ],
                  "type": "property"
                }
              }
            },
            "props": {
              "style": {
                "classes": "Buttons/Large_Button",
                "height": "64px",
                "width": "100px"
              },
              "text": "End Production"
            },
            "type": "ia.input.button"
          }
        ],
        "meta": {
          "name": "runtime"
        },
        "position": {
          "height": 0.8929,
          "width": 0.9938,
          "x": 0.0049,
          "y": 0.1049
        },
        "propConfig": {
          "meta.visible": {
            "binding": {
              "config": {
                "expression": "!{view.params.configuring}"
              },
              "type": "expr"
            }
          }
        },
        "props": {
          "mode": "percent"
        },
        "type": "ia.container.coord"
      },
      {
        "meta": {
          "name": "configuration"
        },
        "position": {
          "height": 1,
          "width": 1
        },
        "propConfig": {
          "meta.visible": {
            "binding": {
              "config": {
                "path": "view.params.configuring"
              },
              "type": "property"
            }
          }
        },
        "props": {
          "params": {
            "equipmentPathIn": "",
            "equipmentPathOut": "",
            "titleIn": "",
            "titleOut": ""
          },
          "path": "Page/Widgets/Configuration/Equipment Path, Title"
        },
        "type": "ia.display.view"
      }
    ],
    "meta": {
      "name": "root"
    },
    "props": {
      "mode": "percent"
    },
    "scripts": {
      "customMethods": [],
      "extensionFunctions": null,
      "messageHandlers": [
        {
          "messageType": "startNewOperation",
          "pageScope": true,
          "script": "\n\tsystem.mes.oee.beginOEERun(payload[\"material\"], payload[\"eqPath\"])\n\topUUIDDate \u003d system.mes.getTagCollectorLastTimeStamp(payload[\"eqPath\"], \u0027Equipment Operation UUID\u0027, \u0027\u0027)\n\tsystem.mes.addTagCollectorValue(payload[\"eqPath\"], \u0027Equipment Schedule Count\u0027, \u0027\u0027,opUUIDDate, payload[\"amount\"])",
          "sessionScope": false,
          "viewScope": false
        },
        {
          "messageType": "endMultipleOperations",
          "pageScope": true,
          "script": "\timport time\n\tlineCells \u003dsystem.mes.loadMESObjectByEquipmentPath(payload[\"eqPath\"]).getChildEquipment()\n\tlastCell \u003d lineCells[len(lineCells)-1].getEquipmentPath()\n\t\n\twhile(not(system.mes.oee.isPreviousProductIndexed(payload[\"eqPath\"]))):\n\t\tsystem.mes.oee.indexCellProduct(lastCell,True)\n\t\ttime.sleep(1)\n\tsystem.mes.oee.endOEEProduction(payload[\"eqPath\"])",
          "sessionScope": false,
          "viewScope": false
        }
      ]
    },
    "type": "ia.container.coord"
  }
}