def user_Login(request): Logger.write_log("判断是否登录") username = str(request.POST.get("username")) password = str(request.POST.get("password")) result = model_login.checkLogin(username, password) jsonstr = json.dumps(result) return HttpResponse(jsonstr)
def update_process(request): Logger.write_log("更新Process数据") # index = request.GET.get('index') process = json.loads(request.GET.get('process')) result = model_setting.updateProcess(process) jsonstr = json.dumps(result) return HttpResponse(jsonstr)
def get_dataList(request): Logger.write_log("Home Page数据") model_name = request.GET.get('model_name') process_cd = request.GET.get('process_cd') datatype_id = request.GET.get('datatype_id') result = model_homePage.getDataList(model_name, process_cd, datatype_id) jsonstr = json.dumps(result) return HttpResponse(jsonstr)
def go_store_out(request): """ 进入出库页面 :param request: :return: """ Logger.write_log("进入出库页面") return render(request, 'base/store/store_out/index.html')
def updatePassword(request): Logger.write_log("修改密码") user_id = str(request.POST.get("user_id")) oldpassword = str(request.POST.get("oldpassword")) newpassword = str(request.POST.get("newpassword")) result = model_login.updatePassword(user_id, oldpassword, newpassword) jsonstr = json.dumps(result) return HttpResponse(jsonstr)
def add_new_user(request): Logger.write_log("添加user数据") user = json.loads(request.GET.get('user')) # model_setting.createUserTable() result = model_setting.add_new_user(user) jsonstr = json.dumps(result) return HttpResponse(jsonstr)
def go_store_in(request): """ 进入入库页面 :param request: :return: """ Logger.write_log("进入入库页面") # model_store_in.testConnecion() return render(request, 'base/store/store_in/index.html')
def add(request): Logger.write_log("添加员工信息") result = model_employee.add() jsonstr = json.dumps(result) return HttpResponse(jsonstr) return render(request, 'base/basic/employee.html')
def update_store_in(request): """ 进行入库操作 :param request: :return: """ Logger.write_log("进行入库操作") # 解析参数 params = json.loads(request.body.decode('utf-8')) searchData = params['searchData'] mainTableData = params['mainTableData'] result = model_store_in.update_store(searchData, mainTableData) return JsonResponse(result)
def time_interval(request): Logger.write_log("获取刷新时间") result = [] database = models_common.get_config("database") model_name = database[0]['MODEL'] timepart = models_common.get_config('time_interval') datestr = time.strftime('%Y-%m-%d', time.localtime(time.time())) result.append({ 'time': timepart, 'model_name': model_name, 'datetime': datestr }) jsonstr = json.dumps(result) return HttpResponse(jsonstr)
def get_InspectList(request): Logger.write_log("Inspect Detail数据") model_name = request.GET.get('model_name') process_cd = request.GET.get('process_cd') datatype_id = request.GET.get('datatype_id') line_cd = request.GET.get('line_cd') start_time = request.GET.get('start_time') end_time = request.GET.get('end_time') serial_cd = request.GET.get('serial_cd') row = model_setting.getProcess(model_name, process_cd) name = row[0]['NAME'] limit = row[0]['LIMIT'] process_name = row[0]['PROCESS_NAME'] result = models_inspectDetail.getInspectList(model_name,name,datatype_id,limit,start_time, end_time, line_cd, serial_cd, process_name) jsonstr = json.dumps(result) return HttpResponse(jsonstr)
def search_config(request): """ 查询config :param request: :return: """ Logger.write_log("查询config") # 解析参数 params = json.loads(request.body.decode('utf-8')) searchData = params['searchData'] # 构建分页数据start与end currentPage = params['currentPage'] pageSize = params['pageSize'] start = (currentPage - 1) * pageSize end = currentPage * pageSize totalDataNumber, results = model_store_out.search_config(searchData, start, end) return JsonResponse({"totalDataNumber": totalDataNumber, "data": results})
def add_material(request): """ 添加原料 :param request: :return: """ Logger.write_log("添加原料数据") params = json.loads(request.body.decode('utf-8')) # 判定apn_cd否存在相同 isExist = materialisExist(params["apn_cd"]); if isExist == 1: return JsonResponse({'status': False, "msg": "已存在该原料"}) result = add(params) if result == 0 : return JsonResponse({"status": False, "msg": "添加失败"}) return JsonResponse({"status": True, "msg": "添加成功"})
def get_DetailList(request): Logger.write_log("获取Warning Detail数据") model_name = request.GET.get('model_name') process_cd = request.GET.get('process_cd') datatype_id = request.GET.get('datatype_id') line_cd = request.GET.get('line_cd') start_time = request.GET.get('start_time') end_time = request.GET.get('end_time') row = model_setting.getProcess(model_name, process_cd) name = row[0]['NAME'] process_name = row[0]['PROCESS_NAME'] JIG = str(row[0]['JIG_S']) + ',' + str(row[0]['JIG_E']) PROCESS = str(row[0]['PROCESS_S']) + ',' + str(row[0]['PROCESS_E']) limit = row[0]['LIMIT'] JIG_type = row[0]['JIG_TYPE'] PROCESS_type = row[0]['PROCESS_TYPE'] result = models_warningDetail.getDetailList(model_name,name, process_name, datatype_id, line_cd,JIG,PROCESS, start_time, end_time, limit, JIG_type, PROCESS_type) jsonstr = json.dumps(result) return HttpResponse(jsonstr)
def get_SerialList(request): Logger.write_log("获取Warning Detail数据") model_name = request.GET.get('model_name') process_cd = request.GET.get('process_cd') datatype_id = request.GET.get('datatype_id') line_cd = request.GET.get('line_cd') station_slot = request.GET.get('station_slot') start_time = request.GET.get('start_time') end_time = request.GET.get('end_time') # allJson = request.GET.get('allJson') row = model_setting.getProcess(model_name, process_cd) name = row[0]['NAME'] limit = row[0]['LIMIT'] process_name = row[0]['PROCESS_NAME'] result = models_serialDetail.getSerialDetail(model_name, name, limit, process_name, datatype_id, line_cd, start_time, end_time) jsonstr = json.dumps(result) return HttpResponse(jsonstr)
def get_material_list (request): """ 获取原料数据 :param req: :return: """ Logger.write_log("获取原料数据") # 解析参数 params = json.loads(request.body.decode('utf-8')) condition = params['condition'] #查询条件 currentPage = params['currentPage'] pageSize = params['pageSize'] # 构建分页数据start start = (currentPage - 1) * pageSize result = get_materail_list(condition['apn_cd'],pageSize, start) totalDataNumber = get_materail_length(condition['apn_cd']) return JsonResponse({"totalDataNumber": totalDataNumber, "data": result})
def user_Login(request): Logger.write_log("用户登陆") username = str(request.POST.get("username")) password = str(request.POST.get("password")) where = " WHERE " where += " user_name = '" + username + "'" where += " AND user_password = '******'" sql_num = findSql() + where cur = models_common.get_cur() cur.execute(sql_num) results = cur.fetchall() count = len(results) for item in results: show_result = {} show_result["id"] = item[0] show_result["user_name"] = item[1] show_result["true_name"] = item[2] show_result["is_admin"] = item[3] show_result["see_plan"] = item[4] if count > 0: return JsonResponse({"code": "0", "data": show_result}) else: return JsonResponse({"code": "1", "msg": "用户名或密码不正确"})
def go_User(request): Logger.write_log("用户一览") return render(request, 'User.html')
def go_vendor(request): Logger.write_log("进入vendor页面") return render(request, 'base/vendor/index.html')
def getVendorList(request): Logger.write_log("获取vendor数据") result = model_vendor.getVendorList() totalDataNumber = len(result) return JsonResponse({"totalDataNumber": totalDataNumber, "data": result})
def update_user(request): Logger.write_log("修改user数据") user = json.loads(request.GET.get('user')) result = model_setting.updateUser(user) jsonstr = json.dumps(result) return HttpResponse(jsonstr)
def go_Plan(request): Logger.write_log("计划一览") return render(request, 'Plan.html')
def go_homePage(request): Logger.write_log("初始化Home Page数据") return render(request, 'HomePage.html')
def auto_updating(request): Logger.write_log("auto updating数据") result = model_homePage.auto_updating() jsonstr = json.dumps(result) return HttpResponse(jsonstr)
def delete_user(request): Logger.write_log("删除user数据") ID = request.GET.get('ID') result = model_setting.deleteUser(ID) jsonstr = json.dumps(result) return HttpResponse(jsonstr)
def go_warningDetail(request): Logger.write_log("初始化Warning Detail数据") return render(request, 'WarningDetail.html')
def go_serialDetail(request): Logger.write_log("初始化Serial Detail数据") return render(request, 'SerialDetail.html')
def get_models(request): Logger.write_log("获取所有models数据") result = model_homePage.get_models() jsonstr = json.dumps(result) return HttpResponse(jsonstr)
def go_Login(request): Logger.write_log("登陆页面") return render(request, 'login.html')
def go_user(request): Logger.write_log("进入user数据") return render(request, 'User.html')