{
  "info": "wos/fastems_new_order.json",
  "info2": "NOTE: parameters to this query comes from dialog/fastems/fastems_default.json",
  "database": "4d",
  "parameter": {
    "rough_load_group": "FMS-SOLU",
    "work_order_open_state": ["EK", "KU", "AL"],
    "show_sql": false
  },
  "query": [
    ["pr_parcel_code", "=", "rough_load_group"], "and",
    ["wo_state", "in", "work_order_open_state"]
  ],
  "filter": [
    [
      "if", [["not", ["prevRec", "is empty"]], "or", [["rec.wlg_rough_load_group", "<>", "fmsPrf.rough_load_group"]]],
      [
        ["prevRec", "=", "rec"]
      ],
      "else",
      [
        [
          "if", [["prevRec.wos_production_lot", "=", "rec.wos_production_lot"], "and", ["prevRec.wos_state", "<", "1"], "and", ["prevRec.wos_produced_amount", ">", "0"]],
          [
            ["filter_value", "=", "true"]
          ]
        ]
      ]
    ],
    ["filter_value", "=", "false"]
  ],
  "field": [
    "wos_production_lot",
    "wos_production_lot__work_ph",
    "wos_produced_amount",
    "wos_state",
    "wlg_rough_load_group"
  ]
}
