| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245 |
- using Core.Mes.Client.Comm.Format;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.YdmBcPipeManage.Entity;
- using CoreFS.CA06;
- using Infragistics.Win.UltraWinGrid;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace Core.StlMes.Client.YdmBcPipeManage
- {
- public partial class FrmSupervisonInfo : FrmBase
- {
- public FrmSupervisonInfo()
- {
- InitializeComponent();
- }
- private void FrmSupervisonInfo_Load(object sender, EventArgs e)
- {
- EntityHelper.ShowGridCaption<YdmBcSupervisorEntity>(ultraGrid1.DisplayLayout.Bands[0]);
- this.txtPline.Enabled = false;
- this.txtUser.Enabled = false;
- initPline();
- }
- /// <summary>
- /// 加载产线信息
- /// </summary>
- private void initPline()
- {
- DataTable dt = ServerHelper.GetData("com.steering.ydm.bc.FrmSupervisonInfo.doQueryPline", new object[] { }, this.ob);
- if (dt.Rows.Count > 0)
- {
- txtPline.DataSource = dt;
- txtPline.DisplayMember = "PLINE_NAME";
- txtPline.ValueMember = "PLINE_CODE";
- }
- }
- /// <summary>
- /// 重写基类方法
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="ToolbarKey"></param>
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- doQuery();
- break;
- case "Add":
- doAdd();
- break;
- case"Delete":
- doDelete();
- break;
- case "Close":
- close();
- break;
- }
- }
-
- /// <summary>
- /// 查询
- /// </summary>
- private void doQuery()
- {
- string plineCode = "";
- string txtUser = "";
- if (utrPlineChk.Checked && this.txtPline.Text != "")
- {
- plineCode = this.txtPline.Value.ToString2();
- }
- if (userChk.Checked && this.txtUser.Text != "")
- {
- txtUser = this.txtUser.Text.Trim().ToString();
- }
- ArrayList ayyList = new ArrayList();
- ayyList.Add(plineCode);
- ayyList.Add(txtUser);
- List<YdmBcSupervisorEntity> listSource = EntityHelper.GetData<YdmBcSupervisorEntity>("com.steering.ydm.bc.FrmSupervisonInfo.doQuery", new object[] { ayyList }, ob);
- YdmBcSupervisorEntitybindingSource.DataSource = listSource;
- }
- /// <summary>
- /// 新增
- /// </summary>
- private void doAdd()
- {
- if(this.texPlineBom.Text == "")
- {
- MessageUtil.ShowTips("请选择产线信息!");
- return;
- }
- if (this.ultraTextEditor2.Text == "")
- {
- MessageUtil.ShowTips("请选择仓库信息!");
- return;
- }
- if(this.txtUserBom.Text == "")
- {
- MessageUtil.ShowTips("请填入监装人信息!");
- return;
- }
- if(this.txtGroupBom.Text == "")
- {
- MessageUtil.ShowTips("请选择班组信息!");
- return;
- }
- YdmBcSupervisorEntity ydmBcEntity = new YdmBcSupervisorEntity();
- ydmBcEntity.SupervisorName = this.txtUserBom.Text;
- ydmBcEntity.PlineCode = this.texPlineBom.Tag.ToString2();
- ydmBcEntity.PlineName = this.texPlineBom.Text;
- ydmBcEntity.SupervisorCall = this.txtCall.Text;
- ydmBcEntity.ColGroup = this.txtGroupBom.Value.ToString2();
- ydmBcEntity.Memo = this.memoBom.Text;
- ydmBcEntity.CreateName = this.UserInfo.GetUserName();
- ydmBcEntity.StorageNo = this.ultraTextEditor2.Tag.ToString2();
- ydmBcEntity.StorageName = this.ultraTextEditor2.Text.ToString2();
- string ydmBcSuerEntity = JSONFormat.Format(ydmBcEntity);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.ydm.bc.FrmSupervisonInfo";
- ccp.MethodName = "doAdd";
- ccp.ServerParams = new object[] { ydmBcSuerEntity };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("新增成功!"))
- {
- doQuery();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- /// <summary>
- /// 删除数据
- /// </summary>
- private void doDelete()
- {
- this.ultraGrid1.UpdateData();
- UltraGridRow row = this.ultraGrid1.ActiveRow;
- if (row == null) return;
- YdmBcSupervisorEntity ydmEntity = (YdmBcSupervisorEntity)row.ListObject;
- string ydmBcEntity = JSONFormat.Format(ydmEntity);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.ydm.bc.FrmSupervisonInfo";
- ccp.MethodName = "doDelete";
- ccp.ServerParams = new object[] { ydmBcEntity };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("删除成功!"))
- {
- doQuery();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- private void close()
- {
- this.Close();
- }
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
- UltraGridRow row = this.ultraGrid1.ActiveRow;
- this.texPlineBom.Tag = row.Cells["PlineCode"].Text;
- this.texPlineBom.Text = row.Cells["PlineName"].Text;
- this.txtUserBom.Text = row.Cells["SupervisorName"].Text;
- this.txtCall.Text = row.Cells["SupervisorCall"].Text;
- this.txtGroupBom.Text = row.Cells["ColGroup"].Text;
- this.memoBom.Text = row.Cells["Memo"].Text;
- this.ultraTextEditor2.Tag = row.Cells["StorageNo"].Text;
- }
- private void utrPlineChk_CheckedChanged(object sender, EventArgs e)
- {
- this.txtPline.Enabled = this.utrPlineChk.Checked;
- }
- private void userChk_CheckedChanged(object sender, EventArgs e)
- {
- this.txtUser.Enabled = this.userChk.Checked;
- }
- private void texPlineBom_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
- {
- DataTable dt = ServerHelper.GetData("com.steering.ydm.bc.FrmSupervisonInfo.doQueryPline",
- new object[] { }, ob);
- dt.Columns["PLINE_NAME"].Caption = "产线";
- BaseInfoPopup baseInfo = new BaseInfoPopup(dt, "PLINE_NAME", "PLINE_CODE");
- baseInfo.Shown += new EventHandler((a, b) =>
- {
- var actRow = baseInfo.UltraGrid1.Rows.AsQueryable().Where(
- c => c.GetValue("PLINE_CODE") == this.texPlineBom.Tag.ToString2()).FirstOrDefault();
- if (actRow != null) actRow.Activate();
- });
- if (baseInfo.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- texPlineBom.Tag = baseInfo.ChoicedRow.GetValue("PLINE_CODE");
- texPlineBom.Text = baseInfo.ChoicedRow.GetValue("PLINE_NAME");
- }
- }
- private void ultraTextEditor2_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
- {
- DataTable dt = ServerHelper.GetData("com.steering.ydm.bc.FrmSupervisonInfo.doQueryStorageNo",
- new object[] { }, ob);
- dt.Columns["STORAGE_NAME"].Caption = "仓库";
- BaseInfoPopup baseInfo = new BaseInfoPopup(dt, "STORAGE_NAME", "STORAGE_NO");
- baseInfo.Shown += new EventHandler((a, b) =>
- {
- var actRow = baseInfo.UltraGrid1.Rows.AsQueryable().Where(
- c => c.GetValue("STORAGE_NO") == this.ultraTextEditor2.Tag.ToString2()).FirstOrDefault();
- if (actRow != null) actRow.Activate();
- });
- if (baseInfo.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- ultraTextEditor2.Tag = baseInfo.ChoicedRow.GetValue("STORAGE_NO");
- ultraTextEditor2.Text = baseInfo.ChoicedRow.GetValue("STORAGE_NAME");
- }
- }
- }
- }
|