Exemplo n.º 1
0
        /// <summary>
        /// 创建List.lis文件
        /// </summary>
        /// <param name="path"></param>
        /// <param name="Content"></param>
        private static void CreateListlis(string path, string Content)
        {
            string LisContent = string.Empty;

            WriteDataToFile.WriteFile(path, Content + ";");
            if (File.Exists(path))
            {
                LisContent = WriteDataToFile.ReadFile(path);
            }
            string JustLisContent = LisContent.Remove(0, 2);

            string[]      tempdata = JustLisContent.Split(';');
            List <string> list     = new List <string>();

            list.Clear();
            for (int i = 0; i < tempdata.Length - 1; i++) //遍历数组成员
            {
                if (list.IndexOf(tempdata[i]) == -1)      //对每个成员做一次新数组查询如果没有相等的则加到新数组
                {
                    list.Add(tempdata[i]);
                }
            }
            WriteDataToFile.FileBaseDeel(path, MyFileMode.Clear);
            string[] tda     = list.ToArray();
            string   outdata = string.Empty;

            foreach (string a in tda)
            {
                outdata += (a + ";");
            }
            WriteDataToFile.WriteFile(path, NumCorrection.KeepNum(NumCorrection.Ten2Hex(list.Count.ToString()),
                                                                  2, HeadOrTail.Head) + outdata);
            // WriteDataToFile.UpadataStringOfFile(path, 0, NumCorrection.KeepNum(num.ToString(), 2, HeadOrTail.Head));
        }
Exemplo n.º 2
0
        public string CreateTrans(JobList job)
        {
            TransformerWindingConfigStruct wt = job.Transformer.WindingConfig;
            int PhyNum = job.Transformer.PhaseNum;

            string TransName = NumCorrection.KeepNumSpace(job.Transformer.SerialNo, 64, HeadOrTail.Tail);
            string TransID   = NumCorrection.KeepNumSpace(job.Transformer.ID.ToString(), 10, HeadOrTail.Tail);
            string PhyNumStr = string.Empty;

            if (PhyNum == 2)
            {
                PhyNumStr = "01";
            }
            else
            {
                PhyNumStr = "00";
            }
            string WindConFig = ParsingWindConfig(job);//2/3
            string KindNum    = ParsingWingKing(job);
            string HTamMessage;

            if (job.Transformer.OLTC.WindingPosition == WindingType.HV)
            {
                HTamMessage = ParsingNum(job.Transformer.OLTC.TapNum) +
                              ParsingNum(job.Transformer.OLTC.TapMainNum) + "00" +
                              NumCorrection.DoubleToHexNum(job.Transformer.OLTC.Step);
            }
            else
            {
                HTamMessage = "0000000000";
            }
            string MTamMessage;

            if (job.Transformer.OLTC.WindingPosition == WindingType.MV)
            {
                MTamMessage = ParsingNum(job.Transformer.OLTC.TapNum) +
                              ParsingNum(job.Transformer.OLTC.TapMainNum) + "00" +
                              NumCorrection.DoubleToHexNum(job.Transformer.OLTC.Step);
            }
            else
            {
                MTamMessage = "0000000000";
            }
            //job.Transformer.OLTC.Step==0.0124;
            string p1            = NumCorrection.Ten2Hex(((job.Transformer.PowerRating.HV) * 1000).ToString());
            string p2            = NumCorrection.Ten2Hex(((job.Transformer.PowerRating.MV) * 1000).ToString());
            string p3            = NumCorrection.Ten2Hex(((job.Transformer.PowerRating.LV) * 1000).ToString());
            string PowerRating   = NumCorrection.KeepNum(p1, 8, HeadOrTail.Head) + NumCorrection.KeepNum(p2, 8, HeadOrTail.Head) + NumCorrection.KeepNum(p3, 8, HeadOrTail.Head);
            string v1            = NumCorrection.Ten2Hex(((job.Transformer.VoltageRating.HV) * 1000).ToString());
            string v2            = NumCorrection.Ten2Hex(((job.Transformer.VoltageRating.MV) * 1000).ToString());
            string v3            = NumCorrection.Ten2Hex(((job.Transformer.VoltageRating.LV) * 1000).ToString());
            string VoltageRating = NumCorrection.KeepNum(v1, 8, HeadOrTail.Head) + NumCorrection.KeepNum(v2, 8, HeadOrTail.Head) + NumCorrection.KeepNum(v3, 8, HeadOrTail.Head);

            return(TransName + TransID + PhyNumStr
                   + WindConFig + KindNum + HTamMessage + MTamMessage + PowerRating + VoltageRating);
            //  string
        }
Exemplo n.º 3
0
 public string ParsingNum(int Num)
 {
     if (Num >= 0 && Num < 16)
     {
         return("0" + NumCorrection.Ten2Hex(Num.ToString()));
     }
     if (Num >= 16 && Num < 255)
     {
         return(NumCorrection.Ten2Hex(Num.ToString()));
     }
     else
     {
         return("11");
     }
 }
Exemplo n.º 4
0
        public string CreateTestList()
        {
            #region Enable
            string[] TestNum = new string[8];
            if (rc.CaPaNumEnable == true)
            {
                TestNum[0] = "01";
            }
            else
            {
                TestNum[0] = "00";
            }
            if (rc.DcReNumEnable == true)
            {
                TestNum[2] = "01";
            }
            else
            {
                TestNum[2] = "00";
            }
            if (rc.DcInNUmEnable == true)
            {
                TestNum[1] = "01";
            }
            else
            {
                TestNum[1] = "00";
            }
            if (rc.OltcNumEnable == true)
            {
                TestNum[3] = "01";
            }
            else
            {
                TestNum[3] = "00";
            }
            TestNum[4] = "00";
            TestNum[5] = "00";
            TestNum[6] = "00";
            TestNum[7] = "00";
            #endregion
            string TestListTask = CreateSortTest();
            int    TestCount    = res.Count + dci.Count + cap.Count + Oltc.Count;

            return(NumCorrection.KeepNum(NumCorrection.Ten2Hex(TestCount.ToString()), 2, HeadOrTail.Head) + string.Join("", TestNum) + TestListTask);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 将四个功能的测量等功能写入文件
        /// </summary>
        /// <param name="respath"></param>
        /// <param name="dcipath"></param>
        /// <param name="cappath"></param>
        /// <param name="oltcpath"></param>
        private static void CreateWorkList(string respath, string dcipath, string cappath, string oltcpath)
        {
            var    result    = UseUpanDoWork.LocalUsb.ReturnTestResult();
            string dciComman = NumCorrection.KeepNum(NumCorrection.Ten2Hex(result[0].dci.Count().ToString()),
                                                     2, HeadOrTail.Head) + string.Join("", result[0].dci);
            string resComman = NumCorrection.KeepNum(NumCorrection.Ten2Hex(result[0].res.Count().ToString()),
                                                     2, HeadOrTail.Head) + string.Join("", result[0].res);
            string capComman = NumCorrection.KeepNum(NumCorrection.Ten2Hex(result[0].cap.Count().ToString()),
                                                     2, HeadOrTail.Head) + string.Join("", result[0].cap);
            string oltcComman = NumCorrection.KeepNum(NumCorrection.Ten2Hex(result[0].oltc.Count().ToString()),
                                                      2, HeadOrTail.Head) + string.Join("", result[0].oltc);

            if (dciComman.Length != 2)
            {
                WriteDataToFile.WriteFile(dcipath, dciComman);
            }
            else
            {
                WriteDataToFile.WriteFile(dcipath, "");
            }
            if (resComman.Length != 2)
            {
                WriteDataToFile.WriteFile(respath, resComman);
            }
            else
            {
                WriteDataToFile.WriteFile(respath, "");
            }
            if (capComman.Length != 2)
            {
                WriteDataToFile.WriteFile(cappath, capComman);
            }
            else
            {
                WriteDataToFile.WriteFile(cappath, "");
            }
            if (oltcComman.Length != 2)
            {
                WriteDataToFile.WriteFile(oltcpath, oltcComman);
            }
            else
            {
                WriteDataToFile.WriteFile(oltcpath, "");
            }
        }
Exemplo n.º 6
0
        private string CreateSortTest()
        {
            string[] NeedSortBuffet = new string[res1.Count + cap1.Count + dci1.Count + Oltc1.Count];
            if (res1 != null)
            {
                for (int i = 0; i < res1.Count; i++)
                {
                    if (NumCorrection.GetNumForstring(res1[i]) >= 0)
                    {
                        string TaskKind    = "03";
                        string TaskNum     = NumCorrection.KeepNum(NumCorrection.Ten2Hex(i.ToString()), 2, HeadOrTail.Head);//resisitance 对应任务号
                        string DcresEnable = "01";
                        NeedSortBuffet[NumCorrection.GetNumForstring(res1[i])] = TaskKind + TaskNum + DcresEnable;
                    }
                }
            }
            if (cap1 != null)
            {
                for (int i = 0; i < cap1.Count; i++)
                {
                    if (NumCorrection.GetNumForstring(cap1[i]) >= 0)
                    {
                        string TaskKind    = "01";
                        string TaskNum     = NumCorrection.KeepNum(NumCorrection.Ten2Hex(i.ToString()), 2, HeadOrTail.Head);//resisitance 对应任务号
                        string DcresEnable = "01";
                        NeedSortBuffet[NumCorrection.GetNumForstring(cap1[i])] = TaskKind + TaskNum + DcresEnable;

                        // NeedSortBuffet[NumCorrection.GetNumForstring(cap1[i])] = cap[i];
                    }
                }
            }
            if (dci1 != null)
            {
                for (int i = 0; i < dci1.Count; i++)
                {
                    if (NumCorrection.GetNumForstring(dci1[i]) >= 0)
                    {
                        string TaskKind    = "02";
                        string TaskNum     = NumCorrection.KeepNum(NumCorrection.Ten2Hex(i.ToString()), 2, HeadOrTail.Head);//resisitance 对应任务号
                        string DcresEnable = "01";
                        NeedSortBuffet[NumCorrection.GetNumForstring(dci1[i])] = TaskKind + TaskNum + DcresEnable;
                        //  NeedSortBuffet[NumCorrection.GetNumForstring(dci1[i])] = dci[i];
                    }
                }
            }
            if (Oltc1 != null)
            {
                for (int i = 0; i < Oltc1.Count; i++)
                {
                    if (NumCorrection.GetNumForstring(Oltc1[i]) >= 0)
                    {
                        string TaskKind    = "04";
                        string TaskNum     = NumCorrection.KeepNum(NumCorrection.Ten2Hex(i.ToString()), 2, HeadOrTail.Head);//resisitance 对应任务号
                        string DcresEnable = "01";
                        NeedSortBuffet[NumCorrection.GetNumForstring(Oltc1[i])] = TaskKind + TaskNum + DcresEnable;
                        // NeedSortBuffet[NumCorrection.GetNumForstring(Oltc1[i])] = Oltc[i];
                    }
                }
            }
            for (int i = 0; i < NeedSortBuffet.Length; i++)
            {
                if (NeedSortBuffet[i] == null)
                {
                    NeedSortBuffet[i] = "00";
                }
            }
            return(string.Join("", NeedSortBuffet));
        }