| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Drawing;
- using System.Linq;
- using System.Windows.Forms;
- using com.steering.mes.mcp.entity;
- using Core.Mes.Client.Comm.Format;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.Mcp.Control.Common;
- using Core.StlMes.Client.Mcp.Control.Entity;
- using Core.StlMes.Client.Mcp.Treatment.HeatTreatment;
- using CoreFS.CA06;
- using Infragistics.Win;
- using Infragistics.Win.UltraWinGrid;
- namespace Core.StlMes.Client.Mcp.Treatment
- {
- public partial class FrmHttLoadingResultEntity : FrmHttBase
- {
- private string plineCode = "";
- private string[] plineCodes;
- private int ProcessSeq = 1;
- public FrmHttLoadingResultEntity()
- {
- InitializeComponent();
- IsLoadUserView = true;
- }
- private string SlGx
- {
- get { return "600201"; }
- }
- protected override void OnLoad(EventArgs e)
- {
- base.OnLoad(e);
- base.ultraGrid1.DisplayLayout.Bands[0].Columns["ProCount"].Header.Caption = "上料支";
- base.ultraGrid1.DisplayLayout.Bands[0].Columns["ProWeight"].Header.Caption = "上料吨";
- base.ultraGrid1.DisplayLayout.Bands[0].Columns["PerStatus"].Header.Caption = "库存位置";
- httInstructionCardControl1.DisableFiltering();
- EntityHelper.ShowGridCaption<HttLoadingResultEntity>(LoadGrid.DisplayLayout.Bands[0]);
- comm.RefreshAndAutoSize(LoadGrid);
- comm.setOtherColumnReadOnly(LoadGrid,new string[]{});
- LoadGrid.DisplayLayout.Override.AllowRowFiltering = DefaultableBoolean.False;
- foreach (UltraGridColumn ugc in LoadGrid.DisplayLayout.Bands[0].Columns)
- {
- ugc.SortIndicator = SortIndicator.Disabled;
- }
- Font f1 = new System.Drawing.Font("宋体", 11F, System.Drawing.FontStyle.Bold);
- httInstructionCardControl1.SetFont(f1);
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- //base.ToolBar_Click(sender, ToolbarKey);
- switch (ToolbarKey)
- {
- case "DoQuery":
- QuerySinglePlan();
- break;
- case "DoLoading":
- DoSave();
- break;
- case "DoReturn":
- DoReturn();
- break;
- case "DoBeside":
- DoBeside();
- break;
- case "CelBeside":
- DoCelBeside();
- break;
- case "DoClose":
- Close();
- break;
- case "doPrint":
- DoTransferPrint();
- break;
- case "Export":
- Mes.Client.Comm.Globals.ulGridToExcel(ultraGrid1, Text);
- break;
- }
- }
- /// <summary>
- /// 传递卡打印
- /// </summary>
- private void DoTransferPrint()
- {
-
- if (ActiveRow == null)
- {
- MessageUtil.ShowTips("请选择要打印的炉信息!");
- return;
- }
- var strurl = "";
- if (ActiveRow.PlineCode.Equals("C021")) //镦粗
- strurl =
- "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=MchDeliveryCard.cpt&T.HEAT_PLAN_NO=" +
- ActiveRow.HeatPlanNo + "&T.JUDGE_STOVE_NO=" + ActiveRow.JudgeStoveNo + "&T.PLINE_CODE=" + ActiveRow.PlineCode + "&T2.BATCH_GROUD_NO=" +
- ActiveRow.BatchGroudNo + "&TT.STATION_DESC='上料'";
- else
- strurl =
- "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=MchDeliveryCard.cpt&T.HEAT_PLAN_NO=" +
- ActiveRow.HeatPlanNo + "&T.JUDGE_STOVE_NO=" + ActiveRow.JudgeStoveNo + "&T.PLINE_CODE" + ActiveRow.PlineCode + "&T2.BATCH_GROUD_NO=" +
- ActiveRow.BatchGroudNo + "&TT.STATION_DESC='上料'";
- var fre = new FrmRepExcel(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 DoCelBeside()
- {
- if (ActiveRow == null) return;
- var list = new ArrayList();
- list.Add(ActiveRow.HeatPlanNo);
- list.Add(ActiveRow.PlineCode);
- list.Add(SlGx);
- if (MessageUtil.ShowYesNoAndQuestion("是否撤销结炉?") == DialogResult.No)
- return;
- var ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.mcp.heatTreatment.HttLoadingService";
- ccp.MethodName = "undoBeside";
- ccp.ServerParams = new object[] {list};
- ccp = ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("撤销结炉成功!"))
- {
- QuerySinglePlan();
- }
- }
- }
- /// <summary>
- /// 工序结炉
- /// </summary>
- private void DoBeside(bool ask = true)
- {
- if (ActiveRow == null)
- {
- MessageUtil.ShowTips("请选择需要结炉的炉计划!");
- return;
- }
- var list = new ArrayList();
- list.Add(ActiveRow.HeatPlanNo);
- list.Add(ActiveRow.PlineCode);
- list.Add(SlGx);
- list.Add(ActiveRow.JudgeStoveNo);
- list.Add(ActiveRow.BatchNo);
- list.Add(ActiveRow.BatchGroudNo);
- list.Add(ActiveRow.JugdeApplyCode);
- list.Add(ActiveRow.NextProcessCode);
- if (ask)
- if (MessageUtil.ShowYesNoAndQuestion("是否结炉?") == DialogResult.No)
- {
- return;
- }
- var ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.mcp.heatTreatment.HttLoadingService";
- ccp.MethodName = "updateDoBeside";
- ccp.ServerParams = new object[] {list};
- ccp = ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("结炉成功!"))
- {
- if (ask)
- MessageUtil.ShowTips(ccp.ReturnInfo);
- QuerySinglePlan();
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- /// <summary>
- /// 简单查询
- /// </summary>
- private void QuerySinglePlan()
- {
- Query(plineCodes);
- }
- //查询管号队列
- private void QueryPortVrp(PlnZyRclCEntity PlnZyRclCEntity)
- {
- portHttBatchControl1.Query(PlnZyRclCEntity.HeatPlanNo, PlnZyRclCEntity.PlineCode, ProcessSeq,ActiveRow.GowhereCode);
- httInstructionCardControl1.PortHttBatchSampleResultEntitys = portHttBatchControl1.datas;
- }
-
- /// <summary>
- /// 根据计划号查询上料实绩
- /// </summary>
- /// <param name="planNo"></param>
- public void GetLoadResult(string heatNo,string sqe)
- {
- List<HttLoadingResultEntity> list =
- EntityHelper.GetData<HttLoadingResultEntity>(
- "com.steering.mes.mcp.heatTreatment.HttLoadingService.getLoadResult", new object[] { heatNo, sqe }, ob);
- httLoadingResultEntityBindingSource.DataSource = list;
- comm.RefreshAndAutoSize(LoadGrid);
- LoadGrid.ActiveRow = null;
- }
- /// <summary>
- /// 初始化控件
- /// </summary>
- private void initControl()
- {
- if (ActiveRow == null) return;
- var result = new HttLoadingResultEntity()
- {
- HeatPlanNo = ActiveRow.HeatPlanNo,
- FailNum = 0,
- LoadShift = UserInfo.GetUserOrder(),
- LoadGroup = UserInfo.GetUserGroup(),
- LoadUser = UserInfo.GetUserName(),
- LoadTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
-
- ProcessSeq = ProcessSeq,
- ZyBatchId = ActiveRow.ZyBatchId,
- IfMonitorRcl = ActiveRow.IfMonitor,
- PrdcrNo =ActiveRow.PrdcrNo ,
- ProducerTime = ActiveRow.IfMonitor.Equals("1") ? DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") : null,
- PlineCode = plineCode,
- MatSource = ActiveRow.MatSource
- };
- result.ProcessSeq = result.ProcessSeq ?? 1;
- result.ProNum = ActiveRow.ActCount;
- result.ProWt = ActiveRow.ActWeight;
- httInstructionCardControl1.ActCount = ActiveRow.ActCount??0;
- httInstructionCardControl1.FeedStoveNo = ActiveRow.FeedHeatNo;
- httInstructionCardControl1.BatchNo = ActiveRow.BatchNo;
- httInstructionCardControl1.GroupNo = ActiveRow.BatchGroudNo;
- httInstructionCardControl1.JudgeNo = ActiveRow.JugdeApplyCode;
- httInstructionCardControl1.ShowPro(ActiveRow.IfMonitor.Equals("1"));
- httInstructionCardControl1.Value = result;
- }
- /// <summary>
- /// 上料实绩保存
- /// </summary>
- private void DoSave()
- {
- if (ActiveRow!= null)
- {
- var groupNo = ActiveRow.BatchGroudNo.ToString2();
- var gxh = "0";
-
- var result = httInstructionCardControl1.Value;
- if (result.ProNum==null || result.ProNum ==0)
- {
- MessageUtil.ShowTips("上料支数不能为空或零");
- return;
- }
- if ((result.FailNum == null))
- result.FailNum = 0;
- if (result.ProcessSeq == null) result.ProcessSeq = 1;
-
-
- if (MessageUtil.ShowYesNoAndQuestion("是否上料?") == DialogResult.No)
- return;
- if (result.FailNum != null && result.FailNum > 0 &&
- result.FailNum != httInstructionCardControl1.ScrappedList.Sum(p => p.DefFillNum))
- {
- MessageUtil.ShowTips("废品数据异常,请重新录入");
- return;
- }
- var ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.mcp.heatTreatment.HttLoadingService";
- ccp.MethodName = "saveHttLoadingResult";
- ccp.ServerParams = new object[] {JSONFormat.Format(result), ActiveRow.HeatPlanSqe, SlGx, ActiveRow.PlineCode, groupNo, new List<string>(),
- httInstructionCardControl1.ScrappedList.Select(JSONFormat.Format).ToList()};
- ccp = ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("上料成功!"))
- {
- QuerySinglePlan();
- doOver();
- }
- }
- }
- //}
- }
- private void doOver()
- {
- if (ActiveRow == null) return;
- var dt1 = ServerHelper.GetData("com.steering.mes.mcp.heatTreatment.HttLoadingService.getquerymaternum",
- new object[] { ActiveRow.HeatPlanNo}, ob);
- if (((dt1.Rows[0]["NUM"].ToString() == "0") || (dt1.Rows[0]["WT"].ToString() == "0.000"))&& ((ActiveRow.ProcessSeq??1).ToString3()== httInstructionCardControl1.Value.ProcessSeq.ToString3()))
- if (MessageUtil.ShowYesNoAndQuestion("待上料量或重量为0,是否结炉?") == DialogResult.No)
- return;
- else
- DoBeside(false);
- }
- /// <summary>
- /// 撤销上料
- /// </summary>
- private void DoReturn()
- {
- var Rows = LoadGrid.ActiveRow;
- if (Rows == null)
- {
- if (LoadGrid.Rows.Count <= 0) return;
- Rows = LoadGrid.Rows[0];
- }
- if (ActiveRow != null)
- {
- var result = Rows.ListObject as HttLoadingResultEntity;
- //查询是否存在上料之后的数据
- var dt = ServerHelper.GetData("com.steering.mes.mcp.heatTreatment.HttLoadingService.getQueryInfoPlan",
- new object[] { SlGx, ActiveRow.HeatPlanNo }, ob);
- if (dt.Rows.Count > 0)
- if (MessageUtil.ShowYesNoAndQuestion("存在上料后工序,是否继续删除?") == DialogResult.No) return;
- if (MessageUtil.ShowYesNoAndQuestion("是否确认撤销上料?") == DialogResult.No)
- return;
- var ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.mcp.heatTreatment.HttLoadingService";
- ccp.MethodName = "returnHttLoadingResult";
- ccp.ServerParams = new object[]
- {
- JSONFormat.Format(result), ActiveRow.HeatPlanSqe, SlGx,UserInfo.GetUserName(),result==null|| result.ProcessSeq>1?ActiveRow.JudgeStoveNo: ActiveRow.FeedHeatNo
- };
- ccp = ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("删除上料成功!"))
- {
- QuerySinglePlan();
- }
- }
- }
- }
-
- private void FrmHttLoading_Load(object sender, EventArgs e)
- {
- plineCodes = comm.GetPlineCode(ValidDataPurviewIds, "F", ob);
- httInstructionCardControl1.Ob = ob;
- portHttBatchControl1.ob = ob;
- portHttBatchControl1.SetOfflineCode(new string[] { SlGx });
- httInstructionCardControl1.Value = new HttLoadingResultEntity() { PlineCode = plineCode };
- Gx = SlGx;
- //QuerySinglePlan();
- //initControl();
- }
- private void LoadGrid_AfterRowActivate(object sender, EventArgs e)
- {
- var urg = LoadGrid.ActiveRow;
- if (urg == null) return;
- httInstructionCardControl1.Value = urg.ListObject as HttLoadingResultEntity;
- }
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
- plineCode = ActiveRow.PlineCode;
- ProcessSeq = (int) (ActiveRow.RealProcessSeq ?? 1);
- this.GetLoadResult(ActiveRow.HeatPlanNo,ActiveRow.HeatPlanSqe);
- QueryPortVrp(ActiveRow);
- initControl();
- }
- private void uteCard_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
- {
- HttLoadingResultEntity entity = LoadGrid.ActiveRow.ListObject as HttLoadingResultEntity;
- string strurl =
- "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepHttDeliveryCard.cpt&op=view&RESULT_NO=" +
- entity.ResultNo;
- var fre = new FrmRepExcel(ob, strurl);
- fre.AutoSize = true;
- fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width,
- Screen.PrimaryScreen.WorkingArea.Height);
- fre.WindowState = FormWindowState.Maximized;
- fre.Show();
- }
- //工艺文件查询
-
- }
- }
|