示例#1
0
        /// <summary>
        /// 初始化默认计划
        /// </summary>
        /// <param name="names"></param>
        /// <param name="datetime"></param>
        /// <returns></returns>
        public static List <PlinePlanMDL> InitialPlans(string[]  names, DateTime datetime)
        {
            List <PlinePlanMDL> list = new List <PlinePlanMDL>();

            try
            {
                DateTime startTime = new DateTime();


                for (int i = 0; i < names.Length; i++)
                {
                    PlinePlanMDL mdl = new PlinePlanMDL();
                    mdl.SetPLANID(datetime, i + 1);

                    mdl.name  = "LINE " + names[i];
                    mdl.PLINE = (i + 1).ToString();
                    mdl.OP1   = 10;
                    startTime = new DateTime(DateTime.Now.Year,
                                             DateTime.Now.Month,
                                             DateTime.Now.Day, 8, 30, 0);

                    mdl.OP1_BEGIN   = startTime;
                    mdl.OP1_RANGE   = 12;
                    mdl.OP1_T       = 1;
                    mdl.OP2         = 10;
                    mdl.OP2_BEGIN   = startTime.AddHours(8);
                    mdl.OP2_RANGE   = 12;
                    mdl.OP2_T       = 2;
                    mdl.CREATE_TIME = DateTime.Now;
                    mdl.REMARK      = string.Empty;

                    list.Add(mdl);

                    System.Threading.Thread.Sleep(100);
                }

                return(list);
            }
            catch
            {
                throw;
            }
        }
示例#2
0
        /// <summary>
        /// 构造计划
        /// </summary>
        /// <param name="id"></param>
        /// <param name="time"></param>
        /// <returns></returns>
        public static PlinePlanMDL BuildedPlan(int id, DateTime time)
        {
            try
            {
                PlinePlanMDL mdl = new PlinePlanMDL();
                mdl.SetPLANID(time, id);

                mdl.name  = "LINE" + id.ToString();
                mdl.PLINE = id.ToString();
                //早班OP
                mdl.OP1 = 10;
                time    = new DateTime(DateTime.Now.Year,
                                       DateTime.Now.Month,
                                       DateTime.Now.Day, 8, 30, 0);

                mdl.OP1_BEGIN = time;
                mdl.OP1_RANGE = 10;
                mdl.OP1_T     = 1;

                string arrayOP = string.Empty;

                for (int i = 0; i < mdl.OP1_RANGE; i++)
                {
                    if (i == (mdl.OP1_RANGE - 1))
                    {
                        arrayOP += mdl.OP1.ToString();
                    }
                    else
                    {
                        arrayOP += mdl.OP1.ToString() + "-";
                    }
                }

                mdl.OP1_ITEMS = OPMDL.BuildOPInfo(mdl.PLINE, time, mdl.OP1_RANGE, arrayOP);

                //晚班OP
                mdl.OP2       = 10;
                mdl.OP2_BEGIN = time.AddHours(8);
                mdl.OP2_RANGE = 5;
                mdl.OP2_T     = 2;

                arrayOP = string.Empty;

                for (int i = 0; i < mdl.OP2_RANGE; i++)
                {
                    if (i == (mdl.OP2_RANGE - 1))
                    {
                        arrayOP += mdl.OP2.ToString();
                    }
                    else
                    {
                        arrayOP += mdl.OP2.ToString() + "-";
                    }
                }

                mdl.OP2_ITEMS = OPMDL.BuildOPInfo(mdl.PLINE, time, mdl.OP2_RANGE, arrayOP);

                mdl.CREATE_TIME = DateTime.Now;
                mdl.REMARK      = string.Empty;

                return(mdl);
            }
            catch
            {
                throw;
            }
        }
示例#3
0
        /// <summary>
        /// 初始化默认的产线计划
        /// </summary>
        /// <param name="id"></param>
        /// <param name="type"></param>
        /// <param name="time"></param>
        /// <returns></returns>
        public static PlinePlanMDL BuildDefualtPlan(int id, DateTime time)
        {
            try
            {
                XmlHelper helper       = new XmlHelper("App.xml");
                string    opsStr       = helper.SelectValue("/Root/APP/OP");
                string    rangeStr     = helper.SelectValue("/Root/APP/TempRange");
                string    beginTimeStr = helper.SelectValue("/Root/APP/TempDateTime");

                PlinePlanMDL mdl = new PlinePlanMDL();
                mdl.SetPLANID(time, id);

                mdl.name  = "LINE" + id.ToString();
                mdl.PLINE = id.ToString();

                string[] opItems   = opsStr.Split(',');
                string[] beginDate = beginTimeStr.Split(':');


                int op          = 21;
                int startHour   = 8;
                int startMinute = 30;
                int range       = 10;

                Int32.TryParse(opItems[0], out op);
                Int32.TryParse(beginDate[0], out startHour);
                Int32.TryParse(beginDate[1], out startMinute);

                //早班OP
                mdl.OP1 = op;


                time = new DateTime(DateTime.Now.Year,
                                    DateTime.Now.Month,
                                    DateTime.Now.Day, startHour, startMinute, 0);

                mdl.OP1_BEGIN = time;
                mdl.OP1_RANGE = range;
                mdl.OP1_T     = 1;

                string arrayOP = string.Empty;

                for (int i = 0; i < mdl.OP1_RANGE; i++)
                {
                    if (i == (mdl.OP1_RANGE - 1))
                    {
                        arrayOP += mdl.OP1.ToString();
                    }
                    else
                    {
                        arrayOP += mdl.OP1.ToString() + "-";
                    }
                }

                mdl.OP1_ITEMS = OPMDL.BuildOPInfo(mdl.PLINE, time, mdl.OP1_RANGE, arrayOP);



                Int32.TryParse(opItems[1], out op);
                //Int32.TryParse(beginDate[1], out startHour);
                //Int32.TryParse(beginDate[2], out startMinute);

                //晚班OP
                mdl.OP2       = op;
                mdl.OP2_BEGIN = time.AddHours(range);
                mdl.OP2_RANGE = 5;
                mdl.OP2_T     = 2;

                arrayOP = string.Empty;

                for (int i = 0; i < mdl.OP2_RANGE; i++)
                {
                    if (i == (mdl.OP2_RANGE - 1))
                    {
                        arrayOP += mdl.OP2.ToString();
                    }
                    else
                    {
                        arrayOP += mdl.OP2.ToString() + "-";
                    }
                }

                mdl.OP2_ITEMS = OPMDL.BuildOPInfo(mdl.PLINE, time, mdl.OP2_RANGE, arrayOP);

                mdl.CREATE_TIME = DateTime.Now;
                mdl.REMARK      = string.Empty;

                return(mdl);
            }
            catch
            {
                throw;
            }
        }