| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243 |
- using com.steering.pss.qcm.model;
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using CoreFS.CA06;
- using Infragistics.Win.UltraWinGrid;
- using System;
- using System.Collections;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Windows.Forms;
- namespace Core.StlMes.Client.Qcm
- {
- public partial class FrmComBaseCustomRPline : FrmBase
- {
- private DataTable _dt = null;
- private String _finallUser = "";
- private String _produc = "";
- public FrmComBaseCustomRPline()
- {
- InitializeComponent();
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- try
- {
- this.Cursor = Cursors.WaitCursor;
- Query();
- }
- finally
- {
- this.Cursor = Cursors.Default;
- }
- break;
- case "Save":
- Save();
- break;
- case "Close":
- this.Close();
- break;
- }
- }
- public void Query()
- {
- QueryFinaluser();
- QueryProduc();
- getCustPline();
- setGridRowColor();
- }
- public void QueryFinaluser()
- {
- String finallUser = "";
- if (ultraCheckUser.Checked)
- {
- finallUser = ultraTextUser.Text.Trim();
- }
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreComBaseCustomRPline.getFinallUser", new Object[] { finallUser }, this.ob);
- GridHelper.CopyDataToDatatable(ref dt, ref this.dataTable1, true);
- }
- public void QueryProduc()
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreComBaseCustomRPline.getProDuc", new Object[] { }, this.ob);
- GridHelper.CopyDataToDatatable(ref dt, ref this.dataTable2, true);
- }
- public void QueryProline()
- {
- UltraGridRow ugrUser = ultraGridUser.ActiveRow;
- UltraGridRow ugrProDuc = ultraGridProDuc.ActiveRow;
- if (ugrUser != null && ugrProDuc != null)
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreComBaseCustomRPline.getProline", new Object[] { ugrUser.Cells["CUSTOMER_NO"].Text.ToString(), ugrProDuc.Cells["PRODUCCODE"].Text.ToString() }, this.ob);
- GridHelper.CopyDataToDatatable(ref dt, ref this.dataTable3, true);
- }
- }
- public void Save()
- {
- UltraGridRow ugrUser = ultraGridUser.ActiveRow;
- UltraGridRow ugrProDuc = ultraGridProDuc.ActiveRow;
- ultraGridPline.UpdateData();
- IQueryable<UltraGridRow> checkedRows = ultraGridPline.Rows.AsQueryable().Where(" CHC = 'True'");
- ArrayList list = new ArrayList();
- foreach (UltraGridRow ugr in checkedRows)
- {
- if (ugrUser != null && ugrProDuc != null)
- {
- ComBaseCustomRPlineEntity entity = new ComBaseCustomRPlineEntity();
- entity.CreateName = UserInfo.GetUserName();
- entity.CustomerNm = ugrUser.Cells["CUSTOMER_NM"].Text.Trim();
- entity.CustomerNo = ugrUser.Cells["CUSTOMER_NO"].Text.Trim();
- entity.PlineCode = ugr.Cells["PLINE_CODE"].Text.Trim();
- entity.PlineName = ugr.Cells["PLINE_NAME"].Text.Trim();
- entity.ProcessCdoe = ugr.Cells["PROCESS_CODE"].Text.Trim();
- entity.ProcessDesc = ugr.Cells["PROCESS_DESC"].Text.Trim();
- entity.Produccode = ugrProDuc.Cells["PRODUCCODE"].Text.Trim();
- entity.Producname = ugrProDuc.Cells["PRODUCNAME"].Text.Trim();
- list.Add(entity);
- }
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否保存?") == DialogResult.No)
- {
- return;
- }
- _finallUser = ugrUser.Cells["CUSTOMER_NO"].Text.Trim();
- _produc = ugrProDuc.Cells["PRODUCCODE"].Text.Trim();
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.qcm.CoreComBaseCustomRPline";
- ccp.MethodName = "saveCustomRPline";
- ccp.ServerParams = new object[] { list, ugrUser.Cells["CUSTOMER_NO"].Text.Trim(), ugrProDuc.Cells["PRODUCCODE"].Text.Trim() };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- MessageUtil.ShowTips("保存成功!");
- QueryProline();
- Query();
- getCustPline();
- setGridRowColor();
- setUltraGridActive();
- }
- }
- private void ultraCheckUser_CheckedChanged(object sender, EventArgs e)
- {
- if (ultraCheckUser.Checked)
- {
- ultraTextUser.Enabled = true;
- }
- else
- {
- ultraTextUser.Enabled = false;
- }
- }
- private void ultraGridUser_AfterRowActivate(object sender, EventArgs e)
- {
- QueryProline();
- if (ultraGridUser.ActiveRow != null)
- {
- setGridRowColor(ultraGridUser.ActiveRow.Cells["CUSTOMER_NO"].Text);
- }
- }
- private void ultraGridProDuc_AfterRowActivate(object sender, EventArgs e)
- {
- QueryProline();
- }
- private void getCustPline()
- {
- _dt = ServerHelper.GetData("com.steering.pss.qcm.CoreComBaseCustomRPline.getCustPline", new Object[] { }, this.ob);
- }
- private void setGridRowColor()
- {
- if (_dt == null || _dt.Rows.Count == 0)
- {
- return;
- }
- ArrayList finalUsers = new ArrayList();
- foreach (DataRow dr in _dt.Rows)
- {
- finalUsers.Add(dr["CUSTOMER_NO"].ToString());
- }
- foreach (UltraGridRow ugr in ultraGridUser.Rows)
- {
- if (finalUsers.Contains(ugr.Cells["CUSTOMER_NO"].Text))
- {
- ugr.Appearance.BackColor = Color.Orange;
- }
- else
- {
- ugr.Appearance.BackColor = Color.White;
- }
- }
- }
- private void setGridRowColor(String customerNo)
- {
- if (_dt == null || _dt.Rows.Count == 0)
- {
- return;
- }
- ArrayList producs = new ArrayList();
- foreach (DataRow dr in _dt.Rows)
- {
- if (dr["CUSTOMER_NO"].ToString().Equals(customerNo))
- {
- producs.Add(dr["PRODUCCODE"].ToString());
- }
- }
- foreach (UltraGridRow ugr in ultraGridProDuc.Rows)
- {
- if (producs.Contains(ugr.Cells["PRODUCCODE"].Text))
- {
- ugr.Appearance.BackColor = Color.Orange;
- }
- else
- {
- ugr.Appearance.BackColor = Color.White;
- }
- }
- }
- private void FrmComBaseCustomRPline_Load(object sender, EventArgs e)
- {
- Query();
- }
- private void setUltraGridActive()
- {
- foreach (UltraGridRow ugr in ultraGridUser.Rows)
- {
- if (ugr.Cells["CUSTOMER_NO"].Text.Equals(_finallUser))
- {
- ugr.Activate();
- break;
- }
- }
- foreach (UltraGridRow ugr in ultraGridProDuc.Rows)
- {
- if (ugr.Cells["PRODUCCODE"].Text.Equals(_produc))
- {
- ugr.Activate();
- }
- }
- _finallUser = "";
- _produc = "";
- }
- }
- }
|