Exemple #1
0
    def billing_return_refund(cls, account='ADMIN', order_nos=[]):
        """
        生成退款账单
        :param account:
        :param order_nos:
        :return:
        """
        # 退款申请
        refund_apply_no = RefundAction.refund_apply(account=account, order_nos=order_nos)

        refund_apply_nos = list()
        refund_apply_nos.append(refund_apply_no)
        sleep(tmsBase.wait_time)
        # 退货确认
        BillingAction.billing_confirm_refund(account=account, refund_apply_nos=refund_apply_nos)
        sleep(tmsBase.wait_time)
        refund_bill_id = BillingUtil.billing_get_billId_by_apply_no(refund_apply_no)[0]
        print u'退款账单号:%s' % refund_bill_id

        refund_bill_ids = list()
        refund_bill_ids.append(refund_bill_id)
        BillingAction.billing_audit_refund(account=account, billing_order_ids=refund_bill_ids)

        BillingAction.billing_deduct_refund(account=account, billing_order_ids=refund_bill_ids)

        return refund_bill_id
Exemple #2
0
    def billing_confirm_refund(cls, account='ADMIN', refund_batch_nos=[], refund_apply_nos=[]):
        """
        退货确认
        :param account:
        :param refund_batch_nos:退货批次号
        :param refund_apply_nos: 退款申请号
        """
        print u'*' * 20 + u'退货确认'
        url = tmsBase.base_url + '/tms/bms/billingRefundConfirmController/sure.do'
        rows = demjson.decode(
            BillingUtil.billing_get_pre_return_confirmed(account=account, refund_batch_nos=refund_batch_nos,
                                                         refund_apply_nos=refund_apply_nos))['rows']

        resp = HttpRequest.post_request(TmsLogin.get_session(account), url, data={'rows': demjson.encode(rows)})

        print resp
    sleep(tmsBase.wait_time)

    # if BaseInfo.get_distributor_id(account='ADMIN', distributor_short_name=sys.argv[1].decode('gbk')) == 0:
    #     obj = BaseInfo.get_subdistributor_id(subdistributor_short_name=sys.argv[1].decode('gbk'))
    #     delivery_dealer = obj[0] + '-' + obj[1]
    # else:
    #     delivery_dealer = BaseInfo.get_distributor_id(account='ADMIN', distributor_short_name=sys.argv[1].decode('gbk')) + '-'

    if BaseInfo.get_distributor_id(account='ADMIN', distributor_short_name='autoexpress') == 0:
        obj = BaseInfo.get_subdistributor_id(subdistributor_short_name='autoexpress')
        delivery_dealer = obj[0] + '-' + obj[1]
    else:
        delivery_dealer = BaseInfo.get_distributor_id(account='ADMIN', distributor_short_name='autoexpress') + '-'

    RainbowFlow.sorting_forward_to_delivery_dealer(order_ids=order_ids,
                                                   delivery_dealer=delivery_dealer,
                                                   account='TIANJINSORTING')
    sleep(tmsBase.wait_time)
    ExpressFlow.express_return_on_success(order_ids=order_ids, express_account='AUTOEXPRESS')

    sleep(tmsBase.wait_time)
    ExpressUtil.express_check_order_state(order_ids=order_ids, state='退货已签收'.decode('utf-8'))
    RainbowUtil.rainbow_check_order_state(order_ids=order_ids, state='退货已签收'.decode('utf-8'))

    refund_order_id = BillingFlow.billing_return_refund(account='ADMIN', order_nos=order_ids)

    sleep(tmsBase.wait_time)
    BillingUtil.billing_check_refund_order_state(account='ADMIN', refund_bill_id=refund_order_id,
                                                 status='已审核'.decode('utf-8'),
                                                 deduct_status='可抵'.decode('utf-8'))