FrmUpdatePriority.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. using DevComponents.DotNetBar;
  2. using System;
  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.Threading.Tasks;
  10. using System.Windows.Forms;
  11. using WCS_Client.UC;
  12. using WCS_Client.Utility;
  13. namespace WCS_Client.Frm
  14. {
  15. public partial class FrmUpdatePriority : Office2007Form
  16. {
  17. DataRow dr = null;DataTable dt = null;
  18. public FrmUpdatePriority(DataTable datarow)
  19. {
  20. InitializeComponent();
  21. dt = datarow;
  22. //dr = datarow;
  23. //lbltask_no.Text = dr["ID"].ToString();
  24. //lblwmstask_no.Text = dr["WMSTASK"].ToString();
  25. //lblBarCode.Text = dr["BARCODE"].ToString();
  26. //lblStartAddress.Text = dr["ADDRFROM"].ToString();
  27. //lblwcsNextAddress.Text = dr["ADDRNEXT"].ToString();
  28. //lblEndAddress.Text = dr["ADDRTO"].ToString();
  29. //nudPriority.Value = Convert.ToInt32(dr["Priority"].ToString());
  30. }
  31. private void btnCancel_Click(object sender, EventArgs e)
  32. {
  33. this.Close();
  34. }
  35. private void btnSave_Click(object sender, EventArgs e)
  36. {
  37. if (string.IsNullOrEmpty(txtReason.Text))
  38. {
  39. MessageBox.Show("请输入原因");
  40. return;
  41. }
  42. var result = MessageUtil.ShowYesNoAndWarning(string.Format("确定要变更优先级吗?"));
  43. if (result == DialogResult.Yes)
  44. {
  45. //dt = dt.Clone();
  46. string res = "";
  47. for (int i = 0; i < dt.Rows.Count; i++)
  48. {
  49. var dr = dt.Rows[i];
  50. var task_no = Convert.ToInt32(dr["ID"].ToString());
  51. int priority = Convert.ToInt32(dr["Priority"].ToString());
  52. res = TryCachHelper.TryTranExecute((db) =>
  53. {
  54. var task = db.Queryable<WCS_TASK>().First(v => v.ID == task_no);
  55. if (task == null)
  56. {
  57. throw new Exception(string.Format("未查询到WCS任务[{0}]信息", task_no));
  58. }
  59. else
  60. {
  61. if (db.Updateable<WCS_TASK>()
  62. .UpdateColumns(it => new WCS_TASK
  63. {
  64. Priority = priority,
  65. UPDATEUSER = CurrentHelper.User.Use_Name,
  66. UPDATETIME = DateTime.Now
  67. })
  68. .Where(v => v.ID == task_no).ExecuteCommand() < 0)
  69. {
  70. throw new Exception(string.Format("WCS任务[{0}]调整优先级失败", task_no));
  71. }
  72. //string msg = string.Format("任务[{0}]调整优先级为[{1}]成功。", task_no, priority);
  73. }
  74. });
  75. if (string.IsNullOrWhiteSpace(res))
  76. {
  77. //res = string.Format("任务[{0}]调整优先级[{1}]成功。", task_no.ToString(), priority);
  78. }
  79. }
  80. MessageBox.Show(res);
  81. //string massge = BaseWorkflow.UpdateTaskPriority(Convert.ToInt32(lbltask_no.Text.Trim()), (int)nudPriority.Value);
  82. //MessageUtil.ShowTips(res);
  83. this.Close();
  84. }
  85. }
  86. }
  87. }