AddTeamPersonSmallForm.cs 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Windows.Forms;
  10. namespace LYFZ.Software.MainBusiness.MarketingAllPerson.SetSmallForm
  11. {
  12. public partial class AddTeamPersonSmallForm : LYFZ.Software.UI.MarketingAllPerson.SetSmallForm.AddTeamPersonSmallForm
  13. {
  14. class SetCustomControls_TeamPersonColumnHeaderModel
  15. {
  16. private string _strTeamPersonID;
  17. private string _strDepartmentID;
  18. private string _strUserNumber;
  19. /// <summary>
  20. /// 队成员ID
  21. /// </summary>
  22. public string StrTeamPersonID
  23. {
  24. get { return _strTeamPersonID; }
  25. set { _strTeamPersonID = value; }
  26. }
  27. /// <summary>
  28. /// 部门ID
  29. /// </summary>
  30. public string StrDepartmentID
  31. {
  32. get { return _strDepartmentID; }
  33. set { _strDepartmentID = value; }
  34. }
  35. /// <summary>
  36. /// 员工编号
  37. /// </summary>
  38. public string StrUserNumber
  39. {
  40. get { return _strUserNumber; }
  41. set { _strUserNumber = value; }
  42. }
  43. }
  44. LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
  45. LYFZ.BLL.BLL_ErpTeamPersonSet tpsbll = new BLL.BLL_ErpTeamPersonSet();
  46. public AddTeamPersonSmallForm()
  47. {
  48. this.UcNavigationTool.LabTitle = "活动设置";
  49. this.Load += AddTeamPersonSmallForm_Load;
  50. this.Shown += AddTeamPersonSmallForm_Shown;
  51. this.Resize += AddTeamPersonSmallForm_Resize;
  52. this.cmbtreevActivityName.ComboBoxTree_NodeMouseClick += cmbtreevActivityName_ComboBoxTree_NodeMouseClick;
  53. this.cmbtreevMaxTeamName.ComboBoxTree_NodeMouseClick += cmbtreevMaxTeamName_ComboBoxTree_NodeMouseClick;
  54. this.cmbtreevMinTeamName.ComboBoxTree_NodeMouseClick += cmbtreevMinTeamName_ComboBoxTree_NodeMouseClick;
  55. this.btnSaveed.Click += btnSaveed_Click;
  56. this.btnClose.Click += btnClose_Click;
  57. this.btnAddActivity.Click += btnAddActivity_Click;
  58. this.btnAddMaxTeam.Click += btnAddMaxTeam_Click;
  59. this.btnAddMinTeam.Click += btnAddMinTeam_Click;
  60. this.btnAdding.Click += btnAdding_Click;
  61. this.btnRemove.Click += btnRemove_Click;
  62. this.listViewData_Source.MouseDoubleClick += listViewData_Source_MouseDoubleClick;
  63. this.listViewData_Person.MouseDoubleClick += listViewData_Person_MouseDoubleClick;
  64. this.txtText.Leave += txtText_Leave;
  65. this.txtText.KeyPress += txtText_KeyPress;
  66. }
  67. /// <summary>
  68. /// 是否保存
  69. /// </summary>
  70. public bool IsSaveed = false;
  71. /// <summary>
  72. /// 删除的人员
  73. /// </summary>
  74. Hashtable htDelete = new Hashtable();
  75. /// <summary>
  76. /// 窗体加载事件
  77. /// </summary>
  78. /// <param name="sender"></param>
  79. /// <param name="e"></param>
  80. void AddTeamPersonSmallForm_Load(object sender, EventArgs e)
  81. {
  82. this.lblMinTeamBaodiTask.Text = "0";
  83. this.lblMinTeamTargetTask.Text = "0";
  84. this.lblMinTeamSprintTask.Text = "0";
  85. this.lblAssignBaodiTask.Text = "0";
  86. this.lblAssignTargetTask.Text = "0";
  87. this.lblAssignSprintTask.Text = "0";
  88. ImageList mlistImage = new ImageList();
  89. this.listViewData_Source.View = View.Details;
  90. this.listViewData_Source.GridLines = true;
  91. string[] StrColumns = "员工姓名".Split(',');
  92. for (int i = 0; i < StrColumns.Length; i++)
  93. {
  94. ColumnHeader ch = new ColumnHeader();
  95. ch.Text = StrColumns[i].Trim();
  96. switch (StrColumns[i].Trim())
  97. {
  98. case "员工姓名": ch.Width = this.listViewData_Source.Width - 23; break;
  99. }
  100. ch.TextAlign = HorizontalAlignment.Center;
  101. this.listViewData_Source.Columns.Add(ch);
  102. }
  103. mlistImage.ImageSize = new Size(1, 25);
  104. mlistImage.ColorDepth = ColorDepth.Depth32Bit;
  105. this.listViewData_Source.SmallImageList = mlistImage;
  106. this.listViewData_Person.View = View.Details;
  107. this.listViewData_Person.GridLines = true;
  108. StrColumns = "员工姓名,大队名称,小组名称,保底任务,目标任务,冲刺任务".Split(',');
  109. for (int i = 0; i < StrColumns.Length; i++)
  110. {
  111. ColumnHeader ch = new ColumnHeader();
  112. ch.Text = StrColumns[i].Trim();
  113. switch (StrColumns[i].Trim())
  114. {
  115. case "员工姓名":
  116. case "大队名称":
  117. case "小组名称":
  118. case "保底任务":
  119. case "目标任务":
  120. case "冲刺任务": ch.Width = (this.listViewData_Person.Width - 23) / 6; break;
  121. }
  122. switch (StrColumns[i].Trim())
  123. {
  124. case "员工姓名":
  125. case "大队名称":
  126. case "小组名称": ch.TextAlign = HorizontalAlignment.Left;
  127. break;
  128. case "保底任务":
  129. case "目标任务":
  130. case "冲刺任务": ch.TextAlign = HorizontalAlignment.Center;
  131. break;
  132. }
  133. this.listViewData_Person.Columns.Add(ch);
  134. }
  135. mlistImage.ImageSize = new Size(1, 25);
  136. mlistImage.ColorDepth = ColorDepth.Depth32Bit;
  137. this.listViewData_Person.SmallImageList = mlistImage;
  138. ListViewGroup man_lvg = null;
  139. DataTable dt = orbll.GetView_Custom("tb_ErpDepartment", StrWhere: "", ShowColumnName: "ID,Dt_Name", filedOrder: "ID").Tables[0];
  140. for (int i = 0; i < dt.Rows.Count; i++)
  141. {
  142. man_lvg = new ListViewGroup();
  143. man_lvg.Name = dt.Rows[i]["ID"].ToString().Trim();
  144. man_lvg.Header = dt.Rows[i]["Dt_Name"].ToString().Trim();
  145. man_lvg.HeaderAlignment = HorizontalAlignment.Left;
  146. this.listViewData_Source.Groups.Add(man_lvg);
  147. }
  148. man_lvg = new ListViewGroup();
  149. man_lvg.Name = "0";
  150. man_lvg.Header = "无部门";
  151. man_lvg.HeaderAlignment = HorizontalAlignment.Left;
  152. this.listViewData_Source.Groups.Add(man_lvg);
  153. this.listViewData_Source.ShowGroups = true;
  154. }
  155. /// <summary>
  156. ///获取当前未设置到活动下的所有员工
  157. /// </summary>
  158. void GetUserName()
  159. {
  160. this.listViewData_Source.Items.Clear();
  161. if (this.cmbtreevActivityName.Tag != null && !string.IsNullOrEmpty(this.cmbtreevActivityName.Tag.ToString().Trim()))
  162. {
  163. DataTable dtPerson = orbll.GetView_Custom("tb_ErpTeamPersonSet", StrWhere: "Tps_TasNumber = '" + this.cmbtreevActivityName.Tag.ToString().Trim() + "'", ShowColumnName: "Tps_UserNumber").Tables[0];
  164. DataTable dtUser = orbll.GetView_Custom("tb_ErpUser", StrWhere: "", ShowColumnName: "User_Name,User_EmployeeID,User_Department", filedOrder: "User_Department").Tables[0];
  165. for (int i = 0; i < dtUser.Rows.Count; i++)
  166. {
  167. if (dtPerson.Rows.Count > 0)
  168. {
  169. bool IsFind = false;
  170. for (int j = 0; j < dtPerson.Rows.Count; j++)
  171. {
  172. if (dtPerson.Rows[j]["Tps_UserNumber"].ToString().Trim() == dtUser.Rows[i]["User_EmployeeID"].ToString().Trim())
  173. {
  174. IsFind = true;
  175. dtPerson.Rows.RemoveAt(j);
  176. }
  177. }
  178. if (IsFind)
  179. { continue; }
  180. }
  181. ListViewItem lvItem = new ListViewItem();
  182. lvItem.Tag = dtUser.Rows[i]["User_EmployeeID"].ToString().Trim();
  183. lvItem.Text = dtUser.Rows[i]["User_Name"].ToString().Trim();
  184. if (this.listViewData_Source.Groups.Count > 0)
  185. {
  186. if (!string.IsNullOrEmpty(dtUser.Rows[i]["User_Department"].ToString().Trim()) && this.listViewData_Source.Groups[dtUser.Rows[i]["User_Department"].ToString().Trim()] != null)
  187. { this.listViewData_Source.Groups[dtUser.Rows[i]["User_Department"].ToString().Trim()].Items.Add(lvItem); }
  188. else
  189. { this.listViewData_Source.Groups["0"].Items.Add(lvItem); }
  190. }
  191. this.listViewData_Source.Items.Add(lvItem);
  192. }
  193. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.ListViewDrawSingleOrDoubleRows(this.listViewData_Source);
  194. }
  195. }
  196. /// <summary>
  197. /// 窗体加载事件
  198. /// </summary>
  199. /// <param name="sender"></param>
  200. /// <param name="e"></param>
  201. void AddTeamPersonSmallForm_Shown(object sender, EventArgs e)
  202. {
  203. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_TeamActivityName(this.cmbtreevActivityName);
  204. bool b = LYFZ.Software.MainBusiness.VersionControl.StaticVersion.UIFunctionVersion(VersionControl.VersionFunctionEnum.全员营销);
  205. if (!b)
  206. {
  207. this.Close();
  208. }
  209. }
  210. /// <summary>
  211. /// 窗体大小发生变化
  212. /// </summary>
  213. /// <param name="sender"></param>
  214. /// <param name="e"></param>
  215. void AddTeamPersonSmallForm_Resize(object sender, EventArgs e)
  216. {
  217. for (int i = 0; i < this.listViewData_Person.Columns.Count; i++)
  218. {
  219. this.listViewData_Person.Columns[i].Width = (this.listViewData_Person.Width - 23) / 6;
  220. }
  221. }
  222. /// <summary>
  223. /// 活动选择
  224. /// </summary>
  225. /// <param name="sender"></param>
  226. /// <param name="e"></param>
  227. void cmbtreevActivityName_ComboBoxTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
  228. {
  229. this.cmbtreevMaxTeamName.Nodes.Clear();
  230. this.cmbtreevMinTeamName.Nodes.Clear();
  231. this.cmbtreevMaxTeamName.SetTextAndTag_ValueNull();
  232. this.cmbtreevMinTeamName.SetTextAndTag_ValueNull();
  233. this.listViewData_Person.Items.Clear();
  234. this.lblMinTeamBaodiTask.Text = "0";
  235. this.lblMinTeamTargetTask.Text = "0";
  236. this.lblMinTeamSprintTask.Text = "0";
  237. this.lblAssignBaodiTask.Text = "0";
  238. this.lblAssignTargetTask.Text = "0";
  239. this.lblAssignSprintTask.Text = "0";
  240. if (!string.IsNullOrEmpty(this.cmbtreevActivityName.Text.Trim()))
  241. {
  242. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_TeamMaxTaskName(this.cmbtreevMaxTeamName, this.cmbtreevActivityName.Tag.ToString().Trim());
  243. this.GetUserName();
  244. }
  245. }
  246. /// <summary>
  247. /// 大队选择
  248. /// </summary>
  249. /// <param name="sender"></param>
  250. /// <param name="e"></param>
  251. void cmbtreevMaxTeamName_ComboBoxTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
  252. {
  253. this.listViewData_Person.Items.Clear();
  254. this.lblMinTeamBaodiTask.Text = "0";
  255. this.lblMinTeamTargetTask.Text = "0";
  256. this.lblMinTeamSprintTask.Text = "0";
  257. this.lblAssignBaodiTask.Text = "0";
  258. this.lblAssignTargetTask.Text = "0";
  259. this.lblAssignSprintTask.Text = "0";
  260. this.cmbtreevMinTeamName.SetTextAndTag_ValueNull();
  261. this.cmbtreevMinTeamName.Nodes.Clear();
  262. if (!string.IsNullOrEmpty(this.cmbtreevActivityName.Text.Trim()) && !string.IsNullOrEmpty(this.cmbtreevMaxTeamName.Text.Trim()))
  263. {
  264. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_TeamMinTaskName(this.cmbtreevMinTeamName, this.cmbtreevActivityName.Tag.ToString().Trim(), this.cmbtreevMaxTeamName.Tag.ToString().Trim(), IsFirstNodeNull: true, IsFirstNodeName: "全部");
  265. this.GetMinGroupUserName();
  266. this.GetUserName();
  267. DataTable dt = orbll.GetView_Custom("tb_ErpTeamMaxTaskSet", StrWhere: "Tmxt_Number = '" + this.cmbtreevMaxTeamName.StrGetName.Trim() + "'", ShowColumnName: "Tmxt_BaodiTask,Tmxt_TargetTask,Tmxt_SprintTask").Tables[0];
  268. if (dt.Rows.Count > 0)
  269. {
  270. this.lblMinTeamBaodiTask.Text = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(dt.Rows[0]["Tmxt_BaodiTask"]);
  271. this.lblMinTeamTargetTask.Text = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(dt.Rows[0]["Tmxt_TargetTask"]);
  272. this.lblMinTeamSprintTask.Text = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(dt.Rows[0]["Tmxt_SprintTask"]);
  273. }
  274. }
  275. }
  276. /// <summary>
  277. /// 小组选择
  278. /// </summary>
  279. /// <param name="sender"></param>
  280. /// <param name="e"></param>
  281. void cmbtreevMinTeamName_ComboBoxTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
  282. {
  283. DataTable dtSmallTeam = orbll.GetView_Custom("tb_ErpTeamMinTaskSet", StrWhere: "Tmit_TasNumber = '" + this.cmbtreevActivityName.Tag.ToString().Trim() + "' And Tmit_TmxnNumber = '" + this.cmbtreevMaxTeamName.Tag.ToString().Trim() + "' And Tmit_TminNumber = '" + this.cmbtreevMinTeamName.Tag.ToString().Trim() + "'", ShowColumnName: "Tmit_BaodiTask,Tmit_TargetTask,Tmit_SprintTask").Tables[0];
  284. if (dtSmallTeam.Rows.Count > 0)
  285. {
  286. this.lblMinTeamBaodiTask.Text = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(dtSmallTeam.Rows[0]["Tmit_BaodiTask"]);
  287. this.lblMinTeamTargetTask.Text = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(dtSmallTeam.Rows[0]["Tmit_TargetTask"]);
  288. this.lblMinTeamSprintTask.Text = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(dtSmallTeam.Rows[0]["Tmit_SprintTask"]);
  289. }
  290. else
  291. {
  292. this.lblMinTeamBaodiTask.Text = "0";
  293. this.lblMinTeamTargetTask.Text = "0";
  294. this.lblMinTeamSprintTask.Text = "0";
  295. }
  296. this.GetMinGroupUserName();
  297. this.GetUserName();
  298. }
  299. /// <summary>
  300. /// 获取小组成员
  301. /// </summary>
  302. void GetMinGroupUserName()
  303. {
  304. decimal deBaodiTask = 0;
  305. decimal deTargetTask = 0;
  306. decimal deSprintTask = 0;
  307. this.listViewData_Person.Items.Clear();
  308. this.listViewData_Person.Groups.Clear();
  309. string StrWhere = "";
  310. if (this.cmbtreevMinTeamName.Tag != null && !string.IsNullOrEmpty(this.cmbtreevMinTeamName.Tag.ToString().Trim()) && this.cmbtreevMinTeamName.Text.Trim() != "全部")
  311. { StrWhere += " And Tps_TminNumber = '" + this.cmbtreevMinTeamName.Tag.ToString().Trim() + "'"; }
  312. DataTable dtGroup = orbll.GetView_Custom("tb_ErpTeamPersonSet Left Join tb_ErpTeamMinNameSet on Tmin_Number = Tps_TminNumber", StrWhere: "Tps_TasNumber = '" + this.cmbtreevActivityName.Tag.ToString().Trim() + "' And Tps_TmxnNumber = '" + this.cmbtreevMaxTeamName.Tag.ToString().Trim() + "'" + StrWhere, ShowColumnName: "Tps_TminNumber,Tmin_Name").Tables[0];
  313. DataTable dt = orbll.GetView_Custom("tb_ErpTeamPersonSet Left Join tb_ErpUser on User_EmployeeID = Tps_UserNumber Left Join tb_ErpTeamMinNameSet on Tmin_Number = Tps_TminNumber", StrWhere: "Tps_TasNumber = '" + this.cmbtreevActivityName.Tag.ToString().Trim() + "' And Tps_TmxnNumber = '" + this.cmbtreevMaxTeamName.Tag.ToString().Trim() + "'" + StrWhere, ShowColumnName: "tb_ErpTeamPersonSet.ID,Tps_TminNumber,User_EmployeeID,User_Name,User_Department,Tmin_Name,Tps_BaodiTask,Tps_TargetTask,Tps_SprintTask").Tables[0];
  314. if (dtGroup.Rows.Count > 1)
  315. {
  316. ListViewGroup man_lvg = null;
  317. for (int i = 0; i < dtGroup.Rows.Count; i++)
  318. {
  319. man_lvg = new ListViewGroup();
  320. man_lvg.Name = dtGroup.Rows[i]["Tps_TminNumber"].ToString().Trim();
  321. man_lvg.Header = dtGroup.Rows[i]["Tmin_Name"].ToString().Trim();
  322. man_lvg.HeaderAlignment = HorizontalAlignment.Left;
  323. this.listViewData_Person.Groups.Add(man_lvg);
  324. }
  325. this.listViewData_Person.ShowGroups = true;
  326. }
  327. for (int i = 0; i < dt.Rows.Count; i++)
  328. {
  329. ListViewItem lvItem = new ListViewItem();
  330. SetCustomControls_TeamPersonColumnHeaderModel ColumnModel = new SetCustomControls_TeamPersonColumnHeaderModel();
  331. ColumnModel.StrTeamPersonID = dt.Rows[i]["ID"].ToString().Trim();
  332. ColumnModel.StrDepartmentID = dt.Rows[i]["User_Department"].ToString().Trim();
  333. ColumnModel.StrUserNumber = dt.Rows[i]["User_EmployeeID"].ToString().Trim();
  334. lvItem.Tag = ColumnModel;
  335. lvItem.Text = dt.Rows[i]["User_Name"].ToString().Trim();
  336. ListViewItem.ListViewSubItem ListSubItem = new ListViewItem.ListViewSubItem();
  337. ListSubItem.Name = "大队名称";
  338. ListSubItem.Text = this.cmbtreevMaxTeamName.Text.Trim();
  339. lvItem.SubItems.Add(ListSubItem);
  340. ListSubItem = new ListViewItem.ListViewSubItem();
  341. ListSubItem.Name = "小组名称";
  342. ListSubItem.Text = dt.Rows[i]["Tmin_Name"].ToString().Trim();
  343. lvItem.SubItems.Add(ListSubItem);
  344. ListSubItem = new ListViewItem.ListViewSubItem();
  345. ListSubItem.Name = "保底任务";
  346. ListSubItem.Text = dt.Rows[i]["Tps_BaodiTask"].ToString().Trim();
  347. lvItem.SubItems.Add(ListSubItem);
  348. deBaodiTask += Convert.ToDecimal(dt.Rows[i]["Tps_BaodiTask"]);
  349. ListSubItem = new ListViewItem.ListViewSubItem();
  350. ListSubItem.Name = "目标任务";
  351. ListSubItem.Text = dt.Rows[i]["Tps_TargetTask"].ToString().Trim();
  352. lvItem.SubItems.Add(ListSubItem);
  353. deTargetTask += Convert.ToDecimal(dt.Rows[i]["Tps_TargetTask"]);
  354. ListSubItem = new ListViewItem.ListViewSubItem();
  355. ListSubItem.Name = "冲刺任务";
  356. ListSubItem.Text = dt.Rows[i]["Tps_SprintTask"].ToString().Trim();
  357. lvItem.SubItems.Add(ListSubItem);
  358. deSprintTask += Convert.ToDecimal(dt.Rows[i]["Tps_SprintTask"]);
  359. if (this.listViewData_Person.Groups.Count > 0)
  360. { this.listViewData_Person.Groups[dt.Rows[i]["Tps_TminNumber"].ToString().Trim()].Items.Add(lvItem); }
  361. this.listViewData_Person.Items.Add(lvItem);
  362. }
  363. this.lblAssignBaodiTask.Text = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(deBaodiTask);
  364. this.lblAssignTargetTask.Text = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(deTargetTask);
  365. this.lblAssignSprintTask.Text = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(deSprintTask);
  366. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.ListViewDrawSingleOrDoubleRows(this.listViewData_Person);
  367. }
  368. /// <summary>
  369. /// 保存
  370. /// </summary>
  371. /// <param name="sender"></param>
  372. /// <param name="e"></param>
  373. void btnSaveed_Click(object sender, EventArgs e)
  374. {
  375. if (this.listViewData_Person.Items.Count > 0)
  376. {
  377. if ((Convert.ToDecimal(this.lblAssignBaodiTask.Text.Trim()) - Convert.ToDecimal(this.lblMinTeamBaodiTask.Text.Trim())) > 0)
  378. { MessageBoxCustom.Show("小组成员总保底任务不能大于小组保底任务!"); return; }
  379. if ((Convert.ToDecimal(this.lblAssignTargetTask.Text.Trim()) - Convert.ToDecimal(this.lblMinTeamTargetTask.Text.Trim())) > 0)
  380. { MessageBoxCustom.Show("小组成员总目标任务不能大于小组目标任务!"); return; }
  381. if ((Convert.ToDecimal(this.lblAssignSprintTask.Text.Trim()) - Convert.ToDecimal(this.lblMinTeamSprintTask.Text.Trim())) > 0)
  382. { MessageBoxCustom.Show("小组成员总冲刺任务不能大于小组冲刺任务!"); return; }
  383. DateTime StrTime = SDateTime.Now;
  384. string StrUserID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  385. LYFZ.Model.Model_ErpTeamPersonSet model = null;
  386. List<Helper.CommandInfo> clist = new List<Helper.CommandInfo>();
  387. for (int i = 0; i < this.listViewData_Person.Items.Count; i++)
  388. {
  389. SetCustomControls_TeamPersonColumnHeaderModel ColumnModel = (SetCustomControls_TeamPersonColumnHeaderModel)this.listViewData_Person.Items[i].Tag;
  390. if (string.IsNullOrEmpty(ColumnModel.StrTeamPersonID.Trim()))
  391. {
  392. model = new Model.Model_ErpTeamPersonSet();
  393. model.Tps_Number = "MPS_" + LYFZ.WinAPI.CustomPublicMethod.GenerateId().ToString().Trim();
  394. model.Tps_TasNumber = this.cmbtreevActivityName.Tag.ToString().Trim();
  395. model.Tps_TmxnNumber = this.cmbtreevMaxTeamName.Tag.ToString().Trim();
  396. model.Tps_TmxtNumber = this.cmbtreevMaxTeamName.StrGetName.Trim();
  397. model.Tps_TminNumber = this.cmbtreevMinTeamName.Tag.ToString().Trim();
  398. model.Tps_TmitNumber = this.cmbtreevMinTeamName.StrGetName.Trim();
  399. model.Tps_UserNumber = ColumnModel.StrUserNumber.Trim();
  400. model.Tps_BaodiTask = Convert.ToDecimal(this.listViewData_Person.Items[i].SubItems["保底任务"].Text.Trim());
  401. model.Tps_TargetTask = Convert.ToDecimal(this.listViewData_Person.Items[i].SubItems["目标任务"].Text.Trim());
  402. model.Tps_SprintTask = Convert.ToDecimal(this.listViewData_Person.Items[i].SubItems["冲刺任务"].Text.Trim());
  403. model.Tps_TeamLeader = 0;
  404. model.Tps_GroupLeader = 0;
  405. model.Tps_CreateDateTime = StrTime;
  406. model.Tps_CreateName = StrUserID;
  407. clist.Add(tpsbll.GetAddCommandInfo(model));
  408. }
  409. else
  410. {
  411. model = tpsbll.GetModel(Convert.ToInt32(ColumnModel.StrTeamPersonID));
  412. model.Tps_BaodiTask = Convert.ToDecimal(this.listViewData_Person.Items[i].SubItems["保底任务"].Text.Trim());
  413. model.Tps_TargetTask = Convert.ToDecimal(this.listViewData_Person.Items[i].SubItems["目标任务"].Text.Trim());
  414. model.Tps_SprintTask = Convert.ToDecimal(this.listViewData_Person.Items[i].SubItems["冲刺任务"].Text.Trim());
  415. model.Tps_TeamLeader = 0;
  416. model.Tps_GroupLeader = 0;
  417. model.Tps_UpdateDateTime = StrTime;
  418. model.Tps_UpdateName = StrUserID;
  419. clist.Add(tpsbll.GetUpdateCommandInfo(model));
  420. }
  421. }
  422. foreach (DictionaryEntry item in htDelete)
  423. {
  424. clist.Add(tpsbll.GetDeleteCommandInfo("ID", "=", item.Key.ToString().Trim()));
  425. }
  426. if (clist.Count > 0)
  427. {
  428. if (MessageBoxCustom.Show("您确定要保存吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No)
  429. { return; }
  430. if (LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) > 0)
  431. {
  432. this.htDelete.Clear();
  433. this.IsSaveed = true;
  434. MessageBoxCustom.Show("保存成功!");
  435. this.GetMinGroupUserName();
  436. }
  437. else
  438. { MessageBoxCustom.Show("保存失败!"); }
  439. }
  440. }
  441. }
  442. /// <summary>
  443. /// 关闭
  444. /// </summary>
  445. /// <param name="sender"></param>
  446. /// <param name="e"></param>
  447. void btnClose_Click(object sender, EventArgs e)
  448. {
  449. this.Close();
  450. }
  451. /// <summary>
  452. /// 设置活动
  453. /// </summary>
  454. /// <param name="sender"></param>
  455. /// <param name="e"></param>
  456. void btnAddActivity_Click(object sender, EventArgs e)
  457. {
  458. LYFZ.Software.MainBusiness.MarketingAllPerson.SetSmallForm.AddNewActiveSmallForm frm = new AddNewActiveSmallForm();
  459. frm.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
  460. frm.Location = new Point(LYFZ.EnumPublic.FormLocation_X, LYFZ.EnumPublic.FormLocation_Y);
  461. frm.Size = new Size(LYFZ.EnumPublic.FormSize_Width, LYFZ.EnumPublic.FormSize_Height);
  462. frm.ShowDialog();
  463. if (frm.IsSaveed)
  464. { this.AddTeamPersonSmallForm_Shown(this, null); }
  465. }
  466. /// <summary>
  467. /// 设置大队
  468. /// </summary>
  469. /// <param name="sender"></param>
  470. /// <param name="e"></param>
  471. void btnAddMaxTeam_Click(object sender, EventArgs e)
  472. {
  473. LYFZ.Software.MainBusiness.MarketingAllPerson.SetSmallForm.AddMaxTeamSmallForm frm = new AddMaxTeamSmallForm();
  474. frm.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
  475. frm.Location = new Point(LYFZ.EnumPublic.FormLocation_X, LYFZ.EnumPublic.FormLocation_Y);
  476. frm.Size = new Size(LYFZ.EnumPublic.FormSize_Width, LYFZ.EnumPublic.FormSize_Height);
  477. frm.ShowDialog();
  478. if (frm.IsSaveed)
  479. { this.cmbtreevActivityName_ComboBoxTree_NodeMouseClick(this, null); }
  480. }
  481. /// <summary>
  482. /// 设置小组
  483. /// </summary>
  484. /// <param name="sender"></param>
  485. /// <param name="e"></param>
  486. void btnAddMinTeam_Click(object sender, EventArgs e)
  487. {
  488. LYFZ.Software.MainBusiness.MarketingAllPerson.SetSmallForm.AddMinTeamSmallForm frm = new AddMinTeamSmallForm();
  489. frm.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
  490. frm.Location = new Point(LYFZ.EnumPublic.FormLocation_X, LYFZ.EnumPublic.FormLocation_Y);
  491. frm.Size = new Size(LYFZ.EnumPublic.FormSize_Width, LYFZ.EnumPublic.FormSize_Height);
  492. frm.ShowDialog();
  493. if (frm.IsSaveed)
  494. { this.cmbtreevMaxTeamName_ComboBoxTree_NodeMouseClick(this, null); }
  495. }
  496. /// <summary>
  497. /// 添加人员
  498. /// </summary>
  499. /// <param name="sender"></param>
  500. /// <param name="e"></param>
  501. void btnAdding_Click(object sender, EventArgs e)
  502. {
  503. if (this.listViewData_Source.Items.Count > 0 && this.listViewData_Source.SelectedItems.Count > 0)
  504. {
  505. if (string.IsNullOrEmpty(this.cmbtreevActivityName.Text.Trim()))
  506. { MessageBoxCustom.Show("请选择活动名称"); return; }
  507. if (string.IsNullOrEmpty(this.cmbtreevMaxTeamName.Text.Trim()))
  508. { MessageBoxCustom.Show("请选择大队名称"); return; }
  509. if (this.cmbtreevMinTeamName.Tag == null || string.IsNullOrEmpty(this.cmbtreevMinTeamName.Tag.ToString().Trim()))
  510. { MessageBoxCustom.Show("请选择小组名称"); return; }
  511. string StrSql = "";
  512. List<ListViewItem> delist = new List<ListViewItem>();
  513. for (int i = 0; i < this.listViewData_Source.SelectedItems.Count; i++)
  514. {
  515. StrSql += "'" + this.listViewData_Source.SelectedItems[i].Tag.ToString().Trim() + "',";
  516. delist.Add(this.listViewData_Source.SelectedItems[i]);
  517. }
  518. if (!string.IsNullOrEmpty(StrSql))
  519. { StrSql = "And Tps_UserNumber in(" + StrSql.TrimEnd(',') + ")"; }
  520. string StrWhere = "Tps_TasNumber = '" + this.cmbtreevActivityName.Tag.ToString().Trim() + "' And Tps_TmxtNumber = '" + this.cmbtreevMaxTeamName.Tag.ToString().Trim() + "' And Tps_TmitNumber = '" + this.cmbtreevMinTeamName.Tag.ToString().Trim() + "' " + StrSql;
  521. string StrFildName = "ID,Tps_TasNumber,Tps_TmxnNumber,Tps_TmxtNumber,Tps_TminNumber,Tps_TmitNumber,Tps_UserNumber,Tps_BaodiTask,Tps_TargetTask,Tps_SprintTask,Tps_TeamLeader,Tps_GroupLeader";
  522. DataTable dt = orbll.GetView_Custom("tb_ErpTeamPersonSet", StrWhere: StrWhere, ShowColumnName: StrFildName).Tables[0];
  523. for (int i = 0; i < this.listViewData_Source.SelectedItems.Count; i++)
  524. {
  525. bool IsFind = false;
  526. if (dt.Rows.Count > 0)
  527. {
  528. DataRow[] dtRow = dt.Select("Tps_UserNumber = '" + this.listViewData_Source.SelectedItems[i].Tag.ToString().Trim() + "'");
  529. if (dtRow.Length > 0)
  530. {
  531. ListViewItem lvItem = new ListViewItem();
  532. SetCustomControls_TeamPersonColumnHeaderModel ColumnModel = new SetCustomControls_TeamPersonColumnHeaderModel();
  533. ColumnModel.StrTeamPersonID = dtRow[0]["ID"].ToString().Trim();
  534. ColumnModel.StrDepartmentID = dtRow[0]["User_Department"].ToString().Trim();
  535. ColumnModel.StrUserNumber = dtRow[0]["User_EmployeeID"].ToString().Trim();
  536. lvItem.Tag = ColumnModel;
  537. lvItem.Text = dtRow[0]["User_Name"].ToString().Trim();
  538. ListViewItem.ListViewSubItem ListSubItem = new ListViewItem.ListViewSubItem();
  539. ListSubItem.Name = "大队名称";
  540. ListSubItem.Text = this.cmbtreevMaxTeamName.Text.Trim();
  541. lvItem.SubItems.Add(ListSubItem);
  542. ListSubItem = new ListViewItem.ListViewSubItem();
  543. ListSubItem.Name = "小组名称";
  544. ListSubItem.Text = this.cmbtreevMinTeamName.Text.Trim();
  545. lvItem.SubItems.Add(ListSubItem);
  546. ListSubItem = new ListViewItem.ListViewSubItem();
  547. ListSubItem.Name = "保底任务";
  548. ListSubItem.Text = dtRow[0]["Tps_BaodiTask"].ToString().Trim();
  549. lvItem.SubItems.Add(ListSubItem);
  550. ListSubItem = new ListViewItem.ListViewSubItem();
  551. ListSubItem.Name = "目标任务";
  552. ListSubItem.Text = dtRow[0]["Tps_TargetTask"].ToString().Trim();
  553. lvItem.SubItems.Add(ListSubItem);
  554. ListSubItem = new ListViewItem.ListViewSubItem();
  555. ListSubItem.Name = "冲刺任务";
  556. ListSubItem.Text = dtRow[0]["Tps_SprintTask"].ToString().Trim();
  557. lvItem.SubItems.Add(ListSubItem);
  558. if (this.listViewData_Person.Groups.Count > 0)
  559. { this.listViewData_Person.Groups[this.cmbtreevMinTeamName.Tag.ToString().Trim()].Items.Add(lvItem); }
  560. this.listViewData_Person.Items.Add(lvItem);
  561. IsFind = true;
  562. }
  563. }
  564. if (!IsFind)
  565. {
  566. ListViewItem lvItem = new ListViewItem();
  567. SetCustomControls_TeamPersonColumnHeaderModel ColumnModel = new SetCustomControls_TeamPersonColumnHeaderModel();
  568. ColumnModel.StrTeamPersonID = "";
  569. ColumnModel.StrDepartmentID = this.listViewData_Source.SelectedItems[i].Group.Name.Trim();
  570. ColumnModel.StrUserNumber = this.listViewData_Source.SelectedItems[i].Tag.ToString().Trim();
  571. lvItem.Tag = ColumnModel;
  572. lvItem.Text = this.listViewData_Source.SelectedItems[i].Text.Trim();
  573. ListViewItem.ListViewSubItem ListSubItem = new ListViewItem.ListViewSubItem();
  574. ListSubItem.Name = "大队名称";
  575. ListSubItem.Text = this.cmbtreevMaxTeamName.Text.Trim();
  576. lvItem.SubItems.Add(ListSubItem);
  577. ListSubItem = new ListViewItem.ListViewSubItem();
  578. ListSubItem.Name = "小组名称";
  579. ListSubItem.Text = this.cmbtreevMinTeamName.Text.Trim();
  580. lvItem.SubItems.Add(ListSubItem);
  581. ListSubItem = new ListViewItem.ListViewSubItem();
  582. ListSubItem.Name = "保底任务";
  583. ListSubItem.Text = "0";
  584. lvItem.SubItems.Add(ListSubItem);
  585. ListSubItem = new ListViewItem.ListViewSubItem();
  586. ListSubItem.Name = "目标任务";
  587. ListSubItem.Text = "0";
  588. lvItem.SubItems.Add(ListSubItem);
  589. ListSubItem = new ListViewItem.ListViewSubItem();
  590. ListSubItem.Name = "冲刺任务";
  591. ListSubItem.Text = "0";
  592. lvItem.SubItems.Add(ListSubItem);
  593. if (this.listViewData_Person.Groups.Count > 0)
  594. { this.listViewData_Person.Groups[this.cmbtreevMinTeamName.Tag.ToString().Trim()].Items.Add(lvItem); }
  595. this.listViewData_Person.Items.Add(lvItem);
  596. }
  597. }
  598. for (int i = 0; i < delist.Count; i++)
  599. { this.listViewData_Source.Items.Remove(delist[i]); }
  600. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.ListViewDrawSingleOrDoubleRows(this.listViewData_Source);
  601. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.ListViewDrawSingleOrDoubleRows(this.listViewData_Person);
  602. this.GetAssignAmount();
  603. }
  604. }
  605. /// <summary>
  606. /// 移除人员
  607. /// </summary>
  608. /// <param name="sender"></param>
  609. /// <param name="e"></param>
  610. void btnRemove_Click(object sender, EventArgs e)
  611. {
  612. if (this.listViewData_Person.Items.Count > 0 && this.listViewData_Person.SelectedItems.Count > 0)
  613. {
  614. List<ListViewItem> delist = new List<ListViewItem>();
  615. for (int i = 0; i < this.listViewData_Person.SelectedItems.Count; i++)
  616. {
  617. SetCustomControls_TeamPersonColumnHeaderModel ColumnModel = (SetCustomControls_TeamPersonColumnHeaderModel)this.listViewData_Person.SelectedItems[i].Tag;
  618. ListViewItem lvItem = new ListViewItem();
  619. lvItem.Tag = ColumnModel.StrUserNumber.Trim();
  620. lvItem.Text = this.listViewData_Person.SelectedItems[i].Text.Trim();
  621. this.listViewData_Source.Groups[ColumnModel.StrDepartmentID.Trim()].Items.Add(lvItem);
  622. this.listViewData_Source.Items.Add(lvItem);
  623. delist.Add(this.listViewData_Person.SelectedItems[i]);
  624. if (!string.IsNullOrEmpty(ColumnModel.StrTeamPersonID.Trim()))
  625. { htDelete[ColumnModel.StrTeamPersonID.Trim()] = ColumnModel; }
  626. }
  627. for (int i = 0; i < delist.Count; i++)
  628. { this.listViewData_Person.Items.Remove(delist[i]); }
  629. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.ListViewDrawSingleOrDoubleRows(this.listViewData_Source);
  630. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.ListViewDrawSingleOrDoubleRows(this.listViewData_Person);
  631. this.GetAssignAmount();
  632. }
  633. }
  634. /// <summary>
  635. /// 双击添加人员
  636. /// </summary>
  637. /// <param name="sender"></param>
  638. /// <param name="e"></param>
  639. void listViewData_Source_MouseDoubleClick(object sender, MouseEventArgs e)
  640. {
  641. if (this.listViewData_Source.Items.Count > 0 && this.listViewData_Source.SelectedItems.Count > 0)
  642. {
  643. if (string.IsNullOrEmpty(this.cmbtreevActivityName.Text.Trim()))
  644. { MessageBoxCustom.Show("请选择活动名称"); return; }
  645. if (string.IsNullOrEmpty(this.cmbtreevMaxTeamName.Text.Trim()))
  646. { MessageBoxCustom.Show("请选择大队名称"); return; }
  647. if (string.IsNullOrEmpty(this.cmbtreevMinTeamName.Text.Trim()) || this.cmbtreevMinTeamName.Tag == null)
  648. { MessageBoxCustom.Show("请选择小组名称"); return; }
  649. if (this.cmbtreevMinTeamName.Tag == null || string.IsNullOrEmpty(this.cmbtreevMinTeamName.Tag.ToString().Trim()))
  650. { MessageBoxCustom.Show("请选择小组名称"); return; }
  651. DataTable dt = orbll.GetView_Custom("tb_ErpTeamPersonSet", StrWhere: "Tps_TasNumber = '" + this.cmbtreevActivityName.Tag.ToString().Trim() + "' And Tps_TmxtNumber = '" + this.cmbtreevMaxTeamName.Tag.ToString().Trim() + "' And Tps_TmitNumber = '" + this.cmbtreevMinTeamName.Tag.ToString().Trim() + "' And Tps_UserNumber = '" + this.listViewData_Source.SelectedItems[0].Tag.ToString().Trim() + "'", ShowColumnName: "*").Tables[0];
  652. if (dt.Rows.Count > 0)
  653. {
  654. ListViewItem lvItem = new ListViewItem();
  655. SetCustomControls_TeamPersonColumnHeaderModel ColumnModel = new SetCustomControls_TeamPersonColumnHeaderModel();
  656. ColumnModel.StrTeamPersonID = dt.Rows[0]["ID"].ToString().Trim();
  657. ColumnModel.StrDepartmentID = dt.Rows[0]["User_Department"].ToString().Trim();
  658. ColumnModel.StrUserNumber = dt.Rows[0]["User_EmployeeID"].ToString().Trim();
  659. lvItem.Tag = ColumnModel;
  660. lvItem.Text = dt.Rows[0]["User_Name"].ToString().Trim();
  661. ListViewItem.ListViewSubItem ListSubItem = new ListViewItem.ListViewSubItem();
  662. ListSubItem.Name = "大队名称";
  663. ListSubItem.Text = this.cmbtreevMaxTeamName.Text.Trim();
  664. lvItem.SubItems.Add(ListSubItem);
  665. ListSubItem = new ListViewItem.ListViewSubItem();
  666. ListSubItem.Name = "小组名称";
  667. ListSubItem.Text = this.cmbtreevMinTeamName.Text.Trim();
  668. lvItem.SubItems.Add(ListSubItem);
  669. ListSubItem = new ListViewItem.ListViewSubItem();
  670. ListSubItem.Name = "保底任务";
  671. ListSubItem.Text = dt.Rows[0]["Tps_BaodiTask"].ToString().Trim();
  672. lvItem.SubItems.Add(ListSubItem);
  673. ListSubItem = new ListViewItem.ListViewSubItem();
  674. ListSubItem.Name = "目标任务";
  675. ListSubItem.Text = dt.Rows[0]["Tps_TargetTask"].ToString().Trim();
  676. lvItem.SubItems.Add(ListSubItem);
  677. ListSubItem = new ListViewItem.ListViewSubItem();
  678. ListSubItem.Name = "冲刺任务";
  679. ListSubItem.Text = dt.Rows[0]["Tps_SprintTask"].ToString().Trim();
  680. lvItem.SubItems.Add(ListSubItem);
  681. if (this.listViewData_Person.Groups.Count > 0)
  682. { this.listViewData_Person.Groups[this.cmbtreevMinTeamName.Tag.ToString().Trim()].Items.Add(lvItem); }
  683. this.listViewData_Person.Items.Add(lvItem);
  684. }
  685. else
  686. {
  687. ListViewItem lvItem = new ListViewItem();
  688. SetCustomControls_TeamPersonColumnHeaderModel ColumnModel = new SetCustomControls_TeamPersonColumnHeaderModel();
  689. ColumnModel.StrTeamPersonID = "";
  690. ColumnModel.StrDepartmentID = this.listViewData_Source.SelectedItems[0].Group.Name.Trim();
  691. ColumnModel.StrUserNumber = this.listViewData_Source.SelectedItems[0].Tag.ToString().Trim();
  692. lvItem.Tag = ColumnModel;
  693. lvItem.Text = this.listViewData_Source.SelectedItems[0].Text.Trim();
  694. ListViewItem.ListViewSubItem ListSubItem = new ListViewItem.ListViewSubItem();
  695. ListSubItem.Name = "大队名称";
  696. ListSubItem.Text = this.cmbtreevMaxTeamName.Text.Trim();
  697. lvItem.SubItems.Add(ListSubItem);
  698. ListSubItem = new ListViewItem.ListViewSubItem();
  699. ListSubItem.Name = "小组名称";
  700. ListSubItem.Text = this.cmbtreevMinTeamName.Text.Trim();
  701. lvItem.SubItems.Add(ListSubItem);
  702. ListSubItem = new ListViewItem.ListViewSubItem();
  703. ListSubItem.Name = "保底任务";
  704. ListSubItem.Text = "0";
  705. lvItem.SubItems.Add(ListSubItem);
  706. ListSubItem = new ListViewItem.ListViewSubItem();
  707. ListSubItem.Name = "目标任务";
  708. ListSubItem.Text = "0";
  709. lvItem.SubItems.Add(ListSubItem);
  710. ListSubItem = new ListViewItem.ListViewSubItem();
  711. ListSubItem.Name = "冲刺任务";
  712. ListSubItem.Text = "0";
  713. lvItem.SubItems.Add(ListSubItem);
  714. if (this.listViewData_Person.Groups.Count > 0)
  715. { this.listViewData_Person.Groups[this.cmbtreevMinTeamName.Tag.ToString().Trim()].Items.Add(lvItem); }
  716. this.listViewData_Person.Items.Add(lvItem);
  717. this.listViewData_Source.Items.Remove(this.listViewData_Source.SelectedItems[0]);
  718. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.ListViewDrawSingleOrDoubleRows(this.listViewData_Source);
  719. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.ListViewDrawSingleOrDoubleRows(this.listViewData_Person);
  720. }
  721. this.GetAssignAmount();
  722. }
  723. }
  724. /// <summary>
  725. /// 双击移除人员及设置任务
  726. /// </summary>
  727. /// <param name="sender"></param>
  728. /// <param name="e"></param>
  729. void listViewData_Person_MouseDoubleClick(object sender, MouseEventArgs e)
  730. {
  731. this.txtText.Visible = false;
  732. if (this.listViewData_Person.Items.Count > 0 && this.listViewData_Person.SelectedItems.Count > 0)
  733. {
  734. bool IsFind = false;
  735. ListViewHitTestInfo info = this.listViewData_Person.HitTest(e.X, e.Y);
  736. if (!string.IsNullOrEmpty(info.SubItem.Name.Trim()))
  737. {
  738. Rectangle rect = info.SubItem.Bounds;
  739. switch (info.SubItem.Name.Trim())
  740. {
  741. case "保底任务":
  742. case "目标任务":
  743. case "冲刺任务":
  744. IsFind = true;
  745. this.txtText.Location = new Point(rect.Location.X + this.listViewData_Person.Location.X + 3, rect.Location.Y + this.listViewData_Person.Location.Y + 2);
  746. this.txtText.Size = rect.Size;
  747. this.txtText.Visible = true;
  748. this.txtText.Tag = info.SubItem.Name.Trim();
  749. this.txtText.Text = info.SubItem.Text.Trim();
  750. this.txtText.Focus();
  751. break;
  752. }
  753. }
  754. if (!IsFind)
  755. {
  756. SetCustomControls_TeamPersonColumnHeaderModel ColumnModel = (SetCustomControls_TeamPersonColumnHeaderModel)this.listViewData_Person.SelectedItems[0].Tag;
  757. ListViewItem lvItem = new ListViewItem();
  758. lvItem.Tag = ColumnModel.StrUserNumber.Trim();
  759. lvItem.Text = this.listViewData_Person.SelectedItems[0].Text.Trim();
  760. this.listViewData_Source.Groups[ColumnModel.StrDepartmentID.Trim()].Items.Add(lvItem);
  761. if (!string.IsNullOrEmpty(ColumnModel.StrTeamPersonID.Trim()))
  762. { htDelete[ColumnModel.StrTeamPersonID.Trim()] = ColumnModel; }
  763. this.listViewData_Source.Items.Add(lvItem);
  764. this.listViewData_Person.Items.Remove(this.listViewData_Person.SelectedItems[0]);
  765. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.ListViewDrawSingleOrDoubleRows(this.listViewData_Source);
  766. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.ListViewDrawSingleOrDoubleRows(this.listViewData_Person);
  767. this.GetAssignAmount();
  768. }
  769. }
  770. }
  771. /// <summary>
  772. /// 文本框离开事件
  773. /// </summary>
  774. /// <param name="sender"></param>
  775. /// <param name="e"></param>
  776. void txtText_Leave(object sender, EventArgs e)
  777. {
  778. try
  779. {
  780. if (this.txtText.Tag != null)
  781. {
  782. switch (this.txtText.Tag.ToString().Trim())
  783. {
  784. case "保底任务":
  785. case "目标任务":
  786. case "冲刺任务":
  787. if (string.IsNullOrEmpty(this.txtText.Text.Trim()))
  788. { break; }
  789. if (!LYFZ.Command.Command_Validate.IsNumberSign(this.txtText.Text.Trim()))
  790. { break; }
  791. if (Convert.ToInt32(this.txtText.Text.Trim()) <= 0)
  792. { break; }
  793. this.listViewData_Person.SelectedItems[0].SubItems[this.txtText.Tag.ToString().Trim()].Text = Convert.ToDecimal(this.txtText.Text).ToString();
  794. this.GetAssignAmount();
  795. break;
  796. }
  797. }
  798. }
  799. catch
  800. { }
  801. this.txtText.Visible = false;
  802. }
  803. /// <summary>
  804. /// 文本框输入限制
  805. /// </summary>
  806. /// <param name="sender"></param>
  807. /// <param name="e"></param>
  808. void txtText_KeyPress(object sender, KeyPressEventArgs e)
  809. {
  810. if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
  811. { e.Handled = true; }
  812. if (!System.Text.RegularExpressions.Regex.IsMatch(e.KeyChar.ToString(), "[0-9]") && e.KeyChar != ' ' && e.KeyChar != '\b')
  813. { e.Handled = true; }
  814. }
  815. /// <summary>
  816. /// 统计已分金额
  817. /// </summary>
  818. void GetAssignAmount()
  819. {
  820. decimal deBaodiTask = 0;
  821. decimal deTargetTask = 0;
  822. decimal deSprintTask = 0;
  823. for (int i = 0; i < this.listViewData_Person.Items.Count; i++)
  824. {
  825. deBaodiTask += Convert.ToDecimal(this.listViewData_Person.Items[i].SubItems["保底任务"].Text.Trim());
  826. deTargetTask += Convert.ToDecimal(this.listViewData_Person.Items[i].SubItems["目标任务"].Text.Trim());
  827. deSprintTask += Convert.ToDecimal(this.listViewData_Person.Items[i].SubItems["冲刺任务"].Text.Trim());
  828. }
  829. this.lblAssignBaodiTask.Text = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(deBaodiTask);
  830. this.lblAssignTargetTask.Text = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(deTargetTask);
  831. this.lblAssignSprintTask.Text = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(deSprintTask);
  832. }
  833. }
  834. }