Ejemplo n.º 1
0
 def post(self, *args, **kwargs):
     post_data = {}
     new = {}
     for key in self.request.arguments:
         post_data[key] = self.get_argument(key)
     if (Dal_Logistics().selectLogistics(post_data['id']) == None):
         respon = {'errorCode': updateLogistics_error['LogisticsInvaild']}
     else:
         staff = Dal_Staff().selectStaff(post_data['receiverId'])
         if (staff == None):
             respon = {
                 'errorCode': updateLogistics_error['receiverInvaild']
             }
         else:
             if (staff['type'] != '司机'):
                 respon = {
                     'errorCode': updateLogistics_error['illegalAccess']
                 }
             else:
                 if post_data.has_key('receiverId') != False and post_data[
                         'receiverId'] != '':
                     new['receiverId'] = post_data['receiverId']
                 if post_data.has_key('endPlace') != False and post_data[
                         'endPlace'] != '':
                     new['endPlace'] = post_data['endPlace']
                 if (Dal_Logistics().updateLogistics(
                         post_data["id"], **new) == 1):
                     respon = {
                         'errorCode': updateLogistics_error['success']
                     }
                 else:
                     respon = {'errorCode': updateLogistics_error['failed']}
     respon_json = json.dumps(respon)
     self.write(respon_json)
Ejemplo n.º 2
0
    def post(self, *args, **kwargs):
        post_data = {}
        new = {}
        for key in self.request.arguments:
            post_data[key] = self.get_argument(key)
        l_id = post_data['id']
        l_res = Dal_Logistics().selectLogistics(l_id)
        if (l_res == None):
            respon = {'errorCode': "1"}  #未知物流
        else:
            if post_data.has_key('comfirm') == False:
                new['comfirm'] = "Y"
            if (Dal_Logistics().updateLogistics(post_data["id"], **new) == 1):
                respon = {'errorCode': updateManifest_error['success']}

                #入库操作

                pname = Dal_Batch().selectBatch(l_res['amount'])
                nowtime = Utils().dbTimeCreate()
                b_res = Dal_Batch().selectBatch(l_res['amount'])
                ware = Warehouse(id=None,
                                 p_name=pname['p_name'],
                                 p_id=l_res['amount'],
                                 inTime=str(nowtime),
                                 outTime=None,
                                 w_id=l_res['endPlace'],
                                 in_c_id=l_res['startPlace'],
                                 out_c_id=None,
                                 stock=b_res['amount'])
                new_ware = Dal_Warehouse().addWarehouse(ware)
            else:
                respon = {'errorCode': updateManifest_error['failed']}
        respon_json = json.dumps(respon)
        self.write(respon_json)
Ejemplo n.º 3
0
def initCache():
    Dal_user().initCache()
    Dal_Company().initCache()
    Dal_Staff().initCache()
    Dal_Warehouse().initCache()
    Dal_Logistics().initCache()
    Dal_Batch().initCache()
    Dal_Manifest().initCache()
Ejemplo n.º 4
0
    def post(self):
        post_data = {}
        for key in self.request.arguments:
            post_data[key] = self.get_argument(key)

        encode = post_data['code']
        # 解密
        # code = decrypt(encode, '1938762450')
        c_code = int(encode[3:7])  #截取公司id
        b_code = int(encode[7:])  #截取批次id

        c_res = Dal_Company().selectCompany(c_code)  #获取公司信息
        b_res = Dal_Batch().selectBatch(b_code)  #获取批次信息

        prod = {
            'prodtime': b_res['prodtime'],
            'p_name': b_res['p_name'],
            'exptime': b_res['exptime'],
            'intro': b_res['intro'],
            'pro_img': b_res['pro_img'],
            'br_img': b_res['br_img'],
        }
        #获取订单信息
        man_id = b_res['man_id']
        m_res = Dal_Manifest().selectManifest(man_id)
        s_res = Dal_Staff().selectStaff(m_res['originatorId'])
        maniefest = {'staff': s_res['name']}
        #获取物流信息
        log_id = b_res['log_id']
        l_res = Dal_Logistics().selectLogistics(log_id)
        d_name = Dal_Staff().selectStaff(l_res['driverId'])
        logistic = {
            'd_name': d_name['name'],
            'plateNum': l_res['plateNum'],
            'start_p': Dal_Company().selectC_nameByID(l_res['startPlace']),
            'end_p': Dal_Company().selectC_nameByID(l_res['endPlace']),
            'time': l_res['time']
        }
        #获取公司信息
        company = {
            'name': c_res['name'],
            'address': c_res['address'],
            'profile': c_res['profile'],
            'tel': c_res['tel'],
            'pcPath': c_res['pcPath'],
            'blPath': c_res['blPath'],
            'scPath': c_res['scPath'],
        }

        data = {
            'errorcode': 0,
            'prod': prod,
            "maniefest": maniefest,
            "logistic": logistic,
            "company": company
        }
        self.write(json.dumps(data))
Ejemplo n.º 5
0
 def post(self, *args, **kwargs):
     post_data = {}
     for key in self.request.arguments:
         post_data[key] = self.get_argument(key)
     if (Dal_Logistics().deleteLogistics(post_data['id']) == False):
         respon = {'errorCode': deleteLogistics_error['logisticsInvaild']}
     else:
         respon = {'errorCode': deleteLogistics_error['success']}
     respon_json = json.dumps(respon)
     self.write(respon_json)
Ejemplo n.º 6
0
 def post(self, *args, **kwargs):
     post_data = {}
     new = {}
     for key in self.request.arguments:
         post_data[key] = self.get_argument(key)
     company = Dal_Company().selectCompanyByN(post_data['companyName'])
     if (company == None):
         respon = {'errorCode': addLogistics_error['companyInvaild']}
     else:
         nextcompany = Dal_Company().selectCompanyByN(
             post_data['nextCompanyName'])
         if (nextcompany == None):
             respon = {'errorCode': addLogistics_error['companyInvaild']}
         else:
             driver = Dal_Staff().selectStaffByName(post_data['name'])
             if (driver == None):
                 respon = {'errorCode': addLogistics_error['driverInvaild']}
             else:
                 batch = Dal_Batch().selectBatch(post_data['amount'])
                 if (batch == None):
                     respon = {
                         'errorCode': addLogistics_error['batchInvaild']
                     }
                 else:
                     nowtime = Utils().dbTimeCreate()
                     newLogistics = Logistics(
                         id=None,
                         driverId=driver['id'],
                         plateNum=post_data['plateNum'],
                         startPlace=company['id'],
                         endPlace=nextcompany['id'],
                         time=str(nowtime),
                         comfirm='N',
                         amount=post_data['amount'])
                     id = Dal_Logistics().addLogistics(newLogistics)
                     if id == False:
                         respon = {
                             'errorCode': addLogistics_error['failed']
                         }
                     else:
                         new['log_id'] = id
                         batch_id = str(post_data["amount"])
                         if (Dal_Batch().updateBatch(batch_id, **new) == 1):
                             respon = {
                                 'errorCode': addLogistics_error['success']
                             }
                             c_id = str(company['id'])
                             c_id = str(c_id.zfill(4))
                             batch_id = str(batch_id.zfill(5))
                             text = "690" + c_id + batch_id
                             self.make_qrcode(text, batch_id)
                             self.make_brcode(text, batch_id)
     respon_json = json.dumps(respon)
     self.write(respon_json)
Ejemplo n.º 7
0
 def post(self):
     post_data = {}
     for key in self.request.arguments:
         post_data[key] = self.get_argument(key)
     logistics = Dal_Logistics().selectMyLogP(post_data["id"])
     if logistics == None:
         respon = {'errorCode': selectLogistics_error['logisticsInvaild']}
     else:
         respon = {
             'errorCode': selectLogistics_error['success'],
             'result': logistics
         }
     respon_json = json.dumps(respon)
     self.write(respon_json)
Ejemplo n.º 8
0
 def post(self, *args, **kwargs):
     respon={}
     post_data = {}
     for key in self.request.arguments:
         post_data[key] = self.get_argument(key)
     company = Dal_Company().selectCompany(post_data['id'])
     if(company==None):
         respon = {'errorCode': selectLogistics_error['companyInvaild']}
     else:
         page=1 if (int(post_data["page"]) <= 0) else int(post_data["page"])
         a = Dal_Logistics().selectAllLogistics(page,str(post_data['type']),int(post_data['id']))
         logistics = a
         total=logistics['total']
         logistics.pop('total')
         for k,v in logistics.items():
             driver=Dal_Staff().selectStaff(v['driverId'])
             company=Dal_Company().selectCompany(v['startPlace'])
             nextCompany=Dal_Company().selectCompany(v['endPlace'])
             amount=v['amount']
             num = amount.count(':')
             amount_list=amount.split(':')
             amount=''
             while num>=0:
                 batch=Dal_Batch().selectBatch(amount_list[num])
                 if batch==None:
                     respon = {'errorCode': selectLogistics_error['batchInvaild']}
                 else:
                     amount+=batch['p_name']+','
                 num-=1
             v['amount']=amount[0:-1]
             v['driverId']=driver['name']
             v['startPlace']=company['name']
             v['endPlace']=nextCompany['name']
         if(logistics=={} and respon!={}):
             respon = {'errorCode': selectLogistics_error['logisticsInvaild']}
         else:
             respon = {'errorCode': selectLogistics_error['success'],'total':total,'result':logistics}
     respon_json = json.dumps(respon)
     self.write(respon_json)