Beispiel #1
0
    def get(self):
        import ods.dhui.dhui_product_template as dpt
        import ods.dhui.dhui_product_supplierinfo as dps
        import ods.dhui.dhui_stock_warehouse_orderpoint as dpwo

        import ods.dhui.dhui_order as do
        import ods.dhui.dhui_order_line as dol

        import ods.clients.mongodb_client as mongodb_client

        result = utils.init_response_data()
        try:
            partner_order_deliver_details = utils.manual_create_invoice(
                dpt=dpt,
                dps=dps,
                dpwo=dpwo,
                do=do,
                dol=dol,
                mongodb_client=mongodb_client)
        except Exception, e:
            result = utils.reset_response_data(status.Status.ERROR,
                                               error_info=str(e))
            self.write(result)
            self.finish()
            return
Beispiel #2
0
    def get(self,*args, **kwargs):
        result = utils.init_response_data()
        query_params = {}

        try:
            partner_id = self.get_argument("partner_id",None)
            if not partner_id:
                result = utils.reset_response_data(status.Status.PARMAS_ERROR)
                self.finish(result)
                return

            _start_time = self.get_argument("start_time","")
            _end_time = self.get_argument("end_time","")
            if _start_time and _end_time :
                start_time = _start_time.split(" ")[0] + " " + "00:00:00"
                end_time = _end_time.split(" ")[0] + " " + "59:59:59"
                query_params = {
                    "partner_id": partner_id,
                    "create_time": {"$gte": start_time, "$lte": end_time},
                }
            else :
                query_params = {
                    "partner_id": partner_id,
                }

            _shipping_status = self.get_argument("shipping_status",None)
            if _shipping_status:
                shipping_status = [int(_shipping_status)]
            else :
                shipping_status = [1,10,20,30]
        except Exception, e:
            result = utils.reset_response_data(status.Status.PARMAS_ERROR, error_info=str(e))
            self.finish(result)
            return
Beispiel #3
0
 def post(self):
     result = utils.init_response_data()
     try:
         deliver_id = self.get_argument("deliver_id")
         deliver_status = self.get_argument("deliver_status")
     except Exception, e:
         result = utils.reset_response_data(status.Status.PARMAS_ERROR, error_info=str(e))
Beispiel #4
0
 def get(self):
     result = utils.init_response_data()
     result["data"] = []
     files_coll = mongodb_client.get_coll("files")
     categ_list = files_coll.find({},{"categ":1})
     for categ_obj in categ_list:
         result["data"].append(categ_obj["categ"])
     self.finish(result)
Beispiel #5
0
 def get(self):
     result = utils.init_response_data()
     try:
         user_id = self.get_argument('user_id','')
     except Exception, e:
         result = utils.reset_response_data(status.Status.PARMAS_ERROR,str(e))
         self.finish(result)
         return
Beispiel #6
0
 def get(self,*args,**options):
     result = utils.init_response_data()
     try:
         user_id = self.get_argument("user_id")
     except Exception, e:
         result = utils.reset_response_data(status.Status.PARMAS_ERROR)
         self.finish(result)
         return
Beispiel #7
0
 def post(self):
     result = utils.init_response_data()
     try:
         deliver_id = self.get_argument("deliver_id")
         deliver_status = self.get_argument("deliver_status")
     except Exception, e:
         result = utils.reset_response_data(status.Status.PARMAS_ERROR,
                                            error_info=str(e))
Beispiel #8
0
 def get(self,*args,**options):
     result = utils.init_response_data()
     try:
         categ = self.get_argument("categ","")
     except Exception, e:
         error_info = traceback.format_exc()
         result = utils.reset_response_data(status.Status.PARMAS_ERROR,error_info)
         self.finish(result)
         return
Beispiel #9
0
 def post(self, *args, **kwargs):
     result = utils.init_response_data()
     try:
         order_id = self.get_argument("order_id")
         shipping_status = self.get_argument("shipping_status")
     except Exception, e:
         result = utils.reset_response_data(status.Status.PARMAS_ERROR)
         self.finish(result)
         return
Beispiel #10
0
 def _param_except_handler(self,request,params) :
     result = utils.init_response_data()
     try :
         result =   func(self,request,params)
     except Exception , e :
         result['success'] = status.Status.ERROR
         result['return_code'] = status.Status().getReason(result['success'])
         ErrorLogger.error( result['return_code'] + " 错误信息 : %s"%e)
         return result
Beispiel #11
0
 def post(self, *args, **kwargs):
     result = utils.init_response_data()
     try :
         order_id = self.get_argument("order_id")
         shipping_status = self.get_argument("shipping_status")
     except Exception ,e :
         result = utils.reset_response_data(status.Status.PARMAS_ERROR)
         self.finish(result)
         return
Beispiel #12
0
def create_dhui_invoice(request):
    result = utils.init_response_data()
    try :
        deliver_details = utils.manual_create_invoice(dpt=dpt, dps=dps, dpwo=dpwo, do=do, dol=dol,mongodb_client=mongodb_client)
    except Exception,e:
        result["success"] = status.Status.ERROR
        trace_info = ""
        result["return_code"] = status.Status().getReason(result["success"] + str(e))
        return result
Beispiel #13
0
    def get(self):
        result = utils.init_response_data()

        try :
            sku = self.get_argument("sku")
        except Exception ,e :
            result = utils.reset_response_data(status.Status.PARMAS_ERROR, error_info=str(e))
            self.write(result)
            return
Beispiel #14
0
 def __deliver(self,*args,**options):
     result = utils.init_response_data()
     order_partner_deliver_detail = args[0]
     create_time = order_partner_deliver_detail["create_time"]
     start_time , end_time = utils.get_date_time(create_time)
     try:
         # 更新odoo中订单状态
         do.update_sale_order_status(start_time, end_time)
     except Exception, e:
         result = utils.reset_response_data(status.Status.ERROR, error_info=str(e))
Beispiel #15
0
    def get(self):
        result = utils.init_response_data()

        try:
            sku = self.get_argument("sku")
        except Exception, e:
            result = utils.reset_response_data(status.Status.PARMAS_ERROR,
                                               error_info=str(e))
            self.write(result)
            return
Beispiel #16
0
 def post(self):
     result = utils.init_response_data()
     try:
         categ = self.get_argument("categ","")
         name = self.get_argument("name","")
         url = self.get_argument("url","")
     except Exception, e:
         error_info = traceback.format_exc()
         result = utils.reset_response_data(status.Status.PARMAS_ERROR,error_info)
         self.finish(result)
         return
Beispiel #17
0
 def __deliver(self, *args, **options):
     result = utils.init_response_data()
     order_partner_deliver_detail = args[0]
     create_time = order_partner_deliver_detail["create_time"]
     start_time, end_time = utils.get_date_time(create_time)
     try:
         # 更新odoo中订单状态
         do.update_sale_order_status(start_time, end_time)
     except Exception, e:
         result = utils.reset_response_data(status.Status.ERROR,
                                            error_info=str(e))
Beispiel #18
0
 def get(self):
     result = utils.init_response_data()
     result["data"] = []
     link_coll = mongodb_client.get_coll("links")
     links = link_coll.find()
     for link in links :
         result["data"].append(dict(
             name = link["name"],
             categ = link["categ"],
             url = link["url"],
         ))
     self.finish(result)
Beispiel #19
0
 def get(self):
     result = utils.init_response_data()
     try:
         start_time = self.get_argument("start_time")
         end_time = self.get_argument("end_time")
         start_time = start_time.split(" ")[0] + " " + "00:00:00"
         end_time = end_time.split(" ")[0] + " " + "59:59:59"
         partner_id = self.get_argument("partner_id")
     except Exception, e:
         result = utils.reset_response_data(status.Status.PARMAS_ERROR, error_info=str(e))
         self.write(result)
         return
Beispiel #20
0
def api_router(request) :
    try:
        result = utils.init_response_data()
        result["success"] = status.Status.ERROR
        result["return_code"] = status.Status().getReason(result["success"])
        action,data = checkRequestMethod(request)
        data = getattr(SERVER_API_ROUTER,"_API_ROUTER__%s"%action,"default")(request,data)
    except Exception,e:
        ErrorLogger.error(str(e))
        trace_info = utils.get_trace_info()
        result["return_code"] = trace_info
        return HttpResponse(json.dumps(result),content_type="application/json")
Beispiel #21
0
 def get(self):
     result = utils.init_response_data()
     try:
         start_time = self.get_argument("start_time")
         end_time = self.get_argument("end_time")
         start_time = start_time.split(" ")[0] + " " + "00:00:00"
         end_time = end_time.split(" ")[0] + " " + "59:59:59"
         partner_id = self.get_argument("partner_id")
     except Exception, e:
         result = utils.reset_response_data(status.Status.PARMAS_ERROR,
                                            error_info=str(e))
         self.write(result)
         return
Beispiel #22
0
def create_dhui_invoice(request):
    result = utils.init_response_data()
    try:
        deliver_details = utils.manual_create_invoice(
            dpt=dpt,
            dps=dps,
            dpwo=dpwo,
            do=do,
            dol=dol,
            mongodb_client=mongodb_client)
    except Exception, e:
        result["success"] = status.Status.ERROR
        trace_info = ""
        result["return_code"] = status.Status().getReason(result["success"] +
                                                          str(e))
        return result
Beispiel #23
0
    def get(self):
        import ods.dhui.dhui_product_template as dpt
        import ods.dhui.dhui_product_supplierinfo as dps
        import ods.dhui.dhui_stock_warehouse_orderpoint as dpwo

        import ods.dhui.dhui_order as do
        import ods.dhui.dhui_order_line as dol

        import ods.clients.mongodb_client as mongodb_client

        result = utils.init_response_data()
        try:
            partner_order_deliver_details = utils.manual_create_invoice(dpt=dpt, dps=dps, dpwo=dpwo, do=do, dol=dol,
                                                                        mongodb_client=mongodb_client)
        except Exception, e:
            result = utils.reset_response_data(status.Status.ERROR, error_info=str(e))
            self.write(result)
            self.finish()
            return
Beispiel #24
0
 def post(self):
     result = utils.init_response_data()
     client = AsyncHTTPClient()
     query_params = dict(action="create_dhui_invoice", data={})
     data = urllib.urlencode(query_params)
     response = yield tornado.gen.Task(
         client.fetch,
         settings.ODS_ADDRESS + settings.DHUI_URL_PREFIX + data)
     try:
         data = json.loads(response.body)
         print data
         if not data["success"] == status.Status.OK:
             self.write(data)
             self.finish()
     except Exception, e:
         trace_info = utils.get_trace_info()
         result = utils.reset_response_data(status.Status.ERROR,
                                            error_info=str(trace_info))
         self.write(result)
         self.finish()
Beispiel #25
0
 def post(self):
     result = utils.init_response_data()
     client = AsyncHTTPClient()
     query_params = dict(
         action = "create_dhui_invoice",
         data = {}
     )
     data = urllib.urlencode(query_params)
     response = yield tornado.gen.Task(client.fetch,
       settings.ODS_ADDRESS + settings.DHUI_URL_PREFIX + data)
     try :
         data = json.loads(response.body)
         print data
         if not data["success"] == status.Status.OK:
             self.write(data)
             self.finish()
     except Exception,e :
         trace_info = utils.get_trace_info()
         result = utils.reset_response_data(status.Status.ERROR, error_info=str(trace_info))
         self.write(result)
         self.finish()
Beispiel #26
0
    def get(self, *args, **kwargs):
        result = utils.init_response_data()
        query_params = {}

        try:
            partner_id = self.get_argument("partner_id", None)
            if not partner_id:
                result = utils.reset_response_data(status.Status.PARMAS_ERROR)
                self.finish(result)
                return

            _start_time = self.get_argument("start_time", "")
            _end_time = self.get_argument("end_time", "")
            if _start_time and _end_time:
                start_time = _start_time.split(" ")[0] + " " + "00:00:00"
                end_time = _end_time.split(" ")[0] + " " + "59:59:59"
                query_params = {
                    "partner_id": partner_id,
                    "create_time": {
                        "$gte": start_time,
                        "$lte": end_time
                    },
                }
            else:
                query_params = {
                    "partner_id": partner_id,
                }

            _shipping_status = self.get_argument("shipping_status", None)
            if _shipping_status:
                shipping_status = [int(_shipping_status)]
            else:
                shipping_status = [1, 10, 20, 30]
        except Exception, e:
            result = utils.reset_response_data(status.Status.PARMAS_ERROR,
                                               error_info=str(e))
            self.finish(result)
            return