def post(self, request, *args, **kwargs): vip_id = Users.objects.filter(appid=request.user.appid, developer=1, is_delete=0).first().vip vip_check = VipCheck.VipCheck(vip_id) if vip_check == "N": return Response(FBMsg.wms_vip()) elif vip_check == "Y": data = DataSolve.datasolve(request) try: if data['code'] == "1031": return Response(FBMsg.err_bad()) except: if ListModel.objects.filter(appid=request.user.appid, name=str(data['name']), is_delete=0).exists(): ret = FBMsg.wms_same() ret['data'] = data return Response(ret) else: if 0 < int(data['customer_lv']) < 4: ListModel.objects.create( appid=request.user.appid, name=str(data['name']), province=str(data['province']), city=str(data['city']), district=str(data['district']), address=str(data['address']), manager=str(data['manager']), mobile=str(data['mobile']), customer_lv=int(data['customer_lv']), t_code=Md5.md5(str(data['name']))) else: ListModel.objects.create( appid=request.user.appid, name=str(data['name']), province=str(data['province']), city=str(data['city']), district=str(data['district']), address=str(data['address']), manager=str(data['manager']), mobile=str(data['mobile']), t_code=Md5.md5(str(data['name']))) ip = request.META.get( 'HTTP_X_FORWARDED_FOR') if request.META.get( 'HTTP_X_FORWARDED_FOR') else request.META.get( 'REMOTE_ADDR') ret = FBMsg.wms_ret() ret['ip'] = ip ret['data'] = data return Response(ret) else: return Response(FBMsg.wms_vip())
def post(self, request, *args, **kwargs): vip_id = Users.objects.filter(appid=request.user.appid, developer=1, is_delete=0).first().vip vip_check = VipCheck.VipCheck(vip_id) if vip_check == "N": return Response(FBMsg.wms_vip()) elif vip_check == "Y": data = DataSolve.datasolve(request) try: if data['code'] == "1031": return Response(FBMsg.err_bad()) except: if ListModel.objects.filter(appid=request.user.appid, name=str(data['name']), is_delete=0).exists(): ret = FBMsg.wms_same() ret['data'] = data return Response(ret) else: create_name = Users.objects.filter(openid=request.auth, appid=request.user.appid, is_delete=0).first().name ListModel.objects.create(appid=request.user.appid, name=str(data['name']), create_name=create_name, t_code=Md5.md5(str(data['name']))) ip = request.META.get('HTTP_X_FORWARDED_FOR') if request.META.get( 'HTTP_X_FORWARDED_FOR') else request.META.get('REMOTE_ADDR') ret = FBMsg.wms_ret() ret['ip'] = ip ret['data'] = data return Response(ret) else: return Response(FBMsg.wms_vip())
def post(self, request, *args, **kwargs): vip_id = Users.objects.filter(appid=request.user.appid, developer=1, is_delete=0).first().vip vip_check = VipCheck.VipCheck(vip_id) if vip_check == "N": return Response(FBMsg.wms_vip()) elif vip_check == "Y": data = DataSolve.datasolve(request) try: if data['code'] == "1031": return Response(FBMsg.err_bad()) except: date_data = str(datetime.date.today()).split('-') check_date = str(date_data[0]) + str(date_data[1]) + str(date_data[2]) create_name = Users.objects.filter(openid=request.auth, appid=request.user.appid, is_delete=0).first().name if ListModel.objects.filter(is_delete=0).exists(): po_name = ListModel.objects.filter(is_delete=0).order_by('-create_time').first().name if str(po_name[0:8]) == str(check_date): po_create = str(check_date) + str(int(po_name[-5:]) + 1).rjust(5, '0') else: po_create = str(check_date) + str(1).rjust(5, '0') else: po_create = str(check_date) + str(1).rjust(5, '0') t_code = Md5.md5(datetime.datetime.now().strftime('%Y%m%d%H%M%S')) ListModel.objects.create(appid=request.user.appid, name=po_create, create_name=create_name, t_code=t_code) c_po_num = ListModel.objects.get(appid=request.user.appid, t_code=t_code).name ip = request.META.get('HTTP_X_FORWARDED_FOR') if request.META.get( 'HTTP_X_FORWARDED_FOR') else request.META.get('REMOTE_ADDR') ret = FBMsg.wms_ret() ret['ip'] = ip ret['data'] = c_po_num return Response(ret) else: return Response(FBMsg.wms_vip())
def post(self, request, *args, **kwargs): vip_id = Users.objects.filter(appid=request.user.appid, developer=1, is_delete=0).first().vip vip_check = VipCheck.VipCheck(vip_id) if vip_check == "N": return Response(FBMsg.wms_vip()) elif vip_check == "Y": data = DataSolve.datasolve(request) try: if data['code'] == "1031": return Response(FBMsg.err_bad()) except: create_name = Users.objects.filter(openid=request.auth, appid=request.user.appid, is_delete=0).first().name if ListModel.objects.filter(appid=request.user.appid, name=str(data[0]['po_number']), is_delete=0).exists(): supplier_data = ListModel.objects.filter( appid=request.user.appid, name=str(data[0]['po_number']), is_delete=0).first() supplier_data.supplier = str(data[0]['supplier']) supplier_data.save() for i in range(len(data)): DetailModel.objects.create( appid=request.user.appid, name=str(data[i]['po_number']), goods_code=str(data[i]['goods_code']), goods_name=str(data[i]['goods_name']), po_qty=int(data[i]['goods_qty']), create_name=create_name, supplier=str(data[i]['supplier']), t_code=Md5.md5(str(data[i]['goods_name']))) stock_list_data = stocklist.models.ListModel.objects.filter( appid=request.user.appid, name=str(data[i]['goods_code']), is_delete=0).first() stock_list_data.pre_delivery_stock = stock_list_data.pre_delivery_stock + int( data[i]['goods_qty']) stock_list_data.save() else: ret = FBMsg.wms_po_empty() ret['data'] = data return Response(ret) ip = request.META.get( 'HTTP_X_FORWARDED_FOR') if request.META.get( 'HTTP_X_FORWARDED_FOR') else request.META.get( 'REMOTE_ADDR') ret = FBMsg.wms_ret() ret['ip'] = ip ret['data'] = data return Response(ret) else: return Response(FBMsg.wms_vip())
def create(self, request, *args, **kwargs): data = self.request.data data['openid'] = self.request.auth.openid data['unit_volume'] = round( (float(data['goods_w']) * float(data['goods_d']) * float(data['goods_h'])) / 1000000000, 4) if ListModel.objects.filter(openid=data['openid'], goods_code=data['goods_code'], is_delete=False).exists(): raise APIException({"detail": "Data Exists"}) else: if supplier.objects.filter(openid=data['openid'], supplier_name=data['goods_supplier'], is_delete=False).exists(): if goods_unit.objects.filter(openid=data['openid'], goods_unit=data['goods_unit'], is_delete=False).exists(): if goods_class.objects.filter(openid=data['openid'], goods_class=data['goods_class'], is_delete=False).exists(): if goods_brand.objects.filter(openid=data['openid'], goods_brand=data['goods_brand'], is_delete=False).exists(): if goods_color.objects.filter(openid=data['openid'], goods_color=data['goods_color'], is_delete=False).exists(): if goods_shape.objects.filter(openid=data['openid'], goods_shape=data['goods_shape'], is_delete=False).exists(): if goods_specs.objects.filter(openid=data['openid'], goods_specs=data['goods_specs'], is_delete=False).exists(): if goods_origin.objects.filter(openid=data['openid'], goods_origin=data['goods_origin'], is_delete=False).exists(): data['bar_code'] = Md5.md5(data['goods_code']) serializer = self.get_serializer(data=data) serializer.is_valid(raise_exception=True) serializer.save() scanner.objects.create(openid=self.request.auth.openid, mode="GOODS", code=data['goods_code'], bar_code=data['bar_code']) headers = self.get_success_headers(serializer.data) return Response(serializer.data, status=200, headers=headers) else: raise APIException( {"detail": "Goods Origin does not exists or it has been changed"}) else: raise APIException( {"detail": "Goods Specs does not exists or it has been changed"}) else: raise APIException({"detail": "Goods Shape does not exists or it has been changed"}) else: raise APIException({"detail": "Goods Color does not exists or it has been changed"}) else: raise APIException({"detail": "Goods Brand does not exists or it has been changed"}) else: raise APIException({"detail": "Goods Class does not exists or it has been changed"}) else: raise APIException({"detail": "Goods Unit does not exists or it has been changed"}) else: raise APIException({"detail": "Supplier does not exists or it has been changed"})
def put(self, request, format=None): file_obj = request.data['file'] vip_id = Users.objects.filter(appid=request.user.appid, developer=1, is_delete=0).first().vip file_check = FileVipCheck.FileVipCheck(file_obj.size, vip_id) if file_check == "N": return Response(FBMsg.err_data()) elif file_check == "Y": if file_obj.name.endswith('.xlsx'): filename = os.path.join( settings.BASE_DIR, 'media/upload/' + pathlink + '/' + request.user.appid + '.xlsx') elif file_obj.name.endswith('.xls'): filename = os.path.join( settings.BASE_DIR, 'media/upload/' + pathlink + '/' + request.user.appid + '.xls') else: return Response(FBMsg.err_data()) with open(filename, 'wb+') as f: for chunk in file_obj.chunks(): f.write(chunk) f.close() df = pd.read_excel(filename) if ListModel.objects.filter(appid=request.user.appid).exists(): upload_data = ListModel.objects.filter( appid=request.user.appid) for i in range(len(upload_data)): upload_data[i].delete() for index, row in df.iterrows(): if str(row[pathname]) == '': pass else: if ListModel.objects.filter(appid=request.user.appid, name=str(row[pathname]), is_delete=0).exists(): pass else: ListModel.objects.create( appid=request.user.appid, name=str(row[pathname]), property_code=int(row['属性权限']), create_name=request.user.nickname, t_code=Md5.md5(str(row[pathname]))) os.remove(filename) ip = request.META.get('HTTP_X_FORWARDED_FOR') if request.META.get( 'HTTP_X_FORWARDED_FOR') else request.META.get('REMOTE_ADDR') ret = FBMsg.wms_ret() ret['ip'] = ip return Response(ret) else: return Response(FBMsg.err_data())
def put(self, request, format=None): file_obj = request.data['file'] vip_id = Users.objects.filter(appid=request.user.appid, developer=1, is_delete=0).first().vip file_check = FileVipCheck.FileVipCheck(file_obj.size, vip_id) if file_check == "N": return Response(FBMsg.err_data()) elif file_check == "Y": if os.path.exists(os.path.join(settings.BASE_DIR, 'media/upload/' + pathlink)): pass else: os.makedirs(os.path.join(settings.BASE_DIR, 'media/upload/' + pathlink)) if file_obj.name.endswith('.xlsx'): filename = os.path.join(settings.BASE_DIR, 'media/upload/' + pathlink + '/' + request.user.appid + '.xlsx') elif file_obj.name.endswith('.xls'): filename = os.path.join(settings.BASE_DIR, 'media/upload/' + pathlink + '/' + request.user.appid + '.xls') else: return Response(FBMsg.err_data()) with open(filename, 'wb+') as f: for chunk in file_obj.chunks(): f.write(chunk) f.close() df = pd.read_excel(filename) if ListModel.objects.filter(appid=request.user.appid).exists(): upload_data = ListModel.objects.filter(appid=request.user.appid) for i in range(len(upload_data)): upload_data[i].delete() for index, row in df.iterrows(): if str(row[pathname]) == '': pass else: if ListModel.objects.filter(appid=request.user.appid, is_delete=0).count() > 0: ret = FBMsg.wms_warehouse_more() ret['data'] = row return Response(ret) else: ListModel.objects.create(appid=request.user.appid, name=str(row[pathname]), province=str(row['省份']), city=str(row['城市']), district=str(row['行政区']), address=str(row['详细地址']), manager=str(row['负责人']), mobile=str(row['联系电话']), t_code=Md5.md5(str(row[pathname]))) os.remove(filename) ip = request.META.get('HTTP_X_FORWARDED_FOR') if request.META.get( 'HTTP_X_FORWARDED_FOR') else request.META.get('REMOTE_ADDR') ret = FBMsg.wms_ret() ret['ip'] = ip return Response(ret) else: return Response(FBMsg.err_data())
def create(self, request, *args, **kwargs): data = self.request.data data['openid'] = self.request.auth.openid if ListModel.objects.filter(openid=data['openid'], bin_name=data['bin_name'], is_delete=False).exists(): raise APIException({"detail": "Data exists"}) else: if binsize.objects.filter(openid=data['openid'], bin_size=data['bin_size'], is_delete=False).exists(): if binproperty.objects.filter( Q(openid=data['openid'], bin_property=data['bin_property'], is_delete=False) | Q(openid='init_data', bin_property=data['bin_property'], is_delete=False)).exists(): data['bar_code'] = Md5.md5(data['bin_name']) serializer = self.get_serializer(data=data) serializer.is_valid(raise_exception=True) serializer.save() scanner.objects.create(openid=self.request.auth.openid, mode="BINSET", code=data['bin_name'], bar_code=data['bar_code']) headers = self.get_success_headers(serializer.data) return Response(serializer.data, status=200, headers=headers) else: raise APIException({ "detail": "Bin property does not exists or it has been changed" }) else: raise APIException({ "detail": "Bin size does not exists or it has been changed" })
def create(self, request, *args, **kwargs): data = self.request.data data['openid'] = self.request.auth.openid if self.get_queryset().filter(openid=data['openid'], is_delete=False).exists(): asn_last_code = self.get_queryset().filter( openid=data['openid']).first().asn_code asn_add_code = str( int(re.findall(r'\d+', str(asn_last_code), re.IGNORECASE)[0]) + 1).zfill(8) data['asn_code'] = 'ASN' + asn_add_code else: data['asn_code'] = 'ASN00000001' data['bar_code'] = Md5.md5(data['asn_code']) serializer = self.get_serializer(data=data) serializer.is_valid(raise_exception=True) serializer.save() scanner.objects.create(openid=self.request.auth.openid, mode="ASN", code=data['asn_code'], bar_code=data['bar_code']) headers = self.get_success_headers(serializer.data) return Response(serializer.data, status=200, headers=headers)
def create(self, request, pk): qs = self.get_object() if qs.openid != self.request.auth.openid: raise APIException({"detail": "Cannot delete data which not yours"}) else: if qs.asn_status != 4: raise APIException({"detail": "This ASN Status Is Not 4"}) else: data = self.request.data if 'bin_name' not in data: raise APIException({"detail": "Please Enter the Bin Name"}) else: bin_detail = binset.objects.filter(openid=self.request.auth.openid, bin_name=str(data['bin_name'])).first() asn_detail = AsnListModel.objects.filter(openid=self.request.auth.openid, asn_code=str(data['asn_code'])).first() goods_qty_change = stocklist.objects.filter(openid=self.request.auth.openid, goods_code=str(data['goods_code'])).first() if int(data['qty']) <= 0: raise APIException({"detail": "Move QTY Must > 0"}) else: move_qty = qs.goods_actual_qty - qs.sorted_qty - int(data['qty']) if move_qty > 0: qs.sorted_qty = qs.sorted_qty + int(data['qty']) goods_qty_change.sorted_stock = goods_qty_change.sorted_stock - int(data['qty']) goods_qty_change.onhand_stock = goods_qty_change.onhand_stock + int(data['qty']) if bin_detail.bin_property == 'Damage': goods_qty_change.damage_stock = goods_qty_change.damage_stock + int(data['qty']) qs.goods_damage_qty = qs.goods_damage_qty + int(data['qty']) elif bin_detail.bin_property == 'Inspection': goods_qty_change.inspect_stock = goods_qty_change.inspect_stock + int(data['qty']) elif bin_detail.bin_property == 'Holding': goods_qty_change.hold_stock = goods_qty_change.hold_stock + int(data['qty']) else: goods_qty_change.can_order_stock = goods_qty_change.can_order_stock + int(data['qty']) qs.save() goods_qty_change.save() stockbin.objects.create(openid=self.request.auth.openid, bin_name=str(data['bin_name']), goods_code=str(data['goods_code']), goods_desc=goods_qty_change.goods_desc, goods_qty=int(data['qty']), bin_size=bin_detail.bin_size, bin_property=bin_detail.bin_property, t_code=Md5.md5(str(data['goods_code'])), create_time=qs.create_time ) if bin_detail.empty_label == True: bin_detail.empty_label = False bin_detail.save() elif move_qty == 0: qs.sorted_qty = qs.sorted_qty + int(data['qty']) qs.asn_status = 5 goods_qty_change.sorted_stock = goods_qty_change.sorted_stock - int(data['qty']) goods_qty_change.onhand_stock = goods_qty_change.onhand_stock + int(data['qty']) if bin_detail.bin_property == 'Damage': goods_qty_change.damage_stock = goods_qty_change.damage_stock + int(data['qty']) qs.goods_damage_qty = qs.goods_damage_qty + int(data['qty']) elif bin_detail.bin_property == 'Inspection': goods_qty_change.inspect_stock = goods_qty_change.inspect_stock + int(data['qty']) elif bin_detail.bin_property == 'Holding': goods_qty_change.hold_stock = goods_qty_change.hold_stock + int(data['qty']) else: goods_qty_change.can_order_stock = goods_qty_change.can_order_stock + int(data['qty']) qs.save() goods_qty_change.save() if AsnDetailModel.objects.filter(openid=self.request.auth.openid, asn_code=str(data['asn_code']), asn_status=4 ).exists(): pass else: asn_detail.asn_status = 5 asn_detail.save() stockbin.objects.create(openid=self.request.auth.openid, bin_name=str(data['bin_name']), goods_code=str(data['goods_code']), goods_desc=goods_qty_change.goods_desc, goods_qty=int(data['qty']), bin_size=bin_detail.bin_size, bin_property=bin_detail.bin_property, t_code=Md5.md5(str(data['goods_code'])), create_time=qs.create_time) if bin_detail.empty_label == True: bin_detail.empty_label = False bin_detail.save() elif move_qty < 0: raise APIException({"detail": "Move Qty must < Actual Arrive Qty"}) else: pass return Response({"success": "Yes"}, status=200)
def register(request, *args, **kwargs): post_data = json.loads(request.body.decode()) data = { "name": post_data.get('name'), "password1": post_data.get('password1'), "password2": post_data.get('password2') } ip = request.META.get('HTTP_X_FORWARDED_FOR') if request.META.get( 'HTTP_X_FORWARDED_FOR') else request.META.get('REMOTE_ADDR') if Users.objects.filter(name=str(data['name']), developer=1, is_delete=0).exists(): err_user_same = FBMsg.err_user_same() err_user_same['ip'] = ip err_user_same['data'] = data['name'] return JsonResponse(err_user_same) else: if data.get('password1') is None: err_password1_empty = FBMsg.err_password1_empty() err_password1_empty['ip'] = ip err_password1_empty['data'] = data['name'] return JsonResponse(err_password1_empty) else: if str(data['password1']) == '': err_password1_empty = FBMsg.err_password1_empty() err_password1_empty['ip'] = ip err_password1_empty['data'] = data['name'] return JsonResponse(err_password1_empty) else: if data.get('password2') is None: err_password2_empty = FBMsg.err_password2_empty() err_password2_empty['ip'] = ip err_password2_empty['data'] = data['name'] return JsonResponse(err_password2_empty) else: if str(data['password2']) == '': err_password2_empty = FBMsg.err_password2_empty() err_password2_empty['ip'] = ip err_password2_empty['data'] = data['name'] return JsonResponse(err_password2_empty) else: if str(data['password1']) != str(data['password2']): err_password_not_same = FBMsg.err_password_not_same( ) err_password_not_same['ip'] = ip err_password_not_same['data'] = data['name'] return JsonResponse(err_password_not_same) else: transaction_code = Md5.md5(data['name']) user = User.objects.create_user( username=str(data['name']), password=str(data['password1'])) Users.objects.create( user_id=user.id, name=str(data['name']), openid=transaction_code, appid=Md5.md5(data['name'] + '1'), t_code=Md5.md5(str(timezone.now())), developer=1, ip=ip) auth.login(request, user) staff.objects.create(staff_name=str(data['name']), staff_type='1', openid=transaction_code) ret = FBMsg.ret() ret['ip'] = ip data['openid'] = transaction_code data['name'] = str(data['name']) data.pop('password1', '') data.pop('password2', '') ret['data'] = data return JsonResponse(ret)
def register(request): postdata = json.loads(request.body.decode().replace("'", "\"")) data = { "name": postdata.get("name", ''), "password1": postdata.get("password1", ''), "password2": postdata.get("password2", ''), } ip = request.META.get('HTTP_X_FORWARDED_FOR') if request.META.get( 'HTTP_X_FORWARDED_FOR') else request.META.get('REMOTE_ADDR') script_obj = re.findall(r'script', str(data), re.IGNORECASE) select_obj = re.findall(r'select', str(data), re.IGNORECASE) if script_obj: return JsonResponse(FBMsg.err_bad()) elif select_obj: return JsonResponse(FBMsg.err_bad()) else: if Users.objects.filter(name=str(data['name']), developer=1, is_delete=0).exists(): err_user_same = FBMsg.err_user_same() err_user_same['ip'] = ip err_user_same['data'] = data['name'] return JsonResponse(err_user_same) else: if Users.objects.filter(ip=ip).exists(): if Users.objects.filter(ip=ip).count() > 2: err_register_more = FBMsg.err_register_more() err_register_more['ip'] = ip err_register_more['data'] = data['name'] return JsonResponse(err_register_more) else: if 'password1' not in data: err_password1_empty = FBMsg.err_password1_empty() err_password1_empty['ip'] = ip err_password1_empty['data'] = data['name'] return JsonResponse(err_password1_empty) else: if str(data['password1']) == '': err_password1_empty = FBMsg.err_password1_empty() err_password1_empty['ip'] = ip err_password1_empty['data'] = data['name'] return JsonResponse(err_password1_empty) else: if 'password2' not in data: err_password2_empty = FBMsg.err_password2_empty( ) err_password2_empty['ip'] = ip err_password2_empty['data'] = data['name'] return JsonResponse(err_password2_empty) else: if str(data['password2']) == '': err_password2_empty = FBMsg.err_password2_empty( ) err_password2_empty['ip'] = ip err_password2_empty['data'] = data['name'] return JsonResponse(err_password2_empty) else: if str(data['password1']) != str( data['password2']): err_password_not_same = FBMsg.err_password_not_same( ) err_password_not_same['ip'] = ip err_password_not_same['data'] = data[ 'name'] return JsonResponse( err_password_not_same) else: transaction_code = Md5.md5( data['name']) user = User.objects.create_user( username=str(data['name']), password=str(data['password1'])) Users.objects.create( user_id=user.id, name=user.username, password=str(data['password1']), openid=transaction_code, appid=Md5.md5(data['name'] + '1'), transaction_code=Md5.md5( str(timezone.now())), developer=1, ip=ip) auth.login(request, user) ret = FBMsg.ret() data['openid'] = transaction_code ret['ip'] = ip data.pop('password1', '') data.pop('password2', '') ret['data'] = data return JsonResponse(ret) else: if 'password1' not in data: err_password1_empty = FBMsg.err_password1_empty() err_password1_empty['ip'] = ip err_password1_empty['data'] = data['name'] return JsonResponse(err_password1_empty) else: if str(data['password1']) == '': err_password1_empty = FBMsg.err_password1_empty() err_password1_empty['ip'] = ip err_password1_empty['data'] = data['name'] return JsonResponse(err_password1_empty) else: if 'password2' not in data: err_password2_empty = FBMsg.err_password2_empty() err_password2_empty['ip'] = ip err_password2_empty['data'] = data['name'] return JsonResponse(err_password2_empty) else: if str(data['password2']) == '': err_password2_empty = FBMsg.err_password2_empty( ) err_password2_empty['ip'] = ip err_password2_empty['data'] = data['name'] return JsonResponse(err_password2_empty) else: if str(data['password1']) != str( data['password2']): err_password_not_same = FBMsg.err_password_not_same( ) err_password_not_same['ip'] = ip err_password_not_same['data'] = data[ 'name'] return JsonResponse(err_password_not_same) else: transaction_code = Md5.md5(data['name']) user = User.objects.create_user( username=str(data['name']), password=str(data['password1'])) Users.objects.create( user_id=user.id, name=user.username, password=str(data['password1']), openid=transaction_code, appid=Md5.md5(data['name'] + '1'), transaction_code=Md5.md5( str(timezone.now())), developer=1, ip=ip) auth.login(request, user) ret = FBMsg.ret() ret['ip'] = ip data['openid'] = transaction_code data.pop('password1', '') data.pop('password2', '') ret['data'] = data return JsonResponse(ret)
def post(self, request, *args, **kwargs): if models.Users.objects.filter(openid=request.auth, appid=request.user.appid, developer=1, is_delete=0).exists(): if models.Users.objects.filter(appid=request.user.appid, is_delete=0).count() >= 6: return Response(FBMsg.err_more_user()) else: return Response(FBMsg.err_dev()) data = DataSolve.datasolve(request) try: if data['code'] == "1031": return Response(FBMsg.err_bad()) except: if models.Users.objects.filter(appid=request.user.appid, name=data['name'], is_delete=0).exists(): return Response(FBMsg.err_user_same()) else: ip = request.META.get( 'HTTP_X_FORWARDED_FOR') if request.META.get( 'HTTP_X_FORWARDED_FOR') else request.META.get( 'REMOTE_ADDR') if 'name' not in data: return Response(FBMsg.err_user_name()) else: if data['name'] == '': return Response(FBMsg.err_user_name()) else: if 'nickname' not in data: return Response(FBMsg.err_user_name()) else: if data['nickname'] == '': return Response(FBMsg.err_user_name()) else: if 'password1' not in data: return Response( FBMsg.err_password1_empty()) else: if data['password1'] == '': return Response( FBMsg.err_password1_empty()) else: if 'password2' not in data: return Response( FBMsg.err_password2_empty()) else: if data['password2'] == '': return Response( FBMsg.err_password2_empty( )) else: if data['password1'] != data[ 'password2']: return Response( FBMsg. err_password_not_same( )) else: transaction_code = Md5.md5( data['nickname']) models.Users.objects.create( openid=Md5.md5( data['name']), appid=request.user. appid, transaction_code= transaction_code, name=data['name'], nickname=data[ 'nickname'], password=data[ 'password1'], ip=ip) ret = FBMsg.ret() ret['ip'] = ip ret['data'] = data['name'] return Response(ret)
def register(request, *args, **kwargs): post_data = json.loads(request.body.decode()) data = { "name": post_data.get('name'), "password1": post_data.get('password1'), "password2": post_data.get('password2') } ip = request.META.get('HTTP_X_FORWARDED_FOR') if request.META.get( 'HTTP_X_FORWARDED_FOR') else request.META.get('REMOTE_ADDR') if Users.objects.filter(name=str(data['name']), developer=1, is_delete=0).exists(): err_user_same = FBMsg.err_user_same() err_user_same['ip'] = ip err_user_same['data'] = data['name'] return JsonResponse(err_user_same) else: if data.get('password1') is None: err_password1_empty = FBMsg.err_password1_empty() err_password1_empty['ip'] = ip err_password1_empty['data'] = data['name'] return JsonResponse(err_password1_empty) else: if str(data['password1']) == '': err_password1_empty = FBMsg.err_password1_empty() err_password1_empty['ip'] = ip err_password1_empty['data'] = data['name'] return JsonResponse(err_password1_empty) else: if data.get('password2') is None: err_password2_empty = FBMsg.err_password2_empty() err_password2_empty['ip'] = ip err_password2_empty['data'] = data['name'] return JsonResponse(err_password2_empty) else: if str(data['password2']) == '': err_password2_empty = FBMsg.err_password2_empty() err_password2_empty['ip'] = ip err_password2_empty['data'] = data['name'] return JsonResponse(err_password2_empty) else: if str(data['password1']) != str(data['password2']): err_password_not_same = FBMsg.err_password_not_same( ) err_password_not_same['ip'] = ip err_password_not_same['data'] = data['name'] return JsonResponse(err_password_not_same) else: transaction_code = Md5.md5(data['name']) user = User.objects.create_user( username=str(data['name']), password=str(data['password1'])) Users.objects.create( user_id=user.id, name=str(data['name']), openid=transaction_code, appid=Md5.md5(data['name'] + '1'), t_code=Md5.md5(str(timezone.now())), developer=1, ip=ip) auth.login(request, user) staff.objects.create(staff_name=str(data['name']), staff_type='Admin', openid=transaction_code) ret = FBMsg.ret() ret['ip'] = ip data['openid'] = transaction_code data['name'] = str(data['name']) data.pop('password1', '') data.pop('password2', '') ret['data'] = data from company.models import ListModel as company company.objects.create( openid=transaction_code, company_name='GreaterWMS', company_city=str(random.choice(randomcity)), company_address='People’s Square # 666 Room 1F', company_contact=int(randomPhone()), company_manager='Elvis.Shi', creater='DemoData') from warehouse.models import ListModel as warehouse warehouse.objects.create( openid=transaction_code, warehouse_name='Center Warehouse', warehouse_city=str(random.choice(randomcity)), warehouse_address= 'People’s Square # 666 Room 2F', warehouse_contact=int(randomPhone()), warehouse_manager='Tim.Yao', creater='DemoData') from supplier.models import ListModel as supplier supplier_data_list = [] for supplier_data in range(1, 42): demo_data = supplier( openid=transaction_code, supplier_name='Supplier Name-' + str(supplier_data), supplier_city=str( random.choice(randomcity)), supplier_address='Address-' + str(supplier_data), supplier_contact=int(randomPhone()), supplier_manager=str( random.choice(randomname)), creater='DemoData') supplier_data_list.append(demo_data) supplier.objects.bulk_create(supplier_data_list, batch_size=100) from customer.models import ListModel as customer customer_data_list = [] for customer_data in range(1, 42): demo_data = customer( openid=transaction_code, customer_name='Customer Name-' + str(customer_data), customer_city=str( random.choice(randomcity)), customer_address='Address-' + str(customer_data), customer_contact=int(randomPhone()), customer_manager=str( random.choice(randomname)), creater='DemoData') customer_data_list.append(demo_data) customer.objects.bulk_create(customer_data_list, batch_size=100) staff_data_list = [] for staff_data in randomname: demo_data = staff(openid=transaction_code, staff_name=staff_data, staff_type=str( randomStaffType())) staff_data_list.append(demo_data) staff.objects.bulk_create(staff_data_list, batch_size=100) from driver.models import ListModel as driver driver_data_list = [] for driver_data in range(1, 42): demo_data = driver( openid=transaction_code, driver_name='Driver Name-' + str(driver_data), license_plate="".join( random.choice("0123456789") for i in range(8)), creater='DemoData') driver_data_list.append(demo_data) driver.objects.bulk_create(driver_data_list, batch_size=100) from capital.models import ListModel as capital capital_data_list = [] for capital_data in range(1, 42): demo_data = capital( openid=transaction_code, capital_name='Capital Name-' + str(capital_data), capital_qty=random.randint(1, 100), capital_cost=random.randint(100, 10000), creater='DemoData') capital_data_list.append(demo_data) capital.objects.bulk_create(capital_data_list, batch_size=100) from binsize.models import ListModel as binsize binsize_data_list = [ binsize(openid=transaction_code, bin_size='Big', bin_size_w=1100, bin_size_d=1200, bin_size_h=1800, creater='DemoData'), binsize(openid=transaction_code, bin_size='Floor', bin_size_w=10000, bin_size_d=10000, bin_size_h=10000, creater='DemoData'), binsize(openid=transaction_code, bin_size='Small', bin_size_w=800, bin_size_d=1000, bin_size_h=1200, creater='DemoData'), binsize(openid=transaction_code, bin_size='Tiny', bin_size_w=200, bin_size_d=250, bin_size_h=300, creater='DemoData') ] binsize.objects.bulk_create(binsize_data_list, batch_size=100) from binset.models import ListModel as binset binset_data_list = [ binset(openid=transaction_code, bin_name='A010101', bin_size=str( random.choice(randombinsize)), bin_property="Normal", empty_label=True, creater='DemoData'), binset(openid=transaction_code, bin_name='A010102', bin_size=str( random.choice(randombinsize)), bin_property="Normal", empty_label=True, creater='DemoData'), binset(openid=transaction_code, bin_name='A010103', bin_size=str( random.choice(randombinsize)), bin_property="Normal", empty_label=True, creater='DemoData'), binset(openid=transaction_code, bin_name='B010101', bin_size=str( random.choice(randombinsize)), bin_property="Inspection", empty_label=True, creater='DemoData'), binset(openid=transaction_code, bin_name='B010102', bin_size=str( random.choice(randombinsize)), bin_property="Inspection", empty_label=True, creater='DemoData'), binset(openid=transaction_code, bin_name='B010103', bin_size=str( random.choice(randombinsize)), bin_property="Inspection", empty_label=True, creater='DemoData'), binset(openid=transaction_code, bin_name='B020101', bin_size=str( random.choice(randombinsize)), bin_property="Holding", empty_label=True, creater='DemoData'), binset(openid=transaction_code, bin_name='B020102', bin_size=str( random.choice(randombinsize)), bin_property="Holding", empty_label=True, creater='DemoData'), binset(openid=transaction_code, bin_name='B020103', bin_size=str( random.choice(randombinsize)), bin_property="Holding", empty_label=True, creater='DemoData'), binset(openid=transaction_code, bin_name='B030101', bin_size=str( random.choice(randombinsize)), bin_property="Damage", empty_label=True, creater='DemoData'), binset(openid=transaction_code, bin_name='B030102', bin_size=str( random.choice(randombinsize)), bin_property="Damage", empty_label=True, creater='DemoData'), binset(openid=transaction_code, bin_name='B030103', bin_size=str( random.choice(randombinsize)), bin_property="Damage", empty_label=True, creater='DemoData'), ] binset.objects.bulk_create(binset_data_list, batch_size=100) from goodsunit.models import ListModel as goodsunit demo_data = [] for goods_unit in randomunit: demo_data.append( goodsunit(openid=transaction_code, goods_unit=goods_unit, creater='DemoData')) goodsunit.objects.bulk_create(demo_data, batch_size=100) from goodsclass.models import ListModel as goodsclass demo_data = [] for goods_class in randomclass: demo_data.append( goodsclass(openid=transaction_code, goods_class=goods_class, creater='DemoData')) goodsclass.objects.bulk_create(demo_data, batch_size=100) from goodscolor.models import ListModel as goodscolor demo_data = [] for goods_color in randomcolor: demo_data.append( goodscolor(openid=transaction_code, goods_color=goods_color, creater='DemoData')) goodscolor.objects.bulk_create(demo_data, batch_size=100) from goodsbrand.models import ListModel as goodsbrand goodsbrand_data_list = [] for goodsbrand_data in range(1, 42): demo_data = goodsbrand( openid=transaction_code, goods_brand='Brand Name-' + str(goodsbrand_data), creater='DemoData') goodsbrand_data_list.append(demo_data) goodsbrand.objects.bulk_create( goodsbrand_data_list, batch_size=100) from goodsshape.models import ListModel as goodsshape demo_data = [] for goods_shape in randomshape: demo_data.append( goodsshape(openid=transaction_code, goods_shape=goods_shape, creater='DemoData')) goodsshape.objects.bulk_create(demo_data, batch_size=100) from goodsspecs.models import ListModel as goodsspecs demo_data = [] for goods_specs in randomspecs: demo_data.append( goodsspecs(openid=transaction_code, goods_specs=goods_specs, creater='DemoData')) goodsspecs.objects.bulk_create(demo_data, batch_size=100) from goodsorigin.models import ListModel as goodsorigin goodsorigin_data_list = [] for city in randomcity: demo_data = goodsorigin( openid=transaction_code, goods_origin=city, creater='DemoData') goodsorigin_data_list.append(demo_data) goodsorigin.objects.bulk_create( goodsorigin_data_list, batch_size=100) from goods.models import ListModel as goods goods_data_list = [] for goods_data in range(1, 42): goods_w = round(random.uniform(10, 1000), 2), goods_d = round(random.uniform(10, 1000), 2), goods_h = round(random.uniform(10, 1000), 2), goods_cost = round(random.uniform(10, 1000), 2), goods_price = round(random.uniform(10, 1000), 2), while True: if goods_cost[0] >= goods_price[0]: goods_price = round( random.uniform(10, 1000), 2), else: break demo_data = goods( openid=transaction_code, goods_code="A0000" + str(goods_data), goods_desc="Goods Desc-" + str(goods_data), goods_supplier='Supplier Name-' + str(random.randint(1, 42)), goods_weight=random.randint(100, 10000), goods_w=goods_w[0], goods_d=goods_d[0], goods_h=goods_h[0], unit_volume=round( (int(goods_w[0]) * int(goods_d[0]) * int(goods_h[0])) / 1000000000, 4), goods_unit=random.choice(randomunit), goods_class=random.choice(randomclass), goods_brand='Brand Name-' + str(random.randint(1, 42)), goods_color=random.choice(randomcolor), goods_shape=random.choice(randomshape), goods_specs=random.choice(randomspecs), goods_origin=random.choice(randomcity), goods_cost=goods_cost[0], goods_price=goods_price[0], creater='DemoData') goods_data_list.append(demo_data) goods.objects.bulk_create(goods_data_list, batch_size=100) from payment.models import TransportationFeeListModel as freight freight_data_list = [] for sender in randomcity: for receiver in randomcity: demo_data = freight( openid=transaction_code, send_city=sender, receiver_city=receiver, weight_fee=random.randint(10, 20), volume_fee=random.randint(100, 200), min_payment=random.randint(250, 300), transportation_supplier="Supplier", creater="DemoData") freight_data_list.append(demo_data) freight.objects.bulk_create(freight_data_list, batch_size=100) return JsonResponse(ret)
def put(self, request, format=None): file_obj = request.data['file'] vip_id = Users.objects.filter(appid=request.user.appid, developer=1, is_delete=0).first().vip file_check = FileVipCheck.FileVipCheck(file_obj.size, vip_id) if file_check == "N": return Response(FBMsg.err_data()) elif file_check == "Y": if os.path.exists(os.path.join(settings.BASE_DIR, 'media/upload/' + pathlink)): pass else: os.makedirs(os.path.join(settings.BASE_DIR, 'media/upload/' + pathlink)) if file_obj.name.endswith('.xlsx'): filename = os.path.join(settings.BASE_DIR, 'media/upload/' + pathlink + '/' + request.user.appid + '.xlsx') elif file_obj.name.endswith('.xls'): filename = os.path.join(settings.BASE_DIR, 'media/upload/' + pathlink + '/' + request.user.appid + '.xls') else: return Response(FBMsg.err_data()) with open(filename, 'wb+') as f: for chunk in file_obj.chunks(): f.write(chunk) f.close() df = pd.read_excel(filename) if ListModel.objects.filter(appid=request.user.appid).exists(): upload_data = ListModel.objects.filter(appid=request.user.appid) for i in range(len(upload_data)): upload_data[i].delete() for index, row in df.iterrows(): if str(row[pathname]) == '': pass else: if ListModel.objects.filter(appid=request.user.appid, name=str(row[pathname]), is_delete=0).exists(): pass else: create_name = Users.objects.filter(openid=request.auth, appid=request.user.appid, is_delete=0).first().name if goodsunit.models.ListModel.objects.filter(appid=request.user.appid, name=str(row['商品单位']), is_delete=0).exists(): pass else: goodsunit.models.ListModel.objects.create(appid=request.user.appid, name=str(row['商品单位']), create_name=create_name, t_code=Md5.md5(str(row['商品单位']))) if goodsclass.models.ListModel.objects.filter(appid=request.user.appid, name=str(row['商品类别']), is_delete=0).exists(): pass else: goodsclass.models.ListModel.objects.create(appid=request.user.appid, name=str(row['商品类别']), create_name=create_name, t_code=Md5.md5(str(row['商品类别']))) if goodsspecs.models.ListModel.objects.filter(appid=request.user.appid, name=str(row['商品规格']), is_delete=0).exists(): pass else: goodsspecs.models.ListModel.objects.create(appid=request.user.appid, name=str(row['商品规格']), create_name=create_name, t_code=Md5.md5(str(row['商品规格']))) if goodsshape.models.ListModel.objects.filter(appid=request.user.appid, name=str(row['商品形状']), is_delete=0).exists(): pass else: goodsshape.models.ListModel.objects.create(appid=request.user.appid, name=str(row['商品形状']), create_name=create_name, t_code=Md5.md5(str(row['商品形状']))) if goodscolor.models.ListModel.objects.filter(appid=request.user.appid, name=str(row['商品颜色']), is_delete=0).exists(): pass else: goodscolor.models.ListModel.objects.create(appid=request.user.appid, name=str(row['商品颜色']), create_name=create_name, t_code=Md5.md5(str(row['商品颜色']))) if goodsbrand.models.ListModel.objects.filter(appid=request.user.appid, name=str(row['商品品牌']), is_delete=0).exists(): pass else: goodsbrand.models.ListModel.objects.create(appid=request.user.appid, name=str(row['商品品牌']), create_name=create_name, t_code=Md5.md5(str(row['商品品牌']))) if goodscity.models.ListModel.objects.filter(appid=request.user.appid, name=str(row['商品产地']), is_delete=0).exists(): pass else: goodscity.models.ListModel.objects.create(appid=request.user.appid, name=str(row['商品产地']), create_name=create_name, t_code=Md5.md5(str(row['商品产地']))) if stocklist.models.ListModel.objects.filter(appid=request.user.appid, name=str(row[pathname]), is_delete=0).exists(): pass else: stocklist.models.ListModel.objects.create(appid=request.user.appid, name=str(row[pathname]), goods_name=str(row['商品描述']), t_code=Md5.md5(str(row[pathname]))) ListModel.objects.create(appid=request.user.appid, name=str(row[pathname]), goods_name=str(row['商品描述']), goods_unit=str(row['商品单位']), goods_class=str(row['商品类别']), goods_spacs=str(row['商品规格']), goods_shape=str(row['商品形状']), goods_color=str(row['商品颜色']), goods_brand=str(row['商品品牌']), goods_city=str(row['商品产地']), create_name=create_name, goods_l=round(float(row['商品长(单位: mm)']), 2), goods_w=round(float(row['商品宽(单位: mm)']), 2), goods_h=round(float(row['商品高(单位: mm)']), 2), goods_weight=round(float(row['商品重量(单位: 克)']), 2), goods_cost=round(float(row['成本价(单位: 元)']), 2), goods_price1=round(float(row['一销价(单位: 元)']), 2), goods_price2=round(float(row['二销价(单位: 元)']), 2), goods_price3=round(float(row['三销价(单位: 元)']), 2), t_code=Md5.md5(str(row[pathname]))) os.remove(filename) ip = request.META.get('HTTP_X_FORWARDED_FOR') if request.META.get( 'HTTP_X_FORWARDED_FOR') else request.META.get('REMOTE_ADDR') ret = FBMsg.wms_ret() ret['ip'] = ip return Response(ret) else: return Response(FBMsg.err_data())
def post(self, request, *args, **kwargs): vip_id = Users.objects.filter(appid=request.user.appid, developer=1, is_delete=0).first().vip vip_check = VipCheck.VipCheck(vip_id) if vip_check == "N": return Response(FBMsg.wms_vip()) elif vip_check == "Y": data = DataSolve.datasolve(request) try: if data['code'] == "1031": return Response(FBMsg.err_bad()) except: if 'changedata' in data: if str(data['changedata']) == '1': if ListModel.objects.filter( appid=request.user.appid, t_code=str(data['t_code'])).exists(): patch_data = ListModel.objects.filter( appid=request.user.appid, t_code=str(data['t_code'])).first() if 'goods_qty' in data: patch_data.goods_qty = patch_data.goods_qty + int( data['goods_qty']) patch_data.cycle_count_balance = patch_data.cycle_count_balance + int( data['goods_qty']) patch_data.save() ip = request.META.get( 'HTTP_X_FORWARDED_FOR') if request.META.get( 'HTTP_X_FORWARDED_FOR' ) else request.META.get('REMOTE_ADDR') ret = FBMsg.wms_ret() ret['ip'] = ip ret['data'] = data return Response(ret) else: ret = FBMsg.wms_err() ret['data'] = data return Response(ret) if 'postdata' in data: if str(data['postdata']) == '1': if binset.models.ListModel.objects.filter( appid=request.user.appid, name=str(data['name']), is_delete=0).exists(): if goodslist.models.ListModel.objects.filter( appid=request.user.appid, name=str(data['goods_code']), is_delete=0).exists(): goods_name = goodslist.models.ListModel.objects.filter( appid=request.user.appid, name=str(data['goods_code']), is_delete=0).first().goods_name else: goods_name = '' ListModel.objects.create( appid=request.user.appid, name=str(data['name']), goods_code=str(data['goods_code']), goods_name=goods_name, goods_qty=int(data['goods_qty']), inbound_time=datetime.datetime.now(), staff=str(data['staff']), cycle_count_balance=int(data['goods_qty']), t_code=Md5.md5(str(data['name']))) ip = request.META.get( 'HTTP_X_FORWARDED_FOR') if request.META.get( 'HTTP_X_FORWARDED_FOR' ) else request.META.get('REMOTE_ADDR') ret = FBMsg.wms_ret() ret['ip'] = ip ret['data'] = data return Response(ret) else: ret = FBMsg.wms_err() ret['data'] = {"库位不存在": str(data['name'])} return Response(ret) else: return Response(FBMsg.wms_vip())
def put(self, request, format=None): global cyclecount_number file_obj = request.data['file'] vip_id = Users.objects.filter(appid=request.user.appid, developer=1, is_delete=0).first().vip file_check = FileVipCheck.FileVipCheck(file_obj.size, vip_id) if file_check == "N": return Response(FBMsg.err_data()) elif file_check == "Y": if os.path.exists( os.path.join(settings.BASE_DIR, 'media/upload/' + pathlink)): pass else: os.makedirs( os.path.join(settings.BASE_DIR, 'media/upload/' + pathlink)) if file_obj.name.endswith('.xlsx'): filename = os.path.join( settings.BASE_DIR, 'media/upload/' + pathlink + '/' + request.user.appid + '.xlsx') elif file_obj.name.endswith('.xls'): filename = os.path.join( settings.BASE_DIR, 'media/upload/' + pathlink + '/' + request.user.appid + '.xls') else: return Response(FBMsg.err_data()) with open(filename, 'wb+') as f: for chunk in file_obj.chunks(): f.write(chunk) f.close() df = pd.read_excel(filename) if ListModel.objects.filter(appid=request.user.appid).exists(): upload_data = ListModel.objects.filter( appid=request.user.appid) for i in range(len(upload_data)): upload_data[i].delete() for index, row in df.iterrows(): if str(row[pathname]) == '': pass else: if goodslist.models.ListModel.objects.filter( appid=request.user.appid, name=str(row['商品编码']), is_delete=0).exists(): pass else: ret = FBMsg.wms_err() ret['data'] = {"商品编码不存在": str(row['商品编码'])} return Response(ret) if binset.models.ListModel.objects.filter( appid=request.user.appid, name=str(row[pathname]), is_delete=0).exists(): pass else: ret = FBMsg.wms_err() ret['data'] = {"库位不存在": str(row[pathname])} return Response(ret) if Users.objects.filter(appid=request.user.appid, name=str(row['盘点用户名']), is_delete=0).exists(): pass else: ret = FBMsg.wms_err() ret['data'] = {"用户不存在": str(row['盘点用户名'])} return Response(ret) if stockbinlist.models.ListModel.objects.filter( appid=request.user.appid, t_code=str(row['数据标识']), is_delete=0).exists(): cycle_count_data = stockbinlist.models.ListModel.objects.filter( appid=request.user.appid, t_code=str(row['数据标识']), is_delete=0).first() ListModel.objects.create( appid=request.user.appid, name=str(row[pathname]), goods_code=str(row['商品编码']), goods_name=str(row['商品描述']), cycle_count_balance=0 - cycle_count_data.goods_qty, staff=str(row['盘点用户名']), inbound_time=cycle_count_data.create_time, t_code=Md5.md5(str(row[pathname]))) else: ret = FBMsg.wms_err() ret['data'] = {"数据不存在": str(row[pathname])} return Response(ret) os.remove(filename) ip = request.META.get('HTTP_X_FORWARDED_FOR') if request.META.get( 'HTTP_X_FORWARDED_FOR') else request.META.get('REMOTE_ADDR') ret = FBMsg.wms_ret() ret['ip'] = ip return Response(ret) else: return Response(FBMsg.err_data())
def create(self, request, pk): qs = self.get_object() if qs.openid != self.request.auth.openid: raise APIException( {"detail": "Cannot update data which not yours"}) else: data = self.request.data if 'bin_name' not in data and 'move_to_bin' not in data: raise APIException({"detail": "Please Enter The Bin Name"}) else: current_bin_detail = binset.objects.filter( openid=self.request.auth.openid, bin_name=str(data['bin_name'])).first() move_to_bin_detail = binset.objects.filter( openid=self.request.auth.openid, bin_name=str(data['move_to_bin'])).first() goods_qty_change = stocklist.objects.filter( openid=self.request.auth.openid, goods_code=str(data['goods_code'])).first() if int(data['move_qty']) <= 0: raise APIException({"detail": "Move QTY Must > 0"}) else: bin_move_qty_res = qs.goods_qty - qs.pick_qty - qs.picked_qty - int( data['move_qty']) if bin_move_qty_res > 0: qs.goods_qty = qs.goods_qty - qs.pick_qty - int( data['move_qty']) if current_bin_detail.bin_property == 'Damage': if move_to_bin_detail.bin_property == 'Damage': pass elif move_to_bin_detail.bin_property == 'Inspection': goods_qty_change.damage_stock = goods_qty_change.damage_stock - int( data['move_qty']) goods_qty_change.inspect_stock = goods_qty_change.inspect_stock + int( data['move_qty']) elif move_to_bin_detail.bin_property == 'Holding': goods_qty_change.damage_stock = goods_qty_change.damage_stock - int( data['move_qty']) goods_qty_change.hold_stock = goods_qty_change.hold_stock + int( data['move_qty']) else: goods_qty_change.damage_stock = goods_qty_change.damage_stock - int( data['move_qty']) goods_qty_change.can_order_stock = goods_qty_change.can_order_stock + int( data['move_qty']) elif current_bin_detail.bin_property == 'Inspection': if move_to_bin_detail.bin_property == 'Damage': goods_qty_change.inspect_stock = goods_qty_change.inspect_stock - int( data['move_qty']) goods_qty_change.damage_stock = goods_qty_change.damage_stock + int( data['move_qty']) elif move_to_bin_detail.bin_property == 'Inspection': pass elif move_to_bin_detail.bin_property == 'Holding': goods_qty_change.inspect_stock = goods_qty_change.inspect_stock - int( data['move_qty']) goods_qty_change.hold_stock = goods_qty_change.hold_stock + int( data['move_qty']) else: goods_qty_change.inspect_stock = goods_qty_change.inspect_stock - int( data['move_qty']) goods_qty_change.can_order_stock = goods_qty_change.can_order_stock + int( data['move_qty']) elif current_bin_detail.bin_property == 'Holding': if move_to_bin_detail.bin_property == 'Damage': goods_qty_change.hold_stock = goods_qty_change.hold_stock - int( data['move_qty']) goods_qty_change.damage_stock = goods_qty_change.damage_stock + int( data['move_qty']) elif move_to_bin_detail.bin_property == 'Inspection': goods_qty_change.hold_stock = goods_qty_change.hold_stock - int( data['move_qty']) goods_qty_change.inspect_stock = goods_qty_change.inspect_stock + int( data['move_qty']) elif move_to_bin_detail.bin_property == 'Holding': pass else: goods_qty_change.hold_stock = goods_qty_change.hold_stock - int( data['move_qty']) goods_qty_change.can_order_stock = goods_qty_change.can_order_stock + int( data['move_qty']) else: if move_to_bin_detail.bin_property == 'Damage': goods_qty_change.can_order_stock = goods_qty_change.can_order_stock - int( data['move_qty']) goods_qty_change.damage_stock = goods_qty_change.damage_stock + int( data['move_qty']) elif move_to_bin_detail.bin_property == 'Inspection': goods_qty_change.can_order_stock = goods_qty_change.can_order_stock - int( data['move_qty']) goods_qty_change.inspect_stock = goods_qty_change.inspect_stock + int( data['move_qty']) elif move_to_bin_detail.bin_property == 'Holding': goods_qty_change.can_order_stock = goods_qty_change.can_order_stock - int( data['move_qty']) goods_qty_change.hold_stock = goods_qty_change.hold_stock + int( data['move_qty']) else: pass StockBinModel.objects.create( openid=self.request.auth.openid, bin_name=str(data['move_to_bin']), goods_code=str(data['goods_code']), goods_desc=goods_qty_change.goods_desc, goods_qty=int(data['move_qty']), bin_size=move_to_bin_detail.bin_size, bin_property=move_to_bin_detail.bin_property, t_code=Md5.md5(str(data['goods_code'])), create_time=qs.create_time) if move_to_bin_detail.empty_label == True: move_to_bin_detail.empty_label = False move_to_bin_detail.save() goods_qty_change.save() qs.save() elif bin_move_qty_res == 0: qs.goods_qty = qs.picked_qty if current_bin_detail.bin_property == 'Damage': if move_to_bin_detail.bin_property == 'Damage': pass elif move_to_bin_detail.bin_property == 'Inspection': goods_qty_change.damage_stock = goods_qty_change.damage_stock - int( data['move_qty']) goods_qty_change.inspect_stock = goods_qty_change.inspect_stock + int( data['move_qty']) elif move_to_bin_detail.bin_property == 'Holding': goods_qty_change.damage_stock = goods_qty_change.damage_stock - int( data['move_qty']) goods_qty_change.hold_stock = goods_qty_change.hold_stock + int( data['move_qty']) else: goods_qty_change.damage_stock = goods_qty_change.damage_stock - int( data['move_qty']) goods_qty_change.can_order_stock = goods_qty_change.can_order_stock + int( data['move_qty']) elif current_bin_detail.bin_property == 'Inspection': if move_to_bin_detail.bin_property == 'Damage': goods_qty_change.inspect_stock = goods_qty_change.inspect_stock - int( data['move_qty']) goods_qty_change.damage_stock = goods_qty_change.damage_stock + int( data['move_qty']) elif move_to_bin_detail.bin_property == 'Inspection': pass elif move_to_bin_detail.bin_property == 'Holding': goods_qty_change.inspect_stock = goods_qty_change.inspect_stock - int( data['move_qty']) goods_qty_change.hold_stock = goods_qty_change.hold_stock + int( data['move_qty']) else: goods_qty_change.inspect_stock = goods_qty_change.inspect_stock - int( data['move_qty']) goods_qty_change.can_order_stock = goods_qty_change.can_order_stock + int( data['move_qty']) elif current_bin_detail.bin_property == 'Holding': if move_to_bin_detail.bin_property == 'Damage': goods_qty_change.hold_stock = goods_qty_change.hold_stock - int( data['move_qty']) goods_qty_change.damage_stock = goods_qty_change.damage_stock + int( data['move_qty']) elif move_to_bin_detail.bin_property == 'Inspection': goods_qty_change.hold_stock = goods_qty_change.hold_stock - int( data['move_qty']) goods_qty_change.inspect_stock = goods_qty_change.inspect_stock + int( data['move_qty']) elif move_to_bin_detail.bin_property == 'Holding': pass else: goods_qty_change.hold_stock = goods_qty_change.hold_stock - int( data['move_qty']) goods_qty_change.can_order_stock = goods_qty_change.can_order_stock + int( data['move_qty']) else: if move_to_bin_detail.bin_property == 'Damage': goods_qty_change.can_order_stock = goods_qty_change.can_order_stock - int( data['move_qty']) goods_qty_change.damage_stock = goods_qty_change.damage_stock + int( data['move_qty']) elif move_to_bin_detail.bin_property == 'Inspection': goods_qty_change.can_order_stock = goods_qty_change.can_order_stock - int( data['move_qty']) goods_qty_change.inspect_stock = goods_qty_change.inspect_stock + int( data['move_qty']) elif move_to_bin_detail.bin_property == 'Holding': goods_qty_change.can_order_stock = goods_qty_change.can_order_stock - int( data['move_qty']) goods_qty_change.hold_stock = goods_qty_change.hold_stock + int( data['move_qty']) else: pass StockBinModel.objects.create( openid=self.request.auth.openid, bin_name=str(data['move_to_bin']), goods_code=str(data['goods_code']), goods_desc=goods_qty_change.goods_desc, goods_qty=int(data['move_qty']), bin_size=move_to_bin_detail.bin_size, bin_property=move_to_bin_detail.bin_property, t_code=Md5.md5(str(data['goods_code'])), create_time=qs.create_time) if move_to_bin_detail.empty_label == True: move_to_bin_detail.empty_label = False move_to_bin_detail.save() goods_qty_change.save() if qs.goods_qty == 0: qs.delete() else: qs.save() if StockBinModel.objects.filter( openid=self.request.auth.openid, bin_name=str(data['bin_name'])).exists(): pass else: current_bin_detail.empty_label = True current_bin_detail.save() elif bin_move_qty_res < 0: raise APIException( {"detail": "Move Qty must < Bin Goods Qty"}) else: pass headers = self.get_success_headers(data) return Response(data, status=200, headers=headers)
def allow_request(self, request, view): if request.path == "/docs/": return True else: if request.method == "GET": openid = request.auth if Users.objects.filter(openid=openid, is_delete=0).exists(): user = Users.objects.get(openid=openid) ip = request.META.get('REMOTE_ADDR') transaction_code = Md5.md5(openid + ip) ctime = timezone.now() - timezone.timedelta(seconds=86400) throttle_ctimelist = Throttle.objects.filter( mode="get", throttle_create_time__lte=ctime) for i in throttle_ctimelist: i.delete() throttle_allocationlist = Throttle.objects.filter( mode="get", appid=user.appid).order_by('throttle_create_time') Throttle.objects.create(openid=user.openid, appid=user.appid, ip_address=ip, mode="get", transaction_code=transaction_code) throttle_data = Throttle.objects.get( transaction_code=transaction_code) allocation_seconds_balance = ( throttle_data.throttle_create_time - throttle_allocationlist.first().throttle_create_time ).seconds data["visit_check"] = throttle_allocationlist.first( ).throttle_create_time if user.vip == 0: if allocation_seconds_balance >= 86400: throttle_allocationlist.first().delete() return True else: if throttle_allocationlist.count() <= 100000: return True else: throttle_data.delete() return False elif user.vip == 1: if allocation_seconds_balance >= 86400: throttle_allocationlist.first().delete() return True else: if throttle_allocationlist.count() <= 1000: return True else: throttle_data.delete() return False elif user.vip == 2: if allocation_seconds_balance >= 86400: throttle_allocationlist.first().delete() return True else: if throttle_allocationlist.count() <= 5000: return True else: throttle_data.delete() return False elif user.vip == 3: if allocation_seconds_balance >= 86400: throttle_allocationlist.first().delete() return True else: if throttle_allocationlist.count() <= 20000: return True else: throttle_data.delete() return False elif user.vip == 9: return True else: return False else: return False elif request.method == "POST": return True elif request.method == "PATCH": return True elif request.method == "DELETE": return True elif request.method == "PUT": return True else: return True
def post(self, request, *args, **kwargs): global aut1, aut2 vip_id = Users.objects.filter(appid=request.user.appid, developer=1, is_delete=0).first().vip vip_check = VipCheck.VipCheck(vip_id) if vip_check == "N": return Response(FBMsg.wms_vip()) elif vip_check == "Y": data = DataSolve.datasolve(request) try: if data['code'] == "1031": return Response(FBMsg.err_bad()) except: if UserAuth.objects.filter(appid=request.user.appid, name=data['name'], is_delete=0).exists(): ret = FBMsg.wms_same() ret['data'] = data return Response(ret) else: create_name = Users.objects.filter( openid=request.auth, appid=request.user.appid, is_delete=0).first().name if 'aut1' in data: if str(data['aut1']) == "1": aut1 = 1 else: aut1 = 0 else: aut1 = 0 if 'aut2' in data: if str(data['aut2']) == "1": aut2 = 1 else: aut2 = 0 else: aut2 = 0 if 'aut3' in data: if str(data['aut3']) == "1": aut3 = 1 else: aut3 = 0 else: aut3 = 0 if 'aut4' in data: if str(data['aut4']) == "1": aut4 = 1 else: aut4 = 0 else: aut4 = 0 if 'aut5' in data: if str(data['aut5']) == "1": aut5 = 1 else: aut5 = 0 else: aut5 = 0 if 'aut6' in data: if str(data['aut6']) == "1": aut6 = 1 else: aut6 = 0 else: aut6 = 0 if 'aut7' in data: if str(data['aut7']) == "1": aut7 = 1 else: aut7 = 0 else: aut7 = 0 if 'aut8' in data: if str(data['aut8']) == "1": aut8 = 1 else: aut8 = 0 else: aut8 = 0 if 'aut9' in data: if str(data['aut9']) == "1": aut9 = 1 else: aut9 = 0 else: aut9 = 0 if 'aut10' in data: if str(data['aut10']) == "1": aut10 = 1 else: aut10 = 0 else: aut10 = 0 if 'aut11' in data: if str(data['aut11']) == "1": aut11 = 1 else: aut11 = 0 else: aut11 = 0 if 'aut12' in data: if str(data['aut12']) == "1": aut12 = 1 else: aut12 = 0 else: aut12 = 0 if 'aut13' in data: if str(data['aut13']) == "1": aut13 = 1 else: aut13 = 0 else: aut13 = 0 if 'aut14' in data: if str(data['aut14']) == "1": aut14 = 1 else: aut14 = 0 else: aut14 = 0 if 'aut15' in data: if str(data['aut15']) == "1": aut15 = 1 else: aut15 = 0 else: aut15 = 0 if 'aut16' in data: if str(data['aut16']) == "1": aut16 = 1 else: aut16 = 0 else: aut16 = 0 if 'aut17' in data: if str(data['aut17']) == "1": aut17 = 1 else: aut17 = 0 else: aut17 = 0 if 'aut18' in data: if str(data['aut18']) == "1": aut18 = 1 else: aut18 = 0 else: aut18 = 0 if 'aut19' in data: if str(data['aut19']) == "1": aut19 = 1 else: aut19 = 0 else: aut19 = 0 if 'aut20' in data: if str(data['aut20']) == "1": aut20 = 1 else: aut20 = 0 else: aut20 = 0 UserAuth.objects.create(appid=request.user.appid, name=str(data['name']), create_name=create_name, t_code=Md5.md5(str(data['name'])), aut1=aut1, aut2=aut2, aut3=aut3, aut4=aut4, aut5=aut5, aut6=aut6, aut7=aut7, aut8=aut8, aut9=aut9, aut10=aut10, aut11=aut11, aut12=aut12, aut13=aut13, aut14=aut14, aut15=aut15, aut16=aut16, aut17=aut17, aut18=aut18, aut19=aut19, aut20=aut20) ip = request.META.get( 'HTTP_X_FORWARDED_FOR') if request.META.get( 'HTTP_X_FORWARDED_FOR') else request.META.get( 'REMOTE_ADDR') ret = FBMsg.wms_ret() ret['ip'] = ip ret['data'] = data return Response(ret) else: return Response(FBMsg.wms_vip())
def allow_request(self, request, view): ip = request.META.get('HTTP_X_FORWARDED_FOR') if request.META.get( 'HTTP_X_FORWARDED_FOR') else request.META.get('REMOTE_ADDR') openid = request.auth.openid appid = request.auth.appid if request.method.lower() == "get": ntime = timezone.now() ctime = ntime - timezone.timedelta(seconds=1) throttle_ctimelist = ListModel.objects.filter( method="get", create_time__lte=ctime) for i in throttle_ctimelist: i.delete() t_code = Md5.md5(ip) throttle_allocationlist = ListModel.objects.filter( openid=openid, appid=appid, ip=ip, method='get').order_by('id') throttle_count = throttle_allocationlist.count() if throttle_count == 0: ListModel.objects.create(openid=openid, appid=appid, ip=ip, method="get", t_code=t_code) return True else: throttle_last_create_time = throttle_allocationlist.first( ).create_time ListModel.objects.create(openid=openid, appid=appid, ip=ip, method="get", t_code=t_code) allocation_seconds_balance = ( ntime - throttle_last_create_time).seconds data["visit_check"] = throttle_last_create_time if allocation_seconds_balance >= 1: return True else: if throttle_count >= 5: return False else: return True elif request.method.lower() == "post": ntime = timezone.now() ctime = ntime - timezone.timedelta(seconds=1) throttle_ctimelist = ListModel.objects.filter( method="post", create_time__lte=ctime) for i in throttle_ctimelist: i.delete() t_code = Md5.md5(ip) throttle_allocationlist = ListModel.objects.filter( openid=openid, appid=appid, ip=ip, method='post').order_by('id') throttle_count = throttle_allocationlist.count() if throttle_count == 0: ListModel.objects.create(openid=openid, appid=appid, ip=ip, method="post", t_code=t_code) return True else: throttle_last_create_time = throttle_allocationlist.first( ).create_time ListModel.objects.create(openid=openid, appid=appid, ip=ip, method="post", t_code=t_code) allocation_seconds_balance = ( ntime - throttle_last_create_time).seconds data["visit_check"] = throttle_last_create_time if allocation_seconds_balance >= 1: return True else: if throttle_count >= 4: return False else: return True elif request.method.lower() == "put": ntime = timezone.now() ctime = ntime - timezone.timedelta(seconds=1) throttle_ctimelist = ListModel.objects.filter( method="put", create_time__lte=ctime) for i in throttle_ctimelist: i.delete() t_code = Md5.md5(ip) throttle_allocationlist = ListModel.objects.filter( openid=openid, appid=appid, ip=ip, method='put').order_by('id') throttle_count = throttle_allocationlist.count() if throttle_count == 0: ListModel.objects.create(openid=openid, appid=appid, ip=ip, method="put", t_code=t_code) return True else: throttle_last_create_time = throttle_allocationlist.first( ).create_time ListModel.objects.create(openid=openid, appid=appid, ip=ip, method="put", t_code=t_code) allocation_seconds_balance = ( ntime - throttle_last_create_time).seconds data["visit_check"] = throttle_last_create_time if allocation_seconds_balance >= 1: return True else: if throttle_count >= 4: return False else: return True elif request.method.lower() == "patch": ntime = timezone.now() ctime = ntime - timezone.timedelta(seconds=1) throttle_ctimelist = ListModel.objects.filter( method="patch", create_time__lte=ctime) for i in throttle_ctimelist: i.delete() t_code = Md5.md5(ip) throttle_allocationlist = ListModel.objects.filter( openid=openid, appid=appid, ip=ip, method='patch').order_by('id') throttle_count = throttle_allocationlist.count() if throttle_count == 0: ListModel.objects.create(openid=openid, appid=appid, ip=ip, method="patch", t_code=t_code) return True else: throttle_last_create_time = throttle_allocationlist.first( ).create_time ListModel.objects.create(openid=openid, appid=appid, ip=ip, method="patch", t_code=t_code) allocation_seconds_balance = ( ntime - throttle_last_create_time).seconds data["visit_check"] = throttle_last_create_time if allocation_seconds_balance >= 1: return True else: if throttle_count >= 4: return False else: return True elif request.method.lower() == "delete": ntime = timezone.now() ctime = ntime - timezone.timedelta(seconds=1) throttle_ctimelist = ListModel.objects.filter( method="delete", create_time__lte=ctime) for i in throttle_ctimelist: i.delete() t_code = Md5.md5(ip) throttle_allocationlist = ListModel.objects.filter( openid=openid, appid=appid, ip=ip, method='delete').order_by('id') throttle_count = throttle_allocationlist.count() if throttle_count == 0: ListModel.objects.create(openid=openid, appid=appid, ip=ip, method="delete", t_code=t_code) return True else: throttle_last_create_time = throttle_allocationlist.first( ).create_time ListModel.objects.create(openid=openid, appid=appid, ip=ip, method="delete", t_code=t_code) allocation_seconds_balance = ( ntime - throttle_last_create_time).seconds data["visit_check"] = throttle_last_create_time if allocation_seconds_balance >= 1: return True else: if throttle_count >= 3: return False else: return True else: return False
def post(self, request, *args, **kwargs): vip_id = Users.objects.filter(appid=request.user.appid, developer=1, is_delete=0).first().vip vip_check = VipCheck.VipCheck(vip_id) if vip_check == "N": return Response(FBMsg.wms_vip()) elif vip_check == "Y": data = DataSolve.datasolve(request) try: if data['code'] == "1031": return Response(FBMsg.err_bad()) except: if DetailModel.objects.filter(appid=request.user.appid, t_code=str(data[0]['t_code']), is_delete=0).exists(): up_data = DetailModel.objects.filter( t_code=str(data[0]['t_code'])).first() bin_data = binset.models.ListModel.objects.filter( appid=request.user.appid, name=str(data[0]['bin']), is_delete=0).first() property_data = property.models.ListModel.objects.filter( appid=request.user.appid, name=bin_data.bin_property).first() up_data.up_qty = up_data.up_qty - int( data[0]['finish_qty']) goods_stock = stocklist.models.ListModel.objects.filter( appid=request.user.appid, name=up_data.goods_code, goods_name=up_data.goods_name, ).first() if property_data.property_code == 1: up_data.actual_up_qty = up_data.actual_up_qty - int( data[0]['finish_qty']) goods_stock.onhand_stock = goods_stock.onhand_stock + int( data[0]['finish_qty']) goods_stock.can_order_stock = goods_stock.can_order_stock + int( data[0]['finish_qty']) goods_stock.sort_stock = goods_stock.sort_stock - int( data[0]['finish_qty']) if up_data.up_qty > 0: if up_data.actual_up_qty >= 0: up_data.save() goods_stock.save() bin_data.bin_empty = 1 bin_data.save() stockbinlist.models.ListModel.objects.create( appid=request.user.appid, name=str(data[0]['bin']), goods_code=up_data.goods_code, goods_name=up_data.goods_name, goods_qty=int(data[0]['finish_qty']), can_order_stock=int(data[0]['finish_qty']), bin_property=bin_data.bin_property, bin_size=bin_data.bin_size, po_name=up_data.name, t_code=Md5.md5(data[0]['t_code'])) else: ret = FBMsg.wms_po_qty_up_more() ret['data'] = data return Response(ret) elif up_data.up_qty == 0: if up_data.actual_up_qty >= 0: up_data.save() goods_stock.save() bin_data.bin_empty = 1 bin_data.save() stockbinlist.models.ListModel.objects.create( appid=request.user.appid, name=str(data[0]['bin']), goods_code=up_data.goods_code, goods_name=up_data.goods_name, goods_qty=int(data[0]['finish_qty']), can_order_stock=int(data[0]['finish_qty']), bin_property=bin_data.bin_property, bin_size=bin_data.bin_size, po_name=up_data.name, t_code=Md5.md5(data[0]['t_code'])) if DetailModel.objects.filter( appid=request.user.appid, name=up_data.name, up_qty__gt=0, is_delete=0).exists(): pass else: po_detail_status = DetailModel.objects.filter( appid=request.user.appid, name=up_data.name, is_delete=0) po_list_status = ListModel.objects.filter( appid=request.user.appid, name=up_data.name, is_delete=0).first() for i in range(len(po_detail_status)): po_detail_status[i].po_status = 5 po_detail_status[i].save() po_list_status.po_status = 5 po_list_status.save() else: ret = FBMsg.wms_po_qty_up_more() ret['data'] = data return Response(ret) else: ret = FBMsg.wms_po_qty_all_up_more() ret['data'] = data return Response(ret) elif property_data.property_code == 4: up_data.damage_up_qty = up_data.damage_up_qty - int( data[0]['finish_qty']) goods_stock.damage_stock = goods_stock.damage_stock + int( data[0]['finish_qty']) if up_data.up_qty > 0: if up_data.damage_up_qty >= 0: up_data.save() goods_stock.save() bin_data.bin_empty = 1 bin_data.save() stockbinlist.models.ListModel.objects.create( appid=request.user.appid, name=str(data[0]['bin']), goods_code=up_data.goods_code, goods_name=up_data.goods_name, goods_qty=int(data[0]['finish_qty']), bin_property=bin_data.bin_property, bin_size=bin_data.bin_size, po_name=up_data.name, t_code=Md5.md5(data[0]['t_code'])) else: ret = FBMsg.wms_po_qty_dup_more() ret['data'] = data return Response(ret) elif up_data.up_qty == 0: if up_data.damage_up_qty >= 0: up_data.save() goods_stock.save() bin_data.bin_empty = 1 bin_data.save() stockbinlist.models.ListModel.objects.create( appid=request.user.appid, name=str(data[0]['bin']), goods_code=up_data.goods_code, goods_name=up_data.goods_name, goods_qty=int(data[0]['finish_qty']), bin_property=bin_data.bin_property, bin_size=bin_data.bin_size, po_name=up_data.name, t_code=Md5.md5(data[0]['t_code'])) if DetailModel.objects.filter( appid=request.user.appid, name=up_data.name, up_qty__gt=0, is_delete=0).exists(): pass else: po_detail_status = DetailModel.objects.filter( appid=request.user.appid, name=up_data.name, is_delete=0) po_list_status = ListModel.objects.filter( appid=request.user.appid, name=up_data.name, is_delete=0).first() for i in range(len(po_detail_status)): po_detail_status[i].po_status = 5 po_detail_status[i].save() po_list_status.po_status = 5 po_list_status.save() else: ret = FBMsg.wms_po_qty_dup_more() ret['data'] = data return Response(ret) else: ret = FBMsg.wms_po_qty_all_up_more() ret['data'] = data return Response(ret) else: ret = FBMsg.wms_po_empty() ret['data'] = data return Response(ret) ip = request.META.get( 'HTTP_X_FORWARDED_FOR') if request.META.get( 'HTTP_X_FORWARDED_FOR') else request.META.get( 'REMOTE_ADDR') ret = FBMsg.wms_ret() ret['ip'] = ip ret['data'] = data return Response(ret) else: return Response(FBMsg.wms_vip())
def scan(self): sdkinfo.sdk_md5 = Md5.md5_file(sdkinfo.sdk_path) self.get_info() self.get_soname() self.get_other_libs()