• 20200103


    #coding=utf-8
    
    import requests
    import json
    
    
    #获取联单编号
    def get_liandan_code(url,producer_code):
        url=url+"/bc/orders/manual/"+producer_code
        r = requests.post(url)
        assert r.json()['code']==200
        return r.json()['data']
    
    
    
    #产废填写联单
    def produces_write(url,producerId,transporterId,consumerId,liandan_code):
        headers={'Content-Type':'application/json','Host':'betablockchain.tian-wang.com','accept-encoding':'gzip, deflate'}
    
        url=url+"/bc/orders/"+liandan_code+"/producer"
    
        payload = {
        "producerId": "20191009101520823CP266088",
        "transporterId": "20191008112322001CP750008",
        "consumerId": "20191008112042862CP367519",
        "wasteWeight": "1.999",
        "wasteName": "废旧铅酸蓄电池",
        "wasteCode": "900-044-49",
        "wasteType": "HW08",
        "destination": "黄岩",
        "wasteReference": "HW-08",
        "mainIngredient": "",
        "forbiddenEmergency": "禁忌",
        "wasteForm": "1",
        "wasteFeatures": "1,2",
        "wastePackageType": "1",
        "transportPurpose": "1",
        "linkman": ""
        }
        
        payload['producerId']=producerId
        payload['transporterId']=transporterId
        payload['consumerId']=consumerId
        
        params=json.dumps(payload,ensure_ascii=False)
        print(params)
    
        r = requests.post(url,data=params,headers=headers)
        print(r.text)
        assert r.json()['code']==200
    
    
    
    #联单授权
    def liandan_grant(url,liandan_code,operateCompanyId):
        url=url+"/bc/orders/"+liandan_code+"/permission"
        payload={
            "operateCompanyId": "20191008112322001CP750008"
        }
        payload['operateCompanyId']=operateCompanyId
        r = requests.post(url, data=json.dumps(payload))
        assert r.json()['code']==200
    
    
    
    
    
    
    #运输单位签名
    def transport_sign(url,liandan_code,operateCompanyId):
        url=url+"/bc/orders/"+liandan_code+"/transporter"
        payload = {
            "operateCompanyId": "20191008112322001CP750008",
            "companyName1": "test0927运输单位3",
            "transportDate1": "2019-09-29",
            "vehicleModel1": "型号1",
            "vehicleNumber1": "123123",
            "licenseNumber1": "456456",
            "startPoint1": "北京",
            "passBy1": "江苏",
            "destination1": "浙江",
            "transporterName1": "111113"
        }
        payload['operateCompanyId']=operateCompanyId
        r = requests.post(url, data=json.dumps(payload,ensure_ascii=False))
        assert r.json()['code']==200
    
    
    
    
    #处置单位签名
    def consumer_sign(url,liandan_code,operateCompanyId):
        url=url+"/bc/orders/"+liandan_code+"/consumer"
        payload = {
            "operateCompanyId": "20191008112042862CP367519",
            "certNumber": "cert11223344",
            "receiverName": "夏李",
            "usageType": 1,
            "disposeType": 3,
            "storeType": 7,
            "finalWeight": 1.62,
            "linkman": ""
        }
        payload['operateCompanyId']=operateCompanyId
        r = requests.post(url, data=json.dumps(payload,ensure_ascii=False))
        assert r.json()['code']==200
    
    
    
    url="http://betablockchain.tian-wang.com"
    transporterId="20191008112322001CP750008"
    consumerId="20191008112042862CP367519"
    producer=["20191009101520823CP266088","20191009101627039CP835389","20191009101632538CP719772","20191009101637343CP771701","20191009101642926CP538512","20191009101647197CP782183","20191009101651588CP443479","20191009101655955CP741468","20191009101659766CP820945","20191009101704468CP598676","20191009101709067CP184593","20191009101548892CP387850","20191009101714403CP219514","20191009101718447CP615393","20191009101722429CP347019","20191009101726900CP802931","20191009101730591CP452592","20191009101734578CP525001","20191009101554039CP177483","20191009101558829CP208774","20191009101603499CP560106","20191009101607979CP687893","20191009101612317CP954548","20191009101616794CP929536","20191009101621488CP196553"]
    
    #for i in producer:
    i=producer[1]
    #获取联单编号
    liandan_code=get_liandan_code(url,i)
    #产废单位签名
    produces_write(url,i,transporterId,consumerId,liandan_code)
    '''
    #联单授权
    liandan_grant(url,liandan_code,i)
    #运输单位签名
    transport_sign(url,liandan_code,transporterId)
    #联单授权
    liandan_grant(url,liandan_code,transporterId)
    #处置单位签名
    consumer_sign(url,liandan_code,consumerId)
    
    '''

  • 相关阅读:
    浅析 Java 中的 final 关键字
    谷歌Java编程风格指南
    分布式事务之两阶段提交协议(2PC)and 使用事件和消息队列实现分布式事务
    零和博弈与木桶定律
    Executors类创建四种常见线程池
    软件设计的原则&101个设计模式-2011年04月25日 陈皓
    编程中的命名设计那点事-陈皓
    从面向对象的设计模式看软件设计- 2013年02月01日 陈皓
    SQL语句
    分布式事务
  • 原文地址:https://www.cnblogs.com/sea-stream/p/12142962.html
Copyright © 2020-2023  润新知