| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369 |
- 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 Core.Mes.Client.Comm.Format;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.Mcp.Control;
- using Core.StlMes.Client.Mcp.Control.Common;
- using Core.StlMes.Client.Mcp.Control.Entity;
- using Core.StlMes.Client.Mcp.Control.Machining;
- using CoreFS.CA06;
- using Infragistics.Win;
- using Infragistics.Win.UltraWinGrid;
- namespace Core.StlMes.Client.Mcp.Mch
- {
- public partial class FrmFinalTreatmentG : FrmBase
- {
- private string[] plineCodes;
- private string _plineCode;
- protected List<HttSignatureEntity> Names = new List<HttSignatureEntity>();
- public FrmFinalTreatmentG()
- {
- InitializeComponent();
- }
- protected override void OnLoad(EventArgs e)
- {
- base.OnLoad(e);
- EntityHelper.ShowGridCaption<MchFinalCheckTreatmentEntity>(ultraGrid1.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<MchFinalCheckGTotal>(ultraGrid2.DisplayLayout.Bands[0]);
- commHelper.RefreshAndAutoSize(ultraGrid1);
- ultraGrid1.DisplayLayout.Bands[0].Override.HeaderClickAction = HeaderClickAction.Select;
- if (ob == null) return;
- plineCodes = comm.GetPlineCode(ValidDataPurviewIds, "G", this.CustomInfo, ob);
- //comm.InitDroCheckStation("G", uceFactory, ValidDataPurviewIds, ob);
- ultraGrid2.DisplayLayout.Override.AllowRowFiltering = DefaultableBoolean.False;
- ultraGrid2.DisplayLayout.Override.HeaderClickAction = HeaderClickAction.Default;
- if ((plineCodes.Length > 1) &&
- ((plineCodes[1] == "C038") || (plineCodes[1] == "C039") || (plineCodes[1] == "C049") ||
- (plineCodes[1] == "C050") ||
- (plineCodes[1] == "C051") || (plineCodes[1] == "C057")))
- {
- RegStartTime.Value = DateTime.Parse(DateTime.Now.AddMonths(-1).ToString("yyyy-MM-dd 20:00"));
- RegEndTime.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 19:59"));
- }
- else
- {
- RegStartTime.Value = DateTime.Parse(DateTime.Now.AddMonths(-1).ToString("yyyy-MM-dd 21:00"));
- RegEndTime.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 20:59"));
- }
- cmbOrder.Text = this.UserInfo.GetUserOrder();
- cmbGroup.Text = this.UserInfo.GetUserGroup();
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "DoQuery":
- Query();
- break;
- case "DoAdd":
- DoAdd();
- break;
- case "DoDelete":
- DoDelete();
- break;
- case "Print":
- Print();
- break;
- case "DoClose":
- Close();
- break;
- }
- }
-
- private void Query()
- {
- var starts = "";
- var No = "";
- var judgeStoveNo = "";
- string[] plines = plineCodes;
- string startTim = "";
- string endTim = "";
- if (chkTim.Checked)
- {
- startTim = RegStartTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
- endTim = RegEndTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
- }
- mchFinalCheckResultDEntityBindingSource.Clear();
- mchFinalCheckTreatmentEntityBindingSource.DataSource = EntityHelper.GetData<MchFinalCheckTreatmentEntity>(
- "com.steering.mes.mcp.Mch.FrmFinalCheck.QuerTreatment",
- new object[] {startTim,endTim, chbNo.Checked ? txtNo.Text : "",chkJudgeStove.Checked ? txtJudgeStove.Text : "",
- plines, ultraOptionSet2.Value.ToString2(), "" },
- ob);
-
- commHelper.RefreshAndAutoSizeExceptColumns(ultraGrid1, new string[] { });
- }
- private void DoDelete()
- {
- if (ultraGrid1.ActiveRow == null) return;
- MchFinalCheckTreatmentEntity Entity = ultraGrid1.ActiveRow.ListObject as MchFinalCheckTreatmentEntity;
- if (Entity == null) return;
- /* if (txtInfo.Text.Trim() == "")
- {
- MessageBox.Show("请输入反馈信息");
- return;
- }*/
- if (MessageUtil.ShowYesNoAndQuestion("是否确认撤销反馈?") == DialogResult.No)
- return;
- var ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.mcp.Mch.FrmFinalCheck";
- ccp.MethodName = "DoCancelReply";
- ccp.ServerParams = new object[]
- {
- Entity.TreatmentNo,
- this.UserInfo.GetUserName()
- };
- ccp = ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("撤销反馈成功!"))
- {
- Query();
- }
- }
- }
- private void DoAdd()
- {
- ultraGrid2.UpdateData();
- if (ultraGrid1.ActiveRow == null) return;
-
- MchFinalCheckTreatmentEntity Entity = ultraGrid1.ActiveRow.ListObject as MchFinalCheckTreatmentEntity;
- List<MchFinalCheckGTotal> AllData =
- mchFinalCheckResultDEntityBindingSource.DataSource as List<MchFinalCheckGTotal>;
- if (Entity == null) return;
- if (!AllData.Any())
- {
- MessageBox.Show("数据异常,无不合管号");
- return;
- }
- var Data = AllData.Where(p => p.Check).ToList();
- if (!Data.Any())
- {
- MessageBox.Show("请勾选需要反馈的管号!");
- return;
- }
-
- if (txtInfo.Text.Trim() == "")
- {
- MessageBox.Show("请输入反馈信息");
- return;
- }
- bool NeedSplit = AllData.Count > Data.Count;
- if (NeedSplit)
- {
- if (MessageUtil.ShowYesNoAndQuestion("请确认只反馈" + Data.Count + "支管? 系统将拆分当前处置单,当前反馈的管并入新的处置单中") == DialogResult.No)
- return;
- }
- else
- {
- if (MessageUtil.ShowYesNoAndQuestion("是否确认反馈?") == DialogResult.No)
- return;
- }
- List<MchBugDEntity> ScrappedList =
- Data.Where(p =>p.Station!="2" && p.ReplayStation == "2").SelectMany(p => p.ScrapList).ToList();
- string failNum =ScrappedList==null || !ScrappedList.Any()?"0": ScrappedList.Sum(p => p.FailNum).ToString3();
- string failWt = ScrappedList == null || !ScrappedList.Any() ? "0" : ScrappedList.Sum(p => p.FailWt).ToString3();
- var ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.mcp.Mch.FrmFinalCheck";
- ccp.MethodName = "DoReply";
- ccp.ServerParams = new object[]
- {
- Entity.TreatmentNo,
- name.Text,
- txtInfo.Text,
- this.UserInfo.GetDeptid(),
- this.UserInfo.GetDepartment(),
- failNum,
- failWt,
- Data.Select(JSONFormat.Format).ToList(),
- ScrappedList.Select(JSONFormat.Format).ToList(),
- NeedSplit,
- cmbOrder.Value.ToString2(),
- cmbGroup.Value.ToString2()
- };
- ccp = ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("反馈成功!"))
- {
- Query();
- }
- }
- }
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
- if(ultraGrid1.ActiveRow==null) return;
- MchFinalCheckTreatmentEntity Entity = ultraGrid1.ActiveRow.ListObject as MchFinalCheckTreatmentEntity;
- if(Entity==null) return;
- var data = EntityHelper.GetData<MchFinalCheckGTotal>(
- "com.steering.mes.mcp.Mch.FrmFinalCheck.getQueryUnPassDetail",
- new object[] { Entity.ResultNo, Entity.TreatmentNo },
- ob);
- data.ForEach(p => p.Check = true);
- mchFinalCheckResultDEntityBindingSource.DataSource = data;
- commHelper.RefreshAndAutoSizeExceptColumns(ultraGrid2, new string[] { });
- ultraGrid2.DisplayLayout.Bands[0].Columns["Check"].SetHeaderCheckedState(ultraGrid2.Rows, true);
-
- if (_plineCode != Entity.PlineCode)
- {
- Names = EntityHelper.GetData<HttSignatureEntity>(
- "com.steering.mes.mcp.heatTreatment.FrmHttCrackDetectResult.getHttSign",
- new object[] {Entity.PlineCode, "10"}, ob);
- name.DisplayMember = "UserName";
- name.ValueMember = "UserName";
- YdmBaseClass.SetComboItemHeight(name);
- _plineCode = Entity.PlineCode;
- name.DataSource = Names;
- }
- name.Text = this.UserInfo.GetUserName();
- txtInfo.Text = "";
- }
-
- protected void Print()
- {
- if (ultraGrid1.ActiveRow == null) return;
- MchFinalCheckTreatmentEntity MchFinalCheckTreatmentEntity = ultraGrid1.ActiveRow.ListObject as MchFinalCheckTreatmentEntity;
- string strurl = "";
- strurl =
- "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMchNoticeOfQualityDisposal.cpt&__embed__=true" +
- "&TREATMENT_NO=" + MchFinalCheckTreatmentEntity.TreatmentNo;
- FrmRepExcel fBug = new FrmRepExcel(ob, strurl);
- fBug.AutoSize = true;
- fBug.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
- fBug.WindowState = FormWindowState.Maximized;
- fBug.Text = "处置单";
- fBug.Show();
- }
- private void uteUnpass_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
- {
- if (ultraGrid1.ActiveRow == null) return;
- MchFinalCheckTreatmentEntity TreatEntity = ultraGrid1.ActiveRow.ListObject as MchFinalCheckTreatmentEntity;
- MchFinalCheckGTotal entity = ultraGrid2.ActiveRow.ListObject as MchFinalCheckGTotal;
- if (entity.Station == "2")
- {
- MessageBox.Show("已经被质检站判废,无法再录入原因");
- return;
- }
- var matfrm = new ReasonChooseNew(ob, "7036", true,entity.ScrapList );
- matfrm.ShowDialog();
- if (matfrm.DialogResult == DialogResult.OK)
- {
- entity.ScrapList = matfrm.FailData;
- entity.ScrapCode = entity.ScrapList == null || !entity.ScrapList.Any()
- ? ""
- : entity.ScrapList.Select(p => p.FailTypeCode).Aggregate((a, b) => (string.IsNullOrWhiteSpace(a) ? "" : (a + ",")) + b);
- entity.ScrapName = entity.ScrapList == null || !entity.ScrapList.Any()
- ? ""
- : entity.ScrapList.Select(p => p.FailTypeName).Aggregate((a, b) => (string.IsNullOrWhiteSpace(a) ? "" : (a + ",")) + b);
- entity.ScrapList.ForEach(p =>
- {
- p.MatNo = entity.MatNo;
- p.FailNum = 1;
- p.FailWt = TreatEntity.UnqualifiedWt;
- p.BatchNo = TreatEntity.BatchNo;
- p.HeatPlanNo = TreatEntity.HeatPlanNo;
- });
-
-
- entity.ReplayStation = entity.ScrapList!=null && entity.ScrapList.Any() ? "2" : "0";
- if (entity.ReplayStation == "1" || entity.ReplayStation == "2")
- {
- ultraGrid2.ActiveCell.Row.Cells["ReplayStation"].Appearance.BackColor = Color.Red;
- }
- else
- {
- ultraGrid2.ActiveCell.Row.Cells["ReplayStation"].Appearance.ResetBackColor();
- }
- ultraGrid2.PerformAction(UltraGridAction.ExitEditMode);
- mchFinalCheckResultDEntityBindingSource.ResetBindings(false);
- ultraGrid2.UpdateData();
- }
- }
- }
- }
|