Beispiel #1
0
 def get_actual_phone_in_datas(self, asset_infos):
     actual_asset_infos = []
     aci = AssetInfoChNameToId()
     for asset_info in asset_infos:
         asset_info = aci.get_asset_info_common_data(asset_info)
         actual_asset_infos.append(asset_info)
     return self.add_actual_phone_batch_datas(actual_asset_infos)
Beispiel #2
0
 def get_prov_model_place_num(self, params):
     aio = AssetInfoChNameToId()
     list = aio.get_asset_type_and_model_id(params)
     asset_type_id = list[0]
     model_id = list[1]
     store_place_id = aio. \
         get_store_place_id_by_ch_name(params['store_place'])
     return AssetPhoneInfoDal().get_asset_type_model_place_num(
         asset_type_id, model_id, store_place_id)
Beispiel #3
0
 def store_old_add_data(self, data):
     aci = AssetInfoChNameToId()
     new_data = {}
     for k, v in data.items():
         new_data[k] = v
     new_data["asset_ids"] = data["asset_id"]
     new_data = aci.store_in_out_old_data(new_data)
     ret, msg = AssetInfoDal().update_asset_info_by_id(new_data)
     return ret, msg
Beispiel #4
0
 def get_model_by_prov(self, asset_type, provider):
     # 根据品牌得到所有的该品牌的型号
     aoc = AssetInfoChNameToId()
     id = aoc.get_id_by_at_asset_ch_name(asset_type)
     prov_model = ProviderDal().get_prov_by_id_and_at(id, provider)
     modelList = ModelDal().get_model_by_prov_id(prov_model.id)
     models = []
     for model in modelList:
         models.append(model.name)
     return models
Beispiel #5
0
 def store_edit_asset_info_data(self, params):
     data = {}
     for k, v in params.items():
         data[k] = v
     cds = ConstructDictService()
     data['type_info'] = cds.construct_type_info(data)
     aoc = AssetInfoChNameToId()
     new_data = aoc.trans_ch_data_to_id(data)
     ret, msg = AssetInfoDal().edit_asset_info(new_data)
     return ret, msg
Beispiel #6
0
 def get_actual_num_data(self, data):
     aci = AssetInfoChNameToId()
     data['store_state'] = aci.\
             get_store_state_id_by_ch_name('库存')
     data['store_place'] = aci.\
             get_store_place_id_by_ch_name(data['store_place'])
     data['device_state'] = aci.\
             get_device_state_id_by_ch_name('可用')
     data['asset_type'] = aci.get_id_by_at_asset_ch_name(data['asset_type'])
     return data
Beispiel #7
0
 def get_advanced_web_params(self, request_params):
     list = AssetInfoUtils().get_advanced_list()
     d_len = len(list)
     params = {}
     for i in range(d_len):
         params[list[i]] = request_params[list[i]]
     ait = AssetInfoChNameToId()
     if params["store_state"] != "":
         params["store_state"] = ait.get_store_state_id_by_ch_name(params["store_state"])
     if params["device_state"] != "":
         params["device_state"] = ait.get_device_state_id_by_ch_name(params["device_state"])
     if params["store_place"] != "":
         params["store_place"] = ait.get_store_place_id_by_ch_name(params["store_place"])
     params["in_out_reason"] = ""
     if params["in_reason"] != "":
         params["in_out_reason"] = ait.get_in_out_reason_id_by_ch_name(params["in_reason"])
     if params["out_reason"] != "":
         params["in_out_reason"] = ait.get_in_out_reason_id_by_ch_name(params["out_reason"])
     if params["asset_type"] != "":
         params["asset_type"] = ait.get_id_by_at_asset_ch_name(params["asset_type"])
     if params["provider"] != "":
         params["provider"] = ait.get_prov_id_by_atd_ch(params["asset_type"], params["provider"])
     if params["model"] != "" and params["provider"] != "":
         params["model"] = ait.get_model_id_by_pd_ch(params["provider"], params["model"])
     params["model_list"] = []
     if params["provider"] != "":
         if params["model"] == "":
             params["model_list"] = ModelDal().get_model_list_by_prov_id(params["provider"])
     if params["oper_name"] != "":
         params["asset_id_list"] = OperationInfoDal().get_asset_id_list_by_operator(params["oper_name"])
     return params
Beispiel #8
0
 def validate_add_new_asset_info(self, data):
     validate_ret, msg = self.validate_web_data(data, 1)
     if validate_ret is False:
         return False, msg
     validate_ret, msg = self.validate_value_is_single(data)
     if validate_ret is False:
         return False, msg
     aci = AssetInfoChNameToId()
     new_data = aci.trans_ch_data_to_id(data)
     validate_ret, msg = self.validate_web_data(new_data, 2)
     if validate_ret is False:
         return False, msg
     return True, new_data
Beispiel #9
0
 def get_prov_model_user_name_num(self, params):
     aio = AssetInfoChNameToId()
     list = aio.get_asset_type_and_model_id(params)
     asset_type_id = list[0]
     model_id = list[1]
     print list
     assetInfo = AssetConsumeInfoDal().get_asset_type_model_user_name_num(
         asset_type_id, model_id, params["user_name"], 2)
     print assetInfo
     ret_params = {}
     if assetInfo:
         ret_params['in_num'] = str(assetInfo.in_num)
         ret_params['user_name'] = assetInfo.user_name
     return json.dumps(ret_params)
Beispiel #10
0
 def get_prov_model_place_num(self, params):
     aio = AssetInfoChNameToId()
     list = aio.get_asset_type_and_model_id(params)
     asset_type_id = list[0]
     model_id = list[1]
     store_place_id = aio. \
         get_store_place_id_by_ch_name(params['store_place'])
     assetInfo = AssetConsumeInfoDal().get_asset_type_model_place_num(
         asset_type_id, model_id, store_place_id)
     ret_params = {}
     if assetInfo:
         ret_params['in_num1'] = str(assetInfo.in_num)
         ret_params['user_name'] = assetInfo.user_name
     return json.dumps(ret_params)
Beispiel #11
0
 def store_new_add_phone_data(self, params):
     data = {}
     aio = AssetInfoChNameToId()
     list = aio.get_asset_type_and_model_id(params)
     data["asset_type_id"] = list[0]
     data["model_id"] = list[1]
     data["user_name"] = params["user_name"]
     data["phone_num"] = int(params["phone_num1"]) + int(params["phone_num2"])
     data["phone_num1"] = params["phone_num1"]
     data["phone_num2"] = params["phone_num2"]
     data["store_place_id"] = aio. \
         get_store_place_id_by_ch_name(params['store_place'])
     data["remark"] = params["remark"]
     return AssetPhoneInfoDal().store_new_phone_data(data)
Beispiel #12
0
 def store_consume_old_data(self, data):
     aci = AssetInfoChNameToId()
     data['old_user_name'] = data['user_name_c']
     data['user_name'] = data['c_user_name']
     data['store_state'] = aci.\
             get_store_state_id_by_ch_name(data['c_store_state'])
     data['store_place'] = aci.\
             get_store_place_id_by_ch_name(data['c_store_place'])
     data['in_out_reason'] = aci.\
             get_in_out_reason_id_by_ch_name(data['c_in_out_reason'])
     data['device_state'] = aci.\
             get_device_state_id_by_ch_name(data['c_device_state'])
     data['remark'] = data['c_remark']
     list = aci.get_asset_type_and_model_id(data)
     data["asset_type"] = list[0]
     data["model"] = list[1]
Beispiel #13
0
 def store_out_add_consume_data(self, data, operator):
     new_data = {}
     for k, v in data.items():
         new_data[k] = v
     # self.construct_out_oper_data(new_data, operator)
     aio = AssetInfoChNameToId()
     list = aio.get_asset_type_and_model_id(new_data)
     new_data["asset_type"] = list[0]
     new_data["model"] = list[1]
     new_data["store_place1"] = aio. \
         get_store_place_id_by_ch_name(new_data['store_place1'])
     new_data["store_place2"] = aio. \
         get_store_place_id_by_ch_name(new_data['store_place2'])
     new_data["store_state"] = aio. \
         get_store_state_id_by_ch_name('在用')
     new_data["device_state"] = aio. \
         get_store_state_id_by_ch_name('可用')
     new_data['in_out_reason'] = aio.\
         get_in_out_reason_id_by_ch_name(data['in_out_reason'])
     return AssetConsumeInfoDal().store_old_consume_data(new_data)
Beispiel #14
0
 def add_new_asset_info(self, data):
     asset_type = data['asset_type']
     from itdblib.common.type_info_utils import consumeList, phoneList
     data['store_state'] = '库存'
     if asset_type in consumeList():
         acs = AssetConsumeService()
         ret, msg = acs.store_new_consume_info(data)
     elif asset_type in phoneList():
         # 电话号码类存数
         ret, msg = AssetInfoService().validate_phone_is_single(data)
         if ret:
             acd = AssetInfoChNameToId()
             data = acd.get_asset_info_common_data(data)
             ret, msg = AssetPhoneInfoDal().store_new_phone_data(data)
             return ret, msg
     else:
         # 固定资产类存数
         data = self.transform_web_data(data)
         ret, msg = AssetInfoService().validate_add_new_asset_info(data)
         if ret:
             ret, msg = AssetInfoDal().add_new_asset_info(msg)
             return ret, msg
     return ret, msg
Beispiel #15
0
 def get_prov_list_by_type(self, asset_type):
     aoc = AssetInfoChNameToId()
     id = aoc.get_id_by_at_asset_ch_name(asset_type)
     return ProviderDal().get_prov_by_asset_type(id)
Beispiel #16
0
 def get_actual_prov_list(self, asset_type):
     aoc = AssetInfoChNameToId()
     id = aoc.get_id_by_at_asset_ch_name(asset_type)
     return self.get_prov_list_by_atd(id)
Beispiel #17
0
 def store_new_consume_info(self, data):
     acd = AssetInfoChNameToId()
     data = acd.trans_ch_data_to_id(data)
     data["in_num"] = int(data["in_num1"]) + int(data["in_num2"])
     return AssetConsumeInfoDal().store_new_consume_data(data)