| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464 |
- using com.steering.mes.mcp.entity;
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.Mcp.Control;
- using CoreFS.CA06;
- using Infragistics.Win;
- 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;
- using Core.StlMes.Client.Mcp.Control.Entity;
- namespace Core.StlMes.Client.Mcp.Mch
- {
- public partial class FrmScrapNumMeasureFail : FrmBase
- {
- private ArrayList list = null;
- private string[] plineCode;
- private string SLGx = "";
- private string SLGxname = "";
- private string resultNo = "";
- public string reslNo = "";
- public string groudno = "";
- public string cutnum = "";
- private string save = "0";
- private string Linenum = "";
- private string PlineName = "";
- private string heartno = "";
- public FrmScrapNumMeasureFail(string heartNo,string slgx, string slgxname, string batchgroudno, string outnumcut, string[] pline_Code, string ResultNo,string linenum,string plineName, OpeBase ob)
- {
- InitializeComponent();
- this.ob = ob;
- plineCode = pline_Code;
- SLGx = slgx;
- SLGxname = slgxname;
- groudno = batchgroudno;
- cutnum = outnumcut;
- resultNo = ResultNo;
- Linenum = linenum;
- PlineName = plineName;
- heartno = heartNo;
- }
- private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
- {
- switch (e.Tool.Key)
- {
- case "Save":
- Save();
- break;
- case "Close":
- CloseFrm();
- break;
- }
- }
- public static ArrayList CrName= null;//超声701302
- public static ArrayList CuName = null;//分切701303
- public static ArrayList TrName = null;//车丝701304
- public static ArrayList TsName = null;//螺纹检验701305
- public static ArrayList CoName = null;//拧接701306
- public static ArrayList DrName = null;//通径701307
- public static ArrayList HyName = null;//水压701308
- public static ArrayList ChName = null;//倒棱701309
- public static ArrayList MeName = null;//测量701310
- public static int CrNum = 0;//超声701302
- public static int CuNum = 0;//分切701303
- public static int TrNum = 0;//车丝701304
- public static int TsNum = 0;//螺纹检验701305
- public static int CoNum = 0;//拧接701306
- public static int DrNum = 0;//通径701307
- public static int HyNum = 0;//水压701308
- public static int ChNum = 0;//倒棱701309
- public static int MeNum = 0;//测量701310
- private void CloseFrm()
- {
- this.DialogResult = System.Windows.Forms.DialogResult.OK;
- this.Close();
- }
- /// <summary>
- /// 录入绝废
- /// </summary>
- private void Save()
- {
- this.ultraGridDetailDes1.UpdateData();
- IQueryable<UltraGridRow> checkAlarmRows = this.ultraGridDetailDes1.Rows.AsQueryable().Where(" CHK = 'True'");
- ArrayList alarmlist = new ArrayList();
- ArrayList scraplist = new ArrayList();
- int num = 0;
- foreach (UltraGridRow urrg in ultraGridDetailDes1.Rows)
- {
- num = num + int.Parse(urrg.Cells["FAIL_NUM"].Value.ToString());
- }
- if (SLGx == "701302")
- {
- CrNum = num;
- }else if(SLGx == "701303")
- {
- CuNum = num;
- }else if(SLGx == "701304")
- {
- TrNum = num;
- }else if(SLGx == "701305")
- {
- TsNum = num;
- }else if(SLGx == "701306")
- {
- CoNum = num;
- }else if(SLGx == "701307")
- {
- DrNum = num;
- }else if (SLGx == "701308")
- {
- HyNum = num;
- }else if(SLGx == "701309")
- {
- ChNum = num;
- }else if(SLGx == "701310")
- {
- MeNum = num;
- }
-
- string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- ArrayList list = new ArrayList();
- list.Add(heartno);
- list.Add(SLGx);
- list.Add(SLGxname);
- list.Add(this.UserInfo.GetUserName());
- list.Add(time);
- list.Add(this.UserInfo.GetUserOrder());
- list.Add(this.UserInfo.GetUserGroup());
- list.Add(num.ToString());
- if (MessageUtil.ShowYesNoAndQuestion("是否录入废品?") == DialogResult.No) return;
- foreach (UltraGridRow uRow in checkAlarmRows)
- {
- ArrayList list1 = new ArrayList();
- if (uRow.Cells["FAIL_DIRECT"].Value.ToString() == "")
- {
- MessageUtil.ShowTips("去向不能为空,请选择!");
- return;
- }
- if (uRow.Cells["FAIL_NUM"].Value.ToString() == "" || uRow.Cells["FAIL_NUM"].Value.ToString() == "0")
- {
- MessageUtil.ShowTips("支数不能为空或者为零支,请输入!");
- return;
- }
- if (!uRow.Cells["FAIL_NUM"].Value.ToString().TryParseInt())
- {
- MessageUtil.ShowTips("支数请输入整数!");
- return;
- }
- //if (Convert.ToInt32(Linenum) <= Convert.ToInt32(uRow.Cells["FAIL_NUM"].Value.ToString()))
- //{
- // MessageUtil.ShowTips("绝废支数不允许大于加工支数!");
- // return;
- //}
- //list1.Add(uRow.Cells["FAIL_TYPE_NAME"].Text.Trim());
- //list1.Add(uRow.Cells["FAIL_NUM"].Value.ToString3());
- //list1.Add(alarmTotalNum.ToString());
- //alarmlist.Add(list1);
- MchBugDEntity resultD = getRowData(uRow);
- resultD.ResultNo = uRow.Cells["FAIL_BILL"].Value.ToString();
- resultD.FailDirect = uRow.Cells["FAIL_DIRECT"].Text.ToString().Trim();
- resultD.FailNum =decimal.Parse(uRow.Cells["FAIL_NUM"].Value.ToString().Trim());
- resultD.FailTypeName = uRow.Cells["FAIL_TYPE_NAME"].Value.ToString().Trim();
- alarmlist.Add(resultD);
- }
- if (SLGx == "701302")
- {
- CrName = alarmlist;
- if (CrName.Count != 0)
- {
- MessageUtil.ShowTips("添加成功!");
- save = "1";
- this.DialogResult = System.Windows.Forms.DialogResult.OK;
- }
- }
- else if (SLGx == "701303")
- {
- CuName = alarmlist;
- if (CuName.Count != 0)
- {
- MessageUtil.ShowTips("添加成功!");
- save = "1";
- ultraGridDetailDes1.UpdateData();
- this.DialogResult = System.Windows.Forms.DialogResult.OK;
- }
- }
- else if (SLGx == "701304")
- {
- TrName = alarmlist;
- if (TrName.Count != 0)
- {
- MessageUtil.ShowTips("添加成功!");
- save = "1";
- this.DialogResult = System.Windows.Forms.DialogResult.OK;
- }
- }
- else if (SLGx == "701305")
- {
- TsName = alarmlist;
- if (TsName.Count != 0)
- {
- MessageUtil.ShowTips("添加成功!");
- save = "1";
- this.DialogResult = System.Windows.Forms.DialogResult.OK;
- }
- }
- else if (SLGx == "701306")
- {
- CoName = alarmlist;
- if (CoName.Count != 0)
- {
- MessageUtil.ShowTips("添加成功!");
- save = "1";
- this.DialogResult = System.Windows.Forms.DialogResult.OK;
- }
- }
- else if (SLGx == "701307")
- {
- DrName = alarmlist;
- if (DrName.Count != 0)
- {
- MessageUtil.ShowTips("添加成功!");
- save = "1";
- this.DialogResult = System.Windows.Forms.DialogResult.OK;
- }
- }
- else if (SLGx == "701308")
- {
- HyName = alarmlist;
- if (HyName.Count != 0)
- {
- MessageUtil.ShowTips("添加成功!");
- save = "1";
- this.DialogResult = System.Windows.Forms.DialogResult.OK;
- }
- }
- else if (SLGx == "701309")
- {
- ChName = alarmlist;
- if (ChName.Count != 0)
- {
- MessageUtil.ShowTips("添加成功!");
- save = "1";
- this.DialogResult = System.Windows.Forms.DialogResult.OK;
- }
- }
- else if (SLGx == "701310")
- {
- MeName = alarmlist;
- if (MeName.Count != 0)
- {
- MessageUtil.ShowTips("添加成功!");
- save = "1";
- this.DialogResult = System.Windows.Forms.DialogResult.OK;
- }
- }
-
- //CoreClientParam ccp = new CoreClientParam();
- //try
- //{
- // this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
- // if (Constant.WaitingForm == null)
- // {
- // Constant.WaitingForm = new WaitingForm();
- // }
- // Constant.WaitingForm.ShowToUser = true;
- // Constant.WaitingForm.Show();
- // Constant.WaitingForm.Update();
- // ccp.ServerName = "com.steering.mes.mcp.Mch.FrmMeasureResult";
- // ccp.MethodName = "FailExpandResult";
- // ccp.ServerParams = new Object[] { alarmlist, result1, list, plineCode, groudno, cutnum, resultNo };
- // ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- // this.Cursor = Cursors.Default;
- // Constant.WaitingForm.ShowToUser = false;
- // Constant.WaitingForm.Close();
- // Constant.WaitingForm = null;
- //}
- //catch (Exception ex)
- //{
- // this.Cursor = Cursors.Default;
- // Constant.WaitingForm.ShowToUser = false;
- // Constant.WaitingForm.Close();
- // Constant.WaitingForm = null;
- //}
- //if (ccp.ReturnCode != -1)
- //{
- // MessageUtil.ShowTips(ccp.ReturnInfo);
- // if (ccp.ReturnInfo.Equals("录入绝废成功!"))
- // {
- // Fname =
- // save = "1";
- // this.DialogResult = System.Windows.Forms.DialogResult.OK;
- // }
- // else
- // {
- // MessageUtil.ShowTips(ccp.ReturnInfo);
- // }
- //}
-
- }
- public static void query(string heatNo)
- {
- CrNum = 0;//超声701302
- CuNum = 0;//分切701303
- TrNum = 0;//车丝701304
- TsNum = 0;//螺纹检验701305
- CoNum = 0;//拧接701306
- DrNum = 0;//通径701307
- HyNum = 0;//水压701308
- ChNum = 0;//倒棱701309
- MeNum = 0;//测量701310
- }
- public MchBugDEntity getRowData(UltraGridRow checkrow)
- {
- MchBugDEntity resultD = new MchBugDEntity();
- resultD.FailDirect = checkrow.Cells["FAIL_DIRECT"].Value.ToString().Trim();
- resultD.FailNum =decimal.Parse(checkrow.Cells["FAIL_NUM"].Value.ToString().Trim());
- resultD.FailTypeName = checkrow.Cells["FAIL_TYPE_NAME"].Value.ToString().Trim();
- return resultD;
- }
- private void ultraGridDetailDes1_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
- {
- UltraGrid ug = (UltraGrid)sender;
- this.ultraGridDetailDes1.UpdateData();
- GridEdite(e.Cell.Row);
- if (e.Cell.Column.Key == "REASON")
- {
- if (e.Cell.Value == "")
- {
- MessageBox.Show("您未选择任何选项,请重新选择", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- int temp = 0;
- for (int i = 0; i < ug.Rows.Count(); i++)
- {
- UltraGridRow ugr = ug.Rows[i];
- if (e.Cell.Value.ToString().Equals(ugr.Cells["REASON"].Value.ToString()))
- {
- temp = temp + 1;
- }
- }
- if (temp > 1)
- {
- MessageBox.Show(e.Cell.Value.ToString() + "选项已被选取,请重新选择", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- e.Cell.Row.Cells["REASON"].Value = "";
- }
- }
- }
- private void ultraGridDetailDes2_CellChange(object sender, CellEventArgs e)
- {
- UltraGrid ug = (UltraGrid)sender;
- if (e.Cell.Column.Key == "REASON")
- {
- if (e.Cell.Value == "")
- {
- MessageBox.Show("您未选择任何选项,请重新选择", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- int temp = 0;
- for (int i = 0; i < ug.Rows.Count(); i++)
- {
- UltraGridRow ugr = ug.Rows[i];
- if (e.Cell.Value.ToString().Equals(ugr.Cells["REASON"].Value.ToString()) && e.Cell.Row.Cells["REASON1"].Value.ToString2().Equals(ugr.Cells["REASON1"].Value.ToString2()))
- {
- temp = temp + 1;
- }
- }
- if (temp > 1)
- {
- MessageBox.Show(e.Cell.Value.ToString() + "选项已被选取,请重新选择", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- e.Cell.Row.Cells["REASON"].Value = "";
- }
- }
- if (e.Cell.Column.Key == "REASON1")
- {
- if (e.Cell.Value == "")
- {
- MessageBox.Show("您未选择任何选项,请重新选择", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- int temp1 = 0;
- for (int i = 0; i < ug.Rows.Count(); i++)
- {
- UltraGridRow ugr = ug.Rows[i];
- if (e.Cell.Value.ToString().Equals(ugr.Cells["REASON1"].Value.ToString()) && e.Cell.Row.Cells["REASON"].Value.ToString2().Equals(ugr.Cells["REASON"].Value.ToString2()))
- {
- temp1 = temp1 + 1;
- }
- }
- if (temp1 > 1)
- {
- MessageBox.Show(e.Cell.Value.ToString() + "选项已被选取,请重新选择", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- e.Cell.Row.Cells["REASON"].Value = "";
- }
- }
- }
- private void FrmScrapNumMeasure_FormClosing(object sender, FormClosingEventArgs e)
- {
- UltraGridRow urg = ultraGridDetailDes1.ActiveRow;
- if (urg != null)
- {
- if (Convert.ToBoolean(urg.Cells["CHK"].Text) == true && urg.Cells["FAIL_DIRECT"].Text != "")
- {
- if (save == "0")
- {
- MessageUtil.ShowTips("请点保存按钮!");
- e.Cancel = true;
- }
- }
- }
- }
- /// <summary>
- ///
- /// ulltragrid控件受勾影响(打钩可编辑,不打勾不能编辑)**
- /// </summary>
- /// <param name="row"></param>
- private void GridEdite(UltraGridRow row)
- {
- if (row.GetValue("CHK") == "True")
- {
- foreach (UltraGridCell cell in row.Cells)
- {
- if (cell.Column.CellActivation == Activation.AllowEdit)
- {
- cell.Activation = Activation.AllowEdit;
- }
- }
- }
- else
- {
- foreach (UltraGridCell cell in row.Cells)
- {
- if (cell.Column.Key.Contains("CHK")) continue;
- if (cell.Column.CellActivation == Activation.AllowEdit)
- {
- cell.Activation = Activation.ActivateOnly;
- }
- }
- }
- ultraGridDetailDes1.UpdateData();
- }
- private void ultraGridDetailDes1_AfterRowInsert(object sender, RowEventArgs e)
- {
- this.ultraGridDetailDes1.UpdateData();
- GridEdite(e.Row);
- }
- }
- }
|