Printer import now assigns the cut code for TM-m30

Also, hard-coding of the cut string is removed.
Now need to see how it will be handled in update printer
This commit is contained in:
Amritanshu Agrawal 2021-03-18 17:48:31 +05:30
parent 52943c7ee0
commit 088982c6d4
7 changed files with 14 additions and 9 deletions

View File

@ -56,7 +56,12 @@ def update_section_printers():
column("printer_name", sa.Unicode(length=255)),
)
section = table("sections", column("id", postgresql.UUID(as_uuid=True)), column("name", sa.Unicode(length=255)))
printer = table("printers", column("id", postgresql.UUID(as_uuid=True)), column("name", sa.Unicode(length=255)))
printer = table(
"printers",
column("id", postgresql.UUID(as_uuid=True)),
column("name", sa.Unicode(length=255)),
column("cut_code", sa.Unicode(length=255)),
)
op.execute(
section_printer.update(
values={"section_id": select([section.c.id]).where(section_printer.c.section_name == section.c.name)}
@ -67,6 +72,7 @@ def update_section_printers():
values={"printer_id": select([printer.c.id]).where(section_printer.c.printer_name == printer.c.name)}
)
)
op.execute(printer.update(values={"cut_code": "\x1dV\x41\x03"}))
with op.batch_alter_table("section_printers") as batch_op:
batch_op.alter_column("section_id", nullable=False)
batch_op.drop_column("section_name")

View File

@ -53,7 +53,7 @@ def print_bill(voucher_id: uuid.UUID, db: Session):
redis: ArqRedis = asyncio.run(create_pool(redis_settings))
asyncio.run(
redis.enqueue_job(
"sent_to_printer", data, printer.address, "\x1dV\x41\x03", _queue_name=f"barker:print:{printer.name}"
"sent_to_printer", data, printer.address, printer.cut_code, _queue_name=f"barker:print:{printer.name}"
)
)

View File

@ -30,7 +30,7 @@ def print_cashier_report(report: CashierReport, device_id: uuid.UUID, db: Sessio
redis: ArqRedis = asyncio.run(create_pool(redis_settings))
asyncio.run(
redis.enqueue_job(
"sent_to_printer", data, printer.address, "\x1dV\x41\x03", _queue_name=f"barker:print:{printer.name}"
"sent_to_printer", data, printer.address, printer.cut_code, _queue_name=f"barker:print:{printer.name}"
)
)

View File

@ -28,7 +28,7 @@ def print_discount_report(report: DiscountReport, device_id: uuid.UUID, db: Sess
redis: ArqRedis = asyncio.run(create_pool(redis_settings))
asyncio.run(
redis.enqueue_job(
"sent_to_printer", data, printer.address, "\x1dV\x41\x03", _queue_name=f"barker:print:{printer.name}"
"sent_to_printer", data, printer.address, printer.cut_code, _queue_name=f"barker:print:{printer.name}"
)
)

View File

@ -118,7 +118,7 @@ def print_kot(voucher_id: uuid.UUID, db: Session):
"sent_to_printer",
data,
printer.address,
"\x1dV\x41\x03",
printer.cut_code,
_queue_name=f"barker:print:{printer.name}",
)
)

View File

@ -30,7 +30,7 @@ def print_sale_report(report: SaleReport, device_id: uuid.UUID, db: Session):
redis: ArqRedis = asyncio.run(create_pool(redis_settings))
asyncio.run(
redis.enqueue_job(
"sent_to_printer", data, printer.address, "\x1dV\x41\x03", _queue_name=f"barker:print:{printer.name}"
"sent_to_printer", data, printer.address, printer.cut_code, _queue_name=f"barker:print:{printer.name}"
)
)

View File

@ -27,7 +27,6 @@ else
tar xvf "$parent_path"/csv/csv.tar.zip -C "$parent_path"/csv || exit
fi
if [ $docker -eq 1 ]
then
docker stop "$doname" || exit
@ -92,8 +91,8 @@ else
alembic upgrade 48bc1c7c07ce || exit
fi
#rm "$parent_path"/csv/*.csv "$parent_path"/csv/csv.tar.zip || exit
#rmdir "$parent_path"/csv || exit
rm -f "$parent_path"/csv/*.csv "$parent_path"/csv/csv.tar.zip || exit
rmdir "$parent_path"/csv || exit
# Show the file in code to see the hidden chars