def request_OverseasDispatch(waybill_list, customer_code, waybill_servercode,
                             if_pqm, fee_count, source):
    """
    造海外重派运单及费用数据
    :param waybill_list:
    :param customer_code:
    :param waybill_servercode:
    :param if_pqm:
    :param fee_count:
    :param source:
    :return:
    """
    """造海外重派业务数据"""
    # 将每个运单从运单集合中取出来,有几个运单就执行多少次
    for waybill_number in waybill_list:
        dispatch_number = create_OverseasDispatch_business(
            waybill_number, waybill_servercode, source)

        time.sleep(SleepTime.sleep_time)
        """调报价计算费用"""
        # 进报价
        if if_pqm:
            if source == 1:
                print("YT-海外重派应付报价费用")
                pqm_to_cost(waybill_number=dispatch_number,
                            waybill_list=waybill_list,
                            server_code=waybill_servercode,
                            product_code="",
                            customer_code=customer_code,
                            cost_type="CP",
                            charge_type="",
                            source=source)
            elif source == 2:
                print("WT-海外重派中转应付报价费用")
                pqm_to_cost(waybill_number=dispatch_number,
                            waybill_list=waybill_list,
                            server_code=waybill_servercode,
                            product_code="",
                            customer_code=customer_code,
                            cost_type="CP",
                            charge_type="",
                            source=source)
        # 不进报价直接推费用到fms
        else:
            create_OverseasDispatch_fee(dispatch_number, waybill_servercode,
                                        fee_count, source)

        time.sleep(SleepTime.sleep_time)
        check_sql_result_business(
            bsn_overseasdispatch.format(table_dev_aps_db, dispatch_number),
            fms_db_166, "dispatch_number", dispatch_number, "")
        check_sql_result_fee(
            overseasdispatch_fee.format(table_dev_aps_db, dispatch_number),
            fms_db_166, dispatch_number)
def request_SettlementClaims(waybill_list, waybill_servercode, source):
    """
    造理赔业务数据
    :param waybill_list:
    :param waybill_servercode:
    :param source:
    :return:
    """
    """造理赔业务数据"""
    # 将每个运单从运单集合中取出来,有几个运单就执行多少次
    for waybill_number in waybill_list:
        create_SettlementClaims_business(waybill_number, waybill_servercode,
                                         source)

        time.sleep(SleepTime.sleep_time)
        check_sql_result_business(
            bsn_overseasclaim.format(table_dev_aps_db, waybill_number),
            fms_db_166, "claim_number", waybill_number, "")
Esempio n. 3
0
def request_transport(transport_servercode, bag_list, waybill_count, fee_count,
                      if_pqm, source):
    """
    造调拨运输业务及费用数据
    :param allocation_number:
    :param transport_number:
    :param transport_servercode:
    :param bag_list:
    :param waybill_count:
    :param fee_count:
    :param if_pqm:
    :param source:
    :return:
    """
    """造调拨运输业务数据"""
    transport_type_code, allocation_number, request_data = create_transport_business(
        transport_servercode, bag_list, waybill_count)

    time.sleep(SleepTime.sleep_time)
    """调报价计算费用"""
    # 进报价
    if if_pqm:
        if source == 1:
            print("YT-调拨运输应付报价费用")
            pqm_to_transport_fee(request_data, transport_type_code)
        elif source == 2:
            pass
    # 不进报价直接推费用到fms
    else:
        create_car_fee(car_number=request_data["transport_hawbcode"],
                       departure_number=request_data["allocation_labelcode"],
                       server_code=transport_servercode,
                       fee_count=fee_count,
                       order_type=3)

    time.sleep(SleepTime.sleep_time)
    check_sql_result_business(
        transfer_reconcile_info.format(table_dev_aps_db, allocation_number),
        fms_db_166, "allocation_number", allocation_number, "")
    check_sql_result_fee(
        transfer_reconcile_info_fee.format(table_dev_aps_db,
                                           allocation_number), fms_db_166,
        allocation_number)
Esempio n. 4
0
def request_OverseasReturn(waybill_list, customer_code, waybill_servercode, if_pqm, fee_count, source):
    """
    造海外退件运单及费用数据
    :param waybill_list:
    :param customer_code:
    :param waybill_servercode:
    :param if_pqm:
    :param fee_count:
    :param source:
    :return:
    """
    """造海外退件业务数据"""
    # 将每个运单从运单集合中取出来,有几个运单就执行多少次
    for waybill_number in waybill_list:
        return_number = create_OverseasReturn_business(waybill_number, customer_code, waybill_servercode, source)

        time.sleep(SleepTime.sleep_time)

        """调报价计算费用"""
        # 进报价
        if if_pqm:
            if source == 1:
                print("YT-海外退件应付报价费用")
                pqm_to_cost(waybill_number=return_number, waybill_list=waybill_list, server_code=waybill_servercode,
                            product_code="", customer_code=customer_code, cost_type="TJ",
                            charge_type="", source=source)
            elif source == 2:
                print("WT-海外退件中转应付报价费用")
                pqm_to_cost(waybill_number=return_number, waybill_list=waybill_list, server_code=waybill_servercode,
                            product_code="", customer_code=customer_code,
                            cost_type="TJ", charge_type="", source=source)
        # 不进报价直接推费用到fms
        else:
            create_OverseasReturn_fee(return_number, waybill_servercode, fee_count, source)

        time.sleep(SleepTime.sleep_time)
        check_sql_result_business(rec_info_overseas_return.format(table_dev_aps_db, return_number), fms_db_166,
                                  "return_number", return_number, "")
        check_sql_result_fee(rec_cost_overseas_return.format(table_dev_aps_db, return_number), fms_db_166,
                             return_number)
Esempio n. 5
0
def request_OpeLabrary(waybill_list, if_pqm, source):
    """
    造调拨库内运单及费用数据
    :param waybill_list:
    :param customer_code:
    :param waybill_servercode:
    :param if_pqm:
    :param fee_count:
    :param source:
    :return:
    """
    """造调拨库内业务数据"""
    # 将每个运单从运单集合中取出来,有几个运单就执行多少次
    for waybill_number in waybill_list:
        operation_type_code = create_OpeLabrary_business(waybill_number)

        time.sleep(SleepTime.sleep_time)
        """调报价计算费用"""
        # 进报价
        if if_pqm:
            if source == 1:
                print("YT-调拨库内应付报价费用")
                pqm_to_OpeLabrary_fee(waybill_number, operation_type_code)
            elif source == 2:
                print("WT-调拨库内中转应付报价费用")
                pqm_to_OpeLabrary_fee(waybill_number, operation_type_code)
        # 不进报价直接推费用到fms
        else:
            create_OpeLabrary_fee(waybill_number, operation_type_code, source)

        time.sleep(SleepTime.sleep_time)
        check_sql_result_business(
            transfer_operations_node.format(table_dev_aps_db, waybill_number),
            fms_db_166, "transfer_number", waybill_number, "")
        check_sql_result_fee(
            transfer_operations_fee.format(table_dev_aps_db, waybill_number),
            fms_db_166, waybill_number)
Esempio n. 6
0
def request_clearance(lading_number, bag_list, waybill_list, fee_count,
                      clearance_servercode, customer_code, if_pqm, if_vat,
                      charge_type, source):
    """
    造清关提单及费用数据
    :param lading_number:
    :param bag_list:
    :param waybill_list:
    :param fee_count:
    :param clearance_servercode:
    :param customer_code:
    :param if_pqm:
    :param if_vat:
    :param source:
    :return:
    """
    """造清关提单业务数据"""
    product_code = create_clearance_business(lading_number, bag_list,
                                             waybill_list,
                                             clearance_servercode,
                                             customer_code, source)

    time.sleep(SleepTime.sleep_time)
    """调报价计算费用"""
    # 进报价
    if if_pqm:
        if source == 1:
            print("YT-清关应收报价费用")
            pqm_to_income(waybill_number=lading_number,
                          waybill_list=waybill_list,
                          server_code=clearance_servercode,
                          product_code="EUFBA",
                          customer_code=customer_code,
                          income_type="QG",
                          source=source)
            print("YT-清关应付报价费用")
            pqm_to_cost(waybill_number=lading_number,
                        waybill_list=waybill_list,
                        server_code=clearance_servercode,
                        product_code=product_code,
                        customer_code=customer_code,
                        cost_type="QG",
                        charge_type=charge_type,
                        source=source)
        elif source == 2:
            print("WT-清关应收报价费用")
            pqm_to_income(waybill_number=lading_number,
                          waybill_list=waybill_list,
                          server_code=clearance_servercode,
                          product_code="PK0053",
                          customer_code=customer_code,
                          income_type="QG",
                          source=source)
            print("WT-清关应付报价费用")
            pqm_to_cost(waybill_number=lading_number,
                        waybill_list=waybill_list,
                        server_code=clearance_servercode,
                        product_code=product_code,
                        customer_code=customer_code,
                        cost_type="QG",
                        charge_type=charge_type,
                        source=source)
    # 不进报价直接推费用到fms
    else:
        # 应收
        create_bill_income_fee(waybill_code=lading_number,
                               customer_code=customer_code,
                               income_type="QG",
                               source=source)
        # 应付
        create_clearance_fee(lading_number, fee_count, clearance_servercode)

        create_clearance_vat_fee(lading_number, waybill_list, fee_count)

    time.sleep(SleepTime.sleep_time)
    check_sql_result_business(
        customs_info.format(table_dev_aps_db, lading_number), fms_db_166,
        "clearance_number", lading_number, "")
    check_sql_result_business(
        chl_customs_info.format(table_dev_aps_db, lading_number), fms_db_166,
        "clearance_number", lading_number, "")
    check_sql_result_fee(customs_fee.format(table_dev_aps_db, lading_number),
                         fms_db_166, lading_number)
    check_sql_result_fee(
        chl_customs_fee.format(table_dev_aps_db, lading_number), fms_db_166,
        lading_number)
    check_sql_result_fee(
        customs_vat_fee.format(table_dev_aps_db, lading_number), fms_db_166,
        lading_number)
    if source == 2 or not if_pqm:
        check_sql_result_fee(
            bil_income_clearance.format(table_fms_db, lading_number),
            fms_db_195, lading_number)
def request_TransitTransport(TransitTransport_servercode, bag_list,
                             waybill_count, customer_code, fee_count,
                             start_place, end_place, source, if_pqm):
    """
    造发货中转业务及费用数据
    :param departure_number:
    :param car_number:
    :param TransitTransport_servercode:
    :param bag_list:
    :param waybill_count:
    :param customer_code:
    :param fee_count:
    :param source:
    :param if_pqm:
    :return:
    """
    """造发货中转业务数据"""
    departure_number, car_number = create_TransitTransport_business(
        TransitTransport_servercode, bag_list, waybill_count, customer_code,
        start_place, end_place, source)
    """造发货中转业务数据和袋子关系数据"""
    bag_items = params_TransitTransport_bag(bag_list, source)
    bag_items["departure_number"] = departure_number
    bag_items["car_number"] = car_number
    request_url = BaseUrl.fms_url + Path.TransitTransportBag

    request_interface(request_url, bag_items)

    time.sleep(SleepTime.sleep_time)
    """调报价计算费用"""
    # 进报价
    if if_pqm:
        if source == 1:
            print("YT-发货中转应付报价费用")
            pqm_to_TransitTransport_fee(
                waybill_number=departure_number,
                waybill_list=[],
                car_number=car_number,
                server_code=TransitTransport_servercode,
                product_code="",
                start_place=start_place,
                end_place=end_place,
                cost_type="ZY",
                source=source)
        elif source == 2:
            print("WT-发货中转应收报价费用")
            pqm_to_income(waybill_number=departure_number,
                          waybill_list=[],
                          server_code=TransitTransport_servercode,
                          product_code="PK0055",
                          customer_code=customer_code,
                          income_type="ZY",
                          source=source)
            print("WT-发货中转应付报价费用")
            pqm_to_TransitTransport_fee(
                waybill_number=departure_number,
                waybill_list=[],
                car_number=car_number,
                server_code=TransitTransport_servercode,
                product_code="",
                start_place=start_place,
                end_place=end_place,
                cost_type="ZY",
                source=source)
    # 不进报价直接推费用到fms
    else:
        # 应付
        create_car_fee(car_number=car_number,
                       departure_number=departure_number,
                       server_code=TransitTransport_servercode,
                       fee_count=fee_count,
                       order_type=2)

    time.sleep(SleepTime.sleep_time)
    check_sql_result_business(
        transport_info.format(table_dev_aps_db, departure_number), fms_db_166,
        "departure_number", departure_number, car_number)
    check_sql_result_fee(
        transport_payment.format(table_dev_aps_db, departure_number),
        fms_db_166, departure_number)
Esempio n. 8
0
def request_AirTransport(bag_list, waybill_list, customer_code, air_servercode,
                         fee_count, if_pqm, charge_type, source):
    """
    造空运提单及费用数据
    :param lading_number:
    :param bag_list:
    :param waybill_list:
    :param customer_code:
    :param air_servercode:
    :param fee_count:
    :param if_pqm:
    :param source:
    :return:
    """
    """造空运提单业务数据"""
    lading_number, product_code, request_data = create_AirTransport_business(
        bag_list, waybill_list, air_servercode, customer_code, source)

    time.sleep(SleepTime.sleep_time)
    """调报价计算费用"""
    # 进报价
    if if_pqm:
        if source == 1:
            print("YT-空运应付报价费用")
            pqm_to_cost(waybill_number=lading_number,
                        waybill_list=waybill_list,
                        server_code=air_servercode,
                        product_code=product_code,
                        customer_code=customer_code,
                        cost_type="KY",
                        charge_type=charge_type,
                        source=source)

        elif source == 2:
            print("WT-空运应收报价费用")
            pqm_to_income(waybill_number=lading_number,
                          waybill_list=waybill_list,
                          server_code=air_servercode,
                          product_code="PK0054",
                          customer_code=customer_code,
                          income_type="KY",
                          source=source)
            print("WT-空运应付报价费用")
            pqm_to_cost(waybill_number=lading_number,
                        waybill_list=waybill_list,
                        server_code=air_servercode,
                        product_code=product_code,
                        customer_code=customer_code,
                        cost_type="KY",
                        charge_type=charge_type,
                        source=source)

    # 不进报价直接推费用到fms
    else:
        # 应收
        create_bill_income_fee(waybill_code=lading_number,
                               customer_code=customer_code,
                               income_type="KY",
                               source=source)
        # 应付
        create_AirTransport_fee(lading_number, fee_count, air_servercode,
                                source, charge_type)

    time.sleep(SleepTime.sleep_time)
    if charge_type == 0:
        check_sql_result_business(
            lading_info.format(table_dev_aps_db, lading_number), fms_db_166,
            "lading_number", lading_number, "")
        check_sql_result_fee(
            lading_fee.format(table_dev_aps_db, lading_number), fms_db_166,
            lading_number)
    else:
        check_sql_result_business(
            chl_lading_info.format(table_dev_aps_db, lading_number),
            fms_db_166, "lading_number", lading_number, "")
        check_sql_result_fee(
            chl_lading_fee.format(table_dev_aps_db, lading_number), fms_db_166,
            lading_number)

    if source == 2 or not if_pqm:
        check_sql_result_fee(
            bil_income_air.format(table_fms_db, lading_number), fms_db_195,
            lading_number)

    column_data = air_transport_column_data(air_servercode, request_data)
    write_reconciliation_file("空运对账.xlsx", "Sheet1", column_data)

    return lading_number
Esempio n. 9
0
def request_waybill(waybill_count, customer_code, waybill_servercode,
                    transfer_type, if_pqm, source):
    """
    造运单及费用数据
    :param customer_code:
    :param transfer_type:
    :param waybill_servercode:
    :param if_pqm:
    :param source:
    :return:
    """
    """造末端运单业务数据"""
    waybill_number, waybill_info = create_WayBill_business(
        customer_code, transfer_type, waybill_servercode, source)

    time.sleep(SleepTime.sleep_time)
    '''应收返点费用'''
    create_rebate_income_fee(waybill_number, source, customer_code)
    """应付返点费用"""
    create_rebate_cost_fee(waybill_number, source, waybill_servercode)
    """调报价计算费用"""
    # 进报价
    if if_pqm:
        if source == 1:
            print("YT-末端应收报价费用")
            pqm_to_income(waybill_number=waybill_number,
                          waybill_list=[],
                          server_code=waybill_servercode,
                          product_code="SGRDGM",
                          customer_code=customer_code,
                          income_type="PS",
                          source=source)
            print("YT-末端应付报价费用")
            pqm_to_cost(waybill_number=waybill_number,
                        waybill_list=[],
                        server_code=waybill_servercode,
                        product_code="",
                        customer_code=customer_code,
                        cost_type="PS",
                        charge_type="",
                        source=source)
        elif source == 2:
            print("WT-末端应收报价费用")
            pqm_to_income(waybill_number=waybill_number,
                          waybill_list=[],
                          server_code=waybill_servercode,
                          product_code="FDXGR-CA",
                          customer_code=customer_code,
                          income_type="PS",
                          source=source)
            print("WT-末端应付报价费用")
            pqm_to_cost(waybill_number=waybill_number,
                        waybill_list=[],
                        server_code=waybill_servercode,
                        product_code="",
                        customer_code=customer_code,
                        cost_type="PS",
                        charge_type="",
                        source=source)
    # 不进报价直接推费用到fms
    else:
        # 应收
        create_bill_income_fee(waybill_code=waybill_number,
                               customer_code=customer_code,
                               income_type="PS",
                               source=source)
        # 应付
        create_WayBill_fee(waybill_number, waybill_servercode, source)
    """是否入库检查"""
    time.sleep(SleepTime.sleep_time)
    check_sql_result_business(
        bsn_receivablebusiness.format(table_dev_aps_db, waybill_number),
        fms_db_166, "waybill_number", waybill_number, "")
    check_sql_result_fee(rebate_income.format(table_fms_db, waybill_number),
                         fms_db_195, waybill_number)
    check_sql_result_fee(
        rebate_payment.format(table_dev_aps_db, waybill_number), fms_db_166,
        waybill_number)
    check_sql_result_fee(
        bil_income_Deliver.format(table_fms_db, waybill_number), fms_db_195,
        waybill_number)
    check_sql_result_fee(bil_payment.format(table_dev_aps_db, waybill_number),
                         fms_db_166, waybill_number)

    column_data = waybill_column_data(waybill_servercode, waybill_info)
    write_reconciliation_file("末端服务商正常账单模板.xlsx", "Sheet1", column_data)

    return waybill_number