コード例 #1
0
ファイル: stock_in.py プロジェクト: wzqwsrf/itdb
def upload_asset_file():
    try:
        f = request.files.get("file")
        if not f:
            return ajax.api_error(msg=u'没有获取文件信息')
        fileName = secure_filename(f.filename)
        path = '/tmp/'
        fileFullPath = os.path.join(path, fileName)
        # import re
        # temp = tempfile.mkdtemp(suffix='xlsx', prefix='asset', dir=fileFullPath)
        # os.rename(os.path.join(path, fileName), os.path.join(path, new_name))
        f.save(fileFullPath)
        ret, msg = get_excel_sheet_name(fileFullPath)
        if not ret:
            return ajax.api_error(msg=msg)
        else:
            operator = session.get('rtx_id')
            ss = StockInService()
            ret, msg = ss.muti_stock_in_different_assets(fileFullPath, operator, int(msg))
            if ret:
                return ajax.api_success(msg=msg, data=[])
            else:
                return ajax.api_error(msg=msg)
    except Exception, _ex:
        LOG.error("error occured while upload_asset_file : %s" % str(_ex))
        return ajax.api_error(msg=u'添加失败')
コード例 #2
0
ファイル: attribute_manager.py プロジェクト: wzqwsrf/itdb
def addAssetClass():
    try:
        data = request.form
        dataNew = {}
        for k, v in data.items():
            dataNew[k] = v
        num, msg = AttributeManagerService().addAssetClass(dataNew)
        if -1 == num:
            LOG.error("添加错误")
            return ajax.api_error(msg=msg)
        elif 0 == num:
            return ajax.api_success(msg=msg, data=False)
        else:
            return ajax.api_success(msg=msg)
    except Exception as _ex:
        LOG.error("error occured while add asset tree node: %s" % str(_ex))
        return ajax.api_error(msg=u'添加失败')
コード例 #3
0
ファイル: asset_consume.py プロジェクト: wzqwsrf/itdb
def store_consume_old_data():
    data = request.form
    ret, msg = AssetConsumeService().store_consume_old_add_data(data)
    if ret:
        LOG.info(msg)
        return ajax.api_success(msg=msg, data=[])
    else:
        LOG.error(msg)
        return ajax.api_error(msg=msg)
コード例 #4
0
ファイル: asset_phone.py プロジェクト: wzqwsrf/itdb
def store_phone_out_data():
    data = request.form
    operator = session.get('rtx_id')
    ret, msg = AssetPhoneService().store_phone_out_data(data, operator)
    if ret:
        LOG.info(msg)
        return ajax.api_success(msg=msg, data=[])
    else:
        LOG.error(msg)
        return ajax.api_error(msg=msg)
コード例 #5
0
ファイル: asset_phone.py プロジェクト: wzqwsrf/itdb
def store_phone_old_data():
    data = request.form
    print data
    ret, msg = AssetPhoneService().store_phone_old_add_data(data)
    if ret:
        LOG.info(msg)
        return ajax.api_success(msg=msg, data=[])
    else:
        LOG.error(msg)
        return ajax.api_error(msg=msg)
コード例 #6
0
ファイル: asset_consume.py プロジェクト: wzqwsrf/itdb
def add_old_asset_info():
    params = request.form
    operator = session.get('rtx_id')
    ret = AssetConsumeService().store_out_add_consume_data(params, operator)
    if ret:
        msg = u"已有耗材类数据出库成功"
        LOG.info(msg)
        return ajax.api_success(msg=msg, data=[])
    else:
        msg = u"已有耗材类数据出库失败"
        LOG.error(msg)
        return ajax.api_error(msg=msg)
コード例 #7
0
ファイル: attribute_manager.py プロジェクト: wzqwsrf/itdb
def addStorehouseMsgs():
    try:
        data = request.form
        print data
        bFlag, msg = AttributeManagerService().addStorePlace(data)
        if bFlag:
            return ajax.api_success(msg=msg, data=[])
        else:
            return ajax.api_error(msg=msg)
    except Exception as _ex:
        LOG.error("error occured while add storehouse msgs: %s" % str(_ex))
        return ajax.api_error(msg=u'添加失败')
コード例 #8
0
ファイル: attribute_manager.py プロジェクト: wzqwsrf/itdb
def removeAssetClassNode():
    try:
        data = request.form
        dataNew = {}
        for k, v in data.items():
            dataNew[k] = v
        bFlag = AttributeManagerService().removeAssetClassNode(dataNew)
        if bFlag:
            return ajax.api_error(msg=u'删除失败')
        return ajax.api_success(msg=u"删除成功", data=[])
    except Exception as _ex:
        LOG.error("error occured while remvoe asset tree node: %s" % str(_ex))
        return ajax.api_error(msg=u'删除失败')
コード例 #9
0
ファイル: attribute_manager.py プロジェクト: wzqwsrf/itdb
def addDeviceType():
    try:
        data = request.form
        dataNew = {}
        for k, v in data.items():
            dataNew[k] = v
        bFlag, strRet = AttributeManagerService().addDeviceTypeInfos(dataNew)
        if bFlag:
            return ajax.api_success(msg=strRet, data=[])
        else:
            return ajax.api_error(msg=strRet)
    except Exception, _ex:
        LOG.error("error occured while add device type: %s" % str(_ex))
        return ajax.api_error(msg=u'添加失败')
コード例 #10
0
ファイル: asset_manager.py プロジェクト: wzqwsrf/itdb
def submit_asset_info():
    try:
        params = request.form
        ams = AssetManagerService()
        ret, msg = ams.store_edit_asset_info_data(params)
        if ret:
            LOG.info(msg)
            return ajax.api_success(msg=msg, data=[])
        else:
            LOG.error(msg)
            return ajax.api_error(msg=msg)
    except Exception, _ex:
        LOG.error("error occured while submit_asset_info : %s" % str(_ex))
        return u"编辑失败"
コード例 #11
0
ファイル: stock_out.py プロジェクト: wzqwsrf/itdb
def updateStockOutInfos():
    try:
        data = request.form
        dataNew = {}
        for k, v in data.items():
            dataNew[k] = v
        bRet, msg = StockOutService().updateStockOutInfos(dataNew)
        if not bRet:
            return ajax.api_error(msg=msg)
        else:
            return ajax.api_success(msg=u'出库成功', data=[])
    except Exception as _ex:
        LOG.error("error occured while modify stock out asset infos: %s"
                  % str(_ex))
        return ajax.api_error(msg=u'出库失败')