| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using CoreFS.CA06;
- using System.Data;
- using Core.Mes.Client.Comm.Server;
- using System.Collections;
- using Core.StlMes.Client.ZGMil.Entity;
- namespace Core.StlMes.Client.ZGMil.Common
- {
- class HOTMethod : FrmBase
- {
- private OpeBase _ob;
- public OpeBase OB
- {
- get { return _ob; }
- set { _ob = value; }
- }
- public HOTMethod(OpeBase ob)
- {
- OB = ob;
- }
- public HOTMethod()
- {
- // TODO: Complete member initialization
- }
- /// <summary>
- /// 判断炉号是否结炉
- /// </summary>
- /// <param name="JudgeStoveNo"></param>
- /// <param name="ProcessNo">0-锯切 1-加热炉 2-穿孔 3-连轧 4-再加热 5-定径 6-管排锯 7-矫直 8-探伤 9-质检</param>
- /// <returns></returns>
- public bool isNode(string JudgeStoveNo, string ResultNo, int ProcessNo, string PlineCode)
- {
- bool isnode = false;
- DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.isNode", new object[] { JudgeStoveNo, ResultNo, ProcessNo, PlineCode }, this._ob);
- if (dt.Rows.Count > 0)
- {
- if (dt.Rows[0][0].ToString() == "1")
- {
- isnode = true;
- }
- }
- return isnode;
- }
- /// <summary>
- /// 查询炉内是否有正在装炉或正在出炉的计划
- /// </summary>
- /// <param name="Falg">0-正在装炉,2-正在出炉</param>
- /// <param name="FurType">0-加热炉,2-再加热炉</param>
- /// <returns>isInOrOut true-有 false-没有 </returns>
- public DataTable InFurIsEnd(string Falg, string PlineCode, int FurType = 0)
- {
- DataTable dt = null;
- if (FurType == 0)
- {
- dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FurResult.getINFurNonEndIN", new object[] { Falg, PlineCode }, this._ob);
- }
- else
- {
- dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmReFurResult.getINFurNonEndIN", new object[] { Falg, PlineCode }, this._ob);
- }
- return dt;
- }
- /// <summary>
- /// 查询当前炉次炉内状态
- /// </summary>
- /// <param name="JudgeStoveNo"></param>
- /// <returns></returns>
- public DataTable InFurStatus(string JudgeStoveNo)
- {
- DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FurResult.getInFurStatus", new object[] { JudgeStoveNo }, this._ob);
- return dt;
- }
- /// <summary>
- /// 查询上个班班次班组
- /// 天管白夜两班制,天淮早中晚三班制
- /// </summary>
- /// <param name="Shift"></param>
- /// <param name="Group"></param>
- /// <returns></returns>
- public static string GetShiftBefore(string Shift, string Group, string Date, string PlineCode)
- {
- ArrayList ShiftList = new ArrayList();
- string ShiftBefore = "";
- string[] ShiftD = new string[4] { "甲", "乙", "丙", "丁" };
- int[] ShiftNo = new int[4] { 3, 0, 1, 2 }; //通过修改此数组得到指定日期的班组 起始点为2015年12月31日排班顺序
- int[] MouseDay = new int[13] { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 29 };
- int LoopCount = 0; //循环次数
- //算出当前日期与起始点相差天数
- int Days = 0;
- string DYear = Date.Substring(0, 4);
- for (int i = 2016; i < int.Parse(DYear); i++)
- {
- if (i % 4 == 0)
- {
- Days += 366;
- }
- else
- {
- Days += 365;
- }
- }
- string DMouse = Date.Substring(4, 2);
- for (int i = 1; i < int.Parse(DMouse); i++)
- {
- if (i == 2)
- {
- if (int.Parse(DYear) % 4 == 0)
- {
- Days += MouseDay[12];
- }
- else
- {
- Days += MouseDay[i - 1];
- }
- }
- else
- {
- Days += MouseDay[i - 1];
- }
- }
- string DDay = Date.Substring(6, 2);
- Days += int.Parse(DDay);
- if (Days > 0)
- {
- if (Days % 2 == 0)
- {
- LoopCount = (Days / 2) % 4;
- }
- else
- {
- LoopCount = ((Days - 1) / 2 + 1) % 4;
- }
- }
- ShiftNo[0] = (ShiftNo[0] + 4 - LoopCount) % 4;
- ShiftNo[1] = (ShiftNo[1] + 4 - LoopCount) % 4;
- ShiftNo[2] = (ShiftNo[2] + 4 - LoopCount) % 4;
- ShiftNo[3] = (ShiftNo[3] + 4 - LoopCount) % 4;
- ShiftList.Add(ShiftD[ShiftNo[0]]); //早
- ShiftList.Add(ShiftD[ShiftNo[1]]); //中
- ShiftList.Add(ShiftD[ShiftNo[2]]); //晚
- ShiftList.Add(ShiftD[ShiftNo[3]]); //休
- //ShiftList.Add//2016年 1月1日 1月2日 配班表
- if (PlineCode.Equals("C072"))
- {
- //早中晚三班制
- switch (Shift)
- {
- case "1":
- ShiftBefore = "3";
- break;
- case "2":
- ShiftBefore = "1";
- break;
- case "3":
- ShiftBefore = "2";
- break;
- }
- if (Shift == "1")
- {
- switch (ShiftList[2].ToString())
- {
- case "甲":
- ShiftBefore += "1";
- break;
- case "乙":
- ShiftBefore += "2";
- break;
- case "丙":
- ShiftBefore += "3";
- break;
- case "丁":
- ShiftBefore += "4";
- break;
- }
- }
- else
- {
- for (int i = 0; i < ShiftNo.Count(); i++)
- {
- if (ShiftNo[i] == int.Parse(Group) - 1)
- {
- ShiftBefore += (int.Parse((ShiftNo[(i + 3) % 4]).ToString()) + 1).ToString();
- }
- }
- }
- }
- else
- {
- //白夜两班制
- switch (Shift)
- {
- case "3":
- ShiftBefore = "0";
- switch (Group)
- {
- case "1":
- ShiftBefore += "4";
- break;
- case "2":
- ShiftBefore += "1";
- break;
- case "3":
- ShiftBefore += "2";
- break;
- case "4":
- ShiftBefore += "3";
- break;
- }
- break;
- case "0":
- ShiftBefore = "3";
- switch (Group)
- {
- case "1":
- ShiftBefore += "3";
- break;
- case "2":
- ShiftBefore += "4";
- break;
- case "3":
- ShiftBefore += "1";
- break;
- case "4":
- ShiftBefore += "2";
- break;
- }
- break;
- }
-
- }
-
-
- return ShiftBefore;
- }
- /// <summary>
- /// 查询上个班班次班组
- /// </summary>
- /// <param name="Shift">当前班次</param>
- /// <param name="Group">当前班组</param>
- /// // <param name="Flag">0-上道班次 班组 1-下道班次班组</param>
- /// <param name="Date"></param>
- /// <returns></returns>
- public static string GetShiftBefore(string Shift, string Group, string Date)
- {
- ArrayList ShiftList = new ArrayList();
- string ShiftBefore = "";
- string[] ShiftD = new string[4] { "甲", "乙", "丙", "丁" };
- int[] ShiftNo = new int[4] { 3, 0, 1, 2 }; //通过修改此数组得到指定日期的班组 起始点为2015年12月31日排班顺序
- int[] MouseDay = new int[13] { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 29 };
- int LoopCount = 0; //循环次数
- //算出当前日期与起始点相差天数
- int Days = 0;
- string DYear = Date.Substring(0, 4);
- for (int i = 2016; i < int.Parse(DYear); i++)
- {
- if (i % 4 == 0)
- {
- Days += 366;
- }
- else
- {
- Days += 365;
- }
- }
- string DMouse = Date.Substring(4, 2);
- for (int i = 1; i < int.Parse(DMouse); i++)
- {
- if (i == 2)
- {
- if (int.Parse(DYear) % 4 == 0)
- {
- Days += MouseDay[12];
- }
- else
- {
- Days += MouseDay[i - 1];
- }
- }
- else
- {
- Days += MouseDay[i - 1];
- }
- }
- string DDay = Date.Substring(6, 2);
- Days += int.Parse(DDay);
- if (Days > 0)
- {
- if (Days % 2 == 0)
- {
- LoopCount = (Days / 2) % 4;
- }
- else
- {
- LoopCount = ((Days - 1) / 2 + 1) % 4;
- }
- }
- ShiftNo[0] = (ShiftNo[0] + 4 - LoopCount) % 4;
- ShiftNo[1] = (ShiftNo[1] + 4 - LoopCount) % 4;
- ShiftNo[2] = (ShiftNo[2] + 4 - LoopCount) % 4;
- ShiftNo[3] = (ShiftNo[3] + 4 - LoopCount) % 4;
- ShiftList.Add(ShiftD[ShiftNo[0]]); //早
- ShiftList.Add(ShiftD[ShiftNo[1]]); //中
- ShiftList.Add(ShiftD[ShiftNo[2]]); //晚
- ShiftList.Add(ShiftD[ShiftNo[3]]); //休
- //ShiftList.Add//2016年 1月1日 1月2日 配班表
- switch (Shift)
- {
- case "1":
- ShiftBefore = "3";
- break;
- case "2":
- ShiftBefore = "1";
- break;
- case "3":
- ShiftBefore = "2";
- break;
- }
- if (Shift == "1")
- {
- switch (ShiftList[2].ToString())
- {
- case "甲":
- ShiftBefore += "1";
- break;
- case "乙":
- ShiftBefore += "2";
- break;
- case "丙":
- ShiftBefore += "3";
- break;
- case "丁":
- ShiftBefore += "4";
- break;
- }
- }
- else
- {
- for (int i = 0; i < ShiftNo.Count(); i++)
- {
- if (ShiftNo[i] == int.Parse(Group) - 1)
- {
- ShiftBefore += (int.Parse((ShiftNo[(i + 3) % 4]).ToString()) + 1).ToString();
- }
- }
- }
- return ShiftBefore;
- }
- /// <summary>
- /// 查询下个班班次班组
- /// </summary>
- /// <param name="Shift">当前班次</param>
- /// <param name="Group">当前班组</param>
- /// <param name="Date"></param>
- /// <returns></returns>
- public static string GetShiftAfter(string Shift, string Group, string Date)
- {
- ArrayList ShiftList = new ArrayList();
- string ShiftAfter = "";
- string[] ShiftD = new string[4] { "甲", "乙", "丙", "丁" };
- int[] ShiftNo = new int[4] { 3, 0, 1, 2 }; //通过修改此数组得到指定日期的班组 起始点为2015年12月31日排班顺序
- int[] MouseDay = new int[13] { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 29 };
- int LoopCount = 0; //循环次数
- //算出当前日期与起始点相差天数
- int Days = 0;
- string DYear = Date.Substring(0, 4);
- for (int i = 2016; i < int.Parse(DYear); i++)
- {
- if (i % 4 == 0)
- {
- Days += 366;
- }
- else
- {
- Days += 365;
- }
- }
- string DMouse = Date.Substring(4, 2);
- for (int i = 1; i < int.Parse(DMouse); i++)
- {
- if (i == 2)
- {
- if (int.Parse(DYear) % 4 == 0)
- {
- Days += MouseDay[12];
- }
- else
- {
- Days += MouseDay[i - 1];
- }
- }
- else
- {
- Days += MouseDay[i - 1];
- }
- }
- string DDay = Date.Substring(6, 2);
- Days += int.Parse(DDay);
- if (Days > 0)
- {
- if (Days % 2 == 0)
- {
- LoopCount = (Days / 2) % 4;
- }
- else
- {
- LoopCount = ((Days - 1) / 2 + 1) % 4;
- }
- }
- ShiftNo[0] = (ShiftNo[0] + 4 - LoopCount) % 4;
- ShiftNo[1] = (ShiftNo[1] + 4 - LoopCount) % 4;
- ShiftNo[2] = (ShiftNo[2] + 4 - LoopCount) % 4;
- ShiftNo[3] = (ShiftNo[3] + 4 - LoopCount) % 4;
- ShiftList.Add(ShiftD[ShiftNo[0]]); //早
- ShiftList.Add(ShiftD[ShiftNo[1]]); //中
- ShiftList.Add(ShiftD[ShiftNo[2]]); //晚
- ShiftList.Add(ShiftD[ShiftNo[3]]); //休
- //ShiftList.Add//2016年 1月1日 1月2日 配班表
- switch (Shift)
- {
- case "1":
- ShiftAfter = "2";
- break;
- case "2":
- ShiftAfter = "3";
- break;
- case "3":
- ShiftAfter = "1";
- break;
- }
- if (Shift == "3")
- {
- switch (ShiftList[0].ToString())
- {
- case "甲":
- ShiftAfter += "1";
- break;
- case "乙":
- ShiftAfter += "2";
- break;
- case "丙":
- ShiftAfter += "3";
- break;
- case "丁":
- ShiftAfter += "4";
- break;
- }
- }
- else
- {
- for (int i = 0; i < ShiftNo.Count(); i++)
- {
- if (ShiftNo[i] == int.Parse(Group) - 1)
- {
- ShiftAfter += ((int.Parse((ShiftNo[(i + 3) % 4]).ToString()) + 3)%4).ToString();
- }
- }
- }
- return ShiftAfter;
- }
- /// <summary>
- /// 修改交班标识
- /// <param name="ProcessNo">0-锯切 1-加热炉 2-穿孔 3-连轧 4-再加热 5-定径 6-管排锯 7-矫直 8-探伤 9-质检</param>
- /// <param name="FurFlag">0-入炉 1-出炉</param>
- /// </summary>
- public void UpdateChangeFlag(string JudgeStvoeNo, string ResultNo, string FeedRowNo, int ProcessNo, int Seq, int FurFlag)
- {
- int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.UpdateChangeFlag", new object[] { JudgeStvoeNo, ResultNo, FeedRowNo, ProcessNo, Seq, FurFlag }, this._ob);
- }
- /// <summary>
- /// 查询待接班确认Seq
- /// <param name="ProcessNo">0-锯切 1-加热炉 2-穿孔 3-连轧 4-再加热 5-定径 6-管排锯 7-矫直 8-探伤 9-质检</param>
- /// </summary>
- public int GetWaitChangeSeq(string JudgeStvoeNo, string ResultNo, string FeedRowNo, int ProcessNo, int FurFlag, string proPlanId, string gxPlanNo)
- {
- int Seq = 0;
- DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.GetWaitChangeSeq", new object[] { JudgeStvoeNo, ResultNo, FeedRowNo, ProcessNo, FurFlag, proPlanId, gxPlanNo }, this._ob);
- if (dt.Rows.Count > 0)
- {
- Seq = int.Parse(dt.Rows[0][0].ToString());
- }
- return Seq;
- }
- /// <summary>
- /// 结炉前判断是否有待交班确认的管
- /// </summary>
- /// <param name="JudgeStoveNo"></param>
- /// <param name="ResultNo"></param>
- /// <param name="ProcessNo">工序号 0-锯切 1-环形加热炉 2-穿孔 3-连轧 4-再加热炉 5-定径 6-管排锯 7-矫直 8-探伤 9-质检</param>
- /// <returns></returns>
- public int NodeGetWaitChangeMat(string JudgeStoveNo, string ResultNo, int ProcessNo)
- {
- int MatNo = 0;
- DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.NodeGetWaitChangeMat", new object[] { JudgeStoveNo, ResultNo, ProcessNo }, this._ob);
- if (dt.Rows.Count > 0)
- {
- MatNo = int.Parse(dt.Rows[0][0].ToString());
- }
- return MatNo;
- }
- /// <summary>
- /// 查询当班是否有完成的炉次
- /// </summary>
- /// <param name="Group"></param>
- /// <param name="Shift"></param>
- /// <returns>Result 0-未完成 1-已完成</returns>
- public int IsFirstFur(string DateTime, string Group, string Shift)
- {
- int Result = 0;
- return Result;
- }
- /// <summary>
- /// 查询是否已经接班登录
- /// </summary>
- /// <param name="StartTime"></param>
- /// <param name="EndTime"></param>
- /// <param name="Shift"></param>
- /// <param name="Group"></param>
- /// <param name="ProcessNo">工序号(0-锯切 1-加热炉 2-穿孔 3-连轧 4-再加热炉 5-定径 6-分切 7矫直 8-探伤 9-人工质检) </param>
- /// <param name="PlineCode"></param>
- /// <returns></returns>
- public bool IsChanged(string StartTime, string EndTime, string Shift, string Group, string ProcessNo, string PlineCode)
- {
- bool Result = false;
- DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.GetIsChanged", new object[] { StartTime, EndTime, Shift, Group, ProcessNo, PlineCode }, this._ob);
- if (dt.Rows.Count > 0)
- {
- Result = true;
- }
- return Result;
- }
- /// <summary>
- /// 接班后插入履历
- /// </summary>
- /// <param name="StartTime"></param>
- /// <param name="EndTime"></param>
- /// <param name="Shift"></param>
- /// <param name="Group"></param>
- /// <param name="ProcessNo">工序号(0-锯切 1-加热炉 2-穿孔 3-连轧 4-再加热炉 5-定径 6-分切 7矫直 8-探伤 9-人工质检) </param>
- /// <param name="PlineCode"></param>
- /// <returns></returns>
- public void InsertChangeRemuse(string Shift, string Group, string User, string ProcessNo, string PlineCode)
- {
- ArrayList arry = new ArrayList();
- arry.Add(Shift);
- arry.Add(Group);
- arry.Add(User);
- arry.Add(ProcessNo);
- arry.Add(PlineCode);
- //bool Result = false;
- //string time = DateTime.Now.ToString();
- //int dt = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.InsertChangeRemuse", new object[] {arry }, this._ob);
- //if (dt.Rows.Count > 0)
- //{
- // Result = true;
- //}
- }
- /// <summary>
- /// 获取前道班UserID
- /// </summary>
- /// <param name="StartTime">开始时间</param>
- /// <param name="EndTime">结束时间</param>
- /// <param name="Shift">前道班次</param>
- /// <param name="Group">前道班组</param>
- /// <param name="ProcessNo">工序号</param>
- /// <returns>UserID</returns>
- public string GetUserIDBefore(string StartTime, string EndTime, string Shift, string Group, int ProcessNo, string PlineCode)
- {
- string UserID = "";
- DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.GetUserIDBefore", new object[] { StartTime, EndTime, Shift, Group, ProcessNo, PlineCode }, this._ob);
- if (dt.Rows.Count > 0)
- {
- UserID = dt.Rows[0][0].ToString();
- }
- return UserID;
- }
- }
- }
|