entranceFeeBill_details.py 3.6 KB
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import urllib3
from commons import common as com
from commons.MySession import sy1
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)


class entranceFeeBill_details():
    "收费单标记-查询"
    url = "http://test.jmsf.diligrp.com:8385/entranceFeeBill/details.action"
    header = {
          "Connection": "keep-alive",
          "Accept": "application/json, text/javascript, */*; q=0.01",
          "X-Requested-With": "XMLHttpRequest",
          "User-Agent": "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36",
          "Content-Type": "application/json",
          "Accept-Language": "zh-CN,zh;q=0.9",
          "Accept-Encoding": "gzip, deflate"}
    url_tail = """?rows=10&page=1
        &metadata[charge_total_amount]={"provider":"moneyProvider","index":10,"field":"charge_total_amount"}
        &metadata[discount]={"provider":"moneyProvider","index":20,"field":"discount"}
        &metadata[freeze_price]={"provider":"moneyProvider","index":30,"field":"freeze_price"}
        &metadata[trx_sum]={"provider":"moneyProvider","index":40,"field":"trx_sum"}
        &metadata[itemFee103]={"provider":"moneyProvider","index":50,"field":"itemFee103"}
        &metadata[itemFee106]={"provider":"moneyProvider","index":60,"field":"itemFee106"}
        &metadata[payment_time]={"provider":"datetimeProvider","index":70,"field":"payment_time"}
        &metadata[status]={"provider":"entranceFeeBillStateProvider","index":80,"field":"status"}
        &metadata[CREATED]={"provider":"datetimeProvider","index":90,"field":"CREATED"}
        &metadata[gross_weight_date]={"provider":"datetimeProvider","index":100,"field":"gross_weight_date"}
        &metadata[tare_weight_date]={"provider":"datetimeProvider","index":110,"field":"tare_weight_date"}
        &carTypeId=53
        &categoryId=14436
        &dep=58
        &regionId=72
        &status=4
        &type=1
        &backSkinStatus=-1
        &tag=20
        &companyId=9
        &startTime=2020-08-11 00:00:00&endTime=2025-08-13 00:00:00
        &startPayTime=2020-08-11 00:00:00&endPayTime=2025-08-13 00:00:00
        &attr=number&attrValue=202108120900001"""

    def __init__(self):
        self.url = entranceFeeBill_details.url.replace("http://test.", com.get_global_config("global_data", "environment", "en"))
        self.url =self.url + entranceFeeBill_details.url_tail.replace('\n', '')
        self.header = entranceFeeBill_details.header
        self.sql="""SELECT 
                    a.car_type_id, #0车型
                    b.category_id, #1品类
                    a.dep,   #2接车部
                    b.region_id ,#3货物区域
                    a.`status`, #4状态
                    a.type ,#5称重类型
                    a.back_skin_status, #6回皮状态
                    b.tags,    #7货物标签-F
                    a.company_id, #8子公司
                    a.number,  #9收费单号
                    a.plate, #10车牌号
                    b.product_name , #11商品
                    a.cashier_name , #12收费员
                    a.customer_name, #13客户姓名
                    a.customer_phone, #14客户手机号
                    a.ic #15客户卡号
                    FROM entrance_fee_bill a ,goods b 
                    WHERE a.goods_id=b.id 
                    AND a.market_id={}
                    AND a.`status`=4
                    ORDER BY a.id DESC LIMIT 1;""".format(sy1.user["sy_user01"]["firmId"])


# tt=entranceFeeBill_details()
# re=sy1.get(url=tt.url,headers=tt.header)
# print(str(re.json()).replace(" ",""))