f (!empty($uidarr)) {
$uids = array();
$update = array();
foreach ($uidarr as $_uid => $n) {
$uids[] = $_uid;
$update[$_uid] = array('articles-' => $n);
'mysql' != $conf['cache']['type'] and cache_delete('user-' . $_uid);
}
user_big_update(array('uid' => $uids), $update);
}
!empty($operate_create) && function_exists('operate_big_insert') and operate_big_insert($operate_create);
return TRUE;
}
// 大数据量容易超时 删除用户时使用,删除主题 回复 栏目统计 附件 全站统计
function well_thread_delete_all_by_uid($uid)
{
// 用户主题数
$user = user_read_cache($uid);
set_time_limit(0);
// 删除所有回复
if ($user['comments']) {
$postist = comment_pid_find_by_uid($uid, 1, $user['comments'], FALSE);
$pidarr = array();
foreach ($postist as $val) {
$pidarr[] = $val['pid'];
}
unset($postist);
!empty($pidarr) and comment_delete_by_pids($pidarr);
}
if ($user['articles']) {
// 如果主题、附件和回复数量太大会超时
$tidlist = thread_tid_find_by_uid($uid, 1, $user['articles'], FALSE, 'tid', array('tid'));
$tidarr = array();
foreach ($tidlist as $val) {
$tidarr[] = $val['tid'];
}
unset($tidlist);
!empty($tidarr) and well_thread_delete_all($tidarr);
}
return TRUE;
}
// 搜索标题
function well_thread_find_by_keyword($keyword, $d = NULL)
{
if (empty($keyword)) return NULL;
$db = $_SERVER['db'];
$d = $d ? $d : $db;
if (!$d) return FALSE;
$threadlist = db_sql_find("SELECT * FROM `{$d->tablepre}website_thread` WHERE subject LIKE '%$keyword%' LIMIT 60;", 'tid', $d);
if ($threadlist) {
$threadlist = arrlist_multisort($threadlist, 'tid', FALSE);
foreach ($threadlist as &$thread) {
well_thread_format($thread);
// 关键词标色
//$thread['subject'] = comment_highlight_keyword($thread['subject'], $keyword);
}
}
return $threadlist;
}
// 查找 最后评论 lastpid
function well_thread_find_lastpid($tid)
{
$arr = comment_pid_read(array('tid' => $tid), array('pid' => -1), array('pid'));
$lastpid = empty($arr) ? 0 : $arr['pid'];
return $lastpid;
}
// 更新最后的 uid
function well_thread_update_last($tid)
{
if (empty($tid)) return FALSE;
$lastpid = well_thread_find_lastpid($tid);
if (empty($lastpid)) return FALSE;
$lastpost = comment_read($lastpid);
if (empty($lastpost)) return FALSE;
$r = well_thread_update($tid, array('lastuid' => $lastpost['uid']));
return $r;
}
function well_thread_maxid()
{
$n = db_maxid('website_thread', 'tid');
return $n;
}
// 主题状态 0:通过 1~9 审核:1待审核 10~19:10退稿 11逻辑删除
function well_thread_format(&$thread)
{
global $gid, $uid, $forumlist;
$conf = _SERVER('conf');
if (empty($thread)) return;
$thread['create_date_fmt'] = humandate($thread['create_date']);
$thread['last_date_fmt'] = humandate($thread['last_date']);
$thread['create_date_fmt_ymd'] = date('Y-m-d', $thread['create_date']);
$thread['last_date_fmt_ymd'] = date('Y-m-d', $thread['last_date']);
$user = user_read_cache($thread['uid']);
$onlinelist = online_user_list_cache();
$user['online_status'] = isset($onlinelist[$user['uid']]) ? 1 : 0;
$thread['username'] = $user['username'];
$thread['user_avatar_url'] = array_value($user, 'avatar_url');
$thread['user'] = user_safe_info($user);
unset($user);
$forum = array_value($forumlist, $thread['fid']);
$thread['forum_name'] = array_value($forum, 'name');
$thread['forum_url'] = array_value($forum, 'url');
if ($thread['last_date'] == $thread['create_date']) {
$thread['last_date_fmt'] = '';
$thread['lastuid'] = 0;
$thread['lastusername'] = '';
} else {
$lastuser = $thread['lastuid'] ? user_read_cache($thread['lastuid']) : array();
$thread['lastusername'] = $thread['lastuid'] ? $lastuser['username'] : lang('guest');
$thread['lastuser'] = $thread['lastuid'] ? user_safe_info($lastuser) : array();
unset($lastuser);
}
$thread['url'] = url('read-' . $thread['tid'], '', FALSE);
if ($conf['url_rewrite_on'] > 1) {
!empty($forum['well_alias']) and $thread['url'] = url(urlencode($forum['well_alias'])."-$thread[create_date]a$thread[tid]", '', FALSE);
} else {
$thread['url'] = url("read-$thread[create_date]a$thread[tid]", '', FALSE);
}
$thread['user_url'] = url('user-' . $thread['uid']);
$thread['sticky_class'] = '';
if ($thread['sticky'] > 0) {
if (1 == $thread['sticky']) {
$thread['sticky_class'] = 'success';
} elseif (2 == $thread['sticky']) {
$thread['sticky_class'] = 'warning';
} elseif (3 == $thread['sticky']) {
$thread['sticky_class'] = 'danger';
}
}
$nopic = view_path() . 'img/nopic.png';
if ($thread['icon']) {
$attach_dir_save_rule = array_value($conf, 'attach_dir_save_rule', 'Ym');
$day = date($attach_dir_save_rule, $thread['icon']);
$thread_format_icon_default = 1;
if (1 == $thread_format_icon_default) {
// 本地文件绝对路径
$destfile = $conf['upload_path'] . 'thumbnail/' . $day . '/' . $thread['uid'] . '_' . $thread['tid'] . '_' . $thread['icon'] . '.jpeg';
// 本地
$thread['icon_fmt'] = is_file($destfile) ? file_path($thread['attach_on']) . 'thumbnail/' . $day . '/' . $thread['uid'] . '_' . $thread['tid'] . '_' . $thread['icon'] . '.jpeg' : $nopic;
if (1 == $conf['attach_on'] && 1 == $thread['attach_on']) {
// 云储存
$thread['icon_fmt'] = file_path($thread['attach_on']) . 'thumbnail/' . $day . '/' . $thread['uid'] . '_' . $thread['tid'] . '_' . $thread['icon'] . '.jpeg';
} elseif (2 == $conf['attach_on'] && 2 == $thread['attach_on']) {
// 图床 未上传成功 本地图片在的话使用本地,不在则默认
$thread['icon_fmt'] = $thread['image_url'] ? $thread['image_url'] : $thread['icon_fmt'];
}
}
} else {
$thread['icon_fmt'] = $nopic;
}
// 回复页面
$thread['pages'] = ceil($thread['posts'] / $conf['comment_pagesize']);
$thread['tag_fmt'] = $thread['tag'] ? xn_json_decode($thread['tag']) : '';
// 权限判断
$thread['allowupdate'] = ($uid == $thread['uid']) || forum_access_mod($thread['fid'], $gid, 'allowupdate');
$thread['allowdelete'] = (group_access($gid, 'allowuserdelete') and $uid == $thread['uid']) || forum_access_mod($thread['fid'], $gid, 'allowdelete');
$thread['allowtop'] = forum_access_mod($thread['fid'], $gid, 'allowtop');
$thread = well_thread_safe_info($thread);
}
function well_thread_format_last_date(&$thread)
{
if ($thread['last_date'] != $thread['create_date']) {
$thread['last_date_fmt'] = humandate($thread['last_date']);
} else {
$thread['create_date_fmt'] = humandate($thread['create_date']);
}
}
// 对 $threadlist 权限过滤
function well_thread_list_access_filter(&$threadlist, $gid)
{
global $forumlist;
if (empty($threadlist)) return NULL;
foreach ($threadlist as $tid => $thread) {
if (empty($forumlist[$thread['fid']]['accesson'])) continue;
if ($thread['sticky'] > 0) continue;
if (!forum_access_user($thread['fid'], $gid, 'allowread')) {
unset($threadlist[$tid]);
}
}
}
function well_thread_safe_info($thread)
{
unset($thread['userip'], $thread['user']['threads'], $thread['user']['posts'], $thread['user']['credits'], $thread['user']['golds'], $thread['user']['money']);
empty($thread['user']) || $thread['user'] = user_safe_info($thread['user']);
return $thread;
}
// 过滤安全数据
function well_thread_filter(&$val)
{
unset($val['userip'], $val['fid'], $val['flagid'], $val['type'], $val['user'], $val['create_date']);
}
//------------------------ 其他方法 ------------------------
// 集合主题tid,统一拉取,避免多次查询thread表
function thread_unified_pull($arr)
{
global $gid, $fid;
$stickylist = array_value($arr, 'stickylist', array());
$tidlist = array_value($arr, 'tidlist', array());
//$fid = array_value($arr, 'fid');
// 合并过滤空数组
//$tidlist = array_filter($stickylist + $tidlist);
$tidarrlist = $tidlist = $stickylist + $tidlist;
// 版块自定义
list($flaglist, $flagtids) = flag_thread_by_fid($fid);
empty($flagtids) || $tidarrlist += $flagtids;
unset($flagtids);
// 在这之前合并所有二维数组 tid值为键/array('tid值' => tid值)
$tidarr = empty($tidarrlist) ? array() : arrlist_values($tidarrlist, 'tid');
// 在这之前使用array_merge()前合并所有一维数组 tid/array(1,2,3)
if (empty($tidarr)) return NULL;
$tidarr = array_unique($tidarr);
// 主题相关统一遍历后再归类
$arrlist = well_thread_find($tidarr, count($tidarr));
// 过滤没有权限访问的主题 / filter no permission thread
well_thread_list_access_filter($arrlist, $gid);
$threadlist = array();
foreach ($arrlist as $_tid => &$_thread) {
$_thread = well_thread_safe_info($_thread);
// 归类列表数据
isset($tidlist[$_thread['tid']]) and $threadlist[$_tid] = $_thread;
// flag thread
if (!empty($flaglist)) {
foreach ($flaglist as $key => $val) {
if (isset($val['tids']) && in_array($_thread['tid'], $val['tids'])) {
$flaglist[$key]['list'][array_search($_thread['tid'], $val['tids'])] = $_thread;
ksort($flaglist[$key]['list']);
}
}
}
}
// 按之前tidlist排序
$threadlist = array2_sort_key($threadlist, $tidlist, 'tid');
unset($arrlist, $tidlist);
$arr = array('threadlist' => $threadlist, 'flaglist' => $flaglist);
return $arr;
}
// read.php 详情页其他主题调用,集合tid统一拉取数据,最后归类
function thread_other_pull($thread)
{
global $forumlist, $gid;
$fid = array_value($thread, 'fid');
$forum = array_value($forumlist, $fid);
if (empty($forum)) return NULL;
//$tid = array_value($thread, 'tid');
//$tag_fmt = array_value($thread, 'tag_fmt');
$arrlist = array();
$tidlist = array();
// 版块自定义
list($flaglist, $flagtids) = flag_thread_by_fid($fid);
empty($flagtids) || $tidlist += $flagtids;
unset($flagtids);
// 在这之前合并所有二维数组 tid值为键/array('tid值' => tid值)
$tidarr = empty($tidlist) ? array() : arrlist_values($tidlist, 'tid');
// 在这之前使用array_merge()前合并所有一维数组 tid/array(1,2,3)
if (empty($tidarr)) return NULL;
$tidarr = array_unique($tidarr);
// 主题相关统一遍历后再归类
$threadlist = well_thread_find($tidarr, count($tidarr));
// 过滤没有权限访问的主题 / filter no permission thread
well_thread_list_access_filter($threadlist, $gid);
foreach ($threadlist as &$_thread) {
$_thread = well_thread_safe_info($_thread);
// flag thread
if (!empty($flaglist)) {
foreach ($flaglist as $key => $val) {
if (isset($val['tids']) && in_array($_thread['tid'], $val['tids'])) {
$flaglist[$key]['list'][array_search($_thread['tid'], $val['tids'])] = $_thread;
ksort($flaglist[$key]['list']);
}
}
}
}
unset($threadlist);
if (!empty($flaglist)) {
foreach ($flaglist as &$val) {
$i = 0;
if (!isset($val['list'])) continue;
foreach ($val['list'] as &$v) {
++$i;
$v['i'] = $i;
}
}
$arrlist['flaglist'] = $flaglist;
unset($flaglist);
}
return $arrlist;
}
//--------------------------cache--------------------------
// 已格式化 从缓存中读取,避免重复从数据库取数据
function well_thread_read_cache($tid)
{
global $conf;
$key = 'website_thread_' . $tid;
static $cache = array(); // 用静态变量只能在当前 request 生命周期缓存,跨进程需要再加一层缓存:redis/memcached/xcache/apc
if (isset($cache[$key])) return $cache[$key];
if ('mysql' == $conf['cache']['type']) {
$r = well_thread_read($tid);
} else {
$r = cache_get($key);
if (NULL === $r) {
$r = well_thread_read($tid);
$r and cache_set($key, $r, 1800);
}
}
$cache[$key] = $r ? $r : NULL;
return $cache[$key];
}
?>
sap上线前的十大思考编程频道|福州电脑网
sap上线前的十大思考
编程之家740
更新时间:2026-04-10 02:37:24 如果你正考虑要实施SAP的R/3产品,那么你可要小心了:这不是一种机械的改变。一个一般的价值50亿美元的公司得为这个项目在软件、硬件、系统集成、人员上花上5千万美元左右,点企业总资产的1%,年销售额的5%左右。也就是说实施SAPR/3企业一般要有一定的规模,否则可能不能达到期望的ROI(投资回报率)。为了把你从这场灾难中解救出来,我们在这里将列出应该保证的前题条件,因为这些条件是确保项目实施成功的必要条件。
条件一:SAP项目是不断优化和过程
太多公司认为SAP实施项目有明确的开始和明确的结束。我们认为,应该把ERP开始运行的那天当作项目另一阶段的开始,而不是项目的结束。就像举行了婚礼,但却没有对婚姻生活做好准备。
正常情况下,在客户能够进行自我维护之前,顾问公司要进行3-4周的运行后支持。在这后就要公司自己的SAP团队自己负责SAP的支持工作了,如果在项目的实施过程中没有建立起自己的顾问队伍,很难说这个项目是成功的。
条件二:有具体开发业务用例
不要仅仅因为CIO认为需要一个ERP软件,就贸贸然开始一个SAP项目。在这样的一个基础上前进是十分危险的,其代价也及其昂贵。SAP项目必须由利益驱动,必须有一些具体的业务用例,比如:为了提高库存管理水平,把原来平均库存量降低70%。为了提高员工的工作效率,上SAP后,员工加班减少90%等。其实这样的例在中国也是太多,很多公司老总们觉得需要提高企业管理水平就上ERP系统,其实如果本身的管理没跟上,上了ERP一定会成为企业的一个负担。
没有业务用例的风险在于,你会把SAP项目看作是一个普通的软件实施项目,而没有重新设计业务流程发挥SAP潜在的业务流程改进功能。如果只是按照原来的业务流程实施SAP,那么你最终只是白忙一场。你拥有了一个新的系统,但是根本没有解决存在的业务问题。同时,所有你向CEO承诺过的商业利益都不会出现。
条件三:提供最好的员工给实施小组
我们经常看到SAP项目小组成为一个垃圾场,客户把一些它不知该如何处置的人员都扔给了项目组。但是如果要为公司重新设计业务流程,那么就应该给项目组配备公司各个部门最聪明、最优秀的员工。虽然可能各个部门都想抓住这些优秀员工不肯放,但只有他们才能按照预算准时完成项目,为企业愿景提供最相配的优化了的业务流程。为了让客户明白优秀的项目小组有多重要,你要做好准备与客户进行一场奇怪的战斗。如果没有优秀的实施小组,还可能出现更糟糕的情况。如果你的实施小组很糟糕,那么你的项目永远也别想有个结束。如果中途中止项目实施,那么公司很可能倒闭。
条件四:采用与公司相融的解决方案
下面举一个国际化学公司的例子。这家公司本来是以非集中式的方式运行的,想通过SAP项目转换成集中方式,结果实施却遭到了彻底的惨败。从技术上说,SAP的技术完全能够把公司集中起来。“但是这只是问题的一个方面,问题的另一方面就是企业文化。在这个公司里,高级员工习惯于为公司运营做出各种决定,他们不愿意放弃这种权力。这个例子给我们的一个启示就是,不要把技术作为一种改变公司文化的工具。
条件五:太多没有经验的咨询人员
咨询小组的成员应该是新手和熟练人员的平衡组合。他说:“许多咨询公司都通过‘学术’手段来培训员工,给他们上一些培训课程,然后就直接送到客户那里去做咨询了。这根本就行不通。咨询小组必须有有经验的人参加。公司最好事先看一下咨询人员的简历,确定项目小组有有经验的人参加。国内的SAP咨询公司常常招一些KEYuser或IT来实施SAP项目,KEYuser常常是知识面狭,到了一家他没有经历过的公司,很难提出流程改进意见。而IT人员往往IT支持好,但对企业流程不熟。
条件六:对系统使用者的培训进行充分的培训
如果没有对系统使用者的培训进行充分的培训,会导致在系统实际运行后,咨询员还得留下来进行几个月的现场指导。如果没有充分的培训,员工们会按照他们自己的方式做事情,这样就无法对公司的新流程进行管理。这会导致每个业务领域都产生问题。
条件七:控制“范围爬升”
许多公司在它们开始项目前会创建一个业务用例,但接着它们就会因为ERP软件拥有一些其他的功能,而把这些功能胡乱的添加到项目范围里来。它们从来不会回头想一想最初的业务用例,思考一下“这项功能是否支持这个业务用例?”1000个小伤口也可以造成死亡。同样,每个对项目范围的改变可能都是一个很微小的改变,但是这些改变合起来却可能使项目超出预算,落后于计划时间,甚至更糟——最终没有产生任何预期的效益。”
条件八:不要把SAP项目看成一个技术项目
一个SAP实施项目涉及到人、流程、技术的平衡。如果实施小组90%是技术人员,而没有各个业务部门的代表参加,那么最终的结果可能是一个空想的技术实施项目,对公司增强竞争力毫无帮助。这听起来似乎很明白,但是还是有很多公司在犯这种错误。特别是企业高层领导,如果不能有正确认识,很难投入相关资源。
条件九:积极听取SAP顾问人员的建议
由于公司上SAP系统,公司以前可能用过其它ERP系统,但很少人用过SAP系统,而且SAP咨询人员,一般至少有几个SAP项目经验,在项目实施过程中,他们有过很多经验和教训。听取了他的的经验,企业将少走很多弯路。经常出现的情况是SAP咨询人员开始提出建议时,企业没有听取,到项目实施了一段时间后,发现原来坚持的意见是错的,又要重新返工。
条件十:分块实施SAP
许多公司试图通过分阶段实施SAP项目来迅速获得竞争优势。比如说,先实施财务模块,然后实施人力资源模块,接着是销售模块,等等。但是,这样做就不能很好的获得一个最终集成的系统。因为在你准备好进行下一阶段的实施的时候,你已经被前一阶段的作出的一些定义束缚住了。这种情况下,你不得不对前面阶段的工作进行大修改,使其能够与后面阶段的模块进行有效地整合。我们可以对业务流程进行逻辑分组,然后按照逻辑组一步步的进行实施,否则你可能需要比原来多一倍的时间来进行分步实施。
本文发布于:2025-01-31,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:十大上线SAP
发布评论