FrmUpdateEquMsg.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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.Data.Models;
  12. using WCS_Client.UC;
  13. namespace WCS_Client.Frm.MBtn_Monitor
  14. {
  15. public partial class FrmUpdateEquMsg : Office2007Form
  16. {
  17. DataRow dr = null;
  18. public FrmUpdateEquMsg(DataRow datarow)
  19. {
  20. InitializeComponent();
  21. dr = datarow;
  22. txtEqu_No.Text = datarow["Equ_No"].ToString();
  23. txtEqu_PlcName.Text = datarow["Equ_PlcName"].ToString();
  24. txtEqu_Area.Text = datarow["Equ_Area"].ToString();
  25. txtEqu_Type.Text = datarow["Equ_Type"].ToString();
  26. txtEqu_Notes.Text = datarow["Equ_Notes"].ToString();
  27. }
  28. private void btnCancel_Click_1(object sender, EventArgs e)
  29. {
  30. this.Close();
  31. }
  32. private void btnUpdateP_Click_1(object sender, EventArgs e)
  33. {
  34. var enuipmentinfo = new WCS_EQUIPMENTINFO();
  35. enuipmentinfo.Equ_Notes = txtEqu_Notes.Text.Trim();
  36. string result = TryCachHelper.TryExecute((db) =>
  37. {
  38. if (db.Updateable<WCS_EQUIPMENTINFO>()
  39. .UpdateColumns(it => new WCS_EQUIPMENTINFO
  40. {
  41. Equ_Notes = enuipmentinfo.Equ_Notes
  42. })
  43. .Where(v => v.Equ_No == txtEqu_No.Text).ExecuteCommand() < 0)
  44. {
  45. throw new Exception(string.Format("设备编号[{0}]修改备注信息失败!", txtEqu_No.Text));
  46. }
  47. });
  48. if (string.IsNullOrWhiteSpace(result))
  49. {
  50. result = string.Format("修改机械码垛信息成功");
  51. }
  52. MessageUtil.ShowTips(result);
  53. }
  54. }
  55. }