This commit is contained in:
2026-01-28 16:24:05 +03:30
parent 3b34441efc
commit e646bb88a9
3 changed files with 285 additions and 14 deletions

View File

@@ -63,7 +63,6 @@ import hashlib
# 1232, 1232, 1273, 1273, 1240,
# 1240, 1240, 1240, 1240, 1234, 1234, 1200, 1200, 1247, 1186, 1085, 1098, 1251, 1251, 1251, 1251, 1251,
# 1336, 1336, 1113, 1113, 1253, 1253, 1113]
#
@api_view(["GET"])
@@ -2661,6 +2660,21 @@ def accept_bar_difference_request_pending_cron_job():
bar_request.hatching.save()
bar_request.save()
def accept_bar_difference_request_pending_manual(request):
date = datetime.now().date() - timedelta(days=2)
bar_requests = BarDifferenceRequest.objects.filter(trash=False,
state='pending', create_date__date__lt=date).order_by('id')
for bar_request in bar_requests:
bar_request.state = 'accepted'
bar_request.acceptor_fullname = 'سیستمی'
bar_request.acceptor_mobile = '00000000000'
bar_request.acceptor_date = datetime.now()
bar_request.hatching.bar_difference_request_quantity += bar_request.quantity
bar_request.hatching.bar_difference_request_weight += bar_request.weight
bar_request.hatching.save()
bar_request.save()
return HttpResponse('ok')
@api_view(["POST"])
@permission_classes([AllowAny])
@@ -4290,7 +4304,7 @@ def fix_kill_house_archive_warehousing(request):
@csrf_exempt
@permission_classes([AllowAny])
def fix_steward_free_buying_product_warehousing_for_limitation(request):
stewards = Guilds.objects.filter(trash=False, steward=True, active=True)
stewards = Guilds.objects.filter(trash=False)
for steward in stewards:
product = RolesProducts.objects.get(parent_product__name='مرغ گرم', guild=steward)
guild_steward_free_buying_product_warehousing(product)
@@ -4301,7 +4315,7 @@ def fix_steward_free_buying_product_warehousing_for_limitation(request):
@csrf_exempt
@permission_classes([AllowAny])
def fix_steward_guild_steward_allocations_warehousing_for_limitation(request):
stewards = Guilds.objects.filter(trash=False, steward=True, active=True)
stewards = Guilds.objects.filter(trash=False)
for steward in stewards:
product = RolesProducts.objects.get(parent_product__name='مرغ گرم', guild=steward)
guild_steward_allocations_product_warehousing(product)
@@ -4312,7 +4326,7 @@ def fix_steward_guild_steward_allocations_warehousing_for_limitation(request):
@csrf_exempt
@permission_classes([AllowAny])
def fix_guild_steward_free_sale_warehousing_for_limitation(request):
stewards = Guilds.objects.filter(trash=False, steward=True, active=True)
stewards = Guilds.objects.filter(trash=False)
for steward in stewards:
product = RolesProducts.objects.get(parent_product__name='مرغ گرم', guild=steward)
guild_steward_free_sale_product_warehousing(product)
@@ -4323,7 +4337,7 @@ def fix_guild_steward_free_sale_warehousing_for_limitation(request):
@csrf_exempt
@permission_classes([AllowAny])
def fix_guild_steward_product_segmentation_warehousing_for_limitation(request):
stewards = Guilds.objects.filter(trash=False, steward=True, active=True)
stewards = Guilds.objects.filter(trash=False)
for steward in stewards:
product = RolesProducts.objects.get(parent_product__name='مرغ گرم', guild=steward)
guild_steward_product_segmentation(product)
@@ -4334,7 +4348,7 @@ def fix_guild_steward_product_segmentation_warehousing_for_limitation(request):
@csrf_exempt
@permission_classes([AllowAny])
def fix_steward_guild_pos_allocations_warehousing_for_limitation(request):
stewards = Guilds.objects.filter(trash=False, steward=True, active=True)
stewards = Guilds.objects.filter(trash=False)
for steward in stewards:
product = RolesProducts.objects.get(parent_product__name='مرغ گرم', guild=steward)
product.pos_allocated_weight = 0
@@ -4346,7 +4360,7 @@ def fix_steward_guild_pos_allocations_warehousing_for_limitation(request):
@csrf_exempt
@permission_classes([AllowAny])
def fix_guild_steward_archive_warehousing(request):
stewards = Guilds.objects.filter(trash=False, steward=True, active=True)
stewards = Guilds.objects.filter(trash=False)
for steward in stewards:
product = RolesProducts.objects.filter(guild=steward, trash=False, name='مرغ گرم').first()
@@ -4375,7 +4389,7 @@ def fix_guild_steward_archive_warehousing(request):
@csrf_exempt
@permission_classes([AllowAny])
def fix_guild_steward_pos_allocation_weight_for_product(request):
stewards = Guilds.objects.filter(trash=False, steward=True, active=True)
stewards = Guilds.objects.filter(trash=False)
for steward in stewards:
product = RolesProducts.objects.filter(guild=steward, trash=False, name='مرغ گرم').first()
transactions = ProductsTransactions.objects.filter(product=product, transaction__paid=True, trash=False,
@@ -4398,7 +4412,7 @@ def fix_guild_steward_pos_allocation_weight_for_product(request):
@csrf_exempt
@permission_classes([AllowAny])
def fix_steward_warehouse_for_limitation(request):
stewards = Guilds.objects.filter(trash=False, steward=True, active=True)
stewards = Guilds.objects.filter(trash=False)
guild_steward_allocations = StewardAllocation.objects.filter(
Q(guilds__in=stewards) | Q(to_guilds__in=stewards) | Q(steward__in=stewards) | Q(to_steward__in=stewards),
trash=False, calculate_status=True, warehouse=True, steward_warehouse=True)
@@ -4443,3 +4457,32 @@ def fix_pos_owner(request):
transaction.save()
return Response("done!")
def canceled_out_province_request_manual(request):
province_requests = PoultryRequest.objects.filter(state_process__in=('accepted', 'pending'),
province_state__in=('accepted', 'pending'), trash=False,
archive=False,
out_province_request_cancel=False, out=True, wage_pay=False,
has_wage=True)
data = {"date": str(datetime.now()), "role": "SuperAdmin", "mobile": "-",
"fullname": "کنسل شده توسط سیستم به دلیل عدم پرداخت"}
for province_request in province_requests:
if province_request.state_process == 'accepted' and province_request.province_state == 'accepted':
hatching = PoultryHatching.objects.get(key=province_request.hatching.key, trash=False)
hatching.out_province_killed_weight -= int(province_request.quantity * province_request.Index_weight)
hatching.out_province_killed_quantity -= province_request.quantity
hatching.save()
province_request.out_province_request_cancel = True
province_request.out_province_request_canceller = data
province_request.archive = True
province_request.state_process = 'rejected'
province_request.province_state = 'rejected'
province_request.save()
message = f'بار خارج از استان به شماره {province_request.order_code} به علت عدم پرداخت کنسل شد.' \
f'\n' \
f'(سامانه رصدیار)'
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}")
return HttpResponse('ok')