using com.steering.mes.zgmil.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.ZGMil.Entity; 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.ZGMil.NodeResultQuery { public partial class FrmXiaXianOffLine : FrmBase { private OpeBase ob; public OpeBase Ob { get { return ob; } set { ob = value; } } //工序状态:01-矫直1#,02-矫直2#,03-矫直3#,11-ET探伤,12-MT探伤,13-UT探伤 private string node=""; private string test = ""; private string colno = "0";//探伤台号 //可下线支数 private int ScrapNumBefore = 0; //剔除支数 private int DelNum = 0; //产线代码 string PlineCod = ""; //点击主计划的炉号 private string heatno = ""; private string stoveno = ""; private string lotno = ""; private string proPlanId = "";//轧管订单编号 private string gxPlanNo = "";//工序排产序号 //工序 private string process = ""; private string labtext = ""; private string qualifiedNum = "";//上倒工序合格支数 //下线实绩表实体类 MilOfflineReslutEntity2 milofflineresult = new MilOfflineReslutEntity2(); /// /// 构造函数 /// public FrmXiaXianOffLine() { } public FrmXiaXianOffLine(string node, OpeBase _ob, string PlineCode, string stoveno, string lotno, string qualifiedNumS, string proPlanId, string gxPlanNo) { InitializeComponent(); EntityHelper.ShowGridCaption(this.ultraRack.DisplayLayout.Bands[0]); process = node; this.Ob = _ob; this.PlineCod = PlineCode; this.stoveno = stoveno; this.lotno = lotno; this.proPlanId = proPlanId; this.gxPlanNo = gxPlanNo; qualifiedNum = qualifiedNumS; this.TxtHeatNo.Text = this.stoveno; Query(); } private void Query() { string jugeNo = this.TxtHeatNo.Text.Trim(); //DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmOffLine.GetMILPlan", new object[] { PlineCod,process }, this.ob); List listSource = EntityHelper.GetData( "com.steering.mes.zgmil.coup.FrmOffLine.GetMILPlan", new object[] { PlineCod, process, jugeNo, proPlanId, gxPlanNo }, this.ob); MilPlanEntity3bindingSource.DataSource = listSource; if (listSource ==null) { dtPlan.Rows.Clear(); MessageBox.Show("未查询到可下线计划", "提示:", MessageBoxButtons.OK); this.TxtHeatNo.Text = ""; //this.TxtHeatNo.Enabled = false; this.TxtTotalNum.Text = "0"; this.TxtTotalNum.Enabled = false; this.TxtOfflineNumhas.Text = "0"; this.TxtOfflineNumhas.Enabled = false; this.TxtOfflinNum.Text = "0"; this.Dispose(); this.Close(); } } /// /// 表格单击事件 /// /// /// private void ultraRack_AfterRowActivate(object sender, EventArgs e) { UltraGridRow ugr = this.ultraRack.ActiveRow; this.TxtTotalNum.Text = "0"; this.TxtOfflinNumBack.Text = "0"; heatno = ugr.Cells["JudgeStoveNo"].Value.ToString(); this.TxtHeatNo.Text = heatno; //this.TxtHeatNo.Enabled = false; string s = ""; DataTable ds = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmOffLine.getOfflineXXCount", new object[] { heatno, PlineCod, proPlanId, gxPlanNo }, ob); if (ds.Rows.Count > 0) { s = ds.Rows[0]["QUALIFIEDNUM"].ToString(); } this.TxtTotalNum.Text = s; this.TxtTotalNum.Enabled = false; DataTable dthas = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmOffLine.getXXCountHAS", new object[] { heatno, proPlanId, gxPlanNo }, this.ob); if (dthas.Rows.Count > 0) { this.TxtOfflineNumhas.Text = dthas.Rows[0]["OFFLINE_COUNT"].ToString(); this.TxtOfflineNumhas.Enabled = false; } else { this.TxtOfflineNumhas.Text = "0"; this.TxtOfflineNumhas.Enabled = false; } } /// /// 下线操作 /// public void Offline() { string strInbound = "800707";//入库类型 string strInMemo = ""; if (string.IsNullOrEmpty(heatno)||ultraRack.ActiveRow==null) { MessageBox.Show("未选择计划行,不允许进行下线操作","提示:",MessageBoxButtons.OK,MessageBoxIcon.Warning); return; } if (!string.IsNullOrEmpty(TxtOfflinNum.Text.ToString().Replace("_",""))) { if (int.Parse(this.TxtOfflinNum.Text.ToString().Replace("_", "")) - int.Parse(this.TxtTotalNum.Text.Trim()) > 0) { MessageBox.Show("输入的下线支数超过了可下线支数,请重新输入", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (int.Parse(TxtOfflinNum.Text.ToString3().Replace("_", "")) <= 0) { MessageBox.Show("下线支数不能为零支,请重新输入", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } else { MessageBox.Show("未输入下线支数,请重新输入", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } DataTable dtMemo = PipeManageClass.getComTypeInfo(strInbound, ob); if (dtMemo.Rows.Count >= 1) { strInMemo = dtMemo.Rows[0]["MEMO"].ToString(); } NativeMethodNew na = new NativeMethodNew(this.ob); string plinCode = this.ultraRack.ActiveRow.Cells["PlineCode"].Value.ToString(); //na.GetPCode(this.UserInfo.GetDepartment()); ArrayList list = new ArrayList(); DataTable ds = getStoreNo(plinCode); if (ds == null) { MessageUtil.ShowTips("无轧管在线库基础信息,请维护!"); return; } list.Add(ds.Rows[0]["STORAGE_NO"].ToString()); list.Add(ds.Rows[0]["STORAGE_NO"].ToString() + "10101"); list.Add(ds.Rows[0]["STORAGE_TYPE_NO"].ToString()); list.Add(ds.Rows[0]["STORAGE_TYPE_NAME"].ToString()); list.Add(this.UserInfo.GetUserName()); list.Add(this.UserInfo.GetDeptid()); list.Add(this.UserInfo.GetDepartment()); list.Add(this.UserInfo.GetDeptid()); list.Add(this.UserInfo.GetDepartment()); //list.Add(PipeManageClass.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob)); //list.Add(PipeManageClass.GetDepartBySectionId(this.UserInfo.GetDeptid(), this.ob)); list.Add(UserInfo.GetUserOrder()); list.Add(UserInfo.GetUserGroup()); UltraGridRow uRow = this.ultraRack.ActiveRow; //DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmOffLine.doQueryResult", new object[] { uRow.Cells["JudgeStoveNo"].Value.ToString2() }, this.ob); //if (int.Parse(dt.Rows[0]["ACOUNT"].ToString2()) < 1) //{ // MessageUtil.ShowTips("部分下线之前,请先录入实绩!"); // return; //} MilPlanEntity3 milPlan = (MilPlanEntity3)uRow.ListObject; String milPlanTity = JSONFormat.Format(milPlan); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.zgmil.coup.FrmOffLine"; ccp.MethodName = "offLineXX"; ccp.ServerParams = new object[] { milPlanTity, TxtOfflinNum.Text.ToString().Replace("_", ""), this.UserInfo.GetUserName(), this.UserInfo.GetUserGroup(), this.UserInfo.GetUserOrder(), "0", list, strInbound, strInMemo, plinCode }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("离线成功!")) { Query(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } foreach (UltraGridRow ugr in ultraRack.Rows) { if (ugr.Cells["JudgeStoveNo"].Value.ToString().Equals(heatno)) { ultraRack.ActiveRow = ugr; } } } /// /// 查询仓库信息 /// /// /// private DataTable getStoreNo(string plineCode) { DataTable ds = ServerHelper.GetData("com.steering.mes.signature.FrmInOnlineStore.doQueryStoreNo", new object[] { plineCode }, ob); if (ds.Rows.Count > 0) { return ds; } else { return null; } } public void offlineAll() { string strInbound = "800707";//入库类型 string strInMemo = ""; if (string.IsNullOrEmpty(heatno) || ultraRack.ActiveRow == null) { MessageBox.Show("未选择计划行,不允许进行下线操作。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } UltraGridRow uRow = this.ultraRack.ActiveRow; //DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmOffLine.doQueryResult", new object[] { uRow.Cells["JudgeStoveNo"].Value.ToString2() }, this.ob); //if (int.Parse(dt.Rows[0]["ACOUNT"].ToString2()) < 1) //{ // MessageUtil.ShowTips("部分下线之前,请先录入实绩!"); // return; //} DataTable dtMemo = PipeManageClass.getComTypeInfo(strInbound, ob); if (dtMemo.Rows.Count >= 1) { strInMemo = dtMemo.Rows[0]["MEMO"].ToString(); } NativeMethodNew na = new NativeMethodNew(this.ob); string plinCode = na.GetPCode(this.UserInfo.GetDepartment()); ArrayList list = new ArrayList(); DataTable ds = getStoreNo(plinCode); if (ds == null) { MessageUtil.ShowTips("无轧管在线库基础信息,请维护!"); return; } list.Add(ds.Rows[0]["STORAGE_NO"].ToString()); list.Add(ds.Rows[0]["STORAGE_NO"].ToString() + "10101"); list.Add(ds.Rows[0]["STORAGE_TYPE_NO"].ToString()); list.Add(ds.Rows[0]["STORAGE_TYPE_NAME"].ToString()); list.Add(this.UserInfo.GetUserName()); list.Add(this.UserInfo.GetDeptid()); list.Add(this.UserInfo.GetDepartment()); list.Add(PipeManageClass.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob)); list.Add(PipeManageClass.GetDepartBySectionId(this.UserInfo.GetDeptid(), this.ob)); list.Add(UserInfo.GetUserOrder()); list.Add(UserInfo.GetUserGroup()); MilPlanEntity milPlan = (MilPlanEntity)uRow.ListObject; String milPlanTity = JSONFormat.Format(milPlan); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.zgmil.coup.FrmOffLine"; ccp.MethodName = "offLineXX"; ccp.ServerParams = new object[] { milPlanTity, TxtTotalNum.Text.ToString().Replace("_", ""), this.UserInfo.GetUserName(), this.UserInfo.GetUserGroup(), this.UserInfo.GetUserOrder(),"1",list }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("下线成功!")) { Query(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } public void offlineBack() { if (string.IsNullOrEmpty(heatno) || ultraRack.ActiveRow == null) { MessageBox.Show("未选择计划行,不允许进行下线回退操作", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (!string.IsNullOrEmpty(this.TxtOfflineNumhas.Text.ToString().Replace("_", ""))) { if (int.Parse(this.TxtOfflineNumhas.Text.ToString().Replace("_","")) == 0) { MessageBox.Show("已下线支数为0,不允许进行下线回退操作", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } else { MessageBox.Show("未进行下线操作,不允许进行下线回退", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } int offlinehas=int.Parse(this.TxtOfflineNumhas.Text.ToString().Replace("_","")); if (!string.IsNullOrEmpty(this.TxtOfflinNumBack.Text.ToString().Replace("_", ""))) { if (int.Parse(this.TxtOfflinNumBack.Text.ToString().Replace("_", "")) - offlinehas > 0) { MessageBox.Show("输入的下线回退支数超过了已下线支数,请重新输入", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } else { MessageBox.Show("未输入下线回退支数,请重新输入", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } UltraGridRow uRow = this.ultraRack.ActiveRow; MilPlanEntity3 milPlan = (MilPlanEntity3)uRow.ListObject; String milPlanTity = JSONFormat.Format(milPlan); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.zgmil.coup.FrmOffLine"; ccp.MethodName = "newXXOfflineBack"; ccp.ServerParams = new object[] { milPlanTity,this.TxtOfflinNumBack.Text.ToString().Replace("_", ""),"XX" }; ccp = ob.ExecuteNonQuery(ccp,CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("回退成功!")) { Query(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } /// /// 是否要插入下线实绩表 /// /// public bool isInsert() { bool result = true; DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmOffLine.isInsertOfflineResult", new object[] { heatno, process, proPlanId, gxPlanNo }, this.ob); if (dt.Rows.Count > 0) { result = false; } return result; } //查询 private void FrmStraighteningOffLine_Load(object sender, EventArgs e) { Query(); } private void FrmStraighteningOffLine_FormClosed(object sender, FormClosedEventArgs e) { this.DialogResult = DialogResult.OK; } private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e) { switch (e.Tool.Key) { case "doquery": Query(); break; case "offline": Offline(); break; case "offlineall": offlineAll(); break; case "OfflineBack": offlineBack(); break; case "Close": this.Close(); break; } } private void TxtOfflineNumhas_TextChanged(object sender, EventArgs e) { if (int.Parse(TxtOfflineNumhas.Text.ToString()) > 0) { this.TxtOfflinNumBack.Enabled = true; } else { this.TxtOfflinNumBack.Enabled = false; } } } }