Example #1
0
def fill_storage_out(request):
	storage_out_id = request.POST.get('storage_out_id', None)
	total_fee_sum = request.POST.get('total_fee_sum', None)	
	customer = request.POST.get('customer', None)			
	create_time = request.POST.get('create_time', None)
	deliveryman = request.POST.get('deliveryman', None)	
	storeman = request.POST.get('storeman', None)			
	col1 = request.POST.get('col1', None)
	col2 = request.POST.get('col2', None)
	col3 = request.POST.get('col3', None)
	col4 = request.POST.get('col4', None)
	col5 = request.POST.get('col5', None)
	col6 = request.POST.get('col6', None)
	col7 = request.POST.get('col7', None)
	r=Storage_material.objects.filter(material_name=col1)
	if not r:
		return comutils.baseresponse('没有该种原料', 500)
	try:
		q = Storage_out(create_time=create_time,
				deliveryman=deliveryman,
				storeman=storeman,
				storage_out_id=storage_out_id,
				customer=customer,
				total_fee_sum=total_fee_sum,
				material_name=col1,
				size=col2,
				buyer=col3,	
				amount=col4,
				price=col5,
				total_fee=col6,
				notes=col7)
		q.save()
	except Exception, e:
		return comutils.baseresponse('system error', 500)
Example #2
0
def modify_password(request):
	phone = request.POST.get('phone', None)
	password = request.POST.get('old_password', None)
	new_password = request.POST.get('new_password', None)
	user=User.objects.filter(phone=phone)[0]
	if not user:
		return comutils.baseresponse('用户不存在', 404)
	if password != user.signin_passwd:
		return comutils.baseresponse('密码不正确', 404)
	user.signin_passwd=new_password
	return HttpResponse(json.dumps(1))
Example #3
0
def fill_multiple(request):
	productID = request.POST.get('productID', None)
	col1 = request.POST.get('col1', None)
	col2 = request.POST.get('col2', None)
	col3 = request.POST.get('col3', None)
	col4 = request.POST.get('col4', None)
	col5 = request.POST.get('col5', None)
	col6 = request.POST.get('col6', None)
	col7 = request.POST.get('col7', None)
	col8 = request.POST.get('col8', None)
	customer = request.POST.get('customer', None)
	create_time = request.POST.get('create_time', None)
	product_name2 = request.POST.get('product_name2', None)

	try:
		q = Purchase_multiple(productID=productID,
				product_name=col1,
				price=col2,
				amount=col3,	
				total_fee=col4,
				suppliers=col5,
				contacts=col6,
				contacts_phone=col7,      
				notes=col8,
				customer=customer,
				create_time=create_time,
				product_name2=product_name2)
		q.save()
	except Exception, e:
		return comutils.baseresponse('system error', 500)
Example #4
0
def fill_storage_in(request):
	storage_in_id = request.POST.get('storage_in_id', None)
	total_fee_sum = request.POST.get('total_fee_sum', None)	
	supplier = request.POST.get('supplier', None)			
	create_time = request.POST.get('create_time', None)
	deliveryman = request.POST.get('deliveryman', None)	
	storeman = request.POST.get('storeman', None)			
	col1 = request.POST.get('col1', None)
	col2 = request.POST.get('col2', None)
	col3 = request.POST.get('col3', None)
	col4 = request.POST.get('col4', None)
	col5 = request.POST.get('col5', None)
	col6 = request.POST.get('col6', None)
	col7 = request.POST.get('col7', None)
	try:
		q = Storage_in(create_time=create_time,
				deliveryman=deliveryman,
				storeman=storeman,
				storage_in_id=storage_in_id,
				supplier=supplier,
				total_fee_sum=total_fee_sum,
				material_name=col1,
				size=col2,
				seller=col3,	
				amount=col4,
				price=col5,
				total_fee=col6,
				notes=col7)
		q.save()
	except Exception, e:
		return comutils.baseresponse('system error', 500)
Example #5
0
def signin(request):

	phone = request.POST.get('phone', None)
	password = request.POST.get('password', None)

	try:
		userlist = User.objects.filter(phone=phone)
	except Exception, e:
		return comutils.baseresponse('system error', 500)
Example #6
0
def modify_worker(request):
	col1 = request.POST.get('col1', None)
	col2 = request.POST.get('col2', None)
	col3 = request.POST.get('col3', None)
	col4 = request.POST.get('col4', None)
	col5 = request.POST.get('col5', None)
	col6 = request.POST.get('col6', None)
	col7 = request.POST.get('col7', None)
	id=request.POST.get('id', None)
	try:
		Worker.objects.filter(id=id).update(worker_name=col1,product_name=col2,pipline_step=col3,count=col4,salary=col5,create_time=col6,notes=col7)
	except Exception, e:
		return comutils.baseresponse(e, 500)
Example #7
0
def fill_single_list(request):
	productID = request.POST.get('productID', None)
	customer = request.POST.get('customer', None)
	create_time = request.POST.get('create_time', None)
	try:
		q = Purchase(productID=productID,
				customer = customer,
				process_step=1,
				product_name=Process.objects.filter(productID=productID)[0].product_name,
				create_time=create_time)
		q.save()
	except Exception, e:
		return comutils.baseresponse("system error", 500)
Example #8
0
def modify_storage(request):
	id = request.POST.get('id', None)
	product_name = request.POST.get('product_name', None)	
	size = request.POST.get('size', None)			
	amount = request.POST.get('amount', None)
	in_time = request.POST.get('in_time', None)
	out_time = request.POST.get('out_time', None)
	customer = request.POST.get('customer', None)
	notes = request.POST.get('notes', None)
	try:
		Storage.objects.filter(id=id).update(customer=customer,product_name=product_name,size=size,amount=amount,in_time=in_time,out_time=out_time,notes=notes)
	except Exception, e:
		return comutils.baseresponse(e, 500)
Example #9
0
def get_process_info(request):
	productID = request.POST.get('productID', None)
	try:
		r = Process.objects.filter(productID=productID)[0]
		b={}
		b[0]=r.productID
		b[1]=r.product_name
		b[2]=r.customer
		b[3]=r.amount
		b[4]=r.create_time
		b[5]=r.deadline
	except Exception, e:
		return comutils.baseresponse('system error', 500)
Example #10
0
def modify_tracking(request):
	col1 = request.POST.get('col1', None)
	col2 = request.POST.get('col2', None)
	col3 = request.POST.get('col3', None)
	col4 = request.POST.get('col4', None)
	col6 = request.POST.get('col6', None)
	col7 = request.POST.get('col7', None)
	col8 = request.POST.get('col8', None)
	id=request.POST.get('id', None)
	try:
		Tracking.objects.filter(id=id).update(product_name=col1,customer=col2,state=col3,pipline_step=col4,create_time=col6,deadline=col7,notes=col8)
	except Exception, e:
		return comutils.baseresponse('system error', 500)
Example #11
0
def fill_multiple_list(request):
	productID = request.POST.get('productID', None)
	customer = request.POST.get('customer', None)
	create_time = request.POST.get('create_time', None)
	product_name2 = request.POST.get('product_name2', None)
	try:
		q = Purchase(productID=productID,
				customer = customer,
				product_name=product_name2,	
				process_step=2,
				create_time=create_time)
		q.save()
	except Exception, e:
		return comutils.baseresponse("system error", 500)
Example #12
0
def modify_finance(request):
	col1 = request.POST.get('col1', None)
	col2 = request.POST.get('col2', None)
	col3 = request.POST.get('col3', None)
	col4 = request.POST.get('col4', None)
	col5 = request.POST.get('col5', None)
	col6 = request.POST.get('col6', None)
	col7 = request.POST.get('col7', None)
	col8 = request.POST.get('col8', None)
	col9 = request.POST.get('col9', None)
	id=request.POST.get('id', None)
	try:
		Finance.objects.filter(id=id).update(delivery_time=col1,productID=col2,product_name=col3,order_amount=col4,delivery_amount=col5,price=col6,total_fee=col7,notes=col8,customer=col9)
	except Exception, e:
		return comutils.baseresponse('system error', 500)
Example #13
0
def modify_material(request):
	material_name = request.POST.get('material', None)
	size = request.POST.get('size', None)
	seller = request.POST.get('seller', None)
	amount = request.POST.get('amount', None)
	price = request.POST.get('price', None)
	total_fee = request.POST.get('total_fee', None)	
	notes = request.POST.get('notes', None)			
	in_time = request.POST.get('in_time', None)
	out_time = request.POST.get('out_time', None)
	id = request.POST.get('id', None)
	try:
		Storage_material.objects.filter(id=id).update(material_name=material_name,size=size,seller=seller,amount=amount,price=price,total_fee=total_fee,notes=notes,in_time=in_time,out_time=out_time)
	except Exception, e:
		return comutils.baseresponse(e, 500)
Example #14
0
def modify_supplier(request):
	col1 = request.POST.get('col1', None)
	col2 = request.POST.get('col2', None)
	col3 = request.POST.get('col3', None)
	col4 = request.POST.get('col4', None)
	col5 = request.POST.get('col5', None)
	col6 = request.POST.get('col6', None)
	col7 = request.POST.get('col7', None)
	col8 = request.POST.get('col8', None)
	col9 = request.POST.get('col9', None)
	id=request.POST.get('id', None)
	try:
		Supplier.objects.filter(id=id).update(suppliers=col1,contacts=col2,contacts_phone=col3,material_name=col4,amount=col5,price=col6,total_fee=col7,create_time=col8,notes=col9)
	except Exception, e:
		return comutils.baseresponse('system error', 500)
Example #15
0
def get_workerdetails_by_ID(request):
	id = request.POST.get('id', None)
	try:
		r = Worker.objects.filter(id=id)[0]
		b={}
		b[0]=r.worker_name
		b[1]=r.product_name
		b[2]=r.pipline_step
		b[3]=r.count
		b[4]=r.salary
		b[5]=r.create_time.strftime('%Y-%m-%d')
		b[6]=r.notes
		b[7]=r.id
	except Exception, e:
		return comutils.baseresponse('system error', 500)
Example #16
0
def get_details_by_ID(request):
	id = request.POST.get('id', None)
	try:
		r = Tracking.objects.filter(id=id)[0]
		b={}
		b[0]=r.product_name
		b[1]=r.customer
		b[2]=r.state
		b[3]=r.pipline_step		
		b[4]=r.create_time
		b[5]=r.deadline
		b[6]=r.notes	
		b[7]=r.productID
		b[8]=r.id
	except Exception, e:
		return comutils.baseresponse('system error', 500)
Example #17
0
def get_customerdetails_by_piplineID(request):
	id = request.POST.get('id', None)
	try:
		r = Customer.objects.filter(id=id)[0]
		b={}
		b[0]=r.customers
		b[1]=r.contacts
		b[2]=r.contacts_phone
		b[3]=r.product_name
		b[4]=r.amount
		b[5]=r.price
		b[6]=r.total_fee
		b[7]=r.create_time
		b[8]=r.notes
		b[9]=r.id
	except Exception, e:
		return comutils.baseresponse('system error', 500)
Example #18
0
def get_details_by_ID(request):
	id = request.POST.get('id', None)
	try:
		r = Finance.objects.filter(id=id)[0]
		b={}
		b[0]=r.delivery_time
		b[1]=r.productID
		b[2]=r.product_name
		b[3]=r.order_amount
		b[4]=r.delivery_amount
		b[5]=r.price
		b[6]=r.total_fee
		b[7]=r.notes
		b[8]=r.id
		b[9]=r.customer
	except Exception, e:
		return comutils.baseresponse('system error', 500)
Example #19
0
def get_supplierdetails_by_piplineID(request):
	id = request.POST.get('id', None)
	try:
		r = Supplier.objects.filter(id=id)[0]
		b={}
		b[0]=r.suppliers
		b[1]=r.contacts
		b[2]=r.contacts_phone
		b[3]=r.material_name
		b[4]=r.amount
		b[5]=r.price
		b[6]=r.total_fee
		b[7]=r.create_time.strftime('%Y-%m-%d')
		b[8]=r.notes
		b[9]=r.id
		print b
	except Exception, e:
		return comutils.baseresponse('system error', 500)
Example #20
0
def modify_storage_out(request):
	storage_out_id = request.POST.get('storage_out_id', None)
	create_time = request.POST.get('create_time', None)
	customer = request.POST.get('customer', None)
	material_name = request.POST.get('material_name', None)
	size = request.POST.get('size', None)
	buyer = request.POST.get('buyer', None)
	amount = request.POST.get('amount', None)
	price = request.POST.get('price', None)
	total_fee = request.POST.get('total_fee', None)	
	notes = request.POST.get('notes', None)			
	total_fee_sum = request.POST.get('total_fee_sum', None)
	deliveryman = request.POST.get('deliveryman', None)
	storeman = request.POST.get('storeman', None)
	id = request.POST.get('id', None)
	try:
		Storage_out.objects.filter(id=id).update(create_time=create_time,customer=customer,material_name=material_name,size=size,buyer=buyer,amount=amount,price=price,total_fee=total_fee,notes=notes,total_fee_sum=total_fee_sum,deliveryman=deliveryman,storeman=storeman)
	except Exception, e:
		return comutils.baseresponse(e, 500)
Example #21
0
def modify_multiple(request):
	productID = request.POST.get('productID', None)
	col1 = request.POST.get('col1', None)
	col2 = request.POST.get('col2', None)
	col3 = request.POST.get('col3', None)
	col4 = request.POST.get('col4', None)
	col5 = request.POST.get('col5', None)
	col6 = request.POST.get('col6', None)
	col7 = request.POST.get('col7', None)
	col8 = request.POST.get('col8', None)
	id = request.POST.get('id', None)
	id2=request.POST.get('id2', None)
	customer = request.POST.get('customer', None)
	create_time = request.POST.get('create_time', None)
	product_name2 = request.POST.get('product_name2', None)
	try:
		q = Purchase.objects.filter(productID=productID).update(customer = customer,
				product_name=product_name2,	
				create_time=create_time)
	except Exception, e:
		return comutils.baseresponse(e, 500)
Example #22
0
def signup(request):

	phone = request.POST.get('phone', None)
	password = request.POST.get('password', None)
	nickname = request.POST.get('nickname', None)
	sexy = request.POST.get('sexy', None)
	qq = request.POST.get('qq', None)
	role = request.POST.get('role', None)
	p1 = request.POST.get('p1', None)
	p2 = request.POST.get('p2', None)
	p3 = request.POST.get('p3', None)
	p4 = request.POST.get('p4', None)
	p5 = request.POST.get('p5', None)
	p6 = request.POST.get('p6', None)
	p7 = request.POST.get('p7', None)
	p8 = request.POST.get('p8', None)
	p9 = request.POST.get('p9', None)
	p10 = request.POST.get('p10', None)

	try:
		user = User(phone = phone,
                nick_name = nickname,
                signin_passwd = password,
                sexy=sexy,
                qq=qq,
                role=role,
                p1=p1,
                p2=p2,
                p3=p3,
                p4=p4,
                p5=p5,
                p6=p6,
                p7=p7,
                p8=p8,
                p9=p9,
                p10=p10)
		user.save()
	except Exception, e:
		return comutils.baseresponse('system error', 500)	
Example #23
0
def modify_single(request):
	productID = request.POST.get('productID', None)	
	customer = request.POST.get('customer', None)
	create_time = request.POST.get('create_time', None)
	product_name = request.POST.get('product_name', None)
	contacts = request.POST.get('contacts', None)
	contacts_phone = request.POST.get('contacts_phone', None)
	fax = request.POST.get('fax', None)	
	size = request.POST.get('size', None)
	amount = request.POST.get('amount', None)
	price = request.POST.get('price', None)
	danwei = request.POST.get('danwei', None)
	fee = request.POST.get('fee', None)
	total_fee = request.POST.get('total_fee', None)
	notes = request.POST.get('notes', None)
	deadline = request.POST.get('deadline', None)
	address = request.POST.get('address', None)
	id = request.POST.get('id', None)
	id2 = request.POST.get('id2', None)
	print id2

	try:
		Purchase_single.objects.filter(id=id).update(customer = customer,
				create_time=create_time,
				product_name=product_name,	
				contacts_phone=contacts_phone,
				contacts=contacts,
				fax=fax,
				size=size,      
				amount=amount,
				price=price,
				danwei=danwei,
				fee=fee,
				total_fee=total_fee,
				notes=notes,
				deadline=deadline,
				address=address)
	except Exception, e:
		return comutils.baseresponse(e, 500)
Example #24
0
def fill_single(request):
	productID = request.POST.get('productID', None)	
	customer = request.POST.get('customer', None)
	create_time = request.POST.get('create_time', None)
	product_name = request.POST.get('product_name', None)
	contacts = request.POST.get('contacts', None)
	contacts_phone = request.POST.get('contacts_phone', None)
	fax = request.POST.get('fax', None)	
	size = request.POST.get('size', None)
	amount = request.POST.get('amount', None)
	price = request.POST.get('price', None)
	danwei = request.POST.get('danwei', None)
	fee = request.POST.get('fee', None)
	total_fee = request.POST.get('total_fee', None)
	notes = request.POST.get('notes', None)
	deadline = request.POST.get('deadline', None)
	address = request.POST.get('address', None)

	try:
		q = Purchase_single(productID=productID,
				customer = customer,
				create_time=create_time,
				product_name=product_name,	
				contacts_phone=contacts_phone,
				contacts=contacts,
				fax=fax,
				size=size,      
				amount=amount,
				price=price,
				danwei=danwei,
				fee=fee,
				total_fee=total_fee,
				notes=notes,
				deadline=deadline,
				address=address)
		q.save()
	except Exception, e:
		return comutils.baseresponse(e, 500)
Example #25
0
def fill_finance(request):
	col1 = request.POST.get('col1', None)
	col2 = request.POST.get('col2', None)
	col3 = request.POST.get('col3', None)
	col4 = request.POST.get('col4', None)
	col5 = request.POST.get('col5', None)
	col6 = request.POST.get('col6', None)
	col7 = request.POST.get('col7', None)
	col8 = request.POST.get('col8', None)
	col9 = request.POST.get('col9', None)
	try:
		q = Finance(delivery_time=col1,
				productID=col2,
				product_name=col3,
				order_amount=col4,	
				delivery_amount=col5,
				price=col6,
				total_fee=col7,
				notes=col8,
				customer=col9)
		q.save()
	except Exception, e:
		return comutils.baseresponse('system error', 500)
Example #26
0
def count_work(request):
	phone = request.POST.get('phone', None)
	worker_name = request.POST.get('worker_name', None)
	productID = request.POST.get('productID', None)
	product_name = request.POST.get('product_name', None)
	pipline_step = request.POST.get('pipline_step', None)
	count = request.POST.get('count', None)
	notes = request.POST.get('notes', None)
	worker_name=User.objects.filter(phone=phone)[0].nick_name
	product_name=Process.objects.filter(productID=productID)[0].product_name

	r=Tracking.objects.filter(productID=productID)
	if r:
		step=r[0].pipline_step
		print step,pipline_step
		processNum = Process.objects.filter(productID=productID)[0].amount
		if(int(step)==0 and int(pipline_step)!=1):
			return comutils.baseresponse('必须从第一步材料到货开始', 500)
		elif((int(pipline_step)==int(step)+1) or int(step)==0):
			if(int(step)==0):
				if(int(count)<int(processNum)):
					return comutils.baseresponse('必须大于施工单上的数目', 500)
			else:
				num = Worker.objects.filter(productID=productID,pipline_step=(int(pipline_step)-1))[0].count
				if((int(count)>int(num)) and (num!=0)):
					return comutils.baseresponse('数目超过可完成总数目', 500)
				elif(int(count)<int(processNum)):
					return comutils.baseresponse('必须大于施工单上的数目', 500)
			Process.objects.filter(productID=productID).update(count_work=pipline_step)
			Tracking.objects.filter(productID=productID).update(pipline_step=pipline_step)
			if(int(pipline_step)<7):
				Tracking.objects.filter(productID=productID).update(state=1)
			else:
				Process.objects.filter(productID=productID).update(finished=2)
				Tracking.objects.filter(productID=productID).update(state=2)
			try:
				p = Worker(productID=productID,workerID=phone,worker_name=worker_name,product_name=product_name,pipline_step=pipline_step,count=count,notes=notes)
				p.save()
			except Exception, e:
				return comutils.baseresponse('写入员工计件表失败', 500)
			return HttpResponse(json.dumps(1))
		else:
			return comutils.baseresponse('没有按流水顺序执行', 500)
Example #27
0
			Tracking.objects.filter(productID=productID).update(pipline_step=pipline_step)
			if(int(pipline_step)<7):
				Tracking.objects.filter(productID=productID).update(state=1)
			else:
				Process.objects.filter(productID=productID).update(finished=2)
				Tracking.objects.filter(productID=productID).update(state=2)
			try:
				p = Worker(productID=productID,workerID=phone,worker_name=worker_name,product_name=product_name,pipline_step=pipline_step,count=count,notes=notes)
				p.save()
			except Exception, e:
				return comutils.baseresponse('写入员工计件表失败', 500)
			return HttpResponse(json.dumps(1))
		else:
			return comutils.baseresponse('没有按流水顺序执行', 500)
	else:
		return comutils.baseresponse('no this productID', 500)
	
@csrf_exempt
def login_in(request):
	phone = request.POST.get('phone', None)
	password = request.POST.get('password', None)
	b={}
	users=User.objects.filter(phone=phone)
	if not users:
		b[0]=0
		b[1]='用户不存在'
	else:
		user=users[0]
		if password != user.signin_passwd:
			b[0]=0
			b[1]='密码错误'
Example #28
0
def delete_user(request):
	id=request.POST.get('id', None)
	try:
		User.objects.filter(id=id).delete()
	except Exception, e:
		return comutils.baseresponse('system error', 500)
Example #29
0
def delete_multiple(request):
	productID = request.POST.get('productID', None)
	try:
		Purchase_multiple.objects.filter(productID=productID).delete()
	except Exception, e:
		return comutils.baseresponse('system error', 500)
Example #30
0
#api
@csrf_exempt
def signin(request):

	phone = request.POST.get('phone', None)
	password = request.POST.get('password', None)

	try:
		userlist = User.objects.filter(phone=phone)
	except Exception, e:
		return comutils.baseresponse('system error', 500)
	
	user=userlist[0]
	
	if not user:
		return comutils.baseresponse('user not found', 404)
	if password != user.signin_passwd:
		return comutils.baseresponse('password is not correct', 400)

	request.session['is_login'] = True
	request.session['pk'] = user.pk
	request.session['phone'] = user.phone
	request.session['nick_name'] = user.nick_name

	return HttpResponse(json.dumps(1))

#api
@csrf_exempt
def signup(request):

	phone = request.POST.get('phone', None)