using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.Mcp.Mch.Mcms.entity; using CoreFS.CA06; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; namespace Core.StlMes.Client.Mcp.Mch.Mcms { public partial class FrmUpdate : FrmBase { public FrmUpdate(OpeBase _ob, string _resultNo,string _recordNo ) { InitializeComponent(); this.ob = _ob; resultNo = _resultNo; recordNo = _recordNo; } public string tabString { get { return tbOther.Tabs[0].Text; } set { tbOther.Tabs[0].Text = value; } } public string ColumnsM { get { return matInfo1.ColumnsM; } set { matInfo1.ColumnsM = value; } } public string ColumnsC { get { return matInfo1.ColumnsC; } set { matInfo1.ColumnsC = value; } } private string resultNo; private string recordNo; protected override void OnLoad(EventArgs e) { base.OnLoad(e); matInfo1.ini(ob); Dictionary dic = new Dictionary(); dic.Add("recordNo", recordNo); List datas = EntityHelper.GetData( "com.steering.Mcms.RecordServer.doQueryRecord", new object[] { dic }, ob); if (datas != null && datas.Any()) { CmmWeightRecordEntityFull data = datas[0]; data.MatInfos = EntityHelper.GetData( "com.steering.Mcms.PoundMatServer.doQuery", new object[] { dic }, ob); matInfo1.SetDefault(data); } } private void ubtOK_Click(object sender, EventArgs e) { CmmWeightRecordEntityFull data = matInfo1.GetData(); if (data.MatInfos != null && data.MatInfos.Any()) { data.MatInfos.ForEach(p=>p.ResultNo = resultNo); } var json = JsonConvert.SerializeObject(data, Formatting.None, new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() }); var ccp = new CoreClientParam { ServerName = "com.steering.Mcms.LocalTruckScale", MethodName = "DoUpdate", ServerParams = new object[] { resultNo, json } }; ccp = ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.ToString2().Contains("操作成功")) { MessageUtil.ShowTips("修改成功"); this.DialogResult = DialogResult.OK; } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } } }