| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082 |
- 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 System.Net;
- namespace Core.StlMes.Client.YdmStuffManage.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)
- {
- 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 }, 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] { "" };
- }
- }
- 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)
- {
- int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.DeleteSlabSeq", new Object[] { heatno, seq, processno, Num, DBNum, "0" }, this._ob);
- return count;
- }
- public int DeleteFeedSlabSeq(string heatno, string feedrowno, string seq, int processno, int Num, int DBNum)
- {
- int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.DeleteFeedSlabSeq", new Object[] { heatno, feedrowno, seq, processno, Num, DBNum, "0" }, 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)
- {
- int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.DeleteSlabSeq", new Object[] { heatno, seq, processno, Num, DBNum, Colno }, 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)
- {
- //方法未针对矫直探伤 进行分台, 需要重写
- 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 }, 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 }, 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 }, 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 }, 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 }, 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 }, 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)
- {
- int seq = 0;
- DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.GetWaitChangeSeq", new object[] { heatno, resultno, processno, colno }, 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)
- {
- 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 }, 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)
- {
- 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 }, 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 }, this._ob);
- }
- else
- {
- DataTable dtchangnumhas = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.GetChangeShiftBackNum", new object[] { JudgeStoveNo, ResultNo, PLineCode, Shift, Group, process, colno }, 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 }, 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 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" }, 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" }, 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" }, 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" }, 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" }, this._ob);
- }
- else
- {
- count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.ChangeShiftBackForLastInFur", new object[] { JudgeStoveNo, ResultNo, PLineCode, Shift, Group, process, changnumhas, changnumhasInfur, "0" }, this._ob);
- }
- }
- }
- return count;
- }
- public int NodeBack(string JudgeStoveNo, string ResultNo, string PLineCode, int process, string colno)
- {
- //适用矫直探伤
- int count = 0;
- string seq = "";
- DataTable dtchangflag = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.NodeBackGetMaxChangFlag", new object[] { JudgeStoveNo, ResultNo, process, colno }, 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 }, 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, 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 };
- 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>
- /// 获取产线
- /// </summary>
- /// <param name="arr1"></param>
- /// <returns></returns>
- public string[] GetPlineCode(string[] arr1)
- {
- string[] arr = null;
- DataTable dt = ServerHelper.GetData("Core.LgMes.Server.Common.ComBaseInfo.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] { "" };
- }
- }
- /// <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>()
- }
- }
|