Exemplo n.º 1
0
def state(tracking_number, statu, message='test'):
    manifestid = manifestId(tracking_number)
    token = login()
    url = "http://120.24.31.239:20000/tms-saas-web/tms/manifesttrack/locus/add"

    payload = {
        "scanId":
        508,
        "idList":
        manifestid,
        "scanName":
        message,
        "scanType":
        1,
        "scanCode":
        statu,
        "scanDatetime":
        datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') +
        datetime.timedelta(days=1),
        "scanStation":
        "泰国",
        "remark":
        message,
        "isdefault":
        0,
        "token":
        token
    }
    headers = {"Content-Type": "application/x-www-form-urlencoded"}
    response = requests.request("POST", url=url, data=payload, headers=headers)
    return response.text
Exemplo n.º 2
0
def Order_Inquire(ref_num):
    token = login()
    url = "http://120.24.31.239:20000/tms-saas-web/tms/order/list"
    payload = {
        "platformType": "",
        "isPrint": 0,
        "isQuotationSegment": 0,
        "isCust": 2,
        "code": ref_num,
        "no": ref_num,
        "noType": 99,
        "sdDateFirst": "2021-07-22 00:00:00",
        "sdDateLast": "2021-07-23 23:59:59",
        "pageSize": 300,
        "currentPage": 1,
        "token": token
    }
    headers = {"Content-Type": "application/x-www-form-urlencoded"}
    response = requests.request("POST",
                                url=url,
                                data=urllib.parse.urlencode(payload),
                                headers=headers)
    if json.loads(response.text)['body']['lastPage'] != 1:
        print(response.text)
        return "没有订单"
    return json.loads(response.text)['body']['list'][0]['jobno']  #获取转单号码
Exemplo n.º 3
0
def manifestId(tracking_number):
    token = login()
    url = "http://120.24.31.239:20000/tms-saas-web/tms/manifestmanage/list"

    payload = {
        "pcs": "",
        "createUserId": "",
        "date1": "0",
        "sdDates": "",
        "isWithStat": "0",
        "sdStatId": "",
        "custType": "",
        "hubInType": "",
        "businessType": "",
        "packType": "",
        "goodsType": "",
        "hubInList": "",
        "destId": "",
        "hubOutType": "",
        "hubOutId": "",
        "deliStatId": "",
        "inventoryType": "",
        "referenceno": "",
        "inventoryStrategyId": "",
        "iscChildCust": "0",
        "ccPayment": "",
        "iscodCharge": "0",
        "isrt": "0",
        "isrr": "0",
        "cocustomType": "",
        "oddNumbers": "",
        "saleEmpId": "",
        "merchandiserEmpId": "",
        "backno": "",
        "isCOD": 0,
        "custIdList": "",
        "hubInTypeList": "",
        "basScanStatusList": "",
        "hubTypeList": "",
        "sortCodeList": "",
        "no": tracking_number,
        "noType": 5,
        "pageSize": 1000,
        "currentPage": "1",
        "token": token
    }
    headers = {"Content-Type": "application/x-www-form-urlencoded"}
    response = requests.request("POST", url=url, data=payload, headers=headers)
    print(json.loads(response.text)['body']['lastPage'])
    if json.loads(response.text)['body']['list'] is not None:
        return json.loads(response.text)['body']['list'][0][
            "manifestId"]  #获取转单号manifestId("KECTH91000794")
    else:
        print(response.text)
Exemplo n.º 4
0
def scan_box(box_num, mawb, mawb_id):
    token = login()
    url = "http://120.24.31.239:20000/tms-saas-web/tms/oawb/selbagging/selectBagging"
    payload = {
        "id": mawb_id,
        "oawbNo": mawb,
        "baggingIdList": select_BoxId(box_num),
        "scanStatId": "1",
        "baggingStatId": "1",
        "dataType": "7",
        "token": token
    }
    headers = {'Content-Type': 'application/x-www-form-urlencoded'}
    response = requests.request("POST", url, headers=headers, data=payload)
    if json.loads(response.text)["body"]:
        print("扫描箱子成功:" + box_num)
Exemplo n.º 5
0
def select_BoxId(box_num):
    token = login()
    url = "http://120.24.31.239:20000/tms-saas-web/tms/oawb/bagging/list"
    payload = {
        "codeType": "7",
        "code": box_num,
        "sdDateFirst": "2021-08-03 00:00",
        "sdDateLast": "2021-09-02 23:59",
        "nextStatId": "",
        "baggingState": 3,
        "posStatId": 1,
        "dataType": 7,
        "pageSize": 500,
        "currentPage": 1,
        "token": token
    }
    headers = {'Content-Type': 'application/x-www-form-urlencoded'}
    response = requests.request("POST", url, headers=headers, data=payload)
    if json.loads(response.text)["body"]["list"]:
        return json.loads(response.text)["body"]["list"][0]["id"]
    else:
        print(response.text)
Exemplo n.º 6
0
def close_mawb(mawb, mawb_id):
    token = login()
    url = "http://120.24.31.239:20000/tms-saas-web/tms/oawbtrack/dtl/add"
    payload = {
        "autoConfirm":
        0,
        "departureRouteName":
        "测试11",
        "destCode":
        "",
        "flipRuleId":
        "238",
        "hubOutIdList":
        "",
        "id":
        mawb_id,
        "nextStation":
        "广州分部",
        "oawbNo":
        mawb,
        "outActual":
        5.3,
        "outPcs":
        0,
        "remark":
        "",
        "scanEr":
        0,
        "scanSc":
        0,
        "startCity":
        "sz",
        "tdActual":
        11,
        "tdPcs":
        10,
        "tdVol":
        12,
        "tdWeig":
        12,
        "totalActual":
        3.6,
        "totalBagPcs":
        1,
        "totalCount":
        "3",
        "totalPcs":
        "3",
        "transportType":
        "1",
        "mawbNo1":
        "1234" + str(random.randint(0, 99999)),
        "oawbState":
        3,
        "token":
        token,
        "oawbShipStr":
        str([{
            "arriveCity": "gz",
            "arriveTime": 1630936774000,
            "companyId": 1,
            "createDatetime": 1630907974000,
            "createUserName": "******",
            "id": 5444,
            "isdel": 0,
            "oawbId": 2942,
            "routeType": "2",
            "shipId": 1205,
            "startTime": 1630936774000,
            "transportNo": "",
            "transportType": "2"
        }, {
            "arriveCity": "cs",
            "arriveTime": 1630936774000,
            "companyId": 1,
            "createDatetime": 1630907974000,
            "createUserName": "******",
            "id": 5445,
            "isdel": 0,
            "oawbId": 2942,
            "routeType": "3",
            "shipId": 1205,
            "startTime": 1630936774000,
            "transportNo": "",
            "transportType": "1"
        }, {
            "arriveCity": "ws",
            "arriveTime": 1630936774000,
            "companyId": 1,
            "createDatetime": 1630907974000,
            "createUserName": "******",
            "id": 5446,
            "isdel": 0,
            "oawbId": 2942,
            "routeType": "2",
            "shipId": 1205,
            "startTime": 1630936774000,
            "transportNo": "",
            "transportType": "2"
        }])
    }
    headers = {'Content-Type': 'application/x-www-form-urlencoded'}
    response = requests.request("POST", url, headers=headers, data=payload)
    if json.loads(response.text)['result_code'] == 0:
        return "创建总运单成功:" + mawb
    return response.text
Exemplo n.º 7
0
def create_mawb():

    token = login()
    url = "http://120.24.31.239:20000/tms-saas-web/tms/oawb/add"
    mawb = "TESTBACK" + str(datetime.datetime.now().strftime('%Y%m%d%H%M%S'))
    payload = {
        "oawbNo":
        mawb,
        "departureRouteId":
        "308",
        "nextStatId":
        "476",
        "remark":
        "",
        "startCity":
        "sz",
        "oawbState":
        "1",
        "outStatId":
        "1",
        "transportType":
        "1",
        "destIds":
        "",
        "destCode":
        "",
        "flipRuleId":
        "238",
        "tdWeig":
        "0.000",
        "token":
        token,
        "shipListStr":
        str([{
            "arriveCity":
            "gz",
            "arriveDay":
            "",
            "arriveTime":
            str(datetime.datetime.now().strftime('%Y-%m-%dT%H:%M:%S.00Z')),
            "companyId":
            1,
            "createDatetime":
            1624427465000,
            "createUserName":
            "******",
            "departureRouteId":
            308,
            "id":
            966,
            "isdel":
            0,
            "routeType":
            "2",
            "shipId":
            1205,
            "startDay":
            "",
            "transportNo":
            "",
            "transportType":
            "2",
            "startTime":
            str(datetime.datetime.now().strftime('%Y-%m-%dT%H:%M:%S.00Z'))
        }, {
            "arriveCity":
            "cs",
            "arriveDay":
            "",
            "arriveTime":
            str(datetime.datetime.now().strftime('%Y-%m-%dT%H:%M:%S.00Z')),
            "companyId":
            1,
            "createDatetime":
            1624427465000,
            "createUserName":
            "******",
            "departureRouteId":
            308,
            "id":
            967,
            "isdel":
            0,
            "routeType":
            "3",
            "shipId":
            1205,
            "startDay":
            "",
            "transportNo":
            "",
            "transportType":
            "1",
            "startTime":
            str(datetime.datetime.now().strftime('%Y-%m-%dT%H:%M:%S.00Z'))
        }, {
            "arriveCity":
            "ws",
            "arriveDay":
            "",
            "arriveTime":
            str(datetime.datetime.now().strftime('%Y-%m-%dT%H:%M:%S.00Z')),
            "companyId":
            1,
            "createDatetime":
            1624427465000,
            "createUserName":
            "******",
            "departureRouteId":
            308,
            "id":
            968,
            "isdel":
            0,
            "routeType":
            "2",
            "shipId":
            1205,
            "startDay":
            "",
            "transportNo":
            "",
            "transportType":
            "2",
            "startTime":
            str(datetime.datetime.now().strftime('%Y-%m-%dT%H:%M:%S.00Z'))
        }])
    }
    headers = {'Content-Type': 'application/x-www-form-urlencoded'}
    response = requests.request("POST", url, headers=headers, data=payload)

    if json.loads(response.text)["body"]["id"]:
        print({"id": json.loads(response.text)["body"]["id"], "mawb": mawb})
        return {"id": json.loads(response.text)["body"]["id"], "mawb": mawb}
    else:
        print(response.text)