| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446 |
- 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 Core.StlMes.Client.YdmStuffManage.Entity;
- using Core.Mes.Client.Comm.Tool;
- using System.Collections;
- using Infragistics.Win.UltraWinEditors;
- using Core.StlMes.Client.YdmBase;
- using Infragistics.Win.UltraWinGrid;
- using Core.Mes.Client.Comm.Format;
- using Infragistics.Win;
- using Core.Mes.Client.Comm.Server;
- namespace Core.StlMes.Client.YdmStuffManage
- {
- public partial class FrmStuffSurfaceInspection : FrmBase
- {
- public FrmStuffSurfaceInspection()
- {
- InitializeComponent();
- }
- private void FrmStuffSurfaceInspection_Load(object sender, EventArgs e)
- {
- DateTime now = DateTime.Now;
- DateTime dt1 = new DateTime(now.Year, now.Month, 1);//当月第一天
- DateTime dt2 = dt1.AddMonths(1).AddDays(-1);//当月最后一天
- RegStartTime.Value = DateTime.Parse(dt1.ToString("yyyy-MM-dd") + " 00:00:00");
- RegEndTime.Value = DateTime.Parse(dt2.ToString("yyyy-MM-dd") + " 23:59:59");
- EntityHelper.ShowGridCaption<MatGpMEntity1>(ultraGrid2.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<QcmLgSurfaceCEntity>(ultraGrid2.DisplayLayout.Bands[1]);
- EntityHelper.ShowGridCaption<StlLgSurfaceMEntity>(ultraGrid1.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<QcmLgSurfaceCEntity>(ultraGrid1.DisplayLayout.Bands[1]);
- BaseMethod.InitCellPosition(ultraGrid2, new string[] {"ActCount", "ActLenMax", "ActLenMin", "ActTheoryWeight", "ActHeight", "ActDimater", "CuttingNum", "ActLen", "ActFixNum", "ActFixLen" });
- BaseMethod.InitCellPosition(ultraGrid2, new string[] { "ActCount", "ActTheoryWeight", "ActLen", "CheckLen", "ActDimater", "CheckDimater" }, 1);
- BaseMethod.InitCellPosition(ultraGrid1, new string[] { "ActCount", "ActLenMax", "ActLenMin", "ActTheoryWeight", "ActDimater", "ActLen", "ActFixNum", "ActFixLen", "Quantity", "Eligiblequty"});
- BaseMethod.InitCellPosition(ultraGrid1, new string[] { "ActCount", "ActTheoryWeight", "ActLen", "CheckLen", "ActDimater", "CheckDimater" }, 1);
- InitBaseBug();
- }
- UltraComboEditor bugLocation = new UltraComboEditor();
- UltraComboEditor bugName1 = new UltraComboEditor();
- UltraComboEditor bugName2 = new UltraComboEditor();
- UltraComboEditor bugName3 = new UltraComboEditor();
- UltraComboEditor bugName4 = new UltraComboEditor();
- UltraComboEditor bugName5 = new UltraComboEditor();
- /// <summary>
- /// 加载缺陷
- /// </summary>
- private void InitBaseBug()
- {
- ClsBaseInfo.FillComBaseInfo(bugLocation, "4082", ob, true);
- //YdmBaseClass.InitComboEditor(bugLocation, "com.steering.pss.ydm.Stuffmanage.FrmStuffSurfaceInspection.getBugLocation", "BASECODE", this.ob, true);
- YdmBaseClass.BindColumn(bugLocation, "BugPosName", this.Controls, this.ultraGrid2, 1);
- YdmBaseClass.InitComboEditor(bugName1, "com.steering.pss.ydm.Stuffmanage.FrmStuffSurfaceInspection.getBugName", "BASECODE", this.ob, true);
- YdmBaseClass.BindColumn(bugName1, "BugName1", this.Controls, this.ultraGrid2, 1);
- YdmBaseClass.InitComboEditor(bugName2, "com.steering.pss.ydm.Stuffmanage.FrmStuffSurfaceInspection.getBugName", "BASECODE", this.ob, true);
- YdmBaseClass.BindColumn(bugName2, "BugName2", this.Controls, this.ultraGrid2, 1);
- YdmBaseClass.InitComboEditor(bugName3, "com.steering.pss.ydm.Stuffmanage.FrmStuffSurfaceInspection.getBugName", "BASECODE", this.ob, true);
- YdmBaseClass.BindColumn(bugName3, "BugName3", this.Controls, this.ultraGrid2, 1);
- YdmBaseClass.InitComboEditor(bugName4, "com.steering.pss.ydm.Stuffmanage.FrmStuffSurfaceInspection.getBugName", "BASECODE", this.ob, true);
- YdmBaseClass.BindColumn(bugName4, "BugName4", this.Controls, this.ultraGrid2, 1);
- YdmBaseClass.InitComboEditor(bugName5, "com.steering.pss.ydm.Stuffmanage.FrmStuffSurfaceInspection.getBugName", "BASECODE", this.ob, true);
- YdmBaseClass.BindColumn(bugName5, "BugName5", this.Controls, this.ultraGrid2, 1);
- }
- /// <summary>
- /// 重写基类方法
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="ToolbarKey"></param>
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- doQueryData();
- break;
- case"QuerySurFace":
- doQuerySurFace();
- break;
- case"Ensure":
- EnsureData();
- break;
- case "Close":
- this.Close();
- break;
- }
- }
- /// <summary>
- /// 查询检验结果
- /// </summary>
- private void doQuerySurFace()
- {
- string regStartTim = "";
- string regEndTim = "";
- string heatNo = "";
- if (this.chkRegTime.Checked)
- {
- regStartTim = RegStartTime.Value.ToString();
- regEndTim = RegEndTime.Value.ToString();
- }
- if (this.chkFurnace.Checked)
- {
- heatNo = this.txtFurnace.Text.Trim();
- }
- ArrayList parm = new ArrayList();
- parm.Add(heatNo);
- List<StlLgSurfaceMEntity> listSource = EntityHelper.GetData<StlLgSurfaceMEntity>(
- "com.steering.pss.ydm.Stuffmanage.FrmStuffSurfaceInspection.doQuerySurFace", new object[] { parm, regStartTim, regEndTim }, this.ob);
-
-
- List<QcmLgSurfaceCEntity> listSource2 = EntityHelper.GetData<QcmLgSurfaceCEntity>(
- "com.steering.pss.ydm.Stuffmanage.FrmStuffSurfaceInspection.doQuerySurFaceC", new object[] {regStartTim, regEndTim }, this.ob);
- EntityHelper.AddEntityRelation(listSource, listSource2, "bugNo","bugNo");
- QcmLgSurfaceMEntitybindingSource.DataSource = listSource;
- }
- /// <summary>
- /// 查询收料信息
- /// </summary>
- private void doQueryData()
- {
- string regStartTim = "";
- string regEndTim = "";
- string heatNo = "";
- string[] L1 = new string[] { "GroudNo", "JudgeStoveNo", "FaceResultCode" };
- string[] L2 = new string[] { "GroudNo", "JudgeStoveNo", "FaceResultCode" };
- if (this.chkRegTime.Checked)
- {
- regStartTim = RegStartTime.Value.ToString();
- regEndTim = RegEndTime.Value.ToString();
- }
- if (this.chkFurnace.Checked)
- {
- heatNo = this.txtFurnace.Text.Trim();
- }
- ArrayList parm = new ArrayList();
- parm.Add(heatNo);
- List<MatGpMEntity1> listSource = EntityHelper.GetData<MatGpMEntity1>(
- "com.steering.pss.ydm.Stuffmanage.FrmStuffSurfaceInspection.doQueryMat", new object[] { parm, regStartTim, regEndTim }, this.ob);
-
- List<QcmLgSurfaceCEntity> listSource2 = EntityHelper.GetData<QcmLgSurfaceCEntity>(
- "com.steering.pss.ydm.Stuffmanage.FrmStuffSurfaceInspection.doQueryMatC", new object[] { parm, regStartTim, regEndTim }, this.ob);
- EntityHelper.AddEntityRelation(listSource, listSource2, L1, L2);
- MatGpMEntity1bindingSource.DataSource = listSource;
- this.chkAll.Checked = false;
- }
- /// <summary>
- /// 确认缺陷
- /// </summary>
- private void EnsureData()
- {
- this.ultraGrid2.UpdateData();
- int m = 0;
- QcmLgSurfaceCEntity qcmEntity = null;
- QcmLgSurfaceCEntity _qcmEntity = null;
- string qcmTity = "";
- string _qcmTity = "";
- IQueryable<UltraGridRow> checkMagRows = this.ultraGrid2.Rows.AsQueryable().Where(" CHK = 'True'");
- if (checkMagRows.Count() == 0)
- {
- MessageUtil.ShowTips("请选择需要确认缺陷的主信息!");
- return;
- }
- ArrayList parm = new ArrayList();
- ArrayList list = new ArrayList();
- ArrayList list1 = new ArrayList();
- foreach (UltraGridRow uRow in checkMagRows)
- {
- if (!((int.Parse(uRow.Cells["QualifiedCount"].Text) + int.Parse(uRow.Cells["NoQualifiedCount"].Text)).ToString()).Equals(uRow.Cells["ActCount"].Text))
- {
- MessageUtil.ShowTips("输入的合格支数/不合格支数有误,请重新输入!");
- return;
- }
- MatGpMEntity1 matGpEntity = (MatGpMEntity1)uRow.ListObject;
- string matTity = JSONFormat.Format(matGpEntity);
- parm.Add(matTity);
- foreach (UltraGridRow row in uRow.ChildBands[0].Rows)
- {
- if (row.Cells["CHK"].Value.ToString() == "True")
- {
- if (row.Cells["CheckDimater"].Text.ToString() != "")
- {
- if (!StringUtil.IsInt(row.Cells["CheckDimater"].Value.ToString()))
- {
- MessageUtil.ShowTips("输入的检验规格需为整数!");
- return;
- }
- }
- if (row.Cells["CheckLen"].Text.ToString() != "")
- {
- if (!StringUtil.IsInt(row.Cells["CheckLen"].Value.ToString()))
- {
- MessageUtil.ShowTips("输入的检验长度需为整数!");
- return;
- }
- }
- if (row.Cells["BugPosName"].Value.ToString() == "" && row.Cells["BugName1"].Value.ToString() == "" && row.Cells["BugName2"].Value.ToString() == "" && row.Cells["BugName3"].Value.ToString()=="" && row.Cells["BugName4"].Value.ToString() == "" && row.Cells["BugName5"].Value.ToString() == "")
- {
- m = m + 1;
- }
- if (row.Cells["BugPosName"].Value.ToString() != "" || row.Cells["BugName1"].Value.ToString() != "" && row.Cells["BugName2"].Value.ToString() != "" && row.Cells["BugName3"].Value.ToString() != "" && row.Cells["BugName4"].Value.ToString() != "" && row.Cells["BugName5"].Value.ToString() != "")
- {
- qcmEntity = EntityHelper.CopyEntity<QcmLgSurfaceCEntity>(row.ListObject);
- qcmEntity.BugCode1 = row.Cells["BugName1"].Value.ToString();
- qcmEntity.BugCode2 = row.Cells["BugName2"].Value.ToString();
- qcmEntity.BugCode3 = row.Cells["BugName3"].Value.ToString();
- qcmEntity.BugCode4 = row.Cells["BugName4"].Value.ToString();
- qcmEntity.BugCode5 = row.Cells["BugName5"].Value.ToString();
- qcmEntity.BugPosCode = row.Cells["BugPosName"].Value.ToString();
- qcmTity = JSONFormat.Format(qcmEntity);
- list.Add(qcmTity);
- }
- else
- {
- _qcmEntity = (QcmLgSurfaceCEntity)row.ListObject;
- _qcmTity = JSONFormat.Format(_qcmEntity);
- list1.Add(_qcmTity);
- }
- }
- }
- if (!m.ToString().Equals(uRow.Cells["QualifiedCount"].Text))
- {
- MessageUtil.ShowTips("输入合格支数与登记合格支数不相符,请确认数据的正确性!");
- return;
- }
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否确认缺陷?") == DialogResult.No)
- {
- return;
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.ydm.Stuffmanage.FrmStuffSurfaceInspection";
- ccp.MethodName = "ensureBug";
- ccp.ServerParams = new object[] {parm,list,list1,this.UserInfo.GetUserName(),"C009"};
- ccp = ob.ExecuteNonQuery(ccp,CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("确认检验结果成功!"))
- {
- doQueryData();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- private void chkFurnace_CheckedChanged(object sender, EventArgs e)
- {
- this.txtFurnace.Enabled = this.chkFurnace.Checked;
- }
- private void ultraGrid2_CellChange(object sender, CellEventArgs e)
- {
- if (e.Cell.Row.HasParent())
- {
- this.ultraGrid2.UpdateData();
- if (e.Cell.Column.Key.Equals("CHK"))
- {
- if (e.Cell.Row.Cells["CHK"].Value.ToString() == "True")
- {
- e.Cell.Row.ParentRow.Cells["Quantity"].Value = (int.Parse(e.Cell.Row.ParentRow.Cells["Quantity"].Value.ToString()) + 1).ToString();//检验支数
- }
- else
- {
- e.Cell.Row.ParentRow.Cells["Quantity"].Value = (int.Parse(e.Cell.Row.ParentRow.Cells["Quantity"].Value.ToString())- 1).ToString();//检验支数
- }
- //if (e.Cell.Row.HasChild())
- //{
- // for (int i = 0; i < e.Cell.Row.ChildBands[0].Rows.Count; i++)
- // {
- // e.Cell.Row.ChildBands[0].Rows[i].Cells["CHK1"].Value = "true";
- // }
- //}
- }
- if (e.Cell.Column.Key.Equals("BugName1"))
- {
- if (e.Cell.Row.Cells["BugName1"].Value.ToString() != "")
- {
- if (e.Cell.Row.Cells["BugName1"].Value.ToString().Equals(e.Cell.Row.Cells["BugName2"].Value.ToString()) || e.Cell.Row.Cells["BugName1"].Value.ToString().Equals(e.Cell.Row.Cells["BugName3"].Value.ToString()) || e.Cell.Row.Cells["BugName1"].Value.ToString().Equals(e.Cell.Row.Cells["BugName4"].Value.ToString()) || e.Cell.Row.Cells["BugName1"].Value.ToString().Equals(e.Cell.Row.Cells["BugName5"].Value.ToString()))
- {
- MessageUtil.ShowTips("此缺陷【" + e.Cell.Row.Cells["BugName1"].Text.ToString() + "】已被选择,不允许重复选择!");
-
- return;
- }
- }
- }
- if (e.Cell.Column.Key.Equals("BugName2"))
- {
- if (e.Cell.Row.Cells["BugName2"].Value.ToString() != "")
- {
- if (e.Cell.Row.Cells["BugName2"].Value.ToString().Equals(e.Cell.Row.Cells["BugName1"].Value.ToString()) || e.Cell.Row.Cells["BugName2"].Value.ToString().Equals(e.Cell.Row.Cells["BugName3"].Value.ToString()) || e.Cell.Row.Cells["BugName2"].Value.ToString().Equals(e.Cell.Row.Cells["BugName4"].Value.ToString()) || e.Cell.Row.Cells["BugName2"].Value.ToString().Equals(e.Cell.Row.Cells["BugName5"].Value.ToString()))
- {
- MessageUtil.ShowTips("此缺陷【" + e.Cell.Row.Cells["BugName2"].Text.ToString() + "】已被选择,不允许重复选择!");
- e.Cell.Row.Cells["BugName2"].Value = "";
- return;
- }
- }
- }
- if (e.Cell.Column.Key.Equals("BugName3"))
- {
- if (e.Cell.Row.Cells["BugName3"].Value.ToString() != "")
- {
- if (e.Cell.Row.Cells["BugName3"].Value.ToString().Equals(e.Cell.Row.Cells["BugName1"].Value.ToString()) || e.Cell.Row.Cells["BugName3"].Value.ToString().Equals(e.Cell.Row.Cells["BugName2"].Value.ToString()) || e.Cell.Row.Cells["BugName3"].Value.ToString().Equals(e.Cell.Row.Cells["BugName4"].Value.ToString()) || e.Cell.Row.Cells["BugName3"].Value.ToString().Equals(e.Cell.Row.Cells["BugName5"].Value.ToString()))
- {
- MessageUtil.ShowTips("此缺陷【" + e.Cell.Row.Cells["BugName3"].Text.ToString() + "】已被选择,不允许重复选择!");
- e.Cell.Row.Cells["BugName3"].Value = "";
- return;
- }
- }
- }
- if (e.Cell.Column.Key.Equals("BugName4"))
- {
- if (e.Cell.Row.Cells["BugName4"].Value.ToString() != "")
- {
- if (e.Cell.Row.Cells["BugName4"].Value.ToString().Equals(e.Cell.Row.Cells["BugName1"].Value.ToString()) || e.Cell.Row.Cells["BugName4"].Value.ToString().Equals(e.Cell.Row.Cells["BugName2"].Value.ToString()) || e.Cell.Row.Cells["BugName4"].Value.ToString().Equals(e.Cell.Row.Cells["BugName3"].Value.ToString()) || e.Cell.Row.Cells["BugName4"].Value.ToString().Equals(e.Cell.Row.Cells["BugName5"].Value.ToString()))
- {
- MessageUtil.ShowTips("此缺陷【" + e.Cell.Row.Cells["BugName4"].Text.ToString() + "】已被选择,不允许重复选择!");
- e.Cell.Row.Cells["BugName4"].Value = "";
- return;
- }
- }
- }
- if (e.Cell.Column.Key.Equals("BugName5"))
- {
- if (e.Cell.Row.Cells["BugName5"].Value.ToString() != "")
- {
- if (e.Cell.Row.Cells["BugName5"].Value.ToString().Equals(e.Cell.Row.Cells["BugName1"].Value.ToString()) || e.Cell.Row.Cells["BugName5"].Value.ToString().Equals(e.Cell.Row.Cells["BugName2"].Value.ToString()) || e.Cell.Row.Cells["BugName5"].Value.ToString().Equals(e.Cell.Row.Cells["BugName3"].Value.ToString()) || e.Cell.Row.Cells["BugName5"].Value.ToString().Equals(e.Cell.Row.Cells["BugName4"].Value.ToString()))
- {
- MessageUtil.ShowTips("此缺陷【" + e.Cell.Row.Cells["BugName5"].Text.ToString() + "】已被选择,不允许重复选择!");
- e.Cell.Row.Cells["BugName5"].Value = "";
- return;
- }
- }
- }
- }
- }
- private void FrmStuffSurfaceInspection_Shown(object sender, EventArgs e)
- {
- if (toolMenu == null) return;
- if (toolMenu.Toolbars[0].Tools.Exists("QuerySurFace"))
- {
- toolMenu.Toolbars[0].Tools["QuerySurFace"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- }
- private void ultraTabControl1_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e)
- {
- if (toolMenu == null) return;
- if (ultraTabControl1.SelectedTab.Key == "0")
- {
- if (toolMenu.Toolbars[0].Tools.Exists("Query"))
- {
- toolMenu.Toolbars[0].Tools["Query"].InstanceProps.Visible = DefaultableBoolean.True;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("Ensure"))
- {
- toolMenu.Toolbars[0].Tools["Ensure"].InstanceProps.Visible = DefaultableBoolean.True;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("QuerySurFace"))
- {
- toolMenu.Toolbars[0].Tools["QuerySurFace"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- this.chkRegTime.Text = "收料时间";
- }
- else
- {
- if (toolMenu.Toolbars[0].Tools.Exists("Query"))
- {
- toolMenu.Toolbars[0].Tools["Query"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("Ensure"))
- {
- toolMenu.Toolbars[0].Tools["Ensure"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("QuerySurFace"))
- {
- toolMenu.Toolbars[0].Tools["QuerySurFace"].InstanceProps.Visible = DefaultableBoolean.True;
- }
- this.chkRegTime.Text = "检验时间";
- }
- }
- private void chkRegTime_CheckedChanged(object sender, EventArgs e)
- {
- this.RegStartTime.Enabled = this.chkRegTime.Checked;
- this.RegEndTime.Enabled = this.chkRegTime.Checked;
- }
- private void chkAll_CheckedChanged(object sender, EventArgs e)
- {
- if (chkAll.Checked)
- {
- foreach (UltraGridRow row in ultraGrid2.Rows)
- {
- if (row.Cells["CHK"].Text == "True")
- {
- foreach (UltraGridRow uRow in row.ChildBands[0].Rows)
- {
- //if (uRow.Cells["CXSTUPP"].Value.ToString().Equals(""))
- //{
- // chkint += 1;
- // if (chkint > 50) return;
- uRow.Cells["CHK"].Value = true;
- row.Cells["Quantity"].Value = (int.Parse(row.Cells["Quantity"].Value.ToString()) + 1).ToString();//检验支数
- //}
- }
- }
- }
- }
- else
- {
- foreach (UltraGridRow row in ultraGrid2.Rows)
- {
- if (row.Cells["CHK"].Text == "True")
- {
- foreach (UltraGridRow uRow in row.ChildBands[0].Rows)
- {
- //if (uRow.Cells["CXSTUPP"].Value.ToString().Equals(""))
- //{
- // chkint += 1;
- // if (chkint > 50) return;
- uRow.Cells["CHK"].Value = false;
- row.Cells["Quantity"].Value = (int.Parse(row.Cells["Quantity"].Value.ToString()) - 1).ToString();//检验支数
- //}
- }
-
- }
- }
- }
- }
- }
- }
|