| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968 |
- using Core.Mes.Client.Comm.Format;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.YdmStuffManage.Entity;
- using CoreFS.CA06;
- 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.Net;
- using System.Text;
- using System.Windows.Forms;
- namespace Core.StlMes.Client.YdmStuffManage
- {
- public partial class FrmStuffSurfaceResult : FrmBase
- {
- public FrmStuffSurfaceResult()
- {
- InitializeComponent();
- //surfaceResult1.initValue();
-
- }
- private StlLgSurfaceM1Entity qcmSurfaceM = new StlLgSurfaceM1Entity();//表检实绩信息
- private string PlineCode = "";//产线
-
- /// <summary>
- /// 重写基类方法
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="ToolbarKey"></param>
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "DoQuery":
- QuerySinglePlan();
- break;
- case "Save":
- SaveData();
- break;
- case "DoBeside":
- doBeside();
- break;
- case "DoBesideBack":
- doBesideBack();
- break;
- case "BatchScrapNum":
- batchScrapNum();
- break;
- case "BatchOffNum":
- batchOffNum();
- break;
- case "BatchSaveReason":
- batchSaveReason();
- break;
- case "ClearReason":
- clearReason();
- break;
- case "printSuface":
- printSuface();
- break;
- case"upLoadSuface":
- upLoadSuface();
- break;
- case "Close":
- this.Close();
- break;
- }
- }
- /// <summary>
- /// 清空缺陷原因
- /// </summary>
- private void clearReason()
- {
- this.ultraGrid1.UpdateData();
- UltraGridRow uRow = this.ultraGrid1.ActiveRow;
- PlnSteelforOrdEntity plnSteelTity = (PlnSteelforOrdEntity)uRow.ListObject;
- string plnSteelEntity = JSONFormat.Format(plnSteelTity);
- ArrayList list = new ArrayList();
- list.Add(plnSteelTity.Furnaceno);
- list.Add(plnSteelTity.Sequenceno);
- list.Add(plnSteelTity.StoveNo);
- list.Add(plnSteelTity.JudgeStoveNoSeq);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult";
- ccp.MethodName = "clearReason";
- ccp.ServerParams = new object[] { plnSteelEntity };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("清空成功!"))
- {
- doQueryRack(list);
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- /// <summary>
- /// 保存缺陷原因
- /// </summary>
- private void batchSaveReason()
- {
- this.ultraGrid1.UpdateData();
- string scrapNum = "";
- string scrapReson = "";//缺陷原因
-
- if (this.TxtScrapNum.Text.Trim() != "" && StringUtil.IsInt(this.TxtScrapNum.Text.Trim()))
- {
- scrapNum = this.TxtScrapNum.Text.Trim();
- }
- else
- {
- MessageUtil.ShowTips("批量剔除时请输入支数并且为整数!");
- return;
- }
- if (this.TxtScrapNum.Text.Trim() != "")
- {
- scrapReson = this.ultraComboEditor1.Text.Trim();
- }
- else
- {
- MessageUtil.ShowTips("批量剔除时请选择废品原因!");
- return;
- }
- UltraGridRow uRow = this.ultraGrid1.ActiveRow;
-
- PlnSteelforOrdEntity plnSteelTity = (PlnSteelforOrdEntity)uRow.ListObject;
- string plnSteelEntity = JSONFormat.Format(plnSteelTity);
-
- ArrayList list = new ArrayList();
- list.Add(plnSteelTity.Furnaceno);
- list.Add(plnSteelTity.Sequenceno);
- list.Add(plnSteelTity.StoveNo);
- list.Add(plnSteelTity.JudgeStoveNoSeq);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult";
- ccp.MethodName = "batchSaveReason";
- ccp.ServerParams = new object[] { plnSteelEntity, scrapNum, scrapReson };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("保存成功!"))
- {
- doQueryRack(list);
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- /// <summary>
- /// 批量剔除
- /// </summary>
- private void batchScrapNum()
- {
- this.ultraGrid1.UpdateData();
- string scrapNum = "";
- string scrapReson = "";//废品原因
- string okNum = "";
- if (this.TxtScrapNum.Text.Trim() != "" && StringUtil.IsInt(this.TxtScrapNum.Text.Trim()))
- {
- scrapNum = this.TxtScrapNum.Text.Trim();
- }
- else
- {
- MessageUtil.ShowTips("批量剔除时请输入支数并且为整数!");
- return;
- }
- if (this.TxtScrapNum.Text.Trim() != "")
- {
- scrapReson = this.ultraComboEditor1.Text.Trim();
- }
- else
- {
- MessageUtil.ShowTips("批量剔除时请选择废品原因!");
- return;
- }
- UltraGridRow uRow = this.ultraGrid1.ActiveRow;
- //if (uRow.HasChild())
- //{
- // return;
- //}
- PlnSteelforOrdEntity plnSteelTity = (PlnSteelforOrdEntity)uRow.ListObject;
- string plnSteelEntity = JSONFormat.Format(plnSteelTity);
- DataTable ds = ServerHelper.GetData("Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.doQueryOkNum", new object[] { plnSteelEntity }, ob);//查询合格坯料支数
- if (ds.Rows.Count > 0)
- {
- okNum = ds.Rows[0][0].ToString();
- }
- if (int.Parse(scrapNum) > int.Parse(okNum))
- {
- MessageUtil.ShowTips("输入的批量剔除支数已大于合格支数,不允许批量剔除!");
- return;
- }
- ArrayList list = new ArrayList();
- list.Add(plnSteelTity.Furnaceno);
- list.Add(plnSteelTity.Sequenceno);
- list.Add(plnSteelTity.StoveNo);
- list.Add(plnSteelTity.JudgeStoveNoSeq);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult";
- ccp.MethodName = "batchScrapNum";
- ccp.ServerParams = new object[] { plnSteelEntity,scrapNum,scrapReson };
- ccp = ob.ExecuteNonQuery(ccp,CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("剔除成功!"))
- {
- doQueryRack(list);
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- /// <summary>
- /// 批量离线
- /// </summary>
- private void batchOffNum()
- {
- this.ultraGrid1.UpdateData();
- string scrapNum = "";
- string scrapReson = "";//废品原因
- string okNum = "";
- if (this.TxtScrapNum.Text.Trim() != "" && StringUtil.IsInt(this.TxtScrapNum.Text.Trim()))
- {
- scrapNum = this.TxtScrapNum.Text.Trim();
- }
- else
- {
- MessageUtil.ShowTips("批量离线时请输入支数并且为整数!");
- return;
- }
- if (this.TxtScrapNum.Text.Trim() != "")
- {
- scrapReson = this.ultraComboEditor1.Text.Trim();
- }
- else
- {
- MessageUtil.ShowTips("批量剔除时请选择废品原因!");
- return;
- }
- UltraGridRow uRow = this.ultraGrid1.ActiveRow;
- //if (uRow.HasChild())
- //{
- // return;
- //}
- PlnSteelforOrdEntity plnSteelTity = (PlnSteelforOrdEntity)uRow.ListObject;
- string plnSteelEntity = JSONFormat.Format(plnSteelTity);
- DataTable ds = ServerHelper.GetData("Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.doQueryOkNum", new object[] { plnSteelEntity }, ob);//查询合格坯料支数
- if (ds.Rows.Count > 0)
- {
- okNum = ds.Rows[0][0].ToString();
- }
- if (int.Parse(scrapNum) > int.Parse(okNum))
- {
- MessageUtil.ShowTips("输入的批量离线支数已大于合格支数,不允许批量离线!");
- return;
- }
- ArrayList list = new ArrayList();
- list.Add(plnSteelTity.Furnaceno);
- list.Add(plnSteelTity.Sequenceno);
- list.Add(plnSteelTity.StoveNo);
- list.Add(plnSteelTity.JudgeStoveNoSeq);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult";
- ccp.MethodName = "batchOffNum";
- ccp.ServerParams = new object[] { plnSteelEntity, scrapNum, scrapReson, UserInfo.GetUserName(), UserInfo.GetUserOrder(), UserInfo.GetUserGroup() };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("离线成功!"))
- {
- doQueryRack(list);
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- /// <summary>
- /// 上传PDF表检报告
- /// </summary>
- private void upLoadSuface()
- {
- string filePathNew = ""; //表检报告目录
- WebClient webClient = new WebClient();
- List<FileBean> listPdf = new List<FileBean>();
- string date = DateTime.Now.ToString("yyyyMMdd");
- string judgeNo = "";
- string proPlanId = "";
- string gxPlanNo = "";
- string plineCode = "";
- UltraGridRow uRow = this.ultraGrid1.ActiveRow;
- if (uRow == null)
- {
- return;
- }
- judgeNo = uRow.Cells["JudgeStoveNo"].Text;
- proPlanId = uRow.Cells["ProPlanId"].Text;
- gxPlanNo = uRow.Cells["GxPlanNo"].Text;
- plineCode = uRow.Cells["PlineCode"].Text;
- string url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepLgCastingInspectionRecord.cpt&format=pdf&JUDGE_STOVE_NO=" + judgeNo + "&PRO_PLAN_ID=" + proPlanId + "&GX_PLAN_NO=" + gxPlanNo;
- filePathNew = "LgMil/surfcacReprot"+"/"+ plineCode + "/" + judgeNo + "/";
- byte[] pdf = webClient.DownloadData(url);
- FileBean fileBean = new FileBean();
- fileBean.setFile(pdf);
- fileBean.setFileName(proPlanId.Replace("/","-")+judgeNo + ".pdf");
- fileBean.setPathName(filePathNew);
- listPdf.Add(fileBean);
- webClient.Dispose();
- bool a = FileHelper.Upload(listPdf);
- if (a)
- {
- int count = ServerHelper.SetData("Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.updateSurFace", new object[] { filePathNew, judgeNo, proPlanId, gxPlanNo }, ob);
- if (count > 0)
- {
- MessageUtil.ShowTips("上传成功!");
- SelectFile(filePathNew + proPlanId.Replace("/", "-") + judgeNo + ".pdf");
- }
- }
-
- }
- /// <summary>
- /// 查询上传的PDF文件
- /// </summary>
- private void SelectFile(string filePathNew)
- {
- dlgOrderAskDown down = new dlgOrderAskDown(this.ob, filePathNew);
- down.DeleteButton.Visible = false;
- down.ShowDialog();
- }
- /// <summary>
- /// 打印表检报告
- /// </summary>
- private void printSuface()
- {
- string judgeNo = "";
- string proPlanId = "";
- string gxPlanNo = "";
- UltraGridRow uRow = this.ultraGrid1.ActiveRow;
- if (uRow == null)
- {
- return;
- }
- judgeNo = uRow.Cells["JudgeStoveNo"].Text;
- proPlanId = uRow.Cells["ProPlanId"].Text;
- gxPlanNo = uRow.Cells["GxPlanNo"].Text;
- string strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepLgCastingInspectionRecord.cpt&format=pdf&JUDGE_STOVE_NO=" + judgeNo + "&PRO_PLAN_ID=" + proPlanId + "&GX_PLAN_NO=" + gxPlanNo;
- FrmExcel fre = new FrmExcel(this.ob, strurl);
- fre.AutoSize = true;
- fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
- fre.WindowState = FormWindowState.Maximized;
- fre.Show();
- }
-
- /// <summary>
- /// 查询炉计划
- /// </summary>
- private void QuerySinglePlan()
- {
- string[] L1 = new string[] { "Furnaceno", "StoveNo" };
- string[] L2 = new string[] { "Furnaceno","StoveNo" };
- string startTim = "";
- string endTim = "";
- string stoveNo = "";
- if (this.chkRegTime.Checked)
- {
- startTim = this.RegStartTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
- endTim = this.RegEndTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
- }
- if (this.chkFurnace.Checked && this.txtFurnace.Text.Trim() != "")
- {
- stoveNo = this.txtFurnace.Text.Trim();
- }
- StlLgSurfaceMEntitybindingSource.Clear();
- StlLgProgrrssEntitybindingSource.Clear();
- // List<PlnSteelforOrdEntity1> listSource = EntityHelper.GetData<PlnSteelforOrdEntity1>(
- //"Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.doQueryPlanStoveNo", new object[] { startTim, endTim, stoveNo,this.ultraOptionSet2.CheckedItem.DataValue.ToString(), arr,"0" }, this.ob);
- List<PlnSteelforOrdEntity> listSource1 = EntityHelper.GetData<PlnSteelforOrdEntity>(
- "Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.doQueryPlan", new object[] { startTim, endTim, stoveNo, this.ultraOptionSet2.CheckedItem.DataValue.ToString(), arr,"0" }, this.ob);
- //EntityHelper.AddEntityRelation(listSource, listSource1, L1, L2);
- plnSteelforOrdEntity1BindingSource.DataSource = listSource1;
- }
- /// <summary>
- /// 保存
- /// </summary>
- private void SaveData()
- {
- UltraGridRow uRow = this.ultraGrid1.ActiveRow;
- //if (uRow.HasChild())
- //{
- // return;
- //}
- if (uRow == null)
- {
- MessageUtil.ShowTips("无炉计划信息,无法保存!");
- return;
- }
- this.surfaceResult1.UltraGrid2.UpdateData();
- qcmSurfaceM = BaseMethod.GetUltraGridToEntityNEW(this.surfaceResult1.UltraGrid2,qcmSurfaceM);
- qcmSurfaceM.Furnaceno = uRow.Cells["Furnaceno"].Text;
- qcmSurfaceM.Sequenceno = uRow.Cells["Sequenceno"].Text;
- qcmSurfaceM.StoveNo = uRow.Cells["StoveNo"].Text;
- qcmSurfaceM.JudgeStoveNo = uRow.Cells["JudgeStoveNo"].Text;
- qcmSurfaceM.JudgeStoveNoSeq = uRow.Cells["JudgeStoveNoSeq"].Text;
- qcmSurfaceM.ProPlanId = uRow.Cells["ProPlanId"].Text;
- qcmSurfaceM.GxPlanNo = uRow.Cells["GxPlanNo"].Text;
- qcmSurfaceM.ColGroup = UserInfo.GetUserGroup();
- qcmSurfaceM.ColShift = UserInfo.GetUserOrder();
- qcmSurfaceM.PlineCode = PlineCode;
- //string qcmSurfaceMS = JSONFormat.Format(qcmSurfaceM);
- //qcmSurfaceM.PlineCode = "C001";
- //DataTable ds = ServerHelper.GetData("Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.doQueryStausSum", new object[] { qcmSurfaceMS, "0" }, ob);
- //qcmSurfaceM.Quantity = ds.Rows[0][0].ToString();
- //DataTable dd = ServerHelper.GetData("Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.doQueryStausSum", new object[] { qcmSurfaceMS, "1" }, ob);
- //qcmSurfaceM.ScrapNum = dd.Rows[0][0].ToString();
- //DataTable df = ServerHelper.GetData("Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.doQueryStausSum", new object[] { qcmSurfaceMS, "2" }, ob);
- //qcmSurfaceM.OfflineNum = df.Rows[0][0].ToString();
- //DataTable dh = ServerHelper.GetData("Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.doQueryStausSum", new object[] { qcmSurfaceMS, "3" }, ob);
- //qcmSurfaceM.Eligiblequty = dh.Rows[0][0].ToString();
- //qcmSurfaceM.ActWeight = decimal.Parse(dh.Rows[0][1].ToString());
- qcmSurfaceM.CreateName = UserInfo.GetUserName();
- string qcmSurfaceMTity = JSONFormat.Format(qcmSurfaceM);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult";
- ccp.MethodName = "saveSurfaceResult";
- ccp.ServerParams = new object[] { qcmSurfaceMTity};
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("保存成功!"))
- {
- QuerySinglePlan();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- /// <summary>
- /// 结炉
- /// </summary>
- private void doBeside()
- {
- UltraGridRow uRow = this.ultraGrid1.ActiveRow;
- if (uRow == null) return;
- //if (uRow.HasChild())
- //{
- // return;
- //}
- ArrayList list = new ArrayList();
- list.Add(uRow.Cells["Furnaceno"].Text);
- list.Add(uRow.Cells["Sequenceno"].Text);
- list.Add(uRow.Cells["StoveNo"].Text);
- list.Add(uRow.Cells["JudgeStoveNoSeq"].Text);
- //DataTable ds = ServerHelper.GetData("Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.doQueryOffline", new object[] { list }, ob);
- //if (int.Parse(ds.Rows[0][0].ToString()) > 0)
- //{
- // MessageUtil.ShowTips("还存在待处理坯子,不允许结炉!");
- // return;
- //}
- DataTable dd = ServerHelper.GetData("Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.doQueryPlnSteeOrd", new object[] { list }, ob);
- if (!dd.Rows[0]["CCM_STATE"].ToString().Equals("10"))
- {
- MessageUtil.ShowTips("执行状态不是切割完成,不允许结炉!");
- return;
- }
- SaveData();
- int count = ServerHelper.SetData("Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.doBaside", new object[] { list,this.UserInfo.GetUserOrder(),this.UserInfo.GetUserGroup() }, ob);
- if (count > 0)
- {
- QuerySinglePlan();
- MessageUtil.ShowTips("结炉成功!");
- }
- }
- /// <summary>
- /// 结炉回退
- /// </summary>
- private void doBesideBack()
- {
- UltraGridRow uRow = this.ultraGrid1.ActiveRow;
- if (uRow == null) return;
- //if (uRow.HasChild())
- //{
- // return;
- //}
- ArrayList list = new ArrayList();
- list.Add(uRow.Cells["Furnaceno"].Text);
- list.Add(uRow.Cells["Sequenceno"].Text);
- list.Add(uRow.Cells["StoveNo"].Text);
- list.Add(uRow.Cells["JudgeStoveNoSeq"].Text);
- DataTable ds = ServerHelper.GetData("Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.doQueryPlnSteeOrd", new object[] { list }, ob);
- if (!ds.Rows[0]["CCM_STATE"].ToString().Equals("20"))
- {
- MessageUtil.ShowTips("执行状态不是表检完成,不允许结炉回退!");
- return;
- }
- DataTable dt = ServerHelper.GetData("Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.doQueryEntrust", new object[] { list }, ob);
- if (dt.Rows.Count > 0)
- {
- MessageUtil.ShowTips("已有进行委外加工委托,不允许结炉回退!");
- return;
- }
- DataTable dd = ServerHelper.GetData("Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.doQueryStlLgProcess", new object[] { list }, ob);
- if (dd.Rows.Count > 0)
- {
- MessageUtil.ShowTips("已有进行表检委托,不允许结炉回退!");
- return;
- }
- int count = ServerHelper.SetData("Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.doBasideBack", new object[] { list }, ob);
- if (count > 0)
- {
- QuerySinglePlan();
- MessageUtil.ShowTips("结炉回退成功!");
- }
- }
- private void chkFurnace_CheckedChanged(object sender, EventArgs e)
- {
- this.txtFurnace.Enabled = this.chkFurnace.Checked;
- }
- private void chkRegTime_CheckedChanged(object sender, EventArgs e)
- {
- this.RegStartTime.Enabled = this.RegEndTime.Enabled = this.chkRegTime.Checked;
- }
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
- UltraGridRow uRow = this.ultraGrid1.ActiveRow;
- //if (uRow.HasChild())
- //{
- // return;
- //}
- if (uRow == null)
- {
- return;
- }
- ArrayList list = new ArrayList();
- DataTable ds = new DataTable();
- ds.Columns.Add("STOVE_NO");
- ds.Columns.Add("JUDGE_STOVE_NO");
- ds.Columns.Add("FLAG_STOVE_NO");
- ds.Columns.Add("MATERIAL_NAME");
- ds.Columns.Add("GRADENAME");
- ds.Columns.Add("DIAMETER");
- ds.Columns.Add("LEN_GP_SINGLE");
- ds.Columns.Add("CUT_NUM_GP");
- ds.Columns.Add("CAST_NO");
- ds.Columns.Add("FLOWNO");
- ds.Columns.Add("TOT_MUM_M");
- ds.Columns.Add("TOT_WEIGHT_M");
- DataRow dr = ds.NewRow();
- object[] obj = { uRow.Cells["StoveNo"].Text, uRow.Cells["JudgeStoveNo"].Text, uRow.Cells["FlagStoveNo"].Text, uRow.Cells["MaterialName"].Text, uRow.Cells["Gradename"].Text,uRow.Cells["Diameter"].Text, uRow.Cells["LenGpSingle"].Text, uRow.Cells["CutNumGp"].Text, uRow.Cells["CastNo"].Text, uRow.Cells["Flowno"].Text, uRow.Cells["TotMumM"].Text, uRow.Cells["TotWeightM"].Text };
- dr.ItemArray = obj;
- ds.Rows.Add(dr);
- if (ds.Rows.Count > 0)
- {
- GridEdit(ds);
- }
- list.Add(uRow.Cells["Furnaceno"].Text);
- list.Add(uRow.Cells["Sequenceno"].Text);
- list.Add(uRow.Cells["StoveNo"].Text);
- list.Add(uRow.Cells["JudgeStoveNoSeq"].Text);
- doQuerySurFace(list);
- //DataTable resultDt = ServerHelper.GetData("Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.doQueryResult", new object[] { list }, ob);
- //if (resultDt.Rows.Count > 0)
- //{
- // resultGridEdit(resultDt);
- //}
-
- }
- private void ultraGrid3_AfterRowActivate(object sender, EventArgs e)
- {
- UltraGridRow uRow = this.ultraGrid3.ActiveRow;
- if (uRow == null) return;
- ArrayList parm = new ArrayList();
- parm.Add(uRow.Cells["Furnaceno"].Text);
- parm.Add(uRow.Cells["Sequenceno"].Text);
- parm.Add(uRow.Cells["StoveNo"].Text);
- parm.Add(uRow.Cells["JudgeStoveNoSeq"].Text);
- doQueryRack(parm);//查询管坯队列
- }
- /// <summary>
- /// 查询表检实绩
- /// </summary>
- /// <param name="list"></param>
- private void doQuerySurFace(ArrayList list)
- {
- this.surfaceResult1.clear();
- StlLgProgrrssEntitybindingSource.Clear();
- List<StlLgSurfaceM1Entity> listSource = EntityHelper.GetData<StlLgSurfaceM1Entity>(
- "Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.doQueryResult", new object[] { list }, this.ob);
- StlLgSurfaceMEntitybindingSource.DataSource = listSource;
- if (listSource.Count()>0)
- {
- this.surfaceResult1.Value = listSource[0];
- }
-
- }
- private void doQueryRack(ArrayList list)
- {
- List<StlLgProgrrssEntity> listSource = EntityHelper.GetData<StlLgProgrrssEntity>(
- "Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.doQueryRack", new object[] { list }, this.ob);
- StlLgProgrrssEntitybindingSource.DataSource = listSource;
-
- foreach (UltraGridRow ugr in this.ultraGrid2.Rows)
- {
- if (ugr != null)
- {
- switch (ugr.Cells["Status"].Value.ToString())
- {
- case "剔除":
- ugr.Appearance.BackColor = Color.Yellow;
- break;
- case"待处理":
- ugr.Appearance.BackColor = Color.YellowGreen;
- break;
- case"委外废":
- ugr.Appearance.BackColor = Color.Yellow;
- break;
- }
-
- }
-
- }
- }
- /// <summary>
- /// 显示实绩信息
- /// </summary>
- private void resultGridEdit(DataTable resultDt)
- {
- //QcmLgSurfaceM1Entity qcmSurfaceM = new QcmLgSurfaceM1Entity();
- qcmSurfaceM = BaseMethod.GetTableToEntity(resultDt, qcmSurfaceM);
- this.surfaceResult1.Value = qcmSurfaceM;
- }
- /// <summary>
- /// 显示炉信息
- /// </summary>
- /// <param name="ds"></param>
- private void GridEdit(DataTable ds)
- {
- DataRow row = ds.Rows[0];
- this.planInfomation1.Value.StoveNo = row["STOVE_NO"].ToString();//熔炼炉号
- this.planInfomation1.Value.JudgeStoveNo = row["JUDGE_STOVE_NO"].ToString();//判定炉号
- this.planInfomation1.Value.MaterialName = row["MATERIAL_NAME"].ToString();//物料描述
- this.planInfomation1.Value.Diameter = row["DIAMETER"].ToString3();//直径
- this.planInfomation1.Value.Gradename = row["GRADENAME"].ToString();//钢种
- //this.planInfomation1.Value.LengthM = decimal.Parse(row["LENGTH_M"].ToString3());//总长度
- this.planInfomation1.Value.LenGpSingle = decimal.Parse(row["LEN_GP_SINGLE"].ToString3());//单倍坯长
- this.planInfomation1.Value.CutNumGp = decimal.Parse(row["CUT_NUM_GP"].ToString3());//倍尺数
- this.planInfomation1.Value.FlagStoveNo = row["FLAG_STOVE_NO"].ToString();
- this.planInfomation1.Value.CastNo = row["CAST_NO"].ToString();
- this.planInfomation1.Value.Flowno = row["FLOWNO"].ToString();
- this.planInfomation1.Value.TotMumM = decimal.Parse(row["TOT_MUM_M"].ToString3());
- this.planInfomation1.Value.TotWeightM = decimal.Parse(row["TOT_WEIGHT_M"].ToString3());
- this.planInfomation1.UpdateData();
- }
- private string[] arr = null;
- private void FrmStuffSurfaceResult_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);//当月最后一天
- this.RegStartTime.Value = DateTime.Parse(dt1.ToString("yyyy-MM-dd") + " 00:00:00");
- this.RegEndTime.Value = DateTime.Parse(dt2.ToString("yyyy-MM-dd") + " 23:59:59");
- //EntityHelper.ShowGridCaption<PlnSteelforfurnaceEntity1>(ultraGrid1.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<PlnSteelforOrdEntity>(ultraGrid1.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<StlLgProgrrssEntity>(ultraGrid2.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<StlLgSurfaceM1Entity>(ultraGrid3.DisplayLayout.Bands[0]);
- arr = BaseMethod.InitLgPermissions(this.ValidDataPurviewIds,"B", this.ob);
- getPlineCode();
- }
- /// <summary>
- /// 获取产线
- /// </summary>
- private void getPlineCode()
- {
- PlineCode = ClsLoad.GetPCode(UserInfo.GetDepartment(), ob);
- }
- private void ultraGrid2_ClickCellButton(object sender, CellEventArgs e)
- {
- this.ultraGrid2.UpdateData();
- UltraGridRow uRow1 = this.ultraGrid1.ActiveRow;
- UltraGridRow uRow = this.ultraGrid2.ActiveRow;
- ArrayList list = new ArrayList();
- list.Add(uRow.Cells["Furnaceno"].Text);
- list.Add(uRow.Cells["Sequenceno"].Text);
- list.Add(uRow.Cells["StoveNo"].Text);
- list.Add(uRow.Cells["JudgeStoveNoSeq"].Text);
- DataTable dt = ServerHelper.GetData("Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.doQueryPlanStaus", new object[] { list }, ob);
- if (int.Parse(dt.Rows[0][0].ToString()) >= 20)
- {
- MessageUtil.ShowTips("表检已结炉,不允许进行离线、剔废操作!");
- return;
- }
- string matNo = uRow.Cells["MatNo"].Text;
- DataTable ds = ServerHelper.GetData("Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.doQueryRackStaus", new object[] { list,matNo }, ob);
- string staus = ds.Rows[0][0].ToString();
- int count = 0;
- StlLgProgrrssEntity qcmLgProcessTity = (StlLgProgrrssEntity)uRow.ListObject;
- //qcmLgProcessTity.PlineCode = PlineCode;
- qcmLgProcessTity.ColUser = UserInfo.GetUserName();
- qcmLgProcessTity.ColShift = UserInfo.GetUserOrder();
- qcmLgProcessTity.ColGroup = UserInfo.GetUserGroup();
- qcmLgProcessTity.Standardremak = uRow1.Cells["OrderNo"].Text.Trim();
- qcmLgProcessTity.ScrapReason = uRow.Cells["ScrapReason"].Text;
- string qcmProcessTity = JSONFormat.Format(qcmLgProcessTity);
- if (e.Cell.Column.Key == "Scrap")
- {
- if (staus != "0")
- {
- MessageUtil.ShowTips("此坯已不是合格坯,不能进行剔除!");
- return;
- }
- else
- {
- if (uRow.Cells["ScrapReason"].Text == "")
- {
- MessageUtil.ShowTips("请选择剔除原因!");
- return;
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult";
- ccp.MethodName = "updateRackStaus";
- ccp.ServerParams = new object[] { qcmProcessTity, "2", UserInfo.GetUserName(), uRow1.Cells["EfPlineCode"].Text,uRow1.Cells["EfPlineName"].Text };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("剔除成功!"))
- {
- doQueryRack(list);//查询管坯队列
- }
-
- }
- //count = ServerHelper.SetData("Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.updateRackStaus", new object[] { matNo, "2", uRow.Cells["ScrapReason"].Text, uRow.Cells["StoveNo"].Text, uRow.Cells["JudgeStoveNoSeq"].Text, uRow.Cells["Furnaceno"].Text, uRow.Cells["Sequenceno"].Text }, ob);
- //doQueryRack(list);//查询管坯队列
- }
- }
- else if (e.Cell.Column.Key == "ScrapBack")
- {
- if (staus != "2")
- {
- MessageUtil.ShowTips("此坯不是废品坯,不能进行剔除回退!");
- return;
- }
- else
- {
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult";
- ccp.MethodName = "updateRackStaus";
- ccp.ServerParams = new object[] { qcmProcessTity, "0", UserInfo.GetUserName(), uRow1.Cells["EfPlineCode"].Text, uRow1.Cells["EfPlineName"].Text };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("剔除成功!"))
- {
- doQueryRack(list);//查询管坯队列
- }
-
- }
- //count = ServerHelper.SetData("Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.updateRackStaus", new object[] { matNo, "0", "", uRow.Cells["StoveNo"].Text, uRow.Cells["JudgeStoveNoSeq"].Text, uRow.Cells["Furnaceno"].Text, uRow.Cells["Sequenceno"].Text }, ob);
- //doQueryRack(list);//查询管坯队列
- }
- }
- else if (e.Cell.Column.Key == "Alarm")
- {
- if (staus != "0")
- {
- MessageUtil.ShowTips("此坯已不是合格坯,不能进行离线操作!");
- return;
- }
- else
- {
- if (uRow.Cells["ScrapReason"].Text == "")
- {
- MessageUtil.ShowTips("请选择离线品中的废品原因!");
- return;
- }
- if (uRow.Cells["ScrapReasonNum"].Text == "")
- {
- MessageUtil.ShowTips("请选择离线品中的废的单倍坯支数!");
- return;
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult";
- ccp.MethodName = "insertOffine";
- ccp.ServerParams = new object[] { qcmProcessTity,UserInfo.GetUserName() };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("离线成功!"))
- {
- doQueryRack(list);//查询管坯队列
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
-
-
- }
- }
- else if (e.Cell.Column.Key == "AlarmBack")
- {
- if (staus != "1")
- {
- MessageUtil.ShowTips("此坯不是待处理坯,不能进行离线回退!");
- return;
- }
- else
- {
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult";
- ccp.MethodName = "insertOffineBack";
- ccp.ServerParams = new object[] { qcmProcessTity };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("离线回退成功!"))
- {
- doQueryRack(list);//查询管坯队列
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- }
- }
- private void ultraTextEditor1_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
- {
- this.ultraGrid2.UpdateData();
- UltraGridRow uRow = this.ultraGrid2.ActiveRow;
- if (uRow == null)
- {
- return;
- }
- if (!StringUtil.IsInt(uRow.Cells["ScrapLen"].Text.Trim().ToString3()))
- {
- MessageUtil.ShowTips("废品长度请输入正整数!");
- return;
- }
- if (uRow.Cells["ScrapReason"].Text.Trim().Equals(""))
- {
- MessageUtil.ShowTips("请选择废品原因!");
- return;
- }
- if(!uRow.Cells["Status"].Text.Trim().Equals("合格"))
- {
- MessageUtil.ShowTips("不是合格坯不允许记录废品长度!");
- return;
- }
- ArrayList list = new ArrayList();
- list.Add(uRow.Cells["Furnaceno"].Text);
- list.Add(uRow.Cells["Sequenceno"].Text);
- list.Add(uRow.Cells["StoveNo"].Text);
- list.Add(uRow.Cells["JudgeStoveNoSeq"].Text);
- StlLgProgrrssEntity stlLgProgss = (StlLgProgrrssEntity)uRow.ListObject;
- string stlProgssEntity = JSONFormat.Format(stlLgProgss);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult";
- ccp.MethodName = "saveScrapLen";
- ccp.ServerParams = new object[] { stlProgssEntity };
- ccp = ob.ExecuteNonQuery(ccp,CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("保存成功!"))
- {
- doQueryRack(list);//查询管坯队列
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- private void txtFurnace_KeyDown(object sender, KeyEventArgs e)
- {
- if(e.KeyValue == 13)
- {
- QuerySinglePlan();
- }
-
- }
- private void ultraGrid2_InitializeRow(object sender, InitializeRowEventArgs e)
- {
- Infragistics.Win.ValueList valueList = new Infragistics.Win.ValueList();
- if (e.Row.Cells["FixNum"].Text.ToString() != "")
- {
- int ScrapDBNum = int.Parse(e.Row.Cells["FixNum"].Text.ToString3()) -1;
- valueList.ValueListItems.Add("", "");
- for (int i = 0; i < ScrapDBNum; i++)
- {
- valueList.ValueListItems.Add((i + 1).ToString(), (i + 1).ToString());
- }
- }
- else
- {
- valueList.ValueListItems.Add("0", "0");
- }
- e.Row.Cells["ScrapReasonNum"].ValueList = valueList;
- }
-
- }
- }
|