Beispiel #1
0
 private PlatInfo Replat(int id)
 {
     try
     {
         dt = Myadapter_p.GetDataBy1(id);
         return(DataHelper.Dt2pl(dt));
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #2
0
        /// <summary>
        /// 输入检测类型,返回安排的检测平台号
        /// 有优先测表的情况下,普通表无法使用最后两台检测主机,优先表可以使用所有的检测主机
        /// </summary>
        /// <param name="number"></param>
        /// <returns></returns>
        private static string[] Plat_AnPai(int number, string type, bool ishavepri, bool isprivilege)
        {
            int count_p = CommonFunction.platInfos.Count;

            string[] result = new string[] { "空", "空", "空", "空" };
            if (ishavepri && !isprivilege)
            {
                count_p = Math.Max(0, count_p - 2);
            }
            try
            {
                switch (number)
                {
                case 1:
                    for (int i = 0; i < count_p; i++)
                    {
                        int id = CommonFunction.platInfos[i].id;
                        //根据id查询出一条platinfo的记录
                        DataTable dt   = Myadapter_p.GetDataBy1(id);
                        PlatInfo  temp = DataHelper.Dt2pl(dt);
                        if (temp.PlatComs.Equals("空闲") && IsAllow(temp))
                        {
                            temp.PlatComs = "准备";
                            result[0]     = id.ToString();
                            result[1]     = temp.IP;
                            result[2]     = temp.PlatComp;
                            result[3]     = "PlatComs";
                            // Myadapter_p.UpdatePlatCom(temp.PlatComs, id);
                            return(result);
                        }
                    }
                    break;

                case 2:
                    for (int i = 0; i < count_p; i++)
                    {
                        int id = CommonFunction.platInfos[i].id;
                        //根据id查询出一条platinfo的记录
                        DataTable dt   = Myadapter_p.GetDataBy1(id);
                        PlatInfo  temp = DataHelper.Dt2pl(dt);
                        if (temp.PlatIcs.Equals("空闲") && IsAllow(temp))
                        {
                            temp.PlatIcs = "准备";
                            result[0]    = id.ToString();
                            result[1]    = temp.IP;
                            result[2]    = temp.PlatIcp;
                            result[3]    = "PlatIcs";
                            // Myadapter_p.UpdatePlatIc(temp.PlatIcs, id);
                            return(result);
                        }
                    }
                    break;

                case 3:
                    for (int i = 0; i < count_p; i++)
                    {
                        int id = CommonFunction.platInfos[i].id;
                        //根据id查询出一条platinfo的记录
                        DataTable dt   = Myadapter_p.GetDataBy1(id);
                        PlatInfo  temp = DataHelper.Dt2pl(dt);
                        if (type.Equals("膜式表") || type.Equals("IC卡-膜式表"))
                        {
                            if (temp.PlatChus_msb.Equals("空闲") && IsAllow(temp))
                            {
                                //temp.PlatChus_msb = "准备";
                                result[0] = id.ToString();
                                result[1] = temp.IP;
                                result[2] = temp.PlatChup_msb;
                                result[3] = "PlatChus_msb";
                                //  Myadapter_p.UpdatePlatChu_msb(temp.PlatChus_msb, id);
                                return(result);
                            }
                        }
                        if (type.Equals("修正仪") || type.Equals("IC卡-修正仪"))
                        {
                            if (temp.PlatChus_xzy.Equals("空闲") && IsAllow(temp))
                            {
                                //temp.PlatChus_xzy = "准备";
                                result[0] = id.ToString();
                                result[1] = temp.IP;
                                result[2] = temp.PlatChup_xzy;
                                result[3] = "PlatChus_xzy";
                                // Myadapter_p.UpdatePlatChu_xzy(temp.PlatChus_xzy, id);
                                return(result);
                            }
                        }
                        if (type.Equals("超声波") || type.Equals("IC卡-超声波"))
                        {
                            if (temp.PlatChus_csb.Equals("空闲") && IsAllow(temp))
                            {
                                //temp.PlatChus_csb = "准备";
                                result[0] = id.ToString();
                                result[1] = temp.IP;
                                result[2] = temp.PlatChup_csb;
                                result[3] = "PlatChus_csb";
                                // Myadapter_p.UpdatePlatChu_csb(temp.PlatChus_csb, id);
                                return(result);
                            }
                        }
                    }
                    break;

                case 4:
                    for (int i = 0; i < count_p; i++)
                    {
                        int id = CommonFunction.platInfos[i].id;

                        //根据id查询出一条platinfo的记录
                        DataTable dt   = Myadapter_p.GetDataBy1(id);
                        PlatInfo  temp = DataHelper.Dt2pl(dt);
                        if (temp.PlatZhos.Equals("空闲") && IsAllow(temp))
                        {
                            //temp.PlatZhos = "准备";
                            result[0] = id.ToString();
                            result[1] = temp.IP;
                            result[2] = temp.PlatZhop;
                            result[3] = "PlatZhos";
                            // Myadapter_p.UpdatePlatZho(temp.PlatZhos, id);
                            return(result);
                        }
                    }
                    break;

                default:
                    break;
                }
            }
            catch (System.Exception e)
            {
                LogHelper.Error("分配时出错" + e);
            }
            return(result);
        }