| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301 |
- 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 FrmCouplingInspectReport : FrmBase
- {
- private string SlGx = "";//工序代码
- private string SlGxname = "";//工序名称
- private string departm = "";
- private string plineCode = "";
- private string[] plineCodes = new string[] { };
- public FrmCouplingInspectReport()
- {
- 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 "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.FrmInspection";
- 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.FrmInspection";
- 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();
- }
- }
- }
- /// <summary>
- /// 台账查询
- /// </summary>
- 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.doQueryInspectResult", 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 FrmCouplingInspectReport_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[] { "700307" }, 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();
- }
- }
- }
|