| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289 |
- 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;
- namespace Core.StlMes.Client.ZGMil
- {
- public partial class FrmReportManage : FrmBase
- {
- private string departm = "";
- UltraComboEditor ucePline = new UltraComboEditor();//产线名称
- private string plineCode;
- public FrmReportManage()
- {
- InitializeComponent();
- }
- private void FrmTubeRollFileManage_Load(object sender, EventArgs e)
- {
-
- NativeMethodNew na = new NativeMethodNew(this.ob);
- departm = UserInfo.GetDepartment();
- plineCode = na.GetPCode(departm);//获取 用户 对应的产线
- //plineCode = na.GetPCodePline(this.ValidDataPurviewIds);//获取产线方法
- TubeRoll.InitComboEditorValue(ucePline, "com.steering.mes.signature.FrmTubeRollFileManage.queryPlineCode", "PLINE_CODE", this.ob, false, plineCode);
- TubeRoll.BindColumn(ucePline, "PLINE_CODE", this.Controls, this.ultraGrid1, 0);
- //ultraPlineCode.Items.Remove()
- 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);
- foreach (UltraGridRow ugr in ultraGrid1.Rows)
- {
- ugr.Cells["PLINE_CODE"].Appearance.BackColor =Color.Transparent;
- ugr.Cells["PLINE_CODE"].Appearance.BackHatchStyle = BackHatchStyle.Default;
- ugr.Cells["PLINE_CODE"].Activation = Infragistics.Win.UltraWinGrid.Activation.ActivateOnly;
- //ugr.Cells["COL_GROUP"].Appearance.BackColor = Color.Transparent;
- //ugr.Cells["COL_GROUP"].Appearance.BackHatchStyle = BackHatchStyle.Default;
- //ugr.Cells["COL_GROUP"].Activation = Infragistics.Win.UltraWinGrid.Activation.ActivateOnly;
- }
- }
- /// <summary>
- /// 新增
- /// </summary>
- private void DoAdd()
- {
- ultraGrid1.UpdateData();
- ArrayList list1 = new ArrayList();
- string pline = "";
- string reportNo = "";
- string reportNoNew = "";
- string reportNoTime = "";
- //int count = 0;
- IQueryable<UltraGridRow> uGrid = ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
- if (uGrid.Count() == 0)
- {
- MessageUtil.ShowTips("请选择要新增的数据!");
- return;
- }
- foreach (UltraGridRow ugr in uGrid)
- {
- pline = ugr.Cells["PLINE_CODE"].Value.ToString();
- reportNo = ugr.Cells["REPORT_NO"].Value.ToString();
- reportNoNew = ugr.Cells["REPORT_NO_NEW"].Value.ToString();
- if (ugr.Cells["REPORT_NO_TIME"].Value.ToString().Equals(""))
- {
- MessageUtil.ShowTips("请选择生效日期!");
- return;
- }
- reportNoTime = Convert.ToDateTime(ugr.Cells["REPORT_NO_TIME"].Value.ToString()).ToString("yyyyMMdd");
- if (pline == "") { MessageUtil.ShowTips("产线不能为空!"); return; }
- if (reportNo == "") { MessageUtil.ShowTips("报表不能为空!"); return; }
- if (reportNoNew == "") { MessageUtil.ShowTips("生效编号不能为空!"); return; }
- if (reportNo == "") { MessageUtil.ShowTips("旧编号不能为空!"); return; }
- //if (ugr.Cells["PROCESS_NO"].Text.Trim()!= "") { //MessageUtil.ShowTips("工序名称不能为空!"); return;
- // gx = ugr.Cells["PROCESS_NO"].Value.ToString();
- //}
-
- //DataTable dt = ServerHelper.GetData("com.steering.mes.signature.FrmTubeRollFileManage.queryMinStgnature2", new object[] {ugr.Cells["USER_ID"].Text.Trim()}, ob);
- //if (dt.Rows.Count > 0) { MessageUtil.ShowTips("已存在数据,不能进行此操作!"); return; }
- ArrayList list = new ArrayList();
- list.Add(pline);
- list.Add(reportNo);
- list.Add(reportNoNew);
- list.Add(reportNoTime);
- list.Add(ugr.Cells["REPORT_NAME"].Value.ToString());
- list.Add(ugr.Cells["REMARK"].Text.Trim());
- list.Add(UserInfo.GetUserName());
- list.Add(ugr.Cells["GENERATE_STATION"].Text.Trim());
- list.Add(ugr.Cells["RECEIVING_STATION"].Text.Trim());
- list.Add(ugr.Cells["SAVE_STATION"].Text.Trim());
- list.Add(ugr.Cells["STORAGE_LIFE"].Text.Trim());
- list.Add(ugr.Cells["INTERMEDIARY"].Text.Trim());
- list1.Add(list);
- }
- //if (MessageUtil.ShowYesNoAndQuestion("是否保存签名?") == System.Windows.Forms.DialogResult.No) return;
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.signature.FrmReportManage";
- ccp.MethodName = "addReportManage";
- ccp.ServerParams = new object[] { list1 };
- 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(ugr.Cells["PLINE_CODE"].Value.ToString());
- pram.Add(ugr.Cells["REPORT_NAME"].Value.ToString());
- pram1.Add(pram);
- }
- int countinsert = ServerHelper.SetData("com.steering.mes.signature.FrmReportManage.deleteReportManage", new Object[] { pram1 }, this.ob);
- if (countinsert > 0)
- {
- MessageUtil.ShowTips("删除成功!");
- }
- else
- {
- MessageUtil.ShowTips("删除失败!"); return;
- }
- DoQuery();
- }
- /// <summary>
- /// 修改
- /// </summary>
- private void DoUpdare()
- {
- ultraGrid1.UpdateData();
- string pline = "";
- string reportNo = "";
- string reportNoNew = "";
- string reportNoTime = "";
- //int count = 0;
- ArrayList pram1 = new ArrayList();
- IQueryable<UltraGridRow> uGrid = ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
- if (uGrid.Count() == 0)
- {
- MessageUtil.ShowTips("请选择修改的数据!");
- return;
- }
- foreach (UltraGridRow ugr in uGrid)
- {
- pline = ugr.Cells["PLINE_CODE"].Value.ToString();
- reportNo = ugr.Cells["REPORT_NO"].Value.ToString();
- reportNoNew = ugr.Cells["REPORT_NO_NEW"].Value.ToString();
- if (ugr.Cells["REPORT_NO_TIME"].Value.ToString().Equals(""))
- {
- MessageUtil.ShowTips("请选择生效日期!");
- return;
- }
- reportNoTime = Convert.ToDateTime(ugr.Cells["REPORT_NO_TIME"].Value.ToString()).ToString("yyyyMMdd");
- if (pline == "") { MessageUtil.ShowTips("产线不能为空!"); return; }
- if (reportNo == "") { MessageUtil.ShowTips("报表不能为空!"); return; }
- if (reportNoNew == "") { MessageUtil.ShowTips("生效编号不能为空!"); return; }
- if (reportNo == "") { MessageUtil.ShowTips("旧编号不能为空!"); return; }
- ArrayList list = new ArrayList();
- list.Add(reportNo);
- list.Add(reportNoNew);
- list.Add(reportNoTime);
- list.Add(UserInfo.GetUserName());
- list.Add(ugr.Cells["REMARK"].Text.Trim());
- list.Add(ugr.Cells["GENERATE_STATION"].Text.Trim());
- list.Add(ugr.Cells["RECEIVING_STATION"].Text.Trim());
- list.Add(ugr.Cells["SAVE_STATION"].Text.Trim());
- list.Add(ugr.Cells["STORAGE_LIFE"].Text.Trim());
- list.Add(ugr.Cells["INTERMEDIARY"].Text.Trim());
- list.Add(pline);
- list.Add(ugr.Cells["REPORT_NAME"].Value.ToString());
- pram1.Add(list);
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否修报表信息?") == System.Windows.Forms.DialogResult.No) return;
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.signature.FrmReportManage";
- ccp.MethodName = "updateReportManage";
- ccp.ServerParams = new object[] { pram1 };
- 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 { }
- }
- }
- }
|