示例#1
0
 def get_one_proj_by_id(self, pro_id):
     try:
         proj_info = db.session.query(Projects).filter(Projects.proj_id == pro_id).first()
         if proj_info:
             project = proj_info.to_dict()
             # project[Projects.proj_id.name] = proj_info.proj_id
             # project[Projects.outside_name.name] = proj_info.outside_name
             # project[Projects.describe.name] = proj_info.describe
             # project[Projects.commit_time.name] = self.time_to_str(proj_info.commit_time)
             # project[Projects.update_time.name] = self.time_to_str(proj_info.update_time)
             # project[Projects.inside_name.name] = proj_info.inside_name
             project["inside_i_name"] = proj_info.insideName.inside_name
             # project[Projects.proj_type.name] = proj_info.proj_type
             project["proj_i_type"] = proj_info.projectType.project_type
             # project[Projects.proj_state.name] = proj_info.proj_state
             project["proj_i_state"] = proj_info.projectState.state_name
             project["quotations"] = []
             quotations = proj_info.quotations
             for iq in quotations:
                 quotation = iq.to_dict()
                 from app.ctrl.ctrl_quotations import CtrlQuotations
                 quotation[Quotations.create_user.name] = CtrlQuotations().get_user_name_by_id(iq.create_user)
                 quotation[Quotations.update_user.name] = CtrlQuotations().get_user_name_by_id(iq.create_user)
                 project["quotations"].append(quotation)
             return True, project
         else:
             return False, "沒有此項目信息"
     except Exception as e:
         db.session.rollback()
         current_app.logger.error('%s' % str(e))
         return False, "服务异常!请联系管理员!"
示例#2
0
 def __init__(self):
     CtrlQuotations.__init__(self)
     self.key_col = Task.task_id
     self.db_object = Task
     self.col_list = [
         Task.task1.name, Task.task2.name, Task.task3.name, Task.task4.name,
         Task.task5.name, Task.task6.name, Task.group_id.name
     ]
     self.task_col_list = []
     for column in Task.__table__.columns:
         self.task_col_list.append(column.name)
示例#3
0
 def get(self, pro_id=None, user_id=None):
     result = {"result": "NG", "content": []}
     if user_id and (not pro_id):
         res, msg = CtrlQuotations().get_quotation_list_by_user_id(user_id)
     else:
         res, msg = CtrlQuotations().get_quotation_list2(pro_id, user_id)
     if res:
         result["result"] = "OK"
         result["content"] = msg
     else:
         result["content"] = msg
     return result
示例#4
0
 def get(self, quotation_id):
     result = {"result": "NG", "content": []}
     res, msg = CtrlQuotations().get_quotation_pie(quotation_id)
     if res:
         result["result"] = "OK"
         result["content"] = msg
     else:
         result["content"] = msg
     return result
示例#5
0
    def get(self, quotation_id):
        """
        获取此报价下的所有Option
        :return:
        """
        result = {"result": "NG", "content": []}
        if quotation_id:
            res = CtrlQuotations().get_option_by_quotation_id(quotation_id)
            if res:
                result["result"] = "OK"
                result["content"] = res

        return result
示例#6
0
 def get(self, quotation_id):
     """
     获取状态
     :return:
     """
     result = {"result": "NG", "content": []}
     if quotation_id:
         res, msg = CtrlQuotations().show_one_quotation_status(quotation_id)
         if res:
             result["result"] = "OK"
             result["content"] = msg
         else:
             result["content"] = msg
     return result
示例#7
0
 def get(self, pro_id):
     """
     获取所有base版本
     :return:
     """
     result = {"result": "NG", "content": []}
     if pro_id:
         res, msg = CtrlQuotations().get_base_quotation_list(pro_id)
         if res:
             result["result"] = "OK"
             result["content"] = msg
         else:
             result["content"] = msg
     return result
示例#8
0
 def get(self, quotation_id):
     """
     获取此报价下的featureList历史
     :return:
     """
     result = {"result": "NG", "content": []}
     if quotation_id:
         res, msg = CtrlQuotations().feature_history(quotation_id)
         if res:
             result["result"] = "OK"
             result["content"] = msg
         else:
             result["content"] = msg
     return result
示例#9
0
 def post(self):
     """
     更新此报价下的feature
     :return:
     """
     result = {"result": "NG"}
     request_data = request
     res, msg = CtrlQuotations().import_featurelist(request_data)
     if res:
         result["result"] = "OK"
         result["content"] = res
     else:
         result["error"] = msg
     return result
示例#10
0
 def get(self, quotation_id):
     """
     查看报价
     :return:
     """
     result = {"result": "NG", "content": []}
     if quotation_id:
         res, msg = CtrlQuotations().get_one_quotation_info(quotation_id)
         if res:
             result["result"] = "OK"
             result["content"] = msg
         else:
             result["content"] = msg
     return result
示例#11
0
 def delete(self, op_id):
     """
     删除此条Option
     :return:
     """
     result = {"result": "NG", "content": []}
     if op_id:
         res, msg = CtrlQuotations().del_combination(op_id)
         if res:
             result["result"] = "OK"
             result["content"] = msg
         else:
             result["error"] = msg
     return result
示例#12
0
 def get(self, quotation_id, user_id):
     """
     获取此报价下的所有featureList
     :return:
     """
     result = {"result": "NG", "content": []}
     if quotation_id:
         res, msg = CtrlQuotations().get_feature_list2(
             quotation_id, user_id)
         if res:
             result["result"] = "OK"
             result["content"] = msg
         else:
             result["content"] = msg
     return result
示例#13
0
 def get(self, quotation_id):
     """
     获取此报价下的所有Option
     :return:
     """
     result = {"result": "NG", "content": []}
     if quotation_id:
         res, msg = CtrlQuotations().get_combination_by_quotation_id3(
             quotation_id)
         if res:
             result["result"] = "OK"
             result["content"] = msg
         else:
             result["content"] = msg
     return result
示例#14
0
 def put(self, quotation_id):
     """
     修改报价
     :return:
     """
     result = {"result": "NG", "content": []}
     data = request.get_json(force=True)
     if data:
         res, msg = CtrlQuotations().update_one_quotation_info(
             quotation_id, data)
         if res:
             result["result"] = "OK"
             result["content"] = msg
         else:
             result["content"] = msg
     return result
示例#15
0
 def post(self):
     """
     修改状态
     :return:
     """
     result = {"result": "NG"}
     data = request.get_json(force=True)
     if data:
         succsee, message = CtrlQuotations().update_quotation_status(data)
         if succsee:
             result = {"result": "OK", 'content': message}
         else:
             result["error"] = message
     else:
         result["error"] = "请不要传空数据"
     return result
示例#16
0
 def post(self, quotation_id):
     """
     分配此报价下的feature
     :return:
     """
     result = {"result": "NG"}
     data = request.get_json(force=True)
     if data:
         succsee, message = CtrlQuotations().feature_assign_group(
             data, quotation_id)
         if succsee:
             result = {"result": "OK", 'content': message}
         else:
             result["error"] = message
     else:
         result["error"] = "请不要传空数据"
     return result
示例#17
0
 def post(self, quotation_id):
     """
     更新/添加此报价下的Combination
     :return:
     """
     result = {"result": "NG"}
     data = request.get_json(force=True)
     # data = request.view_args
     if data:
         succsee, message = CtrlQuotations(
         ).add_combination_by_quotation_id3(quotation_id, data)
         if succsee:
             result = {"result": "OK", 'content': message}
         else:
             result["error"] = message
     else:
         result["error"] = "请不要传空数据"
     return result