FrmUpdate.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using Core.Mes.Client.Comm.Tool;
  10. using Core.StlMes.Client.Mcp.Mch.Mcms.entity;
  11. using CoreFS.CA06;
  12. using Newtonsoft.Json;
  13. using Newtonsoft.Json.Serialization;
  14. namespace Core.StlMes.Client.Mcp.Mch.Mcms
  15. {
  16. public partial class FrmUpdate : FrmBase
  17. {
  18. public FrmUpdate(OpeBase _ob, string _resultNo,string _recordNo )
  19. {
  20. InitializeComponent();
  21. this.ob = _ob;
  22. resultNo = _resultNo;
  23. recordNo = _recordNo;
  24. }
  25. public string tabString
  26. {
  27. get { return tbOther.Tabs[0].Text; }
  28. set { tbOther.Tabs[0].Text = value; }
  29. }
  30. public string ColumnsM
  31. {
  32. get { return matInfo1.ColumnsM; }
  33. set { matInfo1.ColumnsM = value; }
  34. }
  35. public string ColumnsC
  36. {
  37. get { return matInfo1.ColumnsC; }
  38. set { matInfo1.ColumnsC = value; }
  39. }
  40. private string resultNo;
  41. private string recordNo;
  42. protected override void OnLoad(EventArgs e)
  43. {
  44. base.OnLoad(e);
  45. matInfo1.ini(ob);
  46. Dictionary<string,object> dic = new Dictionary<string, object>();
  47. dic.Add("recordNo", recordNo);
  48. List<CmmWeightRecordEntityFull> datas = EntityHelper.GetData<CmmWeightRecordEntityFull>(
  49. "com.steering.Mcms.RecordServer.doQueryRecord",
  50. new object[] { dic },
  51. ob);
  52. if (datas != null && datas.Any())
  53. {
  54. CmmWeightRecordEntityFull data = datas[0];
  55. data.MatInfos = EntityHelper.GetData<CmmWeightMatEntity>(
  56. "com.steering.Mcms.PoundMatServer.doQuery",
  57. new object[] { dic },
  58. ob);
  59. matInfo1.SetDefault(data);
  60. }
  61. }
  62. private void ubtOK_Click(object sender, EventArgs e)
  63. {
  64. CmmWeightRecordEntityFull data = matInfo1.GetData();
  65. if (data.MatInfos != null && data.MatInfos.Any())
  66. {
  67. data.MatInfos.ForEach(p=>p.ResultNo = resultNo);
  68. }
  69. var json = JsonConvert.SerializeObject(data, Formatting.None,
  70. new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() });
  71. var ccp = new CoreClientParam
  72. {
  73. ServerName = "com.steering.Mcms.LocalTruckScale",
  74. MethodName = "DoUpdate",
  75. ServerParams = new object[]
  76. {
  77. resultNo,
  78. json
  79. }
  80. };
  81. ccp = ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  82. if (ccp.ReturnCode != -1)
  83. {
  84. if (ccp.ReturnInfo.ToString2().Contains("操作成功"))
  85. {
  86. MessageUtil.ShowTips("修改成功");
  87. this.DialogResult = DialogResult.OK;
  88. }
  89. else
  90. {
  91. MessageUtil.ShowTips(ccp.ReturnInfo);
  92. }
  93. }
  94. }
  95. }
  96. }