| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392 |
- 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;
- namespace Core.StlMes.Client.Mcp.Mch
- {
- public partial class FrmScrapNumMeasure : FrmBase
- {
- private ArrayList list = null;
- private string plineCode = "";
- private string SLGx = "";
- private string SLGxname = "";
- private string heatPlanNo = "";
- private string resultNo = "";
- public string reslNo = "";
- public string groudno = "";
- public string cutnum = "";
- private string StorageNo = "";
- private string save = "0";
- private string Linenum = "";
- private string PlineName = "";
- MchMeasureResultEntity result1 = new MchMeasureResultEntity();//测量
- public FrmScrapNumMeasure(MchMeasureResultEntity result, string heatNo, string slgx, string slgxname, string batchgroudno, string outnumcut, string storageNo, string pline_Code, string ResultNo,string linenum,string plineName, OpeBase ob)
- {
- InitializeComponent();
- //list = arr;
- this.ob = ob;
- plineCode = pline_Code;
- SLGx = slgx;
- SLGxname = slgxname;
- groudno = batchgroudno;
- cutnum = outnumcut;
- StorageNo = storageNo;
- heatPlanNo = heatNo;
- resultNo = ResultNo;
- result1 = result;
- Linenum = linenum;
- PlineName = plineName;
- }
- /// <summary>
- /// 查询所有合格管序号
- /// </summary>
- //private void QuerySeq(ArrayList list)
- //{
- // DataTable ds = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.doQuerySeq", new object[] { list }, ob);
- // GridHelper.CopyDataToDatatable(ref ds, ref dataTable4, true);
- //}
- public string alamNum = "";
- public string scrapNum = "";
- public string testOfflineNum = "";
- private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
- {
- switch (e.Tool.Key)
- {
- case "Save":
- Save();
- break;
- case "Close":
- CloseFrm();
- break;
- }
- }
- int alarmTotalNum = 0;//可疑总支数
- int scarpTotalNum = 0;//废品总支数
- int offlineTotalNum = 0;//下线总支数
- private void CloseFrm()
- {
- alamNum = alarmTotalNum.ToString();
- scrapNum = scarpTotalNum.ToString();
- testOfflineNum = offlineTotalNum.ToString();
- this.DialogResult = System.Windows.Forms.DialogResult.OK;
- this.Close();
- }
- /// <summary>
- /// 保存离线
- /// </summary>
- private void Save()
- {
- this.ultraGridDetailDes1.UpdateData();
- alarmTotalNum = 0;
- scarpTotalNum = 0;
- offlineTotalNum = 0;
- 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["OFFLINE_NUM"].Value.ToString());
- }
- string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- ArrayList list = new ArrayList();
- list.Add(heatPlanNo);
- 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["GOWHERE_NAME"].Value.ToString() == "")
- {
- MessageUtil.ShowTips("去向不能为空,请选择!");
- return;
- }
- if (uRow.Cells["OFFLINE_NUM"].Value.ToString() == "" || uRow.Cells["OFFLINE_NUM"].Value.ToString() == "0")
- {
- MessageUtil.ShowTips("支数不能为空或者为零支,请输入!");
- return;
- }
- if (!uRow.Cells["OFFLINE_NUM"].Value.ToString().TryParseInt())
- {
- MessageUtil.ShowTips("支数请输入整数!");
- return;
- }
- if (Convert.ToInt32(Linenum) <= Convert.ToInt32(uRow.Cells["OFFLINE_NUM"].Value.ToString()))
- {
- MessageUtil.ShowTips("离线支数不允许大于加工支数!");
- return;
- }
- //alarmTotalNum = alarmTotalNum + int.Parse(uRow.Cells["FAIL_NUM"].Value.ToString3());
- //list1.Add(uRow.Cells["FAIL_TYPE_NAME"].Text.Trim());
- //list1.Add(uRow.Cells["FAIL_NUM"].Value.ToString3());
- //list1.Add(alarmTotalNum.ToString());
- //alarmlist.Add(list1);
- MchOfflineResultDentity resultD = getRowData(uRow);
- resultD.ResultNo = uRow.Cells["FAIL_BILL"].Value.ToString();
- resultD.GowhereName = uRow.Cells["GOWHERE_NAME"].Text.ToString().Trim();
- resultD.OfflineNum = uRow.Cells["OFFLINE_NUM"].Value.ToString().Trim();
- alarmlist.Add(resultD);
- }
- 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 = "offLineExpandResult";
- ccp.ServerParams = new Object[] { alarmlist,result1, list, plineCode, StorageNo, groudno, cutnum };
- 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("离线成功!"))
- {
- save = "1";
- alamNum = alarmTotalNum.ToString();
- scrapNum = scarpTotalNum.ToString();
- this.DialogResult = System.Windows.Forms.DialogResult.OK;
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
-
- }
- public MchOfflineResultDentity getRowData(UltraGridRow checkrow)
- {
- MchOfflineResultDentity resultD = new MchOfflineResultDentity();
- resultD.GowhereName = checkrow.Cells["GOWHERE_NAME"].Value.ToString().Trim();
- resultD.OfflineNum = checkrow.Cells["OFFLINE_NUM"].Value.ToString().Trim();
- return resultD;
- }
- /// <summary>
- /// 查询仓库信息
- /// </summary>
- /// <param name="plineCode"></param>
- /// <returns></returns>
- private DataTable getStoreNo(string plineCode)
- {
- DataTable ds = ServerHelper.GetData("com.steering.mes.signature.FrmInOnlineStore.doQueryStoreNo", new object[] { plineCode }, ob);
- if (ds.Rows.Count > 0)
- {
- return ds;
- }
- else
- {
- return null;
- }
- }
- private void FrmScrap_Load(object sender, EventArgs e)
- {
- doQuery();
- }
-
- /// <summary>
- /// 查询离线去向
- /// </summary>
- public void doQuery()
- {
- dataTable1.Clear();
- dataTable2.Clear();
- dataTable3.Clear();
- ////下拉选离线去向
- //DataTable dt2 = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmCrackDetectResult.getQuerydirect", new object[] { "G", "002001006" }, this.ob);
- ////comm.FilComboboxAdd(standard, dt2, "BASECODE", "BASENAME", "validflag NOT in ('0')", false, "全部", "");
- //kreason.DataSource = dt2;
- //kreason.DisplayMember = "PLINE_NAME";
- //kreason.ValueMember = "PLINE_CODE";
- //YdmBaseClass.SetComboItemHeight(kreason);
- //下拉选离线去向
- DataTable dt2 = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmCrackDetectResult.getQuerydirectOffline", new object[] { plineCode }, this.ob);
- //comm.FilComboboxAdd(standard, dt2, "BASECODE", "BASENAME", "validflag NOT in ('0')", false, "全部", "");
- kreason.DataSource = dt2;
- kreason.DisplayMember = "PLINE_NAME";
- kreason.ValueMember = "PLINE_CODE";
- YdmBaseClass.SetComboItemHeight(kreason);
- foreach (UltraGridRow urg in ultraGridDetailDes1.Rows)
- {
- GridEdite(urg);
- }
- }
- 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["GOWHERE_NAME"].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);
- }
- }
- }
|