using com.hnshituo.core.webapp.vo; using Common; using Infragistics.Win.UltraWinGrid; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace CarRemoteMeter { public partial class frmMatCompanyInfo : Form { public frmMatCompanyInfo() { InitializeComponent(); } private void btnCancel_Click(object sender, EventArgs e) { this.Close(); } private void btnSave_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(strMatCode)) { MessageBox.Show("请勾选物料"); return; } if (string.IsNullOrEmpty(strForCode)) { MessageBox.Show("请勾选发货单位"); return; } if (string.IsNullOrEmpty(strRecCode)) { MessageBox.Show("请勾选收货单位"); return; } this.DialogResult = DialogResult.OK; PreNo = strMatCode + strForCode + strRecCode; this.Close(); } private void frmMatCompanyInfo_Load(object sender, EventArgs e) { string sql = @"select t.matter_no, t.matter_name, t.meter_code from meter_base_matter_info t where t.meter_nature_name like '%中控%' and t.valid_flag = '1' and t.meter_code is not null order by t.matter_name"; PbModelDbService> pbModelDbService = new PbModelDbService>(); RESTfulResult> rES = pbModelDbService.executeSqlDataWf(sql); if (rES.Succeed) { if (rES.Data != null && rES.Data.Count > 0) { DataTable dt = rES.Data.ListToDataTable(); ClsControlPack.CopyDataToDatatable(ref dt, ref this.dtMat, true); ClsControlPack.RefreshAndAutoSize(ultraGridMat); ClsControlPack.SetUltraGridRowFilter(ref ultraGridMat,true); } } sql = @"select t.load_point_no, t.load_point_name, t.meter_code from meter_base_load_point t where t.valid_flag = '1' and t.meter_code is not null"; PbModelDbService> pbModelDbCService = new PbModelDbService>(); RESTfulResult> resComp = pbModelDbCService.executeSqlDataWf(sql); if (resComp.Succeed) { if (resComp.Data != null && resComp.Data.Count > 0) { DataTable dt1 = resComp.Data.ListToDataTable(); ClsControlPack.CopyDataToDatatable(ref dt1, ref this.dtForW, true); ClsControlPack.RefreshAndAutoSize(ultraGridFow); ClsControlPack.SetUltraGridRowFilter(ref ultraGridFow, true); DataTable dt2 = resComp.Data.ListToDataTable(); ClsControlPack.CopyDataToDatatable(ref dt2, ref this.dtRec, true); ClsControlPack.RefreshAndAutoSize(ultraGridRec); ClsControlPack.SetUltraGridRowFilter(ref ultraGridRec, true); } } } public string PreNo = ""; string strMatCode = "", strForCode = "", strRecCode = ""; private void ultraGridMat_AfterRowActivate(object sender, EventArgs e) { strMatCode = ""; UltraGridRow ugr = ultraGridMat.ActiveRow; if (ugr != null) { foreach (UltraGridRow ug in ultraGridMat.Rows) { ug.Appearance.BackColor = Color.White; } strMatCode = ugr.Cells["meter_code"].Text.Trim(); if (!string.IsNullOrEmpty(strMatCode)) { ugr.Appearance.BackColor = Color.Red; } } } private void ultraGridFow_AfterRowActivate(object sender, EventArgs e) { strForCode = ""; UltraGridRow ugr = ultraGridFow.ActiveRow; if (ugr != null) { foreach (UltraGridRow ug in ultraGridFow.Rows) { ug.Appearance.BackColor = Color.White; } strForCode = ugr.Cells["meter_code"].Text.Trim(); if (!string.IsNullOrEmpty(strForCode)) { ugr.Appearance.BackColor = Color.Red; } } } private void ultraGridRec_AfterRowActivate(object sender, EventArgs e) { strRecCode = ""; UltraGridRow ugr = ultraGridRec.ActiveRow; if (ugr != null) { foreach (UltraGridRow ug in ultraGridRec.Rows) { ug.Appearance.BackColor = Color.White; } strRecCode = ugr.Cells["meter_code"].Text.Trim(); if (!string.IsNullOrEmpty(strRecCode)) { ugr.Appearance.BackColor = Color.Red; } //ClsControlPack.RefreshAndAutoSize(ultraGridMat); } } } public class matCls { public string matter_no { get; set; } public string matter_name { get; set; } public string meter_code { get; set; } } public class compCls { public string load_point_no { get; set; } public string load_point_name { get; set; } public string meter_code { get; set; } } }