| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404 |
- using com.steering.mes.zgmil.entity;
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Format;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.ZGMil.Common;
- using Core.StlMes.Client.ZGMil.Entity;
- using Core.StlMes.Client.ZGMil.NodeResultQuery;
- using Core.StlMes.Client.ZGMil.Popup;
- using Core.StlMes.Client.ZGMil.Report;
- using Core.StlMes.Client.ZGMil.ResultConrtrol;
- 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.ZGMil.Signature
- {
- public partial class FrmOfflineProcessAudit : FrmBase
- {
- public FrmOfflineProcessAudit()
- {
- InitializeComponent();
- EntityHelper.ShowGridCaption<OfflineProcessAuditEntity>(ultraGrid1.DisplayLayout.Bands[0]);
- }
- /// <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 "Audit1":
- doSave("1");
- break;
- case "Audit2":
- doSave("2");
- break;
- case "Audit3":
- doSave("3");
- break;
- case "Close":
- if (MessageUtil.ShowYesNoAndQuestion("是否确认关闭页面?") == DialogResult.Yes)
- {
- this.Close();
- }
- break;
- }
- }
- private void doQuery()
- {
- string StartTime = "";
- string EndTime = "";
- string isAudit = "";
- String id = "";
- if (ultraGrid1.ActiveRow != null) id = ultraGrid1.ActiveRow.Cells["ID"].Value.ToString();
- if (chkTim.Checked )
- {
- if (DateTime.Parse(startTime.Value.ToString()) > DateTime.Parse(endTime.Value.ToString()))
- {
- MessageUtil.ShowTips("选择的前面时间不能大于后面的时间!");
- return;
- }
- else
- {
- StartTime = this.startTime.Value.ToString("yyyy-MM-dd");
- EndTime = this.endTime.Value.ToString("yyyy-MM-dd");
- }
- }
- if (shr1.Checked)
- {
- isAudit = proc_chekedAudit(shr1.Checked, this.isAudit.Text.Trim());
- }
-
- dataSet1.Clear();
- this.dataTable1.Clear();
- this.dataTable2.Clear();
- DataTable dt = ServerHelper.GetData("com.steering.mes.signature.FrmOfflineProcessAudit.QueryOfflineProcessAudit", new object[] { StartTime, EndTime, isAudit }, ob);
- GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);
- for (int i = 0; i < ultraGrid1.Rows.Count; i++)
- {
- if (ultraGrid1.Rows[i].Cells["ID"].Value.ToString().Equals(id))
- {
- ultraGrid1.ActiveRow = ultraGrid1.Rows[i];
- //ulgridSteelPlan.Rows[i].Selected = true;
- return;
- }
- //else
- //{
- // ulgridSteelPlan.ActiveRow = ulgridSteelPlan.Rows[i];
- // //ulgridSteelPlan.Rows[i].Selected = true;
- // return;
- //}
- }
- }
- private void FrmOfflineProcessAudit_Load(object sender, EventArgs e)
- {
- doQuery();
- }
- private void doSave(string ToolbarKey)
- {
- this.ultraGrid1.UpdateData();
- IQueryable<UltraGridRow> checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
- if (checkMagRows.Count() == 0)
- {
- MessageUtil.ShowTips("请选择需要提交的信息!");
- return;
- }
- ArrayList parmList = new ArrayList();
- foreach (UltraGridRow row in checkMagRows)
- {
- OfflineProcessAuditEntity entity = new OfflineProcessAuditEntity();
- if (String.IsNullOrEmpty(row.Cells["ID"].Value.ToString()))
- continue;
- if (ToolbarKey.Equals("1"))
- {
- entity.Id = row.Cells["id"].Value.ToString();
- entity.AuditDep2 = UserInfo.GetDepartment();
- entity.Memo2 = memo2.Text;
- entity.AuditMan2 = UserInfo.GetUserName();
- entity.AuditTime2 = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- entity.AuditState2 = "1";
- entity.ResultNo = row.Cells["result_no"].Value.ToString();
- }
- if (ToolbarKey.Equals("2"))
- {
- entity.Id = row.Cells["ID"].Value.ToString();
- entity.AuditDep2 = "质保部";
- entity.Memo2 = memo2.Text;
- entity.AuditMan2 = UserInfo.GetUserName();
- entity.AuditTime2 = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- entity.AuditState2 = "2";
- entity.ResultNo = row.Cells["result_no"].Value.ToString();
- }
- //entity.RecRevisor = UserInfo.GetUserName();
- string baseEntity = JSONFormat.Format(entity);
- parmList.Add(baseEntity);
- }
- if (parmList.Count > 0)
- {
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.signature.FrmOfflineProcessAudit";
- ccp.MethodName = "doAddAudits";
- ccp.ServerParams = new object[] { parmList };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("操作成功"))
- {
- // DoQueryInList();
- doQuery();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- //if (ToolbarKey.Equals("1"))
- //{
- // MessageUtil.ShowTips("质检标准类型不能为空!");
- // return;
- //}
- //if (text_inspectStandName.Text == null || text_inspectStandName.Text.Equals(""))
- //{
- // MessageUtil.ShowTips("质检标准名称不能为空!");
- // return;
- //}
- //if (text_standStartDate.Text == null || text_standStartDate.Text.Equals(""))
- //{
- // MessageUtil.ShowTips("标准开始日期不能为空!");
- // return;
- //}
- //if (text_standEndDate.Text == null || text_standEndDate.Text.Equals(""))
- //{
- // MessageUtil.ShowTips("标准结束日期不能为空!");
- // return;
- //}
- //if (text_elmCode.Text == null || text_elmCode.Text.Equals(""))
- //{
- // MessageUtil.ShowTips("元素代码不能为空!");
- // return;
- //}
- //if (text_elmName.Text == null || text_elmName.Text.Equals(""))
- //{
- // MessageUtil.ShowTips("元素名称不能为空!");
- // return;
- //}
- //Tpopi26Entity entity = new Tpopi26Entity();
- //entity.InspectStandType = text_inspectStandType.Text;
- //entity.InspectStandName = text_inspectStandName.Text;
- //entity.StandStartDate = text_standStartDate.DateTime.ToString("yyyymmddHHmmss");
- //entity.StandEndDate = text_standEndDate.DateTime.ToString("yyyymmddHHmmss");
- //entity.ElmCode = text_elmCode.Text;
- //entity.ElmName = text_elmName.Text;
- //entity.InspectStandShort = text_inspectStandShort.Text;
- //entity.InspectOperatType = text_InspectOperatType.Text;
- //entity.JdeLevel = text_jdeLevel.Text;
- //entity.InspectStandDesc = text_InspectStandDesc.Text;
- //entity.RecCreator = UserInfo.GetUserName();
- //entity.RecRevisor = UserInfo.GetUserName();
- //entity.InspectStandCode = text_InspectStandCode.Text;
- //string baseEntity = JSONFormat.Format(entity);
- //if (ToolbarKey.Equals("ADD"))
- //{
- // CoreClientParam ccp = new CoreClientParam();
- // ccp.ServerName = "com.steering.lims.data.pipe.Tpopi26";
- // ccp.MethodName = "doAdd";
- // ccp.ServerParams = new object[] { new ArrayList { baseEntity } };
- // ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- // if (ccp.ReturnCode != -1)
- // {
- // doQuery();
- // MessageUtil.ShowTips("新增成功!");
- // }
- //}
- //if (ToolbarKey.Equals("Update"))
- //{
- // CoreClientParam ccp = new CoreClientParam();
- // ccp.ServerName = "com.steering.lims.data.pipe.Tpopi26";
- // ccp.MethodName = "doUpdate";
- // ccp.ServerParams = new object[] { new ArrayList { baseEntity } };
- // ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- // if (ccp.ReturnCode != -1)
- // {
- // doQuery();
- // MessageUtil.ShowTips("保存成功!");
- // }
- //}
-
- }
- private string proc_chekedAudit(bool cheked, string str)
- {
- switch (str)
- {
- case "等待评审":
- return "0";
- case "开始评审":
- return "1";
- case "评审通过":
- return "2";
- default:
- return "";
- }
- }
- private void doUpdate()
- {
- //this.ultraGrid1.UpdateData();
- //IQueryable<UltraGridRow> checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
- //if (checkMagRows.Count() == 0)
- //{
- // MessageUtil.ShowTips("请选择需要修改的信息!");
- // return;
- //}
- //ArrayList parmList = new ArrayList();
- //foreach (UltraGridRow row in checkMagRows)
- //{
- // Tpopi26Entity entity = row.ListObject as Tpopi26Entity;
- // if (String.IsNullOrEmpty(entity.InspectStandCode) || String.IsNullOrEmpty(entity.JdeLevel) || String.IsNullOrEmpty(entity.ElmCode))
- // continue;
- // //entity.RecRevisor = UserInfo.GetUserName();
- // string baseEntity = JSONFormat.Format(entity);
- // parmList.Add(baseEntity);
- //}
- //if (parmList.Count > 0)
- //{
- // CoreClientParam ccp = new CoreClientParam();
- // ccp.ServerName = "com.steering.lims.data.pipe.Tpopi26";
- // ccp.MethodName = "doUpdate";
- // ccp.ServerParams = new object[] { parmList };
- // ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- // if (ccp.ReturnCode != -1)
- // {
- // doQuery();
- // MessageUtil.ShowTips("修改成功!");
- // }
- //}
- }
- private void doDelete()
- {
- //this.ultraGrid1.UpdateData();
- //IQueryable<UltraGridRow> checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
- //if (checkMagRows.Count() == 0)
- //{
- // MessageUtil.ShowTips("请选择需要删除的信息!");
- // return;
- //}
- //ArrayList parmList = new ArrayList();
- //foreach (UltraGridRow row in checkMagRows)
- //{
- // Tpopi26Entity entity = row.ListObject as Tpopi26Entity;
- // if (String.IsNullOrEmpty(entity.InspectStandCode) || String.IsNullOrEmpty(entity.JdeLevel) || String.IsNullOrEmpty(entity.ElmCode))
- // continue;
- // string baseEntity = JSONFormat.Format(entity);
- // parmList.Add(baseEntity);
- //}
- //if (parmList.Count > 0)
- //{
- // CoreClientParam ccp = new CoreClientParam();
- // ccp.ServerName = "com.steering.lims.data.pipe.Tpopi26";
- // ccp.MethodName = "doDelete";
- // ccp.ServerParams = new object[] { parmList };
- // ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- // if (ccp.ReturnCode != -1)
- // {
- // doQuery();
- // MessageUtil.ShowTips("删除成功!");
- // }
- //}
- }
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
- //try
- //{
- // if (ultraGrid1.ActiveRow == null)
- // return;
- // Infragistics.Win.UltraWinGrid.UltraGridRow ulRow = ultraGrid1.ActiveRow;
- // text_inspectStandType.Text = Convert.ToString(ulRow.Cells["InspectStandType"].Value);
- // text_inspectStandName.Text = Convert.ToString(ulRow.Cells["InspectStandName"].Value);
- // text_inspectStandShort.Text = Convert.ToString(ulRow.Cells["InspectStandShort"].Value);
- // text_InspectStandCode.Text = Convert.ToString(ulRow.Cells["InspectStandCode"].Value);
- // text_InspectOperatType.Text = Convert.ToString(ulRow.Cells["InspectOperatType"].Value);
- // text_jdeLevel.Text = Convert.ToString(ulRow.Cells["JdeLevel"].Value);
- // text_standStartDate.Text = Convert.ToString(ulRow.Cells["StandStartDate"].Value);
- // text_standEndDate.Text = Convert.ToString(ulRow.Cells["StandEndDate"].Value);
- // text_InspectStandDesc.Text = Convert.ToString(ulRow.Cells["InspectStandDesc"].Value);
- // text_elmCode.Text = Convert.ToString(ulRow.Cells["ElmCode"].Value);
- // text_elmName.Text = Convert.ToString(ulRow.Cells["ElmName"].Value);
- // // text_inspectStandCode.Text = Convert.ToString(ulRow.Cells["InspectStandCode"].Value);
- //}
- //catch (Exception ex)
- //{
- // MessageBox.Show(ex.Message, "提示");
- //}
- }
- private void ultraGrid1_AfterRowExpanded(object sender, RowEventArgs e)
- {
- e.Row.Activated = true;
- for (int i = 0; i < ultraGrid1.Rows.Count; i++)
- {
- if (ultraGrid1.Rows[i].Expanded == true && ultraGrid1.Rows[i].Activated == false)
- {
- ultraGrid1.Rows[i].Expanded = false;
- }
- }
- string id = e.Row.Cells["ID"].Value.ToString();
- DataTable dt = ServerHelper.GetData("com.steering.mes.signature.FrmOfflineProcessAudit.QueryOfflineAudit", new object[] { id }, ob);
- GridHelper.CopyDataToDatatable(ref dt, ref dataTable2, true);
- for (int idx = this.dataTable2.Rows.Count - 1; idx >= 0; idx--)
- {
- if (Convert.ToString(this.dataTable2.Rows[idx]["ID"]) == id)
- this.dataTable2.Rows[idx].Delete();
- }
- this.dataTable2.AcceptChanges();
- DataRow newRow = null;
- foreach (DataRow row in dt.Rows)
- {
- newRow = this.dataTable2.NewRow();
- foreach (DataColumn col in dt.Columns)
- {
- if (this.dataTable2.Columns.Contains(col.ColumnName))
- newRow[col.ColumnName] = row[col.ColumnName];
- }
- this.dataTable2.Rows.Add(newRow);
- }
- this.dataTable2.AcceptChanges();
- //ClsControlPack.RefreshAndAutoSize(ulgridSteelPlan);
- }
-
- }
- }
|