Commit 12892887 by 杨林龙

修改审计数据脚本

1 parent 7f7ff004
2023-01~04 gps
联通租赁集团有限公司 商务表未设置安装费 ( 财务GPS安装服务费 属于服务,商务数据未计)
2023-01 GPS
云南隆创尚通汽车销售服务有限公司 财务表只有安装费 没有硬件
2023-04 GPS
云南隆创尚通汽车销售服务有限公司 (财务GPS安装服务费 属于服务,商务数据未计)
2023-01~04 GPS
零售/电商客户 产品类型 都是服务
2023-01~04 记录仪
东台宝通汽车服务有限责任公司 财务有安装费用 商务没有安装费用
2023-01~04 记录仪
广汇汽车服务有限责任公司东台分公司 财务有安装费用 商务没有安装费用
2023-03 记录仪
恒信汽车集团股份有限公司 商务的服务单价分摊在硬件上面时 服务单价分配错误
退换货的时候报错:
遵义市千汇汽车销售服务有限公司 只有退货 没有出货
明细和财务的差别:
恒信汽车集团股份有限公司 2023-02 记录仪 历史累计设备不能满足2023-02退货设备数量 (-28380.540242004397)
恒信汽车集团股份有限公司 2023-03 记录仪 商务的服务单价分摊在硬件上面时 服务单价分配错误
遵义市千汇汽车销售服务有限公司 2023-02 GPS 只有退货 没有出货 (财务收入 -12654.87)
...@@ -1037,10 +1037,10 @@ def query_supplychain_delivery_device(startTime, endTime, devType=8): ...@@ -1037,10 +1037,10 @@ def query_supplychain_delivery_device(startTime, endTime, devType=8):
def textToNumber(text): def textToNumber(text):
if text == "" or text == "-" or text is None: if text == "" or text == "-" or text is None or text == " - " or text.strip() == '-' :
return 0 return 0
else: else:
return int(float(text)) return int(float(text.strip()))
def calc_direct_device_active_time(deliveryTime, activeMonth): def calc_direct_device_active_time(deliveryTime, activeMonth):
...@@ -1123,8 +1123,8 @@ def active_direct_merchant_device(): ...@@ -1123,8 +1123,8 @@ def active_direct_merchant_device():
settMerDict = {} settMerDict = {}
query_settlement_merchant(bizConn, settMerDict) query_settlement_merchant(bizConn, settMerDict)
sql = ( sql = (
"select customer,active_202101,active_202102,active_202103,active_202104,active_202105,active_202106," "select customer,active_202201,active_202202,active_202203,active_202204,active_202205,active_202206,"
"active_202107,active_202108,active_202109,active_202110,active_202111,active_202112 from dj_2022_direct_cus_active_0212 " "active_202207,active_202208,active_202209,active_202210,active_202211,active_202212 from dj_2023_direct_cus_active_20230603 "
) )
if not bizConn.query(sql): if not bizConn.query(sql):
...@@ -1203,9 +1203,10 @@ def active_direct_merchant_device(): ...@@ -1203,9 +1203,10 @@ def active_direct_merchant_device():
if activeTotal != len(res): if activeTotal != len(res):
logger.error( logger.error(
"active_direct_merchant_device settlemer=%s month=%s need=%d found=%d", "active_direct_merchant_device settlemer=%s month=%s nextMonth=%s need=%d found=%d",
settleMer, settleMer,
activeMonth, activeMonth,
nextMonth,
activeTotal, activeTotal,
len(res), len(res),
) )
...@@ -1625,7 +1626,7 @@ def active_direct_record_device(): ...@@ -1625,7 +1626,7 @@ def active_direct_record_device():
sencond, sencond,
) )
if activeTime >= "2023-04-01 00:00:00": if activeTime >= "2023-05-01 00:00:00":
# updateSql = f"update {tblName} set active_time=null,active_merchant='' where id=%d" % ( # updateSql = f"update {tblName} set active_time=null,active_merchant='' where id=%d" % (
# idx) # idx)
continue continue
...@@ -1991,7 +1992,7 @@ if __name__ == "__main__": ...@@ -1991,7 +1992,7 @@ if __name__ == "__main__":
# handle_return_device('渠道', data=2021, devType=6) # handle_return_device('渠道', data=2021, devType=6)
# 记录仪渠道激活 # 记录仪渠道激活
active_direct_record_device() # active_direct_record_device()
# 追踪器渠道测算激活 # 追踪器渠道测算激活
active_direct_merchant_device() active_direct_merchant_device()
......
...@@ -775,13 +775,13 @@ def update_device_alloc(deviceType, startTime, endTime): ...@@ -775,13 +775,13 @@ def update_device_alloc(deviceType, startTime, endTime):
'''回滚''' '''回滚'''
bizConn = MySQL(g_pro_biz_dbcfg) bizConn = MySQL(g_pro_biz_dbcfg)
if deviceType == 8: if deviceType == 8:
detailTable = "dj_2022_settle_details" detailTable = "dj_2023_settle_details"
deliveryTable = "dj_2021_delivery_device" deliveryTable = "dj_2021_delivery_device"
else: else:
detailTable = "dj_2022_settle_details_record" detailTable = "dj_2023_settle_details_record"
deliveryTable = "dj_2021_delivery_device_record" deliveryTable = "dj_2021_delivery_device_record"
sql = f"SELECT sn FROM {detailTable} where settle_time >= '{startTime}' and settle_time < '{endTime}' and is_virtual = 0" sql = f"SELECT sn FROM {detailTable} where settle_time >= '{startTime}' and settle_time < '{endTime}' and is_virtual = 0"
if not bizConn.query(sql): if not bizConn.query(sql):
return return
res = bizConn.fetchAllRows() res = bizConn.fetchAllRows()
...@@ -806,19 +806,19 @@ def update_device_alloc(deviceType, startTime, endTime): ...@@ -806,19 +806,19 @@ def update_device_alloc(deviceType, startTime, endTime):
if __name__ == "__main__": if __name__ == "__main__":
'''''' ''''''
startTime = '2023-01-01' startTime = '2023-01-01'
endTime = '2023-03-31' endTime = '2023-12-31'
#追踪器设备 #追踪器设备
# match_gen_sn_settlement_delivery_order(startTime, devType=8, prefix='19') 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' # #'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(8, startTime, endTime)
#update_device_alloc(6, startTime, endTime) update_device_alloc(6, startTime, endTime)
......
...@@ -101,12 +101,27 @@ def loadDjExcelToMysql(fileName, sheetName): ...@@ -101,12 +101,27 @@ def loadDjExcelToMysql(fileName, sheetName):
pkPrice = newData.loc[idx, '服务(不含税)'] pkPrice = newData.loc[idx, '服务(不含税)']
pkPriceRate = newData.loc[idx, '服务税率'] pkPriceRate = newData.loc[idx, '服务税率']
client = newData.loc[idx, '客户'].strip() client = newData.loc[idx, '客户'].strip()
value = (newData.loc[idx, '单据类型'], newData.loc[idx, '单据编号'], newData.loc[idx, '业务日期'], client, 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, '计价数量'], hwPriceTax, hwPrice, pkPrice, pkPriceRate, 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, '分摊期限'], newData.loc[idx, '安装'], newData.loc[idx, '安装税率']) newData.loc[idx, '业务类型'],
newData.loc[idx, '分摊期限'],
newData.loc[idx, '分摊期限'],
newData.loc[idx, '安装'],
newData.loc[idx, '安装税率'])
print(value) print(value)
valueArr.append(value) valueArr.append(value)
......
if __name__ == "__main__":
if ' - '== '-':
print('true')
# end main
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!