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.ZGMil.Entity; using Core.Mes.Client.Comm.Tool; using System.Collections; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Control; using Core.StlMes.Client.ZGMil.ResultConrtrol; using Infragistics.Win.UltraWinGrid; using com.steering.mes.zgmil.entity; using Core.Mes.Client.Comm.Format; namespace Core.StlMes.Client.ZGMil.Report { public partial class FrmRollingReport : FrmBase { public FrmRollingReport() { InitializeComponent(); this.IsLoadUserView = true; } private void FrmRollingReport_Load(object sender, EventArgs e) { RegStartTime.Value = DateTime.Parse(DateTime.Today.AddDays(-1).ToString("yyyy-MM-dd 21:00:00")); RegEndTime.Value = DateTime.Parse(DateTime.Today.ToString("yyyy-MM-dd 20:59:59")); EntityHelper.ShowGridCaption(ultraGrid1.DisplayLayout.Bands[0]); ClsBaseInfo.SetComboItemHeight(cmbOrder); ClsBaseInfo.SetComboItemHeight(cmbGroup); } /// /// 重写基类方法 /// /// /// public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": doQueryData(); break; case "Save": doSave(); break; case "Print": PrintData(); break; case "ExportData": GridHelper.ulGridToExcel(ultraGrid1, "连轧台账"); break; case "Close": this.Close(); break; } } /// /// 打印 /// private void PrintData() { string bc = ""; string bz = ""; string date = this.RegStartTime.Value.ToString("yyyy-MM-dd HH:mm:ss"); string date1 = this.RegEndTime.Value.ToString("yyyy-MM-dd HH:mm:ss"); string plineCode = ""; string departm = ""; string judgeStoveNo = ""; if (chkOrder.Checked && this.cmbOrder.Text != "") { bc = cmbOrder.Value.ToString(); } else { MessageUtil.ShowTips("班次需勾选并且不能为空!"); return; } if (chkGroup.Checked && this.cmbGroup.Text != "") { bz = cmbGroup.Value.ToString(); } else { MessageUtil.ShowTips("班组需勾选并且不能为空!"); return; } if (chkJudgeStoveNo.Checked && uteJudgeStoveNo.Text != "") { judgeStoveNo = uteJudgeStoveNo.Text; } doQueryData(); NativeMethodNew na = new NativeMethodNew(this.ob); departm = UserInfo.GetDepartment(); plineCode = na.GetPCode(departm);//获取 用户 对应的产线 ColUserName colU = new ColUserName(); colU.Ob = this.ob; colU.PlineCode = plineCode; colU.ColGroup = cmbGroup.Value.ToString2(); colU.ColOrder = cmbOrder.Value.ToString2(); colU.JudgeStoveNo = judgeStoveNo; colU.StationId = "3"; if (plineCode.Equals("C017")) { colU.Url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilRollingResult460.cpt&format=pdf&__bypagesize__=false"; } else if(plineCode.Equals("C010")) { colU.Url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilRollingResult168.cpt&format=pdf&__bypagesize__=false"; } else if (plineCode.Equals("C009")) { colU.Url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilRollingResult258.cpt&format=pdf&__bypagesize__=false"; } else if (plineCode.Equals("C008")) { colU.Url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilRollingResult250.cpt&format=pdf&__bypagesize__=false"; } else if (plineCode.Equals("C072")) { colU.Url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilRollingResult508.cpt&__bypagesize__=false"; } colU.StartTim = date; colU.EndTim = date1; colU.StrText = "连轧实绩报表"; colU.Flag = "0"; colU.ShowDialog(); } /// /// 查询 /// private void doQueryData() { string strRegStart = this.RegStartTime.Value.ToString("yyyy-MM-dd HH:mm:ss"); string strEndtim = this.RegEndTime.Value.ToString("yyyy-MM-dd HH:mm:ss"); string strOrder = ""; string strGroup = ""; string JudgeStoveNo = ""; string[] plineCode = null; if (chkOrder.Checked && this.cmbOrder.Text != "") { strOrder = this.cmbOrder.Value.ToString(); } if (chkGroup.Checked && this.cmbGroup.Text != "") { strGroup = this.cmbGroup.Value.ToString(); } if (chkJudgeStoveNo.Checked) { if (uteJudgeStoveNo.Text.Trim() == "") { JudgeStoveNo = ""; } else { JudgeStoveNo = uteJudgeStoveNo.Value.ToString(); } } NativeMethodNew na = new NativeMethodNew(this.ob); plineCode = na.GetPCodePline(this.ValidDataPurviewIds);//获取 用户 对应的产线 ArrayList parm = new ArrayList(); parm.Add(strRegStart); parm.Add(strEndtim); parm.Add(strOrder); parm.Add(strGroup); parm.Add(JudgeStoveNo); //parm.Add(plineCode); List listSource = EntityHelper.GetData( "com.steering.mes.zgmil.report.FrmRollingReport.doQueryData", new object[] { parm,plineCode }, this.ob); MilRollingResultEntity1bindingSource.DataSource = listSource; GridHelper.RefreshAndAutoSize(this.ultraGrid1); } /// /// 修改 /// private void doSave() { this.ultraGrid1.UpdateData(); IQueryable checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'"); if (checkMagRows.Count() == 0) { MessageUtil.ShowTips("请选择需要修改的信息!"); return; } ArrayList parm = new ArrayList(); foreach (UltraGridRow uRow in checkMagRows) { MilRollingResultEntity1 Entity1 = (MilRollingResultEntity1)uRow.ListObject; FeedSawResultEntity matZcTity = new FeedSawResultEntity(); matZcTity.JudgeStoveNo = Entity1.JudgeStoveNo.ToString(); matZcTity.PlineCode = Entity1.PlineCode.ToString(); if (Entity1.ColShift.ToString().Equals("早班")) { matZcTity.ColShift = "1"; } else if (Entity1.ColShift.ToString().Equals("中班")) { matZcTity.ColShift = "2"; } else if (Entity1.ColShift.ToString().Equals("夜班")) { matZcTity.ColShift = "3"; } else if (Entity1.ColShift.ToString().Equals("常白班")) { matZcTity.ColShift = "0"; } else { matZcTity.ColShift = Entity1.ColShift.ToString(); } if (Entity1.ColGroup.ToString().Equals("甲")) { matZcTity.ColGroup = "1"; } else if (Entity1.ColGroup.ToString().Equals("乙")) { matZcTity.ColGroup = "2"; } else if (Entity1.ColGroup.ToString().Equals("丙")) { matZcTity.ColGroup = "3"; } else if (Entity1.ColGroup.ToString().Equals("丁")) { matZcTity.ColGroup = "4"; } else { matZcTity.ColGroup = Entity1.ColGroup.ToString(); } matZcTity.StartTime = Entity1.EndTime.ToString(); matZcTity.ColUser = Entity1.ColUser.ToString(); matZcTity.Remark = "连轧"; string matTity = JSONFormat.Format(matZcTity); parm.Add(matTity); } if (MessageUtil.ShowYesNoAndQuestion("是否确认修改?") == DialogResult.No) return; CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.zgmil.report.FrmFeedSaw"; ccp.MethodName = "doSave"; ccp.ServerParams = new object[] { parm }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("修改成功!")) { doQueryData(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } private void chkOrder_CheckedChanged(object sender, EventArgs e) { this.cmbOrder.Enabled = this.chkOrder.Checked; } private void chkGroup_CheckedChanged(object sender, EventArgs e) { this.cmbGroup.Enabled = this.chkGroup.Checked; } private void chkJudgeStoveNo_CheckedChanged(object sender, EventArgs e) { this.uteJudgeStoveNo.Enabled = this.chkJudgeStoveNo.Checked; } } }