Ejemplo n.º 1
0
    def batch_dispatch(cls, account='AUTOEXPRESS', order_ids=[]):
        """
        运单批量出库配送
        :param account:
        :param order_ids:
        """
        print u'*' * 20 + u'运单批量出库配送'
        workbook = xlsxwriter.Workbook('batchDispatch.xlsx')
        worksheet = workbook.add_worksheet('Sheet 1')
        worksheet.write(0, 0, u'运单号')
        worksheet.write(0, 1, u'配送员')
        worksheet.write(0, 2, u'配送员电话')
        line = 1
        for order_id in order_ids:
            print order_id
            worksheet.write(line, 0, order_id)
            worksheet.write(line, 1, u'张三')
            worksheet.write(line, 2, u'13800138000')
            line += 1
        workbook.close()

        url = tmsBase.base_url + '/tms/goods/expressGoodsArrivalOutStorageController/upload.do'
        with open('batchDispatch.xlsx', 'rb') as f:
            files = {'uploadExcel': f}
            resp = HttpRequest.post_request(TmsLogin.get_session(account), url, files=files)
            check_result(resp)
            return resp
Ejemplo n.º 2
0
    def batch_in_storage(cls, account='AUTOEXPRESS', order_ids=[]):
        """
        运单到货批量入库
        :param account:
        :param order_ids:运单ids,list
        :return:
        """
        print u'*' * 20 + u'运单到货批量入库'
        workbook = xlsxwriter.Workbook('batchInStorage.xlsx')
        worksheet = workbook.add_worksheet('Sheet 1')
        worksheet.write(0, 0, u'运单号')
        line = 1
        for order_id in order_ids:
            print order_id
            worksheet.write(line, 0, order_id)
            line += 1
        workbook.close()

        url = tmsBase.base_url + '/tms/goods/expressGoodsArrivalToStorageController/upload.do'

        with open('batchInStorage.xlsx', 'rb') as f:
            files = {'uploadExcel': f}
            resp = HttpRequest.post_request(TmsLogin.get_session(account), url, files=files)
            check_result(resp)
            return resp
Ejemplo n.º 3
0
    def delivery_out_storage(cls, account='TIANJINSORTING', out_company='', order_no='', out_order_type=2, out_type=1,
                             outcountct=1, outcountdis=1):
        """
        运单出库
        :param account:
        :param out_company:出库公司
        :param order_no:单据号
        :param out_order_type:单据类型,1:运单号,2:合包号
        :param out_type:出库类型,1:出库到配送商,2:出库到城际运输商
        :param outcountct:
        :param outcountdis:
        :return:
        """
        print u'*' * 20 + u'运单出库'
        url = tmsBase.base_url + '/tms/sort/sortOutstorageController/outStorage.do'
        data = dict()
        data['outCmp'] = out_company
        data['orderNo'] = order_no
        data['outOrderType'] = out_order_type
        data['outType'] = out_type
        data['outcountct'] = outcountct
        data['outcountdis'] = outcountdis

        resp = HttpRequest.post_request(TmsLogin.get_session(account), url, data=data)
        check_operation_result(resp)
        return resp
Ejemplo n.º 4
0
    def batch_feedback(cls, account='AUTOEXPRESS', order_ids=[], feedback_result='SUCCESS'):
        """
        批量状态反馈
        :param account:
        :param order_ids:
        :param feedback_result: SUCCESS,FAIL,INTRANSIT
        """
        print u'*' * 20 + u'批量状态反馈'
        workbook = xlsxwriter.Workbook('batchFeedback.xlsx')
        worksheet = workbook.add_worksheet('Sheet 1')
        worksheet.write(0, 0, u'运单号')
        worksheet.write(0, 1, u'配送状态')
        worksheet.write(0, 2, u'原因')
        worksheet.write(0, 3, u'签收人')
        worksheet.write(0, 4, u'邮寄包裹号')
        line = 1
        for order_id in order_ids:
            print order_id
            worksheet.write(line, 0, order_id)
            worksheet.write(line, 1, dispatchStatus[feedback_result]['status'])
            worksheet.write(line, 2, dispatchStatus[feedback_result]['reason'])
            if feedback_result == 'SUCCESS':
                worksheet.write(line, 3, u'本人签收')
            worksheet.write(line, 4, order_id)
            line += 1
        workbook.close()

        url = tmsBase.base_url + '/tms/goods/expressGoodsStatusFeedBackController/upload.do'

        with open('batchFeedback.xlsx', 'rb') as f:
            files = {'uploadExcel': f}
            resp = HttpRequest.post_request(TmsLogin.get_session(account), url, files=files)
            check_result(resp)
            return resp
Ejemplo n.º 5
0
    def refund_apply(cls, account='ADMIN', order_nos=[]):
        """
        退款申请
        :param account:
        :param ids:
        """
        print u'*' * 20 + u'退款申请'
        # 获取运单id
        order_ids = []
        obj = demjson.decode(RainbowUtil.rainbow_get_refund_apply_info(account=account, order_ids=order_nos))
        for item in obj['rows']:
            order_ids.append(item['id'])
        # 申请退款
        url = tmsBase.base_url + '/tms/sort/refundOrderController/refundApply.do'
        resp = HttpRequest.post_request(TmsLogin.get_session(account), url, data={'ids[]': order_ids})
        # check_operation_result(resp)
        print resp

        # 获取退款申请号
        obj = demjson.decode(RainbowUtil.rainbow_get_refund_apply_info(account=account, order_ids=order_nos))

        refund_apply_no = obj['rows'][0]['refundApplyNo']
        print u'----------退款申请号:%s' % refund_apply_no

        return refund_apply_no
Ejemplo n.º 6
0
    def return_check_requests(cls, account='TIANJINOPERATION', operate_type='1', order_ids=[]):
        """
        退货审核
        :param account:
        :param operate_type: 1:批准,2:二次配送
        :param ids:
        """
        print u'*' * 20 + u'退货审核'

        obj = obj = demjson.decode(RainbowUtil.rainbow_get_return_request(order_nos=order_ids))
        n = 0
        while int(obj['total']) != len(order_ids) and n < tmsBase.retry_times:
            print 'expect %s, actual %s' % (len(order_ids), obj['total'])
            sleep(1)
            obj = demjson.decode(RainbowUtil.rainbow_get_return_request(order_nos=order_ids))
            n += 1

        print 'expect %s, actual %s' % (len(order_ids), obj['total'])

        if int(obj['total']) != len(order_ids):
            print 'expect %s, actual %s' % (len(order_ids), obj['total'])
            raise StandardError(u'>>>>>>>>>>期望待退货审核运单,与实际可退货运单不一致')

        ids = list()
        for item in obj['rows']:
            ids.append(item['id'])

        url = tmsBase.base_url + '/tms/sort/refundOrderCheckController/updateCheckResult.do?operation=' + operate_type
        resp = HttpRequest.post_request(TmsLogin.get_session(account), url, data={'ids[]': ids})
        check_operation_result(resp)
        return resp
Ejemplo n.º 7
0
    def express_confirm_distributor_return(cls, account='EXPRESS', order_ids=[]):
        """
        配送商退货
        :param account:
        :param order_ids:
        """
        print u'*' * 20 + u'配送商退货'
        obj = demjson.decode(ExpressUtil.express_get_distributor_return_info(account=account, order_ids=order_ids))
        n = 0
        while int(obj['total']) != len(order_ids) and n < tmsBase.retry_times:
            print 'expect %s, actual %s' % (len(order_ids), obj['total'])
            sleep(1)
            obj = demjson.decode(ExpressUtil.express_get_distributor_return_info(account=account, order_ids=order_ids))
            n += 1
        print 'expect %s, actual %s' % (len(order_ids), obj['total'])

        if int(obj['total']) != len(order_ids):
            print 'expect %s, actual %s' % (len(order_ids), obj['total'])
            raise StandardError(u'>>>>>>>>>>期望待退货运单,与实际可退货运单不一致')

        keys = ''
        for item in obj['rows']:
            keys += item['id']
            keys += ','

        url = tmsBase.base_url + '/tms/goods/expressReturnGoodsController/goReturnGoodsConfirmation.do?ids=' \
              + keys[:-1]

        resp = HttpRequest.get_request(TmsLogin.get_session(account), url)

        pattern_dis = re.compile(r'returnGoodsBatch" value="(.+)"/>')

        res_dis = pattern_dis.search(resp).groups()
        if len(res_dis) == 0:
            raise StandardError(u'未找到退货批次号')

        return_id = res_dis[0]
        print u'退货批次号 : ' + return_id

        print u'*' * 20 + u'确认退货'
        confirm_url = tmsBase.base_url + '/tms/goods/expressReturnGoodsController/confirm.do'
        confirm_resp = HttpRequest.post_request(TmsLogin.get_session(account), confirm_url,
                                                data={'ids': keys, 'returnGoodsBatch': return_id})
        print confirm_resp
        return return_id, confirm_resp
Ejemplo n.º 8
0
 def billing_deduct_refund(cls, account='ADMIN', billing_order_ids=''):
     """
     退款账单可低收款
     :param account:
     :param billing_order_ids:
     """
     print u'*' * 20 + u'退款账单可低收款'
     url = tmsBase.base_url + '/tms/bms/billingRefundBillController/changeDeductStatus.do'
     resp = HttpRequest.post_request(TmsLogin.get_session(account), url, data={'ids': billing_order_ids})
     print resp
Ejemplo n.º 9
0
 def return_confirm(cls, account='TIANJINSORTING', ids=[]):
     """
     退货签收确认
     :param account:
     :param ids:
     :return:
     """
     print u'*' * 20 + u'退货签收确认'
     url = tmsBase.base_url + '/tms/sort/refundOrderController/signConfirm.do'
     resp = HttpRequest.post_request(TmsLogin.get_session(account), url, data=ids)
     check_operation_result(resp)
     return resp
Ejemplo n.º 10
0
 def return_in_storage(cls, account='TIANJINSORTING', order_no=''):
     """
     退货入库
     :param account:
     :param order_no:
     :return:
     """
     print u'*' * 20 + u'退货入库'
     url = tmsBase.base_url + '/tms/sort/refundOrderController/inbound.do'
     resp = HttpRequest.post_request(TmsLogin.get_session(account), url, data={'orderNo': order_no})
     check_operation_result(resp)
     return resp
Ejemplo n.º 11
0
 def express_export_pre_return_order(cls, account='AUTOEXPRESS', order_ids=[]):
     """
     待上门退货单,导出PDF
     :param account:
     :param order_ids:
     """
     print u'*' * 20 + u'待上门退货单,导出PDF'
     obj = demjson.decode(ExpressUtil.express_get_return_order_info(account=account, order_ids=order_ids))
     ids = ''
     for item in obj['rows']:
         ids += item['id']
         ids += ','
     url = tmsBase.base_url + '/tms/goods/expressChangeReturnGoodsController/exportPDF.do?ids=' + ids
     resp = HttpRequest.get_request(TmsLogin.get_session(account), url)
Ejemplo n.º 12
0
    def delivery_handoff(cls, account='TIANJINSORTING', out_type='1', out_company='', begin_date='', end_date=''):
        """
        出库交接
        :param account:
        :param out_type: 1:出库到配送商,3:出库到城际运输商
        :param out_company:
        :param begin_date:
        :param end_date:
        :return:
        """
        print u'*' * 20 + u'获取出库交接单'
        search_data = dict()
        search_data['handoverBeginDate'] = begin_date
        search_data['handoverEndDate'] = end_date
        search_data['outCmp'] = out_company
        search_data['outType'] = out_type
        search_data['page'] = '1'
        search_data['rows'] = '10'

        search_url = tmsBase.base_url + '/tms/sort/sortDeliveryHandoverController/handoverList.do?field=handoverId,outType,transfer,subtransfer,citytransfer,isCostly,startTime,endTime,traderName,countOrder,countPackage,rfCountOrder,rfCountPackage,diffOrder,diffPackage,operator'
        search_resp = HttpRequest.post_request(TmsLogin.get_session(account), search_url, data=search_data)
        print search_resp

        obj = demjson.decode(search_resp)

        if len(obj['rows']) == 0:
            raise StandardError(u'没有符合要求的交接单')

        handover_id = obj['rows'][0]['handoverId']
        print 'handoverId: ' + handover_id

        print u'*' * 20 + u'出库交接'
        url = tmsBase.base_url + '/tms/sort/sortDeliveryHandoverController/toHandover.do'
        resp = HttpRequest.post_request(TmsLogin.get_session(account), url, data={'ids': handover_id})
        check_operation_result(resp)

        return handover_id, resp
Ejemplo n.º 13
0
 def express_get_distributor_return_info(cls, account='EXPRESS', order_ids=[]):
     """
     获取可配送商直退的运单信息
     :param account:
     :param order_ids:
     """
     print u'*' * 20 + u'获取可配送商直退的运单信息'
     ids = ''
     for order_id in order_ids:
         ids += order_id
         ids += '\n'
     search_url = tmsBase.base_url + '/tms/goods/expressReturnGoodsController/datagrid.do?field=id,waybillNumber,deliverGoodsStorage,deliverGoodsStorageName,returnGoodsAddress,deliveryDealer,deliveryDealerName,deliveryDealerSub,waybillNumberSource,waybillNumberSourceName,waybillType,waybillTypeName,waybillStatus,waybillStatusName,goodsMoney,shouldReturnMoney,deliverGoodsTime,distributionFeedbackTime,returnGoodsTime'
     search_resp = HttpRequest.post_request(TmsLogin.get_session(account), search_url, data={'waybillNumbers': ids})
     print search_resp
     return search_resp
Ejemplo n.º 14
0
 def express_get_return_order_info(cls, account='AUTOEXPRESS', order_ids=[]):
     """
     获取待打印上门退货单信息
     :param account:
     :param order_ids:
     """
     print u'*' * 20 + u'获取待打印上门退货单信息'
     ids = ''
     for order_id in order_ids:
         ids += order_id
         ids += '\n'
     search_url = tmsBase.base_url + '/tms/goods/expressChangeReturnGoodsController/datagrid.do?field=id,waybillNumber,previousWaybillNumber,waybillType,deliverGoodsTime,deliveryDealer,deliveryDealerSub,deliveryDealerSubName,deliverGoodsAddress,deliverGoodsStorage,addressee,addresseeMobile,countryId,countryName,provinceId,provinceName,cityId,cityName,districtId,districtName,streetId,streetName,detailAddress,returnGoods,returnGoodsCount,shouldReturnMoney,bestDeliverGoodsTime,operateUser,returnGoodsReason,customerMessage,returnGoodsPrice,returnGoodsTotalprice,remark,deliverGoodsAddressName,deliverGoodsStorageName'
     search_resp = HttpRequest.post_request(TmsLogin.get_session(account), search_url, data={'waybillNumbers': ids})
     print search_resp
     return search_resp
Ejemplo n.º 15
0
    def billing_get_refund_order_info(cls, account='ADMIN', refund_order_ids=[]):
        """
        账单退款审核页面查询
        :param account:
        :param refund_order_ids:
        """
        print u'*' * 20 + u'账单退款审核页面查询'
        billIds = ''
        for refund_order_id in refund_order_ids:
            billIds += refund_order_id
            billIds += '\n'
        url = tmsBase.base_url + '/tms/bms/billingRefundBillController/datagrid.do?field=id,distributionTrade,refundAmount,commonAmount,exchangeAmount,billDate,checkUser,checkDatetime,auditingUser,auditingDatetime,status,deductStatus,deductDatetime'
        resp = HttpRequest.post_request(TmsLogin.get_session(account), url, data={'billIds': billIds})

        return resp
Ejemplo n.º 16
0
 def delivery_delete_order_from_package(cls, account='TIANJINSORTING', order_no='', package_no=''):
     """
     从合包中删除运单
     :param account:
     :param order_no:
     :param package_no:
     :return:
     """
     print u'*' * 20 + u'从合包中删除运单'
     url = tmsBase.base_url + '/tms/sort/sortWaybillPackageController/delPackageOrderTmp.do?orderNo={order_no}&packageNo={package_no}' \
         .replace('{order_no}', order_no) \
         .replace('{package_no', package_no)
     resp = HttpRequest.post_request(TmsLogin.get_session(account), url)
     check_operation_result(resp)
     return resp
Ejemplo n.º 17
0
 def get_distributor_id(cls, account='ADMIN', distributor_code='', distributor_short_name=''):
     print u'*' * 20 + u'获取配送商id'
     url = tmsBase.base_url + '/tms/base/baseDistributionTraderController.do?datagrid&field=id,supportService,companyNo,companyShortName,companyName,provinceTxt,cityTxt,areaTxt,streetTxt,companyAddress,contactPerson,contactNumber,serviceTel,website,email,supportService4,supportService5,supportService6,supportService1,supportService2,supportService3,alicode,comment,status,chinesename,updateTime,updateTime_begin,updateTime_end,'
     resp = HttpRequest.post_request(TmsLogin.get_session(account), url,
                                     data={'companyNo': distributor_code, 'companyShortName': distributor_short_name,
                                           'page': 1, 'rows': 10})
     print resp
     obj = demjson.decode(resp)
     if obj['total'] == 0:
         print u'*' * 20 + u'无符合条件的配送商'
         return 0
     else:
         distributor_id = obj['rows'][0]['id']
         print u'distributor_id: ' + distributor_id
         return distributor_id
Ejemplo n.º 18
0
 def delivery_confirm_package(cls, account='TIANJINSORTING', package_no='', package_type=1, weight=10):
     """
     确认合包
     :param account:
     :param package_no: 合包号
     :param package_type: 合包类型,1:中转合包,2:配送合包,3:退货合包
     :param weight: 重量
     :return:
     """
     print '*' * 20 + u'确认合包'
     url = tmsBase.base_url + '/tms/sort/sortWaybillPackageController/packageOrder.do'
     data = {'packageNo': package_no, 'packageType': package_type, 'weight': weight}
     resp = HttpRequest.post_request(TmsLogin.get_session(account), url, data=data)
     check_operation_result(resp)
     return resp
Ejemplo n.º 19
0
    def delivery_in_storage(cls, account='TIANJINSORTING', order_id=''):
        """
        运单入库
        :param account:
        :param order_id:
        :return:
        """
        print u'*' * 20 + u'运单入库'
        url = tmsBase.base_url + '/tms/sort/sortInStorageController/inStorage.do'

        resp = HttpRequest.post_request(TmsLogin.get_session(account),
                                        url,
                                        data={'orderNo': order_id})
        print resp
        return resp
Ejemplo n.º 20
0
 def rainbow_get_order_info(cls, account='ADMIN', order_ids=[]):
     """
     查询运单信息
     :param account:
     :param order_id:
     :return:
     """
     print u'*' * 20 + u'在Rainbow查询运单信息'
     ids = ''
     for order_id in order_ids:
         ids += order_id
         ids += '\n'
     url = tmsBase.base_url + '/tms/sort/sortIntegratedQueryController/datagrid.do?field=id,orderId,extOrderId,expressId,sortCenterIdName,warehouseIdName,currentStatusName,creationDate,putStorageTime,deliveryDate,transferPutStorageTime,transferDeliveryDate,distributionFeedbackTime,signTime,expectedDtStart,expectedDtEnd,toProvinceIdName,toCityIdName,toDivisionIdName,toStateIdName,toAddress,amount,dueAmount,quantity,weight,volume,chargedWeight,customerMessage,orderSourceName,orderSourcePlatformName,distributionModeName,shopName,orderDate,differenceStatusName,packSpec,bestArriveDate,payType,payTypeName,interceptStatus,mailPackId'
     resp = HttpRequest.post_request(TmsLogin.get_session(account), url, data={'waybillNumbers': ids})
     print resp
     return resp
Ejemplo n.º 21
0
    def rainbow_get_refund_apply_info(cls, account='ADMIN', order_ids=[]):
        """
        查询退款申请
        :param account:
        :param order_ids:
        :return:
        """
        print u'*' * 20 + u'查询退款申请'
        ids = ''
        for order_id in order_ids:
            ids += order_id
            ids += '\n'
        url = tmsBase.base_url + '/tms/sort/refundOrderController/dgRefundApply.do?field=id,orderNo,refundBatchNo,refundApplyNo,refundStatus,sortingCenter,refundWarehouse,orderType,orderSourceType,status,disTrader,subDisTrader,businessId,quantity,weight,amount,dueAmount,realAmount,expressNo,refundTime,shipTime,refundTime_begin,refundTime_end,refundInboundTime,refundInboundTime_begin,refundInboundTime_end,refundInboundTip,refundInboundBy,refundOutboundTime,refundOutboundTime_begin,refundOutboundTime_end,refundOutboundBy,refundDeliveryNo,refundDeliveryBy,refundSignTime,refundSignTime_begin,refundSignTime_end,toSortingCenter,'
        resp = HttpRequest.post_request(TmsLogin.get_session(account), url, data={'orderNos': ids})

        return resp
Ejemplo n.º 22
0
    def delivery_create_package(cls, account='TIANJINSORTING', package_no='', package_type=1):
        """
        创建合包
        :param account:
        :param package_no:合包号
        :param package_type: 合包类型,1:中转合包,2:配送合包,3:退货合包
        """
        print u'*' * 20 + u'创建合包'
        url = tmsBase.base_url + '/tms/sort/sortWaybillPackageController/checkpkgNo.do'
        data = dict()
        data['packageNo'] = package_no
        data['packageType'] = package_type

        resp = HttpRequest.post_request(TmsLogin.get_session(account), url, data=data)
        check_operation_result(resp)
        return resp
Ejemplo n.º 23
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
Ejemplo n.º 24
0
 def get_subdistributor_id(cls, account='ADMIN', subdistributor_short_name=''):
     print u'-' * 20 + u'获取配送商分公司及总公司id'
     url = tmsBase.base_url + '/tms/base/baseDistributionTraderSubController.do?datagrid&field=id,parentId,parentName,no,companyShortName,provinceTxt,cityTxt,areaTxt,streetTxt,companyAddress,contactPerson,contactPhone,email,comment,status,chinesename,updateTime,updateTime_begin,updateTime_end,'
     resp = HttpRequest.post_request(TmsLogin.get_session(account), url,
                                     data={'companyShortName': subdistributor_short_name, 'page': 1, 'rows': 10})
     print resp
     obj = demjson.decode(resp)
     if obj['total'] == 0:
         print u'-' * 20 + u'无符合条件的配送商分公司'
         return 0
     else:
         distributor_id = obj['rows'][0]['id']
         parent_distributor_id = obj['rows'][0]['parentId']
         print 'sub_distributor_id: ' + distributor_id
         print 'parent_distributor_id: ' + parent_distributor_id
         return parent_distributor_id, distributor_id
Ejemplo n.º 25
0
    def express_get_order_info(cls, account='AUTOEXPRESS', order_ids=[]):
        """
        查询运单信息
        :param account:
        :param order_ids:
        """
        print u'*' * 20 + u'在Express查询运单信息'
        ids = ''
        for order_id in order_ids:
            ids += order_id
            ids += '\n'


        url = tmsBase.base_url + '/tms/waybill/expressWayBillController/datagrid.do?field=id,waybillNumber,deliverGoodsAddressName,deliverGoodsStorageName,waybillStatusName,deliverGoodsTime,putStorageTime,exprotStorageTime,distributionFeedbackTime,signTime,expectArrivalStarttime,expectArrivalEndtime,distributionUser,provinceName,cityName,districtName,streetName,detailAddress,goodsMoney,receiveMoney,caseNumbers,weight,volumeWeight,chargedWeight,customerMessage,waybillNumberSourceName,platformSourceName,distributionTypeName,customerBuyTime,differenceStatusName,packStandard,bestDeliverGoodsTime,payTypeName,interceptStatus,postPackNumber,expressNumber,payTypeName'
        resp = HttpRequest.post_request(TmsLogin.get_session(account), url, data={'waybillNumbers': ids})
        print resp
        return resp
Ejemplo n.º 26
0
    def rainbow_get_return_request(cls, account='TIANJINOPERATION', order_nos=''):
        """
        查询退货申请
        :param account:
        :param order_nos:
        :return:
        """
        print u'*' * 20 + u'查询退货申请'
        url = tmsBase.base_url + '/tms/sort/refundOrderCheckController/datagrid.do?field=id,orderNo,deliveryWarehouse,refundAddress,disTrader,orderSourceType,orderType,feedbackTime,feedbackTime_begin,feedbackTime_end,failReason,amount,amount_begin,amount_end,dueAmount,dueAmount_begin,dueAmount_end,paidAmount,paidAmount_begin,paidAmount_end,refundType,shippedTime,shippedTime_begin,shippedTime_end,checkedResult,checkedTime,checkedTime_begin,checkedTime_end,checkedBy,'
        data = dict()
        ids = ''
        for order_no in order_nos:
            ids += order_no
            ids += '\n'
        data['orderNos'] = ids

        resp = HttpRequest.post_request(TmsLogin.get_session(account), url, data=data)
        # print resp
        return resp
Ejemplo n.º 27
0
    def delivery_weight(cls, account='TIANJINSORTING', order_no='', weight_type=1, weight=10):
        """
        运单称重
        :param account:
        :param order_no:运单号,或运单号
        :param weight_type: 1:运单号,2:订单号
        :param weight:重量,默认10
        :return:
        """
        print u'*' * 20 + u'运单称重'
        url = tmsBase.base_url + '/tms/sort/sortGetWeightController/setWeight.do'
        data = dict()
        data['orderNo'] = order_no
        data['weight'] = weight
        data['weightType'] = weight_type

        resp = HttpRequest.post_request(TmsLogin.get_session(account), url, data=data)
        check_operation_result(resp)
        return resp
Ejemplo n.º 28
0
    def billing_get_pre_return_confirmed(cls, account='ADMIN', refund_batch_nos=[], refund_apply_nos=[]):
        """
        退货确认页面查询
        :param account:
        :param refund_apply_nos:
        """
        print u'*' * 20 + u'退货确认页面查询'
        refund_batch_ids = ''
        for refund_batch_id in refund_batch_nos:
            refund_batch_ids += refund_batch_id
            refund_batch_ids += '\n'
        refund_apply_ids = ''
        for refund_apply_id in refund_apply_nos:
            refund_apply_ids += refund_apply_id
            refund_apply_ids += '\n'
        url = tmsBase.base_url + '/tms/bms/billingRefundConfirmController/datagrid.do?field=distributionTrade,distributionTradeName,orderId,refundBatchNo,refundApplyNo,refundAmount,orderType,orderStatus'
        resp = HttpRequest.post_request(TmsLogin.get_session(account), url,
                                        data={'refundApplyNo': refund_apply_ids, 'refundBatchNo': refund_batch_ids})

        return resp
Ejemplo n.º 29
0
    def return_out_storage(cls, account='TIANJINSORTING', order_no='', business_id='', to_sorting_center=''):
        """
        退货出库
        :param account:
        :param order_no:
        :param business_id:
        :param to_sorting_center:
        :return:
        """
        print u'*' * 20 + u'退货出库'
        url = tmsBase.base_url + '/tms/sort/refundOrderController/outbound.do'
        data = dict()
        data['orderNo'] = order_no
        data['businessId'] = business_id
        data['toSortingCenter'] = to_sorting_center
        if business_id == '':
            data['exFlag'] = '2'
        if to_sorting_center == '':
            data['exFlag'] = '1'

        resp = HttpRequest.post_request(TmsLogin.get_session(account), url, data=data)
        check_operation_result(resp)
        return resp
Ejemplo n.º 30
0
    def express_confirm_direct_return(cls, account='AUTOEXPRESS', order_ids=[], distributor_short_name=''):
        """
        快递直退
        :param account:
        :param order_ids:
        :param distributor_short_name:
        :return:
        """
        print u'*' * 20 + u'快递直退'
        ids = ''
        for order_id in order_ids:
            ids += order_id
            ids += '\n'

        obj = demjson.decode(ExpressUtil.express_get_direct_return_info(account=account, order_ids=order_ids))

        if int(obj['total']) != len(order_ids):
            raise StandardError(u'>>>>>>>>>>有错误的运单号')

        keys = ''
        for item in obj['rows']:
            keys += item['id']
            keys += ','

        url = tmsBase.base_url + '/tms/goods/expressReturnStraightGoodsController/returnStraight.do'

        data = dict()
        data['deliveryDealer'] = BaseInfo.get_distributor(short_name=distributor_short_name)
        data['ids'] = ids
        data['returnGoodsExpnumber'] = datetime.now().strftime('%y%m%d%H%M%S')

        resp = HttpRequest.post_request(TmsLogin.get_session(account), url, data=data)
        print u'退货快递单号:' + data['returnGoodsExpnumber']
        print resp

        return data['returnGoodsExpnumber'], resp