using com.steering.mes.mcp.entity; using Core.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.Mcp.Control; 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.Text; using System.Windows.Forms; namespace Core.StlMes.Client.Mcp.Report { public partial class FrmCouplingPhosphReport : FrmBase { private string SlGx = "";//工序代码 private string SlGxname = "";//工序名称 private string departm = ""; private string plineCode = ""; private string[] plineCodes = new string[] { }; public FrmCouplingPhosphReport() { InitializeComponent(); this.IsLoadUserView = true; } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "DoQuery": QuerySinglePlan();//外观检验 break; case "Confirm": confirm();//确认 break; case "CancelConfirm": cancelConfirm(); break; case "Export": GridHelper.ulGridToExcel(ultraGrid4, "接箍磷化台账"); break; case "DoAudite": DoAudite();//核对 break; case "DoClose": this.Close(); break; } } /// /// 取消确认 /// private void cancelConfirm() { ultraGrid4.UpdateData(); UltraGridRow uRow = this.ultraGrid4.ActiveRow; if (uRow == null) { MessageUtil.ShowTips("无数据!"); return; } ArrayList list1 = new ArrayList(); int UpdaCount = 0; foreach (UltraGridRow ugr in ultraGrid4.Rows) { if (Convert.ToBoolean(ugr.Cells["CHK"].Text) == true) { if (ugr.Cells["CONFIRM"].Value.ToString().Equals("未确认")) { MessageUtil.ShowTips("选中有没确认实绩,不允许取消确认!"); return; } UpdaCount += 1; ArrayList list = new ArrayList(); list.Add(ugr.Cells["RESULT_NO"].Text.ToString()); list.Add(UserInfo.GetUserName()); list.Add(DateTime.Now.ToString()); list1.Add(list); } } if (UpdaCount == 0) { MessageUtil.ShowTips("请选择磷化实绩数据!"); return; } 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.coup.PhosphateResultService"; ccp.MethodName = "getCancelConfirm"; ccp.ServerParams = new object[] { list1 }; ccp = ob.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 confirm() { ultraGrid4.UpdateData(); UltraGridRow uRow = this.ultraGrid4.ActiveRow; if (uRow == null) { MessageUtil.ShowTips("无数据!"); return; } ArrayList list1 = new ArrayList(); int UpdaCount = 0; foreach (UltraGridRow ugr in ultraGrid4.Rows) { if (Convert.ToBoolean(ugr.Cells["CHK"].Text) == true) { if (ugr.Cells["CONFIRM"].Value.ToString().Equals("已确认")) { MessageUtil.ShowTips("选中有已确认实绩,不允许再次确认!"); return; } UpdaCount += 1; ArrayList list = new ArrayList(); list.Add(ugr.Cells["RESULT_NO"].Text.ToString()); list.Add(UserInfo.GetUserName()); list.Add(DateTime.Now.ToString()); list1.Add(list); } } if (UpdaCount == 0) { MessageUtil.ShowTips("请选择磷化实绩数据!"); return; } 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.coup.PhosphateResultService"; ccp.MethodName = "getConfirm"; ccp.ServerParams = new object[] { list1 }; ccp = ob.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 DoAudite() { ultraGrid4.UpdateData(); UltraGridRow row = ultraGrid4.ActiveRow; if (row == null) { MessageUtil.ShowTips("无上料信息!"); return; } ArrayList list1 = new ArrayList(); foreach (UltraGridRow item in ultraGrid4.Rows) { if (Convert.ToBoolean(item.Cells["CHK"].Text) == true) { ArrayList list = new ArrayList(); list.Add(item.Cells["RESULT_NO"].Text.ToString()); list.Add(item.Cells["WO_ID"].Text.ToString()); list.Add(item.Cells["JUDGE_STOVE_NO"].Text.ToString()); list.Add(item.Cells["WO_ID"].Text.ToString()); list1.Add(list); } } 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.Report.FrmJGMatNoReport"; ccp.MethodName = "doAudite"; ccp.ServerParams = new object[] { list1, SlGx }; 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) return; MessageUtil.ShowTips(ccp.ReturnInfo); if (ccp.ReturnInfo.Equals("核对成功!")) { QuerySinglePlan(); } } /// /// 台账查询 /// private void QuerySinglePlan() { string startTim = ""; string endTim = ""; string shift = ""; //班次 string group = ""; //班组 string judgeNo = "";//炉号 string batchNo = "";//批号 string specNo = "";//规格 string steelNo = "";//钢级 string modelNo = "";//扣型 #region if (this.chkOrder.Checked && this.cmbOrder.Text.Trim() != "") { shift = this.cmbOrder.Value.ToString(); } if (this.checkjudge.Checked && this.txtjudge.Text.Trim() != "") { judgeNo = this.txtjudge.Text.Trim().ToString(); } if (this.checkbatch.Checked && this.txtbatch.Text.Trim() != "") { batchNo = this.txtbatch.Text.Trim().ToString(); } if (this.checkspec.Checked && this.txtspec.Text.Trim() != "") { specNo = this.txtspec.Text.Trim().ToString(); } if (this.checksteel.Checked && this.txtsteel.Text.Trim() != "") { steelNo = this.txtsteel.Text.Trim().ToString(); } if (this.checkmodel.Checked && this.txtmodel.Text.Trim() != "") { modelNo = this.txtmodel.Text.Trim().ToString(); } if (chkTim.Checked) { if (DateTime.Parse(RegStartTime.Value.ToString()) > DateTime.Parse(RegEndTime.Value.ToString())) { MessageUtil.ShowTips("选择时间区间错误,请重新选择!"); return; } else { startTim = this.RegStartTime.Value.ToString("yyyy-MM-dd HH:mm:ss"); endTim = this.RegEndTime.Value.ToString("yyyy-MM-dd HH:mm:ss"); } } if (this.chkGroup.Checked && this.cmbGroup.Text.Trim() != "") { group = this.cmbGroup.Value.ToString(); } #endregion DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmJGMatNoReport.doQueryPhosphResult", new object[] { judgeNo, batchNo, specNo, steelNo, modelNo, shift, group, plineCode == "" ? plineCodes : new string[] { plineCode }, startTim, endTim }, this.ob); GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true); foreach (UltraGridRow item in ultraGrid4.Rows) { if (item.Cells["CONFIRM"].Text == "已确认") { item.Appearance.BackColor = Color.Yellow; } } } private void FrmCouplingPhosphReport_Load(object sender, EventArgs e) { RegStartTime.Value = DateTime.Parse(DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd 00:00")); RegEndTime.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 23:59")); departm = UserInfo.GetDepartment(); //plineCode = YdmBaseClass.GetPCode(departm, this.ob);//获取 用户 对应的产线 plineCodes= comm.InitDropPlineCodePower("H", txt_PlinCode, this.ValidDataPurviewIds, this.ob); txt_PlinCode.SelectedIndex = 0; YdmBaseClass.SetComboItemHeight(cmbOrder); YdmBaseClass.SetComboItemHeight(cmbGroup); //获取工序 DataTable dt2 = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryGX", new object[] { "700310" }, this.ob); if (dt2.Rows.Count > 0) { SlGx = dt2.Rows[0]["BASECODE"].ToString(); SlGxname = dt2.Rows[0]["BASENAME"].ToString(); } QuerySinglePlan(); } private void chkStarts_CheckedChanged(object sender, EventArgs e) { if (chkTim.Checked) { RegStartTime.Enabled = true; RegEndTime.Enabled = true; } else { RegStartTime.Enabled = false; RegEndTime.Enabled = false; } if (chkOrder.Checked) { cmbOrder.Enabled = true; } else { cmbOrder.Enabled = false; } if (chkGroup.Checked) { cmbGroup.Enabled = true; } else { cmbGroup.Enabled = false; } if (checkjudge.Checked) { txtjudge.Enabled = true; } else { txtjudge.Enabled = false; } if (checkbatch.Checked) { txtbatch.Enabled = true; } else { txtbatch.Enabled = false; } if (checkspec.Checked) { txtspec.Enabled = true; } else { txtspec.Enabled = false; } if (checksteel.Checked) { txtsteel.Enabled = true; } else { txtsteel.Enabled = false; } if (checkmodel.Checked) { txtmodel.Enabled = true; } else { txtmodel.Enabled = false; } } private void txt_PlinCode_TextChanged(object sender, EventArgs e) { plineCode = txt_PlinCode.SelectedItem.DataValue.ToString(); } } }