| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using CoreFS.CA06;
- using Core.Mes.Client.Comm.Server;
- using System.Data;
- using System.Windows.Forms;
- using System.Collections;
- using Core.Mes.Client.Comm;
- using com.steering.mes.zgmil.entity;
- using System.Net;
- namespace Core.StlMes.Client.ZGMil.Entity
- {
- public class NativeMethodNew : FrmBase
- {
- //public NativeMethodNew()
- //{ }
- private OpeBase _ob;
- public OpeBase Ob
- {
- get { return _ob; }
- set { _ob = value; }
- }
- /// <summary>
- /// 返回信息
- /// </summary>
- private string returnMessage;
- /// <summary>
- /// 返回信息
- /// </summary>
- public string ReturnMessage
- {
- get
- {
- return returnMessage;
- }
- set
- {
- returnMessage = value;
- }
- }
- /// <summary>
- /// 工序选择
- /// </summary>
- /// <param name="ob"></param>
- public NativeMethodNew(OpeBase ob)
- {
- this.Ob = ob;
- }
- /// <summary>
- /// 工序选择
- /// </summary>
- public enum ProcessChoose
- {
- // 摘要:
- //上料锯切
- Feed = 0,
- // 摘要:
- // 加热
- Fur = 1,
- // 摘要:
- // 穿孔
- Perforration = 2,
- // 摘要:
- // 连轧
- Rolling = 3,
- // 摘要:
- // 再加热
- Refur = 4,
- // 摘要:
- // 定径
- Sizing = 5,
- // 摘要:
- // 分切
- Saw = 6,
- // 摘要:
- // 矫直
- Straing = 7,
- // 摘要:
- // ET(涡流)探伤
- ET = 8,
- // 摘要:
- // MT(漏磁)探伤
- MT = 9,
- // 摘要:
- // UL(超声波)探伤
- UL = 10,
- // 摘要:
- // 人工质检
- Surface = 11
- }
- /// <summary>
- /// 方法选择
- /// </summary>
- public enum MethodChoose
- {
- // 摘要:
- // 查询
- Query = 0,
- // 摘要:
- // 添加
- Add = 1,
- // 摘要:
- // 更新
- Update = 2,
- }
- /// <summary>
- /// 表类型选择
- /// </summary>
- public enum TableStytleChoose
- {
- // 摘要:
- // 主表
- MainPlan = 0,
- // 摘要:
- // 子表
- FeedPlan = 1,
- // 摘要:
- // 实绩表
- Result = 2,
- // 摘要:
- // 跟踪记录表
- Rack = 3,
- // 摘要:
- // 历史表
- History = 4
- }
- /// <summary>
- /// 判断该炉是否进行了该工序
- /// </summary>
- /// <param name="JUDGE_STOVE_NO">判定炉号</param>
- /// <param name="Node">工序号状态( 0-开始锯切 1-入炉 2-开始穿孔 3-开始连轧 4-入再加热炉 5-开始定径 6-开始分切 7-开始矫直 8-涡流探伤 9-漏磁探伤 10-超声波探伤 11-人工质检)</param>
- /// <returns></returns>
- public bool isBegineNode(string JUDGE_STOVE_NO, int Node)
- {
- bool isbeginnode = false;
- int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.isBegineNode", new object[] { JUDGE_STOVE_NO, Node }, this._ob);
- if (count > 0)
- {
- isbeginnode = true;
- }
- return isbeginnode;
- }
- /// <summary>
- /// 向对应工序的跟踪记录表里的相应记录插入开始时间
- /// </summary>
- /// <param name="JUDGE_STOVE_NO">判定炉号</param>
- /// <param name="Node">工序号状态( 0-开始锯切 1-入炉 2-开始穿孔 3-开始连轧 4-入再加热炉 5-开始定径 6-开始分切 7-开始矫直 8-开始探伤 9-开始质检)</param>
- /// <param name="status"> status 0,插入开始时间,1,插入结束时间</param>
- public void InsertSTAferDoubleClick(string JUDGE_STOVE_NO, int Node, string status, string proPlanId, string gxPlanNo)
- {
- if (status == "0" || status == "1")
- {
- // if (isBegineNode(JUDGE_STOVE_NO, Node))
- // {
- int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.InsertSTToRack", new object[] { JUDGE_STOVE_NO, Node, status, proPlanId, gxPlanNo }, this._ob);
- // }
- }
- else
- {
- MessageBox.Show("status的值应为0或1");
- return;
- }
- }
- /// <summary>
- /// 返回IP对应的产线代码信息
- /// </summary>
- /// <param name="strip">输入IP</param>
- /// <param name="resultcode">0-操作台号,1-操作台名称</param>
- /// <returns></returns>
- public string GetOperateResult(string strip, string resultcode)
- {
- string strresult = null;
- DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.GetOperateResult", new object[] { strip }, this._ob);
- if (dt.Rows.Count > 0)
- {
- if (resultcode == "0")
- {
- strresult = dt.Rows[0]["PLINE_CODE"].ToString();//操作台号
- }
- else if (resultcode == "1")
- {
- strresult = dt.Rows[0]["OPERAT_NAME"].ToString();//操作台名称
- }
- else
- {
- strresult = "输入返回数据代码错误";
- }
- }
- else
- {
- strresult = "无匹配数据";
- }
- return strresult;
- }
- /// <summary>
- /// h获取PCode
- /// </summary>
- /// <param name="Department">user_depatment</param>
- /// <returns></returns>
- public string GetPCode(string Department)
- {
- string Pcode = "";
- DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.GetPCode", new Object[] { Department }, this._ob);
- if (dt.Rows.Count > 0)
- {
- Pcode = dt.Rows[0]["pline_code"].ToString();
- }
- return Pcode;
- }
- /// <summary>
- /// 获取产线
- /// </summary>
- /// <param name="validDataPurviewIds">数据权限</param>
- /// <param name="ob"></param>
- /// <returns>字符串数组</returns>
- public string[] GetPCodePline(string[] arr1)
- {
- string[] arr = null;
- DataTable dt = ServerHelper.GetData("com.steering.mes.signature.FrmTubeRollFileManage.GetPCode", new Object[] { arr1 }, this._ob);
- if (dt != null && dt.Rows.Count > 0)
- {
- arr = new string[dt.Rows.Count];
- for (int i = 0; i < dt.Rows.Count; i++)
- {
- arr[i] = dt.Rows[i][0].ToString();
- }
- return arr;
- }
- else
- {
- return new string[1] { "" };
- }
- }
- /// <summary>
- /// 获取产线
- /// </summary>
- /// <param name="arr1"></param>
- /// <returns></returns>
- public string[] GetPlineCode(string[] arr1)
- {
- string[] arr = null;
- DataTable dt = ServerHelper.GetData("com.steering.mes.signature.FrmTubeRollFileManage.getPlineCode", new Object[] { arr1 }, this._ob);
- if (dt != null && dt.Rows.Count > 0)
- {
- arr = new string[dt.Rows.Count];
- for (int i = 0; i < dt.Rows.Count; i++)
- {
- arr[i] = dt.Rows[i][0].ToString();
- }
- return arr;
- }
- else
- {
- return new string[1] { "" };
- }
- }
- public int GetInfo(string methodId, object[] param, OpeBase ob)
- {
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = methodId.Substring(0, methodId.LastIndexOf("."));
- ccp.MethodName = methodId.Substring(methodId.LastIndexOf(".") + 1);
- ccp.ServerParams = param;
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp == null)
- {
- throw new MESException("服务端处理失败!");
- }
- if (ccp.ReturnCode < 0)
- {
- throw new MESException("服务端处理失败!", ccp.ReturnCode, ccp.ReturnInfo);
- }
- int count = 0;
- if (!int.TryParse(ccp.ReturnInfo.ToString(), out count))
- {
- throw new MESException("服务端处理成功,但返回处理数量不是数字!");
- }
- return count;
- }
- /// <summary>
- /// 剔除回退公用方法
- /// </summary>
- /// <param name="heatno">炉号</param>
- /// <param name="seq">已剔除序号</param>
- /// <param name="processno">工序号 0-锯切前 1-锯切后 2-环形加热炉 3-穿孔 4-连轧 5-再加热炉 6-定径 7-分切前 8-分切后
- /// 9-矫直1 10-矫直2 11-矫直3 12-ET探伤 13-涡流探伤 14-超声波探伤 15-人工质检</param>
- /// <param name="Num">回退支数(锯切后,分切后需要支数,其它工序默认为1)</param>
- /// <param name="DBNum">倍尺数或分切数不需要则默认0</param>
- public int DeleteSlabSeq(string heatno, string seq, int processno, int Num, int DBNum, string proPlanId, string gxPlanNo)
- {
- int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.DeleteSlabSeq", new Object[] { heatno, seq, processno, Num, DBNum, "0", proPlanId, gxPlanNo }, this._ob);
- return count;
- }
- public int DeleteFeedSlabSeq(string heatno, string feedrowno, string seq, int processno, int Num, int DBNum, string proPlanId, string gxPlanNo)
- {
- int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.DeleteFeedSlabSeq", new Object[] { heatno, feedrowno, seq, processno, Num, DBNum, "0", proPlanId, gxPlanNo }, this._ob);
- return count;
- }
- /// <summary>
- /// 剔除回退公用方法
- /// </summary>
- /// <param name="heatno">炉号</param>
- /// <param name="seq">已剔除序号</param>
- /// <param name="processno">工序号 0-锯切前 1-锯切后 2-环形加热炉 3-穿孔 4-连轧 5-再加热炉 6-定径 7-分切前 8-分切后
- /// 9-矫直1 10-矫直2 11-矫直3 12-ET探伤 13-涡流探伤 14-超声波探伤 15-人工质检</param>
- /// <param name="Num">回退支数(锯切后,分切后需要支数,其它工序默认为1)</param>
- /// <param name="DBNum">倍尺数或分切数不需要则默认0</param>
- public int DeleteSlabSeq(string heatno, string seq, int processno, int Num, int DBNum, string Colno, string proPlanId, string gxPlanNo)
- {
- int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.DeleteSlabSeq", new Object[] { heatno, seq, processno, Num, DBNum, Colno, proPlanId, gxPlanNo }, this._ob);
- return count;
- }
- /// <summary>
- /// 判断当前机器IP是否与数据库一直
- /// </summary>
- /// <param name="MilBase"></param>
- /// <returns></returns>
- public bool CheckIpAddress(string procee, string clono, string plcode)
- {
- bool result = false;
- string hostname = Dns.GetHostName();
- IPAddress ip = Dns.GetHostByName(hostname).AddressList[0];
- DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.CheckIpAddress", new object[] { procee, clono, plcode }, this.ob);
- if (dt.Rows.Count > 0)
- {
- if (!string.IsNullOrEmpty(dt.Rows[0]["IP_ADDRESS1"].ToString()))
- {
- if (ip.ToString().Equals(dt.Rows[0]["IP_ADDRESS1"].ToString()))
- {
- result = true;
- }
- }
- if (!string.IsNullOrEmpty(dt.Rows[0]["IP_ADDRESS2"].ToString()))
- {
- if (ip.ToString().Equals(dt.Rows[0]["IP_ADDRESS2"].ToString()))
- {
- result = true;
- }
- }
- if (!string.IsNullOrEmpty(dt.Rows[0]["IP_ADDRESS3"].ToString()))
- {
- if (ip.ToString().Equals(dt.Rows[0]["IP_ADDRESS3"].ToString()))
- {
- result = true;
- }
- }
- if (!string.IsNullOrEmpty(dt.Rows[0]["IP_ADDRESS4"].ToString()))
- {
- if (ip.ToString().Equals(dt.Rows[0]["IP_ADDRESS4"].ToString()))
- {
- result = true;
- }
- }
- }
- else
- {
- result = true;
- }
- return result;
- }
- public int CheckIpAddressisin(MilBaseAddressEntity MilBase)
- {
- int result = 0;
- List<string> list = new List<string>();
- string ip1 = MilBase.IpAddress1.ToString();
- string ip2 = MilBase.IpAddress2.ToString();
- string ip3 = MilBase.IpAddress3.ToString();
- string ip4 = MilBase.IpAddress4.ToString();
- //list.Add(ip1); list.Add(ip2); list.Add(ip3); list.Add(ip4);
- DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.CheckIpAddressisin", new object[] { MilBase }, this._ob);
- if (dt.Rows.Count > 0)
- {
- list.Clear();
- foreach (DataRow dr in dt.Rows)
- {
- if (!string.IsNullOrEmpty(dr["IP_ADDRESS1"].ToString()))
- {
- list.Add(dr["IP_ADDRESS1"].ToString());
- }
- if (!string.IsNullOrEmpty(dr["IP_ADDRESS2"].ToString()))
- {
- list.Add(dr["IP_ADDRESS2"].ToString());
- }
- if (!string.IsNullOrEmpty(dr["IP_ADDRESS3"].ToString()))
- {
- list.Add(dr["IP_ADDRESS3"].ToString());
- }
- if (!string.IsNullOrEmpty(dr["IP_ADDRESS4"].ToString()))
- {
- list.Add(dr["IP_ADDRESS4"].ToString());
- }
- }
- }
- if (list.Count > 0)
- {
- for (int i = 0; i < list.Count; i++)
- {
- if (ip1.Equals(list[i]))
- {
- result = 1;
- }
- if (ip2.Equals(list[i]))
- {
- result = 2;
- }
- if (ip3.Equals(list[i]))
- {
- result = 3;
- }
- if (ip4.Equals(list[i]))
- {
- result = 4;
- }
- }
- }
- return result;
- }
- /// <summary>
- /// 保存跟踪记录表备注
- /// </summary>
- /// <param name="process">0-开始分切 1-开始矫直 2-开始探伤</param>
- /// <param name="Seq"></param>
- /// <param name="hratno"></param>
- /// <param name="ramark"></param>
- /// <returns></returns>
- public int SaveRackRemark(int process, int Seq, string hratno, string ramark)
- {
- int count = 0;
- count = ServerHelper.SetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.SaveRackRemark", new object[] { process, Seq, hratno, ramark }, this.ob);
- return count;
- }
- public double CountWeight(string heatno, int X)
- {
- double result = 0.0;
- double dbweight = 0.0;
- int sawnum = 0;
- double BURNNING_RATE1 = 0.0;
- double BURNNING_RATE2 = 0.0;
- DataTable dt1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.GetDBWeightfromMILPlan", new object[] { heatno }, this.ob);
- if (dt1.Rows.Count > 0)
- {
- dbweight = Convert.ToDouble(dt1.Rows[0]["db_height"].ToString());
- sawnum = Convert.ToInt16(dt1.Rows[0]["SAW_NUM"].ToString());
- }
- DataTable dt2 = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.GetBURNNING_RATEfromFur", new object[] { heatno }, this.ob);
- if (dt2.Rows.Count > 0)
- {
- if (!string.IsNullOrEmpty(dt2.Rows[0]["burnning_rate"].ToString()))
- {
- BURNNING_RATE1 = Convert.ToDouble(dt2.Rows[0]["burnning_rate"].ToString());
- }
- else
- {
- BURNNING_RATE1 = 1;
- }
- }
- DataTable dt3 = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.GetBURNNING_RATEfromReFur", new object[] { heatno }, this.ob);
- if (dt3.Rows.Count > 0)
- {
- if (!string.IsNullOrEmpty(dt3.Rows[0]["BURNINGRATE"].ToString()))
- {
- BURNNING_RATE2 = Convert.ToDouble(dt3.Rows[0]["BURNINGRATE"].ToString());
- }
- else
- {
- BURNNING_RATE2 = 1;
- }
- }
- switch (X)
- {
- case 1:
- result = dbweight;
- break;
- case 2:
- result = (double)sawnum;
- break;
- case 3:
- result = BURNNING_RATE1;
- break;
- case 4:
- result = BURNNING_RATE2;
- break;
- }
- return result;
- }
- /// <summary>
- /// 获取定尺长度占比
- /// </summary>
- /// <param name="heatno"></param>
- /// <returns></returns>
- public double GetLengthPercent(string heatno, OpeBase obs, int X)
- {
- double result = 100.0;
- double cuthead = 0;
- double cutorder = 0;
- double cuttail = 0;
- double sawnum = 0;
- DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.GetLengthPercent", new object[] { heatno }, obs);
- if (dt.Rows.Count > 0)
- {
- cuthead = Convert.ToDouble(string.IsNullOrEmpty(dt.Rows[0]["cut_head_length"].ToString())?"0" : dt.Rows[0]["cut_head_length"].ToString());
- cutorder = Convert.ToDouble(string.IsNullOrEmpty(dt.Rows[0]["order_length"].ToString()) ? "0" : dt.Rows[0]["order_length"].ToString());
- cuttail = Convert.ToDouble(string.IsNullOrEmpty(dt.Rows[0]["cut_trail_length"].ToString())?"0":dt.Rows[0]["cut_trail_length"].ToString());
- sawnum = Convert.ToDouble(string.IsNullOrEmpty(dt.Rows[0]["saw_num"].ToString()) ? "0" : dt.Rows[0]["saw_num"].ToString());
- //double temp1 = cutorder * sawnum;
- if (X == 0)
- {
- double temp1 = cutorder;
- double temp2 = (cuthead / 100 + cuttail / 100 + cutorder * sawnum);
- if (temp2 > 0 && temp1 > 0)
- {
- result = temp1 / temp2 * 100;
- }
- else
- {
- result = 0.0;
- }
-
- }
- if (X == 1)
- {
- //double temp1 = cuthead / 100;
- //double temp2 = (cuthead / 100 + cuttail / 100 + cutorder * sawnum);
- //if (temp2 > 0 && temp1 > 0)
- //{
- // result = temp1 / temp2 * 100;
- //}
- //else
- //{
- // result = 0.0;
- //}
- result = cuthead/100;
- }
- if (X == 2)
- {
- //double temp1 = cuthead / 100;
- //double temp2 = (cuttail / 100 + cuttail / 100 + cutorder * sawnum);
- //if (temp2 > 0 && temp1 > 0)
- //{
- // result = temp1 / temp2 * 100;
- //}
- //else
- //{
- // result = 0.0;
- //}
- result = cuttail/100;
- }
- }
- return result;
- }
- public int ChangeShift(string JudgeStoveNo, string ResultNo, string Seq, string PLineCode, string Shift, string Group, int process, int flag, string colno, string proPlanId, string gxPlanNo)
- {
- //方法未针对矫直探伤 进行分台, 需要重写
- int count = 0;
- string seqlast = "";
- string seqchanghas = "";
- int changnum = 0;
- int changnumhas = 0;
- int changnumdel = 0;
- //找到本台交接班的第一只
- DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.GetRackChangeFlag", new object[] { JudgeStoveNo, ResultNo, Seq, process, colno, Shift, Group, proPlanId, gxPlanNo }, this._ob);
- if (dt.Rows.Count > 0)
- {
- if (!string.IsNullOrEmpty(dt.Rows[0]["SEQ"].ToString()))
- {
- seqlast = dt.Rows[0]["SEQ"].ToString();
- }
- else
- {
- //seqlast = "1";
- }
- }
- else
- {
- //seqlast = "1";
- }
- if (int.Parse(seqlast) > int.Parse(Seq))
- {
- MessageBox.Show("您所选的管号队列交接班支已被上一班操作,不允许进行交接班", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- count = 2;
- //return count;
- }
- else
- {
- //if (process != 0)
- //{
- //获取本台的交接班支数
- DataTable dt1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.GetRackChangeNum", new object[] { JudgeStoveNo, ResultNo, seqlast, Seq, process, colno, proPlanId, gxPlanNo }, this._ob);
- if (dt1.Rows.Count > 0)
- {
- changnum = int.Parse(dt1.Rows[0]["COUNTS"].ToString());
- }
- //}
- //else
- //{
- // changnum = int.Parse(Seq) - int.Parse(seqlast)+1;
- //}
- DataTable dt2 = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.GetRackChangeFlag1", new object[] { JudgeStoveNo, ResultNo, Seq, process, colno, Shift, Group, proPlanId, gxPlanNo }, this._ob);
- if (dt2.Rows.Count > 0)
- {
- if (!string.IsNullOrEmpty(dt2.Rows[0]["SEQ"].ToString()))
- {
- seqchanghas = dt2.Rows[0]["SEQ"].ToString();
- //if (int.Parse(seqchanghas) > int.Parse(Seq))
- //{
- DataTable dt3 = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.GetRackChangeNum", new object[] { JudgeStoveNo, ResultNo, seqlast, seqchanghas, process, colno, proPlanId, gxPlanNo }, this._ob);
- {
- changnumdel = int.Parse(dt3.Rows[0]["COUNTS"].ToString());
- }
- //}
- //else
- //{
- // changnumdel = 0;
- //}
- }
- else
- {
- seqchanghas = "";
- }
- }
- DataTable dt4 = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.GetRackChangeNumHas", new object[] { JudgeStoveNo, ResultNo, process, colno, proPlanId, gxPlanNo }, this._ob);
- if (dt4.Rows.Count > 0)
- {
- changnumhas = int.Parse(dt4.Rows[0]["COUNTS"].ToString());
- }
- string user = this.UserInfo.GetUserName();
- //count = ServerHelper.SetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.ChangeShift", new object[] { JudgeStoveNo, ResultNo, seqlast, Seq, PLineCode, Shift, Group, process, flag ,colno}, this.ob);
- //count = ServerHelper.SetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.ChangeShiftNEW", new object[] { JudgeStoveNo, ResultNo, seqlast, Seq, changnum, PLineCode, Shift, Group, process, flag, colno, user }, this._ob);
- count = ServerHelper.SetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.ChangeShiftNEWW", new object[] { JudgeStoveNo, ResultNo, seqlast, Seq, seqchanghas, changnum, changnumhas, changnumdel, Shift, Group, user, process, flag, colno, proPlanId, gxPlanNo }, this._ob);
- }
- return count;
- }
- public int UpdateChangeFlag(string heatno, string resultno, int processno, int seq, string colno)
- {
- int count = 0;
- count = ServerHelper.SetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.UpdateChangeFlag", new object[] { heatno, resultno, processno, seq, colno }, this._ob);
- return count;
- }
- public int GetWaitChangeSeq(string heatno, string resultno, int processno, string colno, string proPlanId, string gxPlanNo)
- {
- int seq = 0;
- DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.GetWaitChangeSeq", new object[] { heatno, resultno, processno, colno, proPlanId, gxPlanNo }, this._ob);
- if (dt.Rows.Count > 0)
- {
- if (!string.IsNullOrEmpty(dt.Rows[0]["SEQ"].ToString()))
- {
- seq = int.Parse(dt.Rows[0]["SEQ"].ToString());
- }
- }
- return seq;
- }
- /// <summary>
- /// 交班取消验证
- /// </summary>
- /// <param name="JudgeStoveNo"></param>
- /// <param name="ResultNo"></param>
- /// <param name="PLineCode"></param>
- /// <param name="Shift"></param>
- /// <param name="Group"></param>
- /// <param name="process"></param>
- /// <param name="colno"></param>
- /// <returns></returns>
- public bool ChangeShiftBackCheck(string JudgeStoveNo, string ResultNo, string PLineCode, string Shift, string Group, int process, string colno)
- {
- bool result = false;
- DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.ChangeShiftBackCheck", new object[] { JudgeStoveNo, ResultNo, PLineCode, Shift, Group, process, colno }, this._ob);
- if (dt.Rows.Count > 0)
- {
- result = true;
- //if (process == 1 || process == 4)
- //{
- //}
- //else
- //{
- // if (!string.IsNullOrEmpty(dt.Rows[0]["CHANGFLAG"].ToString()))
- // {
- // if (dt.Rows[0]["CHANGFLAG"].ToString().Equals("1"))
- // {
- // result = true;
- // }
- // }
- //}
- }
- return result;
- }
- public bool ChangeShiftBackCheckelse(string JudgeStoveNo, string ResultNo, string PLineCode, string Shift, string Group, int process, string colno, string proPlanId, string gxPlanNo)
- {
- bool result = false;
- DataTable dt = null;
- dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.BeforeChangBack", new object[] { JudgeStoveNo, ResultNo, PLineCode, Shift, Group, process, colno, proPlanId, gxPlanNo }, this._ob);
- if (dt.Rows.Count > 0)
- {
- result = true;
- }
- return result;
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="JudgeStoveNo"></param>
- /// <param name="ResultNo"></param>
- /// <param name="PLineCode"></param>
- /// <param name="Shift"></param>
- /// <param name="Group"></param>
- /// <param name="process">0-开始锯切 1-入炉 2-开始穿孔 3-开始连轧 4-入再加热炉 5-开始定径 6-开始分切 7-开始矫直 8-开始探伤 9-开始质检</param>
- /// <param name="colno"></param>
- /// <returns></returns>
- public int ChangeShiftBack(string JudgeStoveNo, string ResultNo, string PLineCode, string Shift, string Group, int process, string colno, string proPlanId, string gxPlanNo)
- {
- int count = 0;
- int changnumhas = 0;
- DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.BeforeChangBack", new object[] { JudgeStoveNo, ResultNo, PLineCode, Shift, Group, process, colno, proPlanId, gxPlanNo }, this._ob);
- if (dt.Rows.Count > 0)
- {
- count = ServerHelper.SetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.ChangBackelse", new object[] { JudgeStoveNo, ResultNo, PLineCode, Shift, Group, process, colno, proPlanId, gxPlanNo }, this._ob);
- }
- else
- {
- DataTable dtchangnumhas = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.GetChangeShiftBackNum", new object[] { JudgeStoveNo, ResultNo, PLineCode, Shift, Group, process, colno, proPlanId, gxPlanNo }, this._ob);
- if (dtchangnumhas.Rows.Count > 0)
- {
- changnumhas = int.Parse(dtchangnumhas.Rows[0]["COUNTS"].ToString());
- count = ServerHelper.SetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.ChangeShiftBack", new object[] { JudgeStoveNo, ResultNo, PLineCode, Shift, Group, process, changnumhas, 0, colno, proPlanId, gxPlanNo }, this._ob);
- }
- }
- return count;
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="JudgeStoveNo"></param>
- /// <param name="ResultNo"></param>
- /// <param name="PLineCode"></param>
- /// <param name="Shift"></param>
- /// <param name="Group"></param>
- /// <param name="Flag">加热炉/再加热炉最后一支入炉标识 0-未入炉 1-入炉 最后一支入炉时,交班取消不能取消入炉交班</param>
- /// <param name="process">0-开始锯切 1-入炉 2-开始穿孔 3-开始连轧 4-入再加热炉 5-开始定径 6-开始分切 7-开始矫直 8-开始探伤 9-开始质检</param>
- /// <returns></returns>
- public int ChangeShiftBack(string JudgeStoveNo, string ResultNo, string proPlanId, string gxPlanNo, string PLineCode, string Shift, string Group, int process, int Flag = 0)
- {
- int count = 0;
- int changnumhas = 0;
- int changnumhasInfur = 0;
- DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.BeforeChangBack", new object[] { JudgeStoveNo, ResultNo, PLineCode, Shift, Group, process, "0", proPlanId, gxPlanNo }, this._ob);
- if (dt.Rows.Count > 0)
- {
- count = ServerHelper.SetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.ChangBackelse", new object[] { JudgeStoveNo, ResultNo, PLineCode, Shift, Group, process, "0", proPlanId, gxPlanNo }, this._ob);
- }
- else
- {
- DataTable dtInfur = null;
- if (process == 1 || process == 4)
- {
- dtInfur = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.GetChangeShiftBackNuminfur", new object[] { JudgeStoveNo, ResultNo, PLineCode, Shift, Group, process, "0", proPlanId, gxPlanNo }, this._ob);
- if (dtInfur.Rows.Count > 0)
- {
- changnumhasInfur = int.Parse(dtInfur.Rows[0]["COUNTS"].ToString());
- }
- }
- DataTable dtchangnumhas = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.GetChangeShiftBackNum", new object[] { JudgeStoveNo, ResultNo, PLineCode, Shift, Group, process, "0", proPlanId, gxPlanNo }, this._ob);
- if (dtchangnumhas.Rows.Count > 0)
- {
- changnumhas = int.Parse(dtchangnumhas.Rows[0]["COUNTS"].ToString());
-
- }
- if (dtchangnumhas.Rows.Count > 0 || dtInfur.Rows.Count > 0)
- {
- if (Flag == 0)
- {
- count = ServerHelper.SetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.ChangeShiftBack", new object[] { JudgeStoveNo, ResultNo, PLineCode, Shift, Group, process, changnumhas, changnumhasInfur, "0", proPlanId, gxPlanNo }, this._ob);
- }
- else
- {
- count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.ChangeShiftBackForLastInFur", new object[] { JudgeStoveNo, ResultNo, PLineCode, Shift, Group, process, changnumhas, changnumhasInfur, "0", proPlanId, gxPlanNo }, this._ob);
- }
- }
- }
- return count;
- }
- public int NodeBack(string JudgeStoveNo, string ResultNo, string PLineCode, int process, string colno, string proPlanId, string gxPlanNo, string lotNo)
- {
- //适用矫直探伤
- int count = 0;
- string seq = "";
- DataTable dtchangflag = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.NodeBackGetMaxChangFlag", new object[] { JudgeStoveNo, ResultNo, process, colno, proPlanId, gxPlanNo }, this._ob);
- if (dtchangflag.Rows.Count > 0)
- {
- if (!string.IsNullOrEmpty(dtchangflag.Rows[0]["SEQ"].ToString()))
- {
- seq = dtchangflag.Rows[0]["SEQ"].ToString();
- }
- else
- {
- seq = "0";
- }
- }
- else
- {
- seq = "0";
- }
- count = ServerHelper.SetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.NodeBack", new object[] { JudgeStoveNo, ResultNo, PLineCode, process, seq, colno, 9, proPlanId, gxPlanNo, lotNo }, this._ob);
- return count;
- }
- //public int SetQuNum(string heatno,string resultno ,int pro,int numqu,string colno)
- //{
- // int count = 0;
- // count
- // return count;
- //}
- public bool IsRackOperate(string shift, string group)
- {
- bool result = false;
- string groupcode = UserInfo.GetUserGroup();
- string shiftcode = UserInfo.GetUserOrder();
- string shiftnow = "";
- string groupnow = "";
- switch (groupcode)
- {
- case "1":
- groupnow = "甲";
- break;
- case "2":
- groupnow = "乙";
- break;
- case "3":
- groupnow = "丙";
- break;
- case "4":
- groupnow = "丁";
- break;
- }
- switch (shiftcode)
- {
- case "0":
- shiftnow = "常白班";
- break;
- case "1":
- shiftnow = "早班";
- break;
- case "2":
- shiftnow = "中班";
- break;
- case "3":
- shiftnow = "晚班";
- break;
- }
- if ((shift.Equals(shiftnow) || shift.Contains(shiftnow)) && (group.Equals(groupnow) || group.Contains(groupnow)))
- {
- result = false;
- }
- else
- {
- result = true;
- }
- if (shift.Equals("") && group.Equals(""))
- {
- result = false;
- }
- return result;
- }
- /// <summary>
- /// 连轧用判断班次班组
- /// </summary>
- /// <param name="shift"></param>
- /// <param name="group"></param>
- /// <returns></returns>
- public bool IsRackOperateRolling(string shift, string group)
- {
- bool result = false;
- string groupcode = UserInfo.GetUserGroup();
- string shiftcode = UserInfo.GetUserOrder();
- string shiftnow = "";
- string groupnow = "";
- switch (groupcode)
- {
- case "1":
- groupnow = "甲";
- break;
- case "2":
- groupnow = "乙";
- break;
- case "3":
- groupnow = "丙";
- break;
- case "4":
- groupnow = "丁";
- break;
- }
- switch (shiftcode)
- {
- case "0":
- shiftnow = "常白班";
- break;
- case "1":
- shiftnow = "早班";
- break;
- case "2":
- shiftnow = "中班";
- break;
- case "3":
- shiftnow = "夜班";
- break;
- }
- if ((shift.Equals(shiftnow) || shift.Contains(shiftnow)) && (group.Equals(groupnow) || group.Contains(groupnow)))
- {
- result = false;
- }
- else
- {
- result = true;
- }
- if (shift.Equals("") && group.Equals(""))
- {
- result = false;
- }
- return result;
- }
- /// <summary>
- /// 获取当前工序已剔除支数
- /// </summary>
- /// <param name="heatno">炉号</param>
- /// <param name="processno">工序号(0-锯切前 1-锯切后 2-加热炉 3-穿孔 4-连轧 5-再加热炉 6-定径 7-分切前 8-分切后 9矫直 10-探伤 11-人工质检)</param>
- /// <returns></returns>
- public int GetSlabNum(string heatno, string proPlanId, string gxPlanNo, int processno, OpeBase ob)
- {
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.zgmil.coup.EddyCurrentTestingResult";
- ccp.MethodName = "scrapMatCheck";
- ccp.ServerParams = new Object[] { heatno, processno, proPlanId, gxPlanNo };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- int ScrapNumBefore = Convert.ToInt32(ccp.ReturnInfo);
- return ScrapNumBefore;
- }
- /// <summary>
- /// 获取属性或值
- /// </summary>
- /// <returns></returns>
- public void GetItem()
- {
- }
- /// <summary>
- /// 将类中的属性及值存入字典中
- /// </summary>
- /// <typeparam name="T"></typeparam>
- /// <param name="?"></param>
- /// <returns></returns>
- public Dictionary<string, string> GetItem<T>(T t)
- {
- Dictionary<string, string> dic = new Dictionary<string, string>();
- System.Reflection.PropertyInfo[] pro = t.GetType().GetProperties();
- foreach (System.Reflection.PropertyInfo item in pro)
- {
- dic.Add(item.Name.ToString(), item.GetValue(t, null).ToString());
- }
- return dic;
- }
- /// <summary>
- /// 获取DataTable中的列名
- /// </summary>
- /// <param name="dt">DataTable</param>
- /// <returns></returns>
- public ArrayList[] GetDtItem(DataTable dt)
- {
- ArrayList[] str = null;
- if (dt.Columns.Count > 0)
- {
- str = new ArrayList[dt.Columns.Count];
- for (int i = 0; i < dt.Columns.Count; i++)
- {
- str[i].Add(dt.Columns[i].ColumnName);
- }
- }
- return str;
- }
- /// <summary>
- /// 调用后台方法
- /// </summary>
- /// <returns></returns>
- public void BackBusiness()
- {
- }
- /// <summary>
- /// 得到服务器时间
- /// </summary>
- public DateTime GetSeverTime()
- {
- DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.GetSeverTime", new object[] { }, this._ob);
- return DateTime.Parse(dt.Rows[0][0].ToString());
- }
- /// <summary>
- /// 调用后台方法,返回String类型值
- /// </summary>
- /// <param name="StrResult">需要查询的字段//</param>
- /// <param name="QueryCondition">条件</param>
- /// <param name="process">工序</param>
- /// <param name="process">表类型</param>
- /// <param name="method">方法</param>
- /// <returns></returns>
- //public string BackBusiness(string StrResult, ArrayList[] QueryCondition, ProcessChoose process,TableStytleChoose table, MethodChoose method)
- //{
- //}
- /// <summary>
- /// 调用后台方法返回表类型结果
- /// </summary>
- /// <param name="DtResult">返回结果</param>
- /// <param name="QueryCondition">条件</param>
- /// <param name="process">工序</param>
- /// <param name="table">表类型</param>
- /// <param name="method">方法</param>
- /// <returns></returns>
- //public DataTable BackBusiness(DataTable DtResult, ArrayList[] QueryCondition, ProcessChoose process, TableStytleChoose table,MethodChoose method)
- //{
- //}
- //public T GetSingleResult<T>()
- }
- }
|