| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961 |
- 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.Mcp.Control;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using Infragistics.Win.UltraWinGrid;
- using Core.Mes.Client.Comm.Control;
- using System.Collections;
- using com.steering.mes.mcp.entity;
- using Core.StlMes.Client.Mcp.Mch.MchResult;
- namespace Core.StlMes.Client.Mcp.Mch
- {
- public partial class FrmDetectResult : FrmBase
- {
- private string dingwei = "";
- private string SlGx = "";//湿磁粉探伤工序
- private string SlGxname = "";
- private string plineCode = "";
- private string[] plineCodes;
- private string departm = "";
- private string storageNo = "";//仓库
- public static string REsultno = "";
- private string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- public FrmDetectResult()
- {
- InitializeComponent();
- this.IsLoadUserView = true;
- }
- private void FrmDetectResult_Load(object sender, EventArgs e)
- {
- //cmbDate.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 00:00:00"));
- //cmbEndDate.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 23:59:59"));
- departm = UserInfo.GetDepartment();
- //plineCode = YdmBaseClass.GetPCode(departm, this.ob);//获取 用户 对应的产线
- plineCodes = comm.GetPlineCode(this.ValidDataPurviewIds,"G",this.CustomInfo,ob);
- //获取工序
- DataTable dt2 = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryGX", new object[] { "701302" }, this.ob);
- if (dt2.Rows.Count > 0)
- {
- SlGx = dt2.Rows[0]["BASECODE"].ToString();
- SlGxname = dt2.Rows[0]["BASENAME"].ToString();
- }
-
- frmDetectResultControl1.Ob = this.ob;
- frmDetectResultControl1.init();
- frmDetectResultControl1.init1();
- frmDetectResultControl1.type();
- frmDetectResultControl1.species();
- //查询仓库代码
- DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getStorageDep", new object[] { this.UserInfo.GetDeptid(), Core.Mes.Client.Comm.Server.ClsBaseInfo.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob), "800202", "800304" }, this.ob);
- if (dt.Rows.Count > 0)
- {
- storageNo = dt.Rows[0]["STORAGE_NO"].ToString();
- }
- QuerySinglePlan();
- initControl();
-
- }
- protected override void OnLoad(EventArgs e)
- {
- base.OnLoad(e);
- this.frmDetectResultControl1.Grid.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- //base.ToolBar_Click(sender, ToolbarKey);
- switch (ToolbarKey)
- {
- case "DoQuery":
- QuerySinglePlan();
- break;
- case "DoSave":
- DoSave();
- break;
- case "DoReturn":
- DoReturn();
- break;
- case "DoUpdate":
- DoUpdate();
- break;
- case "DoBeside":
- DoBeside();
- break;
- case "CelBeside":
- DoCelBeside();
- break;
- case "doBesideQuery":
- DoBesideQuery();
- break;
- case "doQueryOffice":
- DoQueryOffice();
- break;
- case "doPrint":
- DoTransferPrint();
- break;
- case "doInsert":
- DoInsert();//绝废录入
- break;
- case "DoClose":
- this.Close();
- break;
- }
- }
- ///
- /// 绝废录入
- /// <summary>
- private void DoInsert()
- {
- UltraGridRow row = ultraGrid1.ActiveRow;
- if (row == null) return;
- string batchgroudno = row.Cells["BATCH_GROUD_NO"].Text.ToString();
- string outnumcut = row.Cells["OUTNUM_CUT"].Text.ToString();
- string linenum = row.Cells["num"].Text.ToString();
- string plineName = row.Cells["PLINE_NAME"].Text.ToString();
- string synum = row.Cells["snum"].Text.ToString();
- string heartNo = row.Cells["HEAT_PLAN_NO"].Text.ToString();
- DataTable dt1 = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmDetectResult.getQueryExpandResultStuts", new object[] { row.Cells["HEAT_PLAN_NO"].Text.ToString(), row.Cells["PLINE_CODE"].Text.ToString() }, this.ob);
- if (dt1.Rows.Count > 0)
- {
- if (dt1.Rows[0]["STATION_STATUS"].ToString() == "2")
- {
- MessageUtil.ShowTips("该工序已经结炉,不允许录入绝废支数!");
- return;
- }
- }
- FrmScrapNumMeasureFail matfrm = new FrmScrapNumMeasureFail(heartNo, SlGx, SlGxname, batchgroudno, outnumcut, plineCodes, REsultno, linenum, plineName, this.ob);
- matfrm.ShowDialog();
- this.ultraGrid1.UpdateData();
- dingwei = row.Cells["HEAT_PLAN_NO"].Value.ToString();
- QuerySinglePlan();
- }
- /// <summary>
- ///传递卡打印
- /// </summary>
- private void DoTransferPrint()
- {
- this.ultraGrid1.UpdateData();
- string jugeNo = "";
- string batchNo = "";
- string groupNo = "";
- string plinCode = "";
- string heatNo = "";
- //int count = 0;
- //ArrayList list = new ArrayList();
- //foreach (UltraGridRow uRow in ultraGrid1.Rows)
- //{
- // if (Convert.ToBoolean(uRow.Cells["CHK"].Text.ToString()) == true)
- // {
- // count += 1;
- UltraGridRow uRow = ultraGrid1.ActiveRow;
- if (uRow == null)
- {
- MessageUtil.ShowTips("请选择要打印的炉信息!");
- return;
- }
- else
- {
- heatNo = uRow.Cells["HEAT_PLAN_NO"].Text.ToString(); //炉计划ID
- jugeNo = uRow.Cells["JUDGE_STOVE_NO"].Value.ToString(); //炉号
- batchNo = uRow.Cells["BATCH_NO"].Value.ToString(); //批号
- groupNo = uRow.Cells["BATCH_GROUD_NO"].Value.ToString(); //组号
- plinCode = uRow.Cells["PLINE_CODE"].Value.ToString(); //产线
- }
- // list.Add(jugeNo);
- // }
- // }
- //if (count == 0)
- //{
- // MessageUtil.ShowTips("请选择需要打印的炉信息!");
- // return;
- //}
- //string str = string.Join("','", (string[])list.ToArray(typeof(string)));
- string strurl = "";
- if (plinCode.Equals("C021"))//镦粗
- {
- strurl = "http://localhost:8075/webroot/decision/view/report?viewlet=MchDeliveryCard.cpt&heatNo=" + heatNo + "&judgeNo=" + jugeNo + "&plineCode=" + plinCode + "&groupNo=" + groupNo + "&batchNo=" + batchNo + "&abc=湿磁粉探伤";
- //strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=MchDeliveryCard.cpt&T.HEAT_PLAN_NO=" + heatNo + "&T.JUDGE_STOVE_NO=" + jugeNo + "&T.PLINE_CODE=" + plinCode + "&T2.BATCH_GROUD_NO=" + batchNo + "&TT.STATION_DESC='上料'" ;
- }
- else
- {
- strurl = "http://localhost:8075/webroot/decision/view/report?viewlet=MchDeliveryCard.cpt&heatNo=" + heatNo + "&judgeNo=" + jugeNo + "&plineCode=" + plinCode + "&groupNo=" + groupNo + "&batchNo=" + batchNo + "&abc=湿磁粉探伤";
- //strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=MchDeliveryCard.cpt&T.HEAT_PLAN_NO=" + heatNo + "&T.JUDGE_STOVE_NO=" + jugeNo + "&T.PLINE_CODE" + plinCode + "&T2.BATCH_GROUD_NO=" + batchNo + "&TT.STATION_DESC='上料'";
- }
- FrmRepExcel fre = new FrmRepExcel(this.ob, strurl);
- fre.AutoSize = true;
- fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
- fre.WindowState = FormWindowState.Maximized;
- fre.Show();
- }
- private void DoQueryOffice()
- {
- string heatno = "";
- string plinename = "";
- UltraGridRow urg = ultraGrid1.ActiveRow;
- if (urg != null)
- {
- heatno = urg.Cells["HEAT_PLAN_NO"].Value.ToString();
- plinename = urg.Cells["PLINE_NAME"].Text.ToString();
- }
- FrmOfficeDirect matfrm = new FrmOfficeDirect(this.ob, urg, SlGxname);
- matfrm.ShowDialog();
- }
- private void DoBesideQuery()
- {
- //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmCrackDetectResult.getMchBugD", new object[] { txtZyBatchId.Text.ToString(), txtRollBatchId.Text.ToString(), plineCode, start }, this.ob);
- //GridHelper.CopyDataToDatatable(ref dt, ref dataTable2, true);
- string heatno = "";
- string lotno = "";
- string plinename = "";
- UltraGridRow urg = ultraGrid1.ActiveRow;
- if (urg != null)
- {
- heatno = urg.Cells["HEAT_PLAN_NO"].Value.ToString();
- lotno = urg.Cells["BATCH_NO"].Value.ToString();
- plinename = urg.Cells["PLINE_NAME"].Text.ToString();
- }
- FrmReason matfrm = new FrmReason(this.ob, urg, SlGxname);
- matfrm.ShowDialog();
- }
- private void DoCelBeside()
- {
- UltraGridRow row = ultraGrid2.ActiveRow;
- if (row == null) return;
- ArrayList list = new ArrayList();
- list.Add(row.Cells["HEAT_PLAN_NO"].Value.ToString());
- list.Add(row.Cells["PLINE_CODE"].Value.ToString());
- list.Add(SlGx);
- if (MessageUtil.ShowYesNoAndQuestion("是否撤销结炉?") == DialogResult.No)
- {
- return;
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.mcp.Mch.FrmDetectResult";
- ccp.MethodName = "undoBeside";
- ccp.ServerParams = new Object[] { list };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("撤销结炉成功!"))
- {
- dingwei = row.Cells["HEAT_PLAN_NO"].Value.ToString();
- QuerySinglePlan();
- initControl();
- }
- }
- }
- /// <summary>
- /// 工序结炉
- /// </summary>
- private void DoBeside()
- {
- UltraGridRow row = ultraGrid2.ActiveRow;
- if (row == null)
- {
- MessageUtil.ShowTips("请选择需要结炉的工单号!");
- return;
- }
- ArrayList list = new ArrayList();
- list.Add(row.Cells["HEAT_PLAN_NO"].Value.ToString());
- list.Add(row.Cells["PLINE_CODE"].Value.ToString());
- list.Add(SlGx);
- if (MessageUtil.ShowYesNoAndQuestion("是否结炉?") == DialogResult.No)
- {
- return;
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.mcp.Mch.FrmDetectResult";
- ccp.MethodName = "updateDoBeside";
- ccp.ServerParams = new Object[] { list };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("结炉成功!"))
- {
- dingwei = row.Cells["HEAT_PLAN_NO"].Value.ToString();
- QuerySinglePlan();
- initControl();
- }
- }
- }
- /// <summary>
- /// 简单查询
- /// </summary>
- private void QuerySinglePlan()
- {
- string starts = "";
- string plnNo = "";
- string judgeStoveNo = "";
- string index = "";
- string dobeside = "";
- #region 条件
- if (chkPlnNo.Checked)
- {
- if (string.IsNullOrEmpty(txtRollBatchId.Text.Trim()))
- {
- MessageUtil.ShowTips("请输入炉次计划号!");
- return;
- }
- else
- {
- plnNo = txtRollBatchId.Text.ToString().Trim();
- }
- }
- if (chkJuNo.Checked)
- {
- if (string.IsNullOrEmpty(txtZyBatchId.Text.Trim()))
- {
- MessageUtil.ShowTips("请输入炉号!");
- return;
- }
- else
- {
- judgeStoveNo = txtZyBatchId.Text.ToString().Trim();
- }
- }
- #endregion
- //string[] start = contorlPlanStatus1.statusArr;
- if (ultraOptionSet1.CheckedIndex.ToString() == "0")
- {
- index = "0";
- dobeside = this.ultraOptionSet1.CheckedItem.DataValue.ToString();
- }
- else
- {
- index = "1";
- dobeside = this.ultraOptionSet1.CheckedItem.DataValue.ToString();
- }
- DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getSingleJGPlan", new object[] { judgeStoveNo, plnNo, plineCodes, dobeside, index }, this.ob);
- GridHelper.CopyDataToDatatable(ref dt, ref dataTable2, true);
- GridHelper.RefreshAndAutoSize(this.ultraGrid1);
- foreach (UltraGridRow urg in ultraGrid1.Rows)
- {
- if (urg.Cells["PLANSTATUS"].Text.Equals("生产中"))
- {
- urg.Cells["PLANSTATUS"].Appearance.BackColor = Color.LightGreen;
- }
- if (urg.Cells["PLANSTATUS"].Text.Equals("生产完成"))
- {
- urg.Cells["PLANSTATUS"].Appearance.BackColor = Color.Red;
- }
- if (urg.Cells["PLANSTATUS"].Text.Equals("关闭"))
- {
- urg.Cells["PLANSTATUS"].Appearance.BackColor = Color.Red;
- }
- if (urg.Cells["BESIDE_STATUS"].Text.Equals("湿磁粉探伤结束"))
- {
- urg.Cells["BESIDE_STATUS"].Appearance.BackColor = Color.LightGray;
- }
- }
- foreach (UltraGridRow urg in ultraGrid1.Rows)
- {
- if (urg != null)
- {
- urg.Cells["snum"].Appearance.BackColor = Color.OrangeRed;
- }
- }
- if (dt.Rows.Count > 0)
- {
- for (int i = 0; i < ultraGrid1.Rows.Count; i++)
- {
- if (ultraGrid1.Rows[i].Cells["HEAT_PLAN_NO"].Value.ToString() == dingwei)
- {
- UltraGridRow row = ultraGrid1.Rows[i];
- row.Activate();
- }
- }
- }
- dingwei = "";
- }
- /// <summary>
- /// 上料计划详情
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ultraGrid2_AfterRowActivate(object sender, EventArgs e)
- {
- this.getUltraGrid1AfterRowActivate();
- }
- private void getUltraGrid1AfterRowActivate()
- {
- UltraGridRow urg = ultraGrid1.ActiveRow;
- if (urg == null) return;
- ultraGrid2.UpdateData();
- UltraGridRow row = ultraGrid2.ActiveRow;
- if (row == null) return;
- string outnumcut = urg.Cells["OUTNUM_CUT"].Text.ToString();
- string heatNo = row.Cells["HEAT_PLAN_NO"].Value.ToString();
- frmDetectResultControl1.ResultNo = row.Cells["RESULT_NO"].Value.ToString();
- string resultno = row.Cells["RESULT_NO"].Value.ToString();
- REsultno = row.Cells["RESULT_NO"].Value.ToString();
- //查询加工管号队列合格的支、吨
- DataTable dt2 = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryRCLPortVrp2", new object[] { heatNo }, ob);
- MchMtResultEntity result = new MchMtResultEntity();
- //if (row.Cells["IF_MONITOR_RCL"].Text.ToString().Equals("是"))
- //{
- // this.instructionCardControl1.Grid.DisplayLayout.Bands[0].Columns["Producer"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
- // this.instructionCardControl1.Grid.DisplayLayout.Bands[0].Columns["ProducerTime"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
- //}
- //else
- //{
- // this.instructionCardControl1.Grid.DisplayLayout.Bands[0].Columns["Producer"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.ActivateOnly;
- // this.instructionCardControl1.Grid.DisplayLayout.Bands[0].Columns["ProducerTime"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.ActivateOnly;
- //}
- //instructionCardControl1.JudNo = row.Cells["HEATNO_LAST"].Text.ToString();
- //instructionCardControl1.BatchNo = row.Cells["ZG_BATCH_NO"].Text.ToString();
- //instructionCardControl1.GroupNo = row.Cells["BATCH_GROUD_NO"].Text.ToString();
- //instructionCardControl1.Ob = this.ob;
- //string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- //result.ProNum = row.Cells["ACT_COUNT"].Text.ToString();
- // result.ProWt = row.Cells["ACT_WEIGHT"].Text.ToString();
- result.ProShift = UserInfo.GetUserOrder();
- result.ProGroup = UserInfo.GetUserGroup();
- //result.CreateUser = UserInfo.GetUserName();
- //result.ColTime = time;
- result.CreateTime = row.Cells["CREATE_TIME"].Text.ToString();
- result.CreateUser = row.Cells["CREATE_USER"].Text.ToString();
- result.CtrStiCurInt = row.Cells["CTR_STI_CUR_INT"].Text.ToString();
- result.DemagVol = row.Cells["DEMAG_VOL"].Text.ToString();
- result.DubiousNum = row.Cells["DUBIOUS_NUM"].Text.ToString();
- result.FailNum = row.Cells["FAIL_NUM"].Text.ToString();
- result.FpassNum = row.Cells["FPASS_NUM"].Text.ToString();
- result.FtestingNum = row.Cells["FTESTING_NUM"].Text.ToString();
- result.HeatPlanNo = row.Cells["HEAT_PLAN_NO"].Text.ToString();
- result.MagSuspLiqCon = row.Cells["MAG_SUSP_LIQ_CON"].Text.ToString();
- result.MtNote = row.Cells["MT_NOTE"].Text.ToString();
- result.MtType = row.Cells["MT_TYPE"].Text.ToString();
- result.ProGroup = row.Cells["PRO_GROUP"].Value.ToString();
- result.ProShift = row.Cells["PRO_SHIFT"].Text.ToString();
- result.ShimMagIndic = row.Cells["SHIM_MAG_INDIC"].Text.ToString();
- result.ShimMagType = row.Cells["SHIM_MAG_TYPE"].Text.ToString();
- result.SignMan = row.Cells["SIGN_ISSUED"].Text.ToString();
- result.SignManGrade = row.Cells["SIGN_MAN_GRADE"].Text.ToString();
- result.TestingGrade1 = row.Cells["TESTING_GRADE1"].Text.ToString();
- result.TestingGrade2 = row.Cells["TESTING_GRADE2"].Text.ToString();
- result.TestingGrade3 = row.Cells["TESTING_GRADE3"].Text.ToString();
- result.TestingGrade4 = row.Cells["TESTING_GRADE4"].Text.ToString();
- result.TestingStandard1 = row.Cells["TESTING_STANDARD1"].Text.ToString();
- result.TestingStandard2 = row.Cells["TESTING_STANDARD2"].Text.ToString();
- result.TestingStandard3 = row.Cells["TESTING_STANDARD3"].Text.ToString();
- result.TestingStandard4 = row.Cells["TESTING_STANDARD4"].Text.ToString();
- result.TetNum = row.Cells["TET_NUM"].Text.ToString();
- result.UpdateName = row.Cells["UPDATE_NAME"].Text.ToString();
- result.UpdateTime = row.Cells["UPDATE_TIME"].Text.ToString();
- result.ProNum = dt2.Rows[0]["ACT_COUNT"].ToString();
- this.frmDetectResultControl1.Value = result;
- if(row.Cells["FAIL_NUM"].Value.ToString()=="0")
- {
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.mcp.Mch.FrmCrackDetectResult";
- ccp.MethodName = "getqueryfailnum";
- ccp.ServerParams = new Object[] { resultno };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- }
- //查询实绩里不同分切数的加工支数
- DataTable dt3 = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmDetectResult.getQueryNum", new object[] { heatNo, outnumcut }, ob);
- int num = 0;
- int fnum = 0;
- UltraGridRow uggr = ultraGrid2.ActiveRow;
- string outnum = uggr.Cells["OUTNUM_CUT"].Text.ToString();
- foreach (UltraGridRow ugr in ultraGrid2.Rows)
- {
- if (ugr.Cells["OUTNUM_CUT"].Text.ToString() == outnum)
- {
- num = num + Convert.ToInt32(dt3.Rows[0]["TET_NUM"].ToString());
- fnum = fnum + Convert.ToInt32(dt3.Rows[0]["FAIL_NUM"].ToString());
- }
- }
- UltraGridRow uug = ultraGrid1.ActiveRow;
- if (uug != null)
- {
- uug.Cells["num"].Value = num;
- if (FrmScrapNumMeasureFail.CrNum != 0)
- {
- uug.Cells["snum"].Value = Convert.ToInt32(dt2.Rows[0]["ACT_COUNT"].ToString()) - num - Convert.ToInt32(FrmScrapNumMeasureFail.CrNum);
- }
- else
- {
- uug.Cells["snum"].Value = Convert.ToInt32(dt2.Rows[0]["ACT_COUNT"].ToString()) - num;
- }
- if (Convert.ToInt32(uug.Cells["snum"].Value) <= 0)
- {
- uug.Cells["snum"].Value = 0;
- }
- }
- frmDetectResultControl1.fenum = uug.Cells["snum"].Value.ToString();
- }
- /// <summary>
- /// 根据计划号查询湿磁粉探伤实绩
- /// </summary>
- /// <param name="planNo"></param>
- public void GetLoadResult(string heatNo)
- {
- DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmDetectResult.getQueryExpandResult", new object[] { heatNo }, this.ob);
- GridHelper.CopyDataToDatatable(ref dt, ref dtLoadRecord, true);
- }
- /// <summary>
- /// 初始化控件
- /// </summary>
- private void initControl()
- {
- ultraGrid1.UpdateData();
- UltraGridRow row = ultraGrid1.ActiveRow;
- if (row == null) return;
- string outnumcut = row.Cells["OUTNUM_CUT"].Text.ToString();
- string heatNo = row.Cells["HEAT_PLAN_NO"].Value.ToString();
- //查询加工管号队列合格的支、吨
- DataTable dt2 = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryRCLPortVrp3", new object[] { heatNo,outnumcut }, ob);
- MchMtResultEntity result = new MchMtResultEntity();
- //string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- //DataTable dt1 = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmMcpLoading.getTime", null, this.ob);
- result.ProShift = UserInfo.GetUserOrder();
- result.ProGroup = UserInfo.GetUserGroup();
- result.CreateUser = UserInfo.GetUserName();
- //result.ColTime = time;
- result.CreateTime = time;
- result.ProducerTime = time;
- result.ProNum = dt2.Rows[0]["ACT_COUNT"].ToString();
- this.frmDetectResultControl1.Value = result;
- }
- /// <summary>
- /// 湿磁粉探伤实绩保存
- /// </summary>
- private void DoSave()
- {
- if (this.frmDetectResultControl1.ValidInput1())
- {
- string batchgroudno = "";//组号
- string outnumcut = "";//分切数
- string lengthin = "";//长度
- string lengthmaxin = "";//长度上限
- string lengthminin = "";//长度下限
- int synum = 0;
- ArrayList dname = new ArrayList();
- ArrayList fname = new ArrayList();
- if (Core.StlMes.Client.Mcp.Control.FrmScrap.dName != null)
- {
- dname = Core.StlMes.Client.Mcp.Control.FrmScrap.dName;
- }
- if (Core.StlMes.Client.Mcp.Control.FrmScrap.fName != null)
- {
- fname = Core.StlMes.Client.Mcp.Control.FrmScrap.fName;
- }
- ArrayList jfname = new ArrayList();
- if (FrmScrapNumMeasureFail.CrName != null)
- {
- jfname = FrmScrapNumMeasureFail.CrName;
- }
- UltraGridRow row = ultraGrid1.ActiveRow;
- if (row != null)
- {
- synum = Convert.ToInt32(row.Cells["snum"].Text.ToString());
- if (synum <= 0)
- {
- MessageUtil.ShowTips("剩余支数小于等于0,无法新增!");
- return;
- }
- batchgroudno = row.Cells["BATCH_GROUD_NO"].Text.ToString();
- outnumcut = row.Cells["OUTNUM_CUT"].Text.ToString();
- lengthin = row.Cells["LENGTH_IN"].Text.ToString();
- lengthminin = row.Cells["LENGTHMIN_IN"].Text.ToString();
- lengthmaxin = row.Cells["LENGTHMAX_IN"].Text.ToString();
- this.frmDetectResultControl1.UpdateData();
- MchMtResultEntity result = this.frmDetectResultControl1.Value;
- if (result.ProNum == "" || result.ProNum == null)
- {
- result.ProNum = "0";
- }
- if (result.FailNum == "" || result.FailNum == null)
- {
- result.FailNum = "0";
- }
- if (result.DubiousNum == "" || result.DubiousNum == null)
- {
- result.DubiousNum = "0";
- }
- if (result.FpassNum == "" || result.FpassNum == null)
- {
- result.FpassNum = "0";
- }
- if (result.FtestingNum == "" || result.FtestingNum == null)
- {
- result.FtestingNum = "0";
- }
- result.ZyBatchId = row.Cells["ZY_BATCH_ID"].Value.ToString();
- result.HeatPlanNo = row.Cells["HEAT_PLAN_NO"].Value.ToString();
- if (result.ProNum == "0")
- {
- MessageUtil.ShowTips("检验支数是零,不允许新增!");
- return;
- }
- string tetnum = "";
- foreach (UltraGridRow rgg in ultraGrid2.Rows)
- {
- if (rgg != null)
- {
- tetnum = Convert.ToString(Convert.ToInt32(rgg.Cells["TET_NUM"].Value.ToString()) + Convert.ToInt32(result.TetNum));
- }
- }
- string heatNo = row.Cells["HEAT_PLAN_NO"].Value.ToString();
- //查询加工管号队列合格的支、吨
- int count = 0;
- double weghit = 0;
- DataTable dt2 = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryRCLPortVrp2", new object[] { heatNo }, ob);
- if (dt2.Rows.Count > 0)
- {
- count = int.Parse(dt2.Rows[0]["ACT_COUNT"].ToString());
- weghit = Double.Parse(dt2.Rows[0]["ACT_WEIGHT"].ToString());
- }
- if (int.Parse(result.ProNum) > count)
- {
- MessageUtil.ShowTips("合格支数不能超过管号队列合格的支数!");
- return;
- }
- if (result.ProNum.Equals("0") && result.FailNum.Equals("0"))
- {
- MessageUtil.ShowTips("合格支数与废品支数都是零,无法新增!!");
- return;
- }
- //查询探伤实绩合格支数的和
- DataTable dt1 = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmDetectResult.getQueryExpandResult1", new object[] { row.Cells["HEAT_PLAN_NO"].Value.ToString() }, this.ob);
- //VrpLoadingResultEntity result1 = new VrpLoadingResultEntity();
- //this.planExpanQuery1.Value = result;
- string pronum = "";
- if (dt1.Rows.Count > 0)
- {
- pronum = dt1.Rows[0]["PRO_NUM"].ToString();
- }
- else
- {
- pronum = "0";
- }
- if (count == 0)
- {
- if (int.Parse(pronum) + int.Parse(result.ProNum) >= count)
- {
- MessageUtil.ShowTips("探伤实绩合格支数和作业实绩合格支数的和超过或等于管号队列合格支数,无法新增!!");
- return;
- }
- }
- else
- {
- if (int.Parse(pronum) + int.Parse(result.ProNum) > count)
- {
- MessageUtil.ShowTips("探伤实绩合格支数和作业实绩合格支数的和超过管号队列合格支数,无法新增!!");
- return;
- }
- }
- if (FrmScrapNumMeasureFail.CrNum != 0)
- {
- result.ProNum = Convert.ToString(int.Parse(result.ProNum) - FrmScrapNumMeasureFail.CrNum);
- if (result.ProWt == null || result.ProWt=="")
- {
- result.ProWt = "0.00";
- }
- else
- {
- result.ProWt = Convert.ToString(FrmScrapNumMeasureFail.CrNum * (int.Parse(result.ProNum) / double.Parse(result.ProWt)));
- }
-
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.mcp.Mch.FrmDetectResult";
- ccp.MethodName = "saveExpandResult";
- ccp.ServerParams = new Object[] { result, heatNo, SlGx, row.Cells["PLINE_CODE"].Value.ToString(), tetnum, batchgroudno, outnumcut, lengthin, lengthmaxin, lengthminin, dname, fname, jfname };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("新增湿磁粉探伤成功!"))
- {
- dingwei = row.Cells["HEAT_PLAN_NO"].Value.ToString();
- QuerySinglePlan();
- initControl();
- jfname.Clear();
- fname.Clear();
- FrmScrapNumMeasureFail.query(heatNo);
- }
- }
- }
- }
- }
- /// <summary>
- /// 撤销湿磁粉探伤
- /// </summary>
- private void DoReturn()
- {
- int nnum = 0;
- UltraGridRow row = ultraGrid2.ActiveRow;
- UltraGridRow Rows = ultraGrid2.ActiveRow;
- if (Rows == null) return;
- if (row != null)
- {
- int detCount = 0;
- detCount = int.Parse(row.Cells["FAIL_NUM"].Text.ToString());
- string outnumcut = row.Cells["OUTNUM_CUT"].Text.ToString();
- int delCount = 0;
- ArrayList list = new ArrayList();
- delCount += 1;
- ArrayList list1 = new ArrayList();
- list1.Add(Rows.Cells["RESULT_NO"].Value.ToString());
- list1.Add(Rows.Cells["ZY_BATCH_ID"].Value.ToString());
- list1.Add(Rows.Cells["HEAT_PLAN_NO"].Value.ToString());
- if (delCount == 0)
- {
- MessageUtil.ShowTips("请选择湿磁粉探伤信息!");
- return;
- }
- string tetnum = "";
- UltraGridRow urg = ultraGrid2.ActiveRow;
- if (urg != null)
- {
- tetnum = urg.Cells["TET_NUM"].Value.ToString();
- }
- DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmDriftDiameterResult.getQueryJFailNum", new object[] { row.Cells["RESULT_NO"].Value.ToString(), row.Cells["HEAT_PLAN_NO"].Value.ToString(), row.Cells["PLINE_CODE"].Value.ToString() }, this.ob);
- if (dt.Rows.Count > 0)
- {
- nnum = int.Parse(dt.Rows[0]["FAIL_NUM"].ToString());
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.mcp.Mch.FrmDetectResult";
- ccp.MethodName = "deleteVrpExpandResult";
- ccp.ServerParams = new Object[] { list1, Rows.Cells["HEAT_PLAN_NO"].Value.ToString(), row.Cells["PLINE_CODE"].Value.ToString(), SlGx, tetnum, outnumcut, nnum,detCount };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("删除湿磁粉探伤成功!"))
- {
- dingwei = row.Cells["HEAT_PLAN_NO"].Value.ToString();
- QuerySinglePlan();
- initControl();
- }
- }
- this.getUltraGrid1AfterRowActivate();
- }
- }
- /// <summary>
- /// 修改
- /// </summary>
- private void DoUpdate()
- {
- UltraGridRow row = ultraGrid1.ActiveRow;
- UltraGridRow urg = ultraGrid2.ActiveRow;
- if (urg == null) return;
- if (row == null) return;
- if (this.frmDetectResultControl1.ValidInput1())
- {
- this.frmDetectResultControl1.UpdateData();
- MchMtResultEntity result = this.frmDetectResultControl1.Value;
- //ArrayList list1 = new ArrayList();
- result.HeatPlanNo = urg.Cells["HEAT_PLAN_NO"].Value.ToString();
- result.ResultNo = urg.Cells["RESULT_NO"].Value.ToString();
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.mcp.Mch.FrmDetectResult";
- ccp.MethodName = "updateVrpExpandResult";
- ccp.ServerParams = new Object[] { result, urg.Cells["RESULT_NO"].Value.ToString(), row.Cells["PLINE_CODE"].Value.ToString(), SlGx };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- this.getUltraGrid1AfterRowActivate();
- }
- }
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
- ultraGrid1.UpdateData();
- UltraGridRow urg = ultraGrid1.ActiveRow;
- if (urg == null) return;
- string outnumcut = urg.Cells["OUTNUM_CUT"].Text.ToString();
- string heatNo = urg.Cells["HEAT_PLAN_NO"].Value.ToString();
- frmDetectResultControl1.heatNo = urg.Cells["HEAT_PLAN_NO"].Value.ToString();
- plineCode = urg.Cells["PLINE_CODE"].Value.ToString();
- //查询加工管号队列合格的支、吨
- DataTable dt2 = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryRCLPortVrp3", new object[] { heatNo,outnumcut }, ob);
- if (urg != null)
- {
- urg.Cells["snum"].Value = dt2.Rows[0]["ACT_COUNT"].ToString();
- if (urg.Cells["num"].Value.ToString() == "" || urg.Cells["num"].Value.ToString() == null)
- {
- urg.Cells["num"].Value = "0";
- }
- }
- frmDetectResultControl1.fenum = urg.Cells["snum"].Text.ToString();
- MchMtResultEntity result = new MchMtResultEntity();
- //string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- //DataTable dt1 = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmMcpLoading.getTime", null, this.ob);
- //result.ProNum = row.Cells["ACT_COUNT"].Text.ToString();
- // result.ProWt = row.Cells["ACT_WEIGHT"].Text.ToString();
- result.ProShift = UserInfo.GetUserOrder();
- result.ProGroup = UserInfo.GetUserGroup();
- result.CreateUser = UserInfo.GetUserName();
- //result.RroTime = time;
- result.CreateTime = time;
- result.TetNum = dt2.Rows[0]["ACT_COUNT"].ToString();
- result.ProNum = dt2.Rows[0]["ACT_COUNT"].ToString();
- this.frmDetectResultControl1.Value = result;
- this.GetLoadResult(heatNo);
- frmDetectResultControl1.Ob = this.ob;
- frmDetectResultControl1.init(urg.Cells["PLINE_NAME"].Text.ToString());
- frmDetectResultControl1.plinCode = plineCode;
- frmDetectResultControl1.SlGx = SlGx;
- //查询管号队列
- DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryJGPortVrphot", new object[] { heatNo }, this.ob);
- GridHelper.CopyDataToDatatable(ref dt, ref dataTable3, true);
- GridHelper.RefreshAndAutoSize(this.ultraGrid4);
- foreach (UltraGridRow urg1 in ultraGrid4.Rows)
- {
- if (urg1.Cells["MAT_STATUS"].Text.Equals("剔除"))
- {
- urg1.Cells["MAT_STATUS"].Appearance.ForeColor = Color.Red;
- }
- if (urg1.Cells["MAT_STATUS"].Text.Equals("绝废"))
- {
- urg1.Cells["MAT_STATUS"].Appearance.ForeColor = Color.Red;
- }
- }
- }
- private void chkStarts_CheckedChanged(object sender, EventArgs e)
- {
- if (chkPlnNo.Checked) { txtRollBatchId.Enabled = true; } else { txtRollBatchId.Enabled = false; }
- if (chkJuNo.Checked) { txtZyBatchId.Enabled = true; } else { txtZyBatchId.Enabled = false; }
- }
- private void BtOffline_Click(object sender, EventArgs e)
- {
- UltraGridRow row = ultraGrid1.ActiveRow;
- if (row == null) return;
- string batchgroudno = row.Cells["BATCH_GROUD_NO"].Text.ToString();
- string outnumcut = row.Cells["OUTNUM_CUT"].Text.ToString();
- UltraGridRow row3 = ultraGrid4.ActiveRow;
- if (row3 == null) return;
- MchMtResultEntity result = this.frmDetectResultControl1.Value;
- if (OfflineNum.Value.ToString().Equals("0"))
- {
- MessageUtil.ShowTips("请输入离线支数!");
- return;
- }
- ArrayList list = new ArrayList();
- list.Add(row.Cells["HEAT_PLAN_NO"].Value.ToString());
- 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(OfflineNum.Value.ToString());
- if (MessageUtil.ShowYesNoAndQuestion("是否离线?") == DialogResult.No) return;
- 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.FrmDetectResult";
- ccp.MethodName = "offLineExpandResult";
- ccp.ServerParams = new Object[] { result, list, row.Cells["PLINE_CODE"].Value.ToString(), storageNo, batchgroudno, outnumcut };
- 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("离线成功!"))
- {
- QuerySinglePlan();
- }
- }
- }
- //工艺文件查询
- private void craftImg_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
- {
- UltraGridRow row = ultraGrid1.ActiveRow;
- string craftPath = YdmBaseClass.getQueryCraftNo(row.Cells["CRAFT_FILE_NO"].Text.ToString(),row.Cells["CRAFT_SEQ"].Text.ToString(), ob);
- if (e.Button.Key.ToLower().Equals("select"))
- {
- FormFileDown down = new FormFileDown(ob, craftPath);
- down.CtrlFileDown1.Button3.Visible = false;
- down.ShowDialog();
- }
- }
- private void OfflineNum_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
- {
- UltraGridRow row = ultraGrid1.ActiveRow;
- if (row == null) return;
- string batchgroudno = row.Cells["BATCH_GROUD_NO"].Text.ToString();
- string outnumcut = row.Cells["OUTNUM_CUT"].Text.ToString();
- string heno = row.Cells["HEAT_PLAN_NO"].Text.ToString();
- string linenum = row.Cells["num"].Text.ToString();
- string plineName = row.Cells["PLINE_NAME"].Text.ToString();
- DataTable dt1 = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmDetectResult.getQueryExpandResultStuts", new object[] { heno, row.Cells["PLINE_CODE"].Text.ToString() }, this.ob);
- if (dt1.Rows.Count>0)
- {
- if (dt1.Rows[0]["STATION_STATUS"].ToString() == "2")
- {
- MessageUtil.ShowTips("该工序已经结炉,不允许录入离线数!");
- return;
- }
- }
- UltraGridRow urg = ultraGrid2.ActiveRow;
- if (urg == null) return;
- UltraGridRow row3 = ultraGrid4.ActiveRow;
- if (row3 == null) return;
- MchMtResultEntity result = this.frmDetectResultControl1.Value;
- FrmScrapNumDetect matfrm = new FrmScrapNumDetect(result, heno, SlGx, SlGxname, batchgroudno, outnumcut, storageNo, plineCode, REsultno,linenum,plineName, this.ob);
- matfrm.ShowDialog();
- this.ultraGrid1.UpdateData();
- QuerySinglePlan();
- }
- }
- }
|