怎么用snapman一个人在三天内开发出一个复杂的软…
2018-06-18 03:59:51来源:未知 阅读 ()
snapman是一个简单而强大的团队协作软件,在上面的信息可以是数据、可以是规则、也可以是自动化代码;最重要的它是一个可以开发的协作平台,所有信息都可以作用到所有人或机器上,大大减少了工作的复杂度。软件开发项目是人类工程中对人力、脑力的配合度要求最高的项目。所以高智商的人才开发出各种项目定义实施流程:PMBOK、CMMI、IPD、SCRUM、XP等,这些流程的实施离不开各种强大的信息系统。但是这些系统只适合于大公司大流程,到单个的项目组级别很难为项目具体的特点做适配,随心所欲的更改。比如做10个项目要开发出10个软件版本这是基本不可能的事情。下面我们看看一个人如何在短短的三天内开发一个软件项目管理系统,短时间为每个项目开发一个适配的系统,将不可能变为可能。
一个软件项目包括:市场、客户需求、设计、开发、测试、版本发布、财务回款、软件维护等过程。我们今天设计的花季项目管理系统只包含:设计、开发、测试、版本发布的核心部分。花季项目管理系统组成包括:
1、项目信息和团队信息
2、设计及计划安排信息
3、员工每天工作日报
4、问题单提单与跟踪
5、员工工作绩效考评
项目中每个环节相互联系并紧密依赖:建立一个项目和团队,按照需求进行系统设计及每天每个员工的工作安排,员工每天按照计划进行工作并进行日报报告,MDE对Story功能进行验收和工作考评,测试人员的问题提单,开发人员对问题进行修复,直到版本成功发布,最终项目完成后系统和项目经理对员工进行评价考核。这个系统总共花费3天大部分时间在业务设计上,代码实现只花了一天多一点点:
一、首选是数据存储部分,如下创建五张表:花季项目信息、花季计划信息、花季工作日报、花季问题跟踪、花季员工考评;这五张表只用来存储数据,不涉及任何 代码,所以业务设计好后,每张表花了5-8分钟来实现
01.花季项目信息,这张表包括:项目的相关信息、需求任务书、项目附件、必要的团队成员、角色及其主管;这张表直接由PM手工维护,这里面的信息由后面的工作表格进行使用。
02.花季计划信息,这张表包括:项目的各个关键里程碑时间点,项目的工作点数和每人每天的平均点数(使用点数可以衡量一个模块的复杂难易程度从而安排不同级别员工的工作),每员工每天的工作内容及完成状态;这张表直接由PM、SE、MDE、TC维护,这里面的信息由后面的工作表格进行使用。
03.花季工作日报,这张表包括:每天每个员工的工作完成状态、今天的总结和明天的计划,员工主管对员工今天工作完成的验收及质量考核;这张表由:01.花季我的日报、01.花季日报审核,2张表自动维护。
04.花季问题跟踪,这张表包括:测试人员提单的问题要素、跟踪状态和开发人员的分析及修复状态;这张表由:03.花季我的问题、04.花季我的测试,2张表自动维护。
05.花季员工考评,这张表包括:每个员工的工作状态、工作质量、工作态度、主管的考核等;这张表由:02.花季团队考评、01.花季日报审核,2张表自动维护。
二、其次是员工工作部分,如下创建四张表:花季我的日报、花季我的任务、花季我的问题、花季我的测试;这4张表是员工每天需要完成的工作。这几张表涉及界面设计和代码控制,界面设计总共花了半个小时,代码控制每张表花了不到1个小时。
01.花季我的日报,这张表包括:项目信息、员工今天的工作点数、完成进度、今天总结、明天计划、工作相关的图片和附件。事件包括:
A、初始化事件,自动获取项目信息、如果今天已经写过日报取今天日报呈现出来,事件代码:
int GetDaily(void *g,wchar_t *date,wchar_t *name) { int row = 4; wchar_t *d,*n; while(1) { d = SnapmanCellGetText(g,row,2); n = SnapmanCellGetText(g,row,3); if(!d||!n)break; if(wcsicmp(d,date)==0&&wcsicmp(n,name)==0)return row; row++; } return 0; } wchar_t * GetUserManager(void *g,wchar_t *name) { int row = 18; int col = 2; wchar_t *manager = NULL, *strName = NULL; while(1) { strName = SnapmanCellGetText(g,row,2); if(!strName || wcslen(strName)==0)break; if(wcsicmp(name,strName)==0) { manager = SnapmanCellGetText(g,row,13); break; } row++; } return manager; } void OnInitialize(void *g) { void *gProject = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\01.花季项目信息")); void *gDaily = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\03.花季工作日报")); if(gProject&&gDaily) { int row = GetDaily(gDaily,Date(),SnapmanGetUserName()); if(row > 0) { SnapmanCellSetText(g,6,3,SnapmanCellGetText(gDaily,row,4)); SnapmanCellSetProgress(g,6,10,SnapmanCellGetInt(gDaily,row,5)); SnapmanCellSetText(g,7,3,SnapmanCellGetText(gDaily,row,6)); SnapmanCellSetText(g,14,3,SnapmanCellGetText(gDaily,row,7)); SnapmanCellSetFile(g,21,10,SnapmanCellGetFile(gDaily,row,10)); SnapmanCellSetPicture(g,21,3,SnapmanCellGetPicture(gDaily,row,9)); } SnapmanCellSetLock(g,4,3,0); SnapmanCellSetLock(g,4,10,0); SnapmanCellSetLock(g,5,3,0); SnapmanCellSetLock(g,5,10,0); SnapmanCellSetText(g,4,3,Date()); SnapmanCellSetText(g,4,10,SnapmanCellGetText(gProject,3,3)); SnapmanCellSetText(g,5,3,SnapmanGetUserName()); SnapmanCellSetText(g,5,10,GetUserManager(gProject,SnapmanGetUserName())); SnapmanCellSetLock(g,4,3,1); SnapmanCellSetLock(g,4,10,1); SnapmanCellSetLock(g,5,3,1); SnapmanCellSetLock(g,5,10,1); } SnapmanCleanUp(); }
B、取昨天日报按钮事件,事件代码:
#include "time.h" int GetLastDaily(void *g,wchar_t *date,wchar_t *name) { int row = SnapmanGridGetDataRowCount(g,2); wchar_t *d,*n; while(row >= 4) { d = SnapmanCellGetText(g,row,2); n = SnapmanCellGetText(g,row,3); if(d&&n) { if(wcsicmp(d,date)!=0&&wcsicmp(n,name)==0)return row; } row--; } return 0; } void OnButtonClick(void *g, int row, int col) { void *gDaily = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\03.花季工作日报")); if(gDaily) { int row = GetLastDaily(gDaily,Date(),SnapmanGetUserName()); if(row > 0) { SnapmanCellSetText(g,6,3,SnapmanCellGetText(gDaily,row,4)); SnapmanCellSetProgress(g,6,10,SnapmanCellGetInt(gDaily,row,5)); SnapmanCellSetText(g,7,3,SnapmanCellGetText(gDaily,row,6)); SnapmanCellSetText(g,14,3,SnapmanCellGetText(gDaily,row,7)); SnapmanCellSetFile(g,21,10,SnapmanCellGetFile(gDaily,row,10)); SnapmanCellSetPicture(g,21,3,SnapmanCellGetPicture(gDaily,row,9)); MessageBox(SnapmanWnd,"日报获取成功!","获取日报",MB_OK); }else { MessageBox(SnapmanWnd,"找不到昨天的日报!","获取日报",MB_OK); } } }
C、提交日报按钮事件 ,事件代码:
int GetDaily(void *g,wchar_t *date,wchar_t *name) { int row = 4; wchar_t *d,*n; while(1) { d = SnapmanCellGetText(g,row,2); n = SnapmanCellGetText(g,row,3); if(!d||!n)break; if(wcsicmp(d,date)==0&&wcsicmp(n,name)==0)return row; row++; } return 0; } void OnButtonClick(void *g, int row, int col) { void *gDaily = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\03.花季工作日报")); if(gDaily) { wchar_t *strWorkPoint = SnapmanCellGetText(g,6,3); wchar_t *strWorkload = SnapmanCellGetText(g,7,3); wchar_t *strPlanTomorrow = SnapmanCellGetText(g,14,3); if(!strWorkPoint || *strWorkPoint==0) { MessageBox(SnapmanWnd,"请填写工作点数!","提交日报",MB_OK); return; } if(!strWorkload || *strWorkload==0) { MessageBox(SnapmanWnd,"请填写今天工作总结!","提交日报",MB_OK); return; } if(!strPlanTomorrow || *strPlanTomorrow==0) { MessageBox(SnapmanWnd,"请填写明天工作计划!","提交日报",MB_OK); return; } int row = GetDaily(gDaily,Date(),SnapmanGetUserName()); if(row > 0) { SnapmanCellSetText(gDaily,row,4,SnapmanCellGetText(g,6,3)); SnapmanCellSetInt(gDaily,row,5,SnapmanCellGetInt(g,6,10)); SnapmanCellSetText(gDaily,row,6,SnapmanCellGetText(g,7,3)); SnapmanCellSetText(gDaily,row,7,SnapmanCellGetText(g,14,3)); SnapmanCellSetText(gDaily,row,8,DateTime()); SnapmanCellSetFile(gDaily,row,10,SnapmanCellGetFile(g,21,10)); SnapmanCellSetPicture(gDaily,row,9,SnapmanCellGetPicture(g,21,3)); }else { int maxRow = SnapmanGridGetDataRowCount(gDaily,2) + 1; SnapmanCellSetText(gDaily,maxRow,1,itostr(maxRow-3)); SnapmanCellSetText(gDaily,maxRow,2,Date()); SnapmanCellSetText(gDaily,maxRow,3,SnapmanGetUserName()); SnapmanCellSetText(gDaily,maxRow,4,SnapmanCellGetText(g,6,3)); SnapmanCellSetInt(gDaily,maxRow,5,SnapmanCellGetInt(g,6,10)); SnapmanCellSetText(gDaily,maxRow,6,SnapmanCellGetText(g,7,3)); SnapmanCellSetText(gDaily,maxRow,7,SnapmanCellGetText(g,14,3)); SnapmanCellSetText(gDaily,maxRow,8,DateTime()); SnapmanCellSetFile(gDaily,maxRow,10,SnapmanCellGetFile(g,21,10)); SnapmanCellSetPicture(gDaily,maxRow,9,SnapmanCellGetPicture(g,21,3)); } if(SnapmanGridSave(gDaily)) { MessageBox(SnapmanWnd,"日报提交成功!","提交日报",MB_OK); } } SnapmanCleanUp(); }
D、最终代码写完后将表格设置为不可以保存状态,这样表格就只能用来工作而不能用来存储数据,这样每个人写的日报就不会产生相互影响
02.花季我的任务,这张表包括:项目信息、员工前面未完成工作的统计、今天任务信息、今天任务完成状况。事件包括:
A、初始化事件,自动获取项目信息、自动计算员工前面未完成的工作,自动获取今天分配的任务,获取员工已经提交的任务信息,事件代码:
//一、获取日期和名字所在任务的行号 int GetPlanning(void *g,wchar_t *date,wchar_t *name) { int row = 17; wchar_t *d,*n; while(1) { d = SnapmanCellGetText(g,row,6); n = SnapmanCellGetText(g,row,12); if(!d||!n)break; if(wcsicmp(d,date)==0&&wcsicmp(n,name)==0)return row; row++; } return 0; } //二、获用名字获取其主管名称 wchar_t * GetUserManager(void *g,wchar_t *name) { int row = 18; int col = 2; wchar_t *manager = NULL, *strName = NULL; while(1) { strName = SnapmanCellGetText(g,row,2); if(!strName || wcslen(strName)==0)break; if(wcsicmp(name,strName)==0) { manager = SnapmanCellGetText(g,row,13); break; } row++; } return manager; } //三、设置用户信息 void SetUserInfo(void *g,void *gProject) { SnapmanCellSetLock(g,4,3,0); SnapmanCellSetLock(g,4,10,0); SnapmanCellSetLock(g,5,3,0); SnapmanCellSetLock(g,5,10,0); SnapmanCellSetText(g,4,3,Date()); SnapmanCellSetText(g,4,10,SnapmanCellGetText(gProject,3,3)); SnapmanCellSetText(g,5,3,SnapmanGetUserName()); SnapmanCellSetText(g,5,10,GetUserManager(gProject,SnapmanGetUserName())); SnapmanCellSetLock(g,4,3,1); SnapmanCellSetLock(g,4,10,1); SnapmanCellSetLock(g,5,3,1); SnapmanCellSetLock(g,5,10,1); } //四、设置计划信息 void SetPlanningInfo(void *g,void *gPlanning,int row) { //1、设置今天需要完成的计划任务 SnapmanCellSetLock(g,7,5,0); SnapmanCellSetLock(g,9,5,0); SnapmanCellSetLock(g,11,5,0); SnapmanCellSetLock(g,13,5,0); SnapmanCellSetLock(g,14,5,0); SnapmanCellSetText(g,7,5,SnapmanCellGetText(gPlanning,row,2)); SnapmanCellSetText(g,9,5,SnapmanCellGetText(gPlanning,row,3)); SnapmanCellSetText(g,11,5,SnapmanCellGetText(gPlanning,row,4)); SnapmanCellSetText(g,13,5,SnapmanCellGetText(gPlanning,row,5)); SnapmanCellSetText(g,14,5,SnapmanCellGetText(gPlanning,row,6)); SnapmanCellSetLock(g,7,5,1); SnapmanCellSetLock(g,9,5,1); SnapmanCellSetLock(g,11,5,1); SnapmanCellSetLock(g,13,5,1); SnapmanCellSetLock(g,14,5,1); //2、设置今天任务完成状态 SnapmanCellSetText(g,18,3,SnapmanCellGetText(gPlanning,row,8)); SnapmanCellSetText(g,20,3,SnapmanCellGetText(gPlanning,row,9)); SnapmanCellSetText(g,22,3,SnapmanCellGetText(gPlanning,row,10)); SnapmanCellSetText(g,24,3,SnapmanCellGetText(gPlanning,row,11)); SnapmanCellSetProgress(g,26,3,SnapmanCellGetInt(gPlanning,row,7)); SnapmanCellSetText(g,29,3,SnapmanCellGetText(gPlanning,row,14)); } //五、计算并设置未完成工作 void SetUnfinishedInfo(void *g,void *gPlanning) { int nUnfinished = 0,nProgress = 0; wchar_t *d,*n; wchar_t *today = SnapmanCellGetText(g,4,3); wchar_t *name = SnapmanCellGetText(g,5,3); if(!today||!name)return; int nTotalPlanning = SnapmanGridGetDataRowCount(gPlanning,1); for(int row = 17; row <= nTotalPlanning; row++) { d = SnapmanCellGetText(gPlanning,row,6); n = SnapmanCellGetText(gPlanning,row,12); nProgress = SnapmanCellGetInt(gPlanning,row,7); if(d&&n&&nProgress!=100&&wcsicmp(d,today)<0&&wcsicmp(n,name)==0)nUnfinished++; } if(nUnfinished > 0) { SnapmanCellSetText(g,6,3,concat3(L("前面您还有"),itostr(nUnfinished),L("天工作未正常完成,请取上一天任务完成它。"))); }else { SnapmanCellSetText(g,6,3,L("您前面的工作都正常完成了,好棒哦!")); } } //六、表格初始化事件函数 void OnInitialize(void *g) { void *gProject = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\01.花季项目信息")); void *gPlanning = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\02.花季计划信息")); if(gProject&&gPlanning) { int row = GetPlanning(gPlanning,Date(),SnapmanGetUserName()); if(row > 0) { SetPlanningInfo(g,gPlanning,row); }else { Print("今天暂时没有您的任务,请好好休息一下哦!"); } SetUserInfo(g,gProject); SetUnfinishedInfo(g,gPlanning); } SnapmanCleanUp(); }
B、取上一天任务按钮事件,事件代码:
//一、获取日期和名字所在任务的行号 int GetLastDayPlanning(void *g,wchar_t *date,wchar_t *name) { int row = 17,result = 0; wchar_t *d,*n,*l = NULL; while(1) { d = SnapmanCellGetText(g,row,6); n = SnapmanCellGetText(g,row,12); if(!d||!n)break; if(wcsicmp(d,date)<0&&wcsicmp(n,name)==0) { if(!l||wcsicmp(d,l)>0) { result = row; l = d; } } row++; } return result; } //二、获用名字获取其主管名称 wchar_t * GetUserManager(void *g,wchar_t *name) { int row = 18; int col = 2; wchar_t *manager = NULL, *strName = NULL; while(1) { strName = SnapmanCellGetText(g,row,2); if(!strName || wcslen(strName)==0)break; if(wcsicmp(name,strName)==0) { manager = SnapmanCellGetText(g,row,13); break; } row++; } return manager; } //四、设置计划信息 void SetPlanningInfo(void *g,void *gPlanning,int row) { //1、设置今天需要完成的计划任务 SnapmanCellSetLock(g,4,3,0); SnapmanCellSetLock(g,7,5,0); SnapmanCellSetLock(g,9,5,0); SnapmanCellSetLock(g,11,5,0); SnapmanCellSetLock(g,13,5,0); SnapmanCellSetLock(g,14,5,0); SnapmanCellSetText(g,4,3,SnapmanCellGetText(gPlanning,row,6)); SnapmanCellSetText(g,7,5,SnapmanCellGetText(gPlanning,row,2)); SnapmanCellSetText(g,9,5,SnapmanCellGetText(gPlanning,row,3)); SnapmanCellSetText(g,11,5,SnapmanCellGetText(gPlanning,row,4)); SnapmanCellSetText(g,13,5,SnapmanCellGetText(gPlanning,row,5)); SnapmanCellSetText(g,14,5,SnapmanCellGetText(gPlanning,row,6)); SnapmanCellSetLock(g,4,3,1); SnapmanCellSetLock(g,7,5,1); SnapmanCellSetLock(g,9,5,1); SnapmanCellSetLock(g,11,5,1); SnapmanCellSetLock(g,13,5,1); SnapmanCellSetLock(g,14,5,1); //2、设置今天任务完成状态 SnapmanCellSetText(g,18,3,SnapmanCellGetText(gPlanning,row,8)); SnapmanCellSetText(g,20,3,SnapmanCellGetText(gPlanning,row,9)); SnapmanCellSetText(g,22,3,SnapmanCellGetText(gPlanning,row,10)); SnapmanCellSetText(g,24,3,SnapmanCellGetText(gPlanning,row,11)); SnapmanCellSetProgress(g,26,3,SnapmanCellGetInt(gPlanning,row,7)); SnapmanCellSetText(g,29,3,SnapmanCellGetText(gPlanning,row,14)); } //五、计算并设置未完成工作 void SetUnfinishedInfo(void *g,void *gPlanning) { int nUnfinished = 0,nProgress = 0; wchar_t *d,*n; wchar_t *today = SnapmanCellGetText(g,4,3); wchar_t *name = SnapmanCellGetText(g,5,3); if(!today||!name)return; int nTotalPlanning = SnapmanGridGetDataRowCount(gPlanning,1); for(int row = 17; row <= nTotalPlanning; row++) { d = SnapmanCellGetText(gPlanning,row,6); n = SnapmanCellGetText(gPlanning,row,12); nProgress = SnapmanCellGetInt(gPlanning,row,7); if(d&&n&&nProgress!=100&&wcsicmp(d,today)<0&&wcsicmp(n,name)==0)nUnfinished++; } if(nUnfinished > 0) { SnapmanCellSetText(g,6,3,concat3(L("前面您还有"),itostr(nUnfinished),L("天工作未正常完成,请取上一天任务完成它。"))); }else { SnapmanCellSetText(g,6,3,L("您前面的工作都正常完成了,好棒哦!")); } } //六、按钮事件函数 void OnButtonClick(void *g, int row, int col) { void *gProject = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\01.花季项目信息")); void *gPlanning = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\02.花季计划信息")); if(gProject&&gPlanning) { int row = GetLastDayPlanning(gPlanning,SnapmanCellGetText(g,4,3),SnapmanCellGetText(g,5,3)); if(row > 0) { SetPlanningInfo(g,gPlanning,row); SetUnfinishedInfo(g,gPlanning); }else { Print("没能找到上一天的任务哦!"); } } SnapmanCleanUp(); }
C、取下一天任务按钮事件,事件代码:
//一、获取日期和名字所在任务的行号 int GetNextDayPlanning(void *g,wchar_t *date,wchar_t *name) { int row = 17,result = 0; wchar_t *d,*n,*l = NULL; while(1) { d = SnapmanCellGetText(g,row,6); n = SnapmanCellGetText(g,row,12); if(!d||!n)break; if(wcsicmp(d,date)>0&&wcsicmp(n,name)==0) { if(!l||wcsicmp(d,l)<0) { result = row; l = d; } } row++; } return result; } //二、获用名字获取其主管名称 wchar_t * GetUserManager(void *g,wchar_t *name) { int row = 18; int col = 2; wchar_t *manager = NULL, *strName = NULL; while(1) { strName = SnapmanCellGetText(g,row,2); if(!strName || wcslen(strName)==0)break; if(wcsicmp(name,strName)==0) { manager = SnapmanCellGetText(g,row,13); break; } row++; } return manager; } //四、设置计划信息 void SetPlanningInfo(void *g,void *gPlanning,int row) { //1、设置今天需要完成的计划任务 SnapmanCellSetLock(g,4,3,0); SnapmanCellSetLock(g,7,5,0); SnapmanCellSetLock(g,9,5,0); SnapmanCellSetLock(g,11,5,0); SnapmanCellSetLock(g,13,5,0); SnapmanCellSetLock(g,14,5,0); SnapmanCellSetText(g,4,3,SnapmanCellGetText(gPlanning,row,6)); SnapmanCellSetText(g,7,5,SnapmanCellGetText(gPlanning,row,2)); SnapmanCellSetText(g,9,5,SnapmanCellGetText(gPlanning,row,3)); SnapmanCellSetText(g,11,5,SnapmanCellGetText(gPlanning,row,4)); SnapmanCellSetText(g,13,5,SnapmanCellGetText(gPlanning,row,5)); SnapmanCellSetText(g,14,5,SnapmanCellGetText(gPlanning,row,6)); SnapmanCellSetLock(g,4,3,1); SnapmanCellSetLock(g,7,5,1); SnapmanCellSetLock(g,9,5,1); SnapmanCellSetLock(g,11,5,1); SnapmanCellSetLock(g,13,5,1); SnapmanCellSetLock(g,14,5,1); //2、设置今天任务完成状态 SnapmanCellSetText(g,18,3,SnapmanCellGetText(gPlanning,row,8)); SnapmanCellSetText(g,20,3,SnapmanCellGetText(gPlanning,row,9)); SnapmanCellSetText(g,22,3,SnapmanCellGetText(gPlanning,row,10)); SnapmanCellSetText(g,24,3,SnapmanCellGetText(gPlanning,row,11)); SnapmanCellSetProgress(g,26,3,SnapmanCellGetInt(gPlanning,row,7)); SnapmanCellSetText(g,29,3,SnapmanCellGetText(gPlanning,row,14)); } //五、计算并设置未完成工作 void SetUnfinishedInfo(void *g,void *gPlanning) { int nUnfinished = 0,nProgress = 0; wchar_t *d,*n; wchar_t *today = SnapmanCellGetText(g,4,3); wchar_t *name = SnapmanCellGetText(g,5,3); if(!today||!name)return; int nTotalPlanning = SnapmanGridGetDataRowCount(gPlanning,1); for(int row = 17; row <= nTotalPlanning; row++) { d = SnapmanCellGetText(gPlanning,row,6); n = SnapmanCellGetText(gPlanning,row,12); nProgress = SnapmanCellGetInt(gPlanning,row,7); if(d&&n&&nProgress!=100&&wcsicmp(d,today)<0&&wcsicmp(n,name)==0)nUnfinished++; } if(nUnfinished > 0) { SnapmanCellSetText(g,6,3,concat3(L("前面您还有"),itostr(nUnfinished),L("天工作未正常完成,请取上一天任务完成它。"))); }else { SnapmanCellSetText(g,6,3,L("您前面的工作都正常完成了,好棒哦!")); } } //六、按钮事件函数 void OnButtonClick(void *g, int row, int col) { void *gProject = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\01.花季项目信息")); void *gPlanning = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\02.花季计划信息")); if(gProject&&gPlanning) { int row = GetNextDayPlanning(gPlanning,SnapmanCellGetText(g,4,3),SnapmanCellGetText(g,5,3)); if(row > 0) { SetPlanningInfo(g,gPlanning,row); SetUnfinishedInfo(g,gPlanning); }else { Print("下一天没有安排任务哦!终于可以休息一下叻!"); } } SnapmanCleanUp(); }
D、提交任务进度按钮事件,事件代码:
//一、获取日期和名字所在任务的行号 int GetPlanning(void *g,wchar_t *date,wchar_t *name) { int row = 17; wchar_t *d,*n; while(1) { d = SnapmanCellGetText(g,row,6); n = SnapmanCellGetText(g,row,12); if(!d||!n)break; if(wcsicmp(d,date)==0&&wcsicmp(n,name)==0)return row; row++; } return 0; } //四、设置计划信息 void SavePlanningInfo(void *g,void *gPlanning,int row) { //2、设置今天任务完成状态 SnapmanCellSetText(gPlanning,row,8,SnapmanCellGetText(g,18,3)); SnapmanCellSetText(gPlanning,row,9,SnapmanCellGetText(g,20,3)); SnapmanCellSetText(gPlanning,row,10,SnapmanCellGetText(g,22,3)); SnapmanCellSetText(gPlanning,row,11,SnapmanCellGetText(g,24,3)); SnapmanCellSetProgress(gPlanning,row,7,SnapmanCellGetInt(g,26,3)); SnapmanCellSetText(gPlanning,row,14,SnapmanCellGetText(g,29,3)); SnapmanGridSave(gPlanning); } //六、表格初始化事件函数 void OnButtonClick(void *g, int row, int col) { void *gPlanning = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\02.花季计划信息")); if(gPlanning) { wchar_t *today = SnapmanCellGetText(g,4,3); wchar_t *name = SnapmanCellGetText(g,5,3); int row = GetPlanning(gPlanning,today,name); if(row > 0) { SavePlanningInfo(g,gPlanning,row); }else { Print("今天暂时没有您的任务,请好好休息一下哦!"); } } SnapmanCleanUp(); }
E、最终代码写完后将表格设置为不可以保存状态,这样表格就只能用来工作而不能用来存储数据,这样每个人写的任务进度就不会产生相互影响
03.花季我的问题,这张表包括:项目信息、我的问题单列表、当前选择问题信息、此问题的处理情况。事件包括:
A、初始化事件,自动获取项目信息、我的问题单列表、当前选择的问题信息展示、此问题的处理情况,问题还分为开发人员问题和测试人员问题侧重不同,事件代码:
wchar_t *GetDevTestProblemList(void *g,wchar_t *name) { wchar_t *result = NULL,*n,*t; int maxrow = SnapmanGridGetTotalDataRow(g); for(int row = 4;row <= maxrow; row++) { t = SnapmanCellGetText(g,row,7); n = SnapmanCellGetText(g,row,13); if(n&&(0==wcsicmp(name,n)||0==wcsicmp(t,name)))//开发或测试人员的都列上了 { if(result==NULL) { result = SnapmanCellGetText(g,row,1); }else { result = concat3(result,L"\n",SnapmanCellGetText(g,row,1)); } } } return result; } int GetLastDevRow(void *g,wchar_t *name) { wchar_t *n; int maxrow = SnapmanGridGetTotalDataRow(g); for(int row = maxrow;row >= 4; row--) { n = SnapmanCellGetText(g,row,13); if(n&&0==wcsicmp(name,n)) { return row; } } return 0; } //二、获用名字获取其主管名称 wchar_t * GetUserManager(void *g,wchar_t *name) { int row = 18; int col = 2; wchar_t *manager = NULL, *strName = NULL; while(1) { strName = SnapmanCellGetText(g,row,2); if(!strName || wcslen(strName)==0)break; if(wcsicmp(name,strName)==0) { manager = SnapmanCellGetText(g,row,13); break; } row++; } return manager; } //三、设置用户信息 void SetUserInfo(void *g,void *gProject) { SnapmanCellSetLock(g,4,3,0); SnapmanCellSetLock(g,4,10,0); SnapmanCellSetLock(g,5,3,0); SnapmanCellSetLock(g,5,10,0); SnapmanCellSetText(g,4,3,Date()); SnapmanCellSetText(g,4,10,SnapmanCellGetText(gProject,3,3)); SnapmanCellSetText(g,5,3,SnapmanGetUserName()); SnapmanCellSetText(g,5,10,GetUserManager(gProject,SnapmanGetUserName())); SnapmanCellSetLock(g,4,3,1); SnapmanCellSetLock(g,4,10,1); SnapmanCellSetLock(g,5,3,1); SnapmanCellSetLock(g,5,10,1); } void SetProblemInfo(void *g,void *gProblem,int row) { if(row > 0) { if(0==wcsicmp(SnapmanGetUserName(),SnapmanCellGetText(gProblem,row,7)))//是测试人员 { SnapmanCellSetLock(g,6,3,0); SnapmanCellSetLock(g,6,10,0); SnapmanCellSetLock(g,7,3,0); SnapmanCellSetLock(g,8,3,0); SnapmanCellSetLock(g,10,3,0); SnapmanCellSetLock(g,23,3,0); SnapmanCellSetLock(g,23,10,0); SnapmanCellSetText(g,6,3,SnapmanCellGetText(gProblem,row,1)); SnapmanCellSetText(g,6,10,SnapmanCellGetText(gProblem,row,8)); SnapmanCellSetText(g,7,3,SnapmanCellGetText(gProblem,row,7)); SnapmanCellSetText(g,7,10,SnapmanCellGetText(gProblem,row,9)); SnapmanCellSetText(g,8,3,SnapmanCellGetText(gProblem,row,2)); SnapmanCellSetText(g,10,3,SnapmanCellGetText(gProblem,row,3)); SnapmanCellSetPicture(g,23,3,SnapmanCellGetPicture(gProblem,row,4)); SnapmanCellSetFile(g,23,10,SnapmanCellGetFile(gProblem,row,5)); SnapmanCellSetLock(g,6,3,1); SnapmanCellSetLock(g,6,10,1); SnapmanCellSetLock(g,7,3,1);; SnapmanCellSetLock(g,8,3,1); SnapmanCellSetLock(g,10,3,1); SnapmanCellSetLock(g,23,3,1); SnapmanCellSetLock(g,23,10,1); SnapmanCellSetText(g,34,3,SnapmanCellGetText(gProblem,row,10)); SnapmanCellSetText(g,47,3,SnapmanCellGetText(gProblem,row,11)); SnapmanCellSetText(g,47,10,SnapmanCellGetText(gProblem,row,12)); SnapmanCellSetText(g,48,3,SnapmanCellGetText(gProblem,row,14)); SnapmanCellSetBackgoundColor(g,34,3,14806254); SnapmanCellSetBackgoundColor(g,47,3,14806254); SnapmanCellSetBackgoundColor(g,47,10,14806254); SnapmanCellSetBackgoundColor(g,48,3,14806254); SnapmanCellSetLock(g,34,3,1); SnapmanCellSetLock(g,47,3,1); SnapmanCellSetLock(g,47,10,1); SnapmanCellSetLock(g,48,3,1); }else//是开发人员 { SnapmanCellSetLock(g,6,3,0); SnapmanCellSetLock(g,6,10,0); SnapmanCellSetLock(g,7,3,0); SnapmanCellSetLock(g,8,3,0); SnapmanCellSetLock(g,10,3,0); SnapmanCellSetLock(g,23,3,0); SnapmanCellSetLock(g,23,10,0); SnapmanCellSetText(g,6,3,SnapmanCellGetText(gProblem,row,1)); SnapmanCellSetText(g,6,10,SnapmanCellGetText(gProblem,row,8)); SnapmanCellSetText(g,7,3,SnapmanCellGetText(gProblem,row,7)); SnapmanCellSetText(g,7,10,SnapmanCellGetText(gProblem,row,9)); SnapmanCellSetText(g,8,3,SnapmanCellGetText(gProblem,row,2)); SnapmanCellSetText(g,10,3,SnapmanCellGetText(gProblem,row,3)); SnapmanCellSetPicture(g,23,3,SnapmanCellGetPicture(gProblem,row,4)); SnapmanCellSetFile(g,23,10,SnapmanCellGetFile(gProblem,row,5)); SnapmanCellSetLock(g,6,3,1); SnapmanCellSetLock(g,6,10,1); SnapmanCellSetLock(g,7,3,1);; SnapmanCellSetLock(g,8,3,1); SnapmanCellSetLock(g,10,3,1); SnapmanCellSetLock(g,23,3,1); SnapmanCellSetLock(g,23,10,1); SnapmanCellSetLock(g,34,3,1); SnapmanCellSetLock(g,47,3,1); SnapmanCellSetLock(g,47,10,1); SnapmanCellSetLock(g,48,3,1); SnapmanCellSetText(g,34,3,SnapmanCellGetText(gProblem,row,10)); SnapmanCellSetText(g,47,3,SnapmanCellGetText(gProblem,row,11)); SnapmanCellSetText(g,47,10,SnapmanCellGetText(gProblem,row,12)); SnapmanCellSetText(g,48,3,SnapmanCellGetText(gProblem,row,14)); } } } void OnInitialize(void *g) { void *gProject = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\01.花季项目信息")); void *gProblem = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\04.花季问题跟踪")); if(gProject&&gProblem) { SnapmanCellSetCombo(g,6,3,GetDevTestProblemList(gProblem,SnapmanGetUserName())); SetProblemInfo(g,gProblem,GetLastDevRow(gProblem,SnapmanGetUserName())); SetUserInfo(g,gProject); } SnapmanCleanUp(); }
B、我的问题单下拉框的选择事件,获取当前问题信息展示、此问题的处理情况,事件代码:
int GetProblemRow(void *g,wchar_t *Index) { wchar_t *n; int maxrow = SnapmanGridGetTotalDataRow(g); for(int row = 4;row <= maxrow; row++) { n = SnapmanCellGetText(g,row,1); if(n&&0==wcsicmp(Index,n)) { return row; } } return 0; } void SetProblemInfo(void *g,void *gProblem,int row) { if(row > 0) { if(0==wcsicmp(SnapmanGetUserName(),SnapmanCellGetText(gProblem,row,7)))//是测试人员 { SnapmanCellSetLock(g,6,10,0); SnapmanCellSetLock(g,7,3,0); SnapmanCellSetLock(g,8,3,0); SnapmanCellSetLock(g,10,3,0); SnapmanCellSetLock(g,23,3,0); SnapmanCellSetLock(g,23,10,0); SnapmanCellSetText(g,6,10,SnapmanCellGetText(gProblem,row,8)); SnapmanCellSetText(g,7,3,SnapmanCellGetText(gProblem,row,7)); SnapmanCellSetText(g,7,10,SnapmanCellGetText(gProblem,row,9)); SnapmanCellSetText(g,8,3,SnapmanCellGetText(gProblem,row,2)); SnapmanCellSetText(g,10,3,SnapmanCellGetText(gProblem,row,3)); SnapmanCellSetPicture(g,23,3,SnapmanCellGetPicture(gProblem,row,4)); SnapmanCellSetFile(g,23,10,SnapmanCellGetFile(gProblem,row,5)); SnapmanCellSetLock(g,6,10,1); SnapmanCellSetLock(g,7,3,1);; SnapmanCellSetLock(g,8,3,1); SnapmanCellSetLock(g,10,3,1); SnapmanCellSetLock(g,23,3,1); SnapmanCellSetLock(g,23,10,1); SnapmanCellSetText(g,34,3,SnapmanCellGetText(gProblem,row,10)); SnapmanCellSetText(g,47,3,SnapmanCellGetText(gProblem,row,11)); SnapmanCellSetText(g,47,10,SnapmanCellGetText(gProblem,row,12)); SnapmanCellSetText(g,48,3,SnapmanCellGetText(gProblem,row,14)); SnapmanCellSetBackgoundColor(g,34,3,14806254); SnapmanCellSetBackgoundColor(g,47,3,14806254); SnapmanCellSetBackgoundColor(g,47,10,14806254); SnapmanCellSetBackgoundColor(g,48,3,14806254); SnapmanCellSetLock(g,34,3,1); SnapmanCellSetLock(g,47,3,1); SnapmanCellSetLock(g,47,10,1); SnapmanCellSetLock(g,48,3,1); }else//是开发人员 { SnapmanCellSetLock(g,6,3,0); SnapmanCellSetLock(g,6,10,0); SnapmanCellSetLock(g,7,3,0); SnapmanCellSetLock(g,8,3,0); SnapmanCellSetLock(g,10,3,0); SnapmanCellSetLock(g,23,3,0); SnapmanCellSetLock(g,23,10,0); SnapmanCellSetText(g,6,3,SnapmanCellGetText(gProblem,row,1)); SnapmanCellSetText(g,6,10,SnapmanCellGetText(gProblem,row,8)); SnapmanCellSetText(g,7,3,SnapmanCellGetText(gProblem,row,7)); SnapmanCellSetText(g,7,10,SnapmanCellGetText(gProblem,row,9)); SnapmanCellSetText(g,8,3,SnapmanCellGetText(gProblem,row,2)); SnapmanCellSetText(g,10,3,SnapmanCellGetText(gProblem,row,3)); SnapmanCellSetPicture(g,23,3,SnapmanCellGetPicture(gProblem,row,4)); SnapmanCellSetFile(g,23,10,SnapmanCellGetFile(gProblem,row,5)); SnapmanCellSetLock(g,6,3,1); SnapmanCellSetLock(g,6,10,1); SnapmanCellSetLock(g,7,3,1);; SnapmanCellSetLock(g,8,3,1); SnapmanCellSetLock(g,10,3,1); SnapmanCellSetLock(g,23,3,1); SnapmanCellSetLock(g,23,10,1); SnapmanCellSetLock(g,34,3,1); SnapmanCellSetLock(g,47,3,1); SnapmanCellSetLock(g,47,10,1); SnapmanCellSetLock(g,48,3,1); SnapmanCellSetText(g,34,3,SnapmanCellGetText(gProblem,row,10)); SnapmanCellSetText(g,47,3,SnapmanCellGetText(gProblem,row,11)); SnapmanCellSetText(g,47,10,SnapmanCellGetText(gProblem,row,12)); SnapmanCellSetText(g,48,3,SnapmanCellGetText(gProblem,row,14)); } } } void OnComboChanged(void *g, int row, int col,wchar_t *text) { void *gProject = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\01.花季项目信息")); void *gProblem = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\04.花季问题跟踪")); if(gProject&&gProblem) { SetProblemInfo(g,gProblem,GetProblemRow(gProblem,text)); } }
C、取上一个问题按钮事件,获取上一个问题信息展示、此问题处理状况,事件代码:
int GetLastDevRow(void *g,wchar_t *name) { wchar_t *n; int maxrow = SnapmanGridGetTotalDataRow(g); for(int row = maxrow;row >= 4; row--) { n = SnapmanCellGetText(g,row,13); if(n&&0==wcsicmp(name,n)) { return row; } } return 0; } int GetPrevDevRow(void *g,wchar_t *name,wchar_t *curIndex) { if(curIndex==NULL||curIndex[0]==0) { return GetLastDevRow(g,name); }else { int result = 0; wchar_t *n,*d,*l = NULL; int maxrow = SnapmanGridGetTotalDataRow(g); for(int row = maxrow;row >= 4; row--) { n = SnapmanCellGetText(g,row,13); d = SnapmanCellGetText(g,row,1); if(n&&0==wcsicmp(name,n)&& d && wcsicmp(d,curIndex) < 0) { if(!l||wcsicmp(d,l)>0) { result = row; l = d; } } } return result; } } void SetProblemInfo(void *g,void *gProblem,int row) { if(row > 0) { if(0==wcsicmp(SnapmanGetUserName(),SnapmanCellGetText(gProblem,row,7)))//是测试人员 { SnapmanCellSetLock(g,6,3,0); SnapmanCellSetLock(g,6,10,0); SnapmanCellSetLock(g,7,3,0); SnapmanCellSetLock(g,8,3,0); SnapmanCellSetLock(g,10,3,0); SnapmanCellSetLock(g,23,3,0); SnapmanCellSetLock(g,23,10,0); SnapmanCellSetText(g,6,3,SnapmanCellGetText(gProblem,row,1)); SnapmanCellSetText(g,6,10,SnapmanCellGetText(gProblem,row,8)); SnapmanCellSetText(g,7,3,SnapmanCellGetText(gProblem,row,7)); SnapmanCellSetText(g,7,10,SnapmanCellGetText(gProblem,row,9)); SnapmanCellSetText(g,8,3,SnapmanCellGetText(gProblem,row,2)); SnapmanCellSetText(g,10,3,SnapmanCellGetText(gProblem,row,3)); SnapmanCellSetPicture(g,23,3,SnapmanCellGetPicture(gProblem,row,4)); SnapmanCellSetFile(g,23,10,SnapmanCellGetFile(gProblem,row,5)); SnapmanCellSetLock(g,6,3,1); SnapmanCellSetLock(g,6,10,1); SnapmanCellSetLock(g,7,3,1);; SnapmanCellSetLock(g,8,3,1); SnapmanCellSetLock(g,10,3,1); SnapmanCellSetLock(g,23,3,1); SnapmanCellSetLock(g,23,10,1); SnapmanCellSetText(g,34,3,SnapmanCellGetText(gProblem,row,10)); SnapmanCellSetText(g,47,3,SnapmanCellGetText(gProblem,row,11)); SnapmanCellSetText(g,47,10,SnapmanCellGetText(gProblem,row,12)); SnapmanCellSetText(g,48,3,SnapmanCellGetText(gProblem,row,14)); SnapmanCellSetBackgoundColor(g,34,3,14806254); SnapmanCellSetBackgoundColor(g,47,3,14806254); SnapmanCellSetBackgoundColor(g,47,10,14806254); SnapmanCellSetBackgoundColor(g,48,3,14806254); SnapmanCellSetLock(g,34,3,1); SnapmanCellSetLock(g,47,3,1); SnapmanCellSetLock(g,47,10,1); SnapmanCellSetLock(g,48,3,1); }else//是开发人员 { SnapmanCellSetLock(g,6,3,0); SnapmanCellSetLock(g,6,10,0); SnapmanCellSetLock(g,7,3,0); SnapmanCellSetLock(g,8,3,0); SnapmanCellSetLock(g,10,3,0); SnapmanCellSetLock(g,23,3,0); SnapmanCellSetLock(g,23,10,0); SnapmanCellSetText(g,6,3,SnapmanCellGetText(gProblem,row,1)); SnapmanCellSetText(g,6,10,SnapmanCellGetText(gProblem,row,8)); SnapmanCellSetText(g,7,3,SnapmanCellGetText(gProblem,row,7)); SnapmanCellSetText(g,7,10,SnapmanCellGetText(gProblem,row,9)); SnapmanCellSetText(g,8,3,SnapmanCellGetText(gProblem,row,2)); SnapmanCellSetText(g,10,3,SnapmanCellGetText(gProblem,row,3)); SnapmanCellSetPicture(g,23,3,SnapmanCellGetPicture(gProblem,row,4)); SnapmanCellSetFile(g,23,10,SnapmanCellGetFile(gProblem,row,5)); SnapmanCellSetLock(g,6,3,1); SnapmanCellSetLock(g,6,10,1); SnapmanCellSetLock(g,7,3,1);; SnapmanCellSetLock(g,8,3,1); SnapmanCellSetLock(g,10,3,1); SnapmanCellSetLock(g,23,3,1); SnapmanCellSetLock(g,23,10,1); SnapmanCellSetLock(g,34,3,1); SnapmanCellSetLock(g,47,3,1); SnapmanCellSetLock(g,47,10,1); SnapmanCellSetLock(g,48,3,1); SnapmanCellSetText(g,34,3,SnapmanCellGetText(gProblem,row,10)); SnapmanCellSetText(g,47,3,SnapmanCellGetText(gProblem,row,11)); SnapmanCellSetText(g,47,10,SnapmanCellGetText(gProblem,row,12)); SnapmanCellSetText(g,48,3,SnapmanCellGetText(gProblem,row,14)); } }else { Print("没有上一个问题咯!"); } } //六、按钮事件函数 void OnButtonClick(void *g, int row, int col) { void *gProject = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\01.花季项目信息")); void *gProblem = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\04.花季问题跟踪")); if(gProject&&gProblem) { SetProblemInfo(g,gProblem,GetPrevDevRow(gProblem,SnapmanGetUserName(),SnapmanCellGetText(g,6,3))); } SnapmanCleanUp(); }
D、取下一个问题按钮事件,获取下一个问题信息展示、此问题处理状况,事件代码:
int GetLastDevRow(void *g,wchar_t *name) { wchar_t *n; int maxrow = SnapmanGridGetTotalDataRow(g); for(int row = maxrow;row >= 4; row--) { n = SnapmanCellGetText(g,row,13); if(n&&0==wcsicmp(name,n)) { return row; } } return 0; } int GetNextDevRow(void *g,wchar_t *name,wchar_t *curIndex) { if(curIndex==NULL||curIndex[0]==0) { return GetLastDevRow(g,name); }else { int result = 0; wchar_t *n,*d,*l = NULL; int maxrow = SnapmanGridGetTotalDataRow(g); for(int row = maxrow;row >= 4; row--) { n = SnapmanCellGetText(g,row,13); d = SnapmanCellGetText(g,row,1); if(n&&0==wcsicmp(name,n)&& d && wcsicmp(d,curIndex) > 0) { if(!l||wcsicmp(d,l)<0) { result = row; l = d; } } } return result; } } void SetProblemInfo(void *g,void *gProblem,int row) { if(row > 0) { if(0==wcsicmp(SnapmanGetUserName(),SnapmanCellGetText(gProblem,row,7)))//是测试人员 { SnapmanCellSetLock(g,6,3,0); SnapmanCellSetLock(g,6,10,0); SnapmanCellSetLock(g,7,3,0); SnapmanCellSetLock(g,8,3,0); SnapmanCellSetLock(g,10,3,0); SnapmanCellSetLock(g,23,3,0); SnapmanCellSetLock(g,23,10,0); SnapmanCellSetText(g,6,3,SnapmanCellGetText(gProblem,row,1)); SnapmanCellSetText(g,6,10,SnapmanCellGetText(gProblem,row,8)); SnapmanCellSetText(g,7,3,SnapmanCellGetText(gProblem,row,7)); SnapmanCellSetText(g,7,10,SnapmanCellGetText(gProblem,row,9)); SnapmanCellSetText(g,8,3,SnapmanCellGetText(gProblem,row,2)); SnapmanCellSetText(g,10,3,SnapmanCellGetText(gProblem,row,3)); SnapmanCellSetPicture(g,23,3,SnapmanCellGetPicture(gProblem,row,4)); SnapmanCellSetFile(g,23,10,SnapmanCellGetFile(gProblem,row,5)); SnapmanCellSetLock(g,6,3,1); SnapmanCellSetLock(g,6,10,1); SnapmanCellSetLock(g,7,3,1);; SnapmanCellSetLock(g,8,3,1); SnapmanCellSetLock(g,10,3,1); SnapmanCellSetLock(g,23,3,1); SnapmanCellSetLock(g,23,10,1); SnapmanCellSetText(g,34,3,SnapmanCellGetText(gProblem,row,10)); SnapmanCellSetText(g,47,3,SnapmanCellGetText(gProblem,row,11)); SnapmanCellSetText(g,47,10,SnapmanCellGetText(gProblem,row,12)); SnapmanCellSetText(g,48,3,SnapmanCellGetText(gProblem,row,14)); SnapmanCellSetBackgoundColor(g,34,3,14806254); SnapmanCellSetBackgoundColor(g,47,3,14806254); SnapmanCellSetBackgoundColor(g,47,10,14806254); SnapmanCellSetBackgoundColor(g,48,3,14806254); SnapmanCellSetLock(g,34,3,1); SnapmanCellSetLock(g,47,3,1); SnapmanCellSetLock(g,47,10,1); SnapmanCellSetLock(g,48,3,1); }else//是开发人员 { SnapmanCellSetLock(g,6,3,0); SnapmanCellSetLock(g,6,10,0); SnapmanCellSetLock(g,7,3,0); SnapmanCellSetLock(g,8,3,0); SnapmanCellSetLock(g,10,3,0); SnapmanCellSetLock(g,23,3,0); SnapmanCellSetLock(g,23,10,0); SnapmanCellSetText(g,6,3,SnapmanCellGetText(gProblem,row,1)); SnapmanCellSetText(g,6,10,SnapmanCellGetText(gProblem,row,8)); SnapmanCellSetText(g,7,3,SnapmanCellGetText(gProblem,row,7)); SnapmanCellSetText(g,7,10,SnapmanCellGetText(gProblem,row,9)); SnapmanCellSetText(g,8,3,SnapmanCellGetText(gProblem,row,2)); SnapmanCellSetText(g,10,3,SnapmanCellGetText(gProblem,row,3)); SnapmanCellSetPicture(g,23,3,SnapmanCellGetPicture(gProblem,row,4)); SnapmanCellSetFile(g,23,10,SnapmanCellGetFile(gProblem,row,5)); SnapmanCellSetLock(g,6,3,1); SnapmanCellSetLock(g,6,10,1); SnapmanCellSetLock(g,7,3,1);; SnapmanCellSetLock(g,8,3,1); SnapmanCellSetLock(g,10,3,1); SnapmanCellSetLock(g,23,3,1); SnapmanCellSetLock(g,23,10,1); SnapmanCellSetLock(g,34,3,1); SnapmanCellSetLock(g,47,3,1); SnapmanCellSetLock(g,47,10,1); SnapmanCellSetLock(g,48,3,1); SnapmanCellSetText(g,34,3,SnapmanCellGetText(gProblem,row,10)); SnapmanCellSetText(g,47,3,SnapmanCellGetText(gProblem,row,11)); SnapmanCellSetText(g,47,10,SnapmanCellGetText(gProblem,row,12)); SnapmanCellSetText(g,48,3,SnapmanCellGetText(gProblem,row,14)); } }else { Print("没有下一个问题咯!"); } } //六、按钮事件函数 void OnButtonClick(void *g, int row, int col) { void *gProject = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\01.花季项目信息")); void *gProblem = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\04.花季问题跟踪")); if(gProject&&gProblem) { SetProblemInfo(g,gProblem,GetNextDevRow(gProblem,SnapmanGetUserName(),SnapmanCellGetText(g,6,3))); } SnapmanCleanUp(); }
E、提交问题进度按钮事件,事件代码:
int GetProblemRow(void *g,wchar_t *Index) { wchar_t *n; int maxrow = SnapmanGridGetTotalDataRow(g); for(int row = 4;row <= maxrow; row++) { n = SnapmanCellGetText(g,row,1); if(n&&0==wcsicmp(Index,n)) { return row; } } return 0; } void SaveProblemProgress(void *g,void *gProblem) { wchar_t *d = SnapmanCellGetText(g,6,3); if(d&&d[0]!=0) { int row = GetProblemRow(gProblem,d); if(0==wcsicmp(SnapmanGetUserName(),SnapmanCellGetText(gProblem,row,7)))//是测试人员 { if(SnapmanCellIsEmpty(g,7,10)) { Print("请填写问题状态!"); }else { SnapmanCellSetText(gProblem,row,9,SnapmanCellGetText(g,7,10)); SnapmanGridSave(gProblem); Print("问题进度提交成功!"); } }else if(row>0)//是开发人员 { if(SnapmanCellIsEmpty(g,7,10)) { Print("请填写问题状态!"); }else if(SnapmanCellIsEmpty(g,34,3)) { Print("请填写问题分析!"); }else if(SnapmanCellIsEmpty(g,47,3)) { Print("请填写修复时间!"); }else if(SnapmanCellIsEmpty(g,47,10)) { Print("请填写修复版本!"); }else { SnapmanCellSetText(gProblem,row,9,SnapmanCellGetText(g,7,10)); SnapmanCellSetText(gProblem,row,10,SnapmanCellGetText(g,34,3)); SnapmanCellSetText(gProblem,row,11,SnapmanCellGetText(g,47,3)); SnapmanCellSetText(gProblem,row,12,SnapmanCellGetText(g,47,10)); SnapmanCellSetText(gProblem,row,14,SnapmanCellGetText(g,48,3)); SnapmanGridSave(gProblem); Print("问题进度提交成功!"); } }else { wPrint(L("问题列表中找不到问题单号为:%s"),d); } }else { Print("请选择问题单号!"); } } //六、按钮事件函数 void OnButtonClick(void *g, int row, int col) { void *gProject = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\01.花季项目信息")); void *gProblem = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\04.花季问题跟踪")); if(gProject&&gProblem) { SaveProblemProgress(g,gProblem); } SnapmanCleanUp(); }
F、最终代码写完后将表格设置为不可以保存状态,这样表格就只能用来工作而不能用来存储数据,这样每个人写的问题处理进度就不会产生相互影响
04.花季我的测试,这张表包括:测试人员提单的问题要素、跟踪状态和开发人员的分析及修复状态;这张表由:03.花季我的问题、04.花季我的测试,2张表自动维护。
A、初始化事件,自动获取项目信息、我的问题单列表、当前选择的问题信息展示,事件代码:
wchar_t *GetUserProblemList(void *g,wchar_t *name) { wchar_t *result = NULL,*n; int maxrow = SnapmanGridGetTotalDataRow(g); for(int row = 4;row <= maxrow; row++) { n = SnapmanCellGetText(g,row,7); if(n&&0==wcsicmp(name,n)) { if(result==NULL) { result = n; }else { result = concat3(result,L"\n",n); } } } return result; } wchar_t *GetDevList(void *g) { wchar_t *result = NULL,*n; int maxrow = SnapmanGridGetTotalDataRow(g); for(int row = 18;row <= maxrow; row++) { n = SnapmanCellGetText(g,row,2); if(n&&n[0]!=0) { if(result==NULL) { result = n; }else { result = concat3(result,L"\n",n); } } } return result; } //二、获用名字获取其主管名称 wchar_t * GetUserManager(void *g,wchar_t *name) { int row = 18; int col = 2; wchar_t *manager = NULL, *strName = NULL; while(1) { strName = SnapmanCellGetText(g,row,2); if(!strName || wcslen(strName)==0)break; if(wcsicmp(name,strName)==0) { manager = SnapmanCellGetText(g,row,13); break; } row++; } return manager; } //三、设置用户信息 void SetUserInfo(void *g,void *gProject) { SnapmanCellSetLock(g,4,3,0); SnapmanCellSetLock(g,4,10,0); SnapmanCellSetLock(g,5,3,0); SnapmanCellSetLock(g,5,10,0); SnapmanCellSetText(g,4,3,Date()); SnapmanCellSetText(g,4,10,SnapmanCellGetText(gProject,3,3)); SnapmanCellSetText(g,5,3,SnapmanGetUserName()); SnapmanCellSetText(g,5,10,GetUserManager(gProject,SnapmanGetUserName())); SnapmanCellSetLock(g,4,3,1); SnapmanCellSetLock(g,4,10,1); SnapmanCellSetLock(g,5,3,1); SnapmanCellSetLock(g,5,10,1); } void OnInitialize(void *g) { void *gProject = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\01.花季项目信息")); void *gProblem = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\04.花季问题跟踪")); if(gProject&&gProblem) { SnapmanCellSetCombo(g,6,3,GetUserProblemList(g,SnapmanGetUserName())); SnapmanCellSetCombo(g,7,3,GetDevList(gProject)); SetUserInfo(g,gProject); } }
B、我的问题单下拉框的选择事件,获取当前问题信息展示,事件代码:
int GetProblemRow(void *g,wchar_t *Index) { wchar_t *n; int maxrow = SnapmanGridGetTotalDataRow(g); for(int row = 4;row <= maxrow; row++) { n = SnapmanCellGetText(g,row,1); if(n&&0==wcsicmp(Index,n)) { return row; } } return 0; } void SetProblemInfo(void *g,void *gProblem,int row) { if(row > 0) { if(0==wcsicmp(SnapmanGetUserName(),SnapmanCellGetText(gProblem,row,7)))//是测试人员 { SnapmanCellSetLock(g,6,10,0); SnapmanCellSetLock(g,7,3,0); SnapmanCellSetLock(g,8,3,0); SnapmanCellSetLock(g,10,3,0); SnapmanCellSetLock(g,23,3,0); SnapmanCellSetLock(g,23,10,0); SnapmanCellSetText(g,6,10,SnapmanCellGetText(gProblem,row,8)); SnapmanCellSetText(g,7,3,SnapmanCellGetText(gProblem,row,7)); SnapmanCellSetText(g,7,10,SnapmanCellGetText(gProblem,row,9)); SnapmanCellSetText(g,8,3,SnapmanCellGetText(gProblem,row,2)); SnapmanCellSetText(g,10,3,SnapmanCellGetText(gProblem,row,3)); SnapmanCellSetPicture(g,23,3,SnapmanCellGetPicture(gProblem,row,4)); SnapmanCellSetFile(g,23,10,SnapmanCellGetFile(gProblem,row,5)); SnapmanCellSetLock(g,6,10,1); SnapmanCellSetLock(g,7,3,1);; SnapmanCellSetLock(g,8,3,1); SnapmanCellSetLock(g,10,3,1); SnapmanCellSetLock(g,23,3,1); SnapmanCellSetLock(g,23,10,1); SnapmanCellSetText(g,34,3,SnapmanCellGetText(gProblem,row,10)); SnapmanCellSetText(g,47,3,SnapmanCellGetText(gProblem,row,11)); SnapmanCellSetText(g,47,10,SnapmanCellGetText(gProblem,row,12)); SnapmanCellSetText(g,48,3,SnapmanCellGetText(gProblem,row,14)); SnapmanCellSetBackgoundColor(g,34,3,14806254); SnapmanCellSetBackgoundColor(g,47,3,14806254); SnapmanCellSetBackgoundColor(g,47,10,14806254); SnapmanCellSetBackgoundColor(g,48,3,14806254); SnapmanCellSetLock(g,34,3,1); SnapmanCellSetLock(g,47,3,1); SnapmanCellSetLock(g,47,10,1); SnapmanCellSetLock(g,48,3,1); }else//是开发人员 { SnapmanCellSetLock(g,6,3,0); SnapmanCellSetLock(g,6,10,0); SnapmanCellSetLock(g,7,3,0); SnapmanCellSetLock(g,8,3,0); SnapmanCellSetLock(g,10,3,0); SnapmanCellSetLock(g,23,3,0); SnapmanCellSetLock(g,23,10,0); SnapmanCellSetText(g,6,3,SnapmanCellGetText(gProblem,row,1)); SnapmanCellSetText(g,6,10,SnapmanCellGetText(gProblem,row,8)); SnapmanCellSetText(g,7,3,SnapmanCellGetText(gProblem,row,7)); SnapmanCellSetText(g,7,10,SnapmanCellGetText(gProblem,row,9)); SnapmanCellSetText(g,8,3,SnapmanCellGetText(gProblem,row,2)); SnapmanCellSetText(g,10,3,SnapmanCellGetText(gProblem,row,3)); SnapmanCellSetPicture(g,23,3,SnapmanCellGetPicture(gProblem,row,4)); SnapmanCellSetFile(g,23,10,SnapmanCellGetFile(gProblem,row,5)); SnapmanCellSetLock(g,6,3,1); SnapmanCellSetLock(g,6,10,1); SnapmanCellSetLock(g,7,3,1);; SnapmanCellSetLock(g,8,3,1); SnapmanCellSetLock(g,10,3,1); SnapmanCellSetLock(g,23,3,1); SnapmanCellSetLock(g,23,10,1); SnapmanCellSetLock(g,34,3,1); SnapmanCellSetLock(g,47,3,1); SnapmanCellSetLock(g,47,10,1); SnapmanCellSetLock(g,48,3,1); SnapmanCellSetText(g,34,3,SnapmanCellGetText(gProblem,row,10)); SnapmanCellSetText(g,47,3,SnapmanCellGetText(gProblem,row,11)); SnapmanCellSetText(g,47,10,SnapmanCellGetText(gProblem,row,12)); SnapmanCellSetText(g,48,3,SnapmanCellGetText(gProblem,row,14)); } } } void OnComboChanged(void *g, int row, int col,wchar_t *text) { void *gProject = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\01.花季项目信息")); void *gProblem = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\04.花季问题跟踪")); if(gProject&&gProblem) { SetProblemInfo(g,gProblem,GetProblemRow(gProblem,text)); } }
C、取上一个问题按钮事件,获取上一个问题信息展示,事件代码:
//一、获取日期和名字所在任务的行号 int GetPrevProblem(void *g,int index,wchar_t *name) { wchar_t *n = NULL; int maxrow = SnapmanGridGetTotalDataRow(g); for(int row = maxrow;row >= 4; row--) { n = SnapmanCellGetText(g,row,7); if(n&&0==wcsicmp(name,n)) { if(index==0) { return row; }else if(SnapmanCellGetInt(g,row,1)<index) { return row; } } } return 0; } void SetProblemInfo(void *g,void *gProblem,int row) { SnapmanCellSetText(g,6,3,SnapmanCellGetText(gProblem,row,1)); SnapmanCellSetText(g,6,10,SnapmanCellGetText(gProblem,row,8)); SnapmanCellSetText(g,7,3,SnapmanCellGetText(gProblem,row,13)); SnapmanCellSetText(g,7,10,SnapmanCellGetText(gProblem,row,9)); SnapmanCellSetText(g,8,3,SnapmanCellGetText(gProblem,row,2)); SnapmanCellSetText(g,10,3,SnapmanCellGetText(gProblem,row,3)); SnapmanCellSetPicture(g,23,3,SnapmanCellGetPicture(gProblem,row,4)); SnapmanCellSetFile(g,23,10,SnapmanCellGetFile(gProblem,row,5)); } //六、按钮事件函数 void OnButtonClick(void *g, int row, int col) { void *gProject = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\01.花季项目信息")); void *gProblem = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\04.花季问题跟踪")); if(gProject&&gProblem) { int row = GetPrevProblem(gProblem,SnapmanCellGetInt(g,6,3),SnapmanCellGetText(g,5,3)); if(row > 0) { SetProblemInfo(g,gProblem,row); }else { Print("找不到上一个问题单了哦!"); } } SnapmanCleanUp(); }
D、取下一个问题按钮事件,获取下一个问题信息展示,事件代码:
//一、获取日期和名字所在任务的行号 int GetNextProblem(void *g,int index,wchar_t *name) { wchar_t *n = NULL; int maxrow = SnapmanGridGetTotalDataRow(g); for(int row = maxrow;row >= 4; row--) { n = SnapmanCellGetText(g,row,7); if(n&&0==wcsicmp(name,n)) { if(index==0) { return row; }else if(SnapmanCellGetInt(g,row,1)>index) { return row; } } } return 0; } void SetProblemInfo(void *g,void *gProblem,int row) { SnapmanCellSetText(g,6,3,SnapmanCellGetText(gProblem,row,1)); SnapmanCellSetText(g,6,10,SnapmanCellGetText(gProblem,row,8)); SnapmanCellSetText(g,7,3,SnapmanCellGetText(gProblem,row,13)); SnapmanCellSetText(g,7,10,SnapmanCellGetText(gProblem,row,9)); SnapmanCellSetText(g,8,3,SnapmanCellGetText(gProblem,row,2)); SnapmanCellSetText(g,10,3,SnapmanCellGetText(gProblem,row,3)); SnapmanCellSetPicture(g,23,3,SnapmanCellGetPicture(gProblem,row,4)); SnapmanCellSetFile(g,23,10,SnapmanCellGetFile(gProblem,row,5)); } //六、按钮事件函数 void OnButtonClick(void *g, int row, int col) { void *gProject = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\01.花季项目信息")); void *gProblem = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\04.花季问题跟踪")); if(gProject&&gProblem) { int row = GetNextProblem(gProblem,SnapmanCellGetInt(g,6,3),SnapmanCellGetText(g,5,3)); if(row > 0) { SetProblemInfo(g,gProblem,row); }else { Print("找不到下一个问题单了哦!"); } } SnapmanCleanUp(); }
E、提交问题单按钮事件,事件代码:
//一、获取日期和名字所在任务的行号 int GetProblemRow(void *g,int index) { wchar_t *n = NULL; int maxrow = SnapmanGridGetTotalDataRow(g); if(index > 0) { for(int row = maxrow;row >= 4; row--) { if(SnapmanCellGetInt(g,row,1)==index) { return row; } } } return maxrow + 1; } void SetProblemInfo(void *g,void *gProblem,int row) { SnapmanCellSetInt(gProblem,row,1,row - 3); SnapmanCellSetText(gProblem,row,8,SnapmanCellGetText(g,6,10)); SnapmanCellSetText(gProblem,row,13,SnapmanCellGetText(g,7,3)); SnapmanCellSetText(gProblem,row,9,SnapmanCellGetText(g,7,10)); SnapmanCellSetText(gProblem,row,2,SnapmanCellGetText(g,8,3)); SnapmanCellSetText(gProblem,row,3,SnapmanCellGetText(g,10,3)); SnapmanCellSetPicture(gProblem,row,4,SnapmanCellGetPicture(g,23,3)); SnapmanCellSetFile(gProblem,row,5,SnapmanCellGetFile(g,23,10)); SnapmanCellSetText(gProblem,row,6,DateTime()); SnapmanCellSetText(gProblem,row,7,SnapmanGetUserName()); SnapmanGridSave(gProblem); //清空问题单 SnapmanCellClearData(g,6,3); SnapmanCellClearData(g,6,10); SnapmanCellClearData(g,7,3); SnapmanCellClearData(g,7,10); SnapmanCellClearData(g,8,3); SnapmanCellClearData(g,10,3); SnapmanCellClearData(g,23,3); SnapmanCellClearData(g,23,10); } //六、按钮事件函数 void OnButtonClick(void *g, int row, int col) { void *gProject = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\01.花季项目信息")); void *gProblem = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\04.花季问题跟踪")); int row = 0, rego = 1; if(gProject&&gProblem) { wchar_t *text1 = SnapmanCellGetText(g,6,10); wchar_t *text2 = SnapmanCellGetText(g,7,3); wchar_t *text3 = SnapmanCellGetText(g,7,10); wchar_t *text4 = SnapmanCellGetText(g,8,3); wchar_t *text5 = SnapmanCellGetText(g,10,3); if(!text1||text1[0]==0) { rego = 0; Print("请选择问题级别!"); }else if(!text2||text2[0]==0) { rego = 0; Print("请选择开发人员!"); }else if(!text3||text3[0]==0) { rego = 0; Print("请选择问题状态!"); }else if(!text4||text4[0]==0) { rego = 0; Print("请填写问题相关Story!"); }else if(!text5||text5[0]==0) { rego = 0; Print("请填写问题描述!"); } if(rego) { row = GetProblemRow(gProblem,SnapmanCellGetInt(g,6,3)); SetProblemInfo(g,gProblem,row); Print("问题单已经成功提交!"); } } SnapmanCleanUp(); }
F、最终代码写完后将表格设置为不可以保存状态,这样表格就只能用来工作而不能用来存储数据,这样每个人写的问题单就不会产生相互影响
三、再次是领导主管的工作部分,如下创建三张表:花季日报审核、花季团队考评、花季项目进度。这几张表涉及界面设计和代码控制,界面设计总共花了20多分钟,代码控制每张表花了不到1个小时。
01.花季日报审核,这张表包括:项目信息、员工列表、当前选择员工的日报、主管的考评信息(每天的考核分数纳入到最终的考核成绩里)。事件包括:
A、初始化事件,自动获取项目信息、员工列表、当前选择员工的日报、考评信息,事件代码:
wchar_t* GetEmployee(void *g,void *m,wchar_t *date,wchar_t *name) { int row = 4; wchar_t *d,*n,*result = NULL,*manager; while(1) { d = SnapmanCellGetText(g,row,2); n = SnapmanCellGetText(g,row,3); if(!d||!n)break; if(wcsicmp(date,d)==0) { manager = FindMap(m,n); if(manager&&wcsicmp(manager,name)==0) { if(!result) { result = n; }else { result = concat3(result,L"\n",n); } } } row++; } return result; } void * GetUserManager(void *g) { int row = 18; int maxRow = SnapmanGridGetTotalDataRow(g); wchar_t *strName = NULL, *strManager = NULL; void *result = NULL; for(; row <= maxRow; row++) { strName = SnapmanCellGetText(g,row,2); strManager = SnapmanCellGetText(g,row,13); if(strName && strManager) { result = InsertMap(result,strName,strManager); } } return result; } int GetDailyRow(void *g,wchar_t *user,wchar_t *time) { int row = 4; wchar_t *d,*n; while(1) { d = SnapmanCellGetText(g,row,2); n = SnapmanCellGetText(g,row,3); if(!d||!n)break; if(wcsicmp(time,d)==0&&wcsicmp(n,user)==0)return row; row++; } return 0; } void OnInitialize(void *g) { int row = 0; void *gProject = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\01.花季项目信息")); void *gDaily = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\03.花季工作日报")); if(gProject&&gDaily) { SnapmanCellSetLock(g,4,3,0); SnapmanCellSetLock(g,4,10,0); SnapmanCellSetLock(g,5,10,0); SnapmanCellSetText(g,4,3,Date()); SnapmanCellSetText(g,4,10,SnapmanCellGetText(gProject,3,3)); SnapmanCellSetCombo(g,5,3,GetEmployee(gDaily,GetUserManager(gProject),Date(),SnapmanGetUserName())); SnapmanCellSetText(g,5,10,SnapmanGetUserName()); SnapmanCellSetLock(g,4,3,1); SnapmanCellSetLock(g,4,10,1); SnapmanCellSetLock(g,5,10,1); SnapmanCellSetComboIndex(g,5,3,0); row = GetDailyRow(gDaily,SnapmanCellGetText(g,5,3),Date()); if(row > 0) { SnapmanCellSetText(g,6,3,SnapmanCellGetText(gDaily,row,4)); SnapmanCellSetProgress(g,6,10,SnapmanCellGetInt(gDaily,row,5)); SnapmanCellSetText(g,7,3,SnapmanCellGetText(gDaily,row,6)); SnapmanCellSetText(g,14,3,SnapmanCellGetText(gDaily,row,7)); SnapmanCellSetFile(g,21,10,SnapmanCellGetFile(gDaily,row,10)); SnapmanCellSetPicture(g,21,3,SnapmanCellGetPicture(gDaily,row,9)); SnapmanCellSetText(g,28,3,SnapmanCellGetText(gDaily,row,11)); SnapmanCellSetText(g,36,3,SnapmanCellGetText(gDaily,row,12)); }else { Print("没有用户日报。"); } } SnapmanCleanUp(); }
B、员工选择下拉框的选择事件,获取当前选择员工的日报、考评信息,事件代码:
int GetDailyRow(void *g,wchar_t *user,wchar_t *time) { int row = 4; wchar_t *d,*n; while(1) { d = SnapmanCellGetText(g,row,2); n = SnapmanCellGetText(g,row,3); if(!d||!n)break; if(wcsicmp(time,d)==0&&wcsicmp(n,user)==0)return row; row++; } return 0; } void OnComboChanged(void *g, int row, int col,wchar_t *text) { int row = 0; void *gProject = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\01.花季项目信息")); void *gDaily = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\03.花季工作日报")); if(gProject&&gDaily) { row = GetDailyRow(gDaily,text,Date()); if(row > 0) { SnapmanCellSetText(g,6,3,SnapmanCellGetText(gDaily,row,4)); SnapmanCellSetProgress(g,6,10,SnapmanCellGetInt(gDaily,row,5)); SnapmanCellSetText(g,7,3,SnapmanCellGetText(gDaily,row,6)); SnapmanCellSetText(g,14,3,SnapmanCellGetText(gDaily,row,7)); SnapmanCellSetFile(g,21,10,SnapmanCellGetFile(gDaily,row,10)); SnapmanCellSetPicture(g,21,3,SnapmanCellGetPicture(gDaily,row,9)); SnapmanCellSetText(g,28,3,SnapmanCellGetText(gDaily,row,11)); SnapmanCellSetText(g,36,3,SnapmanCellGetText(gDaily,row,12)); }else { Print("找不到用户日报。"); } } SnapmanCleanUp(); }
C、提交日报考评按钮事件,事件代码:
int GetDailyRow(void *g,wchar_t *user,wchar_t *time) { int row = 4; wchar_t *d,*n; while(1) { d = SnapmanCellGetText(g,row,2); n = SnapmanCellGetText(g,row,3); if(!d||!n)break; if(wcsicmp(time,d)==0&&wcsicmp(n,user)==0)return row; row++; } return 0; } void OnButtonClick(void *g, int row, int col) { if(!SnapmanCellIsEmpty(g,28,3)) { void *gDaily = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\03.花季工作日报")); int row = GetDailyRow(gDaily,SnapmanCellGetText(g,5,3),Date()); SnapmanCellSetText(gDaily,row,11,SnapmanCellGetText(g,28,3)); SnapmanCellSetText(gDaily,row,12,SnapmanCellGetText(g,36,3)); SnapmanCellSetText(gDaily,row,13,DateTime()); SnapmanCellSetText(gDaily,row,14,SnapmanGetUserName()); SnapmanGridSave(gDaily); Print("日报考评提交成功!"); }else { Print("请填写主管考评。"); } SnapmanCleanUp(); }
D、最终代码写完后将表格设置为不可以保存状态,这样表格就只能用来工作而不能用来存储数据,这样每个人写的日报审核就不会产生相互影响
02.花季团队考评,这张表包括:项目信息、员工今天的工作点数、完成进度、今天总结、明天计划、工作相关的图片和附件。事件包括:
A、初始化事件,自动获取项目信息、员工列表、自动计算选择员工的工作完成状态、日报考评信息、工作得分和工作考评级别、获取主管考评信息,事件代码:
wchar_t* GetEmployee(void *m,wchar_t *name) { Pair *p = ForeachMap(m); wchar_t *result = NULL; while(p) { if(wcsicmp(name,(wchar_t*)p->value)==0) { if(!result) { result = (wchar_t*)p->key; }else { result = concat3(result,L"\n",(wchar_t*)p->key); } } p = ForeachMap(m); } return result; } void * GetUserManager(void *g) { int row = 18; int maxRow = SnapmanGridGetTotalDataRow(g); wchar_t *strName = NULL, *strManager = NULL; void *result = NULL; for(; row <= maxRow; row++) { strName = SnapmanCellGetText(g,row,2); strManager = SnapmanCellGetText(g,row,13); if(strName && strManager) { result = InsertMap(result,strName,strManager); } } return result; } int GetEvaluationRow(void *g,wchar_t *user,wchar_t *time) { int row = 4; int maxRow = SnapmanGridGetTotalDataRow(g); wchar_t *d,*n; for(; row <= maxRow; row++) { d = SnapmanCellGetText(g,row,3); n = SnapmanCellGetText(g,row,2); if(d&&n&&wcsicmp(time,d)==0&&wcsicmp(n,user)==0)return row; } return 0; } wchar_t *GetEvaluationLevel(int score) { wchar_t *result = L("A"); if(score>=90) { result[0] = 'S'; }else if(score>=80) { result[0] = 'A'; }else if(score>=70) { result[0] = 'B'; }else if(score>=60) { result[0] = 'C'; }else { result[0] = 'D'; } return result; } int GetProblemPoint(wchar_t *level) { if(wcsicmp(level,L("致命"))==0) { return 10; }else if(wcsicmp(level,L("严重"))==0) { return 6; }else if(wcsicmp(level,L("一般"))==0) { return 2; }else if(wcsicmp(level,L("提示"))==0) { return 1; }else { return 0; } } void CalcEmployeeScope(void *g,void* gEvaluation,wchar_t *user) { void *gPlan = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\02.花季计划信息")); void *gProblem = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\04.花季问题跟踪")); void *gDaily = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\03.花季工作日报")); int row = 17, totalPoint = 0, pTotalPoint = 0,dTotalPoint = 0, nTaskCount = 0 , nFinish = 0, nScore = 0; int erow = SnapmanGridGetTotalDataRow(gPlan); int uFinishPoint = 0, uUnfinishRation = 0, uProblemPoint = 0, uProblemCount = 0; int uDailyPoinnt = 0, uDailyRatio = 15; int uManagerScore = 0, uManagerRatio = 15; int uWorkingScore = 0, uFinalScore = 0; //1、先运行计划中的工作进度 for(; row <= erow; row++) { if(wcsicmp(user,SnapmanCellGetText(gPlan,row,12))==0)//找到员工对应的任务 { if(wcsicmp(Date(),SnapmanCellGetText(gPlan,row,6)) >= 0)//只计算已经到期的任务 { uFinishPoint += SnapmanCellGetInt(gPlan,row,5) * SnapmanCellGetInt(gPlan,row,7) / 100;//累加完成的点数 totalPoint += SnapmanCellGetInt(gPlan,row,5);//点数累加 nFinish += SnapmanCellGetInt(gPlan,row,7);//进度累加 nTaskCount++;//个数累加 } } } if(nTaskCount) { uUnfinishRation = nFinish/nTaskCount-100; } SnapmanCellSetInt(g,6,3,uFinishPoint); //设置工作完成点数 SnapmanCellSetText(g,6,10,concat2(itostr(uUnfinishRation),L"%")); //设置进度偏差 //2、问题单考评 nTaskCount = 0; for(row = 4,erow = SnapmanGridGetTotalDataRow(gProblem); row <= erow; row++) { if(wcsicmp(user,SnapmanCellGetText(gProblem,row,13))==0)//找到员工对应的任务 { pTotalPoint += GetProblemPoint(SnapmanCellGetText(gProblem,row,8));//点数累加 nTaskCount++;//个数累加 } } SnapmanCellSetInt(g,7,3,pTotalPoint); //设置问题单点数 SnapmanCellSetInt(g,7,10,nTaskCount); //设置问题单个数 //3、运算日报考评 nScore = nTaskCount = 0; for(row = 4,erow = SnapmanGridGetTotalDataRow(gDaily); row <= erow; row++) { if(wcsicmp(user,SnapmanCellGetText(gDaily,row,3))==0)//找到员工对应的任务 { dTotalPoint += SnapmanCellGetInt(gDaily,row,4);//点数累加 nScore += SnapmanCellGetInt(gDaily,row,4) * SnapmanCellGetInt(gDaily,row,12);//考评分数累加 nTaskCount++;//个数累加 } } if(nTaskCount) { uDailyPoinnt = nScore / dTotalPoint; uDailyRatio = SnapmanCellGetInt(g,8,10); } SnapmanCellSetInt(g,8,3,uDailyPoinnt); //设置日报考评分数 //4、运算工作得分和工作级别 uManagerScore = SnapmanCellGetInt(g,23,3); uManagerRatio = SnapmanCellGetInt(g,23,10); uWorkingScore = (uFinishPoint - totalPoint + uFinishPoint - pTotalPoint) * (100 - uDailyRatio) / totalPoint + uDailyPoinnt * uDailyRatio / 100; uFinalScore = (uFinishPoint - totalPoint + uFinishPoint - pTotalPoint) * (100 - uDailyRatio - uManagerRatio) / totalPoint + uDailyPoinnt * uDailyRatio / 100 + uManagerScore * uManagerRatio/100; SnapmanCellSetInt(g,9,3,uWorkingScore); //设置工作得分 SnapmanCellSetText(g,9,10,GetEvaluationLevel(uWorkingScore)); //设置工作考评级别 SnapmanCellSetInt(g,25,3,uFinalScore); //设置最终得分 SnapmanCellSetText(g,25,10,GetEvaluationLevel(uFinalScore)); //设置最终考评级别 } void SetEmployeeChange(void *g,void *gEvaluation,wchar_t *user) { if(user==NULL||wcslen(user)==0)return; int row = GetEvaluationRow(gEvaluation,user,Date()); if(row > 0) { SnapmanCellSetText(g,6,3,SnapmanCellGetText(gEvaluation,row,4));//完成工作点数 SnapmanCellSetText(g,6,10,SnapmanCellGetText(gEvaluation,row,5));//进度偏差 SnapmanCellSetText(g,7,3,SnapmanCellGetText(gEvaluation,row,6));//问题单点数 SnapmanCellSetText(g,7,10,SnapmanCellGetText(gEvaluation,row,7));//问题单总数 SnapmanCellSetText(g,8,3,SnapmanCellGetText(gEvaluation,row,8));//日报总分 SnapmanCellSetText(g,9,3,SnapmanCellGetText(gEvaluation,row,9));//工作得分 SnapmanCellSetText(g,10,3,SnapmanCellGetText(gEvaluation,row,10));//主管评语 SnapmanCellSetText(g,23,3,SnapmanCellGetText(gEvaluation,row,11));//主管打分 SnapmanCellSetText(g,25,3,SnapmanCellGetText(gEvaluation,row,13));//最终分数 SnapmanCellSetText(g,25,10,SnapmanCellGetText(gEvaluation,row,14));//考评级别 SnapmanCellSetText(g,9,10,GetEvaluationLevel(SnapmanCellGetInt(gEvaluation,row,9)));//工作考评级别 }else { CalcEmployeeScope(g,gEvaluation,user); } } void OnInitialize(void *g) { void *gProject = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\01.花季项目信息")); void *gEvaluation = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\05.花季员工考评")); if(gProject&&gEvaluation) { SnapmanCellSetLock(g,4,3,0); SnapmanCellSetLock(g,4,10,0); SnapmanCellSetLock(g,5,10,0); SnapmanCellSetText(g,4,3,Date()); SnapmanCellSetText(g,4,10,SnapmanCellGetText(gProject,3,3)); SnapmanCellSetCombo(g,5,3,GetEmployee(GetUserManager(gProject),SnapmanGetUserName())); SnapmanCellSetText(g,5,10,SnapmanGetUserName()); SnapmanCellSetLock(g,4,3,1); SnapmanCellSetLock(g,4,10,1); SnapmanCellSetLock(g,5,10,1); SnapmanCellSetComboIndex(g,5,3,0); SetEmployeeChange(g,gEvaluation,SnapmanCellGetText(g,5,3)); } SnapmanCleanUp(); }
B、员工选择下拉框的选择事件,获取当前选择员工的工作完成状态、日报考评信息、工作得分和工作考评级别、获取主管考评信息,事件代码:
wchar_t* GetEmployee(void *m,wchar_t *name) { Pair *p = ForeachMap(m); wchar_t *result = NULL; while(p) { if(wcsicmp(name,(wchar_t*)p->value)==0) { if(!result) { result = (wchar_t*)p->key; }else { result = concat3(result,L"\n",(wchar_t*)p->key); } } p = ForeachMap(m); } return result; } void * GetUserManager(void *g) { int row = 18; int maxRow = SnapmanGridGetTotalDataRow(g); wchar_t *strName = NULL, *strManager = NULL; void *result = NULL; for(; row <= maxRow; row++) { strName = SnapmanCellGetText(g,row,2); strManager = SnapmanCellGetText(g,row,13); if(strName && strManager) { result = InsertMap(result,strName,strManager); } } return result; } int GetEvaluationRow(void *g,wchar_t *user,wchar_t *time) { int row = 4; int maxRow = SnapmanGridGetTotalDataRow(g); wchar_t *d,*n; for(; row <= maxRow; row++) { d = SnapmanCellGetText(g,row,3); n = SnapmanCellGetText(g,row,2); if(d&&n&&wcsicmp(time,d)==0&&wcsicmp(n,user)==0)return row; } return 0; } wchar_t *GetEvaluationLevel(int score) { wchar_t *result = L("A"); if(score>=90) { result[0] = 'S'; }else if(score>=80) { result[0] = 'A'; }else if(score>=70) { result[0] = 'B'; }else if(score>=60) { result[0] = 'C'; }else { result[0] = 'D'; } return result; } int GetProblemPoint(wchar_t *level) { if(wcsicmp(level,L("致命"))==0) { return 10; }else if(wcsicmp(level,L("严重"))==0) { return 6; }else if(wcsicmp(level,L("一般"))==0) { return 2; }else if(wcsicmp(level,L("提示"))==0) { return 1; }else { return 0; } } void CalcEmployeeScope(void *g,void* gEvaluation,wchar_t *user) { void *gPlan = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\02.花季计划信息")); void *gProblem = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\04.花季问题跟踪")); void *gDaily = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\03.花季工作日报")); int row = 17, totalPoint = 0, pTotalPoint = 0,dTotalPoint = 0, nTaskCount = 0 , nFinish = 0, nScore = 0; int erow = SnapmanGridGetTotalDataRow(gPlan); int uFinishPoint = 0, uUnfinishRation = 0, uProblemPoint = 0, uProblemCount = 0; int uDailyPoinnt = 0, uDailyRatio = 15; int uManagerScore = 0, uManagerRatio = 15; int uWorkingScore = 0, uFinalScore = 0; //1、先运行计划中的工作进度 for(; row <= erow; row++) { if(wcsicmp(user,SnapmanCellGetText(gPlan,row,12))==0)//找到员工对应的任务 { if(wcsicmp(Date(),SnapmanCellGetText(gPlan,row,6)) >= 0)//只计算已经到期的任务 { uFinishPoint += SnapmanCellGetInt(gPlan,row,5) * SnapmanCellGetInt(gPlan,row,7) / 100;//累加完成的点数 totalPoint += SnapmanCellGetInt(gPlan,row,5);//点数累加 nFinish += SnapmanCellGetInt(gPlan,row,7);//进度累加 nTaskCount++;//个数累加 } } } if(nTaskCount) { uUnfinishRation = nFinish/nTaskCount-100; } SnapmanCellSetInt(g,6,3,uFinishPoint); //设置工作完成点数 SnapmanCellSetText(g,6,10,concat2(itostr(uUnfinishRation),L"%")); //设置进度偏差 //2、问题单考评 nTaskCount = 0; for(row = 4,erow = SnapmanGridGetTotalDataRow(gProblem); row <= erow; row++) { if(wcsicmp(user,SnapmanCellGetText(gProblem,row,13))==0)//找到员工对应的任务 { pTotalPoint += GetProblemPoint(SnapmanCellGetText(gProblem,row,8));//点数累加 nTaskCount++;//个数累加 } } SnapmanCellSetInt(g,7,3,pTotalPoint); //设置问题单点数 SnapmanCellSetInt(g,7,10,nTaskCount); //设置问题单个数 //3、运算日报考评 nScore = nTaskCount = 0; for(row = 4,erow = SnapmanGridGetTotalDataRow(gDaily); row <= erow; row++) { if(wcsicmp(user,SnapmanCellGetText(gDaily,row,3))==0)//找到员工对应的任务 { dTotalPoint += SnapmanCellGetInt(gDaily,row,4);//点数累加 nScore += SnapmanCellGetInt(gDaily,row,4) * SnapmanCellGetInt(gDaily,row,12);//考评分数累加 nTaskCount++;//个数累加 } } if(nTaskCount) { uDailyPoinnt = nScore / dTotalPoint; uDailyRatio = SnapmanCellGetInt(g,8,10); } SnapmanCellSetInt(g,8,3,uDailyPoinnt); //设置日报考评分数 //4、运算工作得分和工作级别 uManagerScore = SnapmanCellGetInt(g,23,3); uManagerRatio = SnapmanCellGetInt(g,23,10); Print("%d",uDailyPoinnt * uDailyRatio / 100); uWorkingScore = (uFinishPoint - totalPoint + uFinishPoint - pTotalPoint) * (100 - uDailyRatio) / totalPoint + uDailyPoinnt * uDailyRatio / 100; uFinalScore = (uFinishPoint - totalPoint + uFinishPoint - pTotalPoint) * (100 - uDailyRatio - uManagerRatio) / totalPoint + uDailyPoinnt * uDailyRatio / 100 + uManagerScore * uManagerRatio/100; SnapmanCellSetInt(g,9,3,uWorkingScore); //设置工作得分 SnapmanCellSetText(g,9,10,GetEvaluationLevel(uWorkingScore)); //设置工作考评级别 SnapmanCellSetInt(g,25,3,uFinalScore); //设置最终得分 SnapmanCellSetText(g,25,10,GetEvaluationLevel(uFinalScore)); //设置最终考评级别 } void SetEmployeeChange(void *g,void *gEvaluation,wchar_t *user) { if(user==NULL||wcslen(user)==0)return; int row = GetEvaluationRow(gEvaluation,user,Date()); if(row > 0) { SnapmanCellSetText(g,6,3,SnapmanCellGetText(gEvaluation,row,4));//完成工作点数 SnapmanCellSetText(g,6,10,SnapmanCellGetText(gEvaluation,row,5));//进度偏差 SnapmanCellSetText(g,7,3,SnapmanCellGetText(gEvaluation,row,6));//问题单点数 SnapmanCellSetText(g,7,10,SnapmanCellGetText(gEvaluation,row,7));//问题单总数 SnapmanCellSetText(g,8,3,SnapmanCellGetText(gEvaluation,row,8));//日报总分 SnapmanCellSetText(g,9,3,SnapmanCellGetText(gEvaluation,row,9));//工作得分 SnapmanCellSetText(g,10,3,SnapmanCellGetText(gEvaluation,row,10));//主管评语 SnapmanCellSetText(g,23,3,SnapmanCellGetText(gEvaluation,row,11));//主管打分 SnapmanCellSetText(g,25,3,SnapmanCellGetText(gEvaluation,row,13));//最终分数 SnapmanCellSetText(g,25,10,SnapmanCellGetText(gEvaluation,row,14));//考评级别 SnapmanCellSetText(g,9,10,GetEvaluationLevel(SnapmanCellGetInt(gEvaluation,row,9)));//工作考评级别 }else { CalcEmployeeScope(g,gEvaluation,user); } } void OnComboChanged(void *g, int row, int col,wchar_t *text) { void *gProject = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\01.花季项目信息")); void *gEvaluation = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\05.花季员工考评")); if(gProject&&gEvaluation) { SetEmployeeChange(g,gEvaluation,text); } SnapmanCleanUp(); }
C、提交员工考评按钮事件,并最终计算员工的考评级别,事件代码:
wchar_t* GetEmployee(void *m,wchar_t *name) { Pair *p = ForeachMap(m); wchar_t *result = NULL; while(p) { if(wcsicmp(name,(wchar_t*)p->value)==0) { if(!result) { result = (wchar_t*)p->key; }else { result = concat3(result,L"\n",(wchar_t*)p->key); } } p = ForeachMap(m); } return result; } void * GetUserManager(void *g) { int row = 18; int maxRow = SnapmanGridGetTotalDataRow(g); wchar_t *strName = NULL, *strManager = NULL; void *result = NULL; for(; row <= maxRow; row++) { strName = SnapmanCellGetText(g,row,2); strManager = SnapmanCellGetText(g,row,13); if(strName && strManager) { result = InsertMap(result,strName,strManager); } } return result; } int GetEvaluationRow(void *g,wchar_t *user,wchar_t *time) { int row = 4; int maxRow = SnapmanGridGetTotalDataRow(g); wchar_t *d,*n; for(; row <= maxRow; row++) { d = SnapmanCellGetText(g,row,3); n = SnapmanCellGetText(g,row,2); if(d&&n&&wcsicmp(time,d)==0&&wcsicmp(n,user)==0)return row; } return 0; } wchar_t *GetEvaluationLevel(int score) { wchar_t *result = L("A"); if(score>=90) { result[0] = 'S'; }else if(score>=80) { result[0] = 'A'; }else if(score>=70) { result[0] = 'B'; }else if(score>=60) { result[0] = 'C'; }else { result[0] = 'D'; } return result; } int GetProblemPoint(wchar_t *level) { if(wcsicmp(level,L("致命"))==0) { return 10; }else if(wcsicmp(level,L("严重"))==0) { return 6; }else if(wcsicmp(level,L("一般"))==0) { return 2; }else if(wcsicmp(level,L("提示"))==0) { return 1; }else { return 0; } } void CalcEmployeeScope(void *g,void* gEvaluation,wchar_t *user) { void *gPlan = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\02.花季计划信息")); void *gProblem = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\04.花季问题跟踪")); void *gDaily = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\03.花季工作日报")); int row = 17, totalPoint = 0, pTotalPoint = 0,dTotalPoint = 0, nTaskCount = 0 , nFinish = 0, nScore = 0; int erow = SnapmanGridGetTotalDataRow(gPlan); int uFinishPoint = 0, uUnfinishRation = 0, uProblemPoint = 0, uProblemCount = 0; int uDailyPoinnt = 0, uDailyRatio = 15; int uManagerScore = 0, uManagerRatio = 15; int uWorkingScore = 0, uFinalScore = 0; //1、先运行计划中的工作进度 for(; row <= erow; row++) { if(wcsicmp(user,SnapmanCellGetText(gPlan,row,12))==0)//找到员工对应的任务 { if(wcsicmp(Date(),SnapmanCellGetText(gPlan,row,6)) >= 0)//只计算已经到期的任务 { uFinishPoint += SnapmanCellGetInt(gPlan,row,5) * SnapmanCellGetInt(gPlan,row,7) / 100;//累加完成的点数 totalPoint += SnapmanCellGetInt(gPlan,row,5);//点数累加 nFinish += SnapmanCellGetInt(gPlan,row,7);//进度累加 nTaskCount++;//个数累加 } } } if(nTaskCount) { uUnfinishRation = nFinish/nTaskCount-100; } SnapmanCellSetInt(g,6,3,uFinishPoint); //设置工作完成点数 SnapmanCellSetText(g,6,10,concat2(itostr(uUnfinishRation),L"%")); //设置进度偏差 //2、问题单考评 nTaskCount = 0; for(row = 4,erow = SnapmanGridGetTotalDataRow(gProblem); row <= erow; row++) { if(wcsicmp(user,SnapmanCellGetText(gProblem,row,13))==0)//找到员工对应的任务 { pTotalPoint += GetProblemPoint(SnapmanCellGetText(gProblem,row,8));//点数累加 nTaskCount++;//个数累加 } } SnapmanCellSetInt(g,7,3,pTotalPoint); //设置问题单点数 SnapmanCellSetInt(g,7,10,nTaskCount); //设置问题单个数 //3、运算日报考评 nScore = nTaskCount = 0; for(row = 4,erow = SnapmanGridGetTotalDataRow(gDaily); row <= erow; row++) { if(wcsicmp(user,SnapmanCellGetText(gDaily,row,3))==0)//找到员工对应的任务 { dTotalPoint += SnapmanCellGetInt(gDaily,row,4);//点数累加 nScore += SnapmanCellGetInt(gDaily,row,4) * SnapmanCellGetInt(gDaily,row,12);//考评分数累加 nTaskCount++;//个数累加 } } if(nTaskCount) { uDailyPoinnt = nScore / dTotalPoint; uDailyRatio = SnapmanCellGetInt(g,8,10); } SnapmanCellSetInt(g,8,3,uDailyPoinnt); //设置日报考评分数 //4、运算工作得分和工作级别 uManagerScore = SnapmanCellGetInt(g,23,3); uManagerRatio = SnapmanCellGetInt(g,23,10); uWorkingScore = (uFinishPoint - totalPoint + uFinishPoint - pTotalPoint) * (100 - uDailyRatio) / totalPoint + uDailyPoinnt * uDailyRatio / 100; uFinalScore = (uFinishPoint - totalPoint + uFinishPoint - pTotalPoint) * (100 - uDailyRatio - uManagerRatio) / totalPoint + uDailyPoinnt * uDailyRatio / 100 + uManagerScore * uManagerRatio/100; SnapmanCellSetInt(g,9,3,uWorkingScore); //设置工作得分 SnapmanCellSetText(g,9,10,GetEvaluationLevel(uWorkingScore)); //设置工作考评级别 SnapmanCellSetInt(g,25,3,uFinalScore); //设置最终得分 SnapmanCellSetText(g,25,10,GetEvaluationLevel(uFinalScore)); //设置最终考评级别 } int SetEmployeeChange(void *g,void *gEvaluation,wchar_t *user) { if(user==NULL||wcslen(user)==0)return 0; int row = GetEvaluationRow(gEvaluation,user,Date()); if(row > 0) { SnapmanCellSetText(g,6,3,SnapmanCellGetText(gEvaluation,row,4));//完成工作点数 SnapmanCellSetText(g,6,10,SnapmanCellGetText(gEvaluation,row,5));//进度偏差 SnapmanCellSetText(g,7,3,SnapmanCellGetText(gEvaluation,row,6));//问题单点数 SnapmanCellSetText(g,7,10,SnapmanCellGetText(gEvaluation,row,7));//问题单总数 SnapmanCellSetText(g,8,3,SnapmanCellGetText(gEvaluation,row,8));//日报总分 SnapmanCellSetText(g,9,3,SnapmanCellGetText(gEvaluation,row,9));//工作得分 SnapmanCellSetText(g,10,3,SnapmanCellGetText(gEvaluation,row,10));//主管评语 SnapmanCellSetText(g,23,3,SnapmanCellGetText(gEvaluation,row,11));//主管打分 SnapmanCellSetText(g,25,3,SnapmanCellGetText(gEvaluation,row,13));//最终分数 SnapmanCellSetText(g,25,10,SnapmanCellGetText(gEvaluation,row,14));//考评级别 SnapmanCellSetText(g,9,10,GetEvaluationLevel(SnapmanCellGetInt(gEvaluation,row,9)));//工作考评级别 } CalcEmployeeScope(g,gEvaluation,user); return row; } void SaveEvaluation(void *g,void *gEvaluation,int row) { if(row==0)row = SnapmanGridGetTotalDataRow(gEvaluation) + 1; SnapmanCellSetInt(gEvaluation,row,1,row-3); //设置序号 SnapmanCellSetText(gEvaluation,row,2,SnapmanCellGetText(g,5,3)); //设置考评员工 SnapmanCellSetText(gEvaluation,row,3,Date()); //设置考评时间 SnapmanCellSetText(gEvaluation,row,4,SnapmanCellGetText(g,6,3)); //完成工作点数 SnapmanCellSetText(gEvaluation,row,5,SnapmanCellGetText(g,6,10)); //进度偏差 SnapmanCellSetText(gEvaluation,row,6,SnapmanCellGetText(g,7,3)); //问题单点数 SnapmanCellSetText(gEvaluation,row,7,SnapmanCellGetText(g,7,10)); //问题单总数 SnapmanCellSetText(gEvaluation,row,8,SnapmanCellGetText(g,8,3)); //日报总分 SnapmanCellSetText(gEvaluation,row,9,SnapmanCellGetText(g,9,3)); //工作得分 SnapmanCellSetText(gEvaluation,row,10,SnapmanCellGetText(g,10,3)); //主管评语 SnapmanCellSetText(gEvaluation,row,11,SnapmanCellGetText(g,23,3)); //主管打分 SnapmanCellSetText(gEvaluation,row,12,SnapmanGetUserName()); //设置主管 SnapmanCellSetText(gEvaluation,row,13,SnapmanCellGetText(g,25,3)); //最终分数 SnapmanCellSetText(gEvaluation,row,14,SnapmanCellGetText(g,25,10));//考评级别 SnapmanGridSave(gEvaluation); Print("员工考评提交成功。"); } void OnButtonClick(void *g, int row, int col) { if(SnapmanCellIsEmpty(g,10,3)) { Print("请填写主管评语哦。"); return; }else if(SnapmanCellIsEmpty(g,23,3)) { Print("请填写主管打分。"); return; }else { void *gProject = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\01.花季项目信息")); void *gEvaluation = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\05.花季员工考评")); if(gProject&&gEvaluation) { SaveEvaluation(g,gEvaluation,SetEmployeeChange(g,gEvaluation,SnapmanCellGetText(g,5,3))); } SnapmanCleanUp(); } }
D、最终代码写完后将表格设置为不可以保存状态,这样表格就只能用来工作而不能用来存储数据,这样每个人写的员工考评就不会产生相互影响
03.花季项目进度,这张表包括:设计、开发、测试、版本发布进展,项目总体进展和预计项目完成时间。事件包括:
A、初始化事件,自动获计算设计、开发、测试、版本发布进展,项目总体进展和预计项目完成时间,事件代码:
void SetProjectInfo(void *g,void *gProject) { wchar_t *strProgress = NULL, *strDiff = NULL, *strStep = NULL; wchar_t *strStep1 = L("设计"); wchar_t *strStep2 = L("开发"); wchar_t *strStep3 = L("测试"); wchar_t *strStep4 = L("版本发布"); wchar_t *strStarTime = SnapmanCellGetText(gProject,4,3); char buffer[1024] = {0}; int index = 0; double nd[4] = {0};//总进度 double id[4] = {0};//到今天个数 double td[4] = {0};//总个数 double nto = 0,ito = 0,tto = 0; int srow = 4; for(int row = SnapmanGridGetTotalDataRow(gProject); row >= 17; row--) { strStep = SnapmanCellGetText(gProject,row,2); if(wcsicmp(strStep,strStep1)==0) { index = 0; }else if(wcsicmp(strStep,strStep2)==0) { index = 1; }else if(wcsicmp(strStep,strStep3)==0) { index = 2; }else { index = 3; } if(wcsicmp(Date(),SnapmanCellGetText(gProject,row,6)) >= 0) { tto++; td[index]++; } nd[index] += SnapmanCellGetInt(gProject,row,7); nto += SnapmanCellGetInt(gProject,row,7); id[index]++; ito++; } for(int i = 0; i < 4; i++) { if(id[i]==0) { SnapmanCellSetText(g,srow,5,L" -"); }else { sprintf(buffer," %.1f",nd[i]/id[i]); SnapmanCellSetText(g,srow,5,concat2(L(buffer),L"%")); } if(td[i]==0) { SnapmanCellSetText(g,srow+1,5,L" -"); }else { sprintf(buffer," %.1f",(nd[i]-td[i]*100)/td[i]); SnapmanCellSetText(g,srow+1,5,concat2(L(buffer),L"%")); } srow += 2; } if(ito==0) { SnapmanCellSetText(g,12,4,L" -"); }else { sprintf(buffer,"%.1f",nto/ito); SnapmanCellSetText(g,12,4,concat2(L(buffer),L"%")); } if(tto==0) { SnapmanCellSetText(g,12,11,L" -"); }else { sprintf(buffer," %.1f",(nto-tto*100)/tto); SnapmanCellSetText(g,12,11,concat2(L(buffer),L"%")); } SnapmanCellSetText(g,16,4,SnapmanCellGetText(gProject,8,3)); if(strStarTime==NULL||wcslen(strStarTime)==0) { SnapmanCellSetText(g,16,11,L" -"); }else { int n = DiffDay(Date(),strStarTime); int d = ito==0?0:(int)((1-nto/ito/100) * n); if(d < 0)d = 0; SnapmanCellSetText(g,16,11,AddDay(SnapmanCellGetText(gProject,8,3),d)); } } void OnInitialize(void *g) { void *gProject = SnapmanGetGrid(L("\\花季项目管理系统\\Data\\02.花季计划信息")); if(gProject) { SetProjectInfo(g,gProject); } }
四、结论:就这样一个比较完整的项目管理系统就开发完成了,系统花了不到2天进行业务设计花了1天多一点进行事件代码开发;虽然有70%代码是重复的单不影响执行性能;Snapman将系统开发工作降低到业务设计量的工作直接超过了开发工作量。
Snapmanb版本的下载地址:http://www.snapman.xyz
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
- CTF中特别小的EXE是怎么生成的 2020-03-18
- c语言该怎么入门?C语言入门教程(非常详细) 2020-02-17
- 怎么偷上别人的微信 最简单偷微信密码不被发现_搜狐科技 2019-11-22
- 图的存储 2019-02-20
- new实现 2018-12-06
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash