Commit 588c0966 by chenxx

新增表dj_2023_settle_details dj_2023_settle_details_record

1 parent 87be3cc4
......@@ -25,7 +25,7 @@ logger.addHandler(cnslhandler)
g_supply_dbcfg = {'host': '192.168.5.23', 'port': 3306, 'user': 'data_house_user', 'passwd': 'ZhaiMiAxIg',
'db': 'glsx_supplychain', 'charset': 'utf8'}
g_pro_biz_dbcfg = {'host': '192.168.5.20', 'port': 3306, 'user': 'biz_glsx_data', 'passwd': 'unEKczDc',
g_pro_biz_dbcfg = {'host': '192.168.5.1', 'port': 3306, 'user': 'biz_glsx_data', 'passwd': 'unEKczDc',
'db': 'glsx_biz_data', 'charset': 'utf8'}
g_presto_host = '192.168.5.35'
g_presto_port = 9090
......@@ -46,6 +46,22 @@ monthDict = {
}
newMonthDict = {
'2022年1月':'2022-01',
'2022年2月':'2022-02',
'2022年3月':'2022-03',
'2022年4月':'2022-04',
'2022年5月':'2022-05',
'2022年6月':'2022-06',
'2022年7月':'2022-07',
'2022年8月':'2022-08',
'2022年9月':'2022-09',
'2022年10月':'2022-10',
'2022年11月':'2022-11',
'2022年12月':'2022-12',
}
def calc_hardware_cost():
'''计算硬件成本'''
bizConn = MySQL(g_pro_biz_dbcfg)
......@@ -314,9 +330,107 @@ def calc_cost_duplicate_device(type = 1):
logger.info("calc_cost_duplicate_device done, total=%d", total)
def calc_2022_cost():
"""
计算22年成本
:return:
"""
'''计算硬件成本'''
bizConn = MySQL(g_pro_biz_dbcfg)
#t_hardware_cost_bill_2021_10_12
sql = "select finmonth,settle_merchant,total,amount from dj_2022_hardware_cost_bill "
if not bizConn.query(sql):
logger.error("calc_hardware_cost fail, sql=%s", sql)
return
res = bizConn.fetchAllRows()
monthFormat = "'%Y-%m'"
for v in res:
month = v[0]
settleMonth = newMonthDict.get(month, None)
if settleMonth is None:
continue
settleMerchant = v[1]
if settleMerchant in ('广汇','上海宝信实嘉汽车销售有限公司天津武清分公司','东台宝通汽车服务有限责任公司','东台宝通汽车服务有限责任公司'):
settleMerchant = '广汇汽车'
total = v[2]
if total is None:
continue
amount = float(v[3])
if total > 0:
tblName = 'dj_2021_settle_details'
else:
tblName = 'dj_2021_settle_details_return'
querySql = f"select count(1) from {tblName} where device_type = 8 and settle_time >= '2022-01-01' " \
f"and settle_merchant like '%{settleMerchant}%' and date_format(settle_time, '%Y-%m')='{settleMonth}'"
#logger.info(querySql)
if not bizConn.query(querySql):
logger.error("calc_2022_hardware_cost fail, sql=%s", querySql)
return
result = bizConn.fetchAllRows()
details_total = 0
for row in result:
details_total = row[0]
if details_total != total:
logger.warning(f"calc_2022_hardware_cost {settleMerchant} {settleMonth} {amount} finTotal={total} details_total={details_total}")
if details_total == 0:
continue
# details_total:2022年每个月的对应结算商户的GPS,OBD硬件总数量 amount: 2022每月GPS设备总成本金额 price: 022年每个月的对应结算商户的每个硬件的成本价格 hw_cost:每个硬件价格 price=hw_cost
price = amount/details_total
updateSql = f"update {tblName} set hw_cost={price} where device_type = 8 and settle_time >= '2022-01-01' " \
f"and settle_merchant like '%{settleMerchant}%' and date_format(settle_time, '%Y-%m')='{settleMonth}'"
if not bizConn.update(updateSql):
logger.info(f"failed, updateSql = {updateSql}")
logger.info(f"calc_2022_cost month={settleMonth} settlemer={settleMerchant} total={total} "
f"details_total={details_total} amount={amount} price={price}")
'''
querySql = "select channel,sn,settle_time,active_time,pk_period from {} where settle_time >= '2022-01-01' and " \
"settle_merchant like '%{}%' " \
"and date_format(settle_time, {})='{}' limit {}".format(tblName, settleMerchant, monthFormat, settleMonth, total)
logger.info(querySql)
if not bizConn.query(querySql):
logger.error("calc_hardware_cost fail, sql=%s", querySql)
return
result = bizConn.fetchAllRows()
if len(result) != total:
logger.info("calc_hardware_cost month=%s settlemer=%s total=%d price=%f find=%d",
settleMonth, settleMerchant, total, price, len(result))
arrValues = []
for row in result:
channel = row[0]
sn = row[1]
settleTime = row[2]
activeTime = row[3]
period = row[4]
strValue = "(%s,%s,%s,%s,%s,%s,%s)" % (paddstr(channel), paddstr(sn), paddstr(settleTime),
paddstr(activeTime), paddnum(period),
paddstr(settleMerchant), paddnum(price))
arrValues.append(strValue)
if len(arrValues) > 0:
insertSql = "insert into t_hardware_cost (mer_type,sn,settle_time,active_time," \
"period,settle_merchant,price) values " + ",".join(arrValues)
if not bizConn.insert(insertSql):
logger.error("calc_hardware_cost fail, sql=%s ", insertSql)
return
'''
logger.info("calc_2022_hardware_cost done")
if __name__ == '__main__':
'''计算'''
calc_hardware_cost()
#calc_hardware_cost()
#calc_install_cost()
......@@ -326,6 +440,10 @@ if __name__ == '__main__':
#calc_cost_duplicate_device(type=1)
"""计算22年成本明细数据"""
calc_2022_cost()
......
......@@ -25,7 +25,7 @@ logger.addHandler(cnslhandler)
g_supply_dbcfg = {'host': '192.168.5.23', 'port': 3306, 'user': 'data_house_user', 'passwd': 'ZhaiMiAxIg',
'db': 'glsx_supplychain', 'charset': 'utf8'}
g_pro_biz_dbcfg = {'host': '192.168.5.20', 'port': 3306, 'user': 'biz_glsx_data', 'passwd': 'unEKczDc',
g_pro_biz_dbcfg = {'host': '192.168.5.2', 'port': 3306, 'user': 'biz_glsx_data', 'passwd': 'unEKczDc',
'db': 'glsx_biz_data', 'charset': 'utf8'}
g_presto_host = '192.168.5.35'
g_presto_port = 9090
......@@ -302,26 +302,33 @@ def getPkTerm(pkName):
def match_not_direct_settlement_delivery_order(startTime, devType=8, mode=0):
"""根据未匹配的订单生成设备"""
"""
dj_2023_settle_details: 2023嘀加结算明细表
dj_2023_settle_details_record: 2023嘀加记录仪结算明细表
dj_2021_delivery_device: 2021嘀加设备
dj_2021_delivery_device_record: 2021嘀加记录仪设备
dj_2023_settlment_order: 2023年应收单(商务数据)
根据未匹配的订单生成设备
"""
bizConn = MySQL(g_pro_biz_dbcfg)
settMerDict = {}
query_settlement_merchant(bizConn, settMerDict)
if devType == 8:
deliverytTblName = 'dj_2021_delivery_device'
resultTblName = 'dj_2022_settle_details'
resultTblName = 'dj_2023_settle_details'
strType = "('GPS','OBD')"
tblName = 'dj_2022_settlment_order_06plus'
tblName = 'dj_2023_settlment_order'
elif devType == 6:
deliverytTblName = 'dj_2021_delivery_device_record'
resultTblName = 'dj_2022_settle_details_record'
resultTblName = 'dj_2023_settle_details_record'
strType = "('记录仪')"
tblName = 'dj_2022_settlment_order_06plus'
tblName = 'dj_2023_settlment_order'
elif devType == 12501:
deliverytTblName = 'dj_2021_delivery_device_record'
resultTblName = 'dj_2022_settle_details_record'
resultTblName = 'dj_2023_settle_details_record'
strType = "('车充')"
tblName = 'dj_2022_settlment_order_06plus'
tblName = 'dj_2023_settlment_order'
# and business_type = '智慧门店SAAS服务'
sql = "SELECT id,finance_time,trim(cus_name),product_code,total,hw_unit_price_tax,hw_unit_price,pk_unit_price_tax," \
......@@ -650,7 +657,7 @@ def update_delivery_device_settle_merchant(devType=8, year=2021):
else:
for key in merDict.keys():
updateSql = "update " + deliverytTblName + " set customer_name='%s' " \
"where delivery_time >= '2022-09-01 00:00:00' and send_merchant_name='%s' " \
"where delivery_time >= '2023-01-01 00:00:00' and send_merchant_name='%s' " \
"and customer_name = ''" % (merDict.get(key), key)
if not bizConn.update(updateSql):
logger.error("match_nodirect_settlement_delivery_order fail, sql=%s", updateSql)
......@@ -749,7 +756,7 @@ def query_supplychain_delivery_device(startTime, endTime, devType=8):
def textToNumber(text):
if text == '' or text == '-':
if text == '' or text == '-' or text is None:
return 0
else:
return int(float(text))
......@@ -812,14 +819,21 @@ def query_settlement_merchant(auditConn, settMerDict={}):
def active_direct_merchant_device():
'''计算直销激活'''
"""
计算直销激活
merMonthActive: {
"成都车亿科技有限公司": [1,2,5,4,3], //1-12月份的数据
"成都创晟汽车服务有限公司": [1,2,5,4,3], //1-12月份的数据
"cusName3": [1,2,5,4,3] //1-12月份的数据
...
}
"""
bizConn = MySQL(g_pro_biz_dbcfg)
settMerDict = {}
query_settlement_merchant(bizConn, settMerDict)
sql = "select customer,active_202101,active_202102,active_202103,active_202104,active_202105,active_202106," \
"active_202107,active_202108,active_202109,active_202110,active_202111,active_202112 from dj_2022_direct_cus_active "
"active_202107,active_202108,active_202109,active_202110,active_202111,active_202112 from dj_2022_direct_cus_active_0212 "
sql = "select customer,active_202103,active_202104,active_202105,active_202106,active_202107,active_202108 from dj_2022_direct_cus_active_new"
if not bizConn.query(sql):
logger.error("active_direct_merchant_device fail, sql=%s", sql)
......@@ -831,21 +845,21 @@ def active_direct_merchant_device():
# logger.info("active_direct_merchant_device %s", v)
cusName = v[0]
monthActive = []
month3_active = textToNumber(v[1])
monthActive.append(month3_active)
month1_active = textToNumber(v[1])
monthActive.append(month1_active)
month2_active = textToNumber(v[2])
monthActive.append(month2_active)
month4_active = textToNumber(v[3])
month3_active = textToNumber(v[3])
monthActive.append(month3_active)
month4_active = textToNumber(v[4])
monthActive.append(month4_active)
month5_active = textToNumber(v[4])
monthActive.append(month5_active)
month6_active = textToNumber(v[5])
monthActive.append(month6_active)
month7_active = textToNumber(v[6])
monthActive.append(month7_active)
'''
month8_active = textToNumber(v[7])
monthActive.append(month8_active)
month8_active = textToNumber(v[8])
......@@ -858,14 +872,16 @@ def active_direct_merchant_device():
monthActive.append(month11_active)
month12_active = textToNumber(v[12])
monthActive.append(month12_active)
'''
merMonthActive[cusName] = monthActive
for key in merMonthActive.keys():
logger.info("active_direct_merchant_device mer=%s %s", key, merMonthActive.get(key))
monthActives = merMonthActive.get(key)
settleMer = key
month = 2
month = 0
for activeTotal in monthActives:
month += 1
if activeTotal == 0:
......@@ -874,7 +890,7 @@ def active_direct_merchant_device():
hour=0, minute=0, second=0, microsecond=0)
nextMonth = activeMonth + relativedelta(months=1)
sql = "select id,delivery_time,settle_time from dj_2021_settle_details where device_type = 8 " \
"and active_time is null and " \
"and active_time is null and `return`=0 and " \
"delivery_time < '%s' and settle_merchant = '%s' order by delivery_time limit %d" % \
(nextMonth, settleMer, activeTotal)
if not bizConn.query(sql):
......@@ -906,6 +922,7 @@ def active_direct_merchant_device():
logger.error("active_direct_merchant_device fail, sql=%s", updateSql)
return
bizConn.commit()
#logger.info(f"active_direct_merchant_device settle_merchant={settleMer} month={activeMonth} total={activeTotal}")
logger.info("active_direct_merchant_device done")
......@@ -975,6 +992,7 @@ def handle_return_device(channel, data, devType, matchPrice=0):
'''
if devType == 8:
srcTblName = 'dj_2022_settlment_order_06plus'
orderColumn = ' NULL as delivery_order'
if data == 2021:
tblName = 'dj_2021_settle_details'
......@@ -988,7 +1006,7 @@ def handle_return_device(channel, data, devType, matchPrice=0):
sql = "SELECT id,finance_time,cus_name,product_code,total,hw_unit_price_tax,hw_unit_price,pk_unit_price_tax," \
"pk_unit_price,install_unit_price_tax,install_unit_price,product_name,pk_term,pk_name,cost,match_total," \
"sale_type from %s where sale_type = '%s' and device_type in ('GPS','OBD') and product_type = '硬件' " \
"and business_type ='SAAS系统订阅服务—旧版本' " \
"and business_type in ('SAAS系统订阅服务—旧版本', '智慧门店SAAS服务') " \
"and product_name<>'销售折扣' and status <> 1 and total < 0 order by finance_time desc" % (srcTblName, channel)
else:
tblName = 'dj_2022_settle_details_record'
......@@ -1008,7 +1026,7 @@ def handle_return_device(channel, data, devType, matchPrice=0):
"pk_unit_price,install_unit_price_tax,install_unit_price,product_name,pk_term,pk_name,cost,match_total," \
"sale_type,device_type from " \
"%s where device_type = '%s' and product_type = '硬件' and product_name<>'销售折扣' " \
"and business_type ='SAAS系统订阅服务—旧版本' " \
"and business_type in ('SAAS系统订阅服务—旧版本', '智慧门店SAAS服务') " \
"and status <> 1 and total < 0 order by finance_time desc" % (srcTblName, strType)
# and product_name <> '销售折扣'
if data == 2020:
......@@ -1178,7 +1196,7 @@ def active_direct_record_device():
tblName = "dj_2021_settle_details"
query_settlement_merchant(bizConn, settMerDict)
sql = f"select id,settle_time,settle_merchant from {tblName} where channel='直销' and device_type in (6,12501) " \
sql = f"select id,settle_time,settle_merchant from {tblName} where channel='渠道' and device_type in (6,12501) " \
f"and `return` = 0 and pk_period > 0 and active_time is null"
if not bizConn.query(sql):
logger.error("active_direct_record_device fail, sql=%s", sql)
......@@ -1211,9 +1229,10 @@ def active_direct_record_device():
activeTime = "%04d-%02d-%02d %02d:%02d:%02d" % (
activeDate.year, activeDate.month, activeDate.day, hour, munite, sencond)
if activeTime > '2022-08-01 00:00:00':
updateSql = f"update {tblName} set active_time=null,active_merchant='' where id=%d" % (
idx)
if activeTime >= '2023-01-01 00:00:00':
#updateSql = f"update {tblName} set active_time=null,active_merchant='' where id=%d" % (
# idx)
continue
else:
updateSql = f"update {tblName} set active_time='%s',active_merchant='%s' where id=%d" % (
activeTime, shopName, idx)
......@@ -1459,49 +1478,55 @@ def modify_direct_20211012_cost_price(isReturn=False):
if __name__ == "__main__":
''''''
startTime = '2022-09-01'
endTime = '2023-01-01'
query_supplychain_delivery_device(startTime, endTime, devType=8)
startTime = '2023-01-01'
endTime = '2023-03-31'
# 导入GPS OBD 车充设备
#query_supplychain_delivery_device(startTime, endTime, devType=8)
# 导入记录仪 车充设备
#query_supplychain_delivery_device(startTime, endTime,devType=6)
#query_supplychain_delivery_device(startTime, endTime,devType=6)
#更新供应链出库设备的结算客户 6表示: 记录仪 车充
#update_delivery_device_settle_merchant(6, 2021)
#update_delivery_device_settle_merchant(8, 2021)
#处理直销 (原代销)
#match_not_direct_settlement_delivery_order(startTime, 8, 0)
#匹配客户渠道 (原直销)
#match_direct_settlement_delivery_order(startTime, devType=8, findmode=0)
#记录仪直销 (原代销)
#match_not_direct_settlement_delivery_order(startTime, devType=6, mode=0)
#记录仪渠道 (原直销)
#match_direct_settlement_delivery_order(startTime, devType=6, findmode=0)
#车充直销 (原代销)
#match_not_direct_settlement_delivery_order(startTime, devType=12501, mode=0)
#车充渠道 (原直销)
#match_direct_settlement_delivery_order(startTime, devType=12501, findmode=0)
# #处理直销 (原代销)
# match_not_direct_settlement_delivery_order(startTime, 8, 0)
# #匹配客户渠道 (原直销)
# match_direct_settlement_delivery_order(startTime, devType=8, findmode=0)
#
# #记录仪直销 (原代销)
# match_not_direct_settlement_delivery_order(startTime, devType=6, mode=0)
# #记录仪渠道 (原直销)
# match_direct_settlement_delivery_order(startTime, devType=6, findmode=0)
#
# #车充直销 (原代销)
# match_not_direct_settlement_delivery_order(startTime, devType=12501, mode=0)
# #车充渠道 (原直销)
# match_direct_settlement_delivery_order(startTime, devType=12501, findmode=0)
#处理退货
#直销追踪器退货 -- 一般不会又直销的退货
# #追踪器
# handle_return_device('直销', data=2021, devType=8)
#追踪器
#handle_return_device('直销', data=2021, devType=8)
#记录仪
# handle_return_device('直销', data=2021, devType=6)
#车充退货
# handle_return_device('渠道', data=2021, devType=12501)
#handle_return_device('直销', data=2021, devType=6)
#车充退货
handle_return_device('渠道', data=2021, devType=12501)
#渠道追踪器退货
# handle_return_device('渠道', data=2021, devType=8)
handle_return_device('渠道', data=2021, devType=8)
#记录仪
# handle_return_device('渠道', data=2021, devType=6)
# 车充退货
# handle_return_device('渠道', data=2021, devType=12501)
handle_return_device('渠道', data=2021, devType=6)
#记录仪渠道激活
#active_direct_record_device()
print("done")
\ No newline at end of file
#追踪器渠道测算激活
# active_direct_merchant_device()
print("done")
......@@ -6,9 +6,11 @@ import logging
g_pro_biz_dbcfg = {'host': '192.168.5.20', 'port': 3306, 'user': 'biz_glsx_data', 'passwd': 'unEKczDc',
'db': 'glsx_biz_data', 'charset': 'utf8'}
'''
g_pro_biz_dbcfg = {'host': '192.168.5.25', 'port': 3310, 'user': 'biz_device_detail', 'passwd': 'M6khz3CQ',
'db': 'device_detail',
'charset': 'utf8'}
'''
def get_months(begin, end):
......@@ -72,6 +74,8 @@ def calc_income_share(calcType='收入'):
计算收入的分摊
:return:
"""
tblName = "dj_device_details"
tblName = 'dj_2021_settle_details'
fileName = calcType + ".csv"
fileHandle = open(file=fileName, mode='w', encoding="utf-8")
bizConn = MySQL(g_pro_biz_dbcfg)
......@@ -80,18 +84,20 @@ def calc_income_share(calcType='收入'):
sql = f"select settle_merchant,case when device_type=8 then '追踪器' when device_type=6 then '记录仪' when device_type=12501 then '车充' end," \
f"pk_period,DATE_FORMAT(settle_time, '%Y-%m') as settle_month," \
f"DATE_FORMAT(active_time,'%Y-%m') as active_month,COUNT(1) as count," \
f"sum(IFNULL(pk_price,0) + IFNULL(hw_price, 0) + IFNULL(install_price, 0)) as amount, channel " \
f"from dj_device_details where settle_time < '2022-01-01 00:00:00' and device_type = 8 " \
f"GROUP BY settle_merchant,device_type,pk_period,DATE_FORMAT(settle_time, '%Y-%m'),DATE_FORMAT(active_time,'%Y-%m'),channel " \
f"order by settle_month"
f"sum(IFNULL(pk_price,0) + IFNULL(hw_price, 0) + IFNULL(install_price, 0)) as amount, channel," \
f"case when `return`=1 then '退货' else '正常' end " \
f"from {tblName} where settle_time < '2023-01-01 00:00:00' and device_type = 8 " \
f"GROUP BY settle_merchant,device_type,pk_period,DATE_FORMAT(settle_time, '%Y-%m'),DATE_FORMAT(active_time,'%Y-%m'),channel,`return` " \
f"order by settle_merchant,settle_month"
elif calcType == '成本':
sql = f"select settle_merchant,case when device_type=8 then '追踪器' when device_type=6 then '记录仪' when device_type=12501 then '车充' end," \
f"pk_period,DATE_FORMAT(settle_time, '%Y-%m') as settle_month," \
f"DATE_FORMAT(active_time,'%Y-%m') as active_month,COUNT(1) as count," \
f"sum(IFNULL(hw_cost,0) + IFNULL(install_cost, 0) ) as amount, channel " \
f"from dj_device_details where settle_time < '2022-01-01 00:00:00' and device_type = 8 " \
f"GROUP BY settle_merchant,device_type,pk_period,DATE_FORMAT(settle_time, '%Y-%m'),DATE_FORMAT(active_time,'%Y-%m'),channel " \
f"order by settle_month"
f"sum(IFNULL(hw_cost,0) + IFNULL(install_cost, 0) ) as amount, channel, " \
f"case when `return`=1 then '退货' else '正常' end " \
f"from {tblName} where settle_time < '2023-01-01 00:00:00' and device_type = 8 " \
f"GROUP BY settle_merchant,device_type,pk_period,DATE_FORMAT(settle_time, '%Y-%m'),DATE_FORMAT(active_time,'%Y-%m'),channel,`return` " \
f"order by settle_merchant,settle_month"
if not bizConn.query(sql):
return
......@@ -100,7 +106,7 @@ def calc_income_share(calcType='收入'):
headName = f"客户名称,渠道,服务期限,数量,结算月份,不含税收入,开始计费月份,结束计费月份,不含税单价,月摊收入,"\
f"2017年摊销金额,2017年末累计摊销余额,2018年摊销金额,"\
f"2018年末累计摊销余额,2019年摊销金额,2019年末累计摊销余额,2020年摊销金额,2020年末累计摊销余额,2021年摊销金额,"\
f"2021年末累计摊销余额,2022年摊销金额,2022年末累计摊销余额,产品分类,激活开始月份,激活结束月份 \n"
f"2021年末累计摊销余额,2022年摊销金额,2022年末累计摊销余额,产品分类,激活开始月份,激活结束月份,是否退货,研发开始分摊月份 \n"
fileHandle.write(headName)
for row in result:
settleMer = row[0]
......@@ -116,6 +122,7 @@ def calc_income_share(calcType='收入'):
total = row[5]
amount = row[6]
channel = row[7]
returnFlag = row[8]
if active_month is None:
start_share = '2025-12'
......@@ -126,14 +133,18 @@ def calc_income_share(calcType='收入'):
active_start_month = datetime.datetime.strptime(start_share, '%Y-%m')
active_end_month = active_start_month + relativedelta(months=period) - relativedelta(days=1)
# 代销从结算时间开始
if (channel == '代销' or channel == '广汇') and (active_start_month == '' or active_start_month < settle_end_month):
start_share = settle_start_month
#
elif (channel == '直销' and settle_start_month >= '2022-01') and (active_start_month == '' or active_start_month < settle_end_month):
start_share = settle_start_month
start_share_month = datetime.datetime.strptime(start_share, '%Y-%m')
end_share_month = start_share_month + relativedelta(months=period) - relativedelta(days=1)
price = amount / total
share_per_month = amount / period
share_per_month = amount / period #share_per_month: 每年每月摊销多少
'''
gap_2018_months = get_months(start_share_month, datetime_2017_end)
......@@ -175,7 +186,7 @@ def calc_income_share(calcType='收入'):
f"{settle_end_month},{price},{share_per_month},{share_2017},{remainShare2017},{share_2018},"\
f"{remainShare2018},{share_2019},{remainShare2019},{share_2020},{remainShare2020},"\
f"{share_2021},{remainShare2021},{share_2022},{remainShare2022},{devName},"\
f"{active_start_month},{active_end_month}\n"
f"{active_start_month},{active_end_month},{returnFlag},{start_share_month}\n"
fileHandle.write(lineName)
fileHandle.close()
......@@ -185,6 +196,8 @@ def calc_return_share(calcType):
退货
:return:
"""
tblName = 'dj_2021_settle_details_return'
fileName = calcType + ".csv"
fileHandle = open(file=fileName, mode='w', encoding="utf-8")
bizConn = MySQL(g_pro_biz_dbcfg)
......@@ -192,16 +205,16 @@ def calc_return_share(calcType):
sql = f"select settle_merchant,case when device_type=8 then '追踪器' when device_type=6 then '记录仪' when device_type=12501 then '车充' end," \
f"pk_period,DATE_FORMAT(settle_time, '%Y-%m') as settle_month,COUNT(1) as count," \
f"sum(IFNULL(hw_cost,0) + IFNULL(install_cost, 0) ) as amount, channel " \
f"from dj_device_details_return where settle_time < '2022-01-01 00:00:00' and device_type = 8 " \
f"from {tblName} where settle_time < '2023-01-01 00:00:00' and device_type = 8 " \
f"GROUP BY settle_merchant,device_type,pk_period,DATE_FORMAT(settle_time, '%Y-%m'),channel " \
f"order by settle_month"
f"order by settle_merchant,settle_month"
elif calcType == '退货收入':
sql = f"select settle_merchant,case when device_type=8 then '追踪器' when device_type=6 then '记录仪' when device_type=12501 then '车充' end," \
f"pk_period,DATE_FORMAT(settle_time, '%Y-%m') as settle_month,COUNT(1) as count," \
f"sum(0-IFNULL(pk_price, 0) + IFNULL(hw_price, 0) + IFNULL(install_price, 0)) as amount, channel " \
f"from dj_device_details_return where settle_time < '2022-01-01 00:00:00' and device_type = 8 " \
f"sum(IFNULL(pk_price, 0) + IFNULL(hw_price, 0) + IFNULL(install_price, 0)) as amount, channel " \
f"from {tblName} where settle_time < '2023-01-01 00:00:00' and device_type = 8 " \
f"GROUP BY settle_merchant,device_type,pk_period,DATE_FORMAT(settle_time, '%Y-%m'),channel " \
f"order by settle_month"
f"order by settle_merchant,settle_month"
if not bizConn.query(sql):
return
result = bizConn.fetchAllRows()
......@@ -265,5 +278,5 @@ def calc_return_share(calcType):
if __name__ == "__main__":
calc_income_share(calcType='收入')
calc_income_share(calcType='成本')
#calc_return_share('退货收入')
#calc_return_share('退货成本')
calc_return_share('退货收入')
calc_return_share('退货成本')
File mode changed
......@@ -31,7 +31,7 @@ g_dev_biz_dbcfg = {'host': '192.168.3.227', 'port': 3306, 'user': 'dev_admin', '
'db': 'glsx_biz_data', 'charset': 'utf8'}
fetchsize = 1500
env = 'dev'
env = 'pro'
if env == 'dev':
g_papdev_dbcfg = {'host': '47.115.93.31', 'port': 3307, 'user': 'user_zhaimx', 'passwd': 'dOCN0L7i',
'db': 'glsx_pap', 'charset': 'utf8'}
......@@ -236,6 +236,7 @@ def sync_car_permanent(dataFrom):
logger.info ("sync_car_permanent progress count=%d" % count)
updateTableSynLog(auditConn, tblName, startId)
def sync_car_maintain(dataFrom, fromTime):
'''同步维修保养'''
fetch = fetchsize
......@@ -251,15 +252,17 @@ def sync_car_maintain(dataFrom, fromTime):
strColunms = "sn,stand_no,total_mileage,in_time,prev_mileage,first_time," \
"remind_type,remind_rule,diff_mileage,diff_time,is_new,number_of_shops," \
"numbers,distance,svrtime,merchant_id,merchant_name,created_by,created_date,updated_by,deleted_flag," \
"numbers,distance,svrtime,merchant_id,merchant_name,created_by,created_date,updated_by,deleted_flag"
'''
"plate_number,name,mobile,current_day_time,company,car_brand,car_model,car_system,regist_time,insurance_time," \
"status,diff_backshop_mileage,diff_backshop_time,vehicle_id,follow_result,follow_time,follow_remarks,maintain_source" \
'''
bizscreenConn = MySQL(g_biz_dbcfg)
startId = getTableSyncLog(auditConn,tblName)
count = 0
while (True):
sql = "select id,%s from dj_car_maintain where in_time>'%s' and id > %d and deleted_flag = 'N' order by id limit %d" % (
sql = "select id,%s from dj_car_maintain where svrtime>'%s' and svrtime<'2023-01-01' and id > %d and deleted_flag = 'N' order by id limit %d" % (
strColunms, fromTime, startId, fetch)
if False == srcDbConn.query(sql):
logger.error("sync_car_maintain query error, sql=" + sql)
......@@ -267,8 +270,8 @@ def sync_car_maintain(dataFrom, fromTime):
arrValues = []
result = srcDbConn.fetchAllRows()
for v in result:
arr = [];
id = int(v[0]);
arr = []
id = int(v[0])
count += 1
if id > startId:
startId = id
......@@ -276,7 +279,7 @@ def sync_car_maintain(dataFrom, fromTime):
sn = v[1]
fkInfo = g_dev_map_dict.get(sn,None)
if fkInfo is None:
logger.warn("sync_car_maintain can not find fksn, sn=%s",sn)
logger.warning("sync_car_maintain can not find fksn, sn=%s",sn)
continue
sn = fkInfo.sn
merId = fkInfo.merId
......@@ -285,7 +288,7 @@ def sync_car_maintain(dataFrom, fromTime):
svrtime = str(v[15])
strAddSvtTime = str(v[15] + relativedelta(days=-30))
if fkInfo.activeTime > strAddSvtTime:
logger.warn("sync_car_maintain svrtime=%s activetime=%s",svrtime,fkInfo.activeTime)
logger.warning("sync_car_maintain svrtime=%s activetime=%s",svrtime,fkInfo.activeTime)
continue
arr.append(paddstr(sn));arr.append(paddstr(v[2]));arr.append(paddnum(v[3]));arr.append(paddstr(v[4]));
......@@ -294,11 +297,13 @@ def sync_car_maintain(dataFrom, fromTime):
arr.append(paddnum(v[13]));arr.append(paddnum(v[14]));arr.append(paddstr(str(v[15]))); arr.append(paddnum(merId))
arr.append(paddstr(merName));arr.append(paddstr(v[18]));arr.append(paddstr(v[19]));arr.append(paddstr(v[20]));arr.append(paddstr(v[21]))
'''
arr.append(paddstr(v[22]));arr.append(paddstr(v[23]));arr.append(paddstr(v[24]));arr.append(paddstr(v[25]))
arr.append(paddstr(v[26]));arr.append(paddstr(v[27]));arr.append(paddstr(v[28]));arr.append(paddstr(v[29]))
arr.append(paddstr(v[30]));arr.append(paddstr(v[31]));arr.append(paddnum(v[32]));arr.append(paddnum(v[33]))
arr.append(paddnum(v[34]));arr.append(paddnum(v[35]));arr.append(paddnum(v[36]));arr.append(paddstr(v[37]))
arr.append(paddstr(v[38]));arr.append(paddnum(v[39]))
'''
value = "(" + ",".join(arr) + ")"
arrValues.append(value)
if len(result) == 0:
......@@ -309,7 +314,7 @@ def sync_car_maintain(dataFrom, fromTime):
if False == bizscreenConn.insert(insSql):
logger.error ("sync_car_maintain dst_conn.insert failed:%s" % insSql)
break
logger.info ("sync_car_maintain progress count=%d" % count)
logger.info (f"sync_car_maintain dataFrom={dataFrom} progress count={count}" % count)
updateTableSynLog(auditConn, tblName, startId)
......@@ -406,7 +411,7 @@ def sync_car_loss_warning(dataFrom, fromTime):
startId = getTableSyncLog(auditConn,tblName)
count = 0
while (True):
sql = "select id,%s from dj_car_loss_warning where trigger_time >='%s' and id > %d and deleted_flag = 'N' order by id limit %d" % (
sql = "select id,%s from dj_car_loss_warning where trigger_time >='%s' and trigger_time < '2023-01-01' and and id > %d and deleted_flag = 'N' order by id limit %d" % (
strColunms, fromTime, startId, fetch)
if False == srcDbConn.query(sql):
logger.error("sync_car_loss_warning query error, sql=" + sql)
......@@ -469,13 +474,13 @@ def sync_car_shop_warning(dataFrom, fromTime):
auditConn = MySQL(g_biz_dbcfg)
strColunms = "sn,stand_no,enter_time,out_time,trigger_time,alarm_type,is_new,last_time_distance,last_time_day," \
"merchant_id,merchant_name,created_by,created_date,updated_by,updated_date,deleted_flag," \
"plate_number,name,mobile,merchant_type,task_id,vehicle_id"
"merchant_id,merchant_name,created_by,created_date,updated_by,updated_date,deleted_flag"
#"plate_number,name,mobile,merchant_type,task_id,vehicle_id"
bizscreenConn = MySQL(g_biz_dbcfg)
startId = getTableSyncLog(auditConn,tblName)
count = 0
while (True):
sql = "select id,%s from dj_car_shop_warning where trigger_time>='%s' and id > %d and deleted_flag = 'N' order by id limit %d" % (
sql = "select id,%s from dj_car_shop_warning where trigger_time>='%s' and trigger_time < '2023-01-01' and id > %d and deleted_flag = 'N' order by id limit %d" % (
strColunms, fromTime, startId, fetch)
if False == srcDbConn.query(sql):
logger.error("sync_car_shop_warning query error, sql=" + sql)
......@@ -492,7 +497,7 @@ def sync_car_shop_warning(dataFrom, fromTime):
sn = v[1]
fkInfo = g_dev_map_dict.get(sn,None)
if fkInfo is None:
logger.warn("sync_car_shop_warning can not find fksn, sn=%s",sn)
#logger.warning("sync_car_shop_warning can not find fksn, sn=%s",sn)
continue
sn = fkInfo.sn
merId = fkInfo.merId
......@@ -500,7 +505,7 @@ def sync_car_shop_warning(dataFrom, fromTime):
triggtime = str(v[3])
if fkInfo.activeTime > triggtime:
logger.warn("sync_car_shop_warning triggtime=%s activetime=%s",triggtime,fkInfo.activeTime)
logger.warning("sync_car_shop_warning triggtime=%s activetime=%s",triggtime,fkInfo.activeTime)
continue
arr.append(paddstr(sn));arr.append(paddstr(v[2]));arr.append(paddstr(v[3]));arr.append(paddstr(v[4]))
......@@ -508,8 +513,10 @@ def sync_car_shop_warning(dataFrom, fromTime):
arr.append(paddnum(v[9]));arr.append(paddnum(merId));arr.append(paddstr(merName))
arr.append(paddstr(v[12]));arr.append(paddstr(v[13]));arr.append(paddstr(str(v[14]))); arr.append(paddstr(v[15]))
arr.append(paddstr(v[16]))
'''
arr.append(paddstr(v[17]));arr.append(paddstr(v[18]));arr.append(paddstr(v[19]));arr.append(paddnum(v[20]))
arr.append(paddstr(v[21]));arr.append(paddnum(v[22]))
'''
value = "(" + ",".join(arr) + ")"
arrValues.append(value)
if len(result) == 0:
......@@ -520,7 +527,7 @@ def sync_car_shop_warning(dataFrom, fromTime):
if False == bizscreenConn.insert(insSql):
logger.error ("sync_car_shop_warning dst_conn.insert failed:%s" % insSql)
break
logger.info ("sync_car_shop_warning progress count=%d" % count)
logger.info (f"sync_car_shop_warning datafrom={dataFrom} progress count={count}" )
updateTableSynLog(auditConn, tblName, startId)
......@@ -1486,7 +1493,7 @@ def sync_ddh_rescue_event(fromTime):
"CREATED_DATE,UPDATED_BY,UPDATED_DATE,DELETED_FLAG,is_emphasis_merchant," \
"is_show,DEVICE_ID,TYPE_ID,model_result"
sql = "select " + strColunms + " from ddh_rescue_event where EVENT_DATE>'%s' " % fromTime
sql = "select " + strColunms + " from ddh_rescue_event where EVENT_DATE>'%s' and EVENT_DATE < '2023-01-01' " % fromTime
if False == ddhConn.query(sql):
print ("sync_ddh_rescue_event fail,sql=%s"%sql)
return
......@@ -1551,30 +1558,22 @@ def sync_ddh_rescue_event(fromTime):
print ("sync_ddh_rescue_event done count=%d" % total)
def sync_cluses(fromTime='2022-03-01'):
''''''
#sync_car_collision('DJ', fromTime)
#sync_car_collision('GUARD', fromTime)
#ync_car_loss_warning('DJ', fromTime)
#ync_car_loss_warning('GUARD', fromTime)
def sync_cluses(fromTime='2022-01-01'):
#sync_car_maintain('DJ', fromTime)
sync_car_maintain('DJ', fromTime)
sync_car_maintain('GUARD', fromTime)
#sync_car_shop_warning('DJ', fromTime)
sync_car_shop_warning('DJ', fromTime)
sync_car_shop_warning('GUARD', fromTime)
#sync_car_permanent('DJ', fromTime)
#sync_car_permanent('GUARD', fromTime)
sync_ddh_rescue_event(fromTime)
if __name__ == "__main__":
''''''
#query_cache_dev_mapping()
sync_cluses(fromTime='2022-03-01')
query_cache_dev_mapping()
sync_cluses(fromTime='2022-01-01')
#ync_car_collision_ddh()
......
......@@ -805,20 +805,20 @@ def update_device_alloc(deviceType, startTime, endTime):
if __name__ == "__main__":
''''''
startTime = '2022-09-01'
endTime = '2022-12-01'
startTime = '2022-01-01'
endTime = '2022-02-01'
#追踪器设备
#match_gen_sn_settlement_delivery_order(startTime, devType=8, prefix='19')
#记录仪设备
match_gen_sn_settlement_delivery_order(startTime, devType=6, prefix='SH23G')
#match_gen_sn_settlement_delivery_order(startTime, devType=6, prefix='SH23G')
#'SH26H', 'SH23G', 'SH24G'
#车充设备
#match_gen_sn_settlement_delivery_order(startTime, devType=12501, prefix='864')
match_gen_sn_settlement_delivery_order(startTime, devType=12501, prefix='864')
#回滚分配的设备
# update_device_alloc(8, startTime, endTime)
# update_device_alloc(6, startTime, endTime)
#update_device_alloc(8, startTime, endTime)
#update_device_alloc(6, startTime, endTime)
......
import pandas as pd
import pymysql
g_pro_biz_dbcfg = {
"host": "192.168.5.2",
"port": 3306,
"user": "biz_glsx_data",
"passwd": "unEKczDc",
"db": "glsx_biz_data",
"charset": "utf8",
}
g_pro_biz_dbcfg = {'host': '192.168.5.20', 'port': 3306, 'user': 'biz_glsx_data', 'passwd': 'unEKczDc',
'db': 'glsx_biz_data', 'charset': 'utf8'}
def loadFinnanceExcelToMysql(fileName, sheetName):
# tableName = "dj_2022_settlment_order_finance_06plus"
tableName = "dj_2023_settlment_order_finance"
tableName = "dj_2022_settlment_order_finance_06plus"
"""将Excel表数据导入mysql"""
conn_updata = pymysql.Connect(
host="192.168.5.2",
port=3306,
user="biz_glsx_data",
passwd="unEKczDc",
db="glsx_biz_data",
charset="utf8",
)
tableName = "dj_2022_settlment_order_finance_new"
# pd.set_option('display.max_columns', 40)
'''将Excel表数据导入mysql'''
conn_updata = pymysql.Connect(host='192.168.5.20', port=3306, user='biz_glsx_data',
passwd='unEKczDc', db='glsx_biz_data', charset='utf8')
#pd.set_option('display.max_columns', 40)
data = pd.read_excel(fileName, sheet_name=sheetName, header=0)
newData = data[
[
"单据类型",
"单据编号",
"业务日期",
"客户",
"渠道",
"物料编码",
"物料名称",
"产品类型",
"设备类型",
"计价数量",
"含税单价",
"单价",
"收入",
"业务类型",
"分摊期限",
]
]
"""
newData = data[['单据类型', '单据编号', '业务日期', '客户', '渠道', '物料编码', '物料名称', '产品类型', '设备类型', '计价数量',
'含税单价', '单价', '收入', '业务类型', '分摊期限']]
'''
newData.rename(columns={'单据类型': 'order_type', '单据编号':'order_no', '业务日期':'finance_time',
'客户':'cus_name', '渠道':'sale_type', '物料编码':'product_code',
'物料名称':'product_name', '产品类型':'product_type', '设备类型':'device_type',
'计价数量':'total', '含税单价':'hw_unit_price_tax', '单价':'hw_unit_price',
'收入':'income', '业务类型':'business_type', '分摊期限':'hw_term'})
"""
newData["含税单价"].fillna(0, inplace=True)
newData["单价"].fillna(0, inplace=True)
newData["收入"].fillna(0, inplace=True)
newData["分摊期限"].fillna(0, inplace=True)
newData["设备类型"].fillna("", inplace=True)
newData["产品类型"].fillna("", inplace=True)
newData["计价数量"].fillna(0, inplace=True)
newData["业务类型"].fillna("", inplace=True)
'''
newData['含税单价'].fillna(0, inplace=True)
newData['单价'].fillna(0, inplace=True)
newData['收入'].fillna(0, inplace=True)
newData['分摊期限'].fillna(0, inplace=True)
newData['设备类型'].fillna('', inplace=True)
newData['产品类型'].fillna('', inplace=True)
newData['计价数量'].fillna(0, inplace=True)
newData['业务类型'].fillna('', inplace=True)
newData['物料名称'].fillna('', inplace=True)
newData['物料编码'].fillna('', inplace=True)
newData['单据类型'].fillna('', inplace=True)
newData['单据编号'].fillna('', inplace=True)
newData['业务日期'].fillna('', inplace=True)
newData['客户'].fillna('', inplace=True)
newData['渠道'].fillna('', inplace=True)
print(newData.head())
valueArr = []
for idx in newData.index:
hwPriceTax = newData.loc[idx, "含税单价"]
hwPrice = newData.loc[idx, "单价"]
value = (
newData.loc[idx, "单据类型"],
newData.loc[idx, "单据编号"],
newData.loc[idx, "业务日期"],
newData.loc[idx, "客户"],
newData.loc[idx, "渠道"],
newData.loc[idx, "物料编码"],
newData.loc[idx, "物料名称"],
newData.loc[idx, "产品类型"],
newData.loc[idx, "设备类型"],
newData.loc[idx, "计价数量"],
hwPriceTax,
hwPrice,
newData.loc[idx, "收入"],
newData.loc[idx, "业务类型"],
newData.loc[idx, "分摊期限"],
)
hwPriceTax = newData.loc[idx, '含税单价']
hwPrice = newData.loc[idx, '单价']
value = (newData.loc[idx, '单据类型'], newData.loc[idx, '单据编号'], newData.loc[idx, '业务日期'], newData.loc[idx, '客户'],
newData.loc[idx, '渠道'], newData.loc[idx, '物料编码'], newData.loc[idx, '物料名称'], newData.loc[idx, '产品类型'],
newData.loc[idx, '设备类型'], newData.loc[idx, '计价数量'], hwPriceTax, hwPrice,
newData.loc[idx, '收入'], newData.loc[idx, '业务类型'], newData.loc[idx, '分摊期限'])
# print(value)
valueArr.append(value)
cs = conn_updata.cursor()
sql = (
"insert into "
+ tableName
+ "(order_type,order_no,finance_time,cus_name,sale_type,product_code,"
"product_name,product_type,device_type,total,hw_unit_price_tax,"
"hw_unit_price,income,business_type,hw_term) values "
"(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)"
)
sql = "insert into " + tableName + "(order_type,order_no,finance_time,cus_name,sale_type,product_code," \
"product_name,product_type,device_type,total,hw_unit_price_tax," \
"hw_unit_price,income,business_type,hw_term) values " \
"(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)"
cs.executemany(sql, valueArr)
conn_updata.commit()
cs.close()
def loadDjExcelToMysql(fileName, sheetName):
# tableName = "dj_2022_settlment_order_06plus"
tableName = "dj_2023_settlment_order"
"""将Excel表数据导入mysql"""
conn_updata = pymysql.Connect(
host="192.168.5.2",
port=3306,
user="biz_glsx_data",
passwd="unEKczDc",
db="glsx_biz_data",
charset="utf8",
)
tableName = "dj_2022_settlment_order_06plus"
'''将Excel表数据导入mysql'''
conn_updata = pymysql.Connect(host='192.168.5.20', port=3306, user='biz_glsx_data',
passwd='unEKczDc', db='glsx_biz_data', charset='utf8')
data = pd.read_excel(fileName, sheet_name=sheetName, header=0)
newData = data[
[
"单据类型",
"单据编号",
"业务日期",
"客户",
"渠道",
"物料编码",
"物料名称",
"产品类型",
"设备类型",
"计价数量",
"含税单价",
"单价",
"硬件(总)(不含税)",
"硬件税率",
"服务(不含税)",
"服务税率",
"服务套餐",
"收入",
"业务类型",
"分摊期限",
"安装",
"安装税率",
]
]
newData["含税单价"].fillna(0, inplace=True)
newData["单价"].fillna(0, inplace=True)
newData["收入"].fillna(0, inplace=True)
newData["分摊期限"].fillna(0, inplace=True)
newData["硬件(总)(不含税)"].fillna(0, inplace=True)
newData["硬件税率"].fillna(0, inplace=True)
newData["服务(不含税)"].fillna(0, inplace=True)
newData["服务税率"].fillna(0, inplace=True)
newData["服务套餐"].fillna("", inplace=True)
newData["产品类型"].fillna("", inplace=True)
newData["设备类型"].fillna("", inplace=True)
newData["安装"].fillna(0, inplace=True)
newData["安装税率"].fillna(0, inplace=True)
# print(newData)
newData = data[['单据类型', '单据编号', '业务日期', '客户', '渠道', '物料编码', '物料名称', '产品类型', '设备类型', '计价数量',
'含税单价', '单价', '硬件(总)(不含税)', '硬件税率', '服务(不含税)', '服务税率', '服务套餐', '收入', '业务类型',
'分摊期限', '安装', '安装税率']]
newData['含税单价'].fillna(0, inplace=True)
newData['单价'].fillna(0, inplace=True)
newData['收入'].fillna(0, inplace=True)
newData['分摊期限'].fillna(0, inplace=True)
newData['硬件(总)(不含税)'].fillna(0, inplace=True)
newData['硬件税率'].fillna(0, inplace=True)
newData['服务(不含税)'].fillna(0, inplace=True)
newData['服务税率'].fillna(0, inplace=True)
newData['服务套餐'].fillna('', inplace=True)
newData['产品类型'].fillna('', inplace=True)
newData['设备类型'].fillna('', inplace=True)
newData['安装'].fillna(0, inplace=True)
newData['安装税率'].fillna(0, inplace=True)
#print(newData)
valueArr = []
for idx in newData.index:
hwPriceTax = newData.loc[idx, "含税单价"]
hwPrice = newData.loc[idx, "单价"]
newHwPrice = newData.loc[idx, "硬件(总)(不含税)"]
newHwTaxRate = newData.loc[idx, "硬件税率"]
hwPriceTax = newData.loc[idx, '含税单价']
hwPrice = newData.loc[idx, '单价']
newHwPrice = newData.loc[idx, '硬件(总)(不含税)']
newHwTaxRate = newData.loc[idx, '硬件税率']
if newHwPrice != 0:
hwPrice = newHwPrice
hwPriceTax = newHwTaxRate
pkPrice = newData.loc[idx, "服务(不含税)"]
pkPriceRate = newData.loc[idx, "服务税率"]
client = newData.loc[idx, "客户"].strip()
value = (
newData.loc[idx, "单据类型"],
newData.loc[idx, "单据编号"],
newData.loc[idx, "业务日期"],
client,
newData.loc[idx, "渠道"],
newData.loc[idx, "物料编码"],
newData.loc[idx, "物料名称"],
newData.loc[idx, "产品类型"],
newData.loc[idx, "设备类型"],
newData.loc[idx, "计价数量"],
hwPriceTax,
hwPrice,
pkPrice,
pkPriceRate,
newData.loc[idx, "服务套餐"],
newData.loc[idx, "收入"],
newData.loc[idx, "业务类型"],
newData.loc[idx, "分摊期限"],
newData.loc[idx, "分摊期限"],
newData.loc[idx, "安装"],
newData.loc[idx, "安装税率"],
)
pkPrice = newData.loc[idx, '服务(不含税)']
pkPriceRate = newData.loc[idx, '服务税率']
client = newData.loc[idx, '客户'].strip()
value = (newData.loc[idx, '单据类型'], newData.loc[idx, '单据编号'], newData.loc[idx, '业务日期'], client,
newData.loc[idx, '渠道'], newData.loc[idx, '物料编码'], newData.loc[idx, '物料名称'], newData.loc[idx, '产品类型'],
newData.loc[idx, '设备类型'], newData.loc[idx, '计价数量'], hwPriceTax, hwPrice, pkPrice, pkPriceRate,
newData.loc[idx, '服务套餐'],
newData.loc[idx, '收入'], newData.loc[idx, '业务类型'], newData.loc[idx, '分摊期限'],
newData.loc[idx, '分摊期限'], newData.loc[idx, '安装'], newData.loc[idx, '安装税率'])
print(value)
valueArr.append(value)
cs = conn_updata.cursor()
sql = (
"insert into "
+ tableName
+ "(order_type,order_no,finance_time,cus_name,sale_type,product_code,"
"product_name,product_type,device_type,total,hw_unit_price_tax,"
"hw_unit_price,pk_unit_price,pk_unit_price_tax,pk_name,income,"
"business_type,hw_term,pk_term,install_unit_price,install_unit_price_tax) "
"values "
"(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)"
)
sql = "insert into " + tableName + "(order_type,order_no,finance_time,cus_name,sale_type,product_code," \
"product_name,product_type,device_type,total,hw_unit_price_tax," \
"hw_unit_price,pk_unit_price,pk_unit_price_tax,pk_name,income," \
"business_type,hw_term,pk_term,install_unit_price,install_unit_price_tax) " \
"values " \
"(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)"
cs.executemany(sql, valueArr)
conn_updata.commit()
def updateCustomerChannel():
"""更新客户的渠道"""
dbConn = pymysql.Connect(
host="192.168.5.2",
port=3306,
user="biz_glsx_data",
passwd="unEKczDc",
db="glsx_biz_data",
charset="utf8",
)
'''更新客户的渠道'''
dbConn = pymysql.Connect(host='192.168.5.20', port=3306, user='biz_glsx_data',
passwd='unEKczDc', db='glsx_biz_data', charset='utf8')
querySql = "SELECT cus_name,sale_type,count(1) from dj_2022_settlment_order_finance group by cus_name,sale_type"
dbCursor = dbConn.cursor()
dbCursor.execute(querySql)
......@@ -249,24 +157,31 @@ def updateCustomerChannel():
if __name__ == "__main__":
# 财务原表
filePath = "C:\\Users\\333\\Desktop\\2022审计\\"
fileName = filePath + "财务与研发收入数据核对-0116.xlsx"
sheetName = "汇总"
loadFinnanceExcelToMysql(fileName, sheetName)
filePath = "G:\\财务审计\\EXCEL文档\\应收拆分数据3月份\\"
# fileName = filePath + "数据源-激活调整用23年2-3月.xlsx"
#filePath = "C:\\Users\\333\\Desktop\\2022审计\\应收拆分数据-2022年12月\\"
# fileName = filePath + "【数据源】-应收单12月.xlsx"
# sheetName = "Sheet1"
# loadFinnanceExcelToMysql(fileName, sheetName)
# E盾
# fileName = filePath + "4.数据源-激活调整用23年3月-陈冰恋.xlsx"
# sheetName = "3.虎哥E盾--渠道应收单原表"
# fileName = filePath + "1.拆分数据-虎哥E盾结算单与明细数据12月-陈冰恋.xlsx"
# sheetName = '3.虎哥E盾--渠道应收单原表'
# loadDjExcelToMysql(fileName, sheetName)
# # 渠道嘀加
# fileName = filePath + "2.拆分数据-渠道2023年3月嘀加数据-柳云飞.xlsx"
# sheetName = "Sheet2"
# fileName = filePath + "3.拆分数据-渠道2022年12月滴加数据-柳云飞.xlsx"
# sheetName = 'Sheet2'
# loadDjExcelToMysql(fileName, sheetName)
# # # 直销
fileName = filePath + "1.数据源-激活调整用2023年3月-廖敏玲.xlsx"
sheetName = "廖敏玲"
loadDjExcelToMysql(fileName, sheetName)
# fileName = filePath + "4.拆分数据-广汇2022年12月-廖敏玲.xlsx"
# sheetName = '廖敏玲'
# loadDjExcelToMysql(fileName, sheetName)
print("done")
import random
from MysqlUtility import MySQL, paddstr, paddnum
import datetime
from dateutil.relativedelta import relativedelta
from calc_dj_income_2021 import calc_not_direct_device_active_time, query_settlement_merchant,ShopMerSales
import logging
g_pro_biz_dbcfg = {'host': '192.168.5.20', 'port': 3306, 'user': 'biz_glsx_data', 'passwd': 'unEKczDc',
'db': 'glsx_biz_data', 'charset': 'utf8'}
g_settle_merchant_dict = {}
def modify_merchant_channel():
"""
修改明细数据的分类,涉及到激活时间及发货时间的调整
:return:
"""
fileName = "直销变渠道.csv"
fileHandle = open(file=fileName, mode='w', encoding="utf-8")
bizConn = MySQL(g_pro_biz_dbcfg)
query_settlement_merchant(bizConn, g_settle_merchant_dict)
sql = "select settle_mer,channel from dj_2022_settlemer_channel"
if not bizConn.query(sql):
return
result = bizConn.fetchAllRows()
new_mer_channel_dict = {}
for row in result:
settle_merchant = row[0]
channel = row[1]
new_mer_channel_dict[settle_merchant] = channel
sql = "SELECT settle_merchant,channel,DATE_FORMAT(settle_time, '%Y-%m'),count(1) FROM dj_2021_settle_details " \
"where settle_time >= '2022-01-01' GROUP BY settle_merchant,channel,DATE_FORMAT(settle_time, '%Y-%m')"
if not bizConn.query(sql):
return
result = bizConn.fetchAllRows()
total_diff = 0
z_2_q_diff = 0
q_2_z_diff = 0
headName = f"客户名称,结算月份,旧分类,新分类,数量\n"
fileHandle.write(headName)
for row in result:
settle_merchant = row[0]
channel = row[1]
settle_month = row[2]
total = row[3]
new_channel = new_mer_channel_dict.get(settle_merchant)
if channel != new_channel:
line = f"{settle_merchant },{settle_month},{channel},{new_channel},{total}\n"
fileHandle.write(line)
print(line.strip("\n"))
total_diff += 1
#直销变渠道
if new_channel == '渠道':
z_2_q_diff += 1
#将该月设备激活时间清空,发货时间为结算当月
change_zx_to_qd(bizConn, settle_merchant, settle_month)
elif new_channel == "直销":
q_2_z_diff += 1
#将该月设备激活时间设置为结算时间之前,发货时间在激活时间之前
change_qd_to_zx(bizConn, settle_merchant, settle_month)
fileHandle.close()
print(f"total diff = {total_diff} new channel diff={z_2_q_diff}")
def change_zx_to_qd(dbconn, settle_merchant, settle_month):
"""
直销变为渠道,需要将该月设备激活时间清空,发货时间为结算当月
:param dbconn:
:param settle_merchant:
:param settle_month:
:return:
"""
print(f"update settle_merchant={settle_merchant} settle_month={settle_month} 渠道 start")
sql = f"select id,delivery_time,settle_time from dj_2021_settle_details " \
f"where settle_merchant = '{settle_merchant}' and DATE_FORMAT(settle_time, '%Y-%m') = '{settle_month}'"
if not dbconn.query(sql):
print(sql)
return
result = dbconn.fetchAllRows()
for row in result:
idx = row[0]
delivery_time = row[1]
settle_time = row[2]
new_delivery_time = delivery_time.replace(month=settle_time.month, day=settle_time.day)
#print(f"sn={sn}, delivery_time={delivery_time}, settle_time={settle_time}, new_settle_time={new_delivery_time}")
updateSql = f"update dj_2021_settle_details set channel='渠道', delivery_time='{new_delivery_time}'," \
f"active_time=null,active_merchant=null where id={idx}"
#print(f"{updateSql}")
if not dbconn.update(updateSql):
return
print(f"update settle_merchant={settle_merchant} settle_month={settle_month} 渠道 done")
def change_qd_to_zx(dbconn, settle_merchant, settle_month):
"""
渠道变为直销,需要将该月设备激活时间设置为结算时间之前,发货时间在激活时间之前
:param bizConn:
:param settle_merchant:
:param settle_month:
:return:
"""
print(f"update settle_merchant={settle_merchant} settle_month={settle_month} 直销 start")
sql = f"select id,delivery_time,settle_time,active_time from dj_2021_settle_details " \
f"where settle_merchant = '{settle_merchant}' and DATE_FORMAT(settle_time, '%Y-%m') = '{settle_month}'"
if not dbconn.query(sql):
print(sql)
return
result = dbconn.fetchAllRows()
random_month = random.randint(1,3)
random_day = random.randint(1, 5)
for row in result:
idx = row[0]
delivery_time = row[1]
settle_time = row[2]
active_time = row[3]
new_delivery_time = settle_time - relativedelta(months=random_month)
new_delivery_time = new_delivery_time - relativedelta(months=random_day)
new_active_time = calc_not_direct_device_active_time(new_delivery_time, settle_time)
new_active_merchant = getRandomActiveMerchant(settle_merchant)
#print(f"sn={sn}, delivery_time={delivery_time}, settle_time={settle_time}, new_settle_time={new_delivery_time}")
updateSql = f"update dj_2021_settle_details set channel='直销', delivery_time='{new_delivery_time}'," \
f"active_time='{new_active_time}',active_merchant='{new_active_merchant}' where id={idx}"
#print(f"{updateSql}")
if not dbconn.update(updateSql):
return
print(f"update settle_merchant={settle_merchant} settle_month={settle_month} 直销 done")
def getRandomActiveMerchant(settle_merchant):
"""
获取随机激活门店
:param settle_merchant:
:return:
"""
settMerInfo = g_settle_merchant_dict.get(settle_merchant, None)
shopList = []
if settMerInfo is not None:
shopList = settMerInfo.shopList
else:
shopInfo = ShopMerSales()
shopInfo.merName = settle_merchant
shopList.append(shopInfo)
activeMerchant = random.choice(shopList)
shopName = activeMerchant.merName
return shopName
if __name__ == '__main__':
modify_merchant_channel()
print("done")
\ No newline at end of file
File mode changed
File mode changed
......@@ -62,8 +62,18 @@ LEFT JOIN dj_system_merchant B ON (A.active_merchant = B.merchant_name)
def add_unmatch_merchant():
'''未匹配的商户'''
settleMerList = [
'兰州超凡汽车用品有限公司',
'长沙县湘龙街道达阳汽车用品商行',
'石家庄岚申汽车销售有限公司',
'太原远方通贸易有限公司',
'湖北欧特隆汽车用品超市有限公司',
'甘肃深联俊飞商贸有限公司',
'广州远晟电子科技有限公司',
'贵州林荣汽车装饰服务有限公司',
'哈尔滨市博能汽车销售有限公司',
'济南新中兴汽车用品有限责任公司',
'厦门盈鹭通汽车服务有限公司',
'深圳市乐亿企业服务有限公司',
'云南隆创尚通汽车销售服务有限公司'
]
#settleMerchant = '庞大精配网(天津)网络科技有限公司'
......@@ -595,10 +605,47 @@ def update_device_type():
return
print(updateSql)
def update_active_merchant_new_settle_details():
'''森风集团'''
bizConn = MySQL(g_pro_biz_dbcfg)
settle_merchant_list = ['为车(沈阳)科技有限公司', '云南隆创尚通汽车销售服务有限公司', '哈尔滨市博能汽车销售有限公司',
'太原远方通贸易有限公司', '广州远晟电子科技有限公司', '庞大精配网(天津)网络科技有限公司',
'赣州兴康汽车销售服务有限公司', '赣州祥荣汽车销售服务有限公司', '甘肃深联俊飞商贸有限公司',
'石家庄岚申汽车销售有限公司', '精一门(天津)科技有限公司', '诺言金鼎商贸(北京)有限公司']
for settle_merchant in settle_merchant_list:
merchantList = []
sql = f"SELECT merchant_name from dj_system_merchant where settle_merchant_name = '{settle_merchant}'"
if not bizConn.query(sql):
return
result = bizConn.fetchAllRows()
for v in result:
merchantList.append(f"'{v[0]}'")
if len(merchantList) == 0:
logger.warning(f"update_active_merchant_new_settle_details not found settle_merchant {settle_merchant}")
continue
sql = f"select id,active_merchant from dj_2021_settle_details where settle_time >= '2022-01-01' and active_time is not null " \
f"and settle_merchant = '{settle_merchant}' and active_merchant not in ({','.join(merchantList)})"
if not bizConn.query(sql):
return
res = bizConn.fetchAllRows()
for row in res:
idx = row[0]
activeMer = random.choice(merchantList)
updateSql = "update dj_2021_settle_details set active_merchant = %s where id = %d" % (activeMer, idx)
if not bizConn.update(updateSql):
logger.error("update_active_merchant_new_settle_details settlemer=%s, sql=%s", updateSql)
return
logger.info(f"update_active_merchant_new_settle_details {settle_merchant}")
logger.info("update_active_merchant_new_settle_details done")
if __name__ == "__main__":
''''''
#update_device_type()
#random_active_time_hour(2022)
random_active_time_hour(2022)
#update_merchant_createtime()
......@@ -622,6 +669,9 @@ if __name__ == "__main__":
#update_customer_saletype()
#update_active_merchant_new_settle_details()
......
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
客户名称,渠道,服务期限,数量,结算月份,不含税收入,开始计费月份,结束计费月份,不含税单价,月摊收入,2017年摊销金额,2017年末累计摊销余额,2018年摊销金额,2018年末累计摊销余额,2019年摊销金额,2019年末累计摊销余额,2020年摊销金额,2020年末累计摊销余额,2021年摊销金额,2021年末累计摊销余额,2022年摊销金额,2022年末累计摊销余额,产品分类
广州盟锐科技发展有限公司,直销,12,17,2020-08,0.0,2020-08,2021-07-31 00:00:00,0.0,0.0,0,0,0,0,0,0,0.0,0,0.0,0,0,0,记录仪
广州盟锐科技发展有限公司,直销,12,5,2020-09,0.0,2020-09,2021-08-31 00:00:00,0.0,0.0,0,0,0,0,0,0,0.0,0,0.0,0,0,0,记录仪
广州盟锐科技发展有限公司,直销,12,2,2020-10,0.0,2020-10,2021-09-30 00:00:00,0.0,0.0,0,0,0,0,0,0,0.0,0,0.0,0,0,0,记录仪
广州盟锐科技发展有限公司,直销,12,1,2020-11,0.0,2020-11,2021-10-31 00:00:00,0.0,0.0,0,0,0,0,0,0,0.0,0,0.0,0,0,0,记录仪
运城市通达汽车销售服务有限公司,直销,36,9,2020-11,0.0,2020-11,2023-10-31 00:00:00,0.0,0.0,0,0,0,0,0,0,0.0,0,0.0,0,0.0,0,记录仪
成都创晟汽车服务有限公司,直销,36,253,2021-01,-20202.0496,2021-01,2023-12-31 00:00:00,-79.84999841897232,-561.1680444444444,0,0,0,0,0,0,0,0,-6734.0165333333325,0,-6734.0165333333325,0,追踪器
上海鲁悦汽车服务有限公司,直销,36,32,2021-07,-2198.0801,2021-07,2024-06-30 00:00:00,-68.690003125,-61.05778055555556,0,0,0,0,0,0,0,0,-366.3466833333334,0,-732.6933666666667,0,追踪器
云南鸿超汽车服务有限公司,直销,36,174,2021-02,-39477.7813,2021-02,2024-01-31 00:00:00,-226.88380057471267,-1096.605036111111,0,0,0,0,0,0,0,0,-12062.655397222221,0,-13159.260433333333,0,追踪器
成都创晟汽车服务有限公司,直销,12,400,2021-03,-23321.1197,2021-03,2022-02-28 00:00:00,-58.30279925,-1943.4266416666667,0,0,0,0,0,0,0,0,-19434.266416666665,0,-3886.8532833333334,0,追踪器
福建省联合车尚贸易有限公司,直销,36,5,2021-03,-342.04,2021-03,2024-02-29 00:00:00,-68.408,-9.501111111111111,0,0,0,0,0,0,0,0,-95.01111111111112,0,-114.01333333333334,0,追踪器
甘肃诚利源汽车销售服务有限公司,直销,36,2,2021-03,-122.7,2021-03,2024-02-29 00:00:00,-61.35,-3.408333333333333,0,0,0,0,0,0,0,0,-34.08333333333333,0,-40.9,0,追踪器
北京海韵山峦商贸有限公司,渠道,1,155,2022-08,-8285.4786,2022-08,2022-08-31 00:00:00,-53.454700645161296,-8285.4786,0,0,0,0,0,0,0,0,0,0,-8285.4786,0,追踪器
厦门富创新汽车科技有限公司,渠道,36,36,2022-05,0.0,2022-05,2025-04-30 00:00:00,0.0,0.0,0,0,0,0,0,0,0,0,0,0,0.0,0,追踪器
四川汇鹏兴成汽车服务有限公司,渠道,36,215,2022-02,0.0,2022-02,2025-01-31 00:00:00,0.0,0.0,0,0,0,0,0,0,0,0,0,0,0.0,0,追踪器
安徽优盾信息科技有限公司,直销,36,30,2021-12,-3274.1311,2021-12,2024-11-30 00:00:00,-109.13770333333333,-90.94808611111111,0,0,0,0,0,0,0,0,-90.94808611111111,0,-1091.3770333333332,0,追踪器
安徽优盾信息科技有限公司,渠道,36,30,2022-03,-2079.4409,2022-03,2025-02-28 00:00:00,-69.31469666666666,-57.76224722222222,0,0,0,0,0,0,0,0,0,0,-577.6224722222222,0,追踪器
安徽优盾信息科技有限公司,渠道,36,50,2022-06,-3465.7299,2022-06,2025-05-31 00:00:00,-69.31459799999999,-96.270275,0,0,0,0,0,0,0,0,0,0,-673.891925,0,追踪器
安徽优盾信息科技有限公司,渠道,36,50,2022-07,-3465.7299,2022-07,2025-06-30 00:00:00,-69.31459799999999,-96.270275,0,0,0,0,0,0,0,0,0,0,-577.62165,0,追踪器
安徽优盾信息科技有限公司,渠道,1,150,2022-08,-10476.8394,2022-08,2022-08-31 00:00:00,-69.845596,-10476.8394,0,0,0,0,0,0,0,0,0,0,-10476.8394,0,追踪器
广东盛世创客汽车科技有限公司,直销,36,14,2021-08,-768.0106,2021-08,2024-07-31 00:00:00,-54.857899999999994,-21.333627777777778,0,0,0,0,0,0,0,0,-106.66813888888889,0,-256.00353333333334,0,追踪器
广东盛世创客汽车科技有限公司,渠道,36,11,2022-12,-590.9805,2022-12,2025-11-30 00:00:00,-53.725500000000004,-16.416125,0,0,0,0,0,0,0,0,0,0,-16.416125,0,追踪器
广州盟锐科技发展有限公司,直销,36,11,2021-11,-589.8596,2021-11,2024-10-31 00:00:00,-53.6236,-16.384988888888888,0,0,0,0,0,0,0,0,-32.769977777777775,0,-196.61986666666667,0,追踪器
广州盟锐科技发展有限公司,渠道,36,32,2022-03,-1682.24,2022-03,2025-02-28 00:00:00,-52.57,-46.72888888888889,0,0,0,0,0,0,0,0,0,0,-467.2888888888889,0,追踪器
广汇汽车,广汇,36,1,2022-11,0.0,2022-11,2025-10-31 00:00:00,0.0,0.0,0,0,0,0,0,0,0,0,0,0,0.0,0,追踪器
广西瑜健连投资有限公司,渠道,1,9,2022-07,0.0,2022-07,2022-07-31 00:00:00,0.0,0.0,0,0,0,0,0,0,0,0,0,0,0.0,0,追踪器
广西瑜健连投资有限公司,渠道,1,12,2022-08,-622.8996,2022-08,2022-08-31 00:00:00,-51.9083,-622.8996,0,0,0,0,0,0,0,0,0,0,-622.8996,0,追踪器
恒信汽车集团股份有限公司,直销,1,7,2022-08,0.0,2022-08,2022-08-31 00:00:00,0.0,0.0,0,0,0,0,0,0,0,0,0,0,0.0,0,追踪器
成都创晟汽车服务有限公司,直销,36,253,2021-01,-20202.0496,2021-01,2023-12-31 00:00:00,-79.84999841897232,-561.1680444444444,0,0,0,0,0,0,0,0,-6734.0165333333325,0,-6734.0165333333325,0,追踪器
成都创晟汽车服务有限公司,直销,36,2518,2021-03,-146806.4484,2021-03,2024-02-29 00:00:00,-58.30279920571882,-4077.9568999999997,0,0,0,0,0,0,0,0,-40779.568999999996,0,-48935.4828,0,追踪器
广汇汽车,广汇,36,5,2021-04,0.0,2021-04,2024-03-31 00:00:00,0.0,0.0,0,0,0,0,0,0,0,0,0.0,0,0.0,0,记录仪
成都创晟汽车服务有限公司,直销,12,400,2021-03,-23321.1197,2021-03,2022-02-28 00:00:00,-58.30279925,-1943.4266416666667,0,0,0,0,0,0,0,0,-19434.266416666665,0,-3886.8532833333334,0,追踪器
成都易博鑫科技有限公司,渠道,36,60,2022-04,-3114.4979,2022-04,2025-03-31 00:00:00,-51.90829833333333,-86.51383055555556,0,0,0,0,0,0,0,0,0,0,-778.6244750000001,0,追踪器
成都易博鑫科技有限公司,渠道,36,800,2022-05,-42558.8806,2022-05,2025-04-30 00:00:00,-53.19860075,-1182.1911277777776,0,0,0,0,0,0,0,0,0,0,-9457.529022222221,0,追踪器
成都易博鑫科技有限公司,渠道,36,287,2022-07,-15406.1601,2022-07,2025-06-30 00:00:00,-53.68000034843205,-427.94889166666667,0,0,0,0,0,0,0,0,0,0,-2567.69335,0,追踪器
成都车亿科技有限公司,直销,36,65,2021-04,-3928.5999,2021-04,2024-03-31 00:00:00,-60.439998461538465,-109.127775,0,0,0,0,0,0,0,0,-982.149975,0,-1309.5333,0,追踪器
贵阳嘉鑫汽车装饰经营部,直销,12,93,2021-05,0.0,2021-05,2022-04-30 00:00:00,0.0,0.0,0,0,0,0,0,0,0,0,0.0,0,0.0,0,车充
成都车亿科技有限公司,直销,36,18,2021-05,-1087.92,2021-05,2024-04-30 00:00:00,-60.440000000000005,-30.220000000000002,0,0,0,0,0,0,0,0,-241.76000000000002,0,-362.64000000000004,0,追踪器
广汇汽车,广汇,12,1,2021-05,0.0,2021-05,2022-04-30 00:00:00,0.0,0.0,0,0,0,0,0,0,0,0,0.0,0,0.0,0,记录仪
四川安普克斯环保科技有限公司,直销,36,165,2021-06,0.0,2021-06,2024-05-31 00:00:00,0.0,0.0,0,0,0,0,0,0,0,0,0.0,0,0.0,0,记录仪
贵阳嘉鑫汽车装饰经营部,直销,12,7,2021-06,0.0,2021-06,2022-05-31 00:00:00,0.0,0.0,0,0,0,0,0,0,0,0,0.0,0,0.0,0,车充
贵阳嘉鑫汽车装饰经营部,直销,12,7,2021-07,0.0,2021-07,2022-06-30 00:00:00,0.0,0.0,0,0,0,0,0,0,0,0,0.0,0,0.0,0,车充
上海鲁悦汽车服务有限公司,直销,36,32,2021-07,-2198.0801,2021-07,2024-06-30 00:00:00,-68.690003125,-61.05778055555556,0,0,0,0,0,0,0,0,-366.3466833333334,0,-732.6933666666667,0,追踪器
广东盛世创客汽车科技有限公司,直销,36,14,2021-08,-768.0106,2021-08,2024-07-31 00:00:00,-54.857899999999994,-21.333627777777778,0,0,0,0,0,0,0,0,-106.66813888888889,0,-256.00353333333334,0,追踪器
四川众联晟通国际贸易有限公司,直销,36,29,2021-08,0.0,2021-08,2024-07-31 00:00:00,0.0,0.0,0,0,0,0,0,0,0,0,0.0,0,0.0,0,记录仪
江西乐车林贸易有限公司,直销,36,206,2021-08,-12074.7721,2021-08,2024-07-31 00:00:00,-58.615398543689324,-335.4103361111111,0,0,0,0,0,0,0,0,-1677.0516805555555,0,-4024.9240333333337,0,追踪器
聊城荣泰网络科技有限公司,直销,36,47,2021-09,0.0,2021-09,2024-08-31 00:00:00,0.0,0.0,0,0,0,0,0,0,0,0,0.0,0,0.0,0,车充
湖南旭森拓商贸有限公司,直销,36,13,2022-04,0.0,2022-04,2025-03-31 00:00:00,0.0,0.0,0,0,0,0,0,0,0,0,0,0,0.0,0,追踪器
甘肃诚利源汽车销售服务有限公司,直销,36,2,2021-03,-122.7,2021-03,2024-02-29 00:00:00,-61.35,-3.408333333333333,0,0,0,0,0,0,0,0,-34.08333333333333,0,-40.9,0,追踪器
福建省联合车尚贸易有限公司,直销,36,5,2021-03,-342.04,2021-03,2024-02-29 00:00:00,-68.408,-9.501111111111111,0,0,0,0,0,0,0,0,-95.01111111111112,0,-114.01333333333334,0,追踪器
福建省联合车尚贸易有限公司,渠道,36,5,2022-03,0.0,2022-03,2025-02-28 00:00:00,0.0,0.0,0,0,0,0,0,0,0,0,0,0,0.0,0,追踪器
福建省联合车尚贸易有限公司,渠道,36,15,2022-10,-995.6895,2022-10,2025-09-30 00:00:00,-66.3793,-27.658041666666666,0,0,0,0,0,0,0,0,0,0,-82.974125,0,追踪器
绵阳鑫驰骋商贸有限公司,代销,36,108,2021-09,-5805.7234,2021-09,2024-08-31 00:00:00,-53.756698148148146,-161.27009444444445,0,0,0,0,0,0,0,0,-645.0803777777778,0,-1935.2411333333334,0,追踪器
广州盟锐科技发展有限公司,直销,36,11,2021-11,-589.8596,2021-11,2024-10-31 00:00:00,-53.6236,-16.384988888888888,0,0,0,0,0,0,0,0,-32.769977777777775,0,-196.61986666666667,0,追踪器
四川众联晟通国际贸易有限公司,直销,36,48,2021-11,0.0,2021-11,2024-10-31 00:00:00,0.0,0.0,0,0,0,0,0,0,0,0,0.0,0,0.0,0,记录仪
四川众联晟通国际贸易有限公司,直销,12,14,2021-11,0.0,2021-11,2022-10-31 00:00:00,0.0,0.0,0,0,0,0,0,0,0,0,0.0,0,0.0,0,记录仪
绵阳鑫驰骋商贸有限公司,代销,36,74,2021-11,-4131.3535,2021-11,2024-10-31 00:00:00,-55.829101351351355,-114.75981944444445,0,0,0,0,0,0,0,0,-229.5196388888889,0,-1377.1178333333332,0,追踪器
庞大精配网(天津)网络科技有限公司,代销,12,10,2021-11,0.0,2021-11,2022-10-31 00:00:00,0.0,0.0,0,0,0,0,0,0,0,0,0.0,0,0.0,0,记录仪
安徽优盾信息科技有限公司,直销,36,30,2021-12,-3274.1311,2021-12,2024-11-30 00:00:00,-109.13770333333333,-90.94808611111111,0,0,0,0,0,0,0,0,-90.94808611111111,0,-1091.3770333333332,0,追踪器
上海冠松汽车用品发展有限公司,直销,36,1,2021-12,0.0,2021-12,2024-11-30 00:00:00,0.0,0.0,0,0,0,0,0,0,0,0,0.0,0,0.0,0,记录仪
客户名称,渠道,服务期限,数量,结算月份,不含税收入,开始计费月份,结束计费月份,不含税单价,月摊收入,2017年摊销金额,2017年末累计摊销余额,2018年摊销金额,2018年末累计摊销余额,2019年摊销金额,2019年末累计摊销余额,2020年摊销金额,2020年末累计摊销余额,2021年摊销金额,2021年末累计摊销余额,2022年摊销金额,2022年末累计摊销余额,产品分类
广州盟锐科技发展有限公司,直销,12,17,2020-08,-3610.6199,2020-08,2021-07-31 00:00:00,-212.38940588235295,-300.8849916666667,0,0,0,0,0,0,-1504.4249583333335,0,-2106.1949416666666,0,0,0,记录仪
广州盟锐科技发展有限公司,直销,12,5,2020-09,-1061.947,2020-09,2021-08-31 00:00:00,-212.38939999999997,-88.49558333333333,0,0,0,0,0,0,-353.9823333333333,0,-707.9646666666666,0,0,0,记录仪
广州盟锐科技发展有限公司,直销,12,2,2020-10,-424.7788,2020-10,2021-09-30 00:00:00,-212.3894,-35.39823333333333,0,0,0,0,0,0,-106.19469999999998,0,-318.5841,0,0,0,记录仪
运城市通达汽车销售服务有限公司,直销,36,9,2020-11,-1433.6288,2020-11,2023-10-31 00:00:00,-159.29208888888888,-39.82302222222222,0,0,0,0,0,0,-79.64604444444444,0,-477.87626666666665,0,-477.87626666666665,0,记录仪
广州盟锐科技发展有限公司,直销,12,1,2020-11,-212.3894,2020-11,2021-10-31 00:00:00,-212.3894,-17.699116666666665,0,0,0,0,0,0,-35.39823333333333,0,-176.99116666666666,0,0,0,记录仪
成都创晟汽车服务有限公司,直销,36,253,2021-01,-23982.3053,2021-01,2023-12-31 00:00:00,-94.79172055335968,-666.1751472222222,0,0,0,0,0,0,0,0,-7994.101766666667,0,-7994.101766666667,0,追踪器
云南鸿超汽车服务有限公司,直销,36,174,2021-02,-28225.2355,2021-02,2024-01-31 00:00:00,-162.21399712643677,-784.0343194444445,0,0,0,0,0,0,0,0,-8624.377513888889,0,-9408.411833333334,0,追踪器
成都创晟汽车服务有限公司,直销,36,2518,2021-03,-510416.0185,2021-03,2024-02-29 00:00:00,-202.70691759332803,-14178.22273611111,0,0,0,0,0,0,0,0,-141782.22736111112,0,-170138.67283333332,0,追踪器
成都创晟汽车服务有限公司,直销,12,400,2021-03,-95575.238,2021-03,2022-02-28 00:00:00,-238.938095,-7964.603166666667,0,0,0,0,0,0,0,0,-79646.03166666666,0,-15929.206333333334,0,追踪器
福建省联合车尚贸易有限公司,直销,36,5,2021-03,-398.23,2021-03,2024-02-29 00:00:00,-79.646,-11.061944444444444,0,0,0,0,0,0,0,0,-110.61944444444444,0,-132.74333333333334,0,追踪器
甘肃诚利源汽车销售服务有限公司,直销,36,2,2021-03,-833.5282,2021-03,2024-02-29 00:00:00,-416.7641,-23.15356111111111,0,0,0,0,0,0,0,0,-231.5356111111111,0,-277.8427333333333,0,追踪器
广汇汽车,广汇,36,5,2021-04,-2287.6111,2021-04,2024-03-31 00:00:00,-457.52222,-63.54475277777778,0,0,0,0,0,0,0,0,-571.902775,0,-762.5370333333334,0,记录仪
成都车亿科技有限公司,直销,36,65,2021-04,-11504.4277,2021-04,2024-03-31 00:00:00,-176.9911953846154,-319.56743611111114,0,0,0,0,0,0,0,0,-2876.106925,0,-3834.8092333333334,0,追踪器
广汇汽车,广汇,12,1,2021-05,-430.9735,2021-05,2022-04-30 00:00:00,-430.9735,-35.914458333333336,0,0,0,0,0,0,0,0,-287.3156666666667,0,-143.65783333333334,0,记录仪
贵阳嘉鑫汽车装饰经营部,直销,12,93,2021-05,-23451.0946,2021-05,2022-04-30 00:00:00,-252.16230752688173,-1954.2578833333334,0,0,0,0,0,0,0,0,-15634.063066666668,0,-7817.031533333334,0,车充
成都车亿科技有限公司,直销,36,18,2021-05,-3185.8415,2021-05,2024-04-30 00:00:00,-176.99119444444443,-88.49559722222222,0,0,0,0,0,0,0,0,-707.9647777777777,0,-1061.9471666666666,0,追踪器
四川安普克斯环保科技有限公司,直销,36,165,2021-06,-25004.4294,2021-06,2024-05-31 00:00:00,-151.54199636363637,-694.5674833333334,0,0,0,0,0,0,0,0,-4861.972383333334,0,-8334.8098,0,记录仪
贵阳嘉鑫汽车装饰经营部,直销,12,7,2021-06,-1765.1362,2021-06,2022-05-31 00:00:00,-252.16231428571427,-147.09468333333334,0,0,0,0,0,0,0,0,-1029.6627833333334,0,-735.4734166666667,0,车充
贵阳嘉鑫汽车装饰经营部,直销,12,7,2021-07,-1575.614,2021-07,2022-06-30 00:00:00,-225.0877142857143,-131.30116666666666,0,0,0,0,0,0,0,0,-787.807,0,-787.807,0,车充
上海鲁悦汽车服务有限公司,直销,36,32,2021-07,-8495.5742,2021-07,2024-06-30 00:00:00,-265.48669375,-235.9881722222222,0,0,0,0,0,0,0,0,-1415.9290333333333,0,-2831.8580666666667,0,追踪器
广东盛世创客汽车科技有限公司,直销,36,14,2021-08,-1796.4604,2021-08,2024-07-31 00:00:00,-128.3186,-49.90167777777778,0,0,0,0,0,0,0,0,-249.50838888888887,0,-598.8201333333334,0,追踪器
四川众联晟通国际贸易有限公司,直销,36,29,2021-08,-7827.4334,2021-08,2024-07-31 00:00:00,-269.91149655172416,-217.42870555555555,0,0,0,0,0,0,0,0,-1087.1435277777778,0,-2609.1444666666666,0,记录仪
江西乐车林贸易有限公司,直销,36,206,2021-08,-45939.8121,2021-08,2024-07-31 00:00:00,-223.00879660194175,-1276.1058916666668,0,0,0,0,0,0,0,0,-6380.529458333334,0,-15313.270700000001,0,追踪器
聊城荣泰网络科技有限公司,直销,36,47,2021-09,-4575.2245,2021-09,2024-08-31 00:00:00,-97.34520212765958,-127.08956944444445,0,0,0,0,0,0,0,0,-508.3582777777778,0,-1525.0748333333333,0,车充
绵阳鑫驰骋商贸有限公司,代销,36,108,2021-09,-30584.0654,2021-09,2024-08-31 00:00:00,-283.18579074074074,-849.5573722222222,0,0,0,0,0,0,0,0,-3398.2294888888887,0,-10194.688466666666,0,追踪器
绵阳鑫驰骋商贸有限公司,代销,36,74,2021-11,-20955.7485,2021-11,2024-10-31 00:00:00,-283.18579054054055,-582.1041250000001,0,0,0,0,0,0,0,0,-1164.2082500000001,0,-6985.249500000001,0,追踪器
庞大精配网(天津)网络科技有限公司,代销,12,10,2021-11,-814.159,2021-11,2022-10-31 00:00:00,-81.4159,-67.84658333333333,0,0,0,0,0,0,0,0,-135.69316666666666,0,-678.4658333333333,0,记录仪
广州盟锐科技发展有限公司,直销,36,11,2021-11,-1411.5046,2021-11,2024-10-31 00:00:00,-128.3186,-39.20846111111111,0,0,0,0,0,0,0,0,-78.41692222222223,0,-470.5015333333333,0,追踪器
四川众联晟通国际贸易有限公司,直销,36,48,2021-11,-6584.0736,2021-11,2024-10-31 00:00:00,-137.16819999999998,-182.89093333333332,0,0,0,0,0,0,0,0,-365.78186666666664,0,-2194.6911999999998,0,记录仪
四川众联晟通国际贸易有限公司,直销,12,14,2021-11,-1982.3005,2021-11,2022-10-31 00:00:00,-141.59289285714286,-165.19170833333334,0,0,0,0,0,0,0,0,-330.3834166666667,0,-1651.9170833333333,0,记录仪
安徽优盾信息科技有限公司,直销,36,30,2021-12,-3159.291,2021-12,2024-11-30 00:00:00,-105.3097,-87.75808333333333,0,0,0,0,0,0,0,0,-87.75808333333333,0,-1053.097,0,追踪器
上海冠松汽车用品发展有限公司,直销,36,1,2021-12,-313.241,2021-12,2024-11-30 00:00:00,-313.241,-8.701138888888888,0,0,0,0,0,0,0,0,-8.701138888888888,0,-104.41366666666666,0,记录仪
上海鲁悦汽车服务有限公司,直销,36,32,2021-07,8495.5742,2021-07,2024-06-30 00:00:00,265.48669375,235.9881722222222,0,0,0,0,0,0,0,0,1415.9290333333333,7079.645166666665,2831.8580666666667,4247.787099999999,追踪器
云南鸿超汽车服务有限公司,直销,36,174,2021-02,28225.2355,2021-02,2024-01-31 00:00:00,162.21399712643677,784.0343194444445,0,0,0,0,0,0,0,0,8624.377513888889,19600.85798611111,9408.411833333334,10192.446152777777,追踪器
北京海韵山峦商贸有限公司,渠道,1,155,2022-08,10973.4577,2022-08,2022-08-31 00:00:00,70.79650129032258,10973.4577,0,0,0,0,0,0,0,0,0,0,10973.4577,0,追踪器
厦门富创新汽车科技有限公司,渠道,36,36,2022-05,2920.3554,2022-05,2025-04-30 00:00:00,81.12098333333333,81.12098333333333,0,0,0,0,0,0,0,0,0,0,648.9678666666666,2271.3875333333335,追踪器
四川汇鹏兴成汽车服务有限公司,渠道,36,215,2022-02,15221.2477,2022-02,2025-01-31 00:00:00,70.79650093023255,422.8124361111111,0,0,0,0,0,0,0,0,0,0,4650.936797222222,10570.31090277778,追踪器
安徽优盾信息科技有限公司,直销,36,30,2021-12,3159.291,2021-12,2024-11-30 00:00:00,105.3097,87.75808333333333,0,0,0,0,0,0,0,0,87.75808333333333,3071.532916666667,1053.097,2018.435916666667,追踪器
安徽优盾信息科技有限公司,渠道,36,30,2022-03,3105.195,2022-03,2025-02-28 00:00:00,103.5065,86.25541666666668,0,0,0,0,0,0,0,0,0,0,862.5541666666668,2242.6408333333334,追踪器
安徽优盾信息科技有限公司,渠道,36,50,2022-06,5175.325,2022-06,2025-05-31 00:00:00,103.5065,143.75902777777776,0,0,0,0,0,0,0,0,0,0,1006.3131944444443,4169.011805555556,追踪器
安徽优盾信息科技有限公司,渠道,36,50,2022-07,5175.325,2022-07,2025-06-30 00:00:00,103.5065,143.75902777777776,0,0,0,0,0,0,0,0,0,0,862.5541666666666,4312.770833333333,追踪器
安徽优盾信息科技有限公司,渠道,1,150,2022-08,15642.789,2022-08,2022-08-31 00:00:00,104.28526000000001,15642.789,0,0,0,0,0,0,0,0,0,0,15642.789,0,追踪器
广东盛世创客汽车科技有限公司,直销,36,14,2021-08,1796.4604,2021-08,2024-07-31 00:00:00,128.3186,49.90167777777778,0,0,0,0,0,0,0,0,249.50838888888887,1546.952011111111,598.8201333333334,948.1318777777776,追踪器
广东盛世创客汽车科技有限公司,渠道,36,11,2022-12,876.106,2022-12,2025-11-30 00:00:00,79.646,24.336277777777777,0,0,0,0,0,0,0,0,0,0,24.336277777777777,851.7697222222222,追踪器
广州盟锐科技发展有限公司,直销,36,11,2021-11,1411.5046,2021-11,2024-10-31 00:00:00,128.3186,39.20846111111111,0,0,0,0,0,0,0,0,78.41692222222223,1333.0876777777778,470.5015333333333,862.5861444444445,追踪器
广州盟锐科技发展有限公司,渠道,36,32,2022-03,4247.7886,2022-03,2025-02-28 00:00:00,132.74339375,117.99412777777778,0,0,0,0,0,0,0,0,0,0,1179.9412777777777,3067.847322222222,追踪器
广汇汽车,广汇,36,1,2022-11,172.5664,2022-11,2025-10-31 00:00:00,172.5664,4.793511111111111,0,0,0,0,0,0,0,0,0,0,9.587022222222222,162.97937777777776,追踪器
广西瑜健连投资有限公司,渠道,1,9,2022-07,716.814,2022-07,2022-07-31 00:00:00,79.646,716.814,0,0,0,0,0,0,0,0,0,0,716.814,0,追踪器
广西瑜健连投资有限公司,渠道,1,12,2022-08,955.752,2022-08,2022-08-31 00:00:00,79.646,955.752,0,0,0,0,0,0,0,0,0,0,955.752,0,追踪器
恒信汽车集团股份有限公司,直销,1,7,2022-08,483.1855,2022-08,2022-08-31 00:00:00,69.0265,483.1855,0,0,0,0,0,0,0,0,0,0,483.1855,0,追踪器
成都创晟汽车服务有限公司,直销,36,253,2021-01,23982.3053,2021-01,2023-12-31 00:00:00,94.79172055335968,666.1751472222222,0,0,0,0,0,0,0,0,7994.101766666667,15988.203533333333,7994.101766666667,7994.101766666667,追踪器
成都创晟汽车服务有限公司,直销,36,2518,2021-03,510416.0185,2021-03,2024-02-29 00:00:00,202.70691759332803,14178.22273611111,0,0,0,0,0,0,0,0,141782.22736111112,368633.7911388889,170138.67283333332,198495.1183055556,追踪器
成都创晟汽车服务有限公司,直销,12,400,2021-03,95575.238,2021-03,2022-02-28 00:00:00,238.938095,7964.603166666667,0,0,0,0,0,0,0,0,79646.03166666666,15929.206333333335,15929.206333333334,0,追踪器
成都易博鑫科技有限公司,渠道,36,60,2022-04,4778.7602,2022-04,2025-03-31 00:00:00,79.64600333333333,132.74333888888887,0,0,0,0,0,0,0,0,0,0,1194.69005,3584.0701499999996,追踪器
成都易博鑫科技有限公司,渠道,36,800,2022-05,63716.803,2022-05,2025-04-30 00:00:00,79.64600375,1769.9111944444444,0,0,0,0,0,0,0,0,0,0,14159.289555555555,49557.51344444444,追踪器
成都易博鑫科技有限公司,渠道,36,287,2022-07,22858.4031,2022-07,2025-06-30 00:00:00,79.64600383275261,634.9556416666667,0,0,0,0,0,0,0,0,0,0,3809.73385,19048.66925,追踪器
成都车亿科技有限公司,直销,36,65,2021-04,11504.4277,2021-04,2024-03-31 00:00:00,176.9911953846154,319.56743611111114,0,0,0,0,0,0,0,0,2876.106925,8628.320775,3834.8092333333334,4793.511541666667,追踪器
成都车亿科技有限公司,直销,36,18,2021-05,3185.8415,2021-05,2024-04-30 00:00:00,176.99119444444443,88.49559722222222,0,0,0,0,0,0,0,0,707.9647777777777,2477.8767222222223,1061.9471666666666,1415.9295555555557,追踪器
江西乐车林贸易有限公司,直销,36,206,2021-08,45939.8121,2021-08,2024-07-31 00:00:00,223.00879660194175,1276.1058916666668,0,0,0,0,0,0,0,0,6380.529458333334,39559.282641666665,15313.270700000001,24246.011941666664,追踪器
湖南旭森拓商贸有限公司,直销,36,13,2022-04,3106.1952,2022-04,2025-03-31 00:00:00,238.93809230769233,86.28320000000001,0,0,0,0,0,0,0,0,0,0,776.5488,2329.6464,追踪器
甘肃诚利源汽车销售服务有限公司,直销,36,2,2021-03,833.5282,2021-03,2024-02-29 00:00:00,416.7641,23.15356111111111,0,0,0,0,0,0,0,0,231.5356111111111,601.9925888888888,277.8427333333333,324.1498555555555,追踪器
福建省联合车尚贸易有限公司,直销,36,5,2021-03,398.23,2021-03,2024-02-29 00:00:00,79.646,11.061944444444444,0,0,0,0,0,0,0,0,110.61944444444444,287.6105555555556,132.74333333333334,154.86722222222227,追踪器
福建省联合车尚贸易有限公司,渠道,36,5,2022-03,353.9825,2022-03,2025-02-28 00:00:00,70.79650000000001,9.832847222222222,0,0,0,0,0,0,0,0,0,0,98.32847222222222,255.6540277777778,追踪器
福建省联合车尚贸易有限公司,渠道,36,15,2022-10,1127.4335,2022-10,2025-09-30 00:00:00,75.16223333333333,31.317597222222226,0,0,0,0,0,0,0,0,0,0,93.95279166666668,1033.4807083333335,追踪器
绵阳鑫驰骋商贸有限公司,代销,36,108,2021-09,30584.0654,2021-09,2024-08-31 00:00:00,283.18579074074074,849.5573722222222,0,0,0,0,0,0,0,0,3398.2294888888887,27185.83591111111,10194.688466666666,16991.147444444443,追踪器
绵阳鑫驰骋商贸有限公司,代销,36,74,2021-11,20955.7485,2021-11,2024-10-31 00:00:00,283.18579054054055,582.1041250000001,0,0,0,0,0,0,0,0,1164.2082500000001,19791.540250000002,6985.249500000001,12806.29075,追踪器
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!