{
  "custom": {},
  "params": {
    "configuring": false,
    "equipmentPath": "",
    "title": "Current Schedule Count"
  },
  "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"
      },
      "paramDirection": "input",
      "persistent": true
    },
    "params.equipmentPath": {
      "paramDirection": "inout",
      "persistent": true
    },
    "params.title": {
      "paramDirection": "inout",
      "persistent": true
    }
  },
  "props": {
    "defaultSize": {
      "height": 305,
      "width": 597
    }
  },
  "root": {
    "children": [
      {
        "meta": {
          "name": "configuration"
        },
        "position": {
          "basis": "320px",
          "grow": 1
        },
        "propConfig": {
          "position.display": {
            "binding": {
              "config": {
                "path": "view.params.configuring"
              },
              "type": "property"
            }
          }
        },
        "props": {
          "params": {
            "equipmentPathIn": "New Enterprise\\Site 1\\Area 1\\Packaging Line 1",
            "equipmentPathOut": "",
            "titleIn": "Current Schedule Count",
            "titleOut": "Current Schedule Count"
          },
          "path": "Page/Widgets/Configuration/Equipment Path, Title"
        },
        "type": "ia.display.view"
      },
      {
        "children": [
          {
            "meta": {
              "name": "title"
            },
            "position": {
              "shrink": 0
            },
            "propConfig": {
              "position.display": {
                "binding": {
                  "config": {
                    "expression": "coalesce({view.params.title},\u0027\u0027)!\u003d\u0027\u0027"
                  },
                  "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": "UnitsSimpleGauge"
                },
                "position": {
                  "height": "60%",
                  "width": "100%",
                  "y": "30%"
                },
                "propConfig": {
                  "props.maxValue": {
                    "binding": {
                      "config": {
                        "expression": "{parent.custom.scheduled}"
                      },
                      "type": "expr"
                    }
                  },
                  "props.value": {
                    "binding": {
                      "config": {
                        "expression": "{parent.custom.made}"
                      },
                      "type": "expr"
                    }
                  }
                },
                "props": {
                  "animate": true,
                  "arc": {
                    "color": "#55A139",
                    "width": 10
                  },
                  "label": {
                    "maxDecimal": 0,
                    "size": 15,
                    "visible": false
                  },
                  "style": {
                    "classes": []
                  }
                },
                "type": "ia.chart.simple-gauge"
              },
              {
                "meta": {
                  "name": "ScheduledLabel"
                },
                "position": {
                  "height": "30px",
                  "width": "60%",
                  "x": "20%",
                  "y": "80%"
                },
                "propConfig": {
                  "props.text": {
                    "binding": {
                      "config": {
                        "expression": "{parent.custom.scheduled}"
                      },
                      "transforms": [
                        {
                          "code": "\tif value is None:\n\t\treturn \"NULL\"\n\telif value \u003d\u003d 0:\n\t\treturn \"Zero Units Scheduled\"\n\telse:\n\t\treturn \"{:,}\".format(value) + \" Units Scheduled\"",
                          "type": "script"
                        }
                      ],
                      "type": "expr"
                    }
                  }
                },
                "props": {
                  "style": {
                    "textAlign": "center"
                  }
                },
                "type": "ia.display.label"
              },
              {
                "children": [
                  {
                    "meta": {
                      "name": "madeBoxColor"
                    },
                    "position": {
                      "basis": "20px",
                      "shrink": 0
                    },
                    "props": {
                      "style": {
                        "backgroundColor": "#55A139",
                        "margin": 10
                      }
                    },
                    "type": "ia.container.coord"
                  },
                  {
                    "meta": {
                      "name": "madeLabel"
                    },
                    "position": {
                      "grow": 1,
                      "shrink": 0
                    },
                    "propConfig": {
                      "props.text": {
                        "binding": {
                          "config": {
                            "expression": "if( isGood({..../UnitCoordinateContainer.custom.made}), {..../UnitCoordinateContainer.custom.made}, null)"
                          },
                          "transforms": [
                            {
                              "code": "\t\n\tif value is None:\n\t\treturn \"NULL\"\n\telif value \u003d\u003d 0:\n\t\treturn \"Zero Made\"\n\telse:\n\t\n\t\treturn \"{:,}\".format(value) + \" Made\"",
                              "type": "script"
                            }
                          ],
                          "type": "expr"
                        }
                      }
                    },
                    "props": {
                      "style": {
                        "textAlign": "left"
                      }
                    },
                    "type": "ia.display.label"
                  },
                  {
                    "meta": {
                      "name": "remainingBoxColor"
                    },
                    "position": {
                      "basis": "20px",
                      "shrink": 0
                    },
                    "props": {
                      "style": {
                        "backgroundColor": "#77B6D833",
                        "margin": 10
                      }
                    },
                    "type": "ia.container.coord"
                  },
                  {
                    "meta": {
                      "name": "remainingLabel"
                    },
                    "position": {
                      "grow": 1,
                      "shrink": 0
                    },
                    "propConfig": {
                      "props.text": {
                        "binding": {
                          "config": {
                            "expression": "{..../UnitCoordinateContainer.custom.scheduled} - {..../UnitCoordinateContainer.custom.made}"
                          },
                          "transforms": [
                            {
                              "code": "\t\t\n\tif value is None:\n\t\treturn \"NULL\"\n\telif value \u003d\u003d 0:\n\t\treturn \"Zero Remaining\"\n\telse:\n\t\treturn \"{:,}\".format(value) + \" Remaining\"",
                              "type": "script"
                            }
                          ],
                          "type": "expr"
                        }
                      }
                    },
                    "props": {
                      "style": {
                        "textAlign": "left"
                      }
                    },
                    "type": "ia.display.label"
                  }
                ],
                "meta": {
                  "name": "MRFlexContainer"
                },
                "position": {
                  "height": "40px",
                  "width": "100%",
                  "y": "10%"
                },
                "type": "ia.container.flex"
              }
            ],
            "custom": {
              "made": 206520,
              "scheduled": 200505
            },
            "meta": {
              "name": "UnitCoordinateContainer"
            },
            "position": {
              "display": false,
              "grow": 1
            },
            "type": "ia.container.coord"
          },
          {
            "meta": {
              "name": "mesWorkOrderTable"
            },
            "position": {
              "basis": "500px",
              "display": false
            },
            "props": {
              "selectedRow": 0
            },
            "type": "mes.production.mesWorkOrderTable"
          },
          {
            "children": [
              {
                "meta": {
                  "name": "LeftSpacing"
                },
                "position": {
                  "basis": "20px"
                },
                "propConfig": {
                  "position.grow": {
                    "binding": {
                      "config": {
                        "path": "parent.custom.pos"
                      },
                      "type": "property"
                    }
                  }
                },
                "type": "ia.display.label"
              },
              {
                "meta": {
                  "name": "scheduledLabel"
                },
                "position": {
                  "shrink": 0
                },
                "propConfig": {
                  "props.text": {
                    "binding": {
                      "config": {
                        "expression": "toInteger({..../runtime.custom.Scheduled})"
                      },
                      "transforms": [
                        {
                          "code": "\tif value \u003d\u003d 0:\n\t\treturn  \"Zero Units Scheduled\"\n\telse:\n\t\treturn \"{:,}\".format(value) + \" Units Scheduled\"",
                          "type": "script"
                        }
                      ],
                      "type": "expr"
                    }
                  }
                },
                "type": "ia.display.label"
              },
              {
                "meta": {
                  "name": "RightSpacing"
                },
                "position": {
                  "basis": "20px"
                },
                "propConfig": {
                  "position.grow": {
                    "binding": {
                      "config": {
                        "path": "parent.custom.pos"
                      },
                      "transforms": [
                        {
                          "expression": "1 -{value}",
                          "type": "expression"
                        }
                      ],
                      "type": "property"
                    }
                  }
                },
                "type": "ia.display.label"
              }
            ],
            "custom": {
              "pos": 0.5
            },
            "meta": {
              "name": "FlexContainerScheduled"
            },
            "position": {
              "basis": "40px",
              "shrink": 0
            },
            "type": "ia.container.flex"
          },
          {
            "children": [
              {
                "meta": {
                  "name": "madeBox"
                },
                "position": {
                  "height": "20%",
                  "x": "5%",
                  "y": "40%"
                },
                "propConfig": {
                  "position.width": {
                    "binding": {
                      "config": {
                        "expression": "{..../runtime.custom.Scheduled} + \",\" + {..../runtime.custom.Made} + \",\" +{..../runtime.custom.Remaining}"
                      },
                      "transforms": [
                        {
                          "code": "\tstringArray \u003d value.split(\",\")\n\tScheduled \u003d float(stringArray[0])\n\tMade \u003d float(stringArray[1])\n\tRemaining \u003d float(stringArray[2])\n\t\n\tself.parent.position.display \u003d True\n\t\n\tif Scheduled \u003d\u003d 0:\n\t\tself.parent.parent.getChild(\"FlexContainerScheduled\").custom.pos \u003d 0.5\n\t\tself.parent.parent.getChild(\"FlexContainerMade\").custom.pos \u003d 0.5\n\t\tself.parent.position.display \u003d False\n\t\treturn \"0%\"\n\t\t\n\tif Remaining \u003d\u003d 0:\n\t\tself.getSibling(\"remainingBox\").position.width \u003d \"0%\"\n\t\tself.getSibling(\"MadeStick\").position.x \u003d \"95%\"\n\t\t\n\t\tself.getSibling(\"ScheduledStick\").position.x \u003d \"95%\"\n\t\tself.getSibling(\"ScheduledStick\").position.height \u003d \"50%\"\n\t\tself.parent.parent.getChild(\"FlexContainerScheduled\").custom.pos \u003d 1\n\t\tself.parent.parent.getChild(\"FlexContainerMade\").custom.pos \u003d 1\n\n\t\treturn \"90%\"\n\t\t\n\telif Remaining \u003c\u003d 0:\n\t\tremainingSize \u003d int(abs(Remaining)/Made * 90)\n\t\tself.getSibling(\"remainingBox\").position.width \u003d str(remainingSize) + \"%\"\n\t\tself.getSibling(\"remainingBox\").position.height \u003d \"10%\"\n\t\tself.getSibling(\"remainingBox\").position.x \u003d str(95-remainingSize) + \"%\"\n\t\t\n\t\tself.getSibling(\"MadeStick\").position.x \u003d \"95%\"\n\t\t\n\t\tself.getSibling(\"ScheduledStick\").position.x \u003d str(95-remainingSize - 1)+ \"%\"\n\t\tself.getSibling(\"ScheduledStick\").position.height \u003d \"50%\"\n\t\tself.parent.parent.getChild(\"FlexContainerScheduled\").custom.pos \u003d Scheduled/Made\n\t\tself.parent.parent.getChild(\"FlexContainerMade\").custom.pos \u003d 1\n\n\t\treturn \"90%\"\n\t\n\telse:\n\t\n\t\tremainingSize \u003d int(abs(Remaining)/Scheduled * 90)\n\t\tself.getSibling(\"remainingBox\").position.width \u003d str(remainingSize) + \"%\"\n\t\tself.getSibling(\"remainingBox\").position.height \u003d \"20%\"\n\t\tself.getSibling(\"remainingBox\").position.x \u003d str(95-remainingSize) + \"%\"\n\t\t\n\t\tself.getSibling(\"MadeStick\").position.x \u003d str(95-remainingSize - 1)+\"%\"\n\t\t\n\t\tself.getSibling(\"ScheduledStick\").position.x \u003d \"95%\"\n\t\tself.getSibling(\"ScheduledStick\").position.height \u003d \"60%\"\n\t\tself.parent.parent.getChild(\"FlexContainerScheduled\").custom.pos \u003d 1\n\t\tself.parent.parent.getChild(\"FlexContainerMade\").custom.pos \u003d Made/Scheduled\n\t\n\t\treturn str(int(Made/Scheduled * 90)) + \"%\"",
                          "type": "script"
                        }
                      ],
                      "type": "expr"
                    }
                  }
                },
                "props": {
                  "style": {
                    "classes": "SepasoftColors/Background/PrimaryColor_4C9C2E"
                  }
                },
                "type": "ia.container.coord"
              },
              {
                "meta": {
                  "name": "remainingBox"
                },
                "position": {
                  "height": "10%",
                  "width": "77%",
                  "x": "18%",
                  "y": "40%"
                },
                "props": {
                  "style": {
                    "borderStyle": "none",
                    "classes": "SepasoftColors/Background/SecondaryColor_62CBC9"
                  }
                },
                "type": "ia.container.coord"
              },
              {
                "meta": {
                  "name": "ScheduledStick"
                },
                "position": {
                  "height": "50%",
                  "width": "1%",
                  "x": "17%"
                },
                "props": {
                  "style": {
                    "classes": "SepasoftColors/Background/SecondaryColor_2D2A26"
                  }
                },
                "type": "ia.container.coord"
              },
              {
                "meta": {
                  "name": "MadeStick"
                },
                "position": {
                  "height": "60%",
                  "width": "1%",
                  "x": "95%",
                  "y": "40%"
                },
                "props": {
                  "style": {
                    "classes": "SepasoftColors/Background/SecondaryColor_2D2A26"
                  }
                },
                "type": "ia.container.coord"
              }
            ],
            "meta": {
              "name": "CoordinateContainer"
            },
            "position": {
              "basis": "200px",
              "display": false,
              "grow": 1
            },
            "type": "ia.container.coord"
          },
          {
            "children": [
              {
                "meta": {
                  "name": "LeftSpacing"
                },
                "position": {
                  "basis": "20px"
                },
                "propConfig": {
                  "position.grow": {
                    "binding": {
                      "config": {
                        "path": "parent.custom.pos"
                      },
                      "type": "property"
                    }
                  }
                },
                "type": "ia.display.label"
              },
              {
                "meta": {
                  "name": "ColorFillCoordinateContainer"
                },
                "position": {
                  "basis": "20px",
                  "shrink": 0
                },
                "props": {
                  "style": {
                    "classes": "SepasoftColors/Background/PrimaryColor_4C9C2E",
                    "margin": 10
                  }
                },
                "type": "ia.container.coord"
              },
              {
                "meta": {
                  "name": "MadeLabel"
                },
                "position": {
                  "shrink": 0
                },
                "propConfig": {
                  "props.text": {
                    "binding": {
                      "config": {
                        "expression": "toInteger({..../runtime.custom.Made})"
                      },
                      "transforms": [
                        {
                          "code": "\tif value \u003d\u003d 0:\n\t\treturn  \"Zero Units Made\"\n\telse:\n\t\treturn \"{:,}\".format(value) + \" Units Made\"",
                          "type": "script"
                        }
                      ],
                      "type": "expr"
                    }
                  }
                },
                "type": "ia.display.label"
              },
              {
                "meta": {
                  "name": "RightSpacing"
                },
                "position": {
                  "basis": "20px"
                },
                "propConfig": {
                  "position.grow": {
                    "binding": {
                      "config": {
                        "path": "parent.custom.pos"
                      },
                      "transforms": [
                        {
                          "expression": "1 -{value}",
                          "type": "expression"
                        }
                      ],
                      "type": "property"
                    }
                  }
                },
                "type": "ia.display.label"
              }
            ],
            "custom": {
              "pos": 0.5
            },
            "meta": {
              "name": "FlexContainerMade"
            },
            "position": {
              "basis": "40px",
              "shrink": 0
            },
            "props": {
              "style": {
                "marginBottom": 20
              }
            },
            "type": "ia.container.flex"
          },
          {
            "children": [
              {
                "meta": {
                  "name": "LeftSpacing"
                },
                "position": {
                  "basis": "20px"
                },
                "propConfig": {
                  "position.grow": {
                    "binding": {
                      "config": {
                        "path": "parent.custom.pos"
                      },
                      "type": "property"
                    }
                  }
                },
                "type": "ia.display.label"
              },
              {
                "meta": {
                  "name": "ColorFillCoordinateContainer"
                },
                "position": {
                  "basis": "20px",
                  "shrink": 0
                },
                "props": {
                  "style": {
                    "classes": "SepasoftColors/Background/SecondaryColor_62CBC9",
                    "margin": 10
                  }
                },
                "type": "ia.container.coord"
              },
              {
                "meta": {
                  "name": "RemainingLabel"
                },
                "position": {
                  "shrink": 0
                },
                "propConfig": {
                  "props.text": {
                    "binding": {
                      "config": {
                        "expression": "toInteger({..../runtime.custom.Remaining})"
                      },
                      "transforms": [
                        {
                          "code": "\tif value \u003d\u003d 0:\n\t\treturn  \"Zero Units Remaining\"\n\tif value \u003e 0:\n\t\treturn \"{:,}\".format(value) + \" Units Remaining\"\n\telse:\n\t\treturn \"{:,}\".format(abs(value)) + \" Units Overrun\"",
                          "type": "script"
                        }
                      ],
                      "type": "expr"
                    }
                  }
                },
                "type": "ia.display.label"
              },
              {
                "meta": {
                  "name": "RightSpacing"
                },
                "position": {
                  "basis": "20px"
                },
                "propConfig": {
                  "position.grow": {
                    "binding": {
                      "config": {
                        "path": "parent.custom.pos"
                      },
                      "transforms": [
                        {
                          "expression": "1 -{value}",
                          "type": "expression"
                        }
                      ],
                      "type": "property"
                    }
                  }
                },
                "type": "ia.display.label"
              }
            ],
            "custom": {
              "pos": 0.5
            },
            "meta": {
              "name": "FlexContainerRemaining"
            },
            "position": {
              "basis": "40px",
              "shrink": 0
            },
            "propConfig": {
              "position.display": {
                "binding": {
                  "config": {
                    "expression": "{parent.custom.Remaining} !\u003d 0"
                  },
                  "type": "expr"
                }
              }
            },
            "props": {
              "style": {
                "marginBottom": 20
              }
            },
            "type": "ia.container.flex"
          }
        ],
        "custom": {
          "Remaining": 0,
          "Scheduled": 0
        },
        "meta": {
          "name": "runtime"
        },
        "position": {
          "basis": "200px",
          "grow": 1
        },
        "propConfig": {
          "custom.Made": {
            "binding": {
              "config": {
                "expression": "toStr({./mesWorkOrderTable.props.data}) + \"~\" + toStr({view.params.equipmentPath})"
              },
              "transforms": [
                {
                  "code": "\t#https://help.sepasoft.com/docs/display/SEPA/system.mes.getEquipmentScheduleEntries\n\teqPath \u003d str(value).split(\"~\")[1]\n\t\n\tdef clearValues():\n\t\tself.custom.Scheduled \u003d 0\n\t\tself.custom.Remaining \u003d 0\n\t\treturn 0\t\n\t\t\n\tif eqPath \u003d\u003d \"\":\n\t\treturn clearValues()\n\t\t\n\t\n\t#define the start and end dates\n\tbegin \u003d system.date.addDays(system.date.now(), -100)\n\tend \u003d system.date.addDays(system.date.now(), 100)\n\t  \n\t#let category be \u0027Active\u0027\n\tcategory \u003d \u0027Active\u0027\n\t  \n\t#Gets the equipment schedule entries\n\t#https://help.sepasoft.com/docs/display/SEPA/system.mes.getEquipmentScheduleEntries\n\tlist \u003d system.mes.getEquipmentScheduleEntries(eqPath, begin, end, category, False)\n\t\n\tcurrentSchedule \u003d None\n\t\n\tnow \u003d system.date.now()\n\tfor Schedule in list:\n\t\tStartDate \u003d Schedule.getOriginalStartDate()\n\t\tEndDate \u003d Schedule.getScheduledEndDate()\n\t\tif (system.date.secondsBetween(now, StartDate) \u003c 0 and system.date.secondsBetween(now, EndDate) \u003e 0):\n\t\t\tcurrentSchedule \u003d Schedule\t\n\t\t\tbreak\t\n\t\t\n\tif (currentSchedule is None):\n\t\treturn clearValues()\n\n\t#https://help.sepasoft.com/docs/display/SEPA/MES+Work+Order\n\tWorkOrderLink \u003d currentSchedule.getWorkOrderLink()\n\n\tScheduled \u003d float(WorkOrderLink.getMESObject().getWorkOrderQuantity())#getScheduledQuantity())\n\t\n\tif (Scheduled \u003d\u003d 0):\n\t\treturn clearValues()\n\t\t\t\n\tRemaining \u003d float(WorkOrderLink.getMESObject().getRemainingQuantity())\n\tMade \u003d Scheduled - Remaining\n\t\n\tself.custom.Scheduled \u003d Scheduled\n\tself.custom.Remaining \u003d Remaining\n\t\n\treturn Made",
                  "type": "script"
                }
              ],
              "type": "expr"
            }
          },
          "position.display": {
            "binding": {
              "config": {
                "expression": "!{view.params.configuring}"
              },
              "type": "expr"
            }
          }
        },
        "props": {
          "direction": "column"
        },
        "type": "ia.container.flex"
      }
    ],
    "meta": {
      "name": "root"
    },
    "props": {
      "direction": "column"
    },
    "type": "ia.container.flex"
  }
}