Skip to content

Instantly share code, notes, and snippets.

@kyleterry
Created March 30, 2012 22:30
Show Gist options
  • Save kyleterry/2256453 to your computer and use it in GitHub Desktop.
Save kyleterry/2256453 to your computer and use it in GitHub Desktop.
@classmethod
def finish_sequencing_on(cls, when, dot=None, only=None, split_printing_at=300):
if only is not None:
pick_sets = (only,)
else:
pick_sets = cls.pick_sets_on(when)
seq = 0
for p in sorted(pick_sets, key=lambda p: p.sequence):
seq = p.finish_sequencing(sequence_start=seq)
if dot:
dot()
if dot:
dot("->")
cls.color_drop_points(when)
telegram.broadcast(channel='beehive-pick_set', subject='Pick Set Sequencing Finished',
content='Ready to start printing', add_to_queue=False)
StockTransfer = models.get_model("stock_transfer", "StockTransfer")
if only is not None:
Piece = models.get_model("warehouse_pieces", "Piece")
pieces = Piece.objects.filter(pk__in=only.order_pieces.values_list('piece', flat=True)).distinct()
pieces = reduce(lambda t, p: t + list(p.breakdown_family), pieces, [])
StockTransfer.update_transfers(pieces)
else:
StockTransfer.update_transfers()
for p in pick_sets:
p.generate_pdfs(split_printing_at=split_printing_at)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment