| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467 |
- 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 FrmStraighteningOffLine : 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();
- /// <summary>
- /// 构造函数
- /// </summary>
- public FrmStraighteningOffLine()
- {
-
- }
- public FrmStraighteningOffLine(string node, OpeBase _ob, string PlineCode, string stoveno, string lotno, string qualifiedNumS, string proPlanId, string gxPlanNo)
- {
-
- InitializeComponent();
- EntityHelper.ShowGridCaption<MilPlanEntity>(this.ultraRack.DisplayLayout.Bands[0]);
-
- process = node;
- this.Ob = _ob;
- this.PlineCod = PlineCode;
- this.stoveno = stoveno;
- this.lotno = lotno;
- this.proPlanId = gxPlanNo;
- this.gxPlanNo = gxPlanNo;
- qualifiedNum = qualifiedNumS;
-
- 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<MilPlanEntity> listSource = EntityHelper.GetData<MilPlanEntity>(
- "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();
- }
- }
- /// <summary>
- /// 表格单击事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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.getStraighteningCount", new object[] { heatno, PlineCod }, ob);
- if (ds.Rows.Count > 0)
- {
- s = ds.Rows[0]["OFFLINE_COUNT"].ToString();
- }
- this.TxtTotalNum.Text = s;
- this.TxtTotalNum.Enabled = false;
- //已下线支数
- DataTable dthas = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmOffLine.GetStraighteningCountHAS", new object[] { heatno, process }, this.ob);
- if (dthas.Rows.Count > 0)
- {
- this.TxtOfflineNumhas.Text = dthas.Rows[0]["OFFLINE_NUM"].ToString();
- this.TxtOfflineNumhas.Enabled = false;
- }
- else
- {
- this.TxtOfflineNumhas.Text = "0";
- this.TxtOfflineNumhas.Enabled = false;
- }
- }
- /// <summary>
- /// 下线操作
- /// </summary>
- public void Offline()
- {
- string strInbound = "800707";//入库类型
- string strInMemo = "";
- NativeMethodNew na = new NativeMethodNew(this.ob);
- string plinCode = na.GetPCode(this.UserInfo.GetDepartment());
- UltraGridRow ugr1 = this.ultraRack.ActiveRow;
- heatno = ugr1.Cells["JudgeStoveNo"].Value.ToString();
- int xxOfflineNum = 0; //交库点离线的支数
- 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;
- }
- DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmOffLine.doQueryXxOfflinNum", new object[] { heatno, plinCode, proPlanId, gxPlanNo }, ob);
- if (dt.Rows.Count > 0)
- {
- xxOfflineNum = int.Parse(dt.Rows[0]["OFFLINE_NUM"].ToString3());
- if (xxOfflineNum + int.Parse(this.TxtOfflinNum.Text.ToString().Replace("_", "")) - int.Parse(this.TxtTotalNum.Text.Trim()) > 0)
- {
- MessageBox.Show("交库点离线了" +xxOfflineNum+"支,请确认数据再做离线!" , "提示:", 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();
- }
-
- 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;
- //}
- MilPlanEntity milPlan = (MilPlanEntity)uRow.ListObject;
- String milPlanTity = JSONFormat.Format(milPlan);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.zgmil.coup.FrmOffLine";
- ccp.MethodName = "offLineJZ";
- 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;
- }
- }
- }
- /// <summary>
- /// 查询仓库信息
- /// </summary>
- /// <param name="plineCode"></param>
- /// <returns></returns>
- 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 = "";
- int xxOfflineNum = 0; //交库点离线的支数
- NativeMethodNew na = new NativeMethodNew(this.ob);
- string plinCode = na.GetPCode(this.UserInfo.GetDepartment());
- if (string.IsNullOrEmpty(heatno) || ultraRack.ActiveRow == null)
- {
- MessageBox.Show("未选择计划行,不允许进行下线操作。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- UltraGridRow uRow = this.ultraRack.ActiveRow;
- //heatno = uRow.Cells["JudgeStoveNo"].Value.ToString();
- //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 dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmOffLine.doQueryXxOfflinNum", new object[] { heatno, plinCode, proPlanId, gxPlanNo }, ob);
- if (dt.Rows.Count > 0)
- {
- xxOfflineNum = int.Parse(dt.Rows[0]["OFFLINE_NUM"].ToString3());
- MessageBox.Show("交库点离线了" + xxOfflineNum + "支,不允许使用整台离线功能!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- DataTable dtMemo = PipeManageClass.getComTypeInfo(strInbound, ob);
- if (dtMemo.Rows.Count >= 1)
- {
- strInMemo = dtMemo.Rows[0]["MEMO"].ToString();
- }
-
- 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 = "offLineJZ";
- ccp.ServerParams = new object[] { milPlanTity, TxtTotalNum.Text.ToString().Replace("_", ""), this.UserInfo.GetUserName(), this.UserInfo.GetUserGroup(), this.UserInfo.GetUserOrder(), "1", 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);
- }
- }
-
- }
- 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;
- MilPlanEntity milPlan = (MilPlanEntity)uRow.ListObject;
- String milPlanTity = JSONFormat.Format(milPlan);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.zgmil.coup.FrmOffLine";
- ccp.MethodName = "newStaOfflineBack";
- ccp.ServerParams = new object[] { milPlanTity,this.TxtOfflinNumBack.Text.ToString().Replace("_", ""),"JZ" };
- ccp = ob.ExecuteNonQuery(ccp,CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("回退成功!"))
- {
- Query();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- /// <summary>
- /// 是否要插入下线实绩表
- /// </summary>
- /// <returns></returns>
- 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;
- }
- }
-
- }
- }
|