update excel

This commit is contained in:
2026-02-10 16:37:06 +03:30
parent 2372c412e9
commit be7860f4dd
4 changed files with 35 additions and 2 deletions

View File

@@ -4486,3 +4486,26 @@ def canceled_out_province_request_manual(request):
req = send_sms_request( req = send_sms_request(
f"http://webservice.sahandsms.com/newsmswebservice.asmx/SendPostUrl?username={USERNAME_SMS_FINANCIAL}&password={PASSWORD_SMS_FINANCIAL}&from=30002501&to={UNION_NUMBER}&message={message}") f"http://webservice.sahandsms.com/newsmswebservice.asmx/SendPostUrl?username={USERNAME_SMS_FINANCIAL}&password={PASSWORD_SMS_FINANCIAL}&from=30002501&to={UNION_NUMBER}&message={message}")
return HttpResponse('ok') return HttpResponse('ok')
@api_view(["GET"])
@csrf_exempt
@permission_classes([AllowAny])
def archive_unknown_hatching(request):
hatchings = PoultryHatching.objects.filter(trash=False, unknown=True,left_over__lt=F('quantity') * 0.1)
for hatching in hatchings:
hatching.archive=True
hatching.state='complete'
hatching.allow_hatching='True'
hatching.save()
return Response("done!")
def archive_unknown_hatching_cron():
hatchings = PoultryHatching.objects.filter(trash=False, unknown=True,left_over__lt=F('quantity') * 0.1)
for hatching in hatchings:
hatching.archive=True
hatching.state='complete'
hatching.allow_hatching='True'
hatching.save()

View File

@@ -6,7 +6,7 @@ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "MaChickenStore.settings")
django.setup() django.setup()
from panel.ReportingPanel.views import cron_find_gid_code, get_gid_out_province_cron_job, hatching_unknown_cron from panel.ReportingPanel.views import cron_find_gid_code, get_gid_out_province_cron_job, hatching_unknown_cron
from panel.KillHouse.helpers import create_kill_house_free_bar_cron from panel.KillHouse.helpers import create_kill_house_free_bar_cron
from authentication.register import add_to_warehouse, fix_duplicate_order_code_cron from authentication.register import add_to_warehouse, fix_duplicate_order_code_cron, archive_unknown_hatching_cron
from panel.excel_processing import test_all_excel_functions_cron from panel.excel_processing import test_all_excel_functions_cron
cron_find_gid_code() cron_find_gid_code()
@@ -16,3 +16,4 @@ get_gid_out_province_cron_job()
fix_duplicate_order_code_cron() fix_duplicate_order_code_cron()
test_all_excel_functions_cron() test_all_excel_functions_cron()
hatching_unknown_cron() hatching_unknown_cron()
archive_unknown_hatching_cron()

View File

@@ -525,6 +525,7 @@ def hatching_excel(request):
'نژاد', 'نژاد',
'سن', 'سن',
'حجم جوجه ریزی', 'حجم جوجه ریزی',
'حجم تایید تخلیه',
'حجم افزایشی', 'حجم افزایشی',
'تلفات دامپزشک(قطعه)', 'تلفات دامپزشک(قطعه)',
'تلفات اتحادیه(قطعه)', 'تلفات اتحادیه(قطعه)',
@@ -595,6 +596,7 @@ def hatching_excel(request):
'تعداد فارم ها', 'تعداد فارم ها',
'تعداد جوجه ریزی ها', 'تعداد جوجه ریزی ها',
'مجموع جوجه ریزی', 'مجموع جوجه ریزی',
'مجموع تایید تخلیه',
'مجموع تلفات دامپزشک(قطعه)', 'مجموع تلفات دامپزشک(قطعه)',
'مجموع تلفات اتحادیه(قطعه)', 'مجموع تلفات اتحادیه(قطعه)',
'مجموع تلفات کل(قطعه)', 'مجموع تلفات کل(قطعه)',
@@ -848,6 +850,7 @@ def hatching_excel(request):
poultry_hatching.chicken_breed, poultry_hatching.chicken_breed,
age, age,
poultry_hatching.quantity, poultry_hatching.quantity,
poultry_hatching.loadingSum,
poultry_hatching.increase_quantity, poultry_hatching.increase_quantity,
poultry_hatching.losses, poultry_hatching.losses,
poultry_hatching.direct_losses, poultry_hatching.direct_losses,
@@ -951,6 +954,9 @@ def hatching_excel(request):
all_total_free_commitment_quantity = filtered_poultry_hatch.aggregate( all_total_free_commitment_quantity = filtered_poultry_hatch.aggregate(
total_quantity=Sum('total_free_commitment_quantity')).get( total_quantity=Sum('total_free_commitment_quantity')).get(
'total_quantity', 0) 'total_quantity', 0)
all_loading_sum = filtered_poultry_hatch.aggregate(
total_quantity=Sum('loadingSum')).get(
'total_quantity', 0)
kill_house_requests = KillHouseRequest.objects.filter(trash=False, kill_house_requests = KillHouseRequest.objects.filter(trash=False,
province_request__poultry_request__hatching__in=filtered_poultry_hatch) province_request__poultry_request__hatching__in=filtered_poultry_hatch)
@@ -995,6 +1001,7 @@ def hatching_excel(request):
len(poultry), len(poultry),
len(filtered_poultry_hatch), len(filtered_poultry_hatch),
all_poultry_hatching_quantity, all_poultry_hatching_quantity,
all_loading_sum,
all_losses, all_losses,
all_direct_losses, all_direct_losses,
all_total_losses, all_total_losses,
@@ -1054,6 +1061,7 @@ def hatching_excel(request):
'', # تاریخ ورود به بایگانی '', # تاریخ ورود به بایگانی
'', # سن فعلی '', # سن فعلی
all_quantity, # حجم جوجه ریزی all_quantity, # حجم جوجه ریزی
all_loading_sum,
'', # حجم افزایشی '', # حجم افزایشی
all_losses, all_losses,
all_direct_losses, all_direct_losses,

View File

@@ -1,5 +1,5 @@
from authentication.register import add_zero_for_user_mobile, accept_bar_difference_request_pending_manual, \ from authentication.register import add_zero_for_user_mobile, accept_bar_difference_request_pending_manual, \
canceled_out_province_request_manual canceled_out_province_request_manual, archive_unknown_hatching
from authentication.sms_management import send_daily_slaughter_statistics_sms_manual, \ from authentication.sms_management import send_daily_slaughter_statistics_sms_manual, \
send_daily_distribution_report_sms_manual send_daily_distribution_report_sms_manual
from pdf.views import kill_request_pdf, management_all_poultry_and_warehouse_pdf, summary_report_pdf, \ from pdf.views import kill_request_pdf, management_all_poultry_and_warehouse_pdf, summary_report_pdf, \
@@ -1404,5 +1404,6 @@ urlpatterns = [
path('delete_steward_allocation_manual/', delete_steward_allocation_manual), path('delete_steward_allocation_manual/', delete_steward_allocation_manual),
path('delete_sale_bar_manual/', delete_sale_bar_manual), path('delete_sale_bar_manual/', delete_sale_bar_manual),
path('send_credit_sahandsms_sms_manual/', send_credit_sahandsms_sms_manual), path('send_credit_sahandsms_sms_manual/', send_credit_sahandsms_sms_manual),
path('archive_unknown_hatching/', archive_unknown_hatching),
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) ] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)