| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Globalization;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.Mcp.Control.Entity;
- using CoreFS.CA06;
- using Infragistics.Win.UltraWinGrid;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Control;
- using System.Collections;
- using Core.StlMes.Client.Mcp.Mch.McmZj;
- using Core.Mes.Client.Comm.Format;
- namespace Core.StlMes.Client.Mcp.Mch.MchResult
- {
- public partial class FrmZjResult : FrmBase
- {
- private string _judgeStove = "";
- private string _batchNo = "";
- protected override void OnLoad(EventArgs e)
- {
- base.OnLoad(e);
- ultraGridPlan.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
- baseinfoZj1.UltraGrid4.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
- informationZj1.UltraGrid4.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
- ultraGrid1.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
- foreach (UltraGridColumn ugc in ultraGridPlan.DisplayLayout.Bands[0].Columns)
- {
- ugc.SortIndicator = SortIndicator.Disabled;
- }
- //PanelSizeFlag = 0;
- }
- public FrmZjResult()
- {
- InitializeComponent();
- //GridHelper.InitCardGrid(dataSet1, ultraGridPlan);//显示人工质检主信息界面
-
- }
- /// <summary>
- /// ToolBar按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="ToolbarKey"></param>
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "DoQuery":
- PlanQuery();
- break;
- case "DoAdd":
- ResultSave();
- break;
- case "DoDelete":
- DoDelete();
- break;
- case "Exp":
- Doexp();
- break;
- case "Close":
- this.Dispose();
- this.Close();
- break;
- }
- }
- /// <summary>
- /// 获取grid 所有勾选的行
- /// </summary>
- /// <param name="grid"></param>
- /// <param name="columnName">复选框所在列名</param>
- /// <returns></returns>
- public static List<UltraGridRow> UltraGridGetChooseRows(UltraGrid grid)
- {
- grid.UpdateData();
- List<UltraGridRow> list = new List<UltraGridRow>();
- RowsCollection rows = grid.Rows;
- foreach (var item in rows)
- {
- try
- {
- if (Convert.ToBoolean(item.Cells["check"].Value) == true)
- {
- list.Add(item);
- }
- }
- catch { }
- }
- return list;
- }
- public List<ArrayList> getplnZyZjc()
- {
- List<ArrayList> ls = new List<ArrayList>();
-
- this.ultraGrid1.UpdateData();
- List<UltraGridRow> listRow = UltraGridGetChooseRows(ultraGrid1);
- foreach (UltraGridRow ultraGridRow in listRow)
- {
- ArrayList plnZyZjc = new ArrayList();
- string heatPlanSqe = ultraGridRow.Cells["HEAT_PLAN_SQE"].Value.ToString();
- string judgeStoveNo = ultraGridRow.Cells["JUDGE_STOVE_NO"].Value.ToString();
- string pipeEndOd1 = ultraGridRow.Cells["PIPE_END_OD1"].Value.ToString();
- string pipeEndOd2 = ultraGridRow.Cells["PIPE_END_OD2"].Value.ToString();
- string pipeEndOutOfRoundness = ultraGridRow.Cells["PIPE_END_OUT_OF_ROUNDNESS"].Value.ToString();
- string pipeEndMm = ultraGridRow.Cells["PIPE_END_MM"].Value.ToString();
- string pipeEndS1 = ultraGridRow.Cells["PIPE_END_S1"].Value.ToString();
- string pipeEndS2 = ultraGridRow.Cells["PIPE_END_S2"].Value.ToString();
- string pipeEndS3 = ultraGridRow.Cells["PIPE_END_S3"].Value.ToString();
- string pipeEndS4 = ultraGridRow.Cells["PIPE_END_S4"].Value.ToString();
- string pipeEndBevel = ultraGridRow.Cells["PIPE_END_BEVEL"].Value.ToString();
- string pipeEndRootFace = ultraGridRow.Cells["PIPE_END_ROOT_FACE"].Value.ToString();
- string pipeEndOutOfSquareness = ultraGridRow.Cells["PIPE_END_OUT_OF_SQUARENESS"].Value.ToString();
- string pipeEndResiMag = ultraGridRow.Cells["PIPE_END_RESI_MAG"].Value.ToString();
- string pipeBodyOd1 = ultraGridRow.Cells["PIPE_BODY_OD1"].Value.ToString();
- string pipeBodyOd2 = ultraGridRow.Cells["PIPE_BODY_OD2"].Value.ToString();
- string pipeBodyOutOfRoundness = ultraGridRow.Cells["PIPE_BODY_OUT_OF_ROUNDNESS"].Value.ToString();
- string pipeBodyMm = ultraGridRow.Cells["PIPE_BODY_MM"].Value.ToString();
- string isDecide = ultraGridRow.Cells["IS_DECIDE"].Value.ToString();
- string pipeBodyLengs = ultraGridRow.Cells["PIPE_BODY_LENGS"].Value.ToString();
- string pipeEndOd1B = ultraGridRow.Cells["PIPE_END_OD1_B"].Value.ToString();
- string pipeEndOd2B = ultraGridRow.Cells["PIPE_END_OD2_B"].Value.ToString();
- string pipeEndOutOfRoundnessB = ultraGridRow.Cells["PIPE_END_OUT_OF_ROUNDNESS_B"].Value.ToString();
- string pipeEndMmB = ultraGridRow.Cells["PIPE_END_MM_B"].Value.ToString();
- string pipeEndS1B = ultraGridRow.Cells["PIPE_END_S1_B"].Value.ToString();
- string pipeEndS2B = ultraGridRow.Cells["PIPE_END_S2_B"].Value.ToString();
- string pipeEndS3B = ultraGridRow.Cells["PIPE_END_S3_B"].Value.ToString();
- string pipeEndS4B = ultraGridRow.Cells["PIPE_END_S4_B"].Value.ToString();
- string pipeEndBevelB = ultraGridRow.Cells["PIPE_END_BEVEL_B"].Value.ToString();
- string pipeEndRootFaceB = ultraGridRow.Cells["PIPE_END_ROOT_FACE_B"].Value.ToString();
- string pipeEndOutOfSquarenessB = ultraGridRow.Cells["PIPE_END_OUT_OF_SQUARENESS_B"].Value.ToString();
- string pipeEndResiMagB = ultraGridRow.Cells["PIPE_END_RESI_MAG_B"].Value.ToString();
- string pipeEndResiMag2 = ultraGridRow.Cells["PIPE_END_RESI_MAG_2"].Value.ToString();
- string pipeEndResiMag3 = ultraGridRow.Cells["PIPE_END_RESI_MAG_3"].Value.ToString();
- string pipeEndResiMag4 = ultraGridRow.Cells["PIPE_END_RESI_MAG_4"].Value.ToString();
- string pipeEndResiMag2B = ultraGridRow.Cells["PIPE_END_RESI_MAG_2_B"].Value.ToString();
- string pipeEndResiMag3B = ultraGridRow.Cells["PIPE_END_RESI_MAG_3_B"].Value.ToString();
- string pipeEndResiMag4B = ultraGridRow.Cells["PIPE_END_RESI_MAG_4_B"].Value.ToString();
- plnZyZjc.Add(heatPlanSqe);
- plnZyZjc.Add(judgeStoveNo);
- plnZyZjc.Add(pipeEndOd1);
- plnZyZjc.Add(pipeEndOd2);
- plnZyZjc.Add(pipeEndOutOfRoundness);
- plnZyZjc.Add(pipeEndMm);
- plnZyZjc.Add(pipeEndS1);
- plnZyZjc.Add(pipeEndS2);
- plnZyZjc.Add(pipeEndS3);
- plnZyZjc.Add(pipeEndS4);
- plnZyZjc.Add(pipeEndBevel);
- plnZyZjc.Add(pipeEndRootFace);
- plnZyZjc.Add(pipeEndOutOfSquareness);
- plnZyZjc.Add(pipeEndResiMag);
- plnZyZjc.Add(pipeBodyOd1);
- plnZyZjc.Add(pipeBodyOd2);
- plnZyZjc.Add(pipeBodyOutOfRoundness);
- plnZyZjc.Add(isDecide);
- plnZyZjc.Add(pipeBodyLengs);
- plnZyZjc.Add(pipeBodyMm);
- plnZyZjc.Add(pipeEndOd1B);
- plnZyZjc.Add(pipeEndOd2B);
- plnZyZjc.Add(pipeEndOutOfRoundnessB);
- plnZyZjc.Add(pipeEndMmB);
- plnZyZjc.Add(pipeEndS1B);
- plnZyZjc.Add(pipeEndS2B);
- plnZyZjc.Add(pipeEndS3B);
- plnZyZjc.Add(pipeEndS4B);
- plnZyZjc.Add(pipeEndBevelB);
- plnZyZjc.Add(pipeEndRootFaceB);
- plnZyZjc.Add(pipeEndOutOfSquarenessB);
- plnZyZjc.Add(pipeEndResiMagB);
- plnZyZjc.Add(pipeEndResiMag2);
- plnZyZjc.Add(pipeEndResiMag3);
- plnZyZjc.Add(pipeEndResiMag4);
- plnZyZjc.Add(pipeEndResiMag2B);
- plnZyZjc.Add(pipeEndResiMag3B);
- plnZyZjc.Add(pipeEndResiMag4B);
- ls.Add(plnZyZjc);
- }
- return ls;
- }
- public void CopyDataToDatatableplnZyZjc(string judgeStoveNo)
- {
- if (judgeStoveNo == null)
- {
- return;
- }
- dtPipeSize.Rows.Clear();
- DataTable dtDtail = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmZjResult.getQueryZjc", new object[] { judgeStoveNo }, this.ob);
- GridHelper.CopyDataToDatatable(ref dtDtail, ref dtPipeSize, true);
- }
- /// <summary>
- /// 计划查询
- /// </summary>
- public void PlanQuery()
- {
- string PrimaKey = txtJudgeStoveNo.Text.ToString();
- //查询计划记录
- DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmZjResult.getQueryZjBaseInfo", new object[] { PrimaKey }, this.ob);
- if (dt.Rows.Count == 0)
- {
- if (ShowMessageFlag == 0)
- {
- MessageBox.Show("未查询到匹配的数据,请重新查询!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- return;
- }
- GridHelper.CopyDataToDatatable(ref dt, ref dtPlan, true);
- _judgeStove = dt.Rows[0]["JUDGE_STOVE_NO"].ToString();
- baseinfoZj1.CopyDataToDatatableBseinfo(dt);
- informationZj1.CopyDataToDatatableplnZyZjDtail(dt,this.ob);
- CopyDataToDatatableplnZyZjc(dt.Rows[0]["JUDGE_STOVE_NO"].ToString());
- }
- /// <summary>
- /// 保存
- /// </summary>
- public void ResultSave()
- {
- //基础信息
- ArrayList plnZyZjm = getplinZyZjm();
- //详情表
- ArrayList plnZyZjcDtail = informationZj1.getplinZyZjdetal();
- //管号详情表
- List<ArrayList> plnZyZjc = getplnZyZjc();
- if (informationZj1.isReturn == false)
- {
- MessageBox.Show("输入支数错误", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否保存?") == DialogResult.No)
- return;
- var ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.mcp.Mch.FrmZjResult";
- ccp.MethodName = "doSaveZjRusult";
- ccp.ServerParams = new object[]
- {
- plnZyZjm, plnZyZjcDtail,plnZyZjc
- };
- ccp = ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- PlanQuery();
- }
- }
- private void Doexp()
- {
- UltraGridRow row = ultraGridPlan.ActiveRow;
- string jugeNo = row.Cells["JUDGE_STOVE_NO"].Value.ToString();
- string zjid = row.Cells["ZJID"].Value.ToString();
- if (zjid.Equals("")) return;
- string strurl = "http://172.54.10.42:8080/webroot/decision/view/report?op=write&viewlet=SteelPipeFinalInspectionReport.cpt&zjId=" + zjid + "&stoNo=" + jugeNo;
- if (zjid.Equals("")) return;
- var fre = new FrmRepExcel(ob, strurl);
- fre.AutoSize = true;
- fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
- fre.WindowState = FormWindowState.Maximized;
- fre.Show();
- }
- public ArrayList getplinZyZjm()
- {
- ArrayList plnZyZjm = new ArrayList();
- baseinfoZj1.UltraGrid4.UpdateData();
- UltraGridRow ultraGridPlans = ultraGridPlan.ActiveRow;
- UltraGridRow ultraGridBaseinfo = baseinfoZj1.UltraGrid4.ActiveRow;
- //基础信息
- string judgeStove = ultraGridPlans.Cells["JUDGE_STOVE_NO"].Value.ToString();
- string orderNo = ultraGridPlans.Cells["ORDER_NO"].Value.ToString();
- string specName = ultraGridPlans.Cells["SPEC_NAME"].Value.ToString();
- string gradename = ultraGridPlans.Cells["GRADENAME"].Value.ToString();
- string steelname = ultraGridPlans.Cells["STEELNAME"].Value.ToString();
- string producname = ultraGridPlans.Cells["PRODUCNAME"].Value.ToString();
- string stdName = ultraGridPlans.Cells["STD_NAME"].Value.ToString();
-
- string length = ultraGridBaseinfo.Cells["LENGTH"].Value.ToString();
- string coating = ultraGridBaseinfo.Cells["COATING"].Value.ToString();
- string protector = ultraGridBaseinfo.Cells["PROTECTOR"].Value.ToString();
- string marking = ultraGridBaseinfo.Cells["MARKING"].Value.ToString();
- string bachNo = ultraGridBaseinfo.Cells["lotNo"].Value.ToString();
- string resiMag = ultraGridBaseinfo.Cells["Resimag"].Value.ToString();
- string zjid = ultraGridPlans.Cells["ZJID"].Value.ToString();
- _batchNo = bachNo;
- plnZyZjm.Add(judgeStove);
- plnZyZjm.Add(bachNo);
- plnZyZjm.Add(specName);
- plnZyZjm.Add(gradename);
- plnZyZjm.Add(steelname);
- plnZyZjm.Add(orderNo);
- plnZyZjm.Add(producname);
- plnZyZjm.Add(stdName);
- plnZyZjm.Add(length);
- plnZyZjm.Add(coating);
- plnZyZjm.Add(protector);
- plnZyZjm.Add(marking);
- plnZyZjm.Add(resiMag);
- plnZyZjm.Add(zjid);
- return plnZyZjm;
- }
- private void DoDelete()
- {
- UltraGridRow row = ultraGridPlan.ActiveRow;
- string stoveNo = row.Cells["JUDGE_STOVE_NO"].Value.ToString();
- if (stoveNo.Equals("") || stoveNo == null) return;
- if (MessageUtil.ShowYesNoAndQuestion("是否删除?") == DialogResult.No)
- return;
- CoreClientParam ccp = new CoreClientParam();
- try
- {
- ccp.ServerName = "com.steering.mes.mcp.Mch.FrmZjResult";
- ccp.MethodName = "DoDelete";
- ccp.ServerParams = new object[] { stoveNo };
- ccp = ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- PlanQuery();
- }
- }
- catch (Exception ex)
- {
- MessageUtil.ShowTips("操作失败");
- }
- if (ccp.ReturnCode != -1)
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- ccp.ReturnInfo.Equals("删除成功");
- PlanQuery();
- }
- }
- public int ShowMessageFlag { get; set; }
- private void ultraComboEditor1_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
- {
- List<String> ls = new List<string>();
- List<UltraGridRow> listRow = UltraGridGetChooseRows(ultraGrid1);
- RowsCollection rows = ultraGrid1.Rows;
- foreach (var item in rows)
- {
- try
- {
- //if (Convert.ToBoolean(item.Cells["check"].Value) == true)
- //{
- // list.Add(item);
- //}
- string heatPlanSqe = item.Cells["MAT_NO"].Value.ToString();
- ls.Add(heatPlanSqe);
- }
- catch { }
- }
- using (FrmMesureData MesureData = new FrmMesureData(_judgeStove, _batchNo, ob, this.UserInfo.GetUserName(), false, ls))
- {
- MesureData.ShowDialog();
- CopyDataToDatatableplnZyZjc(_judgeStove);
- ultraGrid1.UpdateData();
- ultraGrid1.Refresh();
- //ultraGrid1.ActiveCell.Value = (decimal)MesureData.list.Where(p => p.Flag == "00").Select(p => p.MatNo).Distinct().Count();
- //portMchBatchControl1.Query(ActiveRow.HeatPlanNo, ActiveRow.BatchNo, Gx, ActiveRow.ProducType == "C" || ActiveRow.ProducType == "E");
- }
- }
- private void ultraGrid1_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (this.ultraGrid1.ActiveCell == null)
- return;
- string strKey = this.ultraGrid1.ActiveCell.Column.ToString();
- if (!(e.KeyChar == '\b') && ultraGrid1.ActiveRow.Cells[strKey].Value.ToString().Length >= 6)
- {
- e.Handled = true;
- }
- if (!(Char.IsNumber(e.KeyChar) || e.KeyChar == '\b' || e.KeyChar == '.'))
- {
- e.Handled = true;
- }
- if (e.KeyChar == '.')
- {
- char[] arrary = ultraGrid1.ActiveRow.Cells[strKey].Text.ToCharArray();
- if (arrary.Length == 0)
- {
- ultraGrid1.ActiveRow.Cells[strKey].Value = "0.";
- ultraGrid1.ActiveRow.Cells[strKey].SelStart = ultraGrid1.ActiveRow.Cells[strKey].Value.ToString().Length;
- e.Handled = true;
- }
- else
- {
- for (int i = 0; i < arrary.Length; i++)
- {
- if (arrary[i] == '.')
- e.Handled = true;
- }
- }
- }
- }
- private void chkHeatNo_CheckedChanged(object sender, EventArgs e)
- {
- txtJudgeStoveNo.Enabled = chkHeatNo.Checked;
- }
- }
- }
|