| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290 |
- 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 CoreFS.CA06;
- using Infragistics.Win.UltraWinEditors;
- using Core.StlMes.Client.ZGMil.Signature;
- using Core.StlMes.Client.ZGMil.Entity;
- using Core.Mes.Client.Comm.Control;
- using Infragistics.Win.UltraWinGrid;
- using Core.Mes.Client.Comm.Tool;
- using Core.Mes.Client.Comm.Server;
- using CoreFS.SA06;
- using System.Collections;
- using Infragistics.Win;
- using System.IO;
- using Core.Mes.Client.Comm.Format;
- namespace Core.StlMes.Client.ZGMil
- {
- public partial class FrmQualityObjectives : FrmBase
- {
- private string departm = "";
- UltraComboEditor ucePline = new UltraComboEditor();//产线名称
- private string plineCode;
- string year = "";
- public FrmQualityObjectives()
- {
- InitializeComponent();
- }
- private void FrmQualityObjectives_Load(object sender, EventArgs e)
- {
-
- NativeMethodNew na = new NativeMethodNew(this.ob);
- departm = UserInfo.GetDepartment();
- plineCode = na.GetPCode(departm);//获取 用户 对应的产线
- EntityHelper.ShowGridCaption<ComBaseQualityObjectivesEntity>(ultraGrid1.DisplayLayout.Bands[0]);
- year = DateTime.Now.Year.ToString();
- //plineCode = na.GetPCodePline(this.ValidDataPurviewIds);//获取产线方法
- //TubeRoll.InitComboEditorValue(ucePline, "com.steering.mes.signature.FrmQualityObjectives.queryPlineCode", "PLINE_CODE", this.ob, false, plineCode);
- //TubeRoll.BindColumn(ucePline, "PLINE_CODE", this.Controls, this.ultraGrid1, 0);
- //ultraPlineCode.Items.Remove()
- //类别
- DataTable dt = TubeRoll.GetComBaseInfo("411001", ob);
- ultraType.DataSource = dt;
- ultraType.ValueMember = "BASECODE";
- ultraType.DisplayMember = "BASENAME";
- TubeRoll.SetComboItemHeight(ultraType);
- //部门
- DataTable dt2 = TubeRoll.GetComBaseInfo("411002", ob);
- ultraDepartname.DataSource = dt2;
- ultraDepartname.ValueMember = "BASECODE";
- ultraDepartname.DisplayMember = "BASENAME";
- TubeRoll.SetComboItemHeight(ultraDepartname);
- //项目
- DataTable dt3 = TubeRoll.GetComBaseInfo("411003", ob);
- ultraProject.DataSource = dt3;
- ultraProject.ValueMember = "BASECODE";
- ultraProject.DisplayMember = "BASENAME";
- TubeRoll.SetComboItemHeight(ultraProject);
- DoQuery();
- }
- /// <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 "Update":
- DoUpdare();
- break;
- case "Close":
- this.Close();
- break;
- }
- }
- /// <summary>
- /// 查询
- /// </summary>
- private void DoQuery()
- {
- //DataTable dt = ServerHelper.GetData("com.steering.mes.signature.FrmReportManage.queryReportManage", new Object[] { plineCode, this.UserInfo.GetUserName() }, ob);
- //GridHelper.CopyDataToDatatable(dt, this.dataTable1, true);
- List<ComBaseQualityObjectivesEntity> listSource = EntityHelper.GetData<ComBaseQualityObjectivesEntity>(
- "com.steering.mes.signature.FrmQualityObjectives.doQueryData", new object[] { "1"}, this.ob);
- bindingSource1.DataSource = listSource;
- // GridHelper.RefreshAndAutoSize(this.ultraGrid1);
- }
- /// <summary>
- /// 新增
- /// </summary>
- private void DoAdd()
- {
- ultraGrid1.UpdateData();
- IQueryable<UltraGridRow> uGrid = ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
- if (uGrid.Count() == 0)
- {
- MessageUtil.ShowTips("请选择要新增的数据!");
- return;
- }
- ArrayList parm = new ArrayList();
- foreach (UltraGridRow uRow in uGrid)
- {
- if (!StringUtil.IsInt(uRow.Cells["qqYear"].Text.ToString()))
- {
- MessageUtil.ShowTips("请输人正确的年份!");
- return;
- }
- ComBaseQualityObjectivesEntity qualityEntity = (ComBaseQualityObjectivesEntity)uRow.ListObject;
- qualityEntity.CreateName = this.UserInfo.GetUserName();
- qualityEntity.TypeDesc = uRow.Cells["typeCode"].Text.ToString();
- qualityEntity.Departname = uRow.Cells["departid"].Text.ToString();
- //qualityEntity.DepartmentDesc = uRow.Cells["departmentCode"].Text.ToString();
- qualityEntity.ProjectDesc = uRow.Cells["projectCode"].Text.ToString();
- string qualityTity = JSONFormat.Format(qualityEntity);
- parm.Add(qualityTity);
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.signature.FrmQualityObjectives";
- ccp.MethodName = "doAdd";
- ccp.ServerParams = new object[] { parm };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("新增成功!"))
- {
- DoQuery();
- }
- }
- }
- /// <summary>
- /// 作废
- /// </summary>
- private void DoDelete()
- {
- ultraGrid1.UpdateData();
- ArrayList pram1 = new ArrayList();
- IQueryable<UltraGridRow> uGrid = ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
- if (uGrid.Count() == 0)
- {
- MessageUtil.ShowTips("请选择要作废的数据!");
- return;
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否确认作废信息?") == System.Windows.Forms.DialogResult.No)
- {
- return;
- }
- foreach (UltraGridRow ugr in uGrid)
- {
- ArrayList pram = new ArrayList();
- pram.Add(this.UserInfo.GetUserName());
- pram.Add(ugr.Cells["sysGuid"].Value.ToString());
- pram1.Add(pram);
- }
- int countinsert = ServerHelper.SetData("com.steering.mes.signature.FrmQualityObjectives.doDelete", new Object[] { pram1 }, this.ob);
- if (countinsert > 0)
- {
- MessageUtil.ShowTips("作废成功!");
- }
- else
- {
- MessageUtil.ShowTips("作废失败!"); return;
- }
- DoQuery();
- }
- /// <summary>
- /// 修改
- /// </summary>
- private void DoUpdare()
- {
- ultraGrid1.UpdateData();
-
- IQueryable<UltraGridRow> uGrid = ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
- if (uGrid.Count() == 0)
- {
- MessageUtil.ShowTips("请选择修改的数据!");
- return;
- }
- ArrayList parm = new ArrayList();
- foreach (UltraGridRow uRow in uGrid)
- {
- if (!StringUtil.IsInt(uRow.Cells["qqYear"].Text.ToString()))
- {
- MessageUtil.ShowTips("请输人正确的年份!");
- return;
- }
- ComBaseQualityObjectivesEntity qualityEntity = (ComBaseQualityObjectivesEntity)uRow.ListObject;
- qualityEntity.UpdateName = this.UserInfo.GetUserName();
- qualityEntity.TypeDesc = uRow.Cells["typeCode"].Text.ToString();
- qualityEntity.Departname = uRow.Cells["departid"].Text.ToString();
- //qualityEntity.DepartmentDesc = uRow.Cells["departmentCode"].Text.ToString();
- qualityEntity.ProjectDesc = uRow.Cells["projectCode"].Text.ToString();
- string qualityTity = JSONFormat.Format(qualityEntity);
- parm.Add(qualityTity);
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否修改?") == System.Windows.Forms.DialogResult.No) return;
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.signature.FrmQualityObjectives";
- ccp.MethodName = "doUpdate";
- ccp.ServerParams = new object[] { parm };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("修改成功!"))
- {
- DoQuery();
- }
- }
- }
- private void ultraGrid1_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
- {
- try
- {
- ultraGrid1.UpdateData();
- foreach (UltraGridRow r in ultraGrid1.Rows)
- {
- r.Cells["CHK"].Value = r.Selected;
- }
- }
- catch { }
- }
-
- private void ultraDepartment_EditorButtonClick(object sender, EditorButtonEventArgs e)
- {
- UltraGridRow row = ultraGrid1.ActiveRow;
- if (row == null) return;
- string departid = row.Cells["departid"].Value.ToString();
- FrmDepartment fpdc = new FrmDepartment(departid, ob);
- fpdc.AutoSize = true;
- fpdc.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
- fpdc.Text = "单位";
- fpdc.ShowDialog();
- if (fpdc.DialogResult == System.Windows.Forms.DialogResult.OK)
- {
- //获取弹出窗体的属性值
- row.Cells["departmentDesc"].Value = fpdc.Basename;
- row.Cells["departmentCode"].Value = fpdc.Basecode;
- }
- }
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
- UltraGridRow row = ultraGrid1.ActiveRow;
- if (row.Cells["qqYear"].Value.ToString() == "")
- {
- row.Cells["qqYear"].Value = year;
- }
- }
- }
- }
|