Пример #1
0
    def getData(timestamp, cluster=-1):
        import frepple

        for i in frepple.resources():
            if cluster != -1 and cluster != i.cluster:
                continue
            for j in i.loadplans:
                if j.quantity >= 0:
                    continue
                elif not j.operationplan.reference:
                    logger.warn(
                        "Warning: skip exporting uninitialized operationplan: %s %s %s %s"
                        % (
                            j.operationplan.operation.name,
                            j.operationplan.quantity,
                            j.operationplan.start,
                            j.operationplan.end,
                        ))
                else:
                    yield "%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\n" % (
                        clean_value(j.operationplan.reference),
                        clean_value(j.resource.name),
                        round(-j.quantity, 8),
                        str(j.startdate),
                        str(j.enddate),
                        clean_value(j.setup),
                        j.status,
                        timestamp,
                    )
Пример #2
0
    def getData(timestamp, cluster=-1):
        import frepple

        for i in frepple.buffers():
            if cluster != -1 and cluster != i.cluster:
                continue
            for j in i.flowplans:
                if not j.quantity:
                    continue
                elif not j.operationplan.reference:
                    logger.error(
                        "Warning: skip exporting uninitialized operationplan %s %s %s %s"
                        % (
                            j.operationplan.operation.name,
                            j.operationplan.quantity,
                            j.operationplan.start,
                            j.operationplan.end,
                        ))
                else:
                    yield "%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\n" % (
                        clean_value(j.operationplan.reference),
                        clean_value(j.buffer.item.name),
                        clean_value(j.buffer.location.name),
                        round(j.quantity, 8),
                        str(j.date),
                        round(j.onhand, 8),
                        round(j.minimum, 8),
                        round(j.period_of_cover, 8),
                        j.status,
                        timestamp,
                    )
Пример #3
0
    def getData(cluster=-1):
        import frepple

        for i in frepple.problems():
            if isinstance(i.owner, frepple.operationplan):
                owner = i.owner.operation
            else:
                owner = i.owner
            if cluster != -1 and owner.cluster != cluster:
                continue
            yield "%s\v%s\v%s\v%s\v%s\v%s\v%s\n" % (
                clean_value(i.entity),
                clean_value(i.name),
                clean_value(owner.name),
                clean_value(i.description),
                str(i.start),
                str(i.end),
                round(i.weight, 8),
            )
Пример #4
0
 def getData():
     # Loop over all reporting buckets of all resources
     for i in frepple.resources():
         for j in i.plan(buckets):
             yield "%s\v%s\v%s\v%s\v%s\v%s\v%s\n" % (
                 clean_value(i.name),
                 str(j["start"]),
                 round(j["available"], 8),
                 round(j["unavailable"], 8),
                 round(j["setup"], 8),
                 round(j["load"], 8),
                 round(j["free"], 8),
             )
Пример #5
0
    def getData(cluster=-1):
        import frepple

        for d in frepple.demands():
            if cluster != -1 and cluster != d.cluster:
                continue
            for i in d.constraints:
                yield "%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\n" % (
                    clean_value(d.name)
                    if isinstance(d, frepple.demand_default) else "\\N",
                    "\\N" if isinstance(d, frepple.demand_default) else
                    clean_value(d.owner.name),
                    clean_value(d.item.name),
                    clean_value(i.entity),
                    clean_value(i.name),
                    isinstance(i.owner, frepple.operationplan) and clean_value(
                        i.owner.operation.name) or clean_value(i.owner.name),
                    clean_value(i.description),
                    str(i.start),
                    str(i.end),
                    round(i.weight, 8),
                )
Пример #6
0
    def getData(cls, timestamp, cluster=-1):
        import frepple

        for i in frepple.operations():
            if cluster != -1 and cluster != i.cluster:
                continue

            # variable used to make sure only first proposed operationplan has its color set.
            proposedFound = False
            proposedFoundDate = None

            for j in i.operationplans:
                delay = j.delay
                status = j.status
                color = 100 - delay / 86400

                if isinstance(i, frepple.operation_inventory):
                    # Export inventory
                    yield "%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\n" % (
                        clean_value(i.name),
                        "STCK",
                        status,
                        round(j.quantity, 8),
                        str(j.start),
                        str(j.end),
                        round(j.criticality, 8),
                        j.delay,
                        cls.getPegging(j),
                        clean_value(j.source),
                        timestamp,
                        "\\N",
                        clean_value(j.owner.reference)
                        if j.owner and not j.owner.operation.hidden else "\\N",
                        clean_value(j.operation.buffer.item.name),
                        clean_value(j.operation.buffer.location.name),
                        "\\N",
                        "\\N",
                        "\\N",
                        clean_value(j.demand.name)
                        if j.demand else clean_value(j.owner.demand.name)
                        if j.owner and j.owner.demand else "\\N",
                        j.demand.due if j.demand else j.owner.demand.due
                        if j.owner and j.owner.demand else "\\N",
                        "\\N",  # color is empty for stock
                        clean_value(j.reference),
                        clean_value(j.batch),
                    )
                elif isinstance(i, frepple.operation_itemdistribution):
                    # Export DO
                    yield "%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\n" % (
                        clean_value(i.name),
                        "DO",
                        status,
                        round(j.quantity, 8),
                        str(j.start),
                        str(j.end),
                        round(j.criticality, 8),
                        j.delay,
                        cls.getPegging(j),
                        clean_value(j.source),
                        timestamp,
                        "\\N",
                        clean_value(j.owner.reference)
                        if j.owner and not j.owner.operation.hidden else "\\N",
                        clean_value(j.operation.destination.item.name)
                        if j.operation.destination else
                        j.operation.origin.item.name,
                        clean_value(j.operation.destination.location.name)
                        if j.operation.destination else "\\N",
                        clean_value(j.operation.origin.location.name)
                        if j.operation.origin else "\\N",
                        "\\N",
                        "\\N",
                        clean_value(j.demand.name)
                        if j.demand else clean_value(j.owner.demand.name)
                        if j.owner and j.owner.demand else "\\N",
                        j.demand.due if j.demand else j.owner.demand.due
                        if j.owner and j.owner.demand else "\\N",
                        color if
                        (proposedFound is False and status == "proposed") or
                        (status == "proposed" and j.start == proposedFoundDate)
                        or status in ("confirmed",
                                      "approved") else "\\N",  # color
                        clean_value(j.reference),
                        clean_value(j.batch),
                    )
                elif isinstance(i, frepple.operation_itemsupplier):
                    # Export PO
                    yield "%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\n" % (
                        clean_value(i.name),
                        "PO",
                        status,
                        round(j.quantity, 8),
                        str(j.start),
                        str(j.end),
                        round(j.criticality, 8),
                        j.delay,
                        cls.getPegging(j),
                        clean_value(j.source),
                        timestamp,
                        "\\N",
                        clean_value(j.owner.reference)
                        if j.owner and not j.owner.operation.hidden else "\\N",
                        clean_value(j.operation.buffer.item.name),
                        "\\N",
                        "\\N",
                        clean_value(j.operation.buffer.location.name),
                        clean_value(j.operation.itemsupplier.supplier.name),
                        clean_value(j.demand.name)
                        if j.demand else clean_value(j.owner.demand.name)
                        if j.owner and j.owner.demand else "\\N",
                        j.demand.due if j.demand else j.owner.demand.due
                        if j.owner and j.owner.demand else "\\N",
                        color if
                        (proposedFound is False and status == "proposed") or
                        (status == "proposed" and j.start == proposedFoundDate)
                        or status in ("confirmed", "approved") else
                        "\\N",  # color
                        clean_value(j.reference),
                        clean_value(j.batch),
                    )
                elif not i.hidden:
                    # Export MO
                    yield "%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\n" % (
                        clean_value(i.name),
                        "MO",
                        status,
                        round(j.quantity, 8),
                        str(j.start),
                        str(j.end),
                        round(j.criticality, 8),
                        j.delay,
                        cls.getPegging(j),
                        clean_value(j.source),
                        timestamp,
                        clean_value(i.name),
                        clean_value(j.owner.reference)
                        if j.owner and not j.owner.operation.hidden else "\\N",
                        clean_value(i.item.name)
                        if i.item else clean_value(i.owner.item.name)
                        if i.owner and i.owner.item else clean_value(
                            j.demand.item.name) if j.demand and j.demand.item
                        else clean_value(j.owner.demand.item.name) if j.owner
                        and j.owner.demand and j.owner.demand.item else "\\N",
                        "\\N",
                        "\\N",
                        clean_value(i.location.name) if i.location else "\\N",
                        "\\N",
                        clean_value(j.demand.name)
                        if j.demand else clean_value(j.owner.demand.name)
                        if j.owner and j.owner.demand else "\\N",
                        j.demand.due if j.demand else j.owner.demand.due
                        if j.owner and j.owner.demand else "\\N",
                        color if
                        (proposedFound is False and status == "proposed") or
                        (status == "proposed" and j.start == proposedFoundDate)
                        or status in ("confirmed",
                                      "approved") else "\\N",  # color
                        clean_value(j.reference),
                        clean_value(j.batch),
                    )
                elif j.demand or (j.owner and j.owner.demand):
                    # Export shipments (with automatically created delivery operations)
                    yield "%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\n" % (
                        clean_value(i.name),
                        "DLVR",
                        status,
                        round(j.quantity, 8),
                        str(j.start),
                        str(j.end),
                        round(j.criticality, 8),
                        j.delay,
                        cls.getPegging(j),
                        clean_value(j.source),
                        timestamp,
                        "\\N",
                        clean_value(j.owner.reference)
                        if j.owner and not j.owner.operation.hidden else "\\N",
                        clean_value(j.operation.buffer.item.name),
                        "\\N",
                        "\\N",
                        clean_value(j.operation.buffer.location.name),
                        "\\N",
                        clean_value(j.demand.name)
                        if j.demand else clean_value(j.owner.demand.name)
                        if j.owner and j.owner.demand else "\\N",
                        j.demand.due if j.demand else j.owner.demand.due
                        if j.owner and j.owner.demand else "\\N",
                        "\\N",  # color is empty for deliver operation
                        clean_value(j.reference),
                        clean_value(j.batch),
                    )

                if status == "proposed":
                    proposedFound = True
                    proposedFoundDate = j.start
Пример #7
0
    def getData(cls, timestamp, cluster=-1):
        import frepple

        for i in frepple.operations():
            if cluster != -1 and cluster != i.cluster:
                continue
            for j in i.operationplans:
                delay = j.delay
                color = 100 - delay / 86400

                if isinstance(i, frepple.operation_inventory):
                    # Export inventory
                    yield "%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\n" % (
                        clean_value(i.name),
                        "STCK",
                        j.status,
                        round(j.quantity, 8),
                        str(j.start),
                        str(j.end),
                        round(j.criticality, 8),
                        j.delay,
                        cls.getPegging(j),
                        clean_value(j.source),
                        timestamp,
                        "\\N",
                        clean_value(j.owner.reference)
                        if j.owner and not j.owner.operation.hidden else "\\N",
                        clean_value(j.operation.buffer.item.name),
                        clean_value(j.operation.buffer.location.name),
                        "\\N",
                        "\\N",
                        "\\N",
                        clean_value(j.demand.name)
                        if j.demand else clean_value(j.owner.demand.name)
                        if j.owner and j.owner.demand else "\\N",
                        j.demand.due if j.demand else j.owner.demand.due
                        if j.owner and j.owner.demand else "\\N",
                        color,
                        clean_value(j.reference),
                        "\\N",
                    )
                elif isinstance(i, frepple.operation_itemdistribution):
                    # Export DO
                    yield "%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\n" % (
                        clean_value(i.name),
                        "DO",
                        j.status,
                        round(j.quantity, 8),
                        str(j.start),
                        str(j.end),
                        round(j.criticality, 8),
                        j.delay,
                        cls.getPegging(j),
                        clean_value(j.source),
                        timestamp,
                        "\\N",
                        clean_value(j.owner.reference)
                        if j.owner and not j.owner.operation.hidden else "\\N",
                        clean_value(j.operation.destination.item.name)
                        if j.operation.destination else
                        j.operation.origin.item.name,
                        clean_value(j.operation.destination.location.name)
                        if j.operation.destination else "\\N",
                        clean_value(j.operation.origin.location.name)
                        if j.operation.origin else "\\N",
                        "\\N",
                        "\\N",
                        clean_value(j.demand.name)
                        if j.demand else clean_value(j.owner.demand.name)
                        if j.owner and j.owner.demand else "\\N",
                        j.demand.due if j.demand else j.owner.demand.due
                        if j.owner and j.owner.demand else "\\N",
                        color,
                        clean_value(j.reference),
                        clean_value(j.batch),
                    )
                elif isinstance(i, frepple.operation_itemsupplier):
                    # Export PO
                    yield "%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\n" % (
                        clean_value(i.name),
                        "PO",
                        j.status,
                        round(j.quantity, 8),
                        str(j.start),
                        str(j.end),
                        round(j.criticality, 8),
                        j.delay,
                        cls.getPegging(j),
                        clean_value(j.source),
                        timestamp,
                        "\\N",
                        clean_value(j.owner.reference)
                        if j.owner and not j.owner.operation.hidden else "\\N",
                        clean_value(j.operation.buffer.item.name),
                        "\\N",
                        "\\N",
                        clean_value(j.operation.buffer.location.name),
                        clean_value(j.operation.itemsupplier.supplier.name),
                        clean_value(j.demand.name)
                        if j.demand else clean_value(j.owner.demand.name)
                        if j.owner and j.owner.demand else "\\N",
                        j.demand.due if j.demand else j.owner.demand.due
                        if j.owner and j.owner.demand else "\\N",
                        color,
                        clean_value(j.reference),
                        clean_value(j.batch),
                    )
                elif not i.hidden:
                    # Export MO
                    yield "%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\n" % (
                        clean_value(i.name),
                        "MO",
                        j.status,
                        round(j.quantity, 8),
                        str(j.start),
                        str(j.end),
                        round(j.criticality, 8),
                        j.delay,
                        cls.getPegging(j),
                        clean_value(j.source),
                        timestamp,
                        clean_value(i.name),
                        clean_value(j.owner.reference)
                        if j.owner and not j.owner.operation.hidden else "\\N",
                        clean_value(i.item.name)
                        if i.item else clean_value(i.owner.item.name)
                        if i.owner and i.owner.item else clean_value(
                            j.demand.item.name) if j.demand and j.demand.item
                        else clean_value(j.owner.demand.item.name) if j.owner
                        and j.owner.demand and j.owner.demand.item else "\\N",
                        "\\N",
                        "\\N",
                        clean_value(i.location.name) if i.location else "\\N",
                        "\\N",
                        clean_value(j.demand.name)
                        if j.demand else clean_value(j.owner.demand.name)
                        if j.owner and j.owner.demand else "\\N",
                        j.demand.due if j.demand else j.owner.demand.due
                        if j.owner and j.owner.demand else "\\N",
                        color,
                        clean_value(j.reference),
                        clean_value(j.batch),
                    )
                elif j.demand or (j.owner and j.owner.demand):
                    # Export shipments (with automatically created delivery operations)
                    yield "%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\n" % (
                        clean_value(i.name),
                        "DLVR",
                        j.status,
                        round(j.quantity, 8),
                        str(j.start),
                        str(j.end),
                        round(j.criticality, 8),
                        j.delay,
                        cls.getPegging(j),
                        clean_value(j.source),
                        timestamp,
                        "\\N",
                        clean_value(j.owner.reference)
                        if j.owner and not j.owner.operation.hidden else "\\N",
                        clean_value(j.operation.buffer.item.name),
                        "\\N",
                        "\\N",
                        clean_value(j.operation.buffer.location.name),
                        "\\N",
                        clean_value(j.demand.name)
                        if j.demand else clean_value(j.owner.demand.name)
                        if j.owner and j.owner.demand else "\\N",
                        j.demand.due if j.demand else j.owner.demand.due
                        if j.owner and j.owner.demand else "\\N",
                        color,
                        clean_value(j.reference),
                        clean_value(j.batch),
                    )
Пример #8
0
    def getItemsFromCluster(cluster=-1, ):
        import frepple

        for i in frepple.items():
            if i.cluster == cluster:
                yield "%s\n" % (clean_value(i.name), )
Пример #9
0
    def getData(cls, timestamp, cluster=-1, accepted_status=[]):
        import frepple

        linetemplate = "%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s\v%s"
        for i in cls.attrs:
            linetemplate += "\v%s"
        linetemplate += "\n"

        for i in frepple.operations():
            if cluster != -1 and cluster != i.cluster:
                continue

            # variable used to make sure only first proposed operationplan has its color set.
            proposedFound = False
            proposedFoundDate = None

            for j in i.operationplans:
                status = j.status
                if status not in accepted_status:
                    continue
                delay = j.delay
                color = 100 - delay / 86400

                data = None
                if isinstance(i, frepple.operation_inventory):
                    # Export inventory
                    data = [
                        clean_value(i.name),
                        "STCK",
                        status,
                        round(j.quantity, 8),
                        str(j.start),
                        str(j.end),
                        round(j.criticality, 8),
                        j.delay,
                        cls.getPegging(j),
                        clean_value(j.source),
                        timestamp,
                        "\\N",
                        clean_value(j.owner.reference)
                        if j.owner and not j.owner.operation.hidden else "\\N",
                        clean_value(j.operation.buffer.item.name),
                        clean_value(j.operation.buffer.location.name),
                        "\\N",
                        "\\N",
                        "\\N",
                        clean_value(j.demand.name)
                        if j.demand else clean_value(j.owner.demand.name)
                        if j.owner and j.owner.demand else "\\N",
                        j.demand.due if j.demand else j.owner.demand.due
                        if j.owner and j.owner.demand else "\\N",
                        "\\N",  # color is empty for stock
                        clean_value(j.reference),
                        clean_value(j.batch),
                        "\\N",
                    ]
                elif isinstance(i, frepple.operation_itemdistribution):
                    # Export DO
                    data = [
                        clean_value(i.name),
                        "DO",
                        status,
                        round(j.quantity, 8),
                        str(j.start),
                        str(j.end),
                        round(j.criticality, 8),
                        j.delay,
                        cls.getPegging(j),
                        clean_value(j.source),
                        timestamp,
                        "\\N",
                        clean_value(j.owner.reference)
                        if j.owner and not j.owner.operation.hidden else "\\N",
                        clean_value(j.operation.destination.item.name)
                        if j.operation.destination else
                        j.operation.origin.item.name,
                        clean_value(j.operation.destination.location.name)
                        if j.operation.destination else "\\N",
                        clean_value(j.operation.origin.location.name)
                        if j.operation.origin else "\\N",
                        "\\N",
                        "\\N",
                        clean_value(j.demand.name)
                        if j.demand else clean_value(j.owner.demand.name)
                        if j.owner and j.owner.demand else "\\N",
                        j.demand.due if j.demand else j.owner.demand.due
                        if j.owner and j.owner.demand else "\\N",
                        color if
                        (proposedFound is False and status == "proposed") or
                        (status == "proposed" and j.start == proposedFoundDate)
                        or status in ("confirmed",
                                      "approved") else "\\N",  # color
                        clean_value(j.reference),
                        clean_value(j.batch),
                        "\\N",
                    ]
                elif isinstance(i, frepple.operation_itemsupplier):
                    # Export PO
                    data = [
                        clean_value(i.name),
                        "PO",
                        status,
                        round(j.quantity, 8),
                        str(j.start),
                        str(j.end),
                        round(j.criticality, 8),
                        j.delay,
                        cls.getPegging(j),
                        clean_value(j.source),
                        timestamp,
                        "\\N",
                        clean_value(j.owner.reference)
                        if j.owner and not j.owner.operation.hidden else "\\N",
                        clean_value(j.operation.buffer.item.name),
                        "\\N",
                        "\\N",
                        clean_value(j.operation.buffer.location.name),
                        clean_value(j.operation.itemsupplier.supplier.name),
                        clean_value(j.demand.name)
                        if j.demand else clean_value(j.owner.demand.name)
                        if j.owner and j.owner.demand else "\\N",
                        j.demand.due if j.demand else j.owner.demand.due
                        if j.owner and j.owner.demand else "\\N",
                        color if
                        (proposedFound is False and status == "proposed") or
                        (status == "proposed" and j.start == proposedFoundDate)
                        or status in ("confirmed", "approved") else
                        "\\N",  # color
                        clean_value(j.reference),
                        clean_value(j.batch),
                        "\\N",
                    ]
                elif not i.hidden:
                    # Export MO
                    data = [
                        clean_value(i.name),
                        "MO",
                        status,
                        round(j.quantity, 8),
                        str(j.start),
                        str(j.end),
                        round(j.criticality, 8),
                        j.delay,
                        cls.getPegging(j),
                        clean_value(j.source),
                        timestamp,
                        clean_value(i.name),
                        clean_value(j.owner.reference)
                        if j.owner and not j.owner.operation.hidden else "\\N",
                        clean_value(i.item.name)
                        if i.item else clean_value(i.owner.item.name)
                        if i.owner and i.owner.item else clean_value(
                            j.demand.item.name) if j.demand and j.demand.item
                        else clean_value(j.owner.demand.item.name) if j.owner
                        and j.owner.demand and j.owner.demand.item else "\\N",
                        "\\N",
                        "\\N",
                        clean_value(i.location.name) if i.location else "\\N",
                        "\\N",
                        clean_value(j.demand.name)
                        if j.demand else clean_value(j.owner.demand.name)
                        if j.owner and j.owner.demand else "\\N",
                        j.demand.due if j.demand else j.owner.demand.due
                        if j.owner and j.owner.demand else "\\N",
                        color if
                        (proposedFound is False and status == "proposed") or
                        (status == "proposed" and j.start == proposedFoundDate)
                        or status in ("confirmed",
                                      "approved") else "\\N",  # color
                        clean_value(j.reference),
                        clean_value(j.batch),
                        round(j.quantity_completed, 8)
                        if j.quantity_completed else "\\N",
                    ]
                elif j.demand or (j.owner and j.owner.demand):
                    # Export shipments (with automatically created delivery operations)
                    data = [
                        clean_value(i.name),
                        "DLVR",
                        status,
                        round(j.quantity, 8),
                        str(j.start),
                        str(j.end),
                        round(j.criticality, 8),
                        j.delay,
                        cls.getPegging(j),
                        clean_value(j.source),
                        timestamp,
                        "\\N",
                        clean_value(j.owner.reference)
                        if j.owner and not j.owner.operation.hidden else "\\N",
                        clean_value(j.operation.buffer.item.name),
                        "\\N",
                        "\\N",
                        clean_value(j.operation.buffer.location.name),
                        "\\N",
                        clean_value(j.demand.name)
                        if j.demand else clean_value(j.owner.demand.name)
                        if j.owner and j.owner.demand else "\\N",
                        j.demand.due if j.demand else j.owner.demand.due
                        if j.owner and j.owner.demand else "\\N",
                        "\\N",  # color is empty for deliver operation
                        clean_value(j.reference),
                        clean_value(j.batch),
                        "\\N",
                    ]
                if data:
                    for attr in cls.attrs:
                        v = getattr(j, attr[0], None)
                        if v is None:
                            data.append("\\N")
                        elif attr[2] == "boolean":
                            data.append(True if v else False)
                        elif attr[2] == "duration":
                            data.append(v)
                        elif attr[2] == "integer":
                            data.append(round(v))
                        elif attr[2] == "number":
                            data.append(round(v, 6))
                        elif attr[2] == "string":
                            data.append(clean_value(v))
                        elif attr[2] == "time":
                            data.append(v)
                        elif attr[2] == "date":
                            data.append(v)
                        elif attr[2] == "datetime":
                            data.append(v)
                        else:
                            raise Exception("Unknown attribute type %s" %
                                            attr[2])
                    yield linetemplate % tuple(data)
                if status == "proposed":
                    proposedFound = True
                    proposedFoundDate = j.start