def PODDispatch_Set(request): if request.method == 'POST': dispatch_dtl = mService.Service_model() jsondata = json.loads(request.body.decode('utf-8')) lst = jsondata.get('dispatch_data') for x in lst: dispatch_dtl.action = x.get('action') dispatch_dtl.type = x.get('type') dispatch_dtl.courier_gid = x.get('courier_gid') dispatch_dtl.Dispatch_date = x.get('Dispatch_date') dispatch_dtl.send_by = x.get('send_by') dispatch_dtl.awbno = x.get('awbno') dispatch_dtl.dispatch_mode = x.get('dispatch_mode') dispatch_dtl.dispatch_type = x.get('dispatch_type') dispatch_dtl.packets = x.get('packets') dispatch_dtl.weight = x.get('weight') dispatch_dtl.dispatch_to = x.get('dispatch_to') dispatch_dtl.address = x.get('address') dispatch_dtl.city = x.get('city') dispatch_dtl.state = x.get('state') dispatch_dtl.pincode = x.get('pincode') dispatch_dtl.remark = x.get('remark') dispatch_dtl.returned = x.get('returned') dispatch_dtl.returned_on = x.get('returned_on') dispatch_dtl.returned_remark = x.get('returned_remark') dispatch_dtl.pod = x.get('pod') dispatch_dtl.pod_image = x.get('pod_image') dispatch_dtl.isactive = x.get('isactive') dispatch_dtl.isremoved = x.get('isremoved') dispatch_dtl.dispatch_gid = x.get('dispatch_gid') dispatch_dtl.entity_gid = request.session['Entity_gid'] dispatch_dtl.employee_gid = request.session['Emp_gid'] Service_out = outputSplit(dispatch_dtl.set_PODDispatch(), 0) return JsonResponse(Service_out, safe=False)
def Get_Dispatch(request): if request.method == 'POST': obj_customer_ddl = mService.Service_model() jsondata = json.loads(request.body.decode('utf-8')) obj_customer_ddl.action = jsondata.get('params').get('action') obj_customer_ddl.entity_gid = request.session['Entity_gid'] df_customer_ddl = obj_customer_ddl.Dispatch_Get() jdata = df_customer_ddl.to_json(orient='records') return JsonResponse(json.loads(jdata), safe=False)
def Producttype(request): if request.method == 'POST': producttype = mService.Service_model() jsondata = json.loads(request.body.decode('utf-8')) producttype.producttype_gid = jsondata.get('params').get( 'producttype_gid') data = producttype.get_producttype() jdata = data.to_json(orient='records') return JsonResponse(jdata, safe=False)
def Repair_set(request): if request.method == 'POST': repair_dtl = mService.Service_model() jsondata = json.loads(request.body.decode('utf-8')) repair_dtl.action = jsondata.get('params').get('action') repair_dtl.SERVICE_JSON = jsondata.get('params').get('service_dtl') repair_dtl.entity_gid = request.session['Entity_gid'] repair_dtl.employee_gid = request.session['Emp_gid'] Repair_out = outputSplit(repair_dtl.set_Repair(), 1) return JsonResponse(Repair_out, safe=False)
def Courier_dtl(request): if request.method == 'POST': Courier_dtl = mService.Service_model() jsondata = json.loads(request.body.decode('utf-8')) Courier_dtl.courier_gid = jsondata.get('params').get('courier_gid') Courier_dtl.courier_name = jsondata.get('params').get('courier_name') Courier_dtl.entity_gid = request.session['Entity_gid'] data = Courier_dtl.get_courier() jdata = data.to_json(orient='records') return JsonResponse(json.loads(jdata), safe=False)
def DispatchPOD_set(request): if request.method == 'POST': service_dtl = mService.Service_model() jsondata = json.loads(request.body.decode('utf-8')) service_dtl.action = 'DISPATCH_STATUS' service_dtl.dispatch_gid = jsondata.get('dispatch_gid') service_dtl.status = 'SERVICE CLOSED' service_dtl.SERVICE_JSON = '{}' service_dtl.entity_gid = request.session['Entity_gid'] service_dtl.employee_gid = request.session['Emp_gid'] Service_out = outputSplit(service_dtl.set_servicedtl(), 0) return JsonResponse(Service_out, safe=False)
def Service_set(request): if request.method == 'POST': service_dtl = mService.Service_model() jsondata = json.loads(request.body.decode('utf-8')) service_dtl.action = jsondata.get('params').get('action') service_dtl.date = jsondata.get('params').get('date') service_dtl.customer_gid = jsondata.get('params').get('customer_gid') service_dtl.status = jsondata.get('params').get('status') service_dtl.SERVICE_JSON = jsondata.get('params').get('SERVICE_JSON') service_dtl.entity_gid = jsondata.get('params').get('entity_gid') service_dtl.employee_gid = jsondata.get('params').get('employee_gid') Service_out = outputSplit(service_dtl.set_servicedtl(), 1) return JsonResponse(Service_out, safe=False)
def customer_detail(request): if request.method == 'POST': obj_customer_ddl = mService.Service_model() jsondata = json.loads(request.body.decode('utf-8')) obj_customer_ddl.customer_gid = jsondata.get('params').get( 'customer_gid') obj_customer_ddl.customer_code = jsondata.get('params').get( 'customer_code') obj_customer_ddl.customer_name = jsondata.get('params').get( 'customer_name') obj_customer_ddl.entity_gid = request.session['Entity_gid'] df_customer_ddl = obj_customer_ddl.get_customer() jdata = df_customer_ddl.to_json(orient='records') return JsonResponse(json.loads(jdata), safe=False)
def employee_get(request): if request.method == 'GET': gid = '' name = '' cluster_gid = '1' all_cluster_gid = 'ALL' executive = '' obj_master = mService.Service_model() obj_master.jsonData = json.dumps({ "entity_gid": [request.session['Entity_gid']], "client_gid": [] }) emp = obj_master.get_employee() emp['emp_gid'] = request.session['Emp_gid'] jdata = emp.to_json(orient='records') return JsonResponse(jdata, safe=False)
def ServiceDtl_get(request): if request.method == 'POST': service_get = mService.Service_model() jsondata = json.loads(request.body.decode('utf-8')) service_get.from_date = jsondata.get('params').get('from_date') service_get.to_date = jsondata.get('params').get('to_date') service_get.customer_gid = jsondata.get('params').get('customer_gid') service_get.product_gid = jsondata.get('params').get('product_gid') service_get.service_gid = jsondata.get('params').get('service_gid') service_get.status = jsondata.get('params').get('status') if 'only_employee' in jsondata.get('params'): service_get.employee_gid = request.session['Emp_gid'] else: service_get.employee_gid = 0 service_get.entity_gid = request.session['Entity_gid'] output = service_get.get_Servicedtl() jdata = output.to_json(orient='records') return JsonResponse(json.loads(jdata), safe=False)
def post(self, request): try: # Group = SET_INITIAL, UPDATE_STATUS if self.request.query_params.get("Group") == "SET_INITIAL": jsondata = json.loads(request.body.decode('utf-8')) obj_cltn = mFET.FET_model() obj_cltn.action = self.request.query_params.get("Action") obj_cltn.type = self.request.query_params.get("Type") obj_cltn.collectionheader_gid = self.request.query_params.get("Collection_Gid") obj_cltn.customer_gid = self.request.query_params.get("Customer_Gid") obj_cltn.employee_gid = self.request.query_params.get("Employee_Gid") obj_cltn.mode = self.request.query_params.get("Collection_Mode") obj_cltn.amount = self.request.query_params.get("Collection_Amount") obj_cltn.date = self.request.query_params.get("Collection_Date") obj_cltn.cheque_no = ''; obj_cltn.remark = self.request.query_params.get("Collection_Description") obj_cltn.entity_gid = self.request.query_params.get("Entity_Gid") obj_cltn.create_by = self.request.query_params.get("Employee_Gid") obj_cltn.jsonData = jsondata.get("Params").get("CHEQUE") file = json.dumps(jsondata.get('Params').get('File')) if file != '[]': lst_saved_filepath = commonview.File_Upload(file, 'CHEQUE', obj_cltn.create_by) obj_cltn.json_file = json.dumps({'File':lst_saved_filepath}) else: obj_cltn.json_file = json.dumps(jsondata.get('Params').get('File')) out_message = obj_cltn.set_collection() if out_message[0] == "SUCCESS": return Response({"MESSAGE": "SUCCESS"}) else: return Response({"MESSAGE": "FAIL","DATA":str(out_message[0])}) elif self.request.query_params.get("Group") == "UPDATE_STATUS": obj_cltn = mFET.FET_model() obj_cltn.action = self.request.query_params.get("Action") obj_cltn.type = self.request.query_params.get("Type") obj_cltn.collectionheader_gid = 0 obj_cltn.customer_gid = 0 obj_cltn.employee_gid = self.request.query_params.get("Employee_Gid") obj_cltn.mode = '' obj_cltn.amount = 0 obj_cltn.date = '' obj_cltn.cheque_no = '' obj_cltn.remark = '' obj_cltn.entity_gid = self.request.query_params.get("Entity_Gid") obj_cltn.create_by = self.request.query_params.get("Employee_Gid") obj_cltn.jsonData = json.loads(request.body.decode('utf-8')) out_message = obj_cltn.set_collection() if out_message[0] == "SUCCESS": return Response({"MESSAGE": "SUCCESS"}) else: return Response({"MESSAGE": "FAIL", "DATA": str(out_message[0])}) elif self.request.query_params.get("Group") == "COLLECTION_DELETE": obj_cltn = mFET.FET_model() obj_cltn.action = self.request.query_params.get("Action") obj_cltn.type = self.request.query_params.get("Type") obj_cltn.collectionheader_gid = self.request.query_params.get("Collection_Gid") obj_cltn.customer_gid = 0 obj_cltn.employee_gid = self.request.query_params.get("Employee_Gid") obj_cltn.mode = '' obj_cltn.amount = 0 obj_cltn.date = '' obj_cltn.cheque_no = '' obj_cltn.remark = '' obj_cltn.entity_gid = self.request.query_params.get("Entity_Gid") obj_cltn.create_by = self.request.query_params.get("Employee_Gid") obj_cltn.jsonData = {} out_message = obj_cltn.set_collection() if out_message[0] == "SUCCESS": return Response({"MESSAGE": "SUCCESS"}) else: return Response({"MESSAGE": "FAIL", "DATA": str(out_message[0])}) elif self.request.query_params.get("Group") == "UPDATE_DISPATCH": obj_cltn = mService.Service_model() obj_cltn.action = self.request.query_params.get("Action") obj_cltn.type = self.request.query_params.get("Type") obj_cltn.in_out = self.request.query_params.get("In_Out") obj_cltn.courier_gid = self.request.query_params.get("Courier_Gid") obj_cltn.Dispatch_date = self.request.query_params.get("Dispatch_Date") obj_cltn.send_by = self.request.query_params.get("Send_By") obj_cltn.awbno = self.request.query_params.get("AWB_No") obj_cltn.dispatch_mode = self.request.query_params.get("Dispatch_Mode") obj_cltn.dispatch_type = self.request.query_params.get("Packets") obj_cltn.weight = self.request.query_params.get("Weight") obj_cltn.dispatch_to = self.request.query_params.get("Dispatch_To") obj_cltn.address = self.request.query_params.get("Address") obj_cltn.city = self.request.query_params.get("City") obj_cltn.state = self.request.query_params.get("State") obj_cltn.pincode =self.request.query_params.get("Pincode") obj_cltn.remark = self.request.query_params.get("Remark") obj_cltn.returned = self.request.query_params.get("Returned") obj_cltn.returned_on = '' obj_cltn.returned_remark = '' obj_cltn.pod = '' obj_cltn.pod_image = '' obj_cltn.isactive = '' obj_cltn.isremoved = '' obj_cltn.dispatch_gid = 0 obj_cltn.SERVICE_JSON = json.loads(request.body.decode('utf-8')) obj_cltn.status = self.request.query_params.get("Status") obj_cltn.entity_gid = self.request.query_params.get("Entity_Gid") obj_cltn.employee_gid = self.request.query_params.get("Employee_Gid") out_message = obj_cltn.set_Dispatch() if out_message[0] == "SUCCESS": return Response({"MESSAGE": "SUCCESS"}) else: return Response({"MESSAGE": "FAIL", "DATA": str(out_message[0])}) elif self.request.query_params.get("Group") == "INV_RECEIPT": obj_cltn = mCollection.Collection_model() obj_cltn.action = self.request.query_params.get("Action") obj_cltn.type = self.request.query_params.get("Type") obj_cltn.commit = self.request.query_params.get("commit") obj_cltn.create_by = self.request.query_params.get("Create_by") obj_cltn.jsonData = json.loads(request.body.decode('utf-8')).get('params').get('DATA') obj_cltn.json_classification = json.loads(request.body.decode('utf-8')).get('params').get('Classification') out_message = outputReturn(obj_cltn.set_invreceipt_map(), 1) if out_message == "SUCCESS": return Response({"MESSAGE": "SUCCESS"}) else: return Response({"MESSAGE": "FAIL", "DATA": str(out_message)}) except Exception as e: return Response({"MESSAGE": "ERROR","DATA":str(e)})
def Dispatch_Set(request): if request.method == 'POST': dispatch_dtl = mService.Service_model() jsondata = json.loads(request.body.decode('utf-8')) lst = jsondata.get('dispatch_data') if lst[0].get('type') == 'SALES_INVOICE': for x in lst: dispatch_dtl.action = x.get('action') dispatch_dtl.type = x.get('type') dispatch_dtl.in_out = x.get('in_out') dispatch_dtl.courier_gid = x.get('courier_gid') dispatch_dtl.Dispatch_date = x.get('Dispatch_date') dispatch_dtl.send_by = x.get('send_by') dispatch_dtl.awbno = x.get('awbno') dispatch_dtl.dispatch_mode = x.get('dispatch_mode') dispatch_dtl.dispatch_type = x.get('dispatch_type') dispatch_dtl.packets = x.get('packets') dispatch_dtl.weight = x.get('weight') dispatch_dtl.dispatch_to = x.get('dispatch_to') dispatch_dtl.address = x.get('address') dispatch_dtl.city = x.get('city') dispatch_dtl.state = x.get('state') dispatch_dtl.pincode = x.get('pincode') dispatch_dtl.remark = x.get('remark') dispatch_dtl.returned = x.get('returned') dispatch_dtl.returned_on = x.get('returned_on') dispatch_dtl.returned_remark = x.get('returned_remark') dispatch_dtl.pod = x.get('pod') dispatch_dtl.pod_image = x.get('pod_image') dispatch_dtl.isactive = x.get('isactive') dispatch_dtl.isremoved = x.get('isremoved') dispatch_dtl.dispatch_gid = x.get('dispatch_gid') dispatch_dtl.status = x.get('status') dispatch_dtl.entity_gid = request.session['Entity_gid'] dispatch_dtl.SERVICE_JSON = jsondata.get('service_dtl') dispatch_dtl.employee_gid = request.session['Emp_gid'] Service_out = outputSplit(dispatch_dtl.set_Dispatch(), 0) return JsonResponse(Service_out, safe=False) elif lst[0].get('type') == 'SALES_BULK_COURIER': for y in lst: dispatch_dtl.action = y.get('action') dispatch_dtl.type = y.get('type') dispatch_dtl.in_out = '' dispatch_dtl.courier_gid = y.get('courier_gid') dispatch_dtl.Dispatch_date = '' dispatch_dtl.send_by = y.get('Sent_By') dispatch_dtl.awbno = 0 dispatch_dtl.dispatch_mode = '' dispatch_dtl.dispatch_type = '' dispatch_dtl.packets = 0 dispatch_dtl.weight = 0 dispatch_dtl.dispatch_to = '' dispatch_dtl.address = '' dispatch_dtl.city = '' dispatch_dtl.state = '' dispatch_dtl.pincode = 0 dispatch_dtl.remark = '' dispatch_dtl.returned = '' dispatch_dtl.returned_on = '' dispatch_dtl.returned_remark = '' dispatch_dtl.pod = 0 dispatch_dtl.pod_image = '' dispatch_dtl.isactive = y.get('isactive') dispatch_dtl.isremoved = y.get('isremoved') dispatch_dtl.dispatch_gid = 0 dispatch_dtl.status = y.get('status') dispatch_dtl.entity_gid = y.get('entity_gid') dispatch_dtl.SERVICE_JSON = jsondata.get('service_dtl') dispatch_dtl.employee_gid = request.session['Emp_gid'] Service_out = outputSplit(dispatch_dtl.set_Dispatch(), 0) return JsonResponse(Service_out, safe=False) elif lst[0].get('type') == 'DISPATCH_POD_UPDATE': for z in lst: dispatch_dtl.action = z.get('action') dispatch_dtl.type = z.get('type') dispatch_dtl.courier_gid = 0 dispatch_dtl.Dispatch_date = '' dispatch_dtl.send_by = 0 dispatch_dtl.awbno = 0 dispatch_dtl.dispatch_mode = z.get('dispatch_mode') dispatch_dtl.dispatch_type = '' dispatch_dtl.packets = 0 dispatch_dtl.weight = 0 dispatch_dtl.dispatch_to = '' dispatch_dtl.address = '' dispatch_dtl.city = '' dispatch_dtl.state = '' dispatch_dtl.pincode = 0 dispatch_dtl.remark = '' dispatch_dtl.returned = '' dispatch_dtl.returned_on = '' dispatch_dtl.returned_remark = '' dispatch_dtl.pod = z.get('pod') dispatch_dtl.pod_image = '' dispatch_dtl.isactive = '' dispatch_dtl.isremoved = '' dispatch_dtl.dispatch_gid = z.get('dispatch_gid') dispatch_dtl.status = z.get('status') dispatch_dtl.entity_gid = z.get('entity_gid') dispatch_dtl.employee_gid = request.session['Emp_gid'] Service_out = outputSplit(dispatch_dtl.set_PODDispatch(), 0) return JsonResponse(Service_out, safe=False)