using com.steering.mes.mcp.entity; using Core.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Format; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.Mcp.Control; using CoreFS.CA06; using Infragistics.Win.UltraWinEditors; 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.Mch.MchResult { public partial class FrmMchApply : FrmBase { UltraComboEditor uceLB = new UltraComboEditor();//材料类别 UltraComboEditor uceZT= new UltraComboEditor();//材料状态 UltraComboEditor uceBJ = new UltraComboEditor();//表检结果 UltraComboEditor uceCF = new UltraComboEditor();//成分结果 UltraComboEditor uceXN = new UltraComboEditor();//性能结果 UltraComboEditor uceZHPD = new UltraComboEditor();//综合判定结果 private string manage = ""; //科室id private string manageNmae = ""; //科室名称 private string departm = ""; private string plineCode = ""; public FrmMchApply() { InitializeComponent(); } //private string plineCode = "";//产线 private void FrmMchApply_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.StartTime.Value = DateTime.Parse(dt1.ToString("yyyy-MM-dd") + " 00:00:00"); this.EndTime.Value = DateTime.Parse(dt2.ToString("yyyy-MM-dd") + " 23:59:59"); manageNmae = UserInfo.GetDepartment(); manage = UserInfo.GetDeptid(); departm = UserInfo.GetDepartment(); plineCode = YdmBaseClass.GetPCode(departm, this.ob);//获取 用户 对应的产线 InitBindColumn(); } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": QuerySinglePlan(); break; case "ApplyDec": DoApplyDec(); break; case "UndoApply": DoUndoApply(); break; case "ReturnWt": DoReturnWt(); break; case "TransferPrint": DoTransferPrint(); break; case "CollectedPrint": DoCollectedPrint(); break; case "Close": this.Close(); break; } } private void InitBindColumn() { YdmBaseClass.InitComboEditorWithParm(uceLB, "com.steering.mes.mcp.Mch.FrmMchApply.getProductflag", "BASECODE", this.ob, true,new Object[]{"8014"}); //YdmBaseClass.InitComboEditorWithParm(uceZT, "com.steering.mes.mcp.Mch.FrmMchApply.getProductflag", "BASECODE", this.ob, true, new Object[] { "801501" }); YdmBaseClass.InitComboEditorWithParm(uceBJ, "com.steering.mes.mcp.Mch.FrmMchApply.getProductflag", "BASECODE", this.ob, true, new Object[] { "407406" }); YdmBaseClass.InitComboEditorWithParm(uceCF, "com.steering.mes.mcp.Mch.FrmMchApply.getProductflag", "BASECODE", this.ob, true, new Object[] { "407401" }); YdmBaseClass.InitComboEditorWithParm(uceXN, "com.steering.mes.mcp.Mch.FrmMchApply.getProductflag", "BASECODE", this.ob, true, new Object[] { "407402" }); YdmBaseClass.InitComboEditorWithParm(uceZHPD, "com.steering.mes.mcp.Mch.FrmMchApply.getProductflag", "BASECODE", this.ob, true, new Object[] { "407407" }); YdmBaseClass.BindColumn(uceLB, "PRODUCT_FLAG", this.Controls, ultraGridMat, 0); //YdmBaseClass.BindColumn(uceZT, "MAT_STATUS", this.Controls, ultraGridMat, 0); YdmBaseClass.BindColumn(uceBJ, "VRP_FACE_RESULT_CODE", this.Controls, ultraGridMat, 0); YdmBaseClass.BindColumn(uceCF, "VRP_CHEM_RESULT_CODE", this.Controls, ultraGridMat, 0); YdmBaseClass.BindColumn(uceXN, "VRP_PHY_RESULT_CODE", this.Controls, ultraGridMat, 0); YdmBaseClass.BindColumn(uceZHPD, "VRP_JUDGE_RESULT_CODE", this.Controls, ultraGridMat, 0); //材料状态 this.ultraGridMat.DisplayLayout.ValueLists[0].ValueListItems.Add("80150101", "材料产出等待"); this.ultraGridMat.DisplayLayout.ValueLists[0].ValueListItems.Add("80150102", "材料产出(已判定)"); this.ultraGridMat.DisplayLayout.ValueLists[0].ValueListItems.Add("80150103", "材料已编计划"); this.ultraGridMat.DisplayLayout.ValueLists[0].ValueListItems.Add("80150104", "材料待处理"); this.ultraGridMat.DisplayLayout.ValueLists[0].ValueListItems.Add("80150105", "材料加工"); //this.ultraGridMat.DisplayLayout.ValueLists[0].ValueListItems.Add("80150106", "材料为余材"); this.ultraGridMat.DisplayLayout.ValueLists[0].ValueListItems.Add("80150201", "材料产出等待(未综合判定)"); this.ultraGridMat.DisplayLayout.ValueLists[0].ValueListItems.Add("80150202", "材料产出(已综合判定"); this.ultraGridMat.DisplayLayout.ValueLists[0].ValueListItems.Add("80150203", "材料为余材(生产组织产生)"); this.ultraGridMat.DisplayLayout.ValueLists[0].ValueListItems.Add("80150204", "材料脱单余材(销售组织脱单)"); this.ultraGridMat.DisplayLayout.ValueLists[0].ValueListItems.Add("80150205", "材料缴库余材(销售组织缴库)"); this.ultraGridMat.DisplayLayout.ValueLists[0].ValueListItems.Add("80150301", "材料可编提单"); this.ultraGridMat.DisplayLayout.ValueLists[0].ValueListItems.Add("80150302", "材料已编提单"); this.ultraGridMat.DisplayLayout.ValueLists[0].ValueListItems.Add("80150303", "销售出厂"); } /// /// 查询炉计划 /// private void QuerySinglePlan() { string value = this.ultraOptionSet1.CheckedItem.DataValue.ToString(); string startTim = ""; string endTim = ""; string jugeNo = ""; if (this.chkJugeHeatNo.Checked && this.txtJugeNo.Text.Trim() != "") { jugeNo = this.txtJugeNo.Text.Trim(); } if (chkTim.Checked) { if (DateTime.Parse(StartTime.Value.ToString()) > DateTime.Parse(EndTime.Value.ToString())) { MessageUtil.ShowTips("选择的时间区间不多!"); return; } else { startTim = this.StartTime.Value.ToString("yyyy-MM-dd HH:mm:ss"); endTim = this.EndTime.Value.ToString("yyyy-MM-dd HH:mm:ss"); } } DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmMchApply.doQueryLibrary", new object[] { jugeNo, startTim, endTim, plineCode }, this.ob); GridHelper.CopyDataToDatatable(ref dt, ref dataTable2, true); if(dt.Rows.Count>0) { foreach (UltraGridRow urg in ultraGrid1.Rows) { if (value == "0") { if (Convert.ToInt32(urg.Cells["UNAPPLY_COUNT"].Text) == 0) { urg.Hidden = true; } else { urg.Hidden = false; } } else if (value == "1") { if (Convert.ToInt32(urg.Cells["APPLY_COUNT"].Text) == 0) { urg.Hidden = true; } else { urg.Hidden = false; } } } } } /// /// 查询炉批信息 /// private void QueryMatZcM(string judgeNo,string batchNo,string groupNo,string value,string plinCode) { DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmMchApply.doQueryMatZcM", new object[] { judgeNo, batchNo, groupNo, value, plinCode }, this.ob); GridHelper.CopyDataToDatatable(ref dt, ref dtPipes, true); } /// /// 申请判定 /// private void DoApplyDec() { UltraGridRow row = ultraGrid1.ActiveRow; this.ultraGridMat.UpdateData(); int m = 0; int n = 0; int z = 0; IQueryable checkMagRows = this.ultraGridMat.Rows.AsQueryable().Where(" CHK = 'True'"); if (checkMagRows.Count() == 0) { MessageUtil.ShowTips("请选择需要申请判定炉批信息!"); return; } ArrayList parm = new ArrayList(); foreach (UltraGridRow uRow in checkMagRows) { if (uRow.Cells["VRP_QCM_STAUS"].Text.Trim() == "判废" || uRow.Cells["VRP_QCM_STAUS"].Text.Trim() == "待处理") { m = m + 1; } if (uRow.Cells["VRP_JUGDE_APPLY_CODE"].Text.Trim() != "") { n = n + 1; } ArrayList parm1 = new ArrayList(); parm1.Add(uRow.Cells["JUDGE_STOVE_NO"].Text.ToString()); parm1.Add(uRow.Cells["BATCH_NO"].Text.ToString()); parm1.Add(uRow.Cells["BATCH_GROUD_NO"].Text.ToString()); parm1.Add(this.UserInfo.GetUserName()); parm1.Add(this.UserInfo.GetUserOrder()); parm1.Add(this.UserInfo.GetUserGroup()); parm1.Add(uRow.Cells["PLINE_CODE"].Text.ToString()); parm1.Add(uRow.Cells["PRODUCT_FLAG"].Value.ToString()); parm1.Add(manage); parm1.Add(manageNmae); parm1.Add(row.Cells["ZY_BATCH_ID"].Value.ToString()); parm1.Add(row.Cells["CRAFT_FILE_NO"].Value.ToString()); parm1.Add(uRow.Cells["HEAT_PLAN_NO"].Value.ToString()); parm.Add(parm1); } if (m > 0) { MessageUtil.ShowTips("废品/待处理的炉批组信息,不允许申请判定!"); return; } if (n > 0) { MessageUtil.ShowTips("正在进行判定的炉批组信息,不允许重复申请判定!"); return; } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.mcp.Mch.FrmMchApply"; ccp.MethodName = "doApplyDec"; ccp.ServerParams = new object[] { parm, row.Cells["HEAT_PLAN_NO"].Value.ToString() }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageUtil.ShowTips(ccp.ReturnInfo); if (ccp.ReturnInfo.Equals("申请判定成功!")) { QuerySinglePlan(); } } } /// /// 撤销申请判定 /// private void DoUndoApply() { UltraGridRow row = ultraGrid1.ActiveRow; this.ultraGridMat.UpdateData(); IQueryable checkMagRows = this.ultraGridMat.Rows.AsQueryable().Where(" CHK = 'True'"); if (checkMagRows.Count() == 0) { MessageUtil.ShowTips("请选择需要撤销申请判定炉批信息!"); return; } ArrayList parm = new ArrayList(); foreach (UltraGridRow uRow in checkMagRows) { //if (uRow.Cells["VRP_QCM_STAUS"].Text.Trim() == "判废" || uRow.Cells["VRP_QCM_STAUS"].Text.Trim() == "待处理") //{ // m = m + 1; //} ArrayList parm1 = new ArrayList(); parm1.Add(uRow.Cells["JUDGE_STOVE_NO"].Text.ToString()); parm1.Add(uRow.Cells["BATCH_NO"].Text.ToString()); parm1.Add(uRow.Cells["BATCH_GROUD_NO"].Text.ToString()); parm1.Add(this.UserInfo.GetUserName()); parm1.Add(uRow.Cells["PLINE_CODE"].Text.ToString()); parm1.Add(uRow.Cells["PRODUCT_FLAG"].Value.ToString()); parm1.Add(uRow.Cells["VRP_JUGDE_APPLY_CODE"].Value.ToString()); parm.Add(parm1); } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.mcp.Mch.FrmMchApply"; ccp.MethodName = "DoUndoApply"; ccp.ServerParams = new object[] { parm, row.Cells["HEAT_PLAN_NO"].Value.ToString() }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageUtil.ShowTips(ccp.ReturnInfo); if (ccp.ReturnInfo.Equals("撤销申请判定成功!")) { QuerySinglePlan(); } } } /// /// 回报过磅重量 /// private void DoReturnWt() { this.ultraGrid1.UpdateData(); UltraGridRow uRow = this.ultraGrid1.ActiveRow; //string departMentid = PipeManageClass.GetDepartIdBySectionId(UserInfo.GetDeptid(), ob); string departMentid = UserInfo.GetDeptid(); if (uRow == null) { MessageUtil.ShowTips("请选择需要回报过磅重量的炉计划信息!"); return; } //if (uRow.Cells["ProductFlag"].Value.ToString() != "801402") //{ // MessageUtil.ShowTips("只允许成品类回报过磅重量!"); // return; //} if (Double.Parse(uRow.Cells["PONDER_GROSS_WT"].Value.ToString()) <= 0) { MessageUtil.ShowTips("请输入正确的过磅重量!"); return; } ArrayList list = new ArrayList(); list.Add(uRow.Cells["HEAT_PLAN_NO"].Value.ToString()); list.Add(uRow.Cells["PONDER_GROSS_WT"].Value.ToString()); list.Add(uRow.Cells["HEATNO_LAST"].Value.ToString()); list.Add(uRow.Cells["ZG_BATCH_NO"].Value.ToString()); list.Add(uRow.Cells["BATCH_GROUD_NO"].Value.ToString()); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.mcp.Mch.FrmMchApply"; ccp.MethodName = "doReturnWt"; ccp.ServerParams = new object[] { list }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageUtil.ShowTips(ccp.ReturnInfo); if (ccp.ReturnInfo.Equals("回报成功!")) { QuerySinglePlan(); } } } /// ///缴库单打印 /// private void DoTransferPrint() { this.ultraGrid1.UpdateData(); string jugeNo = ""; string batchNo = ""; string groupNo = ""; string plinCode = ""; int count = 0; ArrayList list = new ArrayList(); foreach (UltraGridRow uRow in ultraGrid1.Rows) { if (Convert.ToBoolean(uRow.Cells["CHK"].Text.ToString()) == true) { count += 1; jugeNo = uRow.Cells["HEATNO_LAST"].Value.ToString(); batchNo = uRow.Cells["ZG_BATCH_NO"].Value.ToString(); groupNo = uRow.Cells["BATCH_GROUD_NO"].Value.ToString(); plinCode = uRow.Cells["PLINE_CODE"].Value.ToString(); string departMentid = UserInfo.GetDeptid(); string userGroup = this.UserInfo.GetUserGroup(); string userOrder = this.UserInfo.GetUserOrder(); DataTable ds = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmMchApply.doQueryApplyCodeNull", new object[] { jugeNo, batchNo, groupNo }, this.ob); if (int.Parse(ds.Rows[0][0].ToString()) > 0) { MessageUtil.ShowTips("有未申请判定的数据,不允许进行缴库单打印!"); return; } list.Add(jugeNo); } } if (count == 0) { MessageUtil.ShowTips("请选择需要打印的炉信息!"); return; } string str = string.Join("','", (string[])list.ToArray(typeof(string))); string strurl = ""; if (plinCode.Equals("C021"))//镦粗 { strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepDbkDcCollected.cpt&PLINE_CODE=" + plinCode + "&HEATNO_LAST=" + str; } else { strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepDbkDcCollected.cpt&PLINE_CODE=" + plinCode + "&HEATNO_LAST=" + str; } FrmRepExcel fre = new FrmRepExcel(this.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 DoCollectedPrint() { this.ultraGridMat.UpdateData(); UltraGridRow uRow = this.ultraGridMat.ActiveRow; if (uRow == null) { MessageUtil.ShowTips("请选择需要打印的判定信息!"); return; } string userGroup = this.UserInfo.GetUserGroup(); string userOrder = this.UserInfo.GetUserOrder(); string userName = this.UserInfo.GetUserName(); string applyNo = uRow.Cells["VRP_JUGDE_APPLY_CODE"].Text.Trim(); if (applyNo == "") { MessageUtil.ShowTips("未申请判定,不允许判定单的打印!"); } string strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepDbkApplyCard.cpt&format=pdf&APPLY_CODE=" + applyNo + "&GROUP=" + userGroup + "&SHIFT=" + userOrder + "&USER_ID=" + userName; FrmRepExcel fre = new FrmRepExcel(this.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 chkJugeHeatNo_CheckedChanged(object sender, EventArgs e) { if (chkJugeHeatNo.Checked) { txtJugeNo.Enabled = true; } else { txtJugeNo.Enabled = false; } if (chkTim.Checked) { StartTime.Enabled = true; EndTime.Enabled = true; } else { StartTime.Enabled = false; EndTime.Enabled = false; } } /// /// 触发Grid1事件 /// /// /// private void ultraGrid1_AfterRowActivate(object sender, EventArgs e) { UltraGridRow uRow = this.ultraGrid1.ActiveRow; if (uRow == null) return; QueryMatZcM(uRow.Cells["JUDGE_STOVE_NO"].Value.ToString(), uRow.Cells["ZG_BATCH_NO"].Value.ToString(), uRow.Cells["BATCH_GROUD_NO"].Value.ToString(), this.ultraOptionSet1.CheckedItem.DataValue.ToString(), uRow.Cells["PLINE_CODE"].Value.ToString()); } /// /// 触发复选框事件 /// /// /// private void ultraOptionSet1_ValueChanged(object sender, EventArgs e) { string value = this.ultraOptionSet1.CheckedItem.DataValue.ToString(); UltraGridRow uRow = this.ultraGrid1.ActiveRow; if (uRow == null) return; foreach (UltraGridRow urg in ultraGrid1.Rows) { if (value == "0") { if (Convert.ToInt32(urg.Cells["UNAPPLY_COUNT"].Text) == 0) { urg.Hidden = true; } else { urg.Hidden = false; } } else if (value == "1") { if (Convert.ToInt32(urg.Cells["APPLY_COUNT"].Text) == 0) { urg.Hidden = true; } else { urg.Hidden = false; } } } QueryMatZcM(uRow.Cells["JUDGE_STOVE_NO"].Value.ToString(), uRow.Cells["ZG_BATCH_NO"].Value.ToString(), uRow.Cells["BATCH_GROUD_NO"].Value.ToString(), this.ultraOptionSet1.CheckedItem.DataValue.ToString(), uRow.Cells["PLINE_CODE"].Value.ToString()); } } }