提交 2f1a140b authored 作者: Chris's avatar Chris

sync: 生产服务器代码同步至dev.

上级 d4d5e01e
# Generated by Django 3.1.4 on 2023-08-25 13:40
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('company', '0327_terminalregister_parent_user'),
]
operations = [
migrations.AddField(
model_name='outlet',
name='adm_copy',
field=models.JSONField(blank=True, default=dict, null=True, verbose_name='临时字段'),
),
]
......@@ -1851,6 +1851,8 @@ class Outlet(models.Model):
is_active = models.BooleanField(_('是否已激活'), default=True)
is_delete = models.BooleanField(_('是否已删除'), default=False)
adm_copy=models.JSONField(_('临时字段'),blank=True,null=True,default=dict)
#franchise_query=models.JSONField(_('首查信息'),blank=True,null=True,default=dict)
#title=models.CharField(_('职位'),max_length=50,blank=True,null=True)
......
......@@ -8,6 +8,9 @@ urlpatterns = [
url(r'^list/user/$', company_views.list_user),
url(r'^app_login/$', company_views.app_login),
# 2023-09-01 第三方app登录录
url(r'^app_login/(?P<thirdparty>\w+)/$', company_views.app_login),
url(r'^tj_os_login/$', company_views.tj_os_login),
......
......@@ -52,6 +52,10 @@ from xlrd import *
from urllib.parse import quote
# 2023-08-25 8月25号以后,行政区划不再查询 gis.adm 而是使用 gis.adm_map_cn
tb_gis='gis.adm_map_cn'
# 2022-10-27
def check_enterprise_tb(company_id):
"""
......@@ -121,11 +125,21 @@ def user_logout(request):
# 扫码枪登录
def app_login(request):
def app_login(request,thirdparty=None):
data = {'user_id':0, 'user_name':'','company_id':0, 'e':'','company_name':'','storehouse':[],
'is_manufacturing':False,'has_plants':False,'roles':[],'ancestor_id':0 }
k = sK
# 2023-09-01 第三方APP登录
if thirdparty:
if thirdparty in settings.THIRDPARTY_KEYS:
k=settings.THIRDPARTY_KEYS[thirdparty]
else:
return JsonResponse({'e': '无效的第三方'})
else:
k = sK
e = time_key_check(request, k)
if e:
data['e'] = e
......@@ -185,8 +199,12 @@ def accounts_login(request):
pwd = request.POST.get('pwd', '')
user = authenticate(username=usr, password=pwd)
if user is not None and user.is_active:
login(request, user)
return HttpResponseRedirect(nxt)
# 2023年7月18日起,天鉴系统禁用掉内参销售公司旗下经销商、终端店全部用户的小程序和后台账号登录权限。总部登录权限不受影响。
if user.ancestor_id==1644 and user.company_id!=1644:
e='当前帐号登录受限'
else:
login(request, user)
return HttpResponseRedirect(nxt)
else:
e = _('用户帐号或密码错误!')
......@@ -252,12 +270,13 @@ def user_chgpwd(request):
user.save()
# 写入SQLSERVER
cn = pyodbc.connect(WULIU_STR)
cur = cn.cursor()
s = "update TJMarketingSystemYin.dbo.TJ_User set PassWords='" + md5_password(newpassword)+ "' " + \
"where pg_stk_id=" + str(u.id)
cur.execute(s)
cn.commit()
#cn = pyodbc.connect(WULIU_STR)
#cur = cn.cursor()
#s = "update TJMarketingSystemYin.dbo.TJ_User set PassWords='" + md5_password(newpassword)+ "' " + \
# "where pg_stk_id=" + str(u.id)
#cur.execute(s)
#cn.commit()
return HttpResponseRedirect(nxt)
else:
e = _('用户帐号或原密码错误!')
......@@ -420,7 +439,7 @@ def get_obj_special(company_id, obj):
return JsonResponse(data)
def get_obj_list(request, company_id, obj):
def get_obj_list(request, company_id, obj, thirdparty=None):
"""
扫码枪数据同步接口
:param request:
......@@ -448,8 +467,18 @@ def get_obj_list(request, company_id, obj):
sK = 'fgfdvgu$#&3t@j'
e = time_key_check(request, sK)
# 2023-09-01 第三方APP登录
if thirdparty:
if thirdparty in settings.THIRDPARTY_KEYS:
k=settings.THIRDPARTY_KEYS[thirdparty]
else:
return JsonResponse({'e': '无效的第三方'})
else:
k = sK
e = time_key_check(request, k)
if e:
data['e'] = e
return JsonResponse(data)
......@@ -483,8 +512,9 @@ def get_obj_list(request, company_id, obj):
#165368;"山西成兆兴销售有限公司"
#2023-07-03 客户要求取消部分指定厂家发给经销商,只保留 134508;"销售" 134510;"其他" 104617;"赵总" 104618;"留样室" 165368; "山西成兆兴销售有限公司"
#2023-07-13 禅道:需添加对应的二级经销商名称为:山西樊王电子商务有限公司
#2023-09-01 客户要求添加一级经销商名称为:化验室176462
if c.id==100425:
sWhere=" where id in (134508,134510,104617,104618,165368, 108845)"
sWhere=" where id in (134508,134510,104617,104618,165368, 108845 ,176462)"
else:
# sWhere=" where (parent_id="+str(c.id)+" and id<>"+str(c.id)+")"
# 2022-11-07
......@@ -5888,7 +5918,10 @@ def leave_message_list(request):
data["date_from"]=dt_fr
data["date_to"]=dt_to
dt_to = (datetime.datetime.now()+datetime.timedelta(days=1)).strftime("%Y-%m-%d")
u = request.user
c = u.company
if c.id==176056:
data['clmns'] = ['头像', '微信昵称', '主题', '姓名', '电话', '城市', '购买机构', '时间']
cur = connection.cursor()
cur.execute("select (SELECT wx_nickname from sales_consumeraccount WHERE id = consumer_id),"+
"(SELECT wx_headimgurl from sales_consumeraccount WHERE id = consumer_id),"+
......@@ -5980,8 +6013,9 @@ def auth_txt(request,file_name):
'MP_verify_ng00Y87rUe565p1O.txt',
'MP_verify_KVgA0qkiHQrR2iKd.txt',
'MP_verify_3tUBs1fDvaPGXxt7.txt',
'MP_verify_rIbowoja572gDX4y.txt',
'MP_verify_HGUJgkrZs6MJWlnF.txt',
'verify_0fb98c6786a5c84b9d1c7647d8cebdad.html',
'MP_verify_uV85hrWGfKUHRgjq.txt',
#https证书申请 验证文件
'fileauth.txt',
......@@ -6456,7 +6490,7 @@ def franchise_outlet(request):
center['lng']=a[0]
center['lat']=a[1]
elif gis_city_id:
cur.execute("SELECT public.st_x(public.ST_Centroid(geom)),public.st_y(public.ST_Centroid(geom)) FROM gis.adm where id="+gis_city_id)
cur.execute("SELECT public.st_x(public.ST_Centroid(geom)),public.st_y(public.ST_Centroid(geom)) FROM "+tb_gis+" where id="+gis_city_id)
r=cur.fetchone()
if r:
center['lng']=r[0]
......@@ -7282,7 +7316,7 @@ def ajax_company_detail(request):
cur.execute(f"""
SELECT NAME
FROM
gis.adm
gis.adm_map_cn
WHERE
ID IN ( SELECT "unnest" ( adm_ids ) FROM logistics.company_company WHERE ID = {id} )
""")
......@@ -7530,19 +7564,19 @@ def outlet_edit(request, id=None):
obj = Outlet(company_id=c.id,ancestor_id=c.ancestor_id)
obj.name = name
if province:
cur.execute("select name from gis.adm where id = "+province)
cur.execute("select name from "+tb_gis+" where id = "+province)
province = {"id":province,"name":cur.fetchone()[0]}
else:
province = {}
obj.province_gis = province
if city:
cur.execute("select name from gis.adm where id = "+city)
cur.execute("select name from "+tb_gis+" where id = "+city)
city = {"id":city,"name":cur.fetchone()[0]}
else:
city = {}
obj.city_gis=city
if county:
cur.execute("select name from gis.adm where id = "+county)
cur.execute("select name from "+tb_gis+" where id = "+county)
county = {"id":county,"name":cur.fetchone()[0]}
else:
county = {}
......@@ -7702,9 +7736,9 @@ def use_excel_upload_companies(request):
level_id,
(select id from company_company where ancestor_id = a.ancestor_id and name = a.parent_name),
address,
(select id from gis.adm where name = a.province and level = 1),
(select id from gis.adm where name = a.city and level = 2 and id_1 = (select id from gis.adm where name = a.province and level = 1)),
(select id from gis.adm where name = a.county and level = 3 and id_1 = (select id from gis.adm where name = a.province and level = 1) and id_2 = (select id from gis.adm where name = a.city and level = 2 and id_1 = (select id from gis.adm where name = a.province and level = 1))),
(select id from gis.adm_map_cn where name = a.province and level = 1),
(select id from gis.adm_map_cn where name = a.city and level = 2 and id_1 = (select id from gis.adm_map_cn where name = a.province and level = 1)),
(select id from gis.adm_map_cn where name = a.county and level = 3 and id_1 = (select id from gis.adm_map_cn where name = a.province and level = 1) and id_2 = (select id from gis.adm_map_cn where name = a.city and level = 2 and id_1 = (select id from gis.adm_map_cn where name = a.province and level = 1))),
(select id from company_salesdivision where name = a.division),
(select id from company_subsaldivision where name = a.subdivision),
a.cell_phone,
......
......@@ -366,8 +366,7 @@ urlpatterns = [
#2021-08-19
url(r'^inventory/label/binding/(?P<company_id>\d+)/(?P<action>\w+)/$', inventory_views.label_binding),
url(r'^inventory/label/binding/(?P<company_id>\d+)/(?P<action>\w+)/$', inventory_views.label_binding),
url(r'^wx/query_trade_no/$', wx_views.query_enterprise_pay),
#2021-10-27
......@@ -396,9 +395,17 @@ urlpatterns = [
url(r'^inventory/stock/near/$', inventory_views.near_stock),
url(r'^inventory/stock/near/(?P<company_id>\d+)/$', inventory_views.near_stock),
# 2023-08-29 工厂扫码枪出库在线检查
url(r'^inventory/factory/outbound/check/(?P<company_id>\d+)/$', inventory_views.factory_outbound_check),
url(r'^legacy/delivery/', inventory_views.legacy_delivery),
#扫码枪同步
url(r'^obj/list/(?P<company_id>\d+)/(?P<obj>\w+)/$', company_views.get_obj_list),
# 2023-09-01 第三方数据交互
url(r'^obj/list/(?P<company_id>\d+)/(?P<obj>\w+)/(?P<thirdparty>\w+)/$', company_views.get_obj_list),
#url(r'^get/production/structure/(?P<company_id>\d+)/(?P<obj>\w+)/$', company_views.get_prd_structure),
#url(r'^list/(?P<obj>\w+)/$', company_views.list_obj),
......@@ -609,9 +616,9 @@ urlpatterns = [
url(r'^wx/ajax/consumer/scan_record/$', wx_views.ajax_consumer_scan_record),
url(r'^wx/ajax/consumer/info/$', wx_views.ajax_consumer_info),
url(r'^wx/ajax/consumer/help/$', wx_views.ajax_consumer_help),
url(r'^wx/ajax/consumer/info/$', wx_views.ajax_consumer_info),
url(r'^wx/ajax/consumer/help/$', wx_views.ajax_consumer_help),
url(r'^wx/ajax/getAddressInfoByLngLat/$', wx_views.getAddressInfoByLngLat),
url(r'^wx/ajax/label/traceinfo/(?P<what>\w+)/$', wx_views.ajax_label_trace_detail),
url(r'^wx/ajax/js/sign/(?P<wx_officail_account_id>\d+)/$', wx_views.get_wx_js_sign),
......@@ -846,6 +853,9 @@ urlpatterns = [
url(r'^thirdparty/nc/haishang/(?P<what>\w+)/$',thirdparty_views.nc_haishang),
# 2023-08-07 发货记录推送第三方查询
url(r'^thirdparty/delivery/post/(?P<what>\w+)/$',thirdparty_views.delivery_post),
#Jonathan
......@@ -1170,6 +1180,8 @@ urlpatterns = [
url(r'^mes/detail/$', mes_views.ajax_vendor_detail),
# 2022-07-25
url(r'^mes/label/bind/(?P<company_id>\d+)/(?P<action>\w+)/(?P<what>\w+)/$', mes_views.label_bind),
# 2023-09-01 第三方在线绑定
url(r'^mes/label/bind/(?P<company_id>\d+)/(?P<action>\w+)/(?P<what>\w+)/(?P<thirdparty>\w+)/$', mes_views.label_bind),
# 2022-08-10
url(r'^mes/product/bind/(?P<action>\w+)/$', mes_views.product_bind),
......@@ -1314,14 +1326,28 @@ urlpatterns = [
#2023-06-29返利明细
url(r'^sales/rebate_claim/(?P<rebate_batch_id>\d+)/$', sal_views.rebate_claim),
#2027-07-18提现明细
url(r'^obj/list/rebate_claim_details_list/(?P<id>\d+)/$', list_views.rebate_claim_details_list),
#2023 07-14 经销商查询标签信息
url(r'^inventory/agent/label/query/(?P<ancestor_id>\d+)/$',inventory_views.agent_label_query),
#url(r'^inventory/batch/summary/',inventory_views.batch_summary),
url(r'^inventory/stack/demolition/(?P<company_id>\d+)/$',inventory_views.demolition_stack)
#2023-07-17 标签页发货
url(r'^inventory/upload/inv/code/$',inventory_views.upload_inv_code),
#2023-07-25 窜货地图显示
url(r'^obj/lists/bugsell_cluster_map_data/$',list_views.bugsell_cluster_map),
url(r'^obj/lists/bugsells/$',list_views.bugsells),
url(r'^obj/list/bugsell_data/(?P<what>\w+)/$', list_views.bugsell_data),
#2023-07-27 假货地图
url(r'^obj/lists/fakelabel_cluster_map_data/$',list_views.fakelabel_cluster_map),
url(r'^obj/lists/fakelabel/$',list_views.fakelabel),
url(r'^obj/list/fakelabel_data/(?P<what>\w+)/$', list_views.fakelabel_data),
#2023-08-04 垛标解除绑定
url(r'^inventory/stack/demolition/(?P<company_id>\d+)/$',inventory_views.demolition_stack),
# 进销存库存
url(r'^inventory/product/summary/$',inventory_views.batch_summary),
url(r'^inventory/product/summary/(?P<product_id>\d+)/$',inventory_views.batch_summary_details),
]
if settings.DEBUG:
......
......@@ -26,7 +26,8 @@ from django.db import connection
#直辖市 行政区划编码前2位
zxs=["50","11","12","31"]
# 2023-08-25 8月25号以后,行政区划不再查询 gis.adm 而是使用 gis.adm_map_cn
tb_gis='gis.adm_map_cn'
# Create your views here.
def ajax_adm_center(request,id):
......@@ -39,7 +40,7 @@ def ajax_adm_center(request,id):
#)
cur=connection.cursor()
s="SELECT public.ST_X(public.ST_Centroid(geom)),public.ST_Y(ST_Centroid(geom)) FROM gis.adm where id="+id
s="SELECT public.ST_X(public.ST_Centroid(geom)),public.ST_Y(ST_Centroid(geom)) FROM "+tb_gis+" where id="+id
cur.execute(s)
r=cur.fetchone()
data={'lng':r[0],'lat':r[1]}
......@@ -63,10 +64,10 @@ def ajax_adm_desc(request,id):
#)
cur=connection.cursor()
s="select " + \
"case when level=1 then name else (select name from gis.adm where id=a.id_1 limit 1) end," + \
"coalesce(case when level=2 then name else (select name from gis.adm where id=a.id_2 limit 1) end,'')," + \
"coalesce(case when level=3 then name else (select name from gis.adm where id=a.id_3 limit 1) end,'')," + \
"name,id FROM gis.adm a where id="+id
"case when level=1 then name else (select name from "+tb_gis+" where id=a.id_1 limit 1) end," + \
"coalesce(case when level=2 then name else (select name from "+tb_gis+" where id=a.id_2 limit 1) end,'')," + \
"coalesce(case when level=3 then name else (select name from "+tb_gis+" where id=a.id_3 limit 1) end,'')," + \
"name,id FROM "+tb_gis+" a where id="+id
cur.execute(s)
r=cur.fetchone()
if r:
......@@ -98,27 +99,27 @@ def ajax_adm_info(request,level=1,parent_id=None):
parent_id='0'
#是否直辖市 LEVEL 和 ID_要加1
is_zx=False
cur.execute("select code from gis.adm where id="+parent_id)
cur.execute("select code from "+tb_gis+" where id="+parent_id)
r=cur.fetchone()
if r:
if r[0][:2] in zxs:
is_zx=True
s=''
if level=='1':
s="select id,name from gis.adm where level=1"
s="select id,name from "+tb_gis+" where level=1"
elif level=='2':
if is_zx:
s="select id,name from gis.adm where level=3 and id_1="+parent_id+\
s="select id,name from "+tb_gis+" where level=3 and id_1="+parent_id+\
" and name not in ('省直辖县级行政区划','市辖区')"
else:
s="select id,name from gis.adm where level=2 and id_1="+parent_id+\
s="select id,name from "+tb_gis+" where level=2 and id_1="+parent_id+\
" and name not in ('省直辖县级行政区划','市辖区')"
elif level=='3':
if is_zx:
s="select id,name from gis.adm where level=4 and id_3="+parent_id+\
s="select id,name from "+tb_gis+" where level=4 and id_3="+parent_id+\
" and name not in ('市辖区')"
else:
s="select id,name from gis.adm where level=3 and id_2="+parent_id+\
s="select id,name from "+tb_gis+" where level=3 and id_2="+parent_id+\
" and name not in ('市辖区')"
if s:
s=s+" order by name"
......
# Generated by Django 3.1.4 on 2023-08-25 13:40
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('inventory', '0187_dndetails_marking'),
]
operations = [
migrations.AlterField(
model_name='batch',
name='distributor_id',
field=models.IntegerField(blank=True, null=True, verbose_name='分销商id'),
),
]
......@@ -264,8 +264,8 @@ class Batch(TJModel):
rmk_address=models.CharField(_('客户/收贷人地址'),max_length=100,blank=True,null=True)
# 2023-03-03 此笔发货对应的平台商(一级),适用于工厂直接发货给分销商(二级)且此分销商属于2个以上的平台商,扫码枪指定了对应平台商
distributor_id=models.IntegerField(_("平台商id"),blank=True,null=True)
# 2023-03-03 仓库是否把货直接发给订单客户下属分销商. 且此分销商属于2个以上的平台商
distributor_id=models.IntegerField(_("分销商id"),blank=True,null=True)
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论